Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Generated by gdbus-codegen 2.40.2. DO NOT EDIT. |
| 3 | * |
| 4 | * The license of this code is the same as for the source it was derived from. |
| 5 | */ |
| 6 | |
| 7 | #ifdef HAVE_CONFIG_H |
| 8 | # include "config.h" |
| 9 | #endif |
| 10 | |
| 11 | #include "interfaces/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.Occ |
| 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * SECTION:Occ |
| 158 | * @title: Occ |
| 159 | * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface |
| 160 | * |
| 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface in C. |
| 162 | */ |
| 163 | |
| 164 | /* ---- Introspection data for org.openbmc.Occ ---- */ |
| 165 | |
| 166 | static const _ExtendedGDBusMethodInfo _occ_method_info_init = |
| 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "init", |
| 171 | NULL, |
| 172 | NULL, |
| 173 | NULL |
| 174 | }, |
| 175 | "handle-init", |
| 176 | FALSE |
| 177 | }; |
| 178 | |
| 179 | static const _ExtendedGDBusMethodInfo _occ_method_info_collect = |
| 180 | { |
| 181 | { |
| 182 | -1, |
| 183 | (gchar *) "collect", |
| 184 | NULL, |
| 185 | NULL, |
| 186 | NULL |
| 187 | }, |
| 188 | "handle-collect", |
| 189 | FALSE |
| 190 | }; |
| 191 | |
| 192 | static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] = |
| 193 | { |
| 194 | &_occ_method_info_init, |
| 195 | &_occ_method_info_collect, |
| 196 | NULL |
| 197 | }; |
| 198 | |
| 199 | static const _ExtendedGDBusPropertyInfo _occ_property_info_state = |
| 200 | { |
| 201 | { |
| 202 | -1, |
| 203 | (gchar *) "state", |
| 204 | (gchar *) "s", |
| 205 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 206 | NULL |
| 207 | }, |
| 208 | "state", |
| 209 | FALSE |
| 210 | }; |
| 211 | |
| 212 | static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval = |
| 213 | { |
| 214 | { |
| 215 | -1, |
| 216 | (gchar *) "poll_interval", |
| 217 | (gchar *) "i", |
| 218 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 219 | NULL |
| 220 | }, |
| 221 | "poll-interval", |
| 222 | FALSE |
| 223 | }; |
| 224 | |
| 225 | static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] = |
| 226 | { |
| 227 | &_occ_property_info_state, |
| 228 | &_occ_property_info_poll_interval, |
| 229 | NULL |
| 230 | }; |
| 231 | |
| 232 | static const _ExtendedGDBusInterfaceInfo _occ_interface_info = |
| 233 | { |
| 234 | { |
| 235 | -1, |
| 236 | (gchar *) "org.openbmc.Occ", |
| 237 | (GDBusMethodInfo **) &_occ_method_info_pointers, |
| 238 | NULL, |
| 239 | (GDBusPropertyInfo **) &_occ_property_info_pointers, |
| 240 | NULL |
| 241 | }, |
| 242 | "occ", |
| 243 | }; |
| 244 | |
| 245 | |
| 246 | /** |
| 247 | * occ_interface_info: |
| 248 | * |
| 249 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface. |
| 250 | * |
| 251 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 252 | */ |
| 253 | GDBusInterfaceInfo * |
| 254 | occ_interface_info (void) |
| 255 | { |
| 256 | return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * occ_override_properties: |
| 261 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 262 | * @property_id_begin: The property id to assign to the first overridden property. |
| 263 | * |
| 264 | * Overrides all #GObject properties in the #Occ interface for a concrete class. |
| 265 | * The properties are overridden in the order they are defined. |
| 266 | * |
| 267 | * Returns: The last property id. |
| 268 | */ |
| 269 | guint |
| 270 | occ_override_properties (GObjectClass *klass, guint property_id_begin) |
| 271 | { |
| 272 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 273 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 274 | return property_id_begin - 1; |
| 275 | } |
| 276 | |
| 277 | |
| 278 | |
| 279 | /** |
| 280 | * Occ: |
| 281 | * |
| 282 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. |
| 283 | */ |
| 284 | |
| 285 | /** |
| 286 | * OccIface: |
| 287 | * @parent_iface: The parent interface. |
| 288 | * @handle_collect: Handler for the #Occ::handle-collect signal. |
| 289 | * @handle_init: Handler for the #Occ::handle-init signal. |
| 290 | * @get_poll_interval: Getter for the #Occ:poll-interval property. |
| 291 | * @get_state: Getter for the #Occ:state property. |
| 292 | * |
| 293 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. |
| 294 | */ |
| 295 | |
| 296 | typedef OccIface OccInterface; |
| 297 | G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT); |
| 298 | |
| 299 | static void |
| 300 | occ_default_init (OccIface *iface) |
| 301 | { |
| 302 | /* GObject signals for incoming D-Bus method calls: */ |
| 303 | /** |
| 304 | * Occ::handle-init: |
| 305 | * @object: A #Occ. |
| 306 | * @invocation: A #GDBusMethodInvocation. |
| 307 | * |
| 308 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method. |
| 309 | * |
| 310 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call occ_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 311 | * |
| 312 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 313 | */ |
| 314 | g_signal_new ("handle-init", |
| 315 | G_TYPE_FROM_INTERFACE (iface), |
| 316 | G_SIGNAL_RUN_LAST, |
| 317 | G_STRUCT_OFFSET (OccIface, handle_init), |
| 318 | g_signal_accumulator_true_handled, |
| 319 | NULL, |
| 320 | g_cclosure_marshal_generic, |
| 321 | G_TYPE_BOOLEAN, |
| 322 | 1, |
| 323 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 324 | |
| 325 | /** |
| 326 | * Occ::handle-collect: |
| 327 | * @object: A #Occ. |
| 328 | * @invocation: A #GDBusMethodInvocation. |
| 329 | * |
| 330 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method. |
| 331 | * |
| 332 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call occ_complete_collect() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 333 | * |
| 334 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 335 | */ |
| 336 | g_signal_new ("handle-collect", |
| 337 | G_TYPE_FROM_INTERFACE (iface), |
| 338 | G_SIGNAL_RUN_LAST, |
| 339 | G_STRUCT_OFFSET (OccIface, handle_collect), |
| 340 | g_signal_accumulator_true_handled, |
| 341 | NULL, |
| 342 | g_cclosure_marshal_generic, |
| 343 | G_TYPE_BOOLEAN, |
| 344 | 1, |
| 345 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 346 | |
| 347 | /* GObject properties for D-Bus properties: */ |
| 348 | /** |
| 349 | * Occ:state: |
| 350 | * |
| 351 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>. |
| 352 | * |
| 353 | * 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. |
| 354 | */ |
| 355 | g_object_interface_install_property (iface, |
| 356 | g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 357 | /** |
| 358 | * Occ:poll-interval: |
| 359 | * |
| 360 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>. |
| 361 | * |
| 362 | * 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. |
| 363 | */ |
| 364 | g_object_interface_install_property (iface, |
| 365 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * occ_get_state: (skip) |
| 370 | * @object: A #Occ. |
| 371 | * |
| 372 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property. |
| 373 | * |
| 374 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 375 | * |
| 376 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use occ_dup_state() if on another thread.</warning> |
| 377 | * |
| 378 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 379 | */ |
| 380 | const gchar * |
| 381 | occ_get_state (Occ *object) |
| 382 | { |
| 383 | return OCC_GET_IFACE (object)->get_state (object); |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * occ_dup_state: (skip) |
| 388 | * @object: A #Occ. |
| 389 | * |
| 390 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property. |
| 391 | * |
| 392 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 393 | * |
| 394 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 395 | */ |
| 396 | gchar * |
| 397 | occ_dup_state (Occ *object) |
| 398 | { |
| 399 | gchar *value; |
| 400 | g_object_get (G_OBJECT (object), "state", &value, NULL); |
| 401 | return value; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * occ_set_state: (skip) |
| 406 | * @object: A #Occ. |
| 407 | * @value: The value to set. |
| 408 | * |
| 409 | * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value. |
| 410 | * |
| 411 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 412 | */ |
| 413 | void |
| 414 | occ_set_state (Occ *object, const gchar *value) |
| 415 | { |
| 416 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 417 | } |
| 418 | |
| 419 | /** |
| 420 | * occ_get_poll_interval: (skip) |
| 421 | * @object: A #Occ. |
| 422 | * |
| 423 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property. |
| 424 | * |
| 425 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 426 | * |
| 427 | * Returns: The property value. |
| 428 | */ |
| 429 | gint |
| 430 | occ_get_poll_interval (Occ *object) |
| 431 | { |
| 432 | return OCC_GET_IFACE (object)->get_poll_interval (object); |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * occ_set_poll_interval: (skip) |
| 437 | * @object: A #Occ. |
| 438 | * @value: The value to set. |
| 439 | * |
| 440 | * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 441 | * |
| 442 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 443 | */ |
| 444 | void |
| 445 | occ_set_poll_interval (Occ *object, gint value) |
| 446 | { |
| 447 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * occ_call_init: |
| 452 | * @proxy: A #OccProxy. |
| 453 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 454 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 455 | * @user_data: User data to pass to @callback. |
| 456 | * |
| 457 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. |
| 458 | * 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. |
| 459 | * You can then call occ_call_init_finish() to get the result of the operation. |
| 460 | * |
| 461 | * See occ_call_init_sync() for the synchronous, blocking version of this method. |
| 462 | */ |
| 463 | void |
| 464 | occ_call_init ( |
| 465 | Occ *proxy, |
| 466 | GCancellable *cancellable, |
| 467 | GAsyncReadyCallback callback, |
| 468 | gpointer user_data) |
| 469 | { |
| 470 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 471 | "init", |
| 472 | g_variant_new ("()"), |
| 473 | G_DBUS_CALL_FLAGS_NONE, |
| 474 | -1, |
| 475 | cancellable, |
| 476 | callback, |
| 477 | user_data); |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * occ_call_init_finish: |
| 482 | * @proxy: A #OccProxy. |
| 483 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init(). |
| 484 | * @error: Return location for error or %NULL. |
| 485 | * |
| 486 | * Finishes an operation started with occ_call_init(). |
| 487 | * |
| 488 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 489 | */ |
| 490 | gboolean |
| 491 | occ_call_init_finish ( |
| 492 | Occ *proxy, |
| 493 | GAsyncResult *res, |
| 494 | GError **error) |
| 495 | { |
| 496 | GVariant *_ret; |
| 497 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 498 | if (_ret == NULL) |
| 499 | goto _out; |
| 500 | g_variant_get (_ret, |
| 501 | "()"); |
| 502 | g_variant_unref (_ret); |
| 503 | _out: |
| 504 | return _ret != NULL; |
| 505 | } |
| 506 | |
| 507 | /** |
| 508 | * occ_call_init_sync: |
| 509 | * @proxy: A #OccProxy. |
| 510 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 511 | * @error: Return location for error or %NULL. |
| 512 | * |
| 513 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 514 | * |
| 515 | * See occ_call_init() for the asynchronous version of this method. |
| 516 | * |
| 517 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 518 | */ |
| 519 | gboolean |
| 520 | occ_call_init_sync ( |
| 521 | Occ *proxy, |
| 522 | GCancellable *cancellable, |
| 523 | GError **error) |
| 524 | { |
| 525 | GVariant *_ret; |
| 526 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 527 | "init", |
| 528 | g_variant_new ("()"), |
| 529 | G_DBUS_CALL_FLAGS_NONE, |
| 530 | -1, |
| 531 | cancellable, |
| 532 | error); |
| 533 | if (_ret == NULL) |
| 534 | goto _out; |
| 535 | g_variant_get (_ret, |
| 536 | "()"); |
| 537 | g_variant_unref (_ret); |
| 538 | _out: |
| 539 | return _ret != NULL; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * occ_call_collect: |
| 544 | * @proxy: A #OccProxy. |
| 545 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 546 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 547 | * @user_data: User data to pass to @callback. |
| 548 | * |
| 549 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. |
| 550 | * 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. |
| 551 | * You can then call occ_call_collect_finish() to get the result of the operation. |
| 552 | * |
| 553 | * See occ_call_collect_sync() for the synchronous, blocking version of this method. |
| 554 | */ |
| 555 | void |
| 556 | occ_call_collect ( |
| 557 | Occ *proxy, |
| 558 | GCancellable *cancellable, |
| 559 | GAsyncReadyCallback callback, |
| 560 | gpointer user_data) |
| 561 | { |
| 562 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 563 | "collect", |
| 564 | g_variant_new ("()"), |
| 565 | G_DBUS_CALL_FLAGS_NONE, |
| 566 | -1, |
| 567 | cancellable, |
| 568 | callback, |
| 569 | user_data); |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * occ_call_collect_finish: |
| 574 | * @proxy: A #OccProxy. |
| 575 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect(). |
| 576 | * @error: Return location for error or %NULL. |
| 577 | * |
| 578 | * Finishes an operation started with occ_call_collect(). |
| 579 | * |
| 580 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 581 | */ |
| 582 | gboolean |
| 583 | occ_call_collect_finish ( |
| 584 | Occ *proxy, |
| 585 | GAsyncResult *res, |
| 586 | GError **error) |
| 587 | { |
| 588 | GVariant *_ret; |
| 589 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 590 | if (_ret == NULL) |
| 591 | goto _out; |
| 592 | g_variant_get (_ret, |
| 593 | "()"); |
| 594 | g_variant_unref (_ret); |
| 595 | _out: |
| 596 | return _ret != NULL; |
| 597 | } |
| 598 | |
| 599 | /** |
| 600 | * occ_call_collect_sync: |
| 601 | * @proxy: A #OccProxy. |
| 602 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 603 | * @error: Return location for error or %NULL. |
| 604 | * |
| 605 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 606 | * |
| 607 | * See occ_call_collect() for the asynchronous version of this method. |
| 608 | * |
| 609 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 610 | */ |
| 611 | gboolean |
| 612 | occ_call_collect_sync ( |
| 613 | Occ *proxy, |
| 614 | GCancellable *cancellable, |
| 615 | GError **error) |
| 616 | { |
| 617 | GVariant *_ret; |
| 618 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 619 | "collect", |
| 620 | g_variant_new ("()"), |
| 621 | G_DBUS_CALL_FLAGS_NONE, |
| 622 | -1, |
| 623 | cancellable, |
| 624 | error); |
| 625 | if (_ret == NULL) |
| 626 | goto _out; |
| 627 | g_variant_get (_ret, |
| 628 | "()"); |
| 629 | g_variant_unref (_ret); |
| 630 | _out: |
| 631 | return _ret != NULL; |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * occ_complete_init: |
| 636 | * @object: A #Occ. |
| 637 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 638 | * |
| 639 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 640 | * |
| 641 | * This method will free @invocation, you cannot use it afterwards. |
| 642 | */ |
| 643 | void |
| 644 | occ_complete_init ( |
| 645 | Occ *object, |
| 646 | GDBusMethodInvocation *invocation) |
| 647 | { |
| 648 | g_dbus_method_invocation_return_value (invocation, |
| 649 | g_variant_new ("()")); |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * occ_complete_collect: |
| 654 | * @object: A #Occ. |
| 655 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 656 | * |
| 657 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 658 | * |
| 659 | * This method will free @invocation, you cannot use it afterwards. |
| 660 | */ |
| 661 | void |
| 662 | occ_complete_collect ( |
| 663 | Occ *object, |
| 664 | GDBusMethodInvocation *invocation) |
| 665 | { |
| 666 | g_dbus_method_invocation_return_value (invocation, |
| 667 | g_variant_new ("()")); |
| 668 | } |
| 669 | |
| 670 | /* ------------------------------------------------------------------------ */ |
| 671 | |
| 672 | /** |
| 673 | * OccProxy: |
| 674 | * |
| 675 | * The #OccProxy structure contains only private data and should only be accessed using the provided API. |
| 676 | */ |
| 677 | |
| 678 | /** |
| 679 | * OccProxyClass: |
| 680 | * @parent_class: The parent class. |
| 681 | * |
| 682 | * Class structure for #OccProxy. |
| 683 | */ |
| 684 | |
| 685 | struct _OccProxyPrivate |
| 686 | { |
| 687 | GData *qdata; |
| 688 | }; |
| 689 | |
| 690 | static void occ_proxy_iface_init (OccIface *iface); |
| 691 | |
| 692 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 693 | G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY, |
| 694 | G_ADD_PRIVATE (OccProxy) |
| 695 | G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init)); |
| 696 | |
| 697 | #else |
| 698 | G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY, |
| 699 | G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init)); |
| 700 | |
| 701 | #endif |
| 702 | static void |
| 703 | occ_proxy_finalize (GObject *object) |
| 704 | { |
| 705 | OccProxy *proxy = OCC_PROXY (object); |
| 706 | g_datalist_clear (&proxy->priv->qdata); |
| 707 | G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object); |
| 708 | } |
| 709 | |
| 710 | static void |
| 711 | occ_proxy_get_property (GObject *object, |
| 712 | guint prop_id, |
| 713 | GValue *value, |
| 714 | GParamSpec *pspec G_GNUC_UNUSED) |
| 715 | { |
| 716 | const _ExtendedGDBusPropertyInfo *info; |
| 717 | GVariant *variant; |
| 718 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 719 | info = _occ_property_info_pointers[prop_id - 1]; |
| 720 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 721 | if (info->use_gvariant) |
| 722 | { |
| 723 | g_value_set_variant (value, variant); |
| 724 | } |
| 725 | else |
| 726 | { |
| 727 | if (variant != NULL) |
| 728 | g_dbus_gvariant_to_gvalue (variant, value); |
| 729 | } |
| 730 | if (variant != NULL) |
| 731 | g_variant_unref (variant); |
| 732 | } |
| 733 | |
| 734 | static void |
| 735 | occ_proxy_set_property_cb (GDBusProxy *proxy, |
| 736 | GAsyncResult *res, |
| 737 | gpointer user_data) |
| 738 | { |
| 739 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 740 | GError *error; |
| 741 | GVariant *_ret; |
| 742 | error = NULL; |
| 743 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 744 | if (!_ret) |
| 745 | { |
| 746 | g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)", |
| 747 | info->parent_struct.name, |
| 748 | error->message, g_quark_to_string (error->domain), error->code); |
| 749 | g_error_free (error); |
| 750 | } |
| 751 | else |
| 752 | { |
| 753 | g_variant_unref (_ret); |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | static void |
| 758 | occ_proxy_set_property (GObject *object, |
| 759 | guint prop_id, |
| 760 | const GValue *value, |
| 761 | GParamSpec *pspec G_GNUC_UNUSED) |
| 762 | { |
| 763 | const _ExtendedGDBusPropertyInfo *info; |
| 764 | GVariant *variant; |
| 765 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 766 | info = _occ_property_info_pointers[prop_id - 1]; |
| 767 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 768 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 769 | "org.freedesktop.DBus.Properties.Set", |
| 770 | g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant), |
| 771 | G_DBUS_CALL_FLAGS_NONE, |
| 772 | -1, |
| 773 | NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 774 | g_variant_unref (variant); |
| 775 | } |
| 776 | |
| 777 | static void |
| 778 | occ_proxy_g_signal (GDBusProxy *proxy, |
| 779 | const gchar *sender_name G_GNUC_UNUSED, |
| 780 | const gchar *signal_name, |
| 781 | GVariant *parameters) |
| 782 | { |
| 783 | _ExtendedGDBusSignalInfo *info; |
| 784 | GVariantIter iter; |
| 785 | GVariant *child; |
| 786 | GValue *paramv; |
| 787 | guint num_params; |
| 788 | guint n; |
| 789 | guint signal_id; |
| 790 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name); |
| 791 | if (info == NULL) |
| 792 | return; |
| 793 | num_params = g_variant_n_children (parameters); |
| 794 | paramv = g_new0 (GValue, num_params + 1); |
| 795 | g_value_init (¶mv[0], TYPE_OCC); |
| 796 | g_value_set_object (¶mv[0], proxy); |
| 797 | g_variant_iter_init (&iter, parameters); |
| 798 | n = 1; |
| 799 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 800 | { |
| 801 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 802 | if (arg_info->use_gvariant) |
| 803 | { |
| 804 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 805 | g_value_set_variant (¶mv[n], child); |
| 806 | n++; |
| 807 | } |
| 808 | else |
| 809 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 810 | g_variant_unref (child); |
| 811 | } |
| 812 | signal_id = g_signal_lookup (info->signal_name, TYPE_OCC); |
| 813 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 814 | for (n = 0; n < num_params + 1; n++) |
| 815 | g_value_unset (¶mv[n]); |
| 816 | g_free (paramv); |
| 817 | } |
| 818 | |
| 819 | static void |
| 820 | occ_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 821 | GVariant *changed_properties, |
| 822 | const gchar *const *invalidated_properties) |
| 823 | { |
| 824 | OccProxy *proxy = OCC_PROXY (_proxy); |
| 825 | guint n; |
| 826 | const gchar *key; |
| 827 | GVariantIter *iter; |
| 828 | _ExtendedGDBusPropertyInfo *info; |
| 829 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 830 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 831 | { |
| 832 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key); |
| 833 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 834 | if (info != NULL) |
| 835 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 836 | } |
| 837 | g_variant_iter_free (iter); |
| 838 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 839 | { |
| 840 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]); |
| 841 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 842 | if (info != NULL) |
| 843 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 844 | } |
| 845 | } |
| 846 | |
| 847 | static const gchar * |
| 848 | occ_proxy_get_state (Occ *object) |
| 849 | { |
| 850 | OccProxy *proxy = OCC_PROXY (object); |
| 851 | GVariant *variant; |
| 852 | const gchar *value = NULL; |
| 853 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 854 | if (variant != NULL) |
| 855 | { |
| 856 | value = g_variant_get_string (variant, NULL); |
| 857 | g_variant_unref (variant); |
| 858 | } |
| 859 | return value; |
| 860 | } |
| 861 | |
| 862 | static gint |
| 863 | occ_proxy_get_poll_interval (Occ *object) |
| 864 | { |
| 865 | OccProxy *proxy = OCC_PROXY (object); |
| 866 | GVariant *variant; |
| 867 | gint value = 0; |
| 868 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 869 | if (variant != NULL) |
| 870 | { |
| 871 | value = g_variant_get_int32 (variant); |
| 872 | g_variant_unref (variant); |
| 873 | } |
| 874 | return value; |
| 875 | } |
| 876 | |
| 877 | static void |
| 878 | occ_proxy_init (OccProxy *proxy) |
| 879 | { |
| 880 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 881 | proxy->priv = occ_proxy_get_instance_private (proxy); |
| 882 | #else |
| 883 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate); |
| 884 | #endif |
| 885 | |
| 886 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ()); |
| 887 | } |
| 888 | |
| 889 | static void |
| 890 | occ_proxy_class_init (OccProxyClass *klass) |
| 891 | { |
| 892 | GObjectClass *gobject_class; |
| 893 | GDBusProxyClass *proxy_class; |
| 894 | |
| 895 | gobject_class = G_OBJECT_CLASS (klass); |
| 896 | gobject_class->finalize = occ_proxy_finalize; |
| 897 | gobject_class->get_property = occ_proxy_get_property; |
| 898 | gobject_class->set_property = occ_proxy_set_property; |
| 899 | |
| 900 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 901 | proxy_class->g_signal = occ_proxy_g_signal; |
| 902 | proxy_class->g_properties_changed = occ_proxy_g_properties_changed; |
| 903 | |
| 904 | occ_override_properties (gobject_class, 1); |
| 905 | |
| 906 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 907 | g_type_class_add_private (klass, sizeof (OccProxyPrivate)); |
| 908 | #endif |
| 909 | } |
| 910 | |
| 911 | static void |
| 912 | occ_proxy_iface_init (OccIface *iface) |
| 913 | { |
| 914 | iface->get_state = occ_proxy_get_state; |
| 915 | iface->get_poll_interval = occ_proxy_get_poll_interval; |
| 916 | } |
| 917 | |
| 918 | /** |
| 919 | * occ_proxy_new: |
| 920 | * @connection: A #GDBusConnection. |
| 921 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 922 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 923 | * @object_path: An object path. |
| 924 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 925 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 926 | * @user_data: User data to pass to @callback. |
| 927 | * |
| 928 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new() for more details. |
| 929 | * |
| 930 | * 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. |
| 931 | * You can then call occ_proxy_new_finish() to get the result of the operation. |
| 932 | * |
| 933 | * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 934 | */ |
| 935 | void |
| 936 | occ_proxy_new ( |
| 937 | GDBusConnection *connection, |
| 938 | GDBusProxyFlags flags, |
| 939 | const gchar *name, |
| 940 | const gchar *object_path, |
| 941 | GCancellable *cancellable, |
| 942 | GAsyncReadyCallback callback, |
| 943 | gpointer user_data) |
| 944 | { |
| 945 | g_async_initable_new_async (TYPE_OCC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL); |
| 946 | } |
| 947 | |
| 948 | /** |
| 949 | * occ_proxy_new_finish: |
| 950 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new(). |
| 951 | * @error: Return location for error or %NULL |
| 952 | * |
| 953 | * Finishes an operation started with occ_proxy_new(). |
| 954 | * |
| 955 | * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set. |
| 956 | */ |
| 957 | Occ * |
| 958 | occ_proxy_new_finish ( |
| 959 | GAsyncResult *res, |
| 960 | GError **error) |
| 961 | { |
| 962 | GObject *ret; |
| 963 | GObject *source_object; |
| 964 | source_object = g_async_result_get_source_object (res); |
| 965 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 966 | g_object_unref (source_object); |
| 967 | if (ret != NULL) |
| 968 | return OCC (ret); |
| 969 | else |
| 970 | return NULL; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * occ_proxy_new_sync: |
| 975 | * @connection: A #GDBusConnection. |
| 976 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 977 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 978 | * @object_path: An object path. |
| 979 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 980 | * @error: Return location for error or %NULL |
| 981 | * |
| 982 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new_sync() for more details. |
| 983 | * |
| 984 | * The calling thread is blocked until a reply is received. |
| 985 | * |
| 986 | * See occ_proxy_new() for the asynchronous version of this constructor. |
| 987 | * |
| 988 | * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set. |
| 989 | */ |
| 990 | Occ * |
| 991 | occ_proxy_new_sync ( |
| 992 | GDBusConnection *connection, |
| 993 | GDBusProxyFlags flags, |
| 994 | const gchar *name, |
| 995 | const gchar *object_path, |
| 996 | GCancellable *cancellable, |
| 997 | GError **error) |
| 998 | { |
| 999 | GInitable *ret; |
| 1000 | ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL); |
| 1001 | if (ret != NULL) |
| 1002 | return OCC (ret); |
| 1003 | else |
| 1004 | return NULL; |
| 1005 | } |
| 1006 | |
| 1007 | |
| 1008 | /** |
| 1009 | * occ_proxy_new_for_bus: |
| 1010 | * @bus_type: A #GBusType. |
| 1011 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1012 | * @name: A bus name (well-known or unique). |
| 1013 | * @object_path: An object path. |
| 1014 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1015 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1016 | * @user_data: User data to pass to @callback. |
| 1017 | * |
| 1018 | * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 1019 | * |
| 1020 | * 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. |
| 1021 | * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation. |
| 1022 | * |
| 1023 | * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 1024 | */ |
| 1025 | void |
| 1026 | occ_proxy_new_for_bus ( |
| 1027 | GBusType bus_type, |
| 1028 | GDBusProxyFlags flags, |
| 1029 | const gchar *name, |
| 1030 | const gchar *object_path, |
| 1031 | GCancellable *cancellable, |
| 1032 | GAsyncReadyCallback callback, |
| 1033 | gpointer user_data) |
| 1034 | { |
| 1035 | g_async_initable_new_async (TYPE_OCC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL); |
| 1036 | } |
| 1037 | |
| 1038 | /** |
| 1039 | * occ_proxy_new_for_bus_finish: |
| 1040 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus(). |
| 1041 | * @error: Return location for error or %NULL |
| 1042 | * |
| 1043 | * Finishes an operation started with occ_proxy_new_for_bus(). |
| 1044 | * |
| 1045 | * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set. |
| 1046 | */ |
| 1047 | Occ * |
| 1048 | occ_proxy_new_for_bus_finish ( |
| 1049 | GAsyncResult *res, |
| 1050 | GError **error) |
| 1051 | { |
| 1052 | GObject *ret; |
| 1053 | GObject *source_object; |
| 1054 | source_object = g_async_result_get_source_object (res); |
| 1055 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1056 | g_object_unref (source_object); |
| 1057 | if (ret != NULL) |
| 1058 | return OCC (ret); |
| 1059 | else |
| 1060 | return NULL; |
| 1061 | } |
| 1062 | |
| 1063 | /** |
| 1064 | * occ_proxy_new_for_bus_sync: |
| 1065 | * @bus_type: A #GBusType. |
| 1066 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1067 | * @name: A bus name (well-known or unique). |
| 1068 | * @object_path: An object path. |
| 1069 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1070 | * @error: Return location for error or %NULL |
| 1071 | * |
| 1072 | * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 1073 | * |
| 1074 | * The calling thread is blocked until a reply is received. |
| 1075 | * |
| 1076 | * See occ_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 1077 | * |
| 1078 | * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set. |
| 1079 | */ |
| 1080 | Occ * |
| 1081 | occ_proxy_new_for_bus_sync ( |
| 1082 | GBusType bus_type, |
| 1083 | GDBusProxyFlags flags, |
| 1084 | const gchar *name, |
| 1085 | const gchar *object_path, |
| 1086 | GCancellable *cancellable, |
| 1087 | GError **error) |
| 1088 | { |
| 1089 | GInitable *ret; |
| 1090 | ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL); |
| 1091 | if (ret != NULL) |
| 1092 | return OCC (ret); |
| 1093 | else |
| 1094 | return NULL; |
| 1095 | } |
| 1096 | |
| 1097 | |
| 1098 | /* ------------------------------------------------------------------------ */ |
| 1099 | |
| 1100 | /** |
| 1101 | * OccSkeleton: |
| 1102 | * |
| 1103 | * The #OccSkeleton structure contains only private data and should only be accessed using the provided API. |
| 1104 | */ |
| 1105 | |
| 1106 | /** |
| 1107 | * OccSkeletonClass: |
| 1108 | * @parent_class: The parent class. |
| 1109 | * |
| 1110 | * Class structure for #OccSkeleton. |
| 1111 | */ |
| 1112 | |
| 1113 | struct _OccSkeletonPrivate |
| 1114 | { |
| 1115 | GValue *properties; |
| 1116 | GList *changed_properties; |
| 1117 | GSource *changed_properties_idle_source; |
| 1118 | GMainContext *context; |
| 1119 | GMutex lock; |
| 1120 | }; |
| 1121 | |
| 1122 | static void |
| 1123 | _occ_skeleton_handle_method_call ( |
| 1124 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1125 | const gchar *sender G_GNUC_UNUSED, |
| 1126 | const gchar *object_path G_GNUC_UNUSED, |
| 1127 | const gchar *interface_name, |
| 1128 | const gchar *method_name, |
| 1129 | GVariant *parameters, |
| 1130 | GDBusMethodInvocation *invocation, |
| 1131 | gpointer user_data) |
| 1132 | { |
| 1133 | OccSkeleton *skeleton = OCC_SKELETON (user_data); |
| 1134 | _ExtendedGDBusMethodInfo *info; |
| 1135 | GVariantIter iter; |
| 1136 | GVariant *child; |
| 1137 | GValue *paramv; |
| 1138 | guint num_params; |
| 1139 | guint num_extra; |
| 1140 | guint n; |
| 1141 | guint signal_id; |
| 1142 | GValue return_value = G_VALUE_INIT; |
| 1143 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1144 | g_assert (info != NULL); |
| 1145 | num_params = g_variant_n_children (parameters); |
| 1146 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1147 | n = 0; |
| 1148 | g_value_init (¶mv[n], TYPE_OCC); |
| 1149 | g_value_set_object (¶mv[n++], skeleton); |
| 1150 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1151 | g_value_set_object (¶mv[n++], invocation); |
| 1152 | if (info->pass_fdlist) |
| 1153 | { |
| 1154 | #ifdef G_OS_UNIX |
| 1155 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1156 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1157 | #else |
| 1158 | g_assert_not_reached (); |
| 1159 | #endif |
| 1160 | } |
| 1161 | g_variant_iter_init (&iter, parameters); |
| 1162 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1163 | { |
| 1164 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1165 | if (arg_info->use_gvariant) |
| 1166 | { |
| 1167 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1168 | g_value_set_variant (¶mv[n], child); |
| 1169 | n++; |
| 1170 | } |
| 1171 | else |
| 1172 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1173 | g_variant_unref (child); |
| 1174 | } |
| 1175 | signal_id = g_signal_lookup (info->signal_name, TYPE_OCC); |
| 1176 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1177 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1178 | if (!g_value_get_boolean (&return_value)) |
| 1179 | 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); |
| 1180 | g_value_unset (&return_value); |
| 1181 | for (n = 0; n < num_params + num_extra; n++) |
| 1182 | g_value_unset (¶mv[n]); |
| 1183 | g_free (paramv); |
| 1184 | } |
| 1185 | |
| 1186 | static GVariant * |
| 1187 | _occ_skeleton_handle_get_property ( |
| 1188 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1189 | const gchar *sender G_GNUC_UNUSED, |
| 1190 | const gchar *object_path G_GNUC_UNUSED, |
| 1191 | const gchar *interface_name G_GNUC_UNUSED, |
| 1192 | const gchar *property_name, |
| 1193 | GError **error, |
| 1194 | gpointer user_data) |
| 1195 | { |
| 1196 | OccSkeleton *skeleton = OCC_SKELETON (user_data); |
| 1197 | GValue value = G_VALUE_INIT; |
| 1198 | GParamSpec *pspec; |
| 1199 | _ExtendedGDBusPropertyInfo *info; |
| 1200 | GVariant *ret; |
| 1201 | ret = NULL; |
| 1202 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name); |
| 1203 | g_assert (info != NULL); |
| 1204 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1205 | if (pspec == NULL) |
| 1206 | { |
| 1207 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1208 | } |
| 1209 | else |
| 1210 | { |
| 1211 | g_value_init (&value, pspec->value_type); |
| 1212 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1213 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1214 | g_value_unset (&value); |
| 1215 | } |
| 1216 | return ret; |
| 1217 | } |
| 1218 | |
| 1219 | static gboolean |
| 1220 | _occ_skeleton_handle_set_property ( |
| 1221 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1222 | const gchar *sender G_GNUC_UNUSED, |
| 1223 | const gchar *object_path G_GNUC_UNUSED, |
| 1224 | const gchar *interface_name G_GNUC_UNUSED, |
| 1225 | const gchar *property_name, |
| 1226 | GVariant *variant, |
| 1227 | GError **error, |
| 1228 | gpointer user_data) |
| 1229 | { |
| 1230 | OccSkeleton *skeleton = OCC_SKELETON (user_data); |
| 1231 | GValue value = G_VALUE_INIT; |
| 1232 | GParamSpec *pspec; |
| 1233 | _ExtendedGDBusPropertyInfo *info; |
| 1234 | gboolean ret; |
| 1235 | ret = FALSE; |
| 1236 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name); |
| 1237 | g_assert (info != NULL); |
| 1238 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1239 | if (pspec == NULL) |
| 1240 | { |
| 1241 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1242 | } |
| 1243 | else |
| 1244 | { |
| 1245 | if (info->use_gvariant) |
| 1246 | g_value_set_variant (&value, variant); |
| 1247 | else |
| 1248 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1249 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1250 | g_value_unset (&value); |
| 1251 | ret = TRUE; |
| 1252 | } |
| 1253 | return ret; |
| 1254 | } |
| 1255 | |
| 1256 | static const GDBusInterfaceVTable _occ_skeleton_vtable = |
| 1257 | { |
| 1258 | _occ_skeleton_handle_method_call, |
| 1259 | _occ_skeleton_handle_get_property, |
| 1260 | _occ_skeleton_handle_set_property, |
| 1261 | {NULL} |
| 1262 | }; |
| 1263 | |
| 1264 | static GDBusInterfaceInfo * |
| 1265 | occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1266 | { |
| 1267 | return occ_interface_info (); |
| 1268 | } |
| 1269 | |
| 1270 | static GDBusInterfaceVTable * |
| 1271 | occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1272 | { |
| 1273 | return (GDBusInterfaceVTable *) &_occ_skeleton_vtable; |
| 1274 | } |
| 1275 | |
| 1276 | static GVariant * |
| 1277 | occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 1278 | { |
| 1279 | OccSkeleton *skeleton = OCC_SKELETON (_skeleton); |
| 1280 | |
| 1281 | GVariantBuilder builder; |
| 1282 | guint n; |
| 1283 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1284 | if (_occ_interface_info.parent_struct.properties == NULL) |
| 1285 | goto out; |
| 1286 | for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++) |
| 1287 | { |
| 1288 | GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n]; |
| 1289 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1290 | { |
| 1291 | GVariant *value; |
| 1292 | value = _occ_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Occ", info->name, NULL, skeleton); |
| 1293 | if (value != NULL) |
| 1294 | { |
| 1295 | g_variant_take_ref (value); |
| 1296 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1297 | g_variant_unref (value); |
| 1298 | } |
| 1299 | } |
| 1300 | } |
| 1301 | out: |
| 1302 | return g_variant_builder_end (&builder); |
| 1303 | } |
| 1304 | |
| 1305 | static gboolean _occ_emit_changed (gpointer user_data); |
| 1306 | |
| 1307 | static void |
| 1308 | occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 1309 | { |
| 1310 | OccSkeleton *skeleton = OCC_SKELETON (_skeleton); |
| 1311 | gboolean emit_changed = FALSE; |
| 1312 | |
| 1313 | g_mutex_lock (&skeleton->priv->lock); |
| 1314 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1315 | { |
| 1316 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1317 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1318 | emit_changed = TRUE; |
| 1319 | } |
| 1320 | g_mutex_unlock (&skeleton->priv->lock); |
| 1321 | |
| 1322 | if (emit_changed) |
| 1323 | _occ_emit_changed (skeleton); |
| 1324 | } |
| 1325 | |
| 1326 | static void occ_skeleton_iface_init (OccIface *iface); |
| 1327 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1328 | G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1329 | G_ADD_PRIVATE (OccSkeleton) |
| 1330 | G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init)); |
| 1331 | |
| 1332 | #else |
| 1333 | G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1334 | G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init)); |
| 1335 | |
| 1336 | #endif |
| 1337 | static void |
| 1338 | occ_skeleton_finalize (GObject *object) |
| 1339 | { |
| 1340 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1341 | guint n; |
| 1342 | for (n = 0; n < 2; n++) |
| 1343 | g_value_unset (&skeleton->priv->properties[n]); |
| 1344 | g_free (skeleton->priv->properties); |
| 1345 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1346 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1347 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1348 | g_main_context_unref (skeleton->priv->context); |
| 1349 | g_mutex_clear (&skeleton->priv->lock); |
| 1350 | G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object); |
| 1351 | } |
| 1352 | |
| 1353 | static void |
| 1354 | occ_skeleton_get_property (GObject *object, |
| 1355 | guint prop_id, |
| 1356 | GValue *value, |
| 1357 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1358 | { |
| 1359 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1360 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 1361 | g_mutex_lock (&skeleton->priv->lock); |
| 1362 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1363 | g_mutex_unlock (&skeleton->priv->lock); |
| 1364 | } |
| 1365 | |
| 1366 | static gboolean |
| 1367 | _occ_emit_changed (gpointer user_data) |
| 1368 | { |
| 1369 | OccSkeleton *skeleton = OCC_SKELETON (user_data); |
| 1370 | GList *l; |
| 1371 | GVariantBuilder builder; |
| 1372 | GVariantBuilder invalidated_builder; |
| 1373 | guint num_changes; |
| 1374 | |
| 1375 | g_mutex_lock (&skeleton->priv->lock); |
| 1376 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1377 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1378 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1379 | { |
| 1380 | ChangedProperty *cp = l->data; |
| 1381 | GVariant *variant; |
| 1382 | const GValue *cur_value; |
| 1383 | |
| 1384 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1385 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1386 | { |
| 1387 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1388 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1389 | g_variant_unref (variant); |
| 1390 | num_changes++; |
| 1391 | } |
| 1392 | } |
| 1393 | if (num_changes > 0) |
| 1394 | { |
| 1395 | GList *connections, *ll; |
| 1396 | GVariant *signal_variant; |
| 1397 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ", |
| 1398 | &builder, &invalidated_builder)); |
| 1399 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1400 | for (ll = connections; ll != NULL; ll = ll->next) |
| 1401 | { |
| 1402 | GDBusConnection *connection = ll->data; |
| 1403 | |
| 1404 | g_dbus_connection_emit_signal (connection, |
| 1405 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 1406 | "org.freedesktop.DBus.Properties", |
| 1407 | "PropertiesChanged", |
| 1408 | signal_variant, |
| 1409 | NULL); |
| 1410 | } |
| 1411 | g_variant_unref (signal_variant); |
| 1412 | g_list_free_full (connections, g_object_unref); |
| 1413 | } |
| 1414 | else |
| 1415 | { |
| 1416 | g_variant_builder_clear (&builder); |
| 1417 | g_variant_builder_clear (&invalidated_builder); |
| 1418 | } |
| 1419 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1420 | skeleton->priv->changed_properties = NULL; |
| 1421 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1422 | g_mutex_unlock (&skeleton->priv->lock); |
| 1423 | return FALSE; |
| 1424 | } |
| 1425 | |
| 1426 | static void |
| 1427 | _occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 1428 | { |
| 1429 | ChangedProperty *cp; |
| 1430 | GList *l; |
| 1431 | cp = NULL; |
| 1432 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 1433 | { |
| 1434 | ChangedProperty *i_cp = l->data; |
| 1435 | if (i_cp->info == info) |
| 1436 | { |
| 1437 | cp = i_cp; |
| 1438 | break; |
| 1439 | } |
| 1440 | } |
| 1441 | if (cp == NULL) |
| 1442 | { |
| 1443 | cp = g_new0 (ChangedProperty, 1); |
| 1444 | cp->prop_id = prop_id; |
| 1445 | cp->info = info; |
| 1446 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 1447 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 1448 | g_value_copy (orig_value, &cp->orig_value); |
| 1449 | } |
| 1450 | } |
| 1451 | |
| 1452 | static void |
| 1453 | occ_skeleton_notify (GObject *object, |
| 1454 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1455 | { |
| 1456 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1457 | g_mutex_lock (&skeleton->priv->lock); |
| 1458 | if (skeleton->priv->changed_properties != NULL && |
| 1459 | skeleton->priv->changed_properties_idle_source == NULL) |
| 1460 | { |
| 1461 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 1462 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 1463 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 1464 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 1465 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 1466 | } |
| 1467 | g_mutex_unlock (&skeleton->priv->lock); |
| 1468 | } |
| 1469 | |
| 1470 | static void |
| 1471 | occ_skeleton_set_property (GObject *object, |
| 1472 | guint prop_id, |
| 1473 | const GValue *value, |
| 1474 | GParamSpec *pspec) |
| 1475 | { |
| 1476 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1477 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 1478 | g_mutex_lock (&skeleton->priv->lock); |
| 1479 | g_object_freeze_notify (object); |
| 1480 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 1481 | { |
| 1482 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 1483 | _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 1484 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 1485 | g_object_notify_by_pspec (object, pspec); |
| 1486 | } |
| 1487 | g_mutex_unlock (&skeleton->priv->lock); |
| 1488 | g_object_thaw_notify (object); |
| 1489 | } |
| 1490 | |
| 1491 | static void |
| 1492 | occ_skeleton_init (OccSkeleton *skeleton) |
| 1493 | { |
| 1494 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1495 | skeleton->priv = occ_skeleton_get_instance_private (skeleton); |
| 1496 | #else |
| 1497 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate); |
| 1498 | #endif |
| 1499 | |
| 1500 | g_mutex_init (&skeleton->priv->lock); |
| 1501 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 1502 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 1503 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 1504 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 1505 | } |
| 1506 | |
| 1507 | static const gchar * |
| 1508 | occ_skeleton_get_state (Occ *object) |
| 1509 | { |
| 1510 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1511 | const gchar *value; |
| 1512 | g_mutex_lock (&skeleton->priv->lock); |
| 1513 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 1514 | g_mutex_unlock (&skeleton->priv->lock); |
| 1515 | return value; |
| 1516 | } |
| 1517 | |
| 1518 | static gint |
| 1519 | occ_skeleton_get_poll_interval (Occ *object) |
| 1520 | { |
| 1521 | OccSkeleton *skeleton = OCC_SKELETON (object); |
| 1522 | gint value; |
| 1523 | g_mutex_lock (&skeleton->priv->lock); |
| 1524 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 1525 | g_mutex_unlock (&skeleton->priv->lock); |
| 1526 | return value; |
| 1527 | } |
| 1528 | |
| 1529 | static void |
| 1530 | occ_skeleton_class_init (OccSkeletonClass *klass) |
| 1531 | { |
| 1532 | GObjectClass *gobject_class; |
| 1533 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 1534 | |
| 1535 | gobject_class = G_OBJECT_CLASS (klass); |
| 1536 | gobject_class->finalize = occ_skeleton_finalize; |
| 1537 | gobject_class->get_property = occ_skeleton_get_property; |
| 1538 | gobject_class->set_property = occ_skeleton_set_property; |
| 1539 | gobject_class->notify = occ_skeleton_notify; |
| 1540 | |
| 1541 | |
| 1542 | occ_override_properties (gobject_class, 1); |
| 1543 | |
| 1544 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 1545 | skeleton_class->get_info = occ_skeleton_dbus_interface_get_info; |
| 1546 | skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties; |
| 1547 | skeleton_class->flush = occ_skeleton_dbus_interface_flush; |
| 1548 | skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable; |
| 1549 | |
| 1550 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1551 | g_type_class_add_private (klass, sizeof (OccSkeletonPrivate)); |
| 1552 | #endif |
| 1553 | } |
| 1554 | |
| 1555 | static void |
| 1556 | occ_skeleton_iface_init (OccIface *iface) |
| 1557 | { |
| 1558 | iface->get_state = occ_skeleton_get_state; |
| 1559 | iface->get_poll_interval = occ_skeleton_get_poll_interval; |
| 1560 | } |
| 1561 | |
| 1562 | /** |
| 1563 | * occ_skeleton_new: |
| 1564 | * |
| 1565 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. |
| 1566 | * |
| 1567 | * Returns: (transfer full) (type OccSkeleton): The skeleton object. |
| 1568 | */ |
| 1569 | Occ * |
| 1570 | occ_skeleton_new (void) |
| 1571 | { |
| 1572 | return OCC (g_object_new (TYPE_OCC_SKELETON, NULL)); |
| 1573 | } |
| 1574 | |
| 1575 | /* ------------------------------------------------------------------------ |
| 1576 | * Code for interface org.openbmc.Fan |
| 1577 | * ------------------------------------------------------------------------ |
| 1578 | */ |
| 1579 | |
| 1580 | /** |
| 1581 | * SECTION:Fan |
| 1582 | * @title: Fan |
| 1583 | * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface |
| 1584 | * |
| 1585 | * 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. |
| 1586 | */ |
| 1587 | |
| 1588 | /* ---- Introspection data for org.openbmc.Fan ---- */ |
| 1589 | |
| 1590 | static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone = |
| 1591 | { |
| 1592 | { |
| 1593 | -1, |
| 1594 | (gchar *) "cooling_zone", |
| 1595 | (gchar *) "i", |
| 1596 | NULL |
| 1597 | }, |
| 1598 | FALSE |
| 1599 | }; |
| 1600 | |
| 1601 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] = |
| 1602 | { |
| 1603 | &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone, |
| 1604 | NULL |
| 1605 | }; |
| 1606 | |
| 1607 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone = |
| 1608 | { |
| 1609 | { |
| 1610 | -1, |
| 1611 | (gchar *) "setCoolingZone", |
| 1612 | (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers, |
| 1613 | NULL, |
| 1614 | NULL |
| 1615 | }, |
| 1616 | "handle-set-cooling-zone", |
| 1617 | FALSE |
| 1618 | }; |
| 1619 | |
| 1620 | static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed = |
| 1621 | { |
| 1622 | { |
| 1623 | -1, |
| 1624 | (gchar *) "speed", |
| 1625 | (gchar *) "i", |
| 1626 | NULL |
| 1627 | }, |
| 1628 | FALSE |
| 1629 | }; |
| 1630 | |
| 1631 | static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] = |
| 1632 | { |
| 1633 | &_fan_method_info_get_speed_OUT_ARG_speed, |
| 1634 | NULL |
| 1635 | }; |
| 1636 | |
| 1637 | static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed = |
| 1638 | { |
| 1639 | { |
| 1640 | -1, |
| 1641 | (gchar *) "getSpeed", |
| 1642 | NULL, |
| 1643 | (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers, |
| 1644 | NULL |
| 1645 | }, |
| 1646 | "handle-get-speed", |
| 1647 | FALSE |
| 1648 | }; |
| 1649 | |
| 1650 | static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed = |
| 1651 | { |
| 1652 | { |
| 1653 | -1, |
| 1654 | (gchar *) "speed", |
| 1655 | (gchar *) "i", |
| 1656 | NULL |
| 1657 | }, |
| 1658 | FALSE |
| 1659 | }; |
| 1660 | |
| 1661 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] = |
| 1662 | { |
| 1663 | &_fan_method_info_set_speed_IN_ARG_speed, |
| 1664 | NULL |
| 1665 | }; |
| 1666 | |
| 1667 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed = |
| 1668 | { |
| 1669 | { |
| 1670 | -1, |
| 1671 | (gchar *) "setSpeed", |
| 1672 | (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers, |
| 1673 | NULL, |
| 1674 | NULL |
| 1675 | }, |
| 1676 | "handle-set-speed", |
| 1677 | FALSE |
| 1678 | }; |
| 1679 | |
| 1680 | static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] = |
| 1681 | { |
| 1682 | &_fan_method_info_set_cooling_zone, |
| 1683 | &_fan_method_info_get_speed, |
| 1684 | &_fan_method_info_set_speed, |
| 1685 | NULL |
| 1686 | }; |
| 1687 | |
| 1688 | static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed = |
| 1689 | { |
| 1690 | { |
| 1691 | -1, |
| 1692 | (gchar *) "speed", |
| 1693 | (gchar *) "i", |
| 1694 | NULL |
| 1695 | }, |
| 1696 | FALSE |
| 1697 | }; |
| 1698 | |
| 1699 | static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] = |
| 1700 | { |
| 1701 | &_fan_signal_info_speed_changed_ARG_speed, |
| 1702 | NULL |
| 1703 | }; |
| 1704 | |
| 1705 | static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed = |
| 1706 | { |
| 1707 | { |
| 1708 | -1, |
| 1709 | (gchar *) "SpeedChanged", |
| 1710 | (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers, |
| 1711 | NULL |
| 1712 | }, |
| 1713 | "speed-changed" |
| 1714 | }; |
| 1715 | |
| 1716 | static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error = |
| 1717 | { |
| 1718 | { |
| 1719 | -1, |
| 1720 | (gchar *) "TachError", |
| 1721 | NULL, |
| 1722 | NULL |
| 1723 | }, |
| 1724 | "tach-error" |
| 1725 | }; |
| 1726 | |
| 1727 | static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] = |
| 1728 | { |
| 1729 | &_fan_signal_info_speed_changed, |
| 1730 | &_fan_signal_info_tach_error, |
| 1731 | NULL |
| 1732 | }; |
| 1733 | |
| 1734 | static const _ExtendedGDBusPropertyInfo _fan_property_info_speed = |
| 1735 | { |
| 1736 | { |
| 1737 | -1, |
| 1738 | (gchar *) "speed", |
| 1739 | (gchar *) "i", |
| 1740 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1741 | NULL |
| 1742 | }, |
| 1743 | "speed", |
| 1744 | FALSE |
| 1745 | }; |
| 1746 | |
| 1747 | static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone = |
| 1748 | { |
| 1749 | { |
| 1750 | -1, |
| 1751 | (gchar *) "cooling_zone", |
| 1752 | (gchar *) "i", |
| 1753 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1754 | NULL |
| 1755 | }, |
| 1756 | "cooling-zone", |
| 1757 | FALSE |
| 1758 | }; |
| 1759 | |
| 1760 | static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num = |
| 1761 | { |
| 1762 | { |
| 1763 | -1, |
| 1764 | (gchar *) "pwm_num", |
| 1765 | (gchar *) "i", |
| 1766 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1767 | NULL |
| 1768 | }, |
| 1769 | "pwm-num", |
| 1770 | FALSE |
| 1771 | }; |
| 1772 | |
| 1773 | static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] = |
| 1774 | { |
| 1775 | &_fan_property_info_speed, |
| 1776 | &_fan_property_info_cooling_zone, |
| 1777 | &_fan_property_info_pwm_num, |
| 1778 | NULL |
| 1779 | }; |
| 1780 | |
| 1781 | static const _ExtendedGDBusInterfaceInfo _fan_interface_info = |
| 1782 | { |
| 1783 | { |
| 1784 | -1, |
| 1785 | (gchar *) "org.openbmc.Fan", |
| 1786 | (GDBusMethodInfo **) &_fan_method_info_pointers, |
| 1787 | (GDBusSignalInfo **) &_fan_signal_info_pointers, |
| 1788 | (GDBusPropertyInfo **) &_fan_property_info_pointers, |
| 1789 | NULL |
| 1790 | }, |
| 1791 | "fan", |
| 1792 | }; |
| 1793 | |
| 1794 | |
| 1795 | /** |
| 1796 | * fan_interface_info: |
| 1797 | * |
| 1798 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface. |
| 1799 | * |
| 1800 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 1801 | */ |
| 1802 | GDBusInterfaceInfo * |
| 1803 | fan_interface_info (void) |
| 1804 | { |
| 1805 | return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct; |
| 1806 | } |
| 1807 | |
| 1808 | /** |
| 1809 | * fan_override_properties: |
| 1810 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 1811 | * @property_id_begin: The property id to assign to the first overridden property. |
| 1812 | * |
| 1813 | * Overrides all #GObject properties in the #Fan interface for a concrete class. |
| 1814 | * The properties are overridden in the order they are defined. |
| 1815 | * |
| 1816 | * Returns: The last property id. |
| 1817 | */ |
| 1818 | guint |
| 1819 | fan_override_properties (GObjectClass *klass, guint property_id_begin) |
| 1820 | { |
| 1821 | g_object_class_override_property (klass, property_id_begin++, "speed"); |
| 1822 | g_object_class_override_property (klass, property_id_begin++, "cooling-zone"); |
| 1823 | g_object_class_override_property (klass, property_id_begin++, "pwm-num"); |
| 1824 | return property_id_begin - 1; |
| 1825 | } |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | /** |
| 1830 | * Fan: |
| 1831 | * |
| 1832 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 1833 | */ |
| 1834 | |
| 1835 | /** |
| 1836 | * FanIface: |
| 1837 | * @parent_iface: The parent interface. |
| 1838 | * @handle_get_speed: Handler for the #Fan::handle-get-speed signal. |
| 1839 | * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal. |
| 1840 | * @handle_set_speed: Handler for the #Fan::handle-set-speed signal. |
| 1841 | * @get_cooling_zone: Getter for the #Fan:cooling-zone property. |
| 1842 | * @get_pwm_num: Getter for the #Fan:pwm-num property. |
| 1843 | * @get_speed: Getter for the #Fan:speed property. |
| 1844 | * @speed_changed: Handler for the #Fan::speed-changed signal. |
| 1845 | * @tach_error: Handler for the #Fan::tach-error signal. |
| 1846 | * |
| 1847 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 1848 | */ |
| 1849 | |
| 1850 | typedef FanIface FanInterface; |
| 1851 | G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT); |
| 1852 | |
| 1853 | static void |
| 1854 | fan_default_init (FanIface *iface) |
| 1855 | { |
| 1856 | /* GObject signals for incoming D-Bus method calls: */ |
| 1857 | /** |
| 1858 | * Fan::handle-set-cooling-zone: |
| 1859 | * @object: A #Fan. |
| 1860 | * @invocation: A #GDBusMethodInvocation. |
| 1861 | * @arg_cooling_zone: Argument passed by remote caller. |
| 1862 | * |
| 1863 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. |
| 1864 | * |
| 1865 | * 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. |
| 1866 | * |
| 1867 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1868 | */ |
| 1869 | g_signal_new ("handle-set-cooling-zone", |
| 1870 | G_TYPE_FROM_INTERFACE (iface), |
| 1871 | G_SIGNAL_RUN_LAST, |
| 1872 | G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone), |
| 1873 | g_signal_accumulator_true_handled, |
| 1874 | NULL, |
| 1875 | g_cclosure_marshal_generic, |
| 1876 | G_TYPE_BOOLEAN, |
| 1877 | 2, |
| 1878 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 1879 | |
| 1880 | /** |
| 1881 | * Fan::handle-get-speed: |
| 1882 | * @object: A #Fan. |
| 1883 | * @invocation: A #GDBusMethodInvocation. |
| 1884 | * |
| 1885 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. |
| 1886 | * |
| 1887 | * 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. |
| 1888 | * |
| 1889 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1890 | */ |
| 1891 | g_signal_new ("handle-get-speed", |
| 1892 | G_TYPE_FROM_INTERFACE (iface), |
| 1893 | G_SIGNAL_RUN_LAST, |
| 1894 | G_STRUCT_OFFSET (FanIface, handle_get_speed), |
| 1895 | g_signal_accumulator_true_handled, |
| 1896 | NULL, |
| 1897 | g_cclosure_marshal_generic, |
| 1898 | G_TYPE_BOOLEAN, |
| 1899 | 1, |
| 1900 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 1901 | |
| 1902 | /** |
| 1903 | * Fan::handle-set-speed: |
| 1904 | * @object: A #Fan. |
| 1905 | * @invocation: A #GDBusMethodInvocation. |
| 1906 | * @arg_speed: Argument passed by remote caller. |
| 1907 | * |
| 1908 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. |
| 1909 | * |
| 1910 | * 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. |
| 1911 | * |
| 1912 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1913 | */ |
| 1914 | g_signal_new ("handle-set-speed", |
| 1915 | G_TYPE_FROM_INTERFACE (iface), |
| 1916 | G_SIGNAL_RUN_LAST, |
| 1917 | G_STRUCT_OFFSET (FanIface, handle_set_speed), |
| 1918 | g_signal_accumulator_true_handled, |
| 1919 | NULL, |
| 1920 | g_cclosure_marshal_generic, |
| 1921 | G_TYPE_BOOLEAN, |
| 1922 | 2, |
| 1923 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 1924 | |
| 1925 | /* GObject signals for received D-Bus signals: */ |
| 1926 | /** |
| 1927 | * Fan::speed-changed: |
| 1928 | * @object: A #Fan. |
| 1929 | * @arg_speed: Argument. |
| 1930 | * |
| 1931 | * 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. |
| 1932 | * |
| 1933 | * 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. |
| 1934 | */ |
| 1935 | g_signal_new ("speed-changed", |
| 1936 | G_TYPE_FROM_INTERFACE (iface), |
| 1937 | G_SIGNAL_RUN_LAST, |
| 1938 | G_STRUCT_OFFSET (FanIface, speed_changed), |
| 1939 | NULL, |
| 1940 | NULL, |
| 1941 | g_cclosure_marshal_generic, |
| 1942 | G_TYPE_NONE, |
| 1943 | 1, G_TYPE_INT); |
| 1944 | |
| 1945 | /** |
| 1946 | * Fan::tach-error: |
| 1947 | * @object: A #Fan. |
| 1948 | * |
| 1949 | * 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. |
| 1950 | * |
| 1951 | * 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. |
| 1952 | */ |
| 1953 | g_signal_new ("tach-error", |
| 1954 | G_TYPE_FROM_INTERFACE (iface), |
| 1955 | G_SIGNAL_RUN_LAST, |
| 1956 | G_STRUCT_OFFSET (FanIface, tach_error), |
| 1957 | NULL, |
| 1958 | NULL, |
| 1959 | g_cclosure_marshal_generic, |
| 1960 | G_TYPE_NONE, |
| 1961 | 0); |
| 1962 | |
| 1963 | /* GObject properties for D-Bus properties: */ |
| 1964 | /** |
| 1965 | * Fan:speed: |
| 1966 | * |
| 1967 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>. |
| 1968 | * |
| 1969 | * 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. |
| 1970 | */ |
| 1971 | g_object_interface_install_property (iface, |
| 1972 | g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1973 | /** |
| 1974 | * Fan:cooling-zone: |
| 1975 | * |
| 1976 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>. |
| 1977 | * |
| 1978 | * 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. |
| 1979 | */ |
| 1980 | g_object_interface_install_property (iface, |
| 1981 | g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1982 | /** |
| 1983 | * Fan:pwm-num: |
| 1984 | * |
| 1985 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>. |
| 1986 | * |
| 1987 | * 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. |
| 1988 | */ |
| 1989 | g_object_interface_install_property (iface, |
| 1990 | g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1991 | } |
| 1992 | |
| 1993 | /** |
| 1994 | * fan_get_speed: (skip) |
| 1995 | * @object: A #Fan. |
| 1996 | * |
| 1997 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property. |
| 1998 | * |
| 1999 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2000 | * |
| 2001 | * Returns: The property value. |
| 2002 | */ |
| 2003 | gint |
| 2004 | fan_get_speed (Fan *object) |
| 2005 | { |
| 2006 | return FAN_GET_IFACE (object)->get_speed (object); |
| 2007 | } |
| 2008 | |
| 2009 | /** |
| 2010 | * fan_set_speed: (skip) |
| 2011 | * @object: A #Fan. |
| 2012 | * @value: The value to set. |
| 2013 | * |
| 2014 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value. |
| 2015 | * |
| 2016 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2017 | */ |
| 2018 | void |
| 2019 | fan_set_speed (Fan *object, gint value) |
| 2020 | { |
| 2021 | g_object_set (G_OBJECT (object), "speed", value, NULL); |
| 2022 | } |
| 2023 | |
| 2024 | /** |
| 2025 | * fan_get_cooling_zone: (skip) |
| 2026 | * @object: A #Fan. |
| 2027 | * |
| 2028 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property. |
| 2029 | * |
| 2030 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2031 | * |
| 2032 | * Returns: The property value. |
| 2033 | */ |
| 2034 | gint |
| 2035 | fan_get_cooling_zone (Fan *object) |
| 2036 | { |
| 2037 | return FAN_GET_IFACE (object)->get_cooling_zone (object); |
| 2038 | } |
| 2039 | |
| 2040 | /** |
| 2041 | * fan_set_cooling_zone: (skip) |
| 2042 | * @object: A #Fan. |
| 2043 | * @value: The value to set. |
| 2044 | * |
| 2045 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value. |
| 2046 | * |
| 2047 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2048 | */ |
| 2049 | void |
| 2050 | fan_set_cooling_zone (Fan *object, gint value) |
| 2051 | { |
| 2052 | g_object_set (G_OBJECT (object), "cooling-zone", value, NULL); |
| 2053 | } |
| 2054 | |
| 2055 | /** |
| 2056 | * fan_get_pwm_num: (skip) |
| 2057 | * @object: A #Fan. |
| 2058 | * |
| 2059 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property. |
| 2060 | * |
| 2061 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2062 | * |
| 2063 | * Returns: The property value. |
| 2064 | */ |
| 2065 | gint |
| 2066 | fan_get_pwm_num (Fan *object) |
| 2067 | { |
| 2068 | return FAN_GET_IFACE (object)->get_pwm_num (object); |
| 2069 | } |
| 2070 | |
| 2071 | /** |
| 2072 | * fan_set_pwm_num: (skip) |
| 2073 | * @object: A #Fan. |
| 2074 | * @value: The value to set. |
| 2075 | * |
| 2076 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value. |
| 2077 | * |
| 2078 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2079 | */ |
| 2080 | void |
| 2081 | fan_set_pwm_num (Fan *object, gint value) |
| 2082 | { |
| 2083 | g_object_set (G_OBJECT (object), "pwm-num", value, NULL); |
| 2084 | } |
| 2085 | |
| 2086 | /** |
| 2087 | * fan_emit_speed_changed: |
| 2088 | * @object: A #Fan. |
| 2089 | * @arg_speed: Argument to pass with the signal. |
| 2090 | * |
| 2091 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal. |
| 2092 | */ |
| 2093 | void |
| 2094 | fan_emit_speed_changed ( |
| 2095 | Fan *object, |
| 2096 | gint arg_speed) |
| 2097 | { |
| 2098 | g_signal_emit_by_name (object, "speed-changed", arg_speed); |
| 2099 | } |
| 2100 | |
| 2101 | /** |
| 2102 | * fan_emit_tach_error: |
| 2103 | * @object: A #Fan. |
| 2104 | * |
| 2105 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal. |
| 2106 | */ |
| 2107 | void |
| 2108 | fan_emit_tach_error ( |
| 2109 | Fan *object) |
| 2110 | { |
| 2111 | g_signal_emit_by_name (object, "tach-error"); |
| 2112 | } |
| 2113 | |
| 2114 | /** |
| 2115 | * fan_call_set_cooling_zone: |
| 2116 | * @proxy: A #FanProxy. |
| 2117 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 2118 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2119 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2120 | * @user_data: User data to pass to @callback. |
| 2121 | * |
| 2122 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. |
| 2123 | * 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. |
| 2124 | * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation. |
| 2125 | * |
| 2126 | * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method. |
| 2127 | */ |
| 2128 | void |
| 2129 | fan_call_set_cooling_zone ( |
| 2130 | Fan *proxy, |
| 2131 | gint arg_cooling_zone, |
| 2132 | GCancellable *cancellable, |
| 2133 | GAsyncReadyCallback callback, |
| 2134 | gpointer user_data) |
| 2135 | { |
| 2136 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2137 | "setCoolingZone", |
| 2138 | g_variant_new ("(i)", |
| 2139 | arg_cooling_zone), |
| 2140 | G_DBUS_CALL_FLAGS_NONE, |
| 2141 | -1, |
| 2142 | cancellable, |
| 2143 | callback, |
| 2144 | user_data); |
| 2145 | } |
| 2146 | |
| 2147 | /** |
| 2148 | * fan_call_set_cooling_zone_finish: |
| 2149 | * @proxy: A #FanProxy. |
| 2150 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone(). |
| 2151 | * @error: Return location for error or %NULL. |
| 2152 | * |
| 2153 | * Finishes an operation started with fan_call_set_cooling_zone(). |
| 2154 | * |
| 2155 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2156 | */ |
| 2157 | gboolean |
| 2158 | fan_call_set_cooling_zone_finish ( |
| 2159 | Fan *proxy, |
| 2160 | GAsyncResult *res, |
| 2161 | GError **error) |
| 2162 | { |
| 2163 | GVariant *_ret; |
| 2164 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2165 | if (_ret == NULL) |
| 2166 | goto _out; |
| 2167 | g_variant_get (_ret, |
| 2168 | "()"); |
| 2169 | g_variant_unref (_ret); |
| 2170 | _out: |
| 2171 | return _ret != NULL; |
| 2172 | } |
| 2173 | |
| 2174 | /** |
| 2175 | * fan_call_set_cooling_zone_sync: |
| 2176 | * @proxy: A #FanProxy. |
| 2177 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 2178 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2179 | * @error: Return location for error or %NULL. |
| 2180 | * |
| 2181 | * 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. |
| 2182 | * |
| 2183 | * See fan_call_set_cooling_zone() for the asynchronous version of this method. |
| 2184 | * |
| 2185 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2186 | */ |
| 2187 | gboolean |
| 2188 | fan_call_set_cooling_zone_sync ( |
| 2189 | Fan *proxy, |
| 2190 | gint arg_cooling_zone, |
| 2191 | GCancellable *cancellable, |
| 2192 | GError **error) |
| 2193 | { |
| 2194 | GVariant *_ret; |
| 2195 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2196 | "setCoolingZone", |
| 2197 | g_variant_new ("(i)", |
| 2198 | arg_cooling_zone), |
| 2199 | G_DBUS_CALL_FLAGS_NONE, |
| 2200 | -1, |
| 2201 | cancellable, |
| 2202 | error); |
| 2203 | if (_ret == NULL) |
| 2204 | goto _out; |
| 2205 | g_variant_get (_ret, |
| 2206 | "()"); |
| 2207 | g_variant_unref (_ret); |
| 2208 | _out: |
| 2209 | return _ret != NULL; |
| 2210 | } |
| 2211 | |
| 2212 | /** |
| 2213 | * fan_call_get_speed: |
| 2214 | * @proxy: A #FanProxy. |
| 2215 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2216 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2217 | * @user_data: User data to pass to @callback. |
| 2218 | * |
| 2219 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. |
| 2220 | * 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. |
| 2221 | * You can then call fan_call_get_speed_finish() to get the result of the operation. |
| 2222 | * |
| 2223 | * See fan_call_get_speed_sync() for the synchronous, blocking version of this method. |
| 2224 | */ |
| 2225 | void |
| 2226 | fan_call_get_speed ( |
| 2227 | Fan *proxy, |
| 2228 | GCancellable *cancellable, |
| 2229 | GAsyncReadyCallback callback, |
| 2230 | gpointer user_data) |
| 2231 | { |
| 2232 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2233 | "getSpeed", |
| 2234 | g_variant_new ("()"), |
| 2235 | G_DBUS_CALL_FLAGS_NONE, |
| 2236 | -1, |
| 2237 | cancellable, |
| 2238 | callback, |
| 2239 | user_data); |
| 2240 | } |
| 2241 | |
| 2242 | /** |
| 2243 | * fan_call_get_speed_finish: |
| 2244 | * @proxy: A #FanProxy. |
| 2245 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 2246 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed(). |
| 2247 | * @error: Return location for error or %NULL. |
| 2248 | * |
| 2249 | * Finishes an operation started with fan_call_get_speed(). |
| 2250 | * |
| 2251 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2252 | */ |
| 2253 | gboolean |
| 2254 | fan_call_get_speed_finish ( |
| 2255 | Fan *proxy, |
| 2256 | gint *out_speed, |
| 2257 | GAsyncResult *res, |
| 2258 | GError **error) |
| 2259 | { |
| 2260 | GVariant *_ret; |
| 2261 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2262 | if (_ret == NULL) |
| 2263 | goto _out; |
| 2264 | g_variant_get (_ret, |
| 2265 | "(i)", |
| 2266 | out_speed); |
| 2267 | g_variant_unref (_ret); |
| 2268 | _out: |
| 2269 | return _ret != NULL; |
| 2270 | } |
| 2271 | |
| 2272 | /** |
| 2273 | * fan_call_get_speed_sync: |
| 2274 | * @proxy: A #FanProxy. |
| 2275 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 2276 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2277 | * @error: Return location for error or %NULL. |
| 2278 | * |
| 2279 | * 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. |
| 2280 | * |
| 2281 | * See fan_call_get_speed() for the asynchronous version of this method. |
| 2282 | * |
| 2283 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2284 | */ |
| 2285 | gboolean |
| 2286 | fan_call_get_speed_sync ( |
| 2287 | Fan *proxy, |
| 2288 | gint *out_speed, |
| 2289 | GCancellable *cancellable, |
| 2290 | GError **error) |
| 2291 | { |
| 2292 | GVariant *_ret; |
| 2293 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2294 | "getSpeed", |
| 2295 | g_variant_new ("()"), |
| 2296 | G_DBUS_CALL_FLAGS_NONE, |
| 2297 | -1, |
| 2298 | cancellable, |
| 2299 | error); |
| 2300 | if (_ret == NULL) |
| 2301 | goto _out; |
| 2302 | g_variant_get (_ret, |
| 2303 | "(i)", |
| 2304 | out_speed); |
| 2305 | g_variant_unref (_ret); |
| 2306 | _out: |
| 2307 | return _ret != NULL; |
| 2308 | } |
| 2309 | |
| 2310 | /** |
| 2311 | * fan_call_set_speed: |
| 2312 | * @proxy: A #FanProxy. |
| 2313 | * @arg_speed: Argument to pass with the method invocation. |
| 2314 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2315 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2316 | * @user_data: User data to pass to @callback. |
| 2317 | * |
| 2318 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. |
| 2319 | * 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. |
| 2320 | * You can then call fan_call_set_speed_finish() to get the result of the operation. |
| 2321 | * |
| 2322 | * See fan_call_set_speed_sync() for the synchronous, blocking version of this method. |
| 2323 | */ |
| 2324 | void |
| 2325 | fan_call_set_speed ( |
| 2326 | Fan *proxy, |
| 2327 | gint arg_speed, |
| 2328 | GCancellable *cancellable, |
| 2329 | GAsyncReadyCallback callback, |
| 2330 | gpointer user_data) |
| 2331 | { |
| 2332 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2333 | "setSpeed", |
| 2334 | g_variant_new ("(i)", |
| 2335 | arg_speed), |
| 2336 | G_DBUS_CALL_FLAGS_NONE, |
| 2337 | -1, |
| 2338 | cancellable, |
| 2339 | callback, |
| 2340 | user_data); |
| 2341 | } |
| 2342 | |
| 2343 | /** |
| 2344 | * fan_call_set_speed_finish: |
| 2345 | * @proxy: A #FanProxy. |
| 2346 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed(). |
| 2347 | * @error: Return location for error or %NULL. |
| 2348 | * |
| 2349 | * Finishes an operation started with fan_call_set_speed(). |
| 2350 | * |
| 2351 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2352 | */ |
| 2353 | gboolean |
| 2354 | fan_call_set_speed_finish ( |
| 2355 | Fan *proxy, |
| 2356 | GAsyncResult *res, |
| 2357 | GError **error) |
| 2358 | { |
| 2359 | GVariant *_ret; |
| 2360 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2361 | if (_ret == NULL) |
| 2362 | goto _out; |
| 2363 | g_variant_get (_ret, |
| 2364 | "()"); |
| 2365 | g_variant_unref (_ret); |
| 2366 | _out: |
| 2367 | return _ret != NULL; |
| 2368 | } |
| 2369 | |
| 2370 | /** |
| 2371 | * fan_call_set_speed_sync: |
| 2372 | * @proxy: A #FanProxy. |
| 2373 | * @arg_speed: Argument to pass with the method invocation. |
| 2374 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2375 | * @error: Return location for error or %NULL. |
| 2376 | * |
| 2377 | * 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. |
| 2378 | * |
| 2379 | * See fan_call_set_speed() for the asynchronous version of this method. |
| 2380 | * |
| 2381 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2382 | */ |
| 2383 | gboolean |
| 2384 | fan_call_set_speed_sync ( |
| 2385 | Fan *proxy, |
| 2386 | gint arg_speed, |
| 2387 | GCancellable *cancellable, |
| 2388 | GError **error) |
| 2389 | { |
| 2390 | GVariant *_ret; |
| 2391 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2392 | "setSpeed", |
| 2393 | g_variant_new ("(i)", |
| 2394 | arg_speed), |
| 2395 | G_DBUS_CALL_FLAGS_NONE, |
| 2396 | -1, |
| 2397 | cancellable, |
| 2398 | error); |
| 2399 | if (_ret == NULL) |
| 2400 | goto _out; |
| 2401 | g_variant_get (_ret, |
| 2402 | "()"); |
| 2403 | g_variant_unref (_ret); |
| 2404 | _out: |
| 2405 | return _ret != NULL; |
| 2406 | } |
| 2407 | |
| 2408 | /** |
| 2409 | * fan_complete_set_cooling_zone: |
| 2410 | * @object: A #Fan. |
| 2411 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2412 | * |
| 2413 | * 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. |
| 2414 | * |
| 2415 | * This method will free @invocation, you cannot use it afterwards. |
| 2416 | */ |
| 2417 | void |
| 2418 | fan_complete_set_cooling_zone ( |
| 2419 | Fan *object, |
| 2420 | GDBusMethodInvocation *invocation) |
| 2421 | { |
| 2422 | g_dbus_method_invocation_return_value (invocation, |
| 2423 | g_variant_new ("()")); |
| 2424 | } |
| 2425 | |
| 2426 | /** |
| 2427 | * fan_complete_get_speed: |
| 2428 | * @object: A #Fan. |
| 2429 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2430 | * @speed: Parameter to return. |
| 2431 | * |
| 2432 | * 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. |
| 2433 | * |
| 2434 | * This method will free @invocation, you cannot use it afterwards. |
| 2435 | */ |
| 2436 | void |
| 2437 | fan_complete_get_speed ( |
| 2438 | Fan *object, |
| 2439 | GDBusMethodInvocation *invocation, |
| 2440 | gint speed) |
| 2441 | { |
| 2442 | g_dbus_method_invocation_return_value (invocation, |
| 2443 | g_variant_new ("(i)", |
| 2444 | speed)); |
| 2445 | } |
| 2446 | |
| 2447 | /** |
| 2448 | * fan_complete_set_speed: |
| 2449 | * @object: A #Fan. |
| 2450 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2451 | * |
| 2452 | * 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. |
| 2453 | * |
| 2454 | * This method will free @invocation, you cannot use it afterwards. |
| 2455 | */ |
| 2456 | void |
| 2457 | fan_complete_set_speed ( |
| 2458 | Fan *object, |
| 2459 | GDBusMethodInvocation *invocation) |
| 2460 | { |
| 2461 | g_dbus_method_invocation_return_value (invocation, |
| 2462 | g_variant_new ("()")); |
| 2463 | } |
| 2464 | |
| 2465 | /* ------------------------------------------------------------------------ */ |
| 2466 | |
| 2467 | /** |
| 2468 | * FanProxy: |
| 2469 | * |
| 2470 | * The #FanProxy structure contains only private data and should only be accessed using the provided API. |
| 2471 | */ |
| 2472 | |
| 2473 | /** |
| 2474 | * FanProxyClass: |
| 2475 | * @parent_class: The parent class. |
| 2476 | * |
| 2477 | * Class structure for #FanProxy. |
| 2478 | */ |
| 2479 | |
| 2480 | struct _FanProxyPrivate |
| 2481 | { |
| 2482 | GData *qdata; |
| 2483 | }; |
| 2484 | |
| 2485 | static void fan_proxy_iface_init (FanIface *iface); |
| 2486 | |
| 2487 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2488 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 2489 | G_ADD_PRIVATE (FanProxy) |
| 2490 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 2491 | |
| 2492 | #else |
| 2493 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 2494 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 2495 | |
| 2496 | #endif |
| 2497 | static void |
| 2498 | fan_proxy_finalize (GObject *object) |
| 2499 | { |
| 2500 | FanProxy *proxy = FAN_PROXY (object); |
| 2501 | g_datalist_clear (&proxy->priv->qdata); |
| 2502 | G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object); |
| 2503 | } |
| 2504 | |
| 2505 | static void |
| 2506 | fan_proxy_get_property (GObject *object, |
| 2507 | guint prop_id, |
| 2508 | GValue *value, |
| 2509 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2510 | { |
| 2511 | const _ExtendedGDBusPropertyInfo *info; |
| 2512 | GVariant *variant; |
| 2513 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 2514 | info = _fan_property_info_pointers[prop_id - 1]; |
| 2515 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 2516 | if (info->use_gvariant) |
| 2517 | { |
| 2518 | g_value_set_variant (value, variant); |
| 2519 | } |
| 2520 | else |
| 2521 | { |
| 2522 | if (variant != NULL) |
| 2523 | g_dbus_gvariant_to_gvalue (variant, value); |
| 2524 | } |
| 2525 | if (variant != NULL) |
| 2526 | g_variant_unref (variant); |
| 2527 | } |
| 2528 | |
| 2529 | static void |
| 2530 | fan_proxy_set_property_cb (GDBusProxy *proxy, |
| 2531 | GAsyncResult *res, |
| 2532 | gpointer user_data) |
| 2533 | { |
| 2534 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 2535 | GError *error; |
| 2536 | GVariant *_ret; |
| 2537 | error = NULL; |
| 2538 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 2539 | if (!_ret) |
| 2540 | { |
| 2541 | g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)", |
| 2542 | info->parent_struct.name, |
| 2543 | error->message, g_quark_to_string (error->domain), error->code); |
| 2544 | g_error_free (error); |
| 2545 | } |
| 2546 | else |
| 2547 | { |
| 2548 | g_variant_unref (_ret); |
| 2549 | } |
| 2550 | } |
| 2551 | |
| 2552 | static void |
| 2553 | fan_proxy_set_property (GObject *object, |
| 2554 | guint prop_id, |
| 2555 | const GValue *value, |
| 2556 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2557 | { |
| 2558 | const _ExtendedGDBusPropertyInfo *info; |
| 2559 | GVariant *variant; |
| 2560 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 2561 | info = _fan_property_info_pointers[prop_id - 1]; |
| 2562 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 2563 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 2564 | "org.freedesktop.DBus.Properties.Set", |
| 2565 | g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant), |
| 2566 | G_DBUS_CALL_FLAGS_NONE, |
| 2567 | -1, |
| 2568 | NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 2569 | g_variant_unref (variant); |
| 2570 | } |
| 2571 | |
| 2572 | static void |
| 2573 | fan_proxy_g_signal (GDBusProxy *proxy, |
| 2574 | const gchar *sender_name G_GNUC_UNUSED, |
| 2575 | const gchar *signal_name, |
| 2576 | GVariant *parameters) |
| 2577 | { |
| 2578 | _ExtendedGDBusSignalInfo *info; |
| 2579 | GVariantIter iter; |
| 2580 | GVariant *child; |
| 2581 | GValue *paramv; |
| 2582 | guint num_params; |
| 2583 | guint n; |
| 2584 | guint signal_id; |
| 2585 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name); |
| 2586 | if (info == NULL) |
| 2587 | return; |
| 2588 | num_params = g_variant_n_children (parameters); |
| 2589 | paramv = g_new0 (GValue, num_params + 1); |
| 2590 | g_value_init (¶mv[0], TYPE_FAN); |
| 2591 | g_value_set_object (¶mv[0], proxy); |
| 2592 | g_variant_iter_init (&iter, parameters); |
| 2593 | n = 1; |
| 2594 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 2595 | { |
| 2596 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 2597 | if (arg_info->use_gvariant) |
| 2598 | { |
| 2599 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 2600 | g_value_set_variant (¶mv[n], child); |
| 2601 | n++; |
| 2602 | } |
| 2603 | else |
| 2604 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2605 | g_variant_unref (child); |
| 2606 | } |
| 2607 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 2608 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 2609 | for (n = 0; n < num_params + 1; n++) |
| 2610 | g_value_unset (¶mv[n]); |
| 2611 | g_free (paramv); |
| 2612 | } |
| 2613 | |
| 2614 | static void |
| 2615 | fan_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 2616 | GVariant *changed_properties, |
| 2617 | const gchar *const *invalidated_properties) |
| 2618 | { |
| 2619 | FanProxy *proxy = FAN_PROXY (_proxy); |
| 2620 | guint n; |
| 2621 | const gchar *key; |
| 2622 | GVariantIter *iter; |
| 2623 | _ExtendedGDBusPropertyInfo *info; |
| 2624 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 2625 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 2626 | { |
| 2627 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key); |
| 2628 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 2629 | if (info != NULL) |
| 2630 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2631 | } |
| 2632 | g_variant_iter_free (iter); |
| 2633 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 2634 | { |
| 2635 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]); |
| 2636 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 2637 | if (info != NULL) |
| 2638 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2639 | } |
| 2640 | } |
| 2641 | |
| 2642 | static gint |
| 2643 | fan_proxy_get_speed (Fan *object) |
| 2644 | { |
| 2645 | FanProxy *proxy = FAN_PROXY (object); |
| 2646 | GVariant *variant; |
| 2647 | gint value = 0; |
| 2648 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed"); |
| 2649 | if (variant != NULL) |
| 2650 | { |
| 2651 | value = g_variant_get_int32 (variant); |
| 2652 | g_variant_unref (variant); |
| 2653 | } |
| 2654 | return value; |
| 2655 | } |
| 2656 | |
| 2657 | static gint |
| 2658 | fan_proxy_get_cooling_zone (Fan *object) |
| 2659 | { |
| 2660 | FanProxy *proxy = FAN_PROXY (object); |
| 2661 | GVariant *variant; |
| 2662 | gint value = 0; |
| 2663 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone"); |
| 2664 | if (variant != NULL) |
| 2665 | { |
| 2666 | value = g_variant_get_int32 (variant); |
| 2667 | g_variant_unref (variant); |
| 2668 | } |
| 2669 | return value; |
| 2670 | } |
| 2671 | |
| 2672 | static gint |
| 2673 | fan_proxy_get_pwm_num (Fan *object) |
| 2674 | { |
| 2675 | FanProxy *proxy = FAN_PROXY (object); |
| 2676 | GVariant *variant; |
| 2677 | gint value = 0; |
| 2678 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num"); |
| 2679 | if (variant != NULL) |
| 2680 | { |
| 2681 | value = g_variant_get_int32 (variant); |
| 2682 | g_variant_unref (variant); |
| 2683 | } |
| 2684 | return value; |
| 2685 | } |
| 2686 | |
| 2687 | static void |
| 2688 | fan_proxy_init (FanProxy *proxy) |
| 2689 | { |
| 2690 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2691 | proxy->priv = fan_proxy_get_instance_private (proxy); |
| 2692 | #else |
| 2693 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate); |
| 2694 | #endif |
| 2695 | |
| 2696 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ()); |
| 2697 | } |
| 2698 | |
| 2699 | static void |
| 2700 | fan_proxy_class_init (FanProxyClass *klass) |
| 2701 | { |
| 2702 | GObjectClass *gobject_class; |
| 2703 | GDBusProxyClass *proxy_class; |
| 2704 | |
| 2705 | gobject_class = G_OBJECT_CLASS (klass); |
| 2706 | gobject_class->finalize = fan_proxy_finalize; |
| 2707 | gobject_class->get_property = fan_proxy_get_property; |
| 2708 | gobject_class->set_property = fan_proxy_set_property; |
| 2709 | |
| 2710 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 2711 | proxy_class->g_signal = fan_proxy_g_signal; |
| 2712 | proxy_class->g_properties_changed = fan_proxy_g_properties_changed; |
| 2713 | |
| 2714 | fan_override_properties (gobject_class, 1); |
| 2715 | |
| 2716 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 2717 | g_type_class_add_private (klass, sizeof (FanProxyPrivate)); |
| 2718 | #endif |
| 2719 | } |
| 2720 | |
| 2721 | static void |
| 2722 | fan_proxy_iface_init (FanIface *iface) |
| 2723 | { |
| 2724 | iface->get_speed = fan_proxy_get_speed; |
| 2725 | iface->get_cooling_zone = fan_proxy_get_cooling_zone; |
| 2726 | iface->get_pwm_num = fan_proxy_get_pwm_num; |
| 2727 | } |
| 2728 | |
| 2729 | /** |
| 2730 | * fan_proxy_new: |
| 2731 | * @connection: A #GDBusConnection. |
| 2732 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2733 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2734 | * @object_path: An object path. |
| 2735 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2736 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2737 | * @user_data: User data to pass to @callback. |
| 2738 | * |
| 2739 | * 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. |
| 2740 | * |
| 2741 | * 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. |
| 2742 | * You can then call fan_proxy_new_finish() to get the result of the operation. |
| 2743 | * |
| 2744 | * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 2745 | */ |
| 2746 | void |
| 2747 | fan_proxy_new ( |
| 2748 | GDBusConnection *connection, |
| 2749 | GDBusProxyFlags flags, |
| 2750 | const gchar *name, |
| 2751 | const gchar *object_path, |
| 2752 | GCancellable *cancellable, |
| 2753 | GAsyncReadyCallback callback, |
| 2754 | gpointer user_data) |
| 2755 | { |
| 2756 | 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); |
| 2757 | } |
| 2758 | |
| 2759 | /** |
| 2760 | * fan_proxy_new_finish: |
| 2761 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new(). |
| 2762 | * @error: Return location for error or %NULL |
| 2763 | * |
| 2764 | * Finishes an operation started with fan_proxy_new(). |
| 2765 | * |
| 2766 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2767 | */ |
| 2768 | Fan * |
| 2769 | fan_proxy_new_finish ( |
| 2770 | GAsyncResult *res, |
| 2771 | GError **error) |
| 2772 | { |
| 2773 | GObject *ret; |
| 2774 | GObject *source_object; |
| 2775 | source_object = g_async_result_get_source_object (res); |
| 2776 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2777 | g_object_unref (source_object); |
| 2778 | if (ret != NULL) |
| 2779 | return FAN (ret); |
| 2780 | else |
| 2781 | return NULL; |
| 2782 | } |
| 2783 | |
| 2784 | /** |
| 2785 | * fan_proxy_new_sync: |
| 2786 | * @connection: A #GDBusConnection. |
| 2787 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2788 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2789 | * @object_path: An object path. |
| 2790 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2791 | * @error: Return location for error or %NULL |
| 2792 | * |
| 2793 | * 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. |
| 2794 | * |
| 2795 | * The calling thread is blocked until a reply is received. |
| 2796 | * |
| 2797 | * See fan_proxy_new() for the asynchronous version of this constructor. |
| 2798 | * |
| 2799 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2800 | */ |
| 2801 | Fan * |
| 2802 | fan_proxy_new_sync ( |
| 2803 | GDBusConnection *connection, |
| 2804 | GDBusProxyFlags flags, |
| 2805 | const gchar *name, |
| 2806 | const gchar *object_path, |
| 2807 | GCancellable *cancellable, |
| 2808 | GError **error) |
| 2809 | { |
| 2810 | GInitable *ret; |
| 2811 | 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); |
| 2812 | if (ret != NULL) |
| 2813 | return FAN (ret); |
| 2814 | else |
| 2815 | return NULL; |
| 2816 | } |
| 2817 | |
| 2818 | |
| 2819 | /** |
| 2820 | * fan_proxy_new_for_bus: |
| 2821 | * @bus_type: A #GBusType. |
| 2822 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2823 | * @name: A bus name (well-known or unique). |
| 2824 | * @object_path: An object path. |
| 2825 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2826 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2827 | * @user_data: User data to pass to @callback. |
| 2828 | * |
| 2829 | * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 2830 | * |
| 2831 | * 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. |
| 2832 | * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation. |
| 2833 | * |
| 2834 | * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 2835 | */ |
| 2836 | void |
| 2837 | fan_proxy_new_for_bus ( |
| 2838 | GBusType bus_type, |
| 2839 | GDBusProxyFlags flags, |
| 2840 | const gchar *name, |
| 2841 | const gchar *object_path, |
| 2842 | GCancellable *cancellable, |
| 2843 | GAsyncReadyCallback callback, |
| 2844 | gpointer user_data) |
| 2845 | { |
| 2846 | 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); |
| 2847 | } |
| 2848 | |
| 2849 | /** |
| 2850 | * fan_proxy_new_for_bus_finish: |
| 2851 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus(). |
| 2852 | * @error: Return location for error or %NULL |
| 2853 | * |
| 2854 | * Finishes an operation started with fan_proxy_new_for_bus(). |
| 2855 | * |
| 2856 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2857 | */ |
| 2858 | Fan * |
| 2859 | fan_proxy_new_for_bus_finish ( |
| 2860 | GAsyncResult *res, |
| 2861 | GError **error) |
| 2862 | { |
| 2863 | GObject *ret; |
| 2864 | GObject *source_object; |
| 2865 | source_object = g_async_result_get_source_object (res); |
| 2866 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2867 | g_object_unref (source_object); |
| 2868 | if (ret != NULL) |
| 2869 | return FAN (ret); |
| 2870 | else |
| 2871 | return NULL; |
| 2872 | } |
| 2873 | |
| 2874 | /** |
| 2875 | * fan_proxy_new_for_bus_sync: |
| 2876 | * @bus_type: A #GBusType. |
| 2877 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2878 | * @name: A bus name (well-known or unique). |
| 2879 | * @object_path: An object path. |
| 2880 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2881 | * @error: Return location for error or %NULL |
| 2882 | * |
| 2883 | * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 2884 | * |
| 2885 | * The calling thread is blocked until a reply is received. |
| 2886 | * |
| 2887 | * See fan_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 2888 | * |
| 2889 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2890 | */ |
| 2891 | Fan * |
| 2892 | fan_proxy_new_for_bus_sync ( |
| 2893 | GBusType bus_type, |
| 2894 | GDBusProxyFlags flags, |
| 2895 | const gchar *name, |
| 2896 | const gchar *object_path, |
| 2897 | GCancellable *cancellable, |
| 2898 | GError **error) |
| 2899 | { |
| 2900 | GInitable *ret; |
| 2901 | 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); |
| 2902 | if (ret != NULL) |
| 2903 | return FAN (ret); |
| 2904 | else |
| 2905 | return NULL; |
| 2906 | } |
| 2907 | |
| 2908 | |
| 2909 | /* ------------------------------------------------------------------------ */ |
| 2910 | |
| 2911 | /** |
| 2912 | * FanSkeleton: |
| 2913 | * |
| 2914 | * The #FanSkeleton structure contains only private data and should only be accessed using the provided API. |
| 2915 | */ |
| 2916 | |
| 2917 | /** |
| 2918 | * FanSkeletonClass: |
| 2919 | * @parent_class: The parent class. |
| 2920 | * |
| 2921 | * Class structure for #FanSkeleton. |
| 2922 | */ |
| 2923 | |
| 2924 | struct _FanSkeletonPrivate |
| 2925 | { |
| 2926 | GValue *properties; |
| 2927 | GList *changed_properties; |
| 2928 | GSource *changed_properties_idle_source; |
| 2929 | GMainContext *context; |
| 2930 | GMutex lock; |
| 2931 | }; |
| 2932 | |
| 2933 | static void |
| 2934 | _fan_skeleton_handle_method_call ( |
| 2935 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2936 | const gchar *sender G_GNUC_UNUSED, |
| 2937 | const gchar *object_path G_GNUC_UNUSED, |
| 2938 | const gchar *interface_name, |
| 2939 | const gchar *method_name, |
| 2940 | GVariant *parameters, |
| 2941 | GDBusMethodInvocation *invocation, |
| 2942 | gpointer user_data) |
| 2943 | { |
| 2944 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 2945 | _ExtendedGDBusMethodInfo *info; |
| 2946 | GVariantIter iter; |
| 2947 | GVariant *child; |
| 2948 | GValue *paramv; |
| 2949 | guint num_params; |
| 2950 | guint num_extra; |
| 2951 | guint n; |
| 2952 | guint signal_id; |
| 2953 | GValue return_value = G_VALUE_INIT; |
| 2954 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 2955 | g_assert (info != NULL); |
| 2956 | num_params = g_variant_n_children (parameters); |
| 2957 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 2958 | n = 0; |
| 2959 | g_value_init (¶mv[n], TYPE_FAN); |
| 2960 | g_value_set_object (¶mv[n++], skeleton); |
| 2961 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 2962 | g_value_set_object (¶mv[n++], invocation); |
| 2963 | if (info->pass_fdlist) |
| 2964 | { |
| 2965 | #ifdef G_OS_UNIX |
| 2966 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 2967 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 2968 | #else |
| 2969 | g_assert_not_reached (); |
| 2970 | #endif |
| 2971 | } |
| 2972 | g_variant_iter_init (&iter, parameters); |
| 2973 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 2974 | { |
| 2975 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 2976 | if (arg_info->use_gvariant) |
| 2977 | { |
| 2978 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 2979 | g_value_set_variant (¶mv[n], child); |
| 2980 | n++; |
| 2981 | } |
| 2982 | else |
| 2983 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2984 | g_variant_unref (child); |
| 2985 | } |
| 2986 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 2987 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 2988 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 2989 | if (!g_value_get_boolean (&return_value)) |
| 2990 | 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); |
| 2991 | g_value_unset (&return_value); |
| 2992 | for (n = 0; n < num_params + num_extra; n++) |
| 2993 | g_value_unset (¶mv[n]); |
| 2994 | g_free (paramv); |
| 2995 | } |
| 2996 | |
| 2997 | static GVariant * |
| 2998 | _fan_skeleton_handle_get_property ( |
| 2999 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3000 | const gchar *sender G_GNUC_UNUSED, |
| 3001 | const gchar *object_path G_GNUC_UNUSED, |
| 3002 | const gchar *interface_name G_GNUC_UNUSED, |
| 3003 | const gchar *property_name, |
| 3004 | GError **error, |
| 3005 | gpointer user_data) |
| 3006 | { |
| 3007 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3008 | GValue value = G_VALUE_INIT; |
| 3009 | GParamSpec *pspec; |
| 3010 | _ExtendedGDBusPropertyInfo *info; |
| 3011 | GVariant *ret; |
| 3012 | ret = NULL; |
| 3013 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 3014 | g_assert (info != NULL); |
| 3015 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3016 | if (pspec == NULL) |
| 3017 | { |
| 3018 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3019 | } |
| 3020 | else |
| 3021 | { |
| 3022 | g_value_init (&value, pspec->value_type); |
| 3023 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3024 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3025 | g_value_unset (&value); |
| 3026 | } |
| 3027 | return ret; |
| 3028 | } |
| 3029 | |
| 3030 | static gboolean |
| 3031 | _fan_skeleton_handle_set_property ( |
| 3032 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3033 | const gchar *sender G_GNUC_UNUSED, |
| 3034 | const gchar *object_path G_GNUC_UNUSED, |
| 3035 | const gchar *interface_name G_GNUC_UNUSED, |
| 3036 | const gchar *property_name, |
| 3037 | GVariant *variant, |
| 3038 | GError **error, |
| 3039 | gpointer user_data) |
| 3040 | { |
| 3041 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3042 | GValue value = G_VALUE_INIT; |
| 3043 | GParamSpec *pspec; |
| 3044 | _ExtendedGDBusPropertyInfo *info; |
| 3045 | gboolean ret; |
| 3046 | ret = FALSE; |
| 3047 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 3048 | g_assert (info != NULL); |
| 3049 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3050 | if (pspec == NULL) |
| 3051 | { |
| 3052 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3053 | } |
| 3054 | else |
| 3055 | { |
| 3056 | if (info->use_gvariant) |
| 3057 | g_value_set_variant (&value, variant); |
| 3058 | else |
| 3059 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 3060 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3061 | g_value_unset (&value); |
| 3062 | ret = TRUE; |
| 3063 | } |
| 3064 | return ret; |
| 3065 | } |
| 3066 | |
| 3067 | static const GDBusInterfaceVTable _fan_skeleton_vtable = |
| 3068 | { |
| 3069 | _fan_skeleton_handle_method_call, |
| 3070 | _fan_skeleton_handle_get_property, |
| 3071 | _fan_skeleton_handle_set_property, |
| 3072 | {NULL} |
| 3073 | }; |
| 3074 | |
| 3075 | static GDBusInterfaceInfo * |
| 3076 | fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3077 | { |
| 3078 | return fan_interface_info (); |
| 3079 | } |
| 3080 | |
| 3081 | static GDBusInterfaceVTable * |
| 3082 | fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3083 | { |
| 3084 | return (GDBusInterfaceVTable *) &_fan_skeleton_vtable; |
| 3085 | } |
| 3086 | |
| 3087 | static GVariant * |
| 3088 | fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 3089 | { |
| 3090 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 3091 | |
| 3092 | GVariantBuilder builder; |
| 3093 | guint n; |
| 3094 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3095 | if (_fan_interface_info.parent_struct.properties == NULL) |
| 3096 | goto out; |
| 3097 | for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++) |
| 3098 | { |
| 3099 | GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n]; |
| 3100 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3101 | { |
| 3102 | GVariant *value; |
| 3103 | 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); |
| 3104 | if (value != NULL) |
| 3105 | { |
| 3106 | g_variant_take_ref (value); |
| 3107 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3108 | g_variant_unref (value); |
| 3109 | } |
| 3110 | } |
| 3111 | } |
| 3112 | out: |
| 3113 | return g_variant_builder_end (&builder); |
| 3114 | } |
| 3115 | |
| 3116 | static gboolean _fan_emit_changed (gpointer user_data); |
| 3117 | |
| 3118 | static void |
| 3119 | fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 3120 | { |
| 3121 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 3122 | gboolean emit_changed = FALSE; |
| 3123 | |
| 3124 | g_mutex_lock (&skeleton->priv->lock); |
| 3125 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3126 | { |
| 3127 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3128 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3129 | emit_changed = TRUE; |
| 3130 | } |
| 3131 | g_mutex_unlock (&skeleton->priv->lock); |
| 3132 | |
| 3133 | if (emit_changed) |
| 3134 | _fan_emit_changed (skeleton); |
| 3135 | } |
| 3136 | |
| 3137 | static void |
| 3138 | _fan_on_signal_speed_changed ( |
| 3139 | Fan *object, |
| 3140 | gint arg_speed) |
| 3141 | { |
| 3142 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3143 | |
| 3144 | GList *connections, *l; |
| 3145 | GVariant *signal_variant; |
| 3146 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3147 | |
| 3148 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 3149 | arg_speed)); |
| 3150 | for (l = connections; l != NULL; l = l->next) |
| 3151 | { |
| 3152 | GDBusConnection *connection = l->data; |
| 3153 | g_dbus_connection_emit_signal (connection, |
| 3154 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged", |
| 3155 | signal_variant, NULL); |
| 3156 | } |
| 3157 | g_variant_unref (signal_variant); |
| 3158 | g_list_free_full (connections, g_object_unref); |
| 3159 | } |
| 3160 | |
| 3161 | static void |
| 3162 | _fan_on_signal_tach_error ( |
| 3163 | Fan *object) |
| 3164 | { |
| 3165 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3166 | |
| 3167 | GList *connections, *l; |
| 3168 | GVariant *signal_variant; |
| 3169 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3170 | |
| 3171 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 3172 | for (l = connections; l != NULL; l = l->next) |
| 3173 | { |
| 3174 | GDBusConnection *connection = l->data; |
| 3175 | g_dbus_connection_emit_signal (connection, |
| 3176 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError", |
| 3177 | signal_variant, NULL); |
| 3178 | } |
| 3179 | g_variant_unref (signal_variant); |
| 3180 | g_list_free_full (connections, g_object_unref); |
| 3181 | } |
| 3182 | |
| 3183 | static void fan_skeleton_iface_init (FanIface *iface); |
| 3184 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3185 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3186 | G_ADD_PRIVATE (FanSkeleton) |
| 3187 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 3188 | |
| 3189 | #else |
| 3190 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3191 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 3192 | |
| 3193 | #endif |
| 3194 | static void |
| 3195 | fan_skeleton_finalize (GObject *object) |
| 3196 | { |
| 3197 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3198 | guint n; |
| 3199 | for (n = 0; n < 3; n++) |
| 3200 | g_value_unset (&skeleton->priv->properties[n]); |
| 3201 | g_free (skeleton->priv->properties); |
| 3202 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3203 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3204 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3205 | g_main_context_unref (skeleton->priv->context); |
| 3206 | g_mutex_clear (&skeleton->priv->lock); |
| 3207 | G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object); |
| 3208 | } |
| 3209 | |
| 3210 | static void |
| 3211 | fan_skeleton_get_property (GObject *object, |
| 3212 | guint prop_id, |
| 3213 | GValue *value, |
| 3214 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3215 | { |
| 3216 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3217 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3218 | g_mutex_lock (&skeleton->priv->lock); |
| 3219 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 3220 | g_mutex_unlock (&skeleton->priv->lock); |
| 3221 | } |
| 3222 | |
| 3223 | static gboolean |
| 3224 | _fan_emit_changed (gpointer user_data) |
| 3225 | { |
| 3226 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3227 | GList *l; |
| 3228 | GVariantBuilder builder; |
| 3229 | GVariantBuilder invalidated_builder; |
| 3230 | guint num_changes; |
| 3231 | |
| 3232 | g_mutex_lock (&skeleton->priv->lock); |
| 3233 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3234 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 3235 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3236 | { |
| 3237 | ChangedProperty *cp = l->data; |
| 3238 | GVariant *variant; |
| 3239 | const GValue *cur_value; |
| 3240 | |
| 3241 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3242 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3243 | { |
| 3244 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3245 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3246 | g_variant_unref (variant); |
| 3247 | num_changes++; |
| 3248 | } |
| 3249 | } |
| 3250 | if (num_changes > 0) |
| 3251 | { |
| 3252 | GList *connections, *ll; |
| 3253 | GVariant *signal_variant; |
| 3254 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan", |
| 3255 | &builder, &invalidated_builder)); |
| 3256 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3257 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3258 | { |
| 3259 | GDBusConnection *connection = ll->data; |
| 3260 | |
| 3261 | g_dbus_connection_emit_signal (connection, |
| 3262 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3263 | "org.freedesktop.DBus.Properties", |
| 3264 | "PropertiesChanged", |
| 3265 | signal_variant, |
| 3266 | NULL); |
| 3267 | } |
| 3268 | g_variant_unref (signal_variant); |
| 3269 | g_list_free_full (connections, g_object_unref); |
| 3270 | } |
| 3271 | else |
| 3272 | { |
| 3273 | g_variant_builder_clear (&builder); |
| 3274 | g_variant_builder_clear (&invalidated_builder); |
| 3275 | } |
| 3276 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3277 | skeleton->priv->changed_properties = NULL; |
| 3278 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3279 | g_mutex_unlock (&skeleton->priv->lock); |
| 3280 | return FALSE; |
| 3281 | } |
| 3282 | |
| 3283 | static void |
| 3284 | _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 3285 | { |
| 3286 | ChangedProperty *cp; |
| 3287 | GList *l; |
| 3288 | cp = NULL; |
| 3289 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 3290 | { |
| 3291 | ChangedProperty *i_cp = l->data; |
| 3292 | if (i_cp->info == info) |
| 3293 | { |
| 3294 | cp = i_cp; |
| 3295 | break; |
| 3296 | } |
| 3297 | } |
| 3298 | if (cp == NULL) |
| 3299 | { |
| 3300 | cp = g_new0 (ChangedProperty, 1); |
| 3301 | cp->prop_id = prop_id; |
| 3302 | cp->info = info; |
| 3303 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 3304 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 3305 | g_value_copy (orig_value, &cp->orig_value); |
| 3306 | } |
| 3307 | } |
| 3308 | |
| 3309 | static void |
| 3310 | fan_skeleton_notify (GObject *object, |
| 3311 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3312 | { |
| 3313 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3314 | g_mutex_lock (&skeleton->priv->lock); |
| 3315 | if (skeleton->priv->changed_properties != NULL && |
| 3316 | skeleton->priv->changed_properties_idle_source == NULL) |
| 3317 | { |
| 3318 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 3319 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 3320 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 3321 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 3322 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 3323 | } |
| 3324 | g_mutex_unlock (&skeleton->priv->lock); |
| 3325 | } |
| 3326 | |
| 3327 | static void |
| 3328 | fan_skeleton_set_property (GObject *object, |
| 3329 | guint prop_id, |
| 3330 | const GValue *value, |
| 3331 | GParamSpec *pspec) |
| 3332 | { |
| 3333 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3334 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3335 | g_mutex_lock (&skeleton->priv->lock); |
| 3336 | g_object_freeze_notify (object); |
| 3337 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 3338 | { |
| 3339 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 3340 | _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 3341 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 3342 | g_object_notify_by_pspec (object, pspec); |
| 3343 | } |
| 3344 | g_mutex_unlock (&skeleton->priv->lock); |
| 3345 | g_object_thaw_notify (object); |
| 3346 | } |
| 3347 | |
| 3348 | static void |
| 3349 | fan_skeleton_init (FanSkeleton *skeleton) |
| 3350 | { |
| 3351 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3352 | skeleton->priv = fan_skeleton_get_instance_private (skeleton); |
| 3353 | #else |
| 3354 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate); |
| 3355 | #endif |
| 3356 | |
| 3357 | g_mutex_init (&skeleton->priv->lock); |
| 3358 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 3359 | skeleton->priv->properties = g_new0 (GValue, 3); |
| 3360 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 3361 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 3362 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 3363 | } |
| 3364 | |
| 3365 | static gint |
| 3366 | fan_skeleton_get_speed (Fan *object) |
| 3367 | { |
| 3368 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3369 | gint value; |
| 3370 | g_mutex_lock (&skeleton->priv->lock); |
| 3371 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 3372 | g_mutex_unlock (&skeleton->priv->lock); |
| 3373 | return value; |
| 3374 | } |
| 3375 | |
| 3376 | static gint |
| 3377 | fan_skeleton_get_cooling_zone (Fan *object) |
| 3378 | { |
| 3379 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3380 | gint value; |
| 3381 | g_mutex_lock (&skeleton->priv->lock); |
| 3382 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 3383 | g_mutex_unlock (&skeleton->priv->lock); |
| 3384 | return value; |
| 3385 | } |
| 3386 | |
| 3387 | static gint |
| 3388 | fan_skeleton_get_pwm_num (Fan *object) |
| 3389 | { |
| 3390 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3391 | gint value; |
| 3392 | g_mutex_lock (&skeleton->priv->lock); |
| 3393 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 3394 | g_mutex_unlock (&skeleton->priv->lock); |
| 3395 | return value; |
| 3396 | } |
| 3397 | |
| 3398 | static void |
| 3399 | fan_skeleton_class_init (FanSkeletonClass *klass) |
| 3400 | { |
| 3401 | GObjectClass *gobject_class; |
| 3402 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 3403 | |
| 3404 | gobject_class = G_OBJECT_CLASS (klass); |
| 3405 | gobject_class->finalize = fan_skeleton_finalize; |
| 3406 | gobject_class->get_property = fan_skeleton_get_property; |
| 3407 | gobject_class->set_property = fan_skeleton_set_property; |
| 3408 | gobject_class->notify = fan_skeleton_notify; |
| 3409 | |
| 3410 | |
| 3411 | fan_override_properties (gobject_class, 1); |
| 3412 | |
| 3413 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 3414 | skeleton_class->get_info = fan_skeleton_dbus_interface_get_info; |
| 3415 | skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties; |
| 3416 | skeleton_class->flush = fan_skeleton_dbus_interface_flush; |
| 3417 | skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable; |
| 3418 | |
| 3419 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 3420 | g_type_class_add_private (klass, sizeof (FanSkeletonPrivate)); |
| 3421 | #endif |
| 3422 | } |
| 3423 | |
| 3424 | static void |
| 3425 | fan_skeleton_iface_init (FanIface *iface) |
| 3426 | { |
| 3427 | iface->speed_changed = _fan_on_signal_speed_changed; |
| 3428 | iface->tach_error = _fan_on_signal_tach_error; |
| 3429 | iface->get_speed = fan_skeleton_get_speed; |
| 3430 | iface->get_cooling_zone = fan_skeleton_get_cooling_zone; |
| 3431 | iface->get_pwm_num = fan_skeleton_get_pwm_num; |
| 3432 | } |
| 3433 | |
| 3434 | /** |
| 3435 | * fan_skeleton_new: |
| 3436 | * |
| 3437 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 3438 | * |
| 3439 | * Returns: (transfer full) (type FanSkeleton): The skeleton object. |
| 3440 | */ |
| 3441 | Fan * |
| 3442 | fan_skeleton_new (void) |
| 3443 | { |
| 3444 | return FAN (g_object_new (TYPE_FAN_SKELETON, NULL)); |
| 3445 | } |
| 3446 | |
| 3447 | /* ------------------------------------------------------------------------ |
| 3448 | * Code for interface org.openbmc.SensorValue |
| 3449 | * ------------------------------------------------------------------------ |
| 3450 | */ |
| 3451 | |
| 3452 | /** |
| 3453 | * SECTION:SensorValue |
| 3454 | * @title: SensorValue |
| 3455 | * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface |
| 3456 | * |
| 3457 | * 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. |
| 3458 | */ |
| 3459 | |
| 3460 | /* ---- Introspection data for org.openbmc.SensorValue ---- */ |
| 3461 | |
| 3462 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = |
| 3463 | { |
| 3464 | { |
| 3465 | -1, |
| 3466 | (gchar *) "init", |
| 3467 | NULL, |
| 3468 | NULL, |
| 3469 | NULL |
| 3470 | }, |
| 3471 | "handle-init", |
| 3472 | FALSE |
| 3473 | }; |
| 3474 | |
| 3475 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = |
| 3476 | { |
| 3477 | { |
| 3478 | -1, |
| 3479 | (gchar *) "value", |
| 3480 | (gchar *) "v", |
| 3481 | NULL |
| 3482 | }, |
| 3483 | FALSE |
| 3484 | }; |
| 3485 | |
| 3486 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = |
| 3487 | { |
| 3488 | &_sensor_value_method_info_get_value_OUT_ARG_value, |
| 3489 | NULL |
| 3490 | }; |
| 3491 | |
| 3492 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = |
| 3493 | { |
| 3494 | { |
| 3495 | -1, |
| 3496 | (gchar *) "getValue", |
| 3497 | NULL, |
| 3498 | (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, |
| 3499 | NULL |
| 3500 | }, |
| 3501 | "handle-get-value", |
| 3502 | FALSE |
| 3503 | }; |
| 3504 | |
| 3505 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = |
| 3506 | { |
| 3507 | { |
| 3508 | -1, |
| 3509 | (gchar *) "value", |
| 3510 | (gchar *) "v", |
| 3511 | NULL |
| 3512 | }, |
| 3513 | FALSE |
| 3514 | }; |
| 3515 | |
| 3516 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = |
| 3517 | { |
| 3518 | &_sensor_value_method_info_set_value_IN_ARG_value, |
| 3519 | NULL |
| 3520 | }; |
| 3521 | |
| 3522 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = |
| 3523 | { |
| 3524 | { |
| 3525 | -1, |
| 3526 | (gchar *) "setValue", |
| 3527 | (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, |
| 3528 | NULL, |
| 3529 | NULL |
| 3530 | }, |
| 3531 | "handle-set-value", |
| 3532 | FALSE |
| 3533 | }; |
| 3534 | |
| 3535 | static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = |
| 3536 | { |
| 3537 | &_sensor_value_method_info_init, |
| 3538 | &_sensor_value_method_info_get_value, |
| 3539 | &_sensor_value_method_info_set_value, |
| 3540 | NULL |
| 3541 | }; |
| 3542 | |
| 3543 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = |
| 3544 | { |
| 3545 | { |
| 3546 | -1, |
| 3547 | (gchar *) "value", |
| 3548 | (gchar *) "v", |
| 3549 | NULL |
| 3550 | }, |
| 3551 | FALSE |
| 3552 | }; |
| 3553 | |
| 3554 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = |
| 3555 | { |
| 3556 | { |
| 3557 | -1, |
| 3558 | (gchar *) "units", |
| 3559 | (gchar *) "s", |
| 3560 | NULL |
| 3561 | }, |
| 3562 | FALSE |
| 3563 | }; |
| 3564 | |
| 3565 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = |
| 3566 | { |
| 3567 | &_sensor_value_signal_info_changed_ARG_value, |
| 3568 | &_sensor_value_signal_info_changed_ARG_units, |
| 3569 | NULL |
| 3570 | }; |
| 3571 | |
| 3572 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = |
| 3573 | { |
| 3574 | { |
| 3575 | -1, |
| 3576 | (gchar *) "Changed", |
| 3577 | (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, |
| 3578 | NULL |
| 3579 | }, |
| 3580 | "changed" |
| 3581 | }; |
| 3582 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3583 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error = |
| 3584 | { |
| 3585 | { |
| 3586 | -1, |
| 3587 | (gchar *) "Error", |
| 3588 | NULL, |
| 3589 | NULL |
| 3590 | }, |
| 3591 | "error" |
| 3592 | }; |
| 3593 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3594 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = |
| 3595 | { |
| 3596 | { |
| 3597 | -1, |
| 3598 | (gchar *) "bus_name", |
| 3599 | (gchar *) "s", |
| 3600 | NULL |
| 3601 | }, |
| 3602 | FALSE |
| 3603 | }; |
| 3604 | |
| 3605 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = |
| 3606 | { |
| 3607 | &_sensor_value_signal_info_heartbeat_ARG_bus_name, |
| 3608 | NULL |
| 3609 | }; |
| 3610 | |
| 3611 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = |
| 3612 | { |
| 3613 | { |
| 3614 | -1, |
| 3615 | (gchar *) "Heartbeat", |
| 3616 | (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, |
| 3617 | NULL |
| 3618 | }, |
| 3619 | "heartbeat" |
| 3620 | }; |
| 3621 | |
| 3622 | static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = |
| 3623 | { |
| 3624 | &_sensor_value_signal_info_changed, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3625 | &_sensor_value_signal_info_error, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3626 | &_sensor_value_signal_info_heartbeat, |
| 3627 | NULL |
| 3628 | }; |
| 3629 | |
| 3630 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = |
| 3631 | { |
| 3632 | { |
| 3633 | -1, |
| 3634 | (gchar *) "value", |
| 3635 | (gchar *) "v", |
| 3636 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3637 | NULL |
| 3638 | }, |
| 3639 | "value", |
| 3640 | FALSE |
| 3641 | }; |
| 3642 | |
| 3643 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = |
| 3644 | { |
| 3645 | { |
| 3646 | -1, |
| 3647 | (gchar *) "units", |
| 3648 | (gchar *) "s", |
| 3649 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3650 | NULL |
| 3651 | }, |
| 3652 | "units", |
| 3653 | FALSE |
| 3654 | }; |
| 3655 | |
| 3656 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = |
| 3657 | { |
| 3658 | { |
| 3659 | -1, |
| 3660 | (gchar *) "poll_interval", |
| 3661 | (gchar *) "i", |
| 3662 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 3663 | NULL |
| 3664 | }, |
| 3665 | "poll-interval", |
| 3666 | FALSE |
| 3667 | }; |
| 3668 | |
| 3669 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = |
| 3670 | { |
| 3671 | { |
| 3672 | -1, |
| 3673 | (gchar *) "heatbeat", |
| 3674 | (gchar *) "i", |
| 3675 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3676 | NULL |
| 3677 | }, |
| 3678 | "heatbeat", |
| 3679 | FALSE |
| 3680 | }; |
| 3681 | |
| 3682 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = |
| 3683 | { |
| 3684 | { |
| 3685 | -1, |
| 3686 | (gchar *) "settable", |
| 3687 | (gchar *) "b", |
| 3688 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3689 | NULL |
| 3690 | }, |
| 3691 | "settable", |
| 3692 | FALSE |
| 3693 | }; |
| 3694 | |
| 3695 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_entity_id = |
| 3696 | { |
| 3697 | { |
| 3698 | -1, |
| 3699 | (gchar *) "ipmi_entity_id", |
| 3700 | (gchar *) "y", |
| 3701 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3702 | NULL |
| 3703 | }, |
| 3704 | "ipmi-entity-id", |
| 3705 | FALSE |
| 3706 | }; |
| 3707 | |
| 3708 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_id = |
| 3709 | { |
| 3710 | { |
| 3711 | -1, |
| 3712 | (gchar *) "ipmi_id", |
| 3713 | (gchar *) "y", |
| 3714 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 3715 | NULL |
| 3716 | }, |
| 3717 | "ipmi-id", |
| 3718 | FALSE |
| 3719 | }; |
| 3720 | |
| 3721 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
| 3722 | { |
| 3723 | &_sensor_value_property_info_value, |
| 3724 | &_sensor_value_property_info_units, |
| 3725 | &_sensor_value_property_info_poll_interval, |
| 3726 | &_sensor_value_property_info_heatbeat, |
| 3727 | &_sensor_value_property_info_settable, |
| 3728 | &_sensor_value_property_info_ipmi_entity_id, |
| 3729 | &_sensor_value_property_info_ipmi_id, |
| 3730 | NULL |
| 3731 | }; |
| 3732 | |
| 3733 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
| 3734 | { |
| 3735 | { |
| 3736 | -1, |
| 3737 | (gchar *) "org.openbmc.SensorValue", |
| 3738 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 3739 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 3740 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
| 3741 | NULL |
| 3742 | }, |
| 3743 | "sensor-value", |
| 3744 | }; |
| 3745 | |
| 3746 | |
| 3747 | /** |
| 3748 | * sensor_value_interface_info: |
| 3749 | * |
| 3750 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. |
| 3751 | * |
| 3752 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 3753 | */ |
| 3754 | GDBusInterfaceInfo * |
| 3755 | sensor_value_interface_info (void) |
| 3756 | { |
| 3757 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
| 3758 | } |
| 3759 | |
| 3760 | /** |
| 3761 | * sensor_value_override_properties: |
| 3762 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 3763 | * @property_id_begin: The property id to assign to the first overridden property. |
| 3764 | * |
| 3765 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
| 3766 | * The properties are overridden in the order they are defined. |
| 3767 | * |
| 3768 | * Returns: The last property id. |
| 3769 | */ |
| 3770 | guint |
| 3771 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
| 3772 | { |
| 3773 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 3774 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 3775 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 3776 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 3777 | g_object_class_override_property (klass, property_id_begin++, "settable"); |
| 3778 | g_object_class_override_property (klass, property_id_begin++, "ipmi-entity-id"); |
| 3779 | g_object_class_override_property (klass, property_id_begin++, "ipmi-id"); |
| 3780 | return property_id_begin - 1; |
| 3781 | } |
| 3782 | |
| 3783 | |
| 3784 | |
| 3785 | /** |
| 3786 | * SensorValue: |
| 3787 | * |
| 3788 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 3789 | */ |
| 3790 | |
| 3791 | /** |
| 3792 | * SensorValueIface: |
| 3793 | * @parent_iface: The parent interface. |
| 3794 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 3795 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
| 3796 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
| 3797 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
| 3798 | * @get_ipmi_entity_id: Getter for the #SensorValue:ipmi-entity-id property. |
| 3799 | * @get_ipmi_id: Getter for the #SensorValue:ipmi-id property. |
| 3800 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
| 3801 | * @get_settable: Getter for the #SensorValue:settable property. |
| 3802 | * @get_units: Getter for the #SensorValue:units property. |
| 3803 | * @get_value: Getter for the #SensorValue:value property. |
| 3804 | * @changed: Handler for the #SensorValue::changed signal. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3805 | * @error: Handler for the #SensorValue::error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3806 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
| 3807 | * |
| 3808 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 3809 | */ |
| 3810 | |
| 3811 | typedef SensorValueIface SensorValueInterface; |
| 3812 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
| 3813 | |
| 3814 | static void |
| 3815 | sensor_value_default_init (SensorValueIface *iface) |
| 3816 | { |
| 3817 | /* GObject signals for incoming D-Bus method calls: */ |
| 3818 | /** |
| 3819 | * SensorValue::handle-init: |
| 3820 | * @object: A #SensorValue. |
| 3821 | * @invocation: A #GDBusMethodInvocation. |
| 3822 | * |
| 3823 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. |
| 3824 | * |
| 3825 | * 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. |
| 3826 | * |
| 3827 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3828 | */ |
| 3829 | g_signal_new ("handle-init", |
| 3830 | G_TYPE_FROM_INTERFACE (iface), |
| 3831 | G_SIGNAL_RUN_LAST, |
| 3832 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
| 3833 | g_signal_accumulator_true_handled, |
| 3834 | NULL, |
| 3835 | g_cclosure_marshal_generic, |
| 3836 | G_TYPE_BOOLEAN, |
| 3837 | 1, |
| 3838 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3839 | |
| 3840 | /** |
| 3841 | * SensorValue::handle-get-value: |
| 3842 | * @object: A #SensorValue. |
| 3843 | * @invocation: A #GDBusMethodInvocation. |
| 3844 | * |
| 3845 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. |
| 3846 | * |
| 3847 | * 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. |
| 3848 | * |
| 3849 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3850 | */ |
| 3851 | g_signal_new ("handle-get-value", |
| 3852 | G_TYPE_FROM_INTERFACE (iface), |
| 3853 | G_SIGNAL_RUN_LAST, |
| 3854 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
| 3855 | g_signal_accumulator_true_handled, |
| 3856 | NULL, |
| 3857 | g_cclosure_marshal_generic, |
| 3858 | G_TYPE_BOOLEAN, |
| 3859 | 1, |
| 3860 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3861 | |
| 3862 | /** |
| 3863 | * SensorValue::handle-set-value: |
| 3864 | * @object: A #SensorValue. |
| 3865 | * @invocation: A #GDBusMethodInvocation. |
| 3866 | * @arg_value: Argument passed by remote caller. |
| 3867 | * |
| 3868 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. |
| 3869 | * |
| 3870 | * 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. |
| 3871 | * |
| 3872 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3873 | */ |
| 3874 | g_signal_new ("handle-set-value", |
| 3875 | G_TYPE_FROM_INTERFACE (iface), |
| 3876 | G_SIGNAL_RUN_LAST, |
| 3877 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
| 3878 | g_signal_accumulator_true_handled, |
| 3879 | NULL, |
| 3880 | g_cclosure_marshal_generic, |
| 3881 | G_TYPE_BOOLEAN, |
| 3882 | 2, |
| 3883 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 3884 | |
| 3885 | /* GObject signals for received D-Bus signals: */ |
| 3886 | /** |
| 3887 | * SensorValue::changed: |
| 3888 | * @object: A #SensorValue. |
| 3889 | * @arg_value: Argument. |
| 3890 | * @arg_units: Argument. |
| 3891 | * |
| 3892 | * 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. |
| 3893 | * |
| 3894 | * 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. |
| 3895 | */ |
| 3896 | g_signal_new ("changed", |
| 3897 | G_TYPE_FROM_INTERFACE (iface), |
| 3898 | G_SIGNAL_RUN_LAST, |
| 3899 | G_STRUCT_OFFSET (SensorValueIface, changed), |
| 3900 | NULL, |
| 3901 | NULL, |
| 3902 | g_cclosure_marshal_generic, |
| 3903 | G_TYPE_NONE, |
| 3904 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
| 3905 | |
| 3906 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3907 | * SensorValue::error: |
| 3908 | * @object: A #SensorValue. |
| 3909 | * |
| 3910 | * 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. |
| 3911 | * |
| 3912 | * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. |
| 3913 | */ |
| 3914 | g_signal_new ("error", |
| 3915 | G_TYPE_FROM_INTERFACE (iface), |
| 3916 | G_SIGNAL_RUN_LAST, |
| 3917 | G_STRUCT_OFFSET (SensorValueIface, error), |
| 3918 | NULL, |
| 3919 | NULL, |
| 3920 | g_cclosure_marshal_generic, |
| 3921 | G_TYPE_NONE, |
| 3922 | 0); |
| 3923 | |
| 3924 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3925 | * SensorValue::heartbeat: |
| 3926 | * @object: A #SensorValue. |
| 3927 | * @arg_bus_name: Argument. |
| 3928 | * |
| 3929 | * 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. |
| 3930 | * |
| 3931 | * 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. |
| 3932 | */ |
| 3933 | g_signal_new ("heartbeat", |
| 3934 | G_TYPE_FROM_INTERFACE (iface), |
| 3935 | G_SIGNAL_RUN_LAST, |
| 3936 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
| 3937 | NULL, |
| 3938 | NULL, |
| 3939 | g_cclosure_marshal_generic, |
| 3940 | G_TYPE_NONE, |
| 3941 | 1, G_TYPE_STRING); |
| 3942 | |
| 3943 | /* GObject properties for D-Bus properties: */ |
| 3944 | /** |
| 3945 | * SensorValue:value: |
| 3946 | * |
| 3947 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. |
| 3948 | * |
| 3949 | * 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. |
| 3950 | */ |
| 3951 | g_object_interface_install_property (iface, |
| 3952 | g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3953 | /** |
| 3954 | * SensorValue:units: |
| 3955 | * |
| 3956 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. |
| 3957 | * |
| 3958 | * 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. |
| 3959 | */ |
| 3960 | g_object_interface_install_property (iface, |
| 3961 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3962 | /** |
| 3963 | * SensorValue:poll-interval: |
| 3964 | * |
| 3965 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. |
| 3966 | * |
| 3967 | * 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. |
| 3968 | */ |
| 3969 | g_object_interface_install_property (iface, |
| 3970 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3971 | /** |
| 3972 | * SensorValue:heatbeat: |
| 3973 | * |
| 3974 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. |
| 3975 | * |
| 3976 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
| 3977 | */ |
| 3978 | g_object_interface_install_property (iface, |
| 3979 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3980 | /** |
| 3981 | * SensorValue:settable: |
| 3982 | * |
| 3983 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. |
| 3984 | * |
| 3985 | * 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. |
| 3986 | */ |
| 3987 | g_object_interface_install_property (iface, |
| 3988 | g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3989 | /** |
| 3990 | * SensorValue:ipmi-entity-id: |
| 3991 | * |
| 3992 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link>. |
| 3993 | * |
| 3994 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
| 3995 | */ |
| 3996 | g_object_interface_install_property (iface, |
| 3997 | g_param_spec_uchar ("ipmi-entity-id", "ipmi_entity_id", "ipmi_entity_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3998 | /** |
| 3999 | * SensorValue:ipmi-id: |
| 4000 | * |
| 4001 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link>. |
| 4002 | * |
| 4003 | * 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. |
| 4004 | */ |
| 4005 | g_object_interface_install_property (iface, |
| 4006 | g_param_spec_uchar ("ipmi-id", "ipmi_id", "ipmi_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4007 | } |
| 4008 | |
| 4009 | /** |
| 4010 | * sensor_value_get_value: (skip) |
| 4011 | * @object: A #SensorValue. |
| 4012 | * |
| 4013 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 4014 | * |
| 4015 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4016 | * |
| 4017 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning> |
| 4018 | * |
| 4019 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4020 | */ |
| 4021 | GVariant * |
| 4022 | sensor_value_get_value (SensorValue *object) |
| 4023 | { |
| 4024 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
| 4025 | } |
| 4026 | |
| 4027 | /** |
| 4028 | * sensor_value_dup_value: (skip) |
| 4029 | * @object: A #SensorValue. |
| 4030 | * |
| 4031 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 4032 | * |
| 4033 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4034 | * |
| 4035 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4036 | */ |
| 4037 | GVariant * |
| 4038 | sensor_value_dup_value (SensorValue *object) |
| 4039 | { |
| 4040 | GVariant *value; |
| 4041 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 4042 | return value; |
| 4043 | } |
| 4044 | |
| 4045 | /** |
| 4046 | * sensor_value_set_value: (skip) |
| 4047 | * @object: A #SensorValue. |
| 4048 | * @value: The value to set. |
| 4049 | * |
| 4050 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. |
| 4051 | * |
| 4052 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4053 | */ |
| 4054 | void |
| 4055 | sensor_value_set_value (SensorValue *object, GVariant *value) |
| 4056 | { |
| 4057 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 4058 | } |
| 4059 | |
| 4060 | /** |
| 4061 | * sensor_value_get_units: (skip) |
| 4062 | * @object: A #SensorValue. |
| 4063 | * |
| 4064 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 4065 | * |
| 4066 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4067 | * |
| 4068 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning> |
| 4069 | * |
| 4070 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4071 | */ |
| 4072 | const gchar * |
| 4073 | sensor_value_get_units (SensorValue *object) |
| 4074 | { |
| 4075 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
| 4076 | } |
| 4077 | |
| 4078 | /** |
| 4079 | * sensor_value_dup_units: (skip) |
| 4080 | * @object: A #SensorValue. |
| 4081 | * |
| 4082 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 4083 | * |
| 4084 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4085 | * |
| 4086 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4087 | */ |
| 4088 | gchar * |
| 4089 | sensor_value_dup_units (SensorValue *object) |
| 4090 | { |
| 4091 | gchar *value; |
| 4092 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 4093 | return value; |
| 4094 | } |
| 4095 | |
| 4096 | /** |
| 4097 | * sensor_value_set_units: (skip) |
| 4098 | * @object: A #SensorValue. |
| 4099 | * @value: The value to set. |
| 4100 | * |
| 4101 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. |
| 4102 | * |
| 4103 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4104 | */ |
| 4105 | void |
| 4106 | sensor_value_set_units (SensorValue *object, const gchar *value) |
| 4107 | { |
| 4108 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 4109 | } |
| 4110 | |
| 4111 | /** |
| 4112 | * sensor_value_get_poll_interval: (skip) |
| 4113 | * @object: A #SensorValue. |
| 4114 | * |
| 4115 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. |
| 4116 | * |
| 4117 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4118 | * |
| 4119 | * Returns: The property value. |
| 4120 | */ |
| 4121 | gint |
| 4122 | sensor_value_get_poll_interval (SensorValue *object) |
| 4123 | { |
| 4124 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
| 4125 | } |
| 4126 | |
| 4127 | /** |
| 4128 | * sensor_value_set_poll_interval: (skip) |
| 4129 | * @object: A #SensorValue. |
| 4130 | * @value: The value to set. |
| 4131 | * |
| 4132 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 4133 | * |
| 4134 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4135 | */ |
| 4136 | void |
| 4137 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
| 4138 | { |
| 4139 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 4140 | } |
| 4141 | |
| 4142 | /** |
| 4143 | * sensor_value_get_heatbeat: (skip) |
| 4144 | * @object: A #SensorValue. |
| 4145 | * |
| 4146 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. |
| 4147 | * |
| 4148 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4149 | * |
| 4150 | * Returns: The property value. |
| 4151 | */ |
| 4152 | gint |
| 4153 | sensor_value_get_heatbeat (SensorValue *object) |
| 4154 | { |
| 4155 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
| 4156 | } |
| 4157 | |
| 4158 | /** |
| 4159 | * sensor_value_set_heatbeat: (skip) |
| 4160 | * @object: A #SensorValue. |
| 4161 | * @value: The value to set. |
| 4162 | * |
| 4163 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 4164 | * |
| 4165 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4166 | */ |
| 4167 | void |
| 4168 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
| 4169 | { |
| 4170 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 4171 | } |
| 4172 | |
| 4173 | /** |
| 4174 | * sensor_value_get_settable: (skip) |
| 4175 | * @object: A #SensorValue. |
| 4176 | * |
| 4177 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. |
| 4178 | * |
| 4179 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4180 | * |
| 4181 | * Returns: The property value. |
| 4182 | */ |
| 4183 | gboolean |
| 4184 | sensor_value_get_settable (SensorValue *object) |
| 4185 | { |
| 4186 | return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); |
| 4187 | } |
| 4188 | |
| 4189 | /** |
| 4190 | * sensor_value_set_settable: (skip) |
| 4191 | * @object: A #SensorValue. |
| 4192 | * @value: The value to set. |
| 4193 | * |
| 4194 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. |
| 4195 | * |
| 4196 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4197 | */ |
| 4198 | void |
| 4199 | sensor_value_set_settable (SensorValue *object, gboolean value) |
| 4200 | { |
| 4201 | g_object_set (G_OBJECT (object), "settable", value, NULL); |
| 4202 | } |
| 4203 | |
| 4204 | /** |
| 4205 | * sensor_value_get_ipmi_entity_id: (skip) |
| 4206 | * @object: A #SensorValue. |
| 4207 | * |
| 4208 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property. |
| 4209 | * |
| 4210 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4211 | * |
| 4212 | * Returns: The property value. |
| 4213 | */ |
| 4214 | guchar |
| 4215 | sensor_value_get_ipmi_entity_id (SensorValue *object) |
| 4216 | { |
| 4217 | return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_entity_id (object); |
| 4218 | } |
| 4219 | |
| 4220 | /** |
| 4221 | * sensor_value_set_ipmi_entity_id: (skip) |
| 4222 | * @object: A #SensorValue. |
| 4223 | * @value: The value to set. |
| 4224 | * |
| 4225 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property to @value. |
| 4226 | * |
| 4227 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4228 | */ |
| 4229 | void |
| 4230 | sensor_value_set_ipmi_entity_id (SensorValue *object, guchar value) |
| 4231 | { |
| 4232 | g_object_set (G_OBJECT (object), "ipmi-entity-id", value, NULL); |
| 4233 | } |
| 4234 | |
| 4235 | /** |
| 4236 | * sensor_value_get_ipmi_id: (skip) |
| 4237 | * @object: A #SensorValue. |
| 4238 | * |
| 4239 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property. |
| 4240 | * |
| 4241 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4242 | * |
| 4243 | * Returns: The property value. |
| 4244 | */ |
| 4245 | guchar |
| 4246 | sensor_value_get_ipmi_id (SensorValue *object) |
| 4247 | { |
| 4248 | return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_id (object); |
| 4249 | } |
| 4250 | |
| 4251 | /** |
| 4252 | * sensor_value_set_ipmi_id: (skip) |
| 4253 | * @object: A #SensorValue. |
| 4254 | * @value: The value to set. |
| 4255 | * |
| 4256 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property to @value. |
| 4257 | * |
| 4258 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4259 | */ |
| 4260 | void |
| 4261 | sensor_value_set_ipmi_id (SensorValue *object, guchar value) |
| 4262 | { |
| 4263 | g_object_set (G_OBJECT (object), "ipmi-id", value, NULL); |
| 4264 | } |
| 4265 | |
| 4266 | /** |
| 4267 | * sensor_value_emit_changed: |
| 4268 | * @object: A #SensorValue. |
| 4269 | * @arg_value: Argument to pass with the signal. |
| 4270 | * @arg_units: Argument to pass with the signal. |
| 4271 | * |
| 4272 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. |
| 4273 | */ |
| 4274 | void |
| 4275 | sensor_value_emit_changed ( |
| 4276 | SensorValue *object, |
| 4277 | GVariant *arg_value, |
| 4278 | const gchar *arg_units) |
| 4279 | { |
| 4280 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
| 4281 | } |
| 4282 | |
| 4283 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4284 | * sensor_value_emit_error: |
| 4285 | * @object: A #SensorValue. |
| 4286 | * |
| 4287 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal. |
| 4288 | */ |
| 4289 | void |
| 4290 | sensor_value_emit_error ( |
| 4291 | SensorValue *object) |
| 4292 | { |
| 4293 | g_signal_emit_by_name (object, "error"); |
| 4294 | } |
| 4295 | |
| 4296 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4297 | * sensor_value_emit_heartbeat: |
| 4298 | * @object: A #SensorValue. |
| 4299 | * @arg_bus_name: Argument to pass with the signal. |
| 4300 | * |
| 4301 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 4302 | */ |
| 4303 | void |
| 4304 | sensor_value_emit_heartbeat ( |
| 4305 | SensorValue *object, |
| 4306 | const gchar *arg_bus_name) |
| 4307 | { |
| 4308 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 4309 | } |
| 4310 | |
| 4311 | /** |
| 4312 | * sensor_value_call_init: |
| 4313 | * @proxy: A #SensorValueProxy. |
| 4314 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4315 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4316 | * @user_data: User data to pass to @callback. |
| 4317 | * |
| 4318 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. |
| 4319 | * 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. |
| 4320 | * You can then call sensor_value_call_init_finish() to get the result of the operation. |
| 4321 | * |
| 4322 | * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. |
| 4323 | */ |
| 4324 | void |
| 4325 | sensor_value_call_init ( |
| 4326 | SensorValue *proxy, |
| 4327 | GCancellable *cancellable, |
| 4328 | GAsyncReadyCallback callback, |
| 4329 | gpointer user_data) |
| 4330 | { |
| 4331 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4332 | "init", |
| 4333 | g_variant_new ("()"), |
| 4334 | G_DBUS_CALL_FLAGS_NONE, |
| 4335 | -1, |
| 4336 | cancellable, |
| 4337 | callback, |
| 4338 | user_data); |
| 4339 | } |
| 4340 | |
| 4341 | /** |
| 4342 | * sensor_value_call_init_finish: |
| 4343 | * @proxy: A #SensorValueProxy. |
| 4344 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). |
| 4345 | * @error: Return location for error or %NULL. |
| 4346 | * |
| 4347 | * Finishes an operation started with sensor_value_call_init(). |
| 4348 | * |
| 4349 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4350 | */ |
| 4351 | gboolean |
| 4352 | sensor_value_call_init_finish ( |
| 4353 | SensorValue *proxy, |
| 4354 | GAsyncResult *res, |
| 4355 | GError **error) |
| 4356 | { |
| 4357 | GVariant *_ret; |
| 4358 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4359 | if (_ret == NULL) |
| 4360 | goto _out; |
| 4361 | g_variant_get (_ret, |
| 4362 | "()"); |
| 4363 | g_variant_unref (_ret); |
| 4364 | _out: |
| 4365 | return _ret != NULL; |
| 4366 | } |
| 4367 | |
| 4368 | /** |
| 4369 | * sensor_value_call_init_sync: |
| 4370 | * @proxy: A #SensorValueProxy. |
| 4371 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4372 | * @error: Return location for error or %NULL. |
| 4373 | * |
| 4374 | * 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. |
| 4375 | * |
| 4376 | * See sensor_value_call_init() for the asynchronous version of this method. |
| 4377 | * |
| 4378 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4379 | */ |
| 4380 | gboolean |
| 4381 | sensor_value_call_init_sync ( |
| 4382 | SensorValue *proxy, |
| 4383 | GCancellable *cancellable, |
| 4384 | GError **error) |
| 4385 | { |
| 4386 | GVariant *_ret; |
| 4387 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4388 | "init", |
| 4389 | g_variant_new ("()"), |
| 4390 | G_DBUS_CALL_FLAGS_NONE, |
| 4391 | -1, |
| 4392 | cancellable, |
| 4393 | error); |
| 4394 | if (_ret == NULL) |
| 4395 | goto _out; |
| 4396 | g_variant_get (_ret, |
| 4397 | "()"); |
| 4398 | g_variant_unref (_ret); |
| 4399 | _out: |
| 4400 | return _ret != NULL; |
| 4401 | } |
| 4402 | |
| 4403 | /** |
| 4404 | * sensor_value_call_get_value: |
| 4405 | * @proxy: A #SensorValueProxy. |
| 4406 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4407 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4408 | * @user_data: User data to pass to @callback. |
| 4409 | * |
| 4410 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. |
| 4411 | * 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. |
| 4412 | * You can then call sensor_value_call_get_value_finish() to get the result of the operation. |
| 4413 | * |
| 4414 | * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. |
| 4415 | */ |
| 4416 | void |
| 4417 | sensor_value_call_get_value ( |
| 4418 | SensorValue *proxy, |
| 4419 | GCancellable *cancellable, |
| 4420 | GAsyncReadyCallback callback, |
| 4421 | gpointer user_data) |
| 4422 | { |
| 4423 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4424 | "getValue", |
| 4425 | g_variant_new ("()"), |
| 4426 | G_DBUS_CALL_FLAGS_NONE, |
| 4427 | -1, |
| 4428 | cancellable, |
| 4429 | callback, |
| 4430 | user_data); |
| 4431 | } |
| 4432 | |
| 4433 | /** |
| 4434 | * sensor_value_call_get_value_finish: |
| 4435 | * @proxy: A #SensorValueProxy. |
| 4436 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 4437 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). |
| 4438 | * @error: Return location for error or %NULL. |
| 4439 | * |
| 4440 | * Finishes an operation started with sensor_value_call_get_value(). |
| 4441 | * |
| 4442 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4443 | */ |
| 4444 | gboolean |
| 4445 | sensor_value_call_get_value_finish ( |
| 4446 | SensorValue *proxy, |
| 4447 | GVariant **out_value, |
| 4448 | GAsyncResult *res, |
| 4449 | GError **error) |
| 4450 | { |
| 4451 | GVariant *_ret; |
| 4452 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4453 | if (_ret == NULL) |
| 4454 | goto _out; |
| 4455 | g_variant_get (_ret, |
| 4456 | "(@v)", |
| 4457 | out_value); |
| 4458 | g_variant_unref (_ret); |
| 4459 | _out: |
| 4460 | return _ret != NULL; |
| 4461 | } |
| 4462 | |
| 4463 | /** |
| 4464 | * sensor_value_call_get_value_sync: |
| 4465 | * @proxy: A #SensorValueProxy. |
| 4466 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 4467 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4468 | * @error: Return location for error or %NULL. |
| 4469 | * |
| 4470 | * 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. |
| 4471 | * |
| 4472 | * See sensor_value_call_get_value() for the asynchronous version of this method. |
| 4473 | * |
| 4474 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4475 | */ |
| 4476 | gboolean |
| 4477 | sensor_value_call_get_value_sync ( |
| 4478 | SensorValue *proxy, |
| 4479 | GVariant **out_value, |
| 4480 | GCancellable *cancellable, |
| 4481 | GError **error) |
| 4482 | { |
| 4483 | GVariant *_ret; |
| 4484 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4485 | "getValue", |
| 4486 | g_variant_new ("()"), |
| 4487 | G_DBUS_CALL_FLAGS_NONE, |
| 4488 | -1, |
| 4489 | cancellable, |
| 4490 | error); |
| 4491 | if (_ret == NULL) |
| 4492 | goto _out; |
| 4493 | g_variant_get (_ret, |
| 4494 | "(@v)", |
| 4495 | out_value); |
| 4496 | g_variant_unref (_ret); |
| 4497 | _out: |
| 4498 | return _ret != NULL; |
| 4499 | } |
| 4500 | |
| 4501 | /** |
| 4502 | * sensor_value_call_set_value: |
| 4503 | * @proxy: A #SensorValueProxy. |
| 4504 | * @arg_value: Argument to pass with the method invocation. |
| 4505 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4506 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4507 | * @user_data: User data to pass to @callback. |
| 4508 | * |
| 4509 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. |
| 4510 | * 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. |
| 4511 | * You can then call sensor_value_call_set_value_finish() to get the result of the operation. |
| 4512 | * |
| 4513 | * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. |
| 4514 | */ |
| 4515 | void |
| 4516 | sensor_value_call_set_value ( |
| 4517 | SensorValue *proxy, |
| 4518 | GVariant *arg_value, |
| 4519 | GCancellable *cancellable, |
| 4520 | GAsyncReadyCallback callback, |
| 4521 | gpointer user_data) |
| 4522 | { |
| 4523 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4524 | "setValue", |
| 4525 | g_variant_new ("(@v)", |
| 4526 | arg_value), |
| 4527 | G_DBUS_CALL_FLAGS_NONE, |
| 4528 | -1, |
| 4529 | cancellable, |
| 4530 | callback, |
| 4531 | user_data); |
| 4532 | } |
| 4533 | |
| 4534 | /** |
| 4535 | * sensor_value_call_set_value_finish: |
| 4536 | * @proxy: A #SensorValueProxy. |
| 4537 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). |
| 4538 | * @error: Return location for error or %NULL. |
| 4539 | * |
| 4540 | * Finishes an operation started with sensor_value_call_set_value(). |
| 4541 | * |
| 4542 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4543 | */ |
| 4544 | gboolean |
| 4545 | sensor_value_call_set_value_finish ( |
| 4546 | SensorValue *proxy, |
| 4547 | GAsyncResult *res, |
| 4548 | GError **error) |
| 4549 | { |
| 4550 | GVariant *_ret; |
| 4551 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4552 | if (_ret == NULL) |
| 4553 | goto _out; |
| 4554 | g_variant_get (_ret, |
| 4555 | "()"); |
| 4556 | g_variant_unref (_ret); |
| 4557 | _out: |
| 4558 | return _ret != NULL; |
| 4559 | } |
| 4560 | |
| 4561 | /** |
| 4562 | * sensor_value_call_set_value_sync: |
| 4563 | * @proxy: A #SensorValueProxy. |
| 4564 | * @arg_value: Argument to pass with the method invocation. |
| 4565 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4566 | * @error: Return location for error or %NULL. |
| 4567 | * |
| 4568 | * 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. |
| 4569 | * |
| 4570 | * See sensor_value_call_set_value() for the asynchronous version of this method. |
| 4571 | * |
| 4572 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4573 | */ |
| 4574 | gboolean |
| 4575 | sensor_value_call_set_value_sync ( |
| 4576 | SensorValue *proxy, |
| 4577 | GVariant *arg_value, |
| 4578 | GCancellable *cancellable, |
| 4579 | GError **error) |
| 4580 | { |
| 4581 | GVariant *_ret; |
| 4582 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4583 | "setValue", |
| 4584 | g_variant_new ("(@v)", |
| 4585 | arg_value), |
| 4586 | G_DBUS_CALL_FLAGS_NONE, |
| 4587 | -1, |
| 4588 | cancellable, |
| 4589 | error); |
| 4590 | if (_ret == NULL) |
| 4591 | goto _out; |
| 4592 | g_variant_get (_ret, |
| 4593 | "()"); |
| 4594 | g_variant_unref (_ret); |
| 4595 | _out: |
| 4596 | return _ret != NULL; |
| 4597 | } |
| 4598 | |
| 4599 | /** |
| 4600 | * sensor_value_complete_init: |
| 4601 | * @object: A #SensorValue. |
| 4602 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 4603 | * |
| 4604 | * 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. |
| 4605 | * |
| 4606 | * This method will free @invocation, you cannot use it afterwards. |
| 4607 | */ |
| 4608 | void |
| 4609 | sensor_value_complete_init ( |
| 4610 | SensorValue *object, |
| 4611 | GDBusMethodInvocation *invocation) |
| 4612 | { |
| 4613 | g_dbus_method_invocation_return_value (invocation, |
| 4614 | g_variant_new ("()")); |
| 4615 | } |
| 4616 | |
| 4617 | /** |
| 4618 | * sensor_value_complete_get_value: |
| 4619 | * @object: A #SensorValue. |
| 4620 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 4621 | * @value: Parameter to return. |
| 4622 | * |
| 4623 | * 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. |
| 4624 | * |
| 4625 | * This method will free @invocation, you cannot use it afterwards. |
| 4626 | */ |
| 4627 | void |
| 4628 | sensor_value_complete_get_value ( |
| 4629 | SensorValue *object, |
| 4630 | GDBusMethodInvocation *invocation, |
| 4631 | GVariant *value) |
| 4632 | { |
| 4633 | g_dbus_method_invocation_return_value (invocation, |
| 4634 | g_variant_new ("(@v)", |
| 4635 | value)); |
| 4636 | } |
| 4637 | |
| 4638 | /** |
| 4639 | * sensor_value_complete_set_value: |
| 4640 | * @object: A #SensorValue. |
| 4641 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 4642 | * |
| 4643 | * 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. |
| 4644 | * |
| 4645 | * This method will free @invocation, you cannot use it afterwards. |
| 4646 | */ |
| 4647 | void |
| 4648 | sensor_value_complete_set_value ( |
| 4649 | SensorValue *object, |
| 4650 | GDBusMethodInvocation *invocation) |
| 4651 | { |
| 4652 | g_dbus_method_invocation_return_value (invocation, |
| 4653 | g_variant_new ("()")); |
| 4654 | } |
| 4655 | |
| 4656 | /* ------------------------------------------------------------------------ */ |
| 4657 | |
| 4658 | /** |
| 4659 | * SensorValueProxy: |
| 4660 | * |
| 4661 | * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. |
| 4662 | */ |
| 4663 | |
| 4664 | /** |
| 4665 | * SensorValueProxyClass: |
| 4666 | * @parent_class: The parent class. |
| 4667 | * |
| 4668 | * Class structure for #SensorValueProxy. |
| 4669 | */ |
| 4670 | |
| 4671 | struct _SensorValueProxyPrivate |
| 4672 | { |
| 4673 | GData *qdata; |
| 4674 | }; |
| 4675 | |
| 4676 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
| 4677 | |
| 4678 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4679 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 4680 | G_ADD_PRIVATE (SensorValueProxy) |
| 4681 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 4682 | |
| 4683 | #else |
| 4684 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 4685 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 4686 | |
| 4687 | #endif |
| 4688 | static void |
| 4689 | sensor_value_proxy_finalize (GObject *object) |
| 4690 | { |
| 4691 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4692 | g_datalist_clear (&proxy->priv->qdata); |
| 4693 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
| 4694 | } |
| 4695 | |
| 4696 | static void |
| 4697 | sensor_value_proxy_get_property (GObject *object, |
| 4698 | guint prop_id, |
| 4699 | GValue *value, |
| 4700 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4701 | { |
| 4702 | const _ExtendedGDBusPropertyInfo *info; |
| 4703 | GVariant *variant; |
| 4704 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
| 4705 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 4706 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 4707 | if (info->use_gvariant) |
| 4708 | { |
| 4709 | g_value_set_variant (value, variant); |
| 4710 | } |
| 4711 | else |
| 4712 | { |
| 4713 | if (variant != NULL) |
| 4714 | g_dbus_gvariant_to_gvalue (variant, value); |
| 4715 | } |
| 4716 | if (variant != NULL) |
| 4717 | g_variant_unref (variant); |
| 4718 | } |
| 4719 | |
| 4720 | static void |
| 4721 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
| 4722 | GAsyncResult *res, |
| 4723 | gpointer user_data) |
| 4724 | { |
| 4725 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 4726 | GError *error; |
| 4727 | GVariant *_ret; |
| 4728 | error = NULL; |
| 4729 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 4730 | if (!_ret) |
| 4731 | { |
| 4732 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", |
| 4733 | info->parent_struct.name, |
| 4734 | error->message, g_quark_to_string (error->domain), error->code); |
| 4735 | g_error_free (error); |
| 4736 | } |
| 4737 | else |
| 4738 | { |
| 4739 | g_variant_unref (_ret); |
| 4740 | } |
| 4741 | } |
| 4742 | |
| 4743 | static void |
| 4744 | sensor_value_proxy_set_property (GObject *object, |
| 4745 | guint prop_id, |
| 4746 | const GValue *value, |
| 4747 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4748 | { |
| 4749 | const _ExtendedGDBusPropertyInfo *info; |
| 4750 | GVariant *variant; |
| 4751 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
| 4752 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 4753 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4754 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 4755 | "org.freedesktop.DBus.Properties.Set", |
| 4756 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
| 4757 | G_DBUS_CALL_FLAGS_NONE, |
| 4758 | -1, |
| 4759 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 4760 | g_variant_unref (variant); |
| 4761 | } |
| 4762 | |
| 4763 | static void |
| 4764 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
| 4765 | const gchar *sender_name G_GNUC_UNUSED, |
| 4766 | const gchar *signal_name, |
| 4767 | GVariant *parameters) |
| 4768 | { |
| 4769 | _ExtendedGDBusSignalInfo *info; |
| 4770 | GVariantIter iter; |
| 4771 | GVariant *child; |
| 4772 | GValue *paramv; |
| 4773 | guint num_params; |
| 4774 | guint n; |
| 4775 | guint signal_id; |
| 4776 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); |
| 4777 | if (info == NULL) |
| 4778 | return; |
| 4779 | num_params = g_variant_n_children (parameters); |
| 4780 | paramv = g_new0 (GValue, num_params + 1); |
| 4781 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
| 4782 | g_value_set_object (¶mv[0], proxy); |
| 4783 | g_variant_iter_init (&iter, parameters); |
| 4784 | n = 1; |
| 4785 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4786 | { |
| 4787 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 4788 | if (arg_info->use_gvariant) |
| 4789 | { |
| 4790 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4791 | g_value_set_variant (¶mv[n], child); |
| 4792 | n++; |
| 4793 | } |
| 4794 | else |
| 4795 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4796 | g_variant_unref (child); |
| 4797 | } |
| 4798 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 4799 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 4800 | for (n = 0; n < num_params + 1; n++) |
| 4801 | g_value_unset (¶mv[n]); |
| 4802 | g_free (paramv); |
| 4803 | } |
| 4804 | |
| 4805 | static void |
| 4806 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 4807 | GVariant *changed_properties, |
| 4808 | const gchar *const *invalidated_properties) |
| 4809 | { |
| 4810 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
| 4811 | guint n; |
| 4812 | const gchar *key; |
| 4813 | GVariantIter *iter; |
| 4814 | _ExtendedGDBusPropertyInfo *info; |
| 4815 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 4816 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 4817 | { |
| 4818 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); |
| 4819 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 4820 | if (info != NULL) |
| 4821 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4822 | } |
| 4823 | g_variant_iter_free (iter); |
| 4824 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 4825 | { |
| 4826 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); |
| 4827 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 4828 | if (info != NULL) |
| 4829 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4830 | } |
| 4831 | } |
| 4832 | |
| 4833 | static GVariant * |
| 4834 | sensor_value_proxy_get_value (SensorValue *object) |
| 4835 | { |
| 4836 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4837 | GVariant *variant; |
| 4838 | GVariant *value = NULL; |
| 4839 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 4840 | value = variant; |
| 4841 | if (variant != NULL) |
| 4842 | g_variant_unref (variant); |
| 4843 | return value; |
| 4844 | } |
| 4845 | |
| 4846 | static const gchar * |
| 4847 | sensor_value_proxy_get_units (SensorValue *object) |
| 4848 | { |
| 4849 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4850 | GVariant *variant; |
| 4851 | const gchar *value = NULL; |
| 4852 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 4853 | if (variant != NULL) |
| 4854 | { |
| 4855 | value = g_variant_get_string (variant, NULL); |
| 4856 | g_variant_unref (variant); |
| 4857 | } |
| 4858 | return value; |
| 4859 | } |
| 4860 | |
| 4861 | static gint |
| 4862 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
| 4863 | { |
| 4864 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4865 | GVariant *variant; |
| 4866 | gint value = 0; |
| 4867 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 4868 | if (variant != NULL) |
| 4869 | { |
| 4870 | value = g_variant_get_int32 (variant); |
| 4871 | g_variant_unref (variant); |
| 4872 | } |
| 4873 | return value; |
| 4874 | } |
| 4875 | |
| 4876 | static gint |
| 4877 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
| 4878 | { |
| 4879 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4880 | GVariant *variant; |
| 4881 | gint value = 0; |
| 4882 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 4883 | if (variant != NULL) |
| 4884 | { |
| 4885 | value = g_variant_get_int32 (variant); |
| 4886 | g_variant_unref (variant); |
| 4887 | } |
| 4888 | return value; |
| 4889 | } |
| 4890 | |
| 4891 | static gboolean |
| 4892 | sensor_value_proxy_get_settable (SensorValue *object) |
| 4893 | { |
| 4894 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4895 | GVariant *variant; |
| 4896 | gboolean value = 0; |
| 4897 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); |
| 4898 | if (variant != NULL) |
| 4899 | { |
| 4900 | value = g_variant_get_boolean (variant); |
| 4901 | g_variant_unref (variant); |
| 4902 | } |
| 4903 | return value; |
| 4904 | } |
| 4905 | |
| 4906 | static guchar |
| 4907 | sensor_value_proxy_get_ipmi_entity_id (SensorValue *object) |
| 4908 | { |
| 4909 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4910 | GVariant *variant; |
| 4911 | guchar value = 0; |
| 4912 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_entity_id"); |
| 4913 | if (variant != NULL) |
| 4914 | { |
| 4915 | value = g_variant_get_byte (variant); |
| 4916 | g_variant_unref (variant); |
| 4917 | } |
| 4918 | return value; |
| 4919 | } |
| 4920 | |
| 4921 | static guchar |
| 4922 | sensor_value_proxy_get_ipmi_id (SensorValue *object) |
| 4923 | { |
| 4924 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4925 | GVariant *variant; |
| 4926 | guchar value = 0; |
| 4927 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_id"); |
| 4928 | if (variant != NULL) |
| 4929 | { |
| 4930 | value = g_variant_get_byte (variant); |
| 4931 | g_variant_unref (variant); |
| 4932 | } |
| 4933 | return value; |
| 4934 | } |
| 4935 | |
| 4936 | static void |
| 4937 | sensor_value_proxy_init (SensorValueProxy *proxy) |
| 4938 | { |
| 4939 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4940 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
| 4941 | #else |
| 4942 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); |
| 4943 | #endif |
| 4944 | |
| 4945 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); |
| 4946 | } |
| 4947 | |
| 4948 | static void |
| 4949 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
| 4950 | { |
| 4951 | GObjectClass *gobject_class; |
| 4952 | GDBusProxyClass *proxy_class; |
| 4953 | |
| 4954 | gobject_class = G_OBJECT_CLASS (klass); |
| 4955 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 4956 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 4957 | gobject_class->set_property = sensor_value_proxy_set_property; |
| 4958 | |
| 4959 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 4960 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 4961 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
| 4962 | |
| 4963 | sensor_value_override_properties (gobject_class, 1); |
| 4964 | |
| 4965 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4966 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
| 4967 | #endif |
| 4968 | } |
| 4969 | |
| 4970 | static void |
| 4971 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
| 4972 | { |
| 4973 | iface->get_value = sensor_value_proxy_get_value; |
| 4974 | iface->get_units = sensor_value_proxy_get_units; |
| 4975 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 4976 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
| 4977 | iface->get_settable = sensor_value_proxy_get_settable; |
| 4978 | iface->get_ipmi_entity_id = sensor_value_proxy_get_ipmi_entity_id; |
| 4979 | iface->get_ipmi_id = sensor_value_proxy_get_ipmi_id; |
| 4980 | } |
| 4981 | |
| 4982 | /** |
| 4983 | * sensor_value_proxy_new: |
| 4984 | * @connection: A #GDBusConnection. |
| 4985 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4986 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4987 | * @object_path: An object path. |
| 4988 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4989 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4990 | * @user_data: User data to pass to @callback. |
| 4991 | * |
| 4992 | * 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. |
| 4993 | * |
| 4994 | * 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. |
| 4995 | * You can then call sensor_value_proxy_new_finish() to get the result of the operation. |
| 4996 | * |
| 4997 | * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 4998 | */ |
| 4999 | void |
| 5000 | sensor_value_proxy_new ( |
| 5001 | GDBusConnection *connection, |
| 5002 | GDBusProxyFlags flags, |
| 5003 | const gchar *name, |
| 5004 | const gchar *object_path, |
| 5005 | GCancellable *cancellable, |
| 5006 | GAsyncReadyCallback callback, |
| 5007 | gpointer user_data) |
| 5008 | { |
| 5009 | 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); |
| 5010 | } |
| 5011 | |
| 5012 | /** |
| 5013 | * sensor_value_proxy_new_finish: |
| 5014 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). |
| 5015 | * @error: Return location for error or %NULL |
| 5016 | * |
| 5017 | * Finishes an operation started with sensor_value_proxy_new(). |
| 5018 | * |
| 5019 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5020 | */ |
| 5021 | SensorValue * |
| 5022 | sensor_value_proxy_new_finish ( |
| 5023 | GAsyncResult *res, |
| 5024 | GError **error) |
| 5025 | { |
| 5026 | GObject *ret; |
| 5027 | GObject *source_object; |
| 5028 | source_object = g_async_result_get_source_object (res); |
| 5029 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5030 | g_object_unref (source_object); |
| 5031 | if (ret != NULL) |
| 5032 | return SENSOR_VALUE (ret); |
| 5033 | else |
| 5034 | return NULL; |
| 5035 | } |
| 5036 | |
| 5037 | /** |
| 5038 | * sensor_value_proxy_new_sync: |
| 5039 | * @connection: A #GDBusConnection. |
| 5040 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5041 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5042 | * @object_path: An object path. |
| 5043 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5044 | * @error: Return location for error or %NULL |
| 5045 | * |
| 5046 | * 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. |
| 5047 | * |
| 5048 | * The calling thread is blocked until a reply is received. |
| 5049 | * |
| 5050 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
| 5051 | * |
| 5052 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5053 | */ |
| 5054 | SensorValue * |
| 5055 | sensor_value_proxy_new_sync ( |
| 5056 | GDBusConnection *connection, |
| 5057 | GDBusProxyFlags flags, |
| 5058 | const gchar *name, |
| 5059 | const gchar *object_path, |
| 5060 | GCancellable *cancellable, |
| 5061 | GError **error) |
| 5062 | { |
| 5063 | GInitable *ret; |
| 5064 | 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); |
| 5065 | if (ret != NULL) |
| 5066 | return SENSOR_VALUE (ret); |
| 5067 | else |
| 5068 | return NULL; |
| 5069 | } |
| 5070 | |
| 5071 | |
| 5072 | /** |
| 5073 | * sensor_value_proxy_new_for_bus: |
| 5074 | * @bus_type: A #GBusType. |
| 5075 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5076 | * @name: A bus name (well-known or unique). |
| 5077 | * @object_path: An object path. |
| 5078 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5079 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5080 | * @user_data: User data to pass to @callback. |
| 5081 | * |
| 5082 | * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 5083 | * |
| 5084 | * 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. |
| 5085 | * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. |
| 5086 | * |
| 5087 | * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 5088 | */ |
| 5089 | void |
| 5090 | sensor_value_proxy_new_for_bus ( |
| 5091 | GBusType bus_type, |
| 5092 | GDBusProxyFlags flags, |
| 5093 | const gchar *name, |
| 5094 | const gchar *object_path, |
| 5095 | GCancellable *cancellable, |
| 5096 | GAsyncReadyCallback callback, |
| 5097 | gpointer user_data) |
| 5098 | { |
| 5099 | 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); |
| 5100 | } |
| 5101 | |
| 5102 | /** |
| 5103 | * sensor_value_proxy_new_for_bus_finish: |
| 5104 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). |
| 5105 | * @error: Return location for error or %NULL |
| 5106 | * |
| 5107 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
| 5108 | * |
| 5109 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5110 | */ |
| 5111 | SensorValue * |
| 5112 | sensor_value_proxy_new_for_bus_finish ( |
| 5113 | GAsyncResult *res, |
| 5114 | GError **error) |
| 5115 | { |
| 5116 | GObject *ret; |
| 5117 | GObject *source_object; |
| 5118 | source_object = g_async_result_get_source_object (res); |
| 5119 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5120 | g_object_unref (source_object); |
| 5121 | if (ret != NULL) |
| 5122 | return SENSOR_VALUE (ret); |
| 5123 | else |
| 5124 | return NULL; |
| 5125 | } |
| 5126 | |
| 5127 | /** |
| 5128 | * sensor_value_proxy_new_for_bus_sync: |
| 5129 | * @bus_type: A #GBusType. |
| 5130 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5131 | * @name: A bus name (well-known or unique). |
| 5132 | * @object_path: An object path. |
| 5133 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5134 | * @error: Return location for error or %NULL |
| 5135 | * |
| 5136 | * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 5137 | * |
| 5138 | * The calling thread is blocked until a reply is received. |
| 5139 | * |
| 5140 | * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 5141 | * |
| 5142 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5143 | */ |
| 5144 | SensorValue * |
| 5145 | sensor_value_proxy_new_for_bus_sync ( |
| 5146 | GBusType bus_type, |
| 5147 | GDBusProxyFlags flags, |
| 5148 | const gchar *name, |
| 5149 | const gchar *object_path, |
| 5150 | GCancellable *cancellable, |
| 5151 | GError **error) |
| 5152 | { |
| 5153 | GInitable *ret; |
| 5154 | 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); |
| 5155 | if (ret != NULL) |
| 5156 | return SENSOR_VALUE (ret); |
| 5157 | else |
| 5158 | return NULL; |
| 5159 | } |
| 5160 | |
| 5161 | |
| 5162 | /* ------------------------------------------------------------------------ */ |
| 5163 | |
| 5164 | /** |
| 5165 | * SensorValueSkeleton: |
| 5166 | * |
| 5167 | * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. |
| 5168 | */ |
| 5169 | |
| 5170 | /** |
| 5171 | * SensorValueSkeletonClass: |
| 5172 | * @parent_class: The parent class. |
| 5173 | * |
| 5174 | * Class structure for #SensorValueSkeleton. |
| 5175 | */ |
| 5176 | |
| 5177 | struct _SensorValueSkeletonPrivate |
| 5178 | { |
| 5179 | GValue *properties; |
| 5180 | GList *changed_properties; |
| 5181 | GSource *changed_properties_idle_source; |
| 5182 | GMainContext *context; |
| 5183 | GMutex lock; |
| 5184 | }; |
| 5185 | |
| 5186 | static void |
| 5187 | _sensor_value_skeleton_handle_method_call ( |
| 5188 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5189 | const gchar *sender G_GNUC_UNUSED, |
| 5190 | const gchar *object_path G_GNUC_UNUSED, |
| 5191 | const gchar *interface_name, |
| 5192 | const gchar *method_name, |
| 5193 | GVariant *parameters, |
| 5194 | GDBusMethodInvocation *invocation, |
| 5195 | gpointer user_data) |
| 5196 | { |
| 5197 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5198 | _ExtendedGDBusMethodInfo *info; |
| 5199 | GVariantIter iter; |
| 5200 | GVariant *child; |
| 5201 | GValue *paramv; |
| 5202 | guint num_params; |
| 5203 | guint num_extra; |
| 5204 | guint n; |
| 5205 | guint signal_id; |
| 5206 | GValue return_value = G_VALUE_INIT; |
| 5207 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 5208 | g_assert (info != NULL); |
| 5209 | num_params = g_variant_n_children (parameters); |
| 5210 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 5211 | n = 0; |
| 5212 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
| 5213 | g_value_set_object (¶mv[n++], skeleton); |
| 5214 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 5215 | g_value_set_object (¶mv[n++], invocation); |
| 5216 | if (info->pass_fdlist) |
| 5217 | { |
| 5218 | #ifdef G_OS_UNIX |
| 5219 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 5220 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 5221 | #else |
| 5222 | g_assert_not_reached (); |
| 5223 | #endif |
| 5224 | } |
| 5225 | g_variant_iter_init (&iter, parameters); |
| 5226 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5227 | { |
| 5228 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 5229 | if (arg_info->use_gvariant) |
| 5230 | { |
| 5231 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5232 | g_value_set_variant (¶mv[n], child); |
| 5233 | n++; |
| 5234 | } |
| 5235 | else |
| 5236 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5237 | g_variant_unref (child); |
| 5238 | } |
| 5239 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 5240 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 5241 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 5242 | if (!g_value_get_boolean (&return_value)) |
| 5243 | 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); |
| 5244 | g_value_unset (&return_value); |
| 5245 | for (n = 0; n < num_params + num_extra; n++) |
| 5246 | g_value_unset (¶mv[n]); |
| 5247 | g_free (paramv); |
| 5248 | } |
| 5249 | |
| 5250 | static GVariant * |
| 5251 | _sensor_value_skeleton_handle_get_property ( |
| 5252 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5253 | const gchar *sender G_GNUC_UNUSED, |
| 5254 | const gchar *object_path G_GNUC_UNUSED, |
| 5255 | const gchar *interface_name G_GNUC_UNUSED, |
| 5256 | const gchar *property_name, |
| 5257 | GError **error, |
| 5258 | gpointer user_data) |
| 5259 | { |
| 5260 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5261 | GValue value = G_VALUE_INIT; |
| 5262 | GParamSpec *pspec; |
| 5263 | _ExtendedGDBusPropertyInfo *info; |
| 5264 | GVariant *ret; |
| 5265 | ret = NULL; |
| 5266 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 5267 | g_assert (info != NULL); |
| 5268 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5269 | if (pspec == NULL) |
| 5270 | { |
| 5271 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5272 | } |
| 5273 | else |
| 5274 | { |
| 5275 | g_value_init (&value, pspec->value_type); |
| 5276 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5277 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5278 | g_value_unset (&value); |
| 5279 | } |
| 5280 | return ret; |
| 5281 | } |
| 5282 | |
| 5283 | static gboolean |
| 5284 | _sensor_value_skeleton_handle_set_property ( |
| 5285 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5286 | const gchar *sender G_GNUC_UNUSED, |
| 5287 | const gchar *object_path G_GNUC_UNUSED, |
| 5288 | const gchar *interface_name G_GNUC_UNUSED, |
| 5289 | const gchar *property_name, |
| 5290 | GVariant *variant, |
| 5291 | GError **error, |
| 5292 | gpointer user_data) |
| 5293 | { |
| 5294 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5295 | GValue value = G_VALUE_INIT; |
| 5296 | GParamSpec *pspec; |
| 5297 | _ExtendedGDBusPropertyInfo *info; |
| 5298 | gboolean ret; |
| 5299 | ret = FALSE; |
| 5300 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 5301 | g_assert (info != NULL); |
| 5302 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5303 | if (pspec == NULL) |
| 5304 | { |
| 5305 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5306 | } |
| 5307 | else |
| 5308 | { |
| 5309 | if (info->use_gvariant) |
| 5310 | g_value_set_variant (&value, variant); |
| 5311 | else |
| 5312 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 5313 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5314 | g_value_unset (&value); |
| 5315 | ret = TRUE; |
| 5316 | } |
| 5317 | return ret; |
| 5318 | } |
| 5319 | |
| 5320 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
| 5321 | { |
| 5322 | _sensor_value_skeleton_handle_method_call, |
| 5323 | _sensor_value_skeleton_handle_get_property, |
| 5324 | _sensor_value_skeleton_handle_set_property, |
| 5325 | {NULL} |
| 5326 | }; |
| 5327 | |
| 5328 | static GDBusInterfaceInfo * |
| 5329 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5330 | { |
| 5331 | return sensor_value_interface_info (); |
| 5332 | } |
| 5333 | |
| 5334 | static GDBusInterfaceVTable * |
| 5335 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5336 | { |
| 5337 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
| 5338 | } |
| 5339 | |
| 5340 | static GVariant * |
| 5341 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 5342 | { |
| 5343 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 5344 | |
| 5345 | GVariantBuilder builder; |
| 5346 | guint n; |
| 5347 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5348 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
| 5349 | goto out; |
| 5350 | for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) |
| 5351 | { |
| 5352 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
| 5353 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 5354 | { |
| 5355 | GVariant *value; |
| 5356 | 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); |
| 5357 | if (value != NULL) |
| 5358 | { |
| 5359 | g_variant_take_ref (value); |
| 5360 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 5361 | g_variant_unref (value); |
| 5362 | } |
| 5363 | } |
| 5364 | } |
| 5365 | out: |
| 5366 | return g_variant_builder_end (&builder); |
| 5367 | } |
| 5368 | |
| 5369 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
| 5370 | |
| 5371 | static void |
| 5372 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 5373 | { |
| 5374 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 5375 | gboolean emit_changed = FALSE; |
| 5376 | |
| 5377 | g_mutex_lock (&skeleton->priv->lock); |
| 5378 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5379 | { |
| 5380 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5381 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5382 | emit_changed = TRUE; |
| 5383 | } |
| 5384 | g_mutex_unlock (&skeleton->priv->lock); |
| 5385 | |
| 5386 | if (emit_changed) |
| 5387 | _sensor_value_emit_changed (skeleton); |
| 5388 | } |
| 5389 | |
| 5390 | static void |
| 5391 | _sensor_value_on_signal_changed ( |
| 5392 | SensorValue *object, |
| 5393 | GVariant *arg_value, |
| 5394 | const gchar *arg_units) |
| 5395 | { |
| 5396 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5397 | |
| 5398 | GList *connections, *l; |
| 5399 | GVariant *signal_variant; |
| 5400 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5401 | |
| 5402 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
| 5403 | arg_value, |
| 5404 | arg_units)); |
| 5405 | for (l = connections; l != NULL; l = l->next) |
| 5406 | { |
| 5407 | GDBusConnection *connection = l->data; |
| 5408 | g_dbus_connection_emit_signal (connection, |
| 5409 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", |
| 5410 | signal_variant, NULL); |
| 5411 | } |
| 5412 | g_variant_unref (signal_variant); |
| 5413 | g_list_free_full (connections, g_object_unref); |
| 5414 | } |
| 5415 | |
| 5416 | static void |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 5417 | _sensor_value_on_signal_error ( |
| 5418 | SensorValue *object) |
| 5419 | { |
| 5420 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5421 | |
| 5422 | GList *connections, *l; |
| 5423 | GVariant *signal_variant; |
| 5424 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5425 | |
| 5426 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 5427 | for (l = connections; l != NULL; l = l->next) |
| 5428 | { |
| 5429 | GDBusConnection *connection = l->data; |
| 5430 | g_dbus_connection_emit_signal (connection, |
| 5431 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error", |
| 5432 | signal_variant, NULL); |
| 5433 | } |
| 5434 | g_variant_unref (signal_variant); |
| 5435 | g_list_free_full (connections, g_object_unref); |
| 5436 | } |
| 5437 | |
| 5438 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5439 | _sensor_value_on_signal_heartbeat ( |
| 5440 | SensorValue *object, |
| 5441 | const gchar *arg_bus_name) |
| 5442 | { |
| 5443 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5444 | |
| 5445 | GList *connections, *l; |
| 5446 | GVariant *signal_variant; |
| 5447 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5448 | |
| 5449 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 5450 | arg_bus_name)); |
| 5451 | for (l = connections; l != NULL; l = l->next) |
| 5452 | { |
| 5453 | GDBusConnection *connection = l->data; |
| 5454 | g_dbus_connection_emit_signal (connection, |
| 5455 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", |
| 5456 | signal_variant, NULL); |
| 5457 | } |
| 5458 | g_variant_unref (signal_variant); |
| 5459 | g_list_free_full (connections, g_object_unref); |
| 5460 | } |
| 5461 | |
| 5462 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
| 5463 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5464 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5465 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 5466 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 5467 | |
| 5468 | #else |
| 5469 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5470 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 5471 | |
| 5472 | #endif |
| 5473 | static void |
| 5474 | sensor_value_skeleton_finalize (GObject *object) |
| 5475 | { |
| 5476 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5477 | guint n; |
| 5478 | for (n = 0; n < 7; n++) |
| 5479 | g_value_unset (&skeleton->priv->properties[n]); |
| 5480 | g_free (skeleton->priv->properties); |
| 5481 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5482 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5483 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5484 | g_main_context_unref (skeleton->priv->context); |
| 5485 | g_mutex_clear (&skeleton->priv->lock); |
| 5486 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
| 5487 | } |
| 5488 | |
| 5489 | static void |
| 5490 | sensor_value_skeleton_get_property (GObject *object, |
| 5491 | guint prop_id, |
| 5492 | GValue *value, |
| 5493 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5494 | { |
| 5495 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5496 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
| 5497 | g_mutex_lock (&skeleton->priv->lock); |
| 5498 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 5499 | g_mutex_unlock (&skeleton->priv->lock); |
| 5500 | } |
| 5501 | |
| 5502 | static gboolean |
| 5503 | _sensor_value_emit_changed (gpointer user_data) |
| 5504 | { |
| 5505 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5506 | GList *l; |
| 5507 | GVariantBuilder builder; |
| 5508 | GVariantBuilder invalidated_builder; |
| 5509 | guint num_changes; |
| 5510 | |
| 5511 | g_mutex_lock (&skeleton->priv->lock); |
| 5512 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5513 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 5514 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 5515 | { |
| 5516 | ChangedProperty *cp = l->data; |
| 5517 | GVariant *variant; |
| 5518 | const GValue *cur_value; |
| 5519 | |
| 5520 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 5521 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 5522 | { |
| 5523 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 5524 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 5525 | g_variant_unref (variant); |
| 5526 | num_changes++; |
| 5527 | } |
| 5528 | } |
| 5529 | if (num_changes > 0) |
| 5530 | { |
| 5531 | GList *connections, *ll; |
| 5532 | GVariant *signal_variant; |
| 5533 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", |
| 5534 | &builder, &invalidated_builder)); |
| 5535 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5536 | for (ll = connections; ll != NULL; ll = ll->next) |
| 5537 | { |
| 5538 | GDBusConnection *connection = ll->data; |
| 5539 | |
| 5540 | g_dbus_connection_emit_signal (connection, |
| 5541 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 5542 | "org.freedesktop.DBus.Properties", |
| 5543 | "PropertiesChanged", |
| 5544 | signal_variant, |
| 5545 | NULL); |
| 5546 | } |
| 5547 | g_variant_unref (signal_variant); |
| 5548 | g_list_free_full (connections, g_object_unref); |
| 5549 | } |
| 5550 | else |
| 5551 | { |
| 5552 | g_variant_builder_clear (&builder); |
| 5553 | g_variant_builder_clear (&invalidated_builder); |
| 5554 | } |
| 5555 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5556 | skeleton->priv->changed_properties = NULL; |
| 5557 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5558 | g_mutex_unlock (&skeleton->priv->lock); |
| 5559 | return FALSE; |
| 5560 | } |
| 5561 | |
| 5562 | static void |
| 5563 | _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 5564 | { |
| 5565 | ChangedProperty *cp; |
| 5566 | GList *l; |
| 5567 | cp = NULL; |
| 5568 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 5569 | { |
| 5570 | ChangedProperty *i_cp = l->data; |
| 5571 | if (i_cp->info == info) |
| 5572 | { |
| 5573 | cp = i_cp; |
| 5574 | break; |
| 5575 | } |
| 5576 | } |
| 5577 | if (cp == NULL) |
| 5578 | { |
| 5579 | cp = g_new0 (ChangedProperty, 1); |
| 5580 | cp->prop_id = prop_id; |
| 5581 | cp->info = info; |
| 5582 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 5583 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 5584 | g_value_copy (orig_value, &cp->orig_value); |
| 5585 | } |
| 5586 | } |
| 5587 | |
| 5588 | static void |
| 5589 | sensor_value_skeleton_notify (GObject *object, |
| 5590 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5591 | { |
| 5592 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5593 | g_mutex_lock (&skeleton->priv->lock); |
| 5594 | if (skeleton->priv->changed_properties != NULL && |
| 5595 | skeleton->priv->changed_properties_idle_source == NULL) |
| 5596 | { |
| 5597 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 5598 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 5599 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 5600 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 5601 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 5602 | } |
| 5603 | g_mutex_unlock (&skeleton->priv->lock); |
| 5604 | } |
| 5605 | |
| 5606 | static void |
| 5607 | sensor_value_skeleton_set_property (GObject *object, |
| 5608 | guint prop_id, |
| 5609 | const GValue *value, |
| 5610 | GParamSpec *pspec) |
| 5611 | { |
| 5612 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5613 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
| 5614 | g_mutex_lock (&skeleton->priv->lock); |
| 5615 | g_object_freeze_notify (object); |
| 5616 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 5617 | { |
| 5618 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 5619 | _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 5620 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 5621 | g_object_notify_by_pspec (object, pspec); |
| 5622 | } |
| 5623 | g_mutex_unlock (&skeleton->priv->lock); |
| 5624 | g_object_thaw_notify (object); |
| 5625 | } |
| 5626 | |
| 5627 | static void |
| 5628 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
| 5629 | { |
| 5630 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5631 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
| 5632 | #else |
| 5633 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); |
| 5634 | #endif |
| 5635 | |
| 5636 | g_mutex_init (&skeleton->priv->lock); |
| 5637 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 5638 | skeleton->priv->properties = g_new0 (GValue, 7); |
| 5639 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 5640 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 5641 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 5642 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 5643 | g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); |
| 5644 | g_value_init (&skeleton->priv->properties[5], G_TYPE_UCHAR); |
| 5645 | g_value_init (&skeleton->priv->properties[6], G_TYPE_UCHAR); |
| 5646 | } |
| 5647 | |
| 5648 | static GVariant * |
| 5649 | sensor_value_skeleton_get_value (SensorValue *object) |
| 5650 | { |
| 5651 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5652 | GVariant *value; |
| 5653 | g_mutex_lock (&skeleton->priv->lock); |
| 5654 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 5655 | g_mutex_unlock (&skeleton->priv->lock); |
| 5656 | return value; |
| 5657 | } |
| 5658 | |
| 5659 | static const gchar * |
| 5660 | sensor_value_skeleton_get_units (SensorValue *object) |
| 5661 | { |
| 5662 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5663 | const gchar *value; |
| 5664 | g_mutex_lock (&skeleton->priv->lock); |
| 5665 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 5666 | g_mutex_unlock (&skeleton->priv->lock); |
| 5667 | return value; |
| 5668 | } |
| 5669 | |
| 5670 | static gint |
| 5671 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
| 5672 | { |
| 5673 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5674 | gint value; |
| 5675 | g_mutex_lock (&skeleton->priv->lock); |
| 5676 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 5677 | g_mutex_unlock (&skeleton->priv->lock); |
| 5678 | return value; |
| 5679 | } |
| 5680 | |
| 5681 | static gint |
| 5682 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
| 5683 | { |
| 5684 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5685 | gint value; |
| 5686 | g_mutex_lock (&skeleton->priv->lock); |
| 5687 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 5688 | g_mutex_unlock (&skeleton->priv->lock); |
| 5689 | return value; |
| 5690 | } |
| 5691 | |
| 5692 | static gboolean |
| 5693 | sensor_value_skeleton_get_settable (SensorValue *object) |
| 5694 | { |
| 5695 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5696 | gboolean value; |
| 5697 | g_mutex_lock (&skeleton->priv->lock); |
| 5698 | value = g_value_get_boolean (&(skeleton->priv->properties[4])); |
| 5699 | g_mutex_unlock (&skeleton->priv->lock); |
| 5700 | return value; |
| 5701 | } |
| 5702 | |
| 5703 | static guchar |
| 5704 | sensor_value_skeleton_get_ipmi_entity_id (SensorValue *object) |
| 5705 | { |
| 5706 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5707 | guchar value; |
| 5708 | g_mutex_lock (&skeleton->priv->lock); |
| 5709 | value = g_value_get_uchar (&(skeleton->priv->properties[5])); |
| 5710 | g_mutex_unlock (&skeleton->priv->lock); |
| 5711 | return value; |
| 5712 | } |
| 5713 | |
| 5714 | static guchar |
| 5715 | sensor_value_skeleton_get_ipmi_id (SensorValue *object) |
| 5716 | { |
| 5717 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5718 | guchar value; |
| 5719 | g_mutex_lock (&skeleton->priv->lock); |
| 5720 | value = g_value_get_uchar (&(skeleton->priv->properties[6])); |
| 5721 | g_mutex_unlock (&skeleton->priv->lock); |
| 5722 | return value; |
| 5723 | } |
| 5724 | |
| 5725 | static void |
| 5726 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
| 5727 | { |
| 5728 | GObjectClass *gobject_class; |
| 5729 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 5730 | |
| 5731 | gobject_class = G_OBJECT_CLASS (klass); |
| 5732 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 5733 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 5734 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 5735 | gobject_class->notify = sensor_value_skeleton_notify; |
| 5736 | |
| 5737 | |
| 5738 | sensor_value_override_properties (gobject_class, 1); |
| 5739 | |
| 5740 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 5741 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 5742 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 5743 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 5744 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
| 5745 | |
| 5746 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5747 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
| 5748 | #endif |
| 5749 | } |
| 5750 | |
| 5751 | static void |
| 5752 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
| 5753 | { |
| 5754 | iface->changed = _sensor_value_on_signal_changed; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 5755 | iface->error = _sensor_value_on_signal_error; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5756 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 5757 | iface->get_value = sensor_value_skeleton_get_value; |
| 5758 | iface->get_units = sensor_value_skeleton_get_units; |
| 5759 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 5760 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
| 5761 | iface->get_settable = sensor_value_skeleton_get_settable; |
| 5762 | iface->get_ipmi_entity_id = sensor_value_skeleton_get_ipmi_entity_id; |
| 5763 | iface->get_ipmi_id = sensor_value_skeleton_get_ipmi_id; |
| 5764 | } |
| 5765 | |
| 5766 | /** |
| 5767 | * sensor_value_skeleton_new: |
| 5768 | * |
| 5769 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 5770 | * |
| 5771 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
| 5772 | */ |
| 5773 | SensorValue * |
| 5774 | sensor_value_skeleton_new (void) |
| 5775 | { |
| 5776 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
| 5777 | } |
| 5778 | |
| 5779 | /* ------------------------------------------------------------------------ |
| 5780 | * Code for interface org.openbmc.SensorThreshold |
| 5781 | * ------------------------------------------------------------------------ |
| 5782 | */ |
| 5783 | |
| 5784 | /** |
| 5785 | * SECTION:SensorThreshold |
| 5786 | * @title: SensorThreshold |
| 5787 | * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface |
| 5788 | * |
| 5789 | * 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. |
| 5790 | */ |
| 5791 | |
| 5792 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
| 5793 | |
| 5794 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
| 5795 | { |
| 5796 | { |
| 5797 | -1, |
| 5798 | (gchar *) "state", |
| 5799 | (gchar *) "y", |
| 5800 | NULL |
| 5801 | }, |
| 5802 | FALSE |
| 5803 | }; |
| 5804 | |
| 5805 | static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = |
| 5806 | { |
| 5807 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
| 5808 | NULL |
| 5809 | }; |
| 5810 | |
| 5811 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
| 5812 | { |
| 5813 | { |
| 5814 | -1, |
| 5815 | (gchar *) "getState", |
| 5816 | NULL, |
| 5817 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
| 5818 | NULL |
| 5819 | }, |
| 5820 | "handle-get-state", |
| 5821 | FALSE |
| 5822 | }; |
| 5823 | |
| 5824 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
| 5825 | { |
| 5826 | &_sensor_threshold_method_info_get_state, |
| 5827 | NULL |
| 5828 | }; |
| 5829 | |
| 5830 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
| 5831 | { |
| 5832 | { |
| 5833 | -1, |
| 5834 | (gchar *) "Warning", |
| 5835 | NULL, |
| 5836 | NULL |
| 5837 | }, |
| 5838 | "warning" |
| 5839 | }; |
| 5840 | |
| 5841 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
| 5842 | { |
| 5843 | { |
| 5844 | -1, |
| 5845 | (gchar *) "Critical", |
| 5846 | NULL, |
| 5847 | NULL |
| 5848 | }, |
| 5849 | "critical" |
| 5850 | }; |
| 5851 | |
| 5852 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
| 5853 | { |
| 5854 | { |
| 5855 | -1, |
| 5856 | (gchar *) "Normal", |
| 5857 | NULL, |
| 5858 | NULL |
| 5859 | }, |
| 5860 | "normal" |
| 5861 | }; |
| 5862 | |
| 5863 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
| 5864 | { |
| 5865 | &_sensor_threshold_signal_info_warning, |
| 5866 | &_sensor_threshold_signal_info_critical, |
| 5867 | &_sensor_threshold_signal_info_normal, |
| 5868 | NULL |
| 5869 | }; |
| 5870 | |
| 5871 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
| 5872 | { |
| 5873 | { |
| 5874 | -1, |
| 5875 | (gchar *) "lower_critical", |
| 5876 | (gchar *) "v", |
| 5877 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5878 | NULL |
| 5879 | }, |
| 5880 | "lower-critical", |
| 5881 | FALSE |
| 5882 | }; |
| 5883 | |
| 5884 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
| 5885 | { |
| 5886 | { |
| 5887 | -1, |
| 5888 | (gchar *) "lower_warning", |
| 5889 | (gchar *) "v", |
| 5890 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5891 | NULL |
| 5892 | }, |
| 5893 | "lower-warning", |
| 5894 | FALSE |
| 5895 | }; |
| 5896 | |
| 5897 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
| 5898 | { |
| 5899 | { |
| 5900 | -1, |
| 5901 | (gchar *) "upper_warning", |
| 5902 | (gchar *) "v", |
| 5903 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5904 | NULL |
| 5905 | }, |
| 5906 | "upper-warning", |
| 5907 | FALSE |
| 5908 | }; |
| 5909 | |
| 5910 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
| 5911 | { |
| 5912 | { |
| 5913 | -1, |
| 5914 | (gchar *) "upper_critical", |
| 5915 | (gchar *) "v", |
| 5916 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5917 | NULL |
| 5918 | }, |
| 5919 | "upper-critical", |
| 5920 | FALSE |
| 5921 | }; |
| 5922 | |
| 5923 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
| 5924 | { |
| 5925 | { |
| 5926 | -1, |
| 5927 | (gchar *) "state", |
| 5928 | (gchar *) "y", |
| 5929 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5930 | NULL |
| 5931 | }, |
| 5932 | "state", |
| 5933 | FALSE |
| 5934 | }; |
| 5935 | |
| 5936 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
| 5937 | { |
| 5938 | &_sensor_threshold_property_info_lower_critical, |
| 5939 | &_sensor_threshold_property_info_lower_warning, |
| 5940 | &_sensor_threshold_property_info_upper_warning, |
| 5941 | &_sensor_threshold_property_info_upper_critical, |
| 5942 | &_sensor_threshold_property_info_state, |
| 5943 | NULL |
| 5944 | }; |
| 5945 | |
| 5946 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
| 5947 | { |
| 5948 | { |
| 5949 | -1, |
| 5950 | (gchar *) "org.openbmc.SensorThreshold", |
| 5951 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 5952 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 5953 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
| 5954 | NULL |
| 5955 | }, |
| 5956 | "sensor-threshold", |
| 5957 | }; |
| 5958 | |
| 5959 | |
| 5960 | /** |
| 5961 | * sensor_threshold_interface_info: |
| 5962 | * |
| 5963 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. |
| 5964 | * |
| 5965 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 5966 | */ |
| 5967 | GDBusInterfaceInfo * |
| 5968 | sensor_threshold_interface_info (void) |
| 5969 | { |
| 5970 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
| 5971 | } |
| 5972 | |
| 5973 | /** |
| 5974 | * sensor_threshold_override_properties: |
| 5975 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 5976 | * @property_id_begin: The property id to assign to the first overridden property. |
| 5977 | * |
| 5978 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
| 5979 | * The properties are overridden in the order they are defined. |
| 5980 | * |
| 5981 | * Returns: The last property id. |
| 5982 | */ |
| 5983 | guint |
| 5984 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 5985 | { |
| 5986 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 5987 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 5988 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 5989 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 5990 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 5991 | return property_id_begin - 1; |
| 5992 | } |
| 5993 | |
| 5994 | |
| 5995 | |
| 5996 | /** |
| 5997 | * SensorThreshold: |
| 5998 | * |
| 5999 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 6000 | */ |
| 6001 | |
| 6002 | /** |
| 6003 | * SensorThresholdIface: |
| 6004 | * @parent_iface: The parent interface. |
| 6005 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 6006 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 6007 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 6008 | * @get_state: Getter for the #SensorThreshold:state property. |
| 6009 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 6010 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 6011 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 6012 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 6013 | * @warning: Handler for the #SensorThreshold::warning signal. |
| 6014 | * |
| 6015 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 6016 | */ |
| 6017 | |
| 6018 | typedef SensorThresholdIface SensorThresholdInterface; |
| 6019 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
| 6020 | |
| 6021 | static void |
| 6022 | sensor_threshold_default_init (SensorThresholdIface *iface) |
| 6023 | { |
| 6024 | /* GObject signals for incoming D-Bus method calls: */ |
| 6025 | /** |
| 6026 | * SensorThreshold::handle-get-state: |
| 6027 | * @object: A #SensorThreshold. |
| 6028 | * @invocation: A #GDBusMethodInvocation. |
| 6029 | * |
| 6030 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. |
| 6031 | * |
| 6032 | * 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. |
| 6033 | * |
| 6034 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 6035 | */ |
| 6036 | g_signal_new ("handle-get-state", |
| 6037 | G_TYPE_FROM_INTERFACE (iface), |
| 6038 | G_SIGNAL_RUN_LAST, |
| 6039 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
| 6040 | g_signal_accumulator_true_handled, |
| 6041 | NULL, |
| 6042 | g_cclosure_marshal_generic, |
| 6043 | G_TYPE_BOOLEAN, |
| 6044 | 1, |
| 6045 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 6046 | |
| 6047 | /* GObject signals for received D-Bus signals: */ |
| 6048 | /** |
| 6049 | * SensorThreshold::warning: |
| 6050 | * @object: A #SensorThreshold. |
| 6051 | * |
| 6052 | * 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. |
| 6053 | * |
| 6054 | * 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. |
| 6055 | */ |
| 6056 | g_signal_new ("warning", |
| 6057 | G_TYPE_FROM_INTERFACE (iface), |
| 6058 | G_SIGNAL_RUN_LAST, |
| 6059 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
| 6060 | NULL, |
| 6061 | NULL, |
| 6062 | g_cclosure_marshal_generic, |
| 6063 | G_TYPE_NONE, |
| 6064 | 0); |
| 6065 | |
| 6066 | /** |
| 6067 | * SensorThreshold::critical: |
| 6068 | * @object: A #SensorThreshold. |
| 6069 | * |
| 6070 | * 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. |
| 6071 | * |
| 6072 | * 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. |
| 6073 | */ |
| 6074 | g_signal_new ("critical", |
| 6075 | G_TYPE_FROM_INTERFACE (iface), |
| 6076 | G_SIGNAL_RUN_LAST, |
| 6077 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
| 6078 | NULL, |
| 6079 | NULL, |
| 6080 | g_cclosure_marshal_generic, |
| 6081 | G_TYPE_NONE, |
| 6082 | 0); |
| 6083 | |
| 6084 | /** |
| 6085 | * SensorThreshold::normal: |
| 6086 | * @object: A #SensorThreshold. |
| 6087 | * |
| 6088 | * 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. |
| 6089 | * |
| 6090 | * 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. |
| 6091 | */ |
| 6092 | g_signal_new ("normal", |
| 6093 | G_TYPE_FROM_INTERFACE (iface), |
| 6094 | G_SIGNAL_RUN_LAST, |
| 6095 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
| 6096 | NULL, |
| 6097 | NULL, |
| 6098 | g_cclosure_marshal_generic, |
| 6099 | G_TYPE_NONE, |
| 6100 | 0); |
| 6101 | |
| 6102 | /* GObject properties for D-Bus properties: */ |
| 6103 | /** |
| 6104 | * SensorThreshold:lower-critical: |
| 6105 | * |
| 6106 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. |
| 6107 | * |
| 6108 | * 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. |
| 6109 | */ |
| 6110 | g_object_interface_install_property (iface, |
| 6111 | g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6112 | /** |
| 6113 | * SensorThreshold:lower-warning: |
| 6114 | * |
| 6115 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. |
| 6116 | * |
| 6117 | * 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. |
| 6118 | */ |
| 6119 | g_object_interface_install_property (iface, |
| 6120 | g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6121 | /** |
| 6122 | * SensorThreshold:upper-warning: |
| 6123 | * |
| 6124 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. |
| 6125 | * |
| 6126 | * 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. |
| 6127 | */ |
| 6128 | g_object_interface_install_property (iface, |
| 6129 | g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6130 | /** |
| 6131 | * SensorThreshold:upper-critical: |
| 6132 | * |
| 6133 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. |
| 6134 | * |
| 6135 | * 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. |
| 6136 | */ |
| 6137 | g_object_interface_install_property (iface, |
| 6138 | g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6139 | /** |
| 6140 | * SensorThreshold:state: |
| 6141 | * |
| 6142 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. |
| 6143 | * |
| 6144 | * 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. |
| 6145 | */ |
| 6146 | g_object_interface_install_property (iface, |
| 6147 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6148 | } |
| 6149 | |
| 6150 | /** |
| 6151 | * sensor_threshold_get_lower_critical: (skip) |
| 6152 | * @object: A #SensorThreshold. |
| 6153 | * |
| 6154 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 6155 | * |
| 6156 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6157 | * |
| 6158 | * <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> |
| 6159 | * |
| 6160 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6161 | */ |
| 6162 | GVariant * |
| 6163 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
| 6164 | { |
| 6165 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
| 6166 | } |
| 6167 | |
| 6168 | /** |
| 6169 | * sensor_threshold_dup_lower_critical: (skip) |
| 6170 | * @object: A #SensorThreshold. |
| 6171 | * |
| 6172 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 6173 | * |
| 6174 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6175 | * |
| 6176 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6177 | */ |
| 6178 | GVariant * |
| 6179 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 6180 | { |
| 6181 | GVariant *value; |
| 6182 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 6183 | return value; |
| 6184 | } |
| 6185 | |
| 6186 | /** |
| 6187 | * sensor_threshold_set_lower_critical: (skip) |
| 6188 | * @object: A #SensorThreshold. |
| 6189 | * @value: The value to set. |
| 6190 | * |
| 6191 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. |
| 6192 | * |
| 6193 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6194 | */ |
| 6195 | void |
| 6196 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
| 6197 | { |
| 6198 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 6199 | } |
| 6200 | |
| 6201 | /** |
| 6202 | * sensor_threshold_get_lower_warning: (skip) |
| 6203 | * @object: A #SensorThreshold. |
| 6204 | * |
| 6205 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 6206 | * |
| 6207 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6208 | * |
| 6209 | * <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> |
| 6210 | * |
| 6211 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6212 | */ |
| 6213 | GVariant * |
| 6214 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
| 6215 | { |
| 6216 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
| 6217 | } |
| 6218 | |
| 6219 | /** |
| 6220 | * sensor_threshold_dup_lower_warning: (skip) |
| 6221 | * @object: A #SensorThreshold. |
| 6222 | * |
| 6223 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 6224 | * |
| 6225 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6226 | * |
| 6227 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6228 | */ |
| 6229 | GVariant * |
| 6230 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 6231 | { |
| 6232 | GVariant *value; |
| 6233 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 6234 | return value; |
| 6235 | } |
| 6236 | |
| 6237 | /** |
| 6238 | * sensor_threshold_set_lower_warning: (skip) |
| 6239 | * @object: A #SensorThreshold. |
| 6240 | * @value: The value to set. |
| 6241 | * |
| 6242 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. |
| 6243 | * |
| 6244 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6245 | */ |
| 6246 | void |
| 6247 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
| 6248 | { |
| 6249 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 6250 | } |
| 6251 | |
| 6252 | /** |
| 6253 | * sensor_threshold_get_upper_warning: (skip) |
| 6254 | * @object: A #SensorThreshold. |
| 6255 | * |
| 6256 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 6257 | * |
| 6258 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6259 | * |
| 6260 | * <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> |
| 6261 | * |
| 6262 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6263 | */ |
| 6264 | GVariant * |
| 6265 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
| 6266 | { |
| 6267 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
| 6268 | } |
| 6269 | |
| 6270 | /** |
| 6271 | * sensor_threshold_dup_upper_warning: (skip) |
| 6272 | * @object: A #SensorThreshold. |
| 6273 | * |
| 6274 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 6275 | * |
| 6276 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6277 | * |
| 6278 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6279 | */ |
| 6280 | GVariant * |
| 6281 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 6282 | { |
| 6283 | GVariant *value; |
| 6284 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 6285 | return value; |
| 6286 | } |
| 6287 | |
| 6288 | /** |
| 6289 | * sensor_threshold_set_upper_warning: (skip) |
| 6290 | * @object: A #SensorThreshold. |
| 6291 | * @value: The value to set. |
| 6292 | * |
| 6293 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. |
| 6294 | * |
| 6295 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6296 | */ |
| 6297 | void |
| 6298 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
| 6299 | { |
| 6300 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 6301 | } |
| 6302 | |
| 6303 | /** |
| 6304 | * sensor_threshold_get_upper_critical: (skip) |
| 6305 | * @object: A #SensorThreshold. |
| 6306 | * |
| 6307 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 6308 | * |
| 6309 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6310 | * |
| 6311 | * <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> |
| 6312 | * |
| 6313 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6314 | */ |
| 6315 | GVariant * |
| 6316 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
| 6317 | { |
| 6318 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
| 6319 | } |
| 6320 | |
| 6321 | /** |
| 6322 | * sensor_threshold_dup_upper_critical: (skip) |
| 6323 | * @object: A #SensorThreshold. |
| 6324 | * |
| 6325 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 6326 | * |
| 6327 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6328 | * |
| 6329 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6330 | */ |
| 6331 | GVariant * |
| 6332 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 6333 | { |
| 6334 | GVariant *value; |
| 6335 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 6336 | return value; |
| 6337 | } |
| 6338 | |
| 6339 | /** |
| 6340 | * sensor_threshold_set_upper_critical: (skip) |
| 6341 | * @object: A #SensorThreshold. |
| 6342 | * @value: The value to set. |
| 6343 | * |
| 6344 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. |
| 6345 | * |
| 6346 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6347 | */ |
| 6348 | void |
| 6349 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
| 6350 | { |
| 6351 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 6352 | } |
| 6353 | |
| 6354 | /** |
| 6355 | * sensor_threshold_get_state: (skip) |
| 6356 | * @object: A #SensorThreshold. |
| 6357 | * |
| 6358 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. |
| 6359 | * |
| 6360 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 6361 | * |
| 6362 | * Returns: The property value. |
| 6363 | */ |
| 6364 | guchar |
| 6365 | sensor_threshold_get_state (SensorThreshold *object) |
| 6366 | { |
| 6367 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
| 6368 | } |
| 6369 | |
| 6370 | /** |
| 6371 | * sensor_threshold_set_state: (skip) |
| 6372 | * @object: A #SensorThreshold. |
| 6373 | * @value: The value to set. |
| 6374 | * |
| 6375 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. |
| 6376 | * |
| 6377 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 6378 | */ |
| 6379 | void |
| 6380 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
| 6381 | { |
| 6382 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 6383 | } |
| 6384 | |
| 6385 | /** |
| 6386 | * sensor_threshold_emit_warning: |
| 6387 | * @object: A #SensorThreshold. |
| 6388 | * |
| 6389 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. |
| 6390 | */ |
| 6391 | void |
| 6392 | sensor_threshold_emit_warning ( |
| 6393 | SensorThreshold *object) |
| 6394 | { |
| 6395 | g_signal_emit_by_name (object, "warning"); |
| 6396 | } |
| 6397 | |
| 6398 | /** |
| 6399 | * sensor_threshold_emit_critical: |
| 6400 | * @object: A #SensorThreshold. |
| 6401 | * |
| 6402 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. |
| 6403 | */ |
| 6404 | void |
| 6405 | sensor_threshold_emit_critical ( |
| 6406 | SensorThreshold *object) |
| 6407 | { |
| 6408 | g_signal_emit_by_name (object, "critical"); |
| 6409 | } |
| 6410 | |
| 6411 | /** |
| 6412 | * sensor_threshold_emit_normal: |
| 6413 | * @object: A #SensorThreshold. |
| 6414 | * |
| 6415 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. |
| 6416 | */ |
| 6417 | void |
| 6418 | sensor_threshold_emit_normal ( |
| 6419 | SensorThreshold *object) |
| 6420 | { |
| 6421 | g_signal_emit_by_name (object, "normal"); |
| 6422 | } |
| 6423 | |
| 6424 | /** |
| 6425 | * sensor_threshold_call_get_state: |
| 6426 | * @proxy: A #SensorThresholdProxy. |
| 6427 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6428 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 6429 | * @user_data: User data to pass to @callback. |
| 6430 | * |
| 6431 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. |
| 6432 | * 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. |
| 6433 | * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. |
| 6434 | * |
| 6435 | * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. |
| 6436 | */ |
| 6437 | void |
| 6438 | sensor_threshold_call_get_state ( |
| 6439 | SensorThreshold *proxy, |
| 6440 | GCancellable *cancellable, |
| 6441 | GAsyncReadyCallback callback, |
| 6442 | gpointer user_data) |
| 6443 | { |
| 6444 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 6445 | "getState", |
| 6446 | g_variant_new ("()"), |
| 6447 | G_DBUS_CALL_FLAGS_NONE, |
| 6448 | -1, |
| 6449 | cancellable, |
| 6450 | callback, |
| 6451 | user_data); |
| 6452 | } |
| 6453 | |
| 6454 | /** |
| 6455 | * sensor_threshold_call_get_state_finish: |
| 6456 | * @proxy: A #SensorThresholdProxy. |
| 6457 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 6458 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). |
| 6459 | * @error: Return location for error or %NULL. |
| 6460 | * |
| 6461 | * Finishes an operation started with sensor_threshold_call_get_state(). |
| 6462 | * |
| 6463 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 6464 | */ |
| 6465 | gboolean |
| 6466 | sensor_threshold_call_get_state_finish ( |
| 6467 | SensorThreshold *proxy, |
| 6468 | guchar *out_state, |
| 6469 | GAsyncResult *res, |
| 6470 | GError **error) |
| 6471 | { |
| 6472 | GVariant *_ret; |
| 6473 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 6474 | if (_ret == NULL) |
| 6475 | goto _out; |
| 6476 | g_variant_get (_ret, |
| 6477 | "(y)", |
| 6478 | out_state); |
| 6479 | g_variant_unref (_ret); |
| 6480 | _out: |
| 6481 | return _ret != NULL; |
| 6482 | } |
| 6483 | |
| 6484 | /** |
| 6485 | * sensor_threshold_call_get_state_sync: |
| 6486 | * @proxy: A #SensorThresholdProxy. |
| 6487 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 6488 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6489 | * @error: Return location for error or %NULL. |
| 6490 | * |
| 6491 | * 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. |
| 6492 | * |
| 6493 | * See sensor_threshold_call_get_state() for the asynchronous version of this method. |
| 6494 | * |
| 6495 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 6496 | */ |
| 6497 | gboolean |
| 6498 | sensor_threshold_call_get_state_sync ( |
| 6499 | SensorThreshold *proxy, |
| 6500 | guchar *out_state, |
| 6501 | GCancellable *cancellable, |
| 6502 | GError **error) |
| 6503 | { |
| 6504 | GVariant *_ret; |
| 6505 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 6506 | "getState", |
| 6507 | g_variant_new ("()"), |
| 6508 | G_DBUS_CALL_FLAGS_NONE, |
| 6509 | -1, |
| 6510 | cancellable, |
| 6511 | error); |
| 6512 | if (_ret == NULL) |
| 6513 | goto _out; |
| 6514 | g_variant_get (_ret, |
| 6515 | "(y)", |
| 6516 | out_state); |
| 6517 | g_variant_unref (_ret); |
| 6518 | _out: |
| 6519 | return _ret != NULL; |
| 6520 | } |
| 6521 | |
| 6522 | /** |
| 6523 | * sensor_threshold_complete_get_state: |
| 6524 | * @object: A #SensorThreshold. |
| 6525 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 6526 | * @state: Parameter to return. |
| 6527 | * |
| 6528 | * 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. |
| 6529 | * |
| 6530 | * This method will free @invocation, you cannot use it afterwards. |
| 6531 | */ |
| 6532 | void |
| 6533 | sensor_threshold_complete_get_state ( |
| 6534 | SensorThreshold *object, |
| 6535 | GDBusMethodInvocation *invocation, |
| 6536 | guchar state) |
| 6537 | { |
| 6538 | g_dbus_method_invocation_return_value (invocation, |
| 6539 | g_variant_new ("(y)", |
| 6540 | state)); |
| 6541 | } |
| 6542 | |
| 6543 | /* ------------------------------------------------------------------------ */ |
| 6544 | |
| 6545 | /** |
| 6546 | * SensorThresholdProxy: |
| 6547 | * |
| 6548 | * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 6549 | */ |
| 6550 | |
| 6551 | /** |
| 6552 | * SensorThresholdProxyClass: |
| 6553 | * @parent_class: The parent class. |
| 6554 | * |
| 6555 | * Class structure for #SensorThresholdProxy. |
| 6556 | */ |
| 6557 | |
| 6558 | struct _SensorThresholdProxyPrivate |
| 6559 | { |
| 6560 | GData *qdata; |
| 6561 | }; |
| 6562 | |
| 6563 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
| 6564 | |
| 6565 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6566 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 6567 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 6568 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 6569 | |
| 6570 | #else |
| 6571 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 6572 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 6573 | |
| 6574 | #endif |
| 6575 | static void |
| 6576 | sensor_threshold_proxy_finalize (GObject *object) |
| 6577 | { |
| 6578 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6579 | g_datalist_clear (&proxy->priv->qdata); |
| 6580 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
| 6581 | } |
| 6582 | |
| 6583 | static void |
| 6584 | sensor_threshold_proxy_get_property (GObject *object, |
| 6585 | guint prop_id, |
| 6586 | GValue *value, |
| 6587 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6588 | { |
| 6589 | const _ExtendedGDBusPropertyInfo *info; |
| 6590 | GVariant *variant; |
| 6591 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 6592 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 6593 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 6594 | if (info->use_gvariant) |
| 6595 | { |
| 6596 | g_value_set_variant (value, variant); |
| 6597 | } |
| 6598 | else |
| 6599 | { |
| 6600 | if (variant != NULL) |
| 6601 | g_dbus_gvariant_to_gvalue (variant, value); |
| 6602 | } |
| 6603 | if (variant != NULL) |
| 6604 | g_variant_unref (variant); |
| 6605 | } |
| 6606 | |
| 6607 | static void |
| 6608 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 6609 | GAsyncResult *res, |
| 6610 | gpointer user_data) |
| 6611 | { |
| 6612 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 6613 | GError *error; |
| 6614 | GVariant *_ret; |
| 6615 | error = NULL; |
| 6616 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 6617 | if (!_ret) |
| 6618 | { |
| 6619 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", |
| 6620 | info->parent_struct.name, |
| 6621 | error->message, g_quark_to_string (error->domain), error->code); |
| 6622 | g_error_free (error); |
| 6623 | } |
| 6624 | else |
| 6625 | { |
| 6626 | g_variant_unref (_ret); |
| 6627 | } |
| 6628 | } |
| 6629 | |
| 6630 | static void |
| 6631 | sensor_threshold_proxy_set_property (GObject *object, |
| 6632 | guint prop_id, |
| 6633 | const GValue *value, |
| 6634 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6635 | { |
| 6636 | const _ExtendedGDBusPropertyInfo *info; |
| 6637 | GVariant *variant; |
| 6638 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 6639 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 6640 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6641 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 6642 | "org.freedesktop.DBus.Properties.Set", |
| 6643 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
| 6644 | G_DBUS_CALL_FLAGS_NONE, |
| 6645 | -1, |
| 6646 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 6647 | g_variant_unref (variant); |
| 6648 | } |
| 6649 | |
| 6650 | static void |
| 6651 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 6652 | const gchar *sender_name G_GNUC_UNUSED, |
| 6653 | const gchar *signal_name, |
| 6654 | GVariant *parameters) |
| 6655 | { |
| 6656 | _ExtendedGDBusSignalInfo *info; |
| 6657 | GVariantIter iter; |
| 6658 | GVariant *child; |
| 6659 | GValue *paramv; |
| 6660 | guint num_params; |
| 6661 | guint n; |
| 6662 | guint signal_id; |
| 6663 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); |
| 6664 | if (info == NULL) |
| 6665 | return; |
| 6666 | num_params = g_variant_n_children (parameters); |
| 6667 | paramv = g_new0 (GValue, num_params + 1); |
| 6668 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
| 6669 | g_value_set_object (¶mv[0], proxy); |
| 6670 | g_variant_iter_init (&iter, parameters); |
| 6671 | n = 1; |
| 6672 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 6673 | { |
| 6674 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 6675 | if (arg_info->use_gvariant) |
| 6676 | { |
| 6677 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 6678 | g_value_set_variant (¶mv[n], child); |
| 6679 | n++; |
| 6680 | } |
| 6681 | else |
| 6682 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 6683 | g_variant_unref (child); |
| 6684 | } |
| 6685 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 6686 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 6687 | for (n = 0; n < num_params + 1; n++) |
| 6688 | g_value_unset (¶mv[n]); |
| 6689 | g_free (paramv); |
| 6690 | } |
| 6691 | |
| 6692 | static void |
| 6693 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 6694 | GVariant *changed_properties, |
| 6695 | const gchar *const *invalidated_properties) |
| 6696 | { |
| 6697 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
| 6698 | guint n; |
| 6699 | const gchar *key; |
| 6700 | GVariantIter *iter; |
| 6701 | _ExtendedGDBusPropertyInfo *info; |
| 6702 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 6703 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 6704 | { |
| 6705 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); |
| 6706 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 6707 | if (info != NULL) |
| 6708 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 6709 | } |
| 6710 | g_variant_iter_free (iter); |
| 6711 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 6712 | { |
| 6713 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 6714 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 6715 | if (info != NULL) |
| 6716 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 6717 | } |
| 6718 | } |
| 6719 | |
| 6720 | static GVariant * |
| 6721 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
| 6722 | { |
| 6723 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6724 | GVariant *variant; |
| 6725 | GVariant *value = NULL; |
| 6726 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); |
| 6727 | value = variant; |
| 6728 | if (variant != NULL) |
| 6729 | g_variant_unref (variant); |
| 6730 | return value; |
| 6731 | } |
| 6732 | |
| 6733 | static GVariant * |
| 6734 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
| 6735 | { |
| 6736 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6737 | GVariant *variant; |
| 6738 | GVariant *value = NULL; |
| 6739 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); |
| 6740 | value = variant; |
| 6741 | if (variant != NULL) |
| 6742 | g_variant_unref (variant); |
| 6743 | return value; |
| 6744 | } |
| 6745 | |
| 6746 | static GVariant * |
| 6747 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
| 6748 | { |
| 6749 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6750 | GVariant *variant; |
| 6751 | GVariant *value = NULL; |
| 6752 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); |
| 6753 | value = variant; |
| 6754 | if (variant != NULL) |
| 6755 | g_variant_unref (variant); |
| 6756 | return value; |
| 6757 | } |
| 6758 | |
| 6759 | static GVariant * |
| 6760 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
| 6761 | { |
| 6762 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6763 | GVariant *variant; |
| 6764 | GVariant *value = NULL; |
| 6765 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); |
| 6766 | value = variant; |
| 6767 | if (variant != NULL) |
| 6768 | g_variant_unref (variant); |
| 6769 | return value; |
| 6770 | } |
| 6771 | |
| 6772 | static guchar |
| 6773 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
| 6774 | { |
| 6775 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6776 | GVariant *variant; |
| 6777 | guchar value = 0; |
| 6778 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 6779 | if (variant != NULL) |
| 6780 | { |
| 6781 | value = g_variant_get_byte (variant); |
| 6782 | g_variant_unref (variant); |
| 6783 | } |
| 6784 | return value; |
| 6785 | } |
| 6786 | |
| 6787 | static void |
| 6788 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
| 6789 | { |
| 6790 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6791 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
| 6792 | #else |
| 6793 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); |
| 6794 | #endif |
| 6795 | |
| 6796 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); |
| 6797 | } |
| 6798 | |
| 6799 | static void |
| 6800 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
| 6801 | { |
| 6802 | GObjectClass *gobject_class; |
| 6803 | GDBusProxyClass *proxy_class; |
| 6804 | |
| 6805 | gobject_class = G_OBJECT_CLASS (klass); |
| 6806 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 6807 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 6808 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
| 6809 | |
| 6810 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 6811 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 6812 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
| 6813 | |
| 6814 | sensor_threshold_override_properties (gobject_class, 1); |
| 6815 | |
| 6816 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6817 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
| 6818 | #endif |
| 6819 | } |
| 6820 | |
| 6821 | static void |
| 6822 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
| 6823 | { |
| 6824 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 6825 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 6826 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 6827 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 6828 | iface->get_state = sensor_threshold_proxy_get_state; |
| 6829 | } |
| 6830 | |
| 6831 | /** |
| 6832 | * sensor_threshold_proxy_new: |
| 6833 | * @connection: A #GDBusConnection. |
| 6834 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6835 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6836 | * @object_path: An object path. |
| 6837 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6838 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6839 | * @user_data: User data to pass to @callback. |
| 6840 | * |
| 6841 | * 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. |
| 6842 | * |
| 6843 | * 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. |
| 6844 | * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. |
| 6845 | * |
| 6846 | * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 6847 | */ |
| 6848 | void |
| 6849 | sensor_threshold_proxy_new ( |
| 6850 | GDBusConnection *connection, |
| 6851 | GDBusProxyFlags flags, |
| 6852 | const gchar *name, |
| 6853 | const gchar *object_path, |
| 6854 | GCancellable *cancellable, |
| 6855 | GAsyncReadyCallback callback, |
| 6856 | gpointer user_data) |
| 6857 | { |
| 6858 | 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); |
| 6859 | } |
| 6860 | |
| 6861 | /** |
| 6862 | * sensor_threshold_proxy_new_finish: |
| 6863 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). |
| 6864 | * @error: Return location for error or %NULL |
| 6865 | * |
| 6866 | * Finishes an operation started with sensor_threshold_proxy_new(). |
| 6867 | * |
| 6868 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6869 | */ |
| 6870 | SensorThreshold * |
| 6871 | sensor_threshold_proxy_new_finish ( |
| 6872 | GAsyncResult *res, |
| 6873 | GError **error) |
| 6874 | { |
| 6875 | GObject *ret; |
| 6876 | GObject *source_object; |
| 6877 | source_object = g_async_result_get_source_object (res); |
| 6878 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6879 | g_object_unref (source_object); |
| 6880 | if (ret != NULL) |
| 6881 | return SENSOR_THRESHOLD (ret); |
| 6882 | else |
| 6883 | return NULL; |
| 6884 | } |
| 6885 | |
| 6886 | /** |
| 6887 | * sensor_threshold_proxy_new_sync: |
| 6888 | * @connection: A #GDBusConnection. |
| 6889 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6890 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6891 | * @object_path: An object path. |
| 6892 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6893 | * @error: Return location for error or %NULL |
| 6894 | * |
| 6895 | * 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. |
| 6896 | * |
| 6897 | * The calling thread is blocked until a reply is received. |
| 6898 | * |
| 6899 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
| 6900 | * |
| 6901 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6902 | */ |
| 6903 | SensorThreshold * |
| 6904 | sensor_threshold_proxy_new_sync ( |
| 6905 | GDBusConnection *connection, |
| 6906 | GDBusProxyFlags flags, |
| 6907 | const gchar *name, |
| 6908 | const gchar *object_path, |
| 6909 | GCancellable *cancellable, |
| 6910 | GError **error) |
| 6911 | { |
| 6912 | GInitable *ret; |
| 6913 | 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); |
| 6914 | if (ret != NULL) |
| 6915 | return SENSOR_THRESHOLD (ret); |
| 6916 | else |
| 6917 | return NULL; |
| 6918 | } |
| 6919 | |
| 6920 | |
| 6921 | /** |
| 6922 | * sensor_threshold_proxy_new_for_bus: |
| 6923 | * @bus_type: A #GBusType. |
| 6924 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6925 | * @name: A bus name (well-known or unique). |
| 6926 | * @object_path: An object path. |
| 6927 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6928 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6929 | * @user_data: User data to pass to @callback. |
| 6930 | * |
| 6931 | * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 6932 | * |
| 6933 | * 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. |
| 6934 | * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 6935 | * |
| 6936 | * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 6937 | */ |
| 6938 | void |
| 6939 | sensor_threshold_proxy_new_for_bus ( |
| 6940 | GBusType bus_type, |
| 6941 | GDBusProxyFlags flags, |
| 6942 | const gchar *name, |
| 6943 | const gchar *object_path, |
| 6944 | GCancellable *cancellable, |
| 6945 | GAsyncReadyCallback callback, |
| 6946 | gpointer user_data) |
| 6947 | { |
| 6948 | 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); |
| 6949 | } |
| 6950 | |
| 6951 | /** |
| 6952 | * sensor_threshold_proxy_new_for_bus_finish: |
| 6953 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). |
| 6954 | * @error: Return location for error or %NULL |
| 6955 | * |
| 6956 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
| 6957 | * |
| 6958 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6959 | */ |
| 6960 | SensorThreshold * |
| 6961 | sensor_threshold_proxy_new_for_bus_finish ( |
| 6962 | GAsyncResult *res, |
| 6963 | GError **error) |
| 6964 | { |
| 6965 | GObject *ret; |
| 6966 | GObject *source_object; |
| 6967 | source_object = g_async_result_get_source_object (res); |
| 6968 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6969 | g_object_unref (source_object); |
| 6970 | if (ret != NULL) |
| 6971 | return SENSOR_THRESHOLD (ret); |
| 6972 | else |
| 6973 | return NULL; |
| 6974 | } |
| 6975 | |
| 6976 | /** |
| 6977 | * sensor_threshold_proxy_new_for_bus_sync: |
| 6978 | * @bus_type: A #GBusType. |
| 6979 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6980 | * @name: A bus name (well-known or unique). |
| 6981 | * @object_path: An object path. |
| 6982 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6983 | * @error: Return location for error or %NULL |
| 6984 | * |
| 6985 | * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 6986 | * |
| 6987 | * The calling thread is blocked until a reply is received. |
| 6988 | * |
| 6989 | * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 6990 | * |
| 6991 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6992 | */ |
| 6993 | SensorThreshold * |
| 6994 | sensor_threshold_proxy_new_for_bus_sync ( |
| 6995 | GBusType bus_type, |
| 6996 | GDBusProxyFlags flags, |
| 6997 | const gchar *name, |
| 6998 | const gchar *object_path, |
| 6999 | GCancellable *cancellable, |
| 7000 | GError **error) |
| 7001 | { |
| 7002 | GInitable *ret; |
| 7003 | 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); |
| 7004 | if (ret != NULL) |
| 7005 | return SENSOR_THRESHOLD (ret); |
| 7006 | else |
| 7007 | return NULL; |
| 7008 | } |
| 7009 | |
| 7010 | |
| 7011 | /* ------------------------------------------------------------------------ */ |
| 7012 | |
| 7013 | /** |
| 7014 | * SensorThresholdSkeleton: |
| 7015 | * |
| 7016 | * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 7017 | */ |
| 7018 | |
| 7019 | /** |
| 7020 | * SensorThresholdSkeletonClass: |
| 7021 | * @parent_class: The parent class. |
| 7022 | * |
| 7023 | * Class structure for #SensorThresholdSkeleton. |
| 7024 | */ |
| 7025 | |
| 7026 | struct _SensorThresholdSkeletonPrivate |
| 7027 | { |
| 7028 | GValue *properties; |
| 7029 | GList *changed_properties; |
| 7030 | GSource *changed_properties_idle_source; |
| 7031 | GMainContext *context; |
| 7032 | GMutex lock; |
| 7033 | }; |
| 7034 | |
| 7035 | static void |
| 7036 | _sensor_threshold_skeleton_handle_method_call ( |
| 7037 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7038 | const gchar *sender G_GNUC_UNUSED, |
| 7039 | const gchar *object_path G_GNUC_UNUSED, |
| 7040 | const gchar *interface_name, |
| 7041 | const gchar *method_name, |
| 7042 | GVariant *parameters, |
| 7043 | GDBusMethodInvocation *invocation, |
| 7044 | gpointer user_data) |
| 7045 | { |
| 7046 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7047 | _ExtendedGDBusMethodInfo *info; |
| 7048 | GVariantIter iter; |
| 7049 | GVariant *child; |
| 7050 | GValue *paramv; |
| 7051 | guint num_params; |
| 7052 | guint num_extra; |
| 7053 | guint n; |
| 7054 | guint signal_id; |
| 7055 | GValue return_value = G_VALUE_INIT; |
| 7056 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 7057 | g_assert (info != NULL); |
| 7058 | num_params = g_variant_n_children (parameters); |
| 7059 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 7060 | n = 0; |
| 7061 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
| 7062 | g_value_set_object (¶mv[n++], skeleton); |
| 7063 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 7064 | g_value_set_object (¶mv[n++], invocation); |
| 7065 | if (info->pass_fdlist) |
| 7066 | { |
| 7067 | #ifdef G_OS_UNIX |
| 7068 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 7069 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 7070 | #else |
| 7071 | g_assert_not_reached (); |
| 7072 | #endif |
| 7073 | } |
| 7074 | g_variant_iter_init (&iter, parameters); |
| 7075 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7076 | { |
| 7077 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 7078 | if (arg_info->use_gvariant) |
| 7079 | { |
| 7080 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7081 | g_value_set_variant (¶mv[n], child); |
| 7082 | n++; |
| 7083 | } |
| 7084 | else |
| 7085 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7086 | g_variant_unref (child); |
| 7087 | } |
| 7088 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 7089 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 7090 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 7091 | if (!g_value_get_boolean (&return_value)) |
| 7092 | 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); |
| 7093 | g_value_unset (&return_value); |
| 7094 | for (n = 0; n < num_params + num_extra; n++) |
| 7095 | g_value_unset (¶mv[n]); |
| 7096 | g_free (paramv); |
| 7097 | } |
| 7098 | |
| 7099 | static GVariant * |
| 7100 | _sensor_threshold_skeleton_handle_get_property ( |
| 7101 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7102 | const gchar *sender G_GNUC_UNUSED, |
| 7103 | const gchar *object_path G_GNUC_UNUSED, |
| 7104 | const gchar *interface_name G_GNUC_UNUSED, |
| 7105 | const gchar *property_name, |
| 7106 | GError **error, |
| 7107 | gpointer user_data) |
| 7108 | { |
| 7109 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7110 | GValue value = G_VALUE_INIT; |
| 7111 | GParamSpec *pspec; |
| 7112 | _ExtendedGDBusPropertyInfo *info; |
| 7113 | GVariant *ret; |
| 7114 | ret = NULL; |
| 7115 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 7116 | g_assert (info != NULL); |
| 7117 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7118 | if (pspec == NULL) |
| 7119 | { |
| 7120 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7121 | } |
| 7122 | else |
| 7123 | { |
| 7124 | g_value_init (&value, pspec->value_type); |
| 7125 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7126 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7127 | g_value_unset (&value); |
| 7128 | } |
| 7129 | return ret; |
| 7130 | } |
| 7131 | |
| 7132 | static gboolean |
| 7133 | _sensor_threshold_skeleton_handle_set_property ( |
| 7134 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7135 | const gchar *sender G_GNUC_UNUSED, |
| 7136 | const gchar *object_path G_GNUC_UNUSED, |
| 7137 | const gchar *interface_name G_GNUC_UNUSED, |
| 7138 | const gchar *property_name, |
| 7139 | GVariant *variant, |
| 7140 | GError **error, |
| 7141 | gpointer user_data) |
| 7142 | { |
| 7143 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7144 | GValue value = G_VALUE_INIT; |
| 7145 | GParamSpec *pspec; |
| 7146 | _ExtendedGDBusPropertyInfo *info; |
| 7147 | gboolean ret; |
| 7148 | ret = FALSE; |
| 7149 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 7150 | g_assert (info != NULL); |
| 7151 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7152 | if (pspec == NULL) |
| 7153 | { |
| 7154 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7155 | } |
| 7156 | else |
| 7157 | { |
| 7158 | if (info->use_gvariant) |
| 7159 | g_value_set_variant (&value, variant); |
| 7160 | else |
| 7161 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 7162 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7163 | g_value_unset (&value); |
| 7164 | ret = TRUE; |
| 7165 | } |
| 7166 | return ret; |
| 7167 | } |
| 7168 | |
| 7169 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
| 7170 | { |
| 7171 | _sensor_threshold_skeleton_handle_method_call, |
| 7172 | _sensor_threshold_skeleton_handle_get_property, |
| 7173 | _sensor_threshold_skeleton_handle_set_property, |
| 7174 | {NULL} |
| 7175 | }; |
| 7176 | |
| 7177 | static GDBusInterfaceInfo * |
| 7178 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7179 | { |
| 7180 | return sensor_threshold_interface_info (); |
| 7181 | } |
| 7182 | |
| 7183 | static GDBusInterfaceVTable * |
| 7184 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7185 | { |
| 7186 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
| 7187 | } |
| 7188 | |
| 7189 | static GVariant * |
| 7190 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 7191 | { |
| 7192 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 7193 | |
| 7194 | GVariantBuilder builder; |
| 7195 | guint n; |
| 7196 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7197 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
| 7198 | goto out; |
| 7199 | for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 7200 | { |
| 7201 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
| 7202 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 7203 | { |
| 7204 | GVariant *value; |
| 7205 | 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); |
| 7206 | if (value != NULL) |
| 7207 | { |
| 7208 | g_variant_take_ref (value); |
| 7209 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 7210 | g_variant_unref (value); |
| 7211 | } |
| 7212 | } |
| 7213 | } |
| 7214 | out: |
| 7215 | return g_variant_builder_end (&builder); |
| 7216 | } |
| 7217 | |
| 7218 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
| 7219 | |
| 7220 | static void |
| 7221 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 7222 | { |
| 7223 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 7224 | gboolean emit_changed = FALSE; |
| 7225 | |
| 7226 | g_mutex_lock (&skeleton->priv->lock); |
| 7227 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7228 | { |
| 7229 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7230 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7231 | emit_changed = TRUE; |
| 7232 | } |
| 7233 | g_mutex_unlock (&skeleton->priv->lock); |
| 7234 | |
| 7235 | if (emit_changed) |
| 7236 | _sensor_threshold_emit_changed (skeleton); |
| 7237 | } |
| 7238 | |
| 7239 | static void |
| 7240 | _sensor_threshold_on_signal_warning ( |
| 7241 | SensorThreshold *object) |
| 7242 | { |
| 7243 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7244 | |
| 7245 | GList *connections, *l; |
| 7246 | GVariant *signal_variant; |
| 7247 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7248 | |
| 7249 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7250 | for (l = connections; l != NULL; l = l->next) |
| 7251 | { |
| 7252 | GDBusConnection *connection = l->data; |
| 7253 | g_dbus_connection_emit_signal (connection, |
| 7254 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", |
| 7255 | signal_variant, NULL); |
| 7256 | } |
| 7257 | g_variant_unref (signal_variant); |
| 7258 | g_list_free_full (connections, g_object_unref); |
| 7259 | } |
| 7260 | |
| 7261 | static void |
| 7262 | _sensor_threshold_on_signal_critical ( |
| 7263 | SensorThreshold *object) |
| 7264 | { |
| 7265 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7266 | |
| 7267 | GList *connections, *l; |
| 7268 | GVariant *signal_variant; |
| 7269 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7270 | |
| 7271 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7272 | for (l = connections; l != NULL; l = l->next) |
| 7273 | { |
| 7274 | GDBusConnection *connection = l->data; |
| 7275 | g_dbus_connection_emit_signal (connection, |
| 7276 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", |
| 7277 | signal_variant, NULL); |
| 7278 | } |
| 7279 | g_variant_unref (signal_variant); |
| 7280 | g_list_free_full (connections, g_object_unref); |
| 7281 | } |
| 7282 | |
| 7283 | static void |
| 7284 | _sensor_threshold_on_signal_normal ( |
| 7285 | SensorThreshold *object) |
| 7286 | { |
| 7287 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7288 | |
| 7289 | GList *connections, *l; |
| 7290 | GVariant *signal_variant; |
| 7291 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7292 | |
| 7293 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7294 | for (l = connections; l != NULL; l = l->next) |
| 7295 | { |
| 7296 | GDBusConnection *connection = l->data; |
| 7297 | g_dbus_connection_emit_signal (connection, |
| 7298 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", |
| 7299 | signal_variant, NULL); |
| 7300 | } |
| 7301 | g_variant_unref (signal_variant); |
| 7302 | g_list_free_full (connections, g_object_unref); |
| 7303 | } |
| 7304 | |
| 7305 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
| 7306 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7307 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7308 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 7309 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 7310 | |
| 7311 | #else |
| 7312 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7313 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 7314 | |
| 7315 | #endif |
| 7316 | static void |
| 7317 | sensor_threshold_skeleton_finalize (GObject *object) |
| 7318 | { |
| 7319 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7320 | guint n; |
| 7321 | for (n = 0; n < 5; n++) |
| 7322 | g_value_unset (&skeleton->priv->properties[n]); |
| 7323 | g_free (skeleton->priv->properties); |
| 7324 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7325 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7326 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7327 | g_main_context_unref (skeleton->priv->context); |
| 7328 | g_mutex_clear (&skeleton->priv->lock); |
| 7329 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
| 7330 | } |
| 7331 | |
| 7332 | static void |
| 7333 | sensor_threshold_skeleton_get_property (GObject *object, |
| 7334 | guint prop_id, |
| 7335 | GValue *value, |
| 7336 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7337 | { |
| 7338 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7339 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7340 | g_mutex_lock (&skeleton->priv->lock); |
| 7341 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 7342 | g_mutex_unlock (&skeleton->priv->lock); |
| 7343 | } |
| 7344 | |
| 7345 | static gboolean |
| 7346 | _sensor_threshold_emit_changed (gpointer user_data) |
| 7347 | { |
| 7348 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7349 | GList *l; |
| 7350 | GVariantBuilder builder; |
| 7351 | GVariantBuilder invalidated_builder; |
| 7352 | guint num_changes; |
| 7353 | |
| 7354 | g_mutex_lock (&skeleton->priv->lock); |
| 7355 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7356 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 7357 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 7358 | { |
| 7359 | ChangedProperty *cp = l->data; |
| 7360 | GVariant *variant; |
| 7361 | const GValue *cur_value; |
| 7362 | |
| 7363 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 7364 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 7365 | { |
| 7366 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 7367 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 7368 | g_variant_unref (variant); |
| 7369 | num_changes++; |
| 7370 | } |
| 7371 | } |
| 7372 | if (num_changes > 0) |
| 7373 | { |
| 7374 | GList *connections, *ll; |
| 7375 | GVariant *signal_variant; |
| 7376 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", |
| 7377 | &builder, &invalidated_builder)); |
| 7378 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7379 | for (ll = connections; ll != NULL; ll = ll->next) |
| 7380 | { |
| 7381 | GDBusConnection *connection = ll->data; |
| 7382 | |
| 7383 | g_dbus_connection_emit_signal (connection, |
| 7384 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 7385 | "org.freedesktop.DBus.Properties", |
| 7386 | "PropertiesChanged", |
| 7387 | signal_variant, |
| 7388 | NULL); |
| 7389 | } |
| 7390 | g_variant_unref (signal_variant); |
| 7391 | g_list_free_full (connections, g_object_unref); |
| 7392 | } |
| 7393 | else |
| 7394 | { |
| 7395 | g_variant_builder_clear (&builder); |
| 7396 | g_variant_builder_clear (&invalidated_builder); |
| 7397 | } |
| 7398 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7399 | skeleton->priv->changed_properties = NULL; |
| 7400 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7401 | g_mutex_unlock (&skeleton->priv->lock); |
| 7402 | return FALSE; |
| 7403 | } |
| 7404 | |
| 7405 | static void |
| 7406 | _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 7407 | { |
| 7408 | ChangedProperty *cp; |
| 7409 | GList *l; |
| 7410 | cp = NULL; |
| 7411 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 7412 | { |
| 7413 | ChangedProperty *i_cp = l->data; |
| 7414 | if (i_cp->info == info) |
| 7415 | { |
| 7416 | cp = i_cp; |
| 7417 | break; |
| 7418 | } |
| 7419 | } |
| 7420 | if (cp == NULL) |
| 7421 | { |
| 7422 | cp = g_new0 (ChangedProperty, 1); |
| 7423 | cp->prop_id = prop_id; |
| 7424 | cp->info = info; |
| 7425 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 7426 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 7427 | g_value_copy (orig_value, &cp->orig_value); |
| 7428 | } |
| 7429 | } |
| 7430 | |
| 7431 | static void |
| 7432 | sensor_threshold_skeleton_notify (GObject *object, |
| 7433 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7434 | { |
| 7435 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7436 | g_mutex_lock (&skeleton->priv->lock); |
| 7437 | if (skeleton->priv->changed_properties != NULL && |
| 7438 | skeleton->priv->changed_properties_idle_source == NULL) |
| 7439 | { |
| 7440 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 7441 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 7442 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 7443 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 7444 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 7445 | } |
| 7446 | g_mutex_unlock (&skeleton->priv->lock); |
| 7447 | } |
| 7448 | |
| 7449 | static void |
| 7450 | sensor_threshold_skeleton_set_property (GObject *object, |
| 7451 | guint prop_id, |
| 7452 | const GValue *value, |
| 7453 | GParamSpec *pspec) |
| 7454 | { |
| 7455 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7456 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7457 | g_mutex_lock (&skeleton->priv->lock); |
| 7458 | g_object_freeze_notify (object); |
| 7459 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 7460 | { |
| 7461 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 7462 | _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 7463 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 7464 | g_object_notify_by_pspec (object, pspec); |
| 7465 | } |
| 7466 | g_mutex_unlock (&skeleton->priv->lock); |
| 7467 | g_object_thaw_notify (object); |
| 7468 | } |
| 7469 | |
| 7470 | static void |
| 7471 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
| 7472 | { |
| 7473 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7474 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
| 7475 | #else |
| 7476 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); |
| 7477 | #endif |
| 7478 | |
| 7479 | g_mutex_init (&skeleton->priv->lock); |
| 7480 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 7481 | skeleton->priv->properties = g_new0 (GValue, 5); |
| 7482 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 7483 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 7484 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 7485 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 7486 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
| 7487 | } |
| 7488 | |
| 7489 | static GVariant * |
| 7490 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
| 7491 | { |
| 7492 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7493 | GVariant *value; |
| 7494 | g_mutex_lock (&skeleton->priv->lock); |
| 7495 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 7496 | g_mutex_unlock (&skeleton->priv->lock); |
| 7497 | return value; |
| 7498 | } |
| 7499 | |
| 7500 | static GVariant * |
| 7501 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
| 7502 | { |
| 7503 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7504 | GVariant *value; |
| 7505 | g_mutex_lock (&skeleton->priv->lock); |
| 7506 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
| 7507 | g_mutex_unlock (&skeleton->priv->lock); |
| 7508 | return value; |
| 7509 | } |
| 7510 | |
| 7511 | static GVariant * |
| 7512 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
| 7513 | { |
| 7514 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7515 | GVariant *value; |
| 7516 | g_mutex_lock (&skeleton->priv->lock); |
| 7517 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
| 7518 | g_mutex_unlock (&skeleton->priv->lock); |
| 7519 | return value; |
| 7520 | } |
| 7521 | |
| 7522 | static GVariant * |
| 7523 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
| 7524 | { |
| 7525 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7526 | GVariant *value; |
| 7527 | g_mutex_lock (&skeleton->priv->lock); |
| 7528 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
| 7529 | g_mutex_unlock (&skeleton->priv->lock); |
| 7530 | return value; |
| 7531 | } |
| 7532 | |
| 7533 | static guchar |
| 7534 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
| 7535 | { |
| 7536 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7537 | guchar value; |
| 7538 | g_mutex_lock (&skeleton->priv->lock); |
| 7539 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
| 7540 | g_mutex_unlock (&skeleton->priv->lock); |
| 7541 | return value; |
| 7542 | } |
| 7543 | |
| 7544 | static void |
| 7545 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
| 7546 | { |
| 7547 | GObjectClass *gobject_class; |
| 7548 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 7549 | |
| 7550 | gobject_class = G_OBJECT_CLASS (klass); |
| 7551 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 7552 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 7553 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 7554 | gobject_class->notify = sensor_threshold_skeleton_notify; |
| 7555 | |
| 7556 | |
| 7557 | sensor_threshold_override_properties (gobject_class, 1); |
| 7558 | |
| 7559 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 7560 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 7561 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 7562 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 7563 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
| 7564 | |
| 7565 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7566 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
| 7567 | #endif |
| 7568 | } |
| 7569 | |
| 7570 | static void |
| 7571 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
| 7572 | { |
| 7573 | iface->warning = _sensor_threshold_on_signal_warning; |
| 7574 | iface->critical = _sensor_threshold_on_signal_critical; |
| 7575 | iface->normal = _sensor_threshold_on_signal_normal; |
| 7576 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 7577 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 7578 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 7579 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 7580 | iface->get_state = sensor_threshold_skeleton_get_state; |
| 7581 | } |
| 7582 | |
| 7583 | /** |
| 7584 | * sensor_threshold_skeleton_new: |
| 7585 | * |
| 7586 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 7587 | * |
| 7588 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
| 7589 | */ |
| 7590 | SensorThreshold * |
| 7591 | sensor_threshold_skeleton_new (void) |
| 7592 | { |
| 7593 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
| 7594 | } |
| 7595 | |
| 7596 | /* ------------------------------------------------------------------------ |
| 7597 | * Code for interface org.openbmc.SensorI2c |
| 7598 | * ------------------------------------------------------------------------ |
| 7599 | */ |
| 7600 | |
| 7601 | /** |
| 7602 | * SECTION:SensorI2c |
| 7603 | * @title: SensorI2c |
| 7604 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 7605 | * |
| 7606 | * 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. |
| 7607 | */ |
| 7608 | |
| 7609 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 7610 | |
| 7611 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 7612 | { |
| 7613 | { |
| 7614 | -1, |
| 7615 | (gchar *) "dev_path", |
| 7616 | (gchar *) "s", |
| 7617 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 7618 | NULL |
| 7619 | }, |
| 7620 | "dev-path", |
| 7621 | FALSE |
| 7622 | }; |
| 7623 | |
| 7624 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 7625 | { |
| 7626 | { |
| 7627 | -1, |
| 7628 | (gchar *) "address", |
| 7629 | (gchar *) "s", |
| 7630 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 7631 | NULL |
| 7632 | }, |
| 7633 | "address", |
| 7634 | FALSE |
| 7635 | }; |
| 7636 | |
| 7637 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 7638 | { |
| 7639 | &_sensor_i2c_property_info_dev_path, |
| 7640 | &_sensor_i2c_property_info_address, |
| 7641 | NULL |
| 7642 | }; |
| 7643 | |
| 7644 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 7645 | { |
| 7646 | { |
| 7647 | -1, |
| 7648 | (gchar *) "org.openbmc.SensorI2c", |
| 7649 | NULL, |
| 7650 | NULL, |
| 7651 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 7652 | NULL |
| 7653 | }, |
| 7654 | "sensor-i2c", |
| 7655 | }; |
| 7656 | |
| 7657 | |
| 7658 | /** |
| 7659 | * sensor_i2c_interface_info: |
| 7660 | * |
| 7661 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 7662 | * |
| 7663 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 7664 | */ |
| 7665 | GDBusInterfaceInfo * |
| 7666 | sensor_i2c_interface_info (void) |
| 7667 | { |
| 7668 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 7669 | } |
| 7670 | |
| 7671 | /** |
| 7672 | * sensor_i2c_override_properties: |
| 7673 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 7674 | * @property_id_begin: The property id to assign to the first overridden property. |
| 7675 | * |
| 7676 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 7677 | * The properties are overridden in the order they are defined. |
| 7678 | * |
| 7679 | * Returns: The last property id. |
| 7680 | */ |
| 7681 | guint |
| 7682 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 7683 | { |
| 7684 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 7685 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 7686 | return property_id_begin - 1; |
| 7687 | } |
| 7688 | |
| 7689 | |
| 7690 | |
| 7691 | /** |
| 7692 | * SensorI2c: |
| 7693 | * |
| 7694 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 7695 | */ |
| 7696 | |
| 7697 | /** |
| 7698 | * SensorI2cIface: |
| 7699 | * @parent_iface: The parent interface. |
| 7700 | * @get_address: Getter for the #SensorI2c:address property. |
| 7701 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 7702 | * |
| 7703 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 7704 | */ |
| 7705 | |
| 7706 | typedef SensorI2cIface SensorI2cInterface; |
| 7707 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 7708 | |
| 7709 | static void |
| 7710 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 7711 | { |
| 7712 | /* GObject properties for D-Bus properties: */ |
| 7713 | /** |
| 7714 | * SensorI2c:dev-path: |
| 7715 | * |
| 7716 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 7717 | * |
| 7718 | * 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. |
| 7719 | */ |
| 7720 | g_object_interface_install_property (iface, |
| 7721 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7722 | /** |
| 7723 | * SensorI2c:address: |
| 7724 | * |
| 7725 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 7726 | * |
| 7727 | * 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. |
| 7728 | */ |
| 7729 | g_object_interface_install_property (iface, |
| 7730 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7731 | } |
| 7732 | |
| 7733 | /** |
| 7734 | * sensor_i2c_get_dev_path: (skip) |
| 7735 | * @object: A #SensorI2c. |
| 7736 | * |
| 7737 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 7738 | * |
| 7739 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7740 | * |
| 7741 | * <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> |
| 7742 | * |
| 7743 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 7744 | */ |
| 7745 | const gchar * |
| 7746 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 7747 | { |
| 7748 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 7749 | } |
| 7750 | |
| 7751 | /** |
| 7752 | * sensor_i2c_dup_dev_path: (skip) |
| 7753 | * @object: A #SensorI2c. |
| 7754 | * |
| 7755 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 7756 | * |
| 7757 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7758 | * |
| 7759 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 7760 | */ |
| 7761 | gchar * |
| 7762 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 7763 | { |
| 7764 | gchar *value; |
| 7765 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 7766 | return value; |
| 7767 | } |
| 7768 | |
| 7769 | /** |
| 7770 | * sensor_i2c_set_dev_path: (skip) |
| 7771 | * @object: A #SensorI2c. |
| 7772 | * @value: The value to set. |
| 7773 | * |
| 7774 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 7775 | * |
| 7776 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7777 | */ |
| 7778 | void |
| 7779 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 7780 | { |
| 7781 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 7782 | } |
| 7783 | |
| 7784 | /** |
| 7785 | * sensor_i2c_get_address: (skip) |
| 7786 | * @object: A #SensorI2c. |
| 7787 | * |
| 7788 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 7789 | * |
| 7790 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7791 | * |
| 7792 | * <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> |
| 7793 | * |
| 7794 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 7795 | */ |
| 7796 | const gchar * |
| 7797 | sensor_i2c_get_address (SensorI2c *object) |
| 7798 | { |
| 7799 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 7800 | } |
| 7801 | |
| 7802 | /** |
| 7803 | * sensor_i2c_dup_address: (skip) |
| 7804 | * @object: A #SensorI2c. |
| 7805 | * |
| 7806 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 7807 | * |
| 7808 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7809 | * |
| 7810 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 7811 | */ |
| 7812 | gchar * |
| 7813 | sensor_i2c_dup_address (SensorI2c *object) |
| 7814 | { |
| 7815 | gchar *value; |
| 7816 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 7817 | return value; |
| 7818 | } |
| 7819 | |
| 7820 | /** |
| 7821 | * sensor_i2c_set_address: (skip) |
| 7822 | * @object: A #SensorI2c. |
| 7823 | * @value: The value to set. |
| 7824 | * |
| 7825 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 7826 | * |
| 7827 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7828 | */ |
| 7829 | void |
| 7830 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 7831 | { |
| 7832 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 7833 | } |
| 7834 | |
| 7835 | /* ------------------------------------------------------------------------ */ |
| 7836 | |
| 7837 | /** |
| 7838 | * SensorI2cProxy: |
| 7839 | * |
| 7840 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 7841 | */ |
| 7842 | |
| 7843 | /** |
| 7844 | * SensorI2cProxyClass: |
| 7845 | * @parent_class: The parent class. |
| 7846 | * |
| 7847 | * Class structure for #SensorI2cProxy. |
| 7848 | */ |
| 7849 | |
| 7850 | struct _SensorI2cProxyPrivate |
| 7851 | { |
| 7852 | GData *qdata; |
| 7853 | }; |
| 7854 | |
| 7855 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 7856 | |
| 7857 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7858 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 7859 | G_ADD_PRIVATE (SensorI2cProxy) |
| 7860 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 7861 | |
| 7862 | #else |
| 7863 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 7864 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 7865 | |
| 7866 | #endif |
| 7867 | static void |
| 7868 | sensor_i2c_proxy_finalize (GObject *object) |
| 7869 | { |
| 7870 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 7871 | g_datalist_clear (&proxy->priv->qdata); |
| 7872 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 7873 | } |
| 7874 | |
| 7875 | static void |
| 7876 | sensor_i2c_proxy_get_property (GObject *object, |
| 7877 | guint prop_id, |
| 7878 | GValue *value, |
| 7879 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7880 | { |
| 7881 | const _ExtendedGDBusPropertyInfo *info; |
| 7882 | GVariant *variant; |
| 7883 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7884 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 7885 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 7886 | if (info->use_gvariant) |
| 7887 | { |
| 7888 | g_value_set_variant (value, variant); |
| 7889 | } |
| 7890 | else |
| 7891 | { |
| 7892 | if (variant != NULL) |
| 7893 | g_dbus_gvariant_to_gvalue (variant, value); |
| 7894 | } |
| 7895 | if (variant != NULL) |
| 7896 | g_variant_unref (variant); |
| 7897 | } |
| 7898 | |
| 7899 | static void |
| 7900 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 7901 | GAsyncResult *res, |
| 7902 | gpointer user_data) |
| 7903 | { |
| 7904 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 7905 | GError *error; |
| 7906 | GVariant *_ret; |
| 7907 | error = NULL; |
| 7908 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 7909 | if (!_ret) |
| 7910 | { |
| 7911 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 7912 | info->parent_struct.name, |
| 7913 | error->message, g_quark_to_string (error->domain), error->code); |
| 7914 | g_error_free (error); |
| 7915 | } |
| 7916 | else |
| 7917 | { |
| 7918 | g_variant_unref (_ret); |
| 7919 | } |
| 7920 | } |
| 7921 | |
| 7922 | static void |
| 7923 | sensor_i2c_proxy_set_property (GObject *object, |
| 7924 | guint prop_id, |
| 7925 | const GValue *value, |
| 7926 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7927 | { |
| 7928 | const _ExtendedGDBusPropertyInfo *info; |
| 7929 | GVariant *variant; |
| 7930 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7931 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 7932 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7933 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 7934 | "org.freedesktop.DBus.Properties.Set", |
| 7935 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 7936 | G_DBUS_CALL_FLAGS_NONE, |
| 7937 | -1, |
| 7938 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 7939 | g_variant_unref (variant); |
| 7940 | } |
| 7941 | |
| 7942 | static void |
| 7943 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 7944 | const gchar *sender_name G_GNUC_UNUSED, |
| 7945 | const gchar *signal_name, |
| 7946 | GVariant *parameters) |
| 7947 | { |
| 7948 | _ExtendedGDBusSignalInfo *info; |
| 7949 | GVariantIter iter; |
| 7950 | GVariant *child; |
| 7951 | GValue *paramv; |
| 7952 | guint num_params; |
| 7953 | guint n; |
| 7954 | guint signal_id; |
| 7955 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 7956 | if (info == NULL) |
| 7957 | return; |
| 7958 | num_params = g_variant_n_children (parameters); |
| 7959 | paramv = g_new0 (GValue, num_params + 1); |
| 7960 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 7961 | g_value_set_object (¶mv[0], proxy); |
| 7962 | g_variant_iter_init (&iter, parameters); |
| 7963 | n = 1; |
| 7964 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7965 | { |
| 7966 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 7967 | if (arg_info->use_gvariant) |
| 7968 | { |
| 7969 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7970 | g_value_set_variant (¶mv[n], child); |
| 7971 | n++; |
| 7972 | } |
| 7973 | else |
| 7974 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7975 | g_variant_unref (child); |
| 7976 | } |
| 7977 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 7978 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 7979 | for (n = 0; n < num_params + 1; n++) |
| 7980 | g_value_unset (¶mv[n]); |
| 7981 | g_free (paramv); |
| 7982 | } |
| 7983 | |
| 7984 | static void |
| 7985 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 7986 | GVariant *changed_properties, |
| 7987 | const gchar *const *invalidated_properties) |
| 7988 | { |
| 7989 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 7990 | guint n; |
| 7991 | const gchar *key; |
| 7992 | GVariantIter *iter; |
| 7993 | _ExtendedGDBusPropertyInfo *info; |
| 7994 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 7995 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 7996 | { |
| 7997 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 7998 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 7999 | if (info != NULL) |
| 8000 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8001 | } |
| 8002 | g_variant_iter_free (iter); |
| 8003 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 8004 | { |
| 8005 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 8006 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 8007 | if (info != NULL) |
| 8008 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8009 | } |
| 8010 | } |
| 8011 | |
| 8012 | static const gchar * |
| 8013 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 8014 | { |
| 8015 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 8016 | GVariant *variant; |
| 8017 | const gchar *value = NULL; |
| 8018 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 8019 | if (variant != NULL) |
| 8020 | { |
| 8021 | value = g_variant_get_string (variant, NULL); |
| 8022 | g_variant_unref (variant); |
| 8023 | } |
| 8024 | return value; |
| 8025 | } |
| 8026 | |
| 8027 | static const gchar * |
| 8028 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 8029 | { |
| 8030 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 8031 | GVariant *variant; |
| 8032 | const gchar *value = NULL; |
| 8033 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 8034 | if (variant != NULL) |
| 8035 | { |
| 8036 | value = g_variant_get_string (variant, NULL); |
| 8037 | g_variant_unref (variant); |
| 8038 | } |
| 8039 | return value; |
| 8040 | } |
| 8041 | |
| 8042 | static void |
| 8043 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 8044 | { |
| 8045 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8046 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 8047 | #else |
| 8048 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 8049 | #endif |
| 8050 | |
| 8051 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 8052 | } |
| 8053 | |
| 8054 | static void |
| 8055 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 8056 | { |
| 8057 | GObjectClass *gobject_class; |
| 8058 | GDBusProxyClass *proxy_class; |
| 8059 | |
| 8060 | gobject_class = G_OBJECT_CLASS (klass); |
| 8061 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 8062 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 8063 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 8064 | |
| 8065 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 8066 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 8067 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 8068 | |
| 8069 | sensor_i2c_override_properties (gobject_class, 1); |
| 8070 | |
| 8071 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8072 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 8073 | #endif |
| 8074 | } |
| 8075 | |
| 8076 | static void |
| 8077 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 8078 | { |
| 8079 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 8080 | iface->get_address = sensor_i2c_proxy_get_address; |
| 8081 | } |
| 8082 | |
| 8083 | /** |
| 8084 | * sensor_i2c_proxy_new: |
| 8085 | * @connection: A #GDBusConnection. |
| 8086 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8087 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8088 | * @object_path: An object path. |
| 8089 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8090 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8091 | * @user_data: User data to pass to @callback. |
| 8092 | * |
| 8093 | * 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. |
| 8094 | * |
| 8095 | * 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. |
| 8096 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 8097 | * |
| 8098 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 8099 | */ |
| 8100 | void |
| 8101 | sensor_i2c_proxy_new ( |
| 8102 | GDBusConnection *connection, |
| 8103 | GDBusProxyFlags flags, |
| 8104 | const gchar *name, |
| 8105 | const gchar *object_path, |
| 8106 | GCancellable *cancellable, |
| 8107 | GAsyncReadyCallback callback, |
| 8108 | gpointer user_data) |
| 8109 | { |
| 8110 | 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); |
| 8111 | } |
| 8112 | |
| 8113 | /** |
| 8114 | * sensor_i2c_proxy_new_finish: |
| 8115 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 8116 | * @error: Return location for error or %NULL |
| 8117 | * |
| 8118 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 8119 | * |
| 8120 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8121 | */ |
| 8122 | SensorI2c * |
| 8123 | sensor_i2c_proxy_new_finish ( |
| 8124 | GAsyncResult *res, |
| 8125 | GError **error) |
| 8126 | { |
| 8127 | GObject *ret; |
| 8128 | GObject *source_object; |
| 8129 | source_object = g_async_result_get_source_object (res); |
| 8130 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8131 | g_object_unref (source_object); |
| 8132 | if (ret != NULL) |
| 8133 | return SENSOR_I2C (ret); |
| 8134 | else |
| 8135 | return NULL; |
| 8136 | } |
| 8137 | |
| 8138 | /** |
| 8139 | * sensor_i2c_proxy_new_sync: |
| 8140 | * @connection: A #GDBusConnection. |
| 8141 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8142 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8143 | * @object_path: An object path. |
| 8144 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8145 | * @error: Return location for error or %NULL |
| 8146 | * |
| 8147 | * 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. |
| 8148 | * |
| 8149 | * The calling thread is blocked until a reply is received. |
| 8150 | * |
| 8151 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 8152 | * |
| 8153 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8154 | */ |
| 8155 | SensorI2c * |
| 8156 | sensor_i2c_proxy_new_sync ( |
| 8157 | GDBusConnection *connection, |
| 8158 | GDBusProxyFlags flags, |
| 8159 | const gchar *name, |
| 8160 | const gchar *object_path, |
| 8161 | GCancellable *cancellable, |
| 8162 | GError **error) |
| 8163 | { |
| 8164 | GInitable *ret; |
| 8165 | 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); |
| 8166 | if (ret != NULL) |
| 8167 | return SENSOR_I2C (ret); |
| 8168 | else |
| 8169 | return NULL; |
| 8170 | } |
| 8171 | |
| 8172 | |
| 8173 | /** |
| 8174 | * sensor_i2c_proxy_new_for_bus: |
| 8175 | * @bus_type: A #GBusType. |
| 8176 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8177 | * @name: A bus name (well-known or unique). |
| 8178 | * @object_path: An object path. |
| 8179 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8180 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8181 | * @user_data: User data to pass to @callback. |
| 8182 | * |
| 8183 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 8184 | * |
| 8185 | * 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. |
| 8186 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 8187 | * |
| 8188 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 8189 | */ |
| 8190 | void |
| 8191 | sensor_i2c_proxy_new_for_bus ( |
| 8192 | GBusType bus_type, |
| 8193 | GDBusProxyFlags flags, |
| 8194 | const gchar *name, |
| 8195 | const gchar *object_path, |
| 8196 | GCancellable *cancellable, |
| 8197 | GAsyncReadyCallback callback, |
| 8198 | gpointer user_data) |
| 8199 | { |
| 8200 | 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); |
| 8201 | } |
| 8202 | |
| 8203 | /** |
| 8204 | * sensor_i2c_proxy_new_for_bus_finish: |
| 8205 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 8206 | * @error: Return location for error or %NULL |
| 8207 | * |
| 8208 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 8209 | * |
| 8210 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8211 | */ |
| 8212 | SensorI2c * |
| 8213 | sensor_i2c_proxy_new_for_bus_finish ( |
| 8214 | GAsyncResult *res, |
| 8215 | GError **error) |
| 8216 | { |
| 8217 | GObject *ret; |
| 8218 | GObject *source_object; |
| 8219 | source_object = g_async_result_get_source_object (res); |
| 8220 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8221 | g_object_unref (source_object); |
| 8222 | if (ret != NULL) |
| 8223 | return SENSOR_I2C (ret); |
| 8224 | else |
| 8225 | return NULL; |
| 8226 | } |
| 8227 | |
| 8228 | /** |
| 8229 | * sensor_i2c_proxy_new_for_bus_sync: |
| 8230 | * @bus_type: A #GBusType. |
| 8231 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8232 | * @name: A bus name (well-known or unique). |
| 8233 | * @object_path: An object path. |
| 8234 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8235 | * @error: Return location for error or %NULL |
| 8236 | * |
| 8237 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 8238 | * |
| 8239 | * The calling thread is blocked until a reply is received. |
| 8240 | * |
| 8241 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 8242 | * |
| 8243 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8244 | */ |
| 8245 | SensorI2c * |
| 8246 | sensor_i2c_proxy_new_for_bus_sync ( |
| 8247 | GBusType bus_type, |
| 8248 | GDBusProxyFlags flags, |
| 8249 | const gchar *name, |
| 8250 | const gchar *object_path, |
| 8251 | GCancellable *cancellable, |
| 8252 | GError **error) |
| 8253 | { |
| 8254 | GInitable *ret; |
| 8255 | 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); |
| 8256 | if (ret != NULL) |
| 8257 | return SENSOR_I2C (ret); |
| 8258 | else |
| 8259 | return NULL; |
| 8260 | } |
| 8261 | |
| 8262 | |
| 8263 | /* ------------------------------------------------------------------------ */ |
| 8264 | |
| 8265 | /** |
| 8266 | * SensorI2cSkeleton: |
| 8267 | * |
| 8268 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 8269 | */ |
| 8270 | |
| 8271 | /** |
| 8272 | * SensorI2cSkeletonClass: |
| 8273 | * @parent_class: The parent class. |
| 8274 | * |
| 8275 | * Class structure for #SensorI2cSkeleton. |
| 8276 | */ |
| 8277 | |
| 8278 | struct _SensorI2cSkeletonPrivate |
| 8279 | { |
| 8280 | GValue *properties; |
| 8281 | GList *changed_properties; |
| 8282 | GSource *changed_properties_idle_source; |
| 8283 | GMainContext *context; |
| 8284 | GMutex lock; |
| 8285 | }; |
| 8286 | |
| 8287 | static void |
| 8288 | _sensor_i2c_skeleton_handle_method_call ( |
| 8289 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8290 | const gchar *sender G_GNUC_UNUSED, |
| 8291 | const gchar *object_path G_GNUC_UNUSED, |
| 8292 | const gchar *interface_name, |
| 8293 | const gchar *method_name, |
| 8294 | GVariant *parameters, |
| 8295 | GDBusMethodInvocation *invocation, |
| 8296 | gpointer user_data) |
| 8297 | { |
| 8298 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8299 | _ExtendedGDBusMethodInfo *info; |
| 8300 | GVariantIter iter; |
| 8301 | GVariant *child; |
| 8302 | GValue *paramv; |
| 8303 | guint num_params; |
| 8304 | guint num_extra; |
| 8305 | guint n; |
| 8306 | guint signal_id; |
| 8307 | GValue return_value = G_VALUE_INIT; |
| 8308 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 8309 | g_assert (info != NULL); |
| 8310 | num_params = g_variant_n_children (parameters); |
| 8311 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 8312 | n = 0; |
| 8313 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 8314 | g_value_set_object (¶mv[n++], skeleton); |
| 8315 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 8316 | g_value_set_object (¶mv[n++], invocation); |
| 8317 | if (info->pass_fdlist) |
| 8318 | { |
| 8319 | #ifdef G_OS_UNIX |
| 8320 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 8321 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 8322 | #else |
| 8323 | g_assert_not_reached (); |
| 8324 | #endif |
| 8325 | } |
| 8326 | g_variant_iter_init (&iter, parameters); |
| 8327 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8328 | { |
| 8329 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 8330 | if (arg_info->use_gvariant) |
| 8331 | { |
| 8332 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8333 | g_value_set_variant (¶mv[n], child); |
| 8334 | n++; |
| 8335 | } |
| 8336 | else |
| 8337 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8338 | g_variant_unref (child); |
| 8339 | } |
| 8340 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 8341 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 8342 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 8343 | if (!g_value_get_boolean (&return_value)) |
| 8344 | 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); |
| 8345 | g_value_unset (&return_value); |
| 8346 | for (n = 0; n < num_params + num_extra; n++) |
| 8347 | g_value_unset (¶mv[n]); |
| 8348 | g_free (paramv); |
| 8349 | } |
| 8350 | |
| 8351 | static GVariant * |
| 8352 | _sensor_i2c_skeleton_handle_get_property ( |
| 8353 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8354 | const gchar *sender G_GNUC_UNUSED, |
| 8355 | const gchar *object_path G_GNUC_UNUSED, |
| 8356 | const gchar *interface_name G_GNUC_UNUSED, |
| 8357 | const gchar *property_name, |
| 8358 | GError **error, |
| 8359 | gpointer user_data) |
| 8360 | { |
| 8361 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8362 | GValue value = G_VALUE_INIT; |
| 8363 | GParamSpec *pspec; |
| 8364 | _ExtendedGDBusPropertyInfo *info; |
| 8365 | GVariant *ret; |
| 8366 | ret = NULL; |
| 8367 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 8368 | g_assert (info != NULL); |
| 8369 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8370 | if (pspec == NULL) |
| 8371 | { |
| 8372 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8373 | } |
| 8374 | else |
| 8375 | { |
| 8376 | g_value_init (&value, pspec->value_type); |
| 8377 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8378 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8379 | g_value_unset (&value); |
| 8380 | } |
| 8381 | return ret; |
| 8382 | } |
| 8383 | |
| 8384 | static gboolean |
| 8385 | _sensor_i2c_skeleton_handle_set_property ( |
| 8386 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8387 | const gchar *sender G_GNUC_UNUSED, |
| 8388 | const gchar *object_path G_GNUC_UNUSED, |
| 8389 | const gchar *interface_name G_GNUC_UNUSED, |
| 8390 | const gchar *property_name, |
| 8391 | GVariant *variant, |
| 8392 | GError **error, |
| 8393 | gpointer user_data) |
| 8394 | { |
| 8395 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8396 | GValue value = G_VALUE_INIT; |
| 8397 | GParamSpec *pspec; |
| 8398 | _ExtendedGDBusPropertyInfo *info; |
| 8399 | gboolean ret; |
| 8400 | ret = FALSE; |
| 8401 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 8402 | g_assert (info != NULL); |
| 8403 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8404 | if (pspec == NULL) |
| 8405 | { |
| 8406 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8407 | } |
| 8408 | else |
| 8409 | { |
| 8410 | if (info->use_gvariant) |
| 8411 | g_value_set_variant (&value, variant); |
| 8412 | else |
| 8413 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 8414 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8415 | g_value_unset (&value); |
| 8416 | ret = TRUE; |
| 8417 | } |
| 8418 | return ret; |
| 8419 | } |
| 8420 | |
| 8421 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 8422 | { |
| 8423 | _sensor_i2c_skeleton_handle_method_call, |
| 8424 | _sensor_i2c_skeleton_handle_get_property, |
| 8425 | _sensor_i2c_skeleton_handle_set_property, |
| 8426 | {NULL} |
| 8427 | }; |
| 8428 | |
| 8429 | static GDBusInterfaceInfo * |
| 8430 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8431 | { |
| 8432 | return sensor_i2c_interface_info (); |
| 8433 | } |
| 8434 | |
| 8435 | static GDBusInterfaceVTable * |
| 8436 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8437 | { |
| 8438 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 8439 | } |
| 8440 | |
| 8441 | static GVariant * |
| 8442 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 8443 | { |
| 8444 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 8445 | |
| 8446 | GVariantBuilder builder; |
| 8447 | guint n; |
| 8448 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8449 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 8450 | goto out; |
| 8451 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 8452 | { |
| 8453 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 8454 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 8455 | { |
| 8456 | GVariant *value; |
| 8457 | 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); |
| 8458 | if (value != NULL) |
| 8459 | { |
| 8460 | g_variant_take_ref (value); |
| 8461 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 8462 | g_variant_unref (value); |
| 8463 | } |
| 8464 | } |
| 8465 | } |
| 8466 | out: |
| 8467 | return g_variant_builder_end (&builder); |
| 8468 | } |
| 8469 | |
| 8470 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 8471 | |
| 8472 | static void |
| 8473 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 8474 | { |
| 8475 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 8476 | gboolean emit_changed = FALSE; |
| 8477 | |
| 8478 | g_mutex_lock (&skeleton->priv->lock); |
| 8479 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8480 | { |
| 8481 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8482 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8483 | emit_changed = TRUE; |
| 8484 | } |
| 8485 | g_mutex_unlock (&skeleton->priv->lock); |
| 8486 | |
| 8487 | if (emit_changed) |
| 8488 | _sensor_i2c_emit_changed (skeleton); |
| 8489 | } |
| 8490 | |
| 8491 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 8492 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8493 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8494 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 8495 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 8496 | |
| 8497 | #else |
| 8498 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8499 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 8500 | |
| 8501 | #endif |
| 8502 | static void |
| 8503 | sensor_i2c_skeleton_finalize (GObject *object) |
| 8504 | { |
| 8505 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8506 | guint n; |
| 8507 | for (n = 0; n < 2; n++) |
| 8508 | g_value_unset (&skeleton->priv->properties[n]); |
| 8509 | g_free (skeleton->priv->properties); |
| 8510 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8511 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8512 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8513 | g_main_context_unref (skeleton->priv->context); |
| 8514 | g_mutex_clear (&skeleton->priv->lock); |
| 8515 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 8516 | } |
| 8517 | |
| 8518 | static void |
| 8519 | sensor_i2c_skeleton_get_property (GObject *object, |
| 8520 | guint prop_id, |
| 8521 | GValue *value, |
| 8522 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8523 | { |
| 8524 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8525 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8526 | g_mutex_lock (&skeleton->priv->lock); |
| 8527 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 8528 | g_mutex_unlock (&skeleton->priv->lock); |
| 8529 | } |
| 8530 | |
| 8531 | static gboolean |
| 8532 | _sensor_i2c_emit_changed (gpointer user_data) |
| 8533 | { |
| 8534 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8535 | GList *l; |
| 8536 | GVariantBuilder builder; |
| 8537 | GVariantBuilder invalidated_builder; |
| 8538 | guint num_changes; |
| 8539 | |
| 8540 | g_mutex_lock (&skeleton->priv->lock); |
| 8541 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8542 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 8543 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 8544 | { |
| 8545 | ChangedProperty *cp = l->data; |
| 8546 | GVariant *variant; |
| 8547 | const GValue *cur_value; |
| 8548 | |
| 8549 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 8550 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 8551 | { |
| 8552 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 8553 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 8554 | g_variant_unref (variant); |
| 8555 | num_changes++; |
| 8556 | } |
| 8557 | } |
| 8558 | if (num_changes > 0) |
| 8559 | { |
| 8560 | GList *connections, *ll; |
| 8561 | GVariant *signal_variant; |
| 8562 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 8563 | &builder, &invalidated_builder)); |
| 8564 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8565 | for (ll = connections; ll != NULL; ll = ll->next) |
| 8566 | { |
| 8567 | GDBusConnection *connection = ll->data; |
| 8568 | |
| 8569 | g_dbus_connection_emit_signal (connection, |
| 8570 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 8571 | "org.freedesktop.DBus.Properties", |
| 8572 | "PropertiesChanged", |
| 8573 | signal_variant, |
| 8574 | NULL); |
| 8575 | } |
| 8576 | g_variant_unref (signal_variant); |
| 8577 | g_list_free_full (connections, g_object_unref); |
| 8578 | } |
| 8579 | else |
| 8580 | { |
| 8581 | g_variant_builder_clear (&builder); |
| 8582 | g_variant_builder_clear (&invalidated_builder); |
| 8583 | } |
| 8584 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8585 | skeleton->priv->changed_properties = NULL; |
| 8586 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8587 | g_mutex_unlock (&skeleton->priv->lock); |
| 8588 | return FALSE; |
| 8589 | } |
| 8590 | |
| 8591 | static void |
| 8592 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 8593 | { |
| 8594 | ChangedProperty *cp; |
| 8595 | GList *l; |
| 8596 | cp = NULL; |
| 8597 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 8598 | { |
| 8599 | ChangedProperty *i_cp = l->data; |
| 8600 | if (i_cp->info == info) |
| 8601 | { |
| 8602 | cp = i_cp; |
| 8603 | break; |
| 8604 | } |
| 8605 | } |
| 8606 | if (cp == NULL) |
| 8607 | { |
| 8608 | cp = g_new0 (ChangedProperty, 1); |
| 8609 | cp->prop_id = prop_id; |
| 8610 | cp->info = info; |
| 8611 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 8612 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 8613 | g_value_copy (orig_value, &cp->orig_value); |
| 8614 | } |
| 8615 | } |
| 8616 | |
| 8617 | static void |
| 8618 | sensor_i2c_skeleton_notify (GObject *object, |
| 8619 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8620 | { |
| 8621 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8622 | g_mutex_lock (&skeleton->priv->lock); |
| 8623 | if (skeleton->priv->changed_properties != NULL && |
| 8624 | skeleton->priv->changed_properties_idle_source == NULL) |
| 8625 | { |
| 8626 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 8627 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 8628 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 8629 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 8630 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 8631 | } |
| 8632 | g_mutex_unlock (&skeleton->priv->lock); |
| 8633 | } |
| 8634 | |
| 8635 | static void |
| 8636 | sensor_i2c_skeleton_set_property (GObject *object, |
| 8637 | guint prop_id, |
| 8638 | const GValue *value, |
| 8639 | GParamSpec *pspec) |
| 8640 | { |
| 8641 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8642 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8643 | g_mutex_lock (&skeleton->priv->lock); |
| 8644 | g_object_freeze_notify (object); |
| 8645 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 8646 | { |
| 8647 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 8648 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 8649 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 8650 | g_object_notify_by_pspec (object, pspec); |
| 8651 | } |
| 8652 | g_mutex_unlock (&skeleton->priv->lock); |
| 8653 | g_object_thaw_notify (object); |
| 8654 | } |
| 8655 | |
| 8656 | static void |
| 8657 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 8658 | { |
| 8659 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8660 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 8661 | #else |
| 8662 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 8663 | #endif |
| 8664 | |
| 8665 | g_mutex_init (&skeleton->priv->lock); |
| 8666 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 8667 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 8668 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 8669 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 8670 | } |
| 8671 | |
| 8672 | static const gchar * |
| 8673 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 8674 | { |
| 8675 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8676 | const gchar *value; |
| 8677 | g_mutex_lock (&skeleton->priv->lock); |
| 8678 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 8679 | g_mutex_unlock (&skeleton->priv->lock); |
| 8680 | return value; |
| 8681 | } |
| 8682 | |
| 8683 | static const gchar * |
| 8684 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 8685 | { |
| 8686 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8687 | const gchar *value; |
| 8688 | g_mutex_lock (&skeleton->priv->lock); |
| 8689 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 8690 | g_mutex_unlock (&skeleton->priv->lock); |
| 8691 | return value; |
| 8692 | } |
| 8693 | |
| 8694 | static void |
| 8695 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 8696 | { |
| 8697 | GObjectClass *gobject_class; |
| 8698 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 8699 | |
| 8700 | gobject_class = G_OBJECT_CLASS (klass); |
| 8701 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 8702 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 8703 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 8704 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 8705 | |
| 8706 | |
| 8707 | sensor_i2c_override_properties (gobject_class, 1); |
| 8708 | |
| 8709 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 8710 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 8711 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 8712 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 8713 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 8714 | |
| 8715 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8716 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 8717 | #endif |
| 8718 | } |
| 8719 | |
| 8720 | static void |
| 8721 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 8722 | { |
| 8723 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 8724 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 8725 | } |
| 8726 | |
| 8727 | /** |
| 8728 | * sensor_i2c_skeleton_new: |
| 8729 | * |
| 8730 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 8731 | * |
| 8732 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 8733 | */ |
| 8734 | SensorI2c * |
| 8735 | sensor_i2c_skeleton_new (void) |
| 8736 | { |
| 8737 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 8738 | } |
| 8739 | |
| 8740 | /* ------------------------------------------------------------------------ |
| 8741 | * Code for interface org.openbmc.SensorMatch |
| 8742 | * ------------------------------------------------------------------------ |
| 8743 | */ |
| 8744 | |
| 8745 | /** |
| 8746 | * SECTION:SensorMatch |
| 8747 | * @title: SensorMatch |
| 8748 | * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface |
| 8749 | * |
| 8750 | * 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. |
| 8751 | */ |
| 8752 | |
| 8753 | /* ---- Introspection data for org.openbmc.SensorMatch ---- */ |
| 8754 | |
| 8755 | static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = |
| 8756 | { |
| 8757 | { |
| 8758 | -1, |
| 8759 | (gchar *) "state", |
| 8760 | (gchar *) "y", |
| 8761 | NULL |
| 8762 | }, |
| 8763 | FALSE |
| 8764 | }; |
| 8765 | |
| 8766 | static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = |
| 8767 | { |
| 8768 | &_sensor_match_signal_info_sensor_match_ARG_state, |
| 8769 | NULL |
| 8770 | }; |
| 8771 | |
| 8772 | static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = |
| 8773 | { |
| 8774 | { |
| 8775 | -1, |
| 8776 | (gchar *) "SensorMatch", |
| 8777 | (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, |
| 8778 | NULL |
| 8779 | }, |
| 8780 | "sensor-match" |
| 8781 | }; |
| 8782 | |
| 8783 | static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = |
| 8784 | { |
| 8785 | &_sensor_match_signal_info_sensor_match, |
| 8786 | NULL |
| 8787 | }; |
| 8788 | |
| 8789 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = |
| 8790 | { |
| 8791 | { |
| 8792 | -1, |
| 8793 | (gchar *) "match_value", |
| 8794 | (gchar *) "v", |
| 8795 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 8796 | NULL |
| 8797 | }, |
| 8798 | "match-value", |
| 8799 | FALSE |
| 8800 | }; |
| 8801 | |
| 8802 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = |
| 8803 | { |
| 8804 | { |
| 8805 | -1, |
| 8806 | (gchar *) "state", |
| 8807 | (gchar *) "y", |
| 8808 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 8809 | NULL |
| 8810 | }, |
| 8811 | "state", |
| 8812 | FALSE |
| 8813 | }; |
| 8814 | |
| 8815 | static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = |
| 8816 | { |
| 8817 | &_sensor_match_property_info_match_value, |
| 8818 | &_sensor_match_property_info_state, |
| 8819 | NULL |
| 8820 | }; |
| 8821 | |
| 8822 | static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = |
| 8823 | { |
| 8824 | { |
| 8825 | -1, |
| 8826 | (gchar *) "org.openbmc.SensorMatch", |
| 8827 | NULL, |
| 8828 | (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, |
| 8829 | (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, |
| 8830 | NULL |
| 8831 | }, |
| 8832 | "sensor-match", |
| 8833 | }; |
| 8834 | |
| 8835 | |
| 8836 | /** |
| 8837 | * sensor_match_interface_info: |
| 8838 | * |
| 8839 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. |
| 8840 | * |
| 8841 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 8842 | */ |
| 8843 | GDBusInterfaceInfo * |
| 8844 | sensor_match_interface_info (void) |
| 8845 | { |
| 8846 | return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; |
| 8847 | } |
| 8848 | |
| 8849 | /** |
| 8850 | * sensor_match_override_properties: |
| 8851 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 8852 | * @property_id_begin: The property id to assign to the first overridden property. |
| 8853 | * |
| 8854 | * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. |
| 8855 | * The properties are overridden in the order they are defined. |
| 8856 | * |
| 8857 | * Returns: The last property id. |
| 8858 | */ |
| 8859 | guint |
| 8860 | sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) |
| 8861 | { |
| 8862 | g_object_class_override_property (klass, property_id_begin++, "match-value"); |
| 8863 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 8864 | return property_id_begin - 1; |
| 8865 | } |
| 8866 | |
| 8867 | |
| 8868 | |
| 8869 | /** |
| 8870 | * SensorMatch: |
| 8871 | * |
| 8872 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 8873 | */ |
| 8874 | |
| 8875 | /** |
| 8876 | * SensorMatchIface: |
| 8877 | * @parent_iface: The parent interface. |
| 8878 | * @get_match_value: Getter for the #SensorMatch:match-value property. |
| 8879 | * @get_state: Getter for the #SensorMatch:state property. |
| 8880 | * @sensor_match: Handler for the #SensorMatch::sensor-match signal. |
| 8881 | * |
| 8882 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 8883 | */ |
| 8884 | |
| 8885 | typedef SensorMatchIface SensorMatchInterface; |
| 8886 | G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); |
| 8887 | |
| 8888 | static void |
| 8889 | sensor_match_default_init (SensorMatchIface *iface) |
| 8890 | { |
| 8891 | /* GObject signals for received D-Bus signals: */ |
| 8892 | /** |
| 8893 | * SensorMatch::sensor-match: |
| 8894 | * @object: A #SensorMatch. |
| 8895 | * @arg_state: Argument. |
| 8896 | * |
| 8897 | * 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. |
| 8898 | * |
| 8899 | * 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. |
| 8900 | */ |
| 8901 | g_signal_new ("sensor-match", |
| 8902 | G_TYPE_FROM_INTERFACE (iface), |
| 8903 | G_SIGNAL_RUN_LAST, |
| 8904 | G_STRUCT_OFFSET (SensorMatchIface, sensor_match), |
| 8905 | NULL, |
| 8906 | NULL, |
| 8907 | g_cclosure_marshal_generic, |
| 8908 | G_TYPE_NONE, |
| 8909 | 1, G_TYPE_UCHAR); |
| 8910 | |
| 8911 | /* GObject properties for D-Bus properties: */ |
| 8912 | /** |
| 8913 | * SensorMatch:match-value: |
| 8914 | * |
| 8915 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. |
| 8916 | * |
| 8917 | * 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. |
| 8918 | */ |
| 8919 | g_object_interface_install_property (iface, |
| 8920 | g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8921 | /** |
| 8922 | * SensorMatch:state: |
| 8923 | * |
| 8924 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. |
| 8925 | * |
| 8926 | * 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. |
| 8927 | */ |
| 8928 | g_object_interface_install_property (iface, |
| 8929 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8930 | } |
| 8931 | |
| 8932 | /** |
| 8933 | * sensor_match_get_match_value: (skip) |
| 8934 | * @object: A #SensorMatch. |
| 8935 | * |
| 8936 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 8937 | * |
| 8938 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8939 | * |
| 8940 | * <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> |
| 8941 | * |
| 8942 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 8943 | */ |
| 8944 | GVariant * |
| 8945 | sensor_match_get_match_value (SensorMatch *object) |
| 8946 | { |
| 8947 | return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); |
| 8948 | } |
| 8949 | |
| 8950 | /** |
| 8951 | * sensor_match_dup_match_value: (skip) |
| 8952 | * @object: A #SensorMatch. |
| 8953 | * |
| 8954 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 8955 | * |
| 8956 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8957 | * |
| 8958 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 8959 | */ |
| 8960 | GVariant * |
| 8961 | sensor_match_dup_match_value (SensorMatch *object) |
| 8962 | { |
| 8963 | GVariant *value; |
| 8964 | g_object_get (G_OBJECT (object), "match-value", &value, NULL); |
| 8965 | return value; |
| 8966 | } |
| 8967 | |
| 8968 | /** |
| 8969 | * sensor_match_set_match_value: (skip) |
| 8970 | * @object: A #SensorMatch. |
| 8971 | * @value: The value to set. |
| 8972 | * |
| 8973 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. |
| 8974 | * |
| 8975 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 8976 | */ |
| 8977 | void |
| 8978 | sensor_match_set_match_value (SensorMatch *object, GVariant *value) |
| 8979 | { |
| 8980 | g_object_set (G_OBJECT (object), "match-value", value, NULL); |
| 8981 | } |
| 8982 | |
| 8983 | /** |
| 8984 | * sensor_match_get_state: (skip) |
| 8985 | * @object: A #SensorMatch. |
| 8986 | * |
| 8987 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. |
| 8988 | * |
| 8989 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8990 | * |
| 8991 | * Returns: The property value. |
| 8992 | */ |
| 8993 | guchar |
| 8994 | sensor_match_get_state (SensorMatch *object) |
| 8995 | { |
| 8996 | return SENSOR_MATCH_GET_IFACE (object)->get_state (object); |
| 8997 | } |
| 8998 | |
| 8999 | /** |
| 9000 | * sensor_match_set_state: (skip) |
| 9001 | * @object: A #SensorMatch. |
| 9002 | * @value: The value to set. |
| 9003 | * |
| 9004 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. |
| 9005 | * |
| 9006 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 9007 | */ |
| 9008 | void |
| 9009 | sensor_match_set_state (SensorMatch *object, guchar value) |
| 9010 | { |
| 9011 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 9012 | } |
| 9013 | |
| 9014 | /** |
| 9015 | * sensor_match_emit_sensor_match: |
| 9016 | * @object: A #SensorMatch. |
| 9017 | * @arg_state: Argument to pass with the signal. |
| 9018 | * |
| 9019 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. |
| 9020 | */ |
| 9021 | void |
| 9022 | sensor_match_emit_sensor_match ( |
| 9023 | SensorMatch *object, |
| 9024 | guchar arg_state) |
| 9025 | { |
| 9026 | g_signal_emit_by_name (object, "sensor-match", arg_state); |
| 9027 | } |
| 9028 | |
| 9029 | /* ------------------------------------------------------------------------ */ |
| 9030 | |
| 9031 | /** |
| 9032 | * SensorMatchProxy: |
| 9033 | * |
| 9034 | * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. |
| 9035 | */ |
| 9036 | |
| 9037 | /** |
| 9038 | * SensorMatchProxyClass: |
| 9039 | * @parent_class: The parent class. |
| 9040 | * |
| 9041 | * Class structure for #SensorMatchProxy. |
| 9042 | */ |
| 9043 | |
| 9044 | struct _SensorMatchProxyPrivate |
| 9045 | { |
| 9046 | GData *qdata; |
| 9047 | }; |
| 9048 | |
| 9049 | static void sensor_match_proxy_iface_init (SensorMatchIface *iface); |
| 9050 | |
| 9051 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9052 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 9053 | G_ADD_PRIVATE (SensorMatchProxy) |
| 9054 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 9055 | |
| 9056 | #else |
| 9057 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 9058 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 9059 | |
| 9060 | #endif |
| 9061 | static void |
| 9062 | sensor_match_proxy_finalize (GObject *object) |
| 9063 | { |
| 9064 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9065 | g_datalist_clear (&proxy->priv->qdata); |
| 9066 | G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); |
| 9067 | } |
| 9068 | |
| 9069 | static void |
| 9070 | sensor_match_proxy_get_property (GObject *object, |
| 9071 | guint prop_id, |
| 9072 | GValue *value, |
| 9073 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9074 | { |
| 9075 | const _ExtendedGDBusPropertyInfo *info; |
| 9076 | GVariant *variant; |
| 9077 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9078 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 9079 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 9080 | if (info->use_gvariant) |
| 9081 | { |
| 9082 | g_value_set_variant (value, variant); |
| 9083 | } |
| 9084 | else |
| 9085 | { |
| 9086 | if (variant != NULL) |
| 9087 | g_dbus_gvariant_to_gvalue (variant, value); |
| 9088 | } |
| 9089 | if (variant != NULL) |
| 9090 | g_variant_unref (variant); |
| 9091 | } |
| 9092 | |
| 9093 | static void |
| 9094 | sensor_match_proxy_set_property_cb (GDBusProxy *proxy, |
| 9095 | GAsyncResult *res, |
| 9096 | gpointer user_data) |
| 9097 | { |
| 9098 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 9099 | GError *error; |
| 9100 | GVariant *_ret; |
| 9101 | error = NULL; |
| 9102 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 9103 | if (!_ret) |
| 9104 | { |
| 9105 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", |
| 9106 | info->parent_struct.name, |
| 9107 | error->message, g_quark_to_string (error->domain), error->code); |
| 9108 | g_error_free (error); |
| 9109 | } |
| 9110 | else |
| 9111 | { |
| 9112 | g_variant_unref (_ret); |
| 9113 | } |
| 9114 | } |
| 9115 | |
| 9116 | static void |
| 9117 | sensor_match_proxy_set_property (GObject *object, |
| 9118 | guint prop_id, |
| 9119 | const GValue *value, |
| 9120 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9121 | { |
| 9122 | const _ExtendedGDBusPropertyInfo *info; |
| 9123 | GVariant *variant; |
| 9124 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9125 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 9126 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 9127 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 9128 | "org.freedesktop.DBus.Properties.Set", |
| 9129 | g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), |
| 9130 | G_DBUS_CALL_FLAGS_NONE, |
| 9131 | -1, |
| 9132 | NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 9133 | g_variant_unref (variant); |
| 9134 | } |
| 9135 | |
| 9136 | static void |
| 9137 | sensor_match_proxy_g_signal (GDBusProxy *proxy, |
| 9138 | const gchar *sender_name G_GNUC_UNUSED, |
| 9139 | const gchar *signal_name, |
| 9140 | GVariant *parameters) |
| 9141 | { |
| 9142 | _ExtendedGDBusSignalInfo *info; |
| 9143 | GVariantIter iter; |
| 9144 | GVariant *child; |
| 9145 | GValue *paramv; |
| 9146 | guint num_params; |
| 9147 | guint n; |
| 9148 | guint signal_id; |
| 9149 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); |
| 9150 | if (info == NULL) |
| 9151 | return; |
| 9152 | num_params = g_variant_n_children (parameters); |
| 9153 | paramv = g_new0 (GValue, num_params + 1); |
| 9154 | g_value_init (¶mv[0], TYPE_SENSOR_MATCH); |
| 9155 | g_value_set_object (¶mv[0], proxy); |
| 9156 | g_variant_iter_init (&iter, parameters); |
| 9157 | n = 1; |
| 9158 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9159 | { |
| 9160 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 9161 | if (arg_info->use_gvariant) |
| 9162 | { |
| 9163 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9164 | g_value_set_variant (¶mv[n], child); |
| 9165 | n++; |
| 9166 | } |
| 9167 | else |
| 9168 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9169 | g_variant_unref (child); |
| 9170 | } |
| 9171 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 9172 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 9173 | for (n = 0; n < num_params + 1; n++) |
| 9174 | g_value_unset (¶mv[n]); |
| 9175 | g_free (paramv); |
| 9176 | } |
| 9177 | |
| 9178 | static void |
| 9179 | sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 9180 | GVariant *changed_properties, |
| 9181 | const gchar *const *invalidated_properties) |
| 9182 | { |
| 9183 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); |
| 9184 | guint n; |
| 9185 | const gchar *key; |
| 9186 | GVariantIter *iter; |
| 9187 | _ExtendedGDBusPropertyInfo *info; |
| 9188 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 9189 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 9190 | { |
| 9191 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); |
| 9192 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 9193 | if (info != NULL) |
| 9194 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9195 | } |
| 9196 | g_variant_iter_free (iter); |
| 9197 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 9198 | { |
| 9199 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); |
| 9200 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 9201 | if (info != NULL) |
| 9202 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9203 | } |
| 9204 | } |
| 9205 | |
| 9206 | static GVariant * |
| 9207 | sensor_match_proxy_get_match_value (SensorMatch *object) |
| 9208 | { |
| 9209 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9210 | GVariant *variant; |
| 9211 | GVariant *value = NULL; |
| 9212 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); |
| 9213 | value = variant; |
| 9214 | if (variant != NULL) |
| 9215 | g_variant_unref (variant); |
| 9216 | return value; |
| 9217 | } |
| 9218 | |
| 9219 | static guchar |
| 9220 | sensor_match_proxy_get_state (SensorMatch *object) |
| 9221 | { |
| 9222 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9223 | GVariant *variant; |
| 9224 | guchar value = 0; |
| 9225 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 9226 | if (variant != NULL) |
| 9227 | { |
| 9228 | value = g_variant_get_byte (variant); |
| 9229 | g_variant_unref (variant); |
| 9230 | } |
| 9231 | return value; |
| 9232 | } |
| 9233 | |
| 9234 | static void |
| 9235 | sensor_match_proxy_init (SensorMatchProxy *proxy) |
| 9236 | { |
| 9237 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9238 | proxy->priv = sensor_match_proxy_get_instance_private (proxy); |
| 9239 | #else |
| 9240 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); |
| 9241 | #endif |
| 9242 | |
| 9243 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); |
| 9244 | } |
| 9245 | |
| 9246 | static void |
| 9247 | sensor_match_proxy_class_init (SensorMatchProxyClass *klass) |
| 9248 | { |
| 9249 | GObjectClass *gobject_class; |
| 9250 | GDBusProxyClass *proxy_class; |
| 9251 | |
| 9252 | gobject_class = G_OBJECT_CLASS (klass); |
| 9253 | gobject_class->finalize = sensor_match_proxy_finalize; |
| 9254 | gobject_class->get_property = sensor_match_proxy_get_property; |
| 9255 | gobject_class->set_property = sensor_match_proxy_set_property; |
| 9256 | |
| 9257 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 9258 | proxy_class->g_signal = sensor_match_proxy_g_signal; |
| 9259 | proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; |
| 9260 | |
| 9261 | sensor_match_override_properties (gobject_class, 1); |
| 9262 | |
| 9263 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9264 | g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); |
| 9265 | #endif |
| 9266 | } |
| 9267 | |
| 9268 | static void |
| 9269 | sensor_match_proxy_iface_init (SensorMatchIface *iface) |
| 9270 | { |
| 9271 | iface->get_match_value = sensor_match_proxy_get_match_value; |
| 9272 | iface->get_state = sensor_match_proxy_get_state; |
| 9273 | } |
| 9274 | |
| 9275 | /** |
| 9276 | * sensor_match_proxy_new: |
| 9277 | * @connection: A #GDBusConnection. |
| 9278 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9279 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9280 | * @object_path: An object path. |
| 9281 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9282 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9283 | * @user_data: User data to pass to @callback. |
| 9284 | * |
| 9285 | * 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. |
| 9286 | * |
| 9287 | * 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. |
| 9288 | * You can then call sensor_match_proxy_new_finish() to get the result of the operation. |
| 9289 | * |
| 9290 | * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 9291 | */ |
| 9292 | void |
| 9293 | sensor_match_proxy_new ( |
| 9294 | GDBusConnection *connection, |
| 9295 | GDBusProxyFlags flags, |
| 9296 | const gchar *name, |
| 9297 | const gchar *object_path, |
| 9298 | GCancellable *cancellable, |
| 9299 | GAsyncReadyCallback callback, |
| 9300 | gpointer user_data) |
| 9301 | { |
| 9302 | 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); |
| 9303 | } |
| 9304 | |
| 9305 | /** |
| 9306 | * sensor_match_proxy_new_finish: |
| 9307 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). |
| 9308 | * @error: Return location for error or %NULL |
| 9309 | * |
| 9310 | * Finishes an operation started with sensor_match_proxy_new(). |
| 9311 | * |
| 9312 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9313 | */ |
| 9314 | SensorMatch * |
| 9315 | sensor_match_proxy_new_finish ( |
| 9316 | GAsyncResult *res, |
| 9317 | GError **error) |
| 9318 | { |
| 9319 | GObject *ret; |
| 9320 | GObject *source_object; |
| 9321 | source_object = g_async_result_get_source_object (res); |
| 9322 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9323 | g_object_unref (source_object); |
| 9324 | if (ret != NULL) |
| 9325 | return SENSOR_MATCH (ret); |
| 9326 | else |
| 9327 | return NULL; |
| 9328 | } |
| 9329 | |
| 9330 | /** |
| 9331 | * sensor_match_proxy_new_sync: |
| 9332 | * @connection: A #GDBusConnection. |
| 9333 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9334 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9335 | * @object_path: An object path. |
| 9336 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9337 | * @error: Return location for error or %NULL |
| 9338 | * |
| 9339 | * 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. |
| 9340 | * |
| 9341 | * The calling thread is blocked until a reply is received. |
| 9342 | * |
| 9343 | * See sensor_match_proxy_new() for the asynchronous version of this constructor. |
| 9344 | * |
| 9345 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9346 | */ |
| 9347 | SensorMatch * |
| 9348 | sensor_match_proxy_new_sync ( |
| 9349 | GDBusConnection *connection, |
| 9350 | GDBusProxyFlags flags, |
| 9351 | const gchar *name, |
| 9352 | const gchar *object_path, |
| 9353 | GCancellable *cancellable, |
| 9354 | GError **error) |
| 9355 | { |
| 9356 | GInitable *ret; |
| 9357 | 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); |
| 9358 | if (ret != NULL) |
| 9359 | return SENSOR_MATCH (ret); |
| 9360 | else |
| 9361 | return NULL; |
| 9362 | } |
| 9363 | |
| 9364 | |
| 9365 | /** |
| 9366 | * sensor_match_proxy_new_for_bus: |
| 9367 | * @bus_type: A #GBusType. |
| 9368 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9369 | * @name: A bus name (well-known or unique). |
| 9370 | * @object_path: An object path. |
| 9371 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9372 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9373 | * @user_data: User data to pass to @callback. |
| 9374 | * |
| 9375 | * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 9376 | * |
| 9377 | * 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. |
| 9378 | * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. |
| 9379 | * |
| 9380 | * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 9381 | */ |
| 9382 | void |
| 9383 | sensor_match_proxy_new_for_bus ( |
| 9384 | GBusType bus_type, |
| 9385 | GDBusProxyFlags flags, |
| 9386 | const gchar *name, |
| 9387 | const gchar *object_path, |
| 9388 | GCancellable *cancellable, |
| 9389 | GAsyncReadyCallback callback, |
| 9390 | gpointer user_data) |
| 9391 | { |
| 9392 | 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); |
| 9393 | } |
| 9394 | |
| 9395 | /** |
| 9396 | * sensor_match_proxy_new_for_bus_finish: |
| 9397 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). |
| 9398 | * @error: Return location for error or %NULL |
| 9399 | * |
| 9400 | * Finishes an operation started with sensor_match_proxy_new_for_bus(). |
| 9401 | * |
| 9402 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9403 | */ |
| 9404 | SensorMatch * |
| 9405 | sensor_match_proxy_new_for_bus_finish ( |
| 9406 | GAsyncResult *res, |
| 9407 | GError **error) |
| 9408 | { |
| 9409 | GObject *ret; |
| 9410 | GObject *source_object; |
| 9411 | source_object = g_async_result_get_source_object (res); |
| 9412 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9413 | g_object_unref (source_object); |
| 9414 | if (ret != NULL) |
| 9415 | return SENSOR_MATCH (ret); |
| 9416 | else |
| 9417 | return NULL; |
| 9418 | } |
| 9419 | |
| 9420 | /** |
| 9421 | * sensor_match_proxy_new_for_bus_sync: |
| 9422 | * @bus_type: A #GBusType. |
| 9423 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9424 | * @name: A bus name (well-known or unique). |
| 9425 | * @object_path: An object path. |
| 9426 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9427 | * @error: Return location for error or %NULL |
| 9428 | * |
| 9429 | * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 9430 | * |
| 9431 | * The calling thread is blocked until a reply is received. |
| 9432 | * |
| 9433 | * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 9434 | * |
| 9435 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9436 | */ |
| 9437 | SensorMatch * |
| 9438 | sensor_match_proxy_new_for_bus_sync ( |
| 9439 | GBusType bus_type, |
| 9440 | GDBusProxyFlags flags, |
| 9441 | const gchar *name, |
| 9442 | const gchar *object_path, |
| 9443 | GCancellable *cancellable, |
| 9444 | GError **error) |
| 9445 | { |
| 9446 | GInitable *ret; |
| 9447 | 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); |
| 9448 | if (ret != NULL) |
| 9449 | return SENSOR_MATCH (ret); |
| 9450 | else |
| 9451 | return NULL; |
| 9452 | } |
| 9453 | |
| 9454 | |
| 9455 | /* ------------------------------------------------------------------------ */ |
| 9456 | |
| 9457 | /** |
| 9458 | * SensorMatchSkeleton: |
| 9459 | * |
| 9460 | * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. |
| 9461 | */ |
| 9462 | |
| 9463 | /** |
| 9464 | * SensorMatchSkeletonClass: |
| 9465 | * @parent_class: The parent class. |
| 9466 | * |
| 9467 | * Class structure for #SensorMatchSkeleton. |
| 9468 | */ |
| 9469 | |
| 9470 | struct _SensorMatchSkeletonPrivate |
| 9471 | { |
| 9472 | GValue *properties; |
| 9473 | GList *changed_properties; |
| 9474 | GSource *changed_properties_idle_source; |
| 9475 | GMainContext *context; |
| 9476 | GMutex lock; |
| 9477 | }; |
| 9478 | |
| 9479 | static void |
| 9480 | _sensor_match_skeleton_handle_method_call ( |
| 9481 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9482 | const gchar *sender G_GNUC_UNUSED, |
| 9483 | const gchar *object_path G_GNUC_UNUSED, |
| 9484 | const gchar *interface_name, |
| 9485 | const gchar *method_name, |
| 9486 | GVariant *parameters, |
| 9487 | GDBusMethodInvocation *invocation, |
| 9488 | gpointer user_data) |
| 9489 | { |
| 9490 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9491 | _ExtendedGDBusMethodInfo *info; |
| 9492 | GVariantIter iter; |
| 9493 | GVariant *child; |
| 9494 | GValue *paramv; |
| 9495 | guint num_params; |
| 9496 | guint num_extra; |
| 9497 | guint n; |
| 9498 | guint signal_id; |
| 9499 | GValue return_value = G_VALUE_INIT; |
| 9500 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 9501 | g_assert (info != NULL); |
| 9502 | num_params = g_variant_n_children (parameters); |
| 9503 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 9504 | n = 0; |
| 9505 | g_value_init (¶mv[n], TYPE_SENSOR_MATCH); |
| 9506 | g_value_set_object (¶mv[n++], skeleton); |
| 9507 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 9508 | g_value_set_object (¶mv[n++], invocation); |
| 9509 | if (info->pass_fdlist) |
| 9510 | { |
| 9511 | #ifdef G_OS_UNIX |
| 9512 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 9513 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 9514 | #else |
| 9515 | g_assert_not_reached (); |
| 9516 | #endif |
| 9517 | } |
| 9518 | g_variant_iter_init (&iter, parameters); |
| 9519 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9520 | { |
| 9521 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 9522 | if (arg_info->use_gvariant) |
| 9523 | { |
| 9524 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9525 | g_value_set_variant (¶mv[n], child); |
| 9526 | n++; |
| 9527 | } |
| 9528 | else |
| 9529 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9530 | g_variant_unref (child); |
| 9531 | } |
| 9532 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 9533 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 9534 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 9535 | if (!g_value_get_boolean (&return_value)) |
| 9536 | 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); |
| 9537 | g_value_unset (&return_value); |
| 9538 | for (n = 0; n < num_params + num_extra; n++) |
| 9539 | g_value_unset (¶mv[n]); |
| 9540 | g_free (paramv); |
| 9541 | } |
| 9542 | |
| 9543 | static GVariant * |
| 9544 | _sensor_match_skeleton_handle_get_property ( |
| 9545 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9546 | const gchar *sender G_GNUC_UNUSED, |
| 9547 | const gchar *object_path G_GNUC_UNUSED, |
| 9548 | const gchar *interface_name G_GNUC_UNUSED, |
| 9549 | const gchar *property_name, |
| 9550 | GError **error, |
| 9551 | gpointer user_data) |
| 9552 | { |
| 9553 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9554 | GValue value = G_VALUE_INIT; |
| 9555 | GParamSpec *pspec; |
| 9556 | _ExtendedGDBusPropertyInfo *info; |
| 9557 | GVariant *ret; |
| 9558 | ret = NULL; |
| 9559 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 9560 | g_assert (info != NULL); |
| 9561 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9562 | if (pspec == NULL) |
| 9563 | { |
| 9564 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9565 | } |
| 9566 | else |
| 9567 | { |
| 9568 | g_value_init (&value, pspec->value_type); |
| 9569 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9570 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 9571 | g_value_unset (&value); |
| 9572 | } |
| 9573 | return ret; |
| 9574 | } |
| 9575 | |
| 9576 | static gboolean |
| 9577 | _sensor_match_skeleton_handle_set_property ( |
| 9578 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9579 | const gchar *sender G_GNUC_UNUSED, |
| 9580 | const gchar *object_path G_GNUC_UNUSED, |
| 9581 | const gchar *interface_name G_GNUC_UNUSED, |
| 9582 | const gchar *property_name, |
| 9583 | GVariant *variant, |
| 9584 | GError **error, |
| 9585 | gpointer user_data) |
| 9586 | { |
| 9587 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9588 | GValue value = G_VALUE_INIT; |
| 9589 | GParamSpec *pspec; |
| 9590 | _ExtendedGDBusPropertyInfo *info; |
| 9591 | gboolean ret; |
| 9592 | ret = FALSE; |
| 9593 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 9594 | g_assert (info != NULL); |
| 9595 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9596 | if (pspec == NULL) |
| 9597 | { |
| 9598 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9599 | } |
| 9600 | else |
| 9601 | { |
| 9602 | if (info->use_gvariant) |
| 9603 | g_value_set_variant (&value, variant); |
| 9604 | else |
| 9605 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 9606 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9607 | g_value_unset (&value); |
| 9608 | ret = TRUE; |
| 9609 | } |
| 9610 | return ret; |
| 9611 | } |
| 9612 | |
| 9613 | static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = |
| 9614 | { |
| 9615 | _sensor_match_skeleton_handle_method_call, |
| 9616 | _sensor_match_skeleton_handle_get_property, |
| 9617 | _sensor_match_skeleton_handle_set_property, |
| 9618 | {NULL} |
| 9619 | }; |
| 9620 | |
| 9621 | static GDBusInterfaceInfo * |
| 9622 | sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9623 | { |
| 9624 | return sensor_match_interface_info (); |
| 9625 | } |
| 9626 | |
| 9627 | static GDBusInterfaceVTable * |
| 9628 | sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9629 | { |
| 9630 | return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; |
| 9631 | } |
| 9632 | |
| 9633 | static GVariant * |
| 9634 | sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 9635 | { |
| 9636 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 9637 | |
| 9638 | GVariantBuilder builder; |
| 9639 | guint n; |
| 9640 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 9641 | if (_sensor_match_interface_info.parent_struct.properties == NULL) |
| 9642 | goto out; |
| 9643 | for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) |
| 9644 | { |
| 9645 | GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; |
| 9646 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 9647 | { |
| 9648 | GVariant *value; |
| 9649 | 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); |
| 9650 | if (value != NULL) |
| 9651 | { |
| 9652 | g_variant_take_ref (value); |
| 9653 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 9654 | g_variant_unref (value); |
| 9655 | } |
| 9656 | } |
| 9657 | } |
| 9658 | out: |
| 9659 | return g_variant_builder_end (&builder); |
| 9660 | } |
| 9661 | |
| 9662 | static gboolean _sensor_match_emit_changed (gpointer user_data); |
| 9663 | |
| 9664 | static void |
| 9665 | sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 9666 | { |
| 9667 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 9668 | gboolean emit_changed = FALSE; |
| 9669 | |
| 9670 | g_mutex_lock (&skeleton->priv->lock); |
| 9671 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 9672 | { |
| 9673 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 9674 | skeleton->priv->changed_properties_idle_source = NULL; |
| 9675 | emit_changed = TRUE; |
| 9676 | } |
| 9677 | g_mutex_unlock (&skeleton->priv->lock); |
| 9678 | |
| 9679 | if (emit_changed) |
| 9680 | _sensor_match_emit_changed (skeleton); |
| 9681 | } |
| 9682 | |
| 9683 | static void |
| 9684 | _sensor_match_on_signal_sensor_match ( |
| 9685 | SensorMatch *object, |
| 9686 | guchar arg_state) |
| 9687 | { |
| 9688 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9689 | |
| 9690 | GList *connections, *l; |
| 9691 | GVariant *signal_variant; |
| 9692 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 9693 | |
| 9694 | signal_variant = g_variant_ref_sink (g_variant_new ("(y)", |
| 9695 | arg_state)); |
| 9696 | for (l = connections; l != NULL; l = l->next) |
| 9697 | { |
| 9698 | GDBusConnection *connection = l->data; |
| 9699 | g_dbus_connection_emit_signal (connection, |
| 9700 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", |
| 9701 | signal_variant, NULL); |
| 9702 | } |
| 9703 | g_variant_unref (signal_variant); |
| 9704 | g_list_free_full (connections, g_object_unref); |
| 9705 | } |
| 9706 | |
| 9707 | static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); |
| 9708 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9709 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9710 | G_ADD_PRIVATE (SensorMatchSkeleton) |
| 9711 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 9712 | |
| 9713 | #else |
| 9714 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9715 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 9716 | |
| 9717 | #endif |
| 9718 | static void |
| 9719 | sensor_match_skeleton_finalize (GObject *object) |
| 9720 | { |
| 9721 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9722 | guint n; |
| 9723 | for (n = 0; n < 2; n++) |
| 9724 | g_value_unset (&skeleton->priv->properties[n]); |
| 9725 | g_free (skeleton->priv->properties); |
| 9726 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9727 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 9728 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 9729 | g_main_context_unref (skeleton->priv->context); |
| 9730 | g_mutex_clear (&skeleton->priv->lock); |
| 9731 | G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); |
| 9732 | } |
| 9733 | |
| 9734 | static void |
| 9735 | sensor_match_skeleton_get_property (GObject *object, |
| 9736 | guint prop_id, |
| 9737 | GValue *value, |
| 9738 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9739 | { |
| 9740 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9741 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9742 | g_mutex_lock (&skeleton->priv->lock); |
| 9743 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 9744 | g_mutex_unlock (&skeleton->priv->lock); |
| 9745 | } |
| 9746 | |
| 9747 | static gboolean |
| 9748 | _sensor_match_emit_changed (gpointer user_data) |
| 9749 | { |
| 9750 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9751 | GList *l; |
| 9752 | GVariantBuilder builder; |
| 9753 | GVariantBuilder invalidated_builder; |
| 9754 | guint num_changes; |
| 9755 | |
| 9756 | g_mutex_lock (&skeleton->priv->lock); |
| 9757 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 9758 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 9759 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 9760 | { |
| 9761 | ChangedProperty *cp = l->data; |
| 9762 | GVariant *variant; |
| 9763 | const GValue *cur_value; |
| 9764 | |
| 9765 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 9766 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 9767 | { |
| 9768 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 9769 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 9770 | g_variant_unref (variant); |
| 9771 | num_changes++; |
| 9772 | } |
| 9773 | } |
| 9774 | if (num_changes > 0) |
| 9775 | { |
| 9776 | GList *connections, *ll; |
| 9777 | GVariant *signal_variant; |
| 9778 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", |
| 9779 | &builder, &invalidated_builder)); |
| 9780 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 9781 | for (ll = connections; ll != NULL; ll = ll->next) |
| 9782 | { |
| 9783 | GDBusConnection *connection = ll->data; |
| 9784 | |
| 9785 | g_dbus_connection_emit_signal (connection, |
| 9786 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 9787 | "org.freedesktop.DBus.Properties", |
| 9788 | "PropertiesChanged", |
| 9789 | signal_variant, |
| 9790 | NULL); |
| 9791 | } |
| 9792 | g_variant_unref (signal_variant); |
| 9793 | g_list_free_full (connections, g_object_unref); |
| 9794 | } |
| 9795 | else |
| 9796 | { |
| 9797 | g_variant_builder_clear (&builder); |
| 9798 | g_variant_builder_clear (&invalidated_builder); |
| 9799 | } |
| 9800 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9801 | skeleton->priv->changed_properties = NULL; |
| 9802 | skeleton->priv->changed_properties_idle_source = NULL; |
| 9803 | g_mutex_unlock (&skeleton->priv->lock); |
| 9804 | return FALSE; |
| 9805 | } |
| 9806 | |
| 9807 | static void |
| 9808 | _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 9809 | { |
| 9810 | ChangedProperty *cp; |
| 9811 | GList *l; |
| 9812 | cp = NULL; |
| 9813 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 9814 | { |
| 9815 | ChangedProperty *i_cp = l->data; |
| 9816 | if (i_cp->info == info) |
| 9817 | { |
| 9818 | cp = i_cp; |
| 9819 | break; |
| 9820 | } |
| 9821 | } |
| 9822 | if (cp == NULL) |
| 9823 | { |
| 9824 | cp = g_new0 (ChangedProperty, 1); |
| 9825 | cp->prop_id = prop_id; |
| 9826 | cp->info = info; |
| 9827 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 9828 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 9829 | g_value_copy (orig_value, &cp->orig_value); |
| 9830 | } |
| 9831 | } |
| 9832 | |
| 9833 | static void |
| 9834 | sensor_match_skeleton_notify (GObject *object, |
| 9835 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9836 | { |
| 9837 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9838 | g_mutex_lock (&skeleton->priv->lock); |
| 9839 | if (skeleton->priv->changed_properties != NULL && |
| 9840 | skeleton->priv->changed_properties_idle_source == NULL) |
| 9841 | { |
| 9842 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 9843 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 9844 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 9845 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 9846 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 9847 | } |
| 9848 | g_mutex_unlock (&skeleton->priv->lock); |
| 9849 | } |
| 9850 | |
| 9851 | static void |
| 9852 | sensor_match_skeleton_set_property (GObject *object, |
| 9853 | guint prop_id, |
| 9854 | const GValue *value, |
| 9855 | GParamSpec *pspec) |
| 9856 | { |
| 9857 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9858 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9859 | g_mutex_lock (&skeleton->priv->lock); |
| 9860 | g_object_freeze_notify (object); |
| 9861 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 9862 | { |
| 9863 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 9864 | _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 9865 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 9866 | g_object_notify_by_pspec (object, pspec); |
| 9867 | } |
| 9868 | g_mutex_unlock (&skeleton->priv->lock); |
| 9869 | g_object_thaw_notify (object); |
| 9870 | } |
| 9871 | |
| 9872 | static void |
| 9873 | sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) |
| 9874 | { |
| 9875 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9876 | skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); |
| 9877 | #else |
| 9878 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); |
| 9879 | #endif |
| 9880 | |
| 9881 | g_mutex_init (&skeleton->priv->lock); |
| 9882 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 9883 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 9884 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 9885 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); |
| 9886 | } |
| 9887 | |
| 9888 | static GVariant * |
| 9889 | sensor_match_skeleton_get_match_value (SensorMatch *object) |
| 9890 | { |
| 9891 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9892 | GVariant *value; |
| 9893 | g_mutex_lock (&skeleton->priv->lock); |
| 9894 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 9895 | g_mutex_unlock (&skeleton->priv->lock); |
| 9896 | return value; |
| 9897 | } |
| 9898 | |
| 9899 | static guchar |
| 9900 | sensor_match_skeleton_get_state (SensorMatch *object) |
| 9901 | { |
| 9902 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9903 | guchar value; |
| 9904 | g_mutex_lock (&skeleton->priv->lock); |
| 9905 | value = g_value_get_uchar (&(skeleton->priv->properties[1])); |
| 9906 | g_mutex_unlock (&skeleton->priv->lock); |
| 9907 | return value; |
| 9908 | } |
| 9909 | |
| 9910 | static void |
| 9911 | sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) |
| 9912 | { |
| 9913 | GObjectClass *gobject_class; |
| 9914 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 9915 | |
| 9916 | gobject_class = G_OBJECT_CLASS (klass); |
| 9917 | gobject_class->finalize = sensor_match_skeleton_finalize; |
| 9918 | gobject_class->get_property = sensor_match_skeleton_get_property; |
| 9919 | gobject_class->set_property = sensor_match_skeleton_set_property; |
| 9920 | gobject_class->notify = sensor_match_skeleton_notify; |
| 9921 | |
| 9922 | |
| 9923 | sensor_match_override_properties (gobject_class, 1); |
| 9924 | |
| 9925 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 9926 | skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; |
| 9927 | skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; |
| 9928 | skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; |
| 9929 | skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; |
| 9930 | |
| 9931 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9932 | g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); |
| 9933 | #endif |
| 9934 | } |
| 9935 | |
| 9936 | static void |
| 9937 | sensor_match_skeleton_iface_init (SensorMatchIface *iface) |
| 9938 | { |
| 9939 | iface->sensor_match = _sensor_match_on_signal_sensor_match; |
| 9940 | iface->get_match_value = sensor_match_skeleton_get_match_value; |
| 9941 | iface->get_state = sensor_match_skeleton_get_state; |
| 9942 | } |
| 9943 | |
| 9944 | /** |
| 9945 | * sensor_match_skeleton_new: |
| 9946 | * |
| 9947 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 9948 | * |
| 9949 | * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. |
| 9950 | */ |
| 9951 | SensorMatch * |
| 9952 | sensor_match_skeleton_new (void) |
| 9953 | { |
| 9954 | return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); |
| 9955 | } |
| 9956 | |
| 9957 | /* ------------------------------------------------------------------------ |
| 9958 | * Code for interface org.openbmc.Process |
| 9959 | * ------------------------------------------------------------------------ |
| 9960 | */ |
| 9961 | |
| 9962 | /** |
| 9963 | * SECTION:Process |
| 9964 | * @title: Process |
| 9965 | * @short_description: Generated C code for the org.openbmc.Process D-Bus interface |
| 9966 | * |
| 9967 | * 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. |
| 9968 | */ |
| 9969 | |
| 9970 | /* ---- Introspection data for org.openbmc.Process ---- */ |
| 9971 | |
| 9972 | static const _ExtendedGDBusMethodInfo _process_method_info_stop = |
| 9973 | { |
| 9974 | { |
| 9975 | -1, |
| 9976 | (gchar *) "stop", |
| 9977 | NULL, |
| 9978 | NULL, |
| 9979 | NULL |
| 9980 | }, |
| 9981 | "handle-stop", |
| 9982 | FALSE |
| 9983 | }; |
| 9984 | |
| 9985 | static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] = |
| 9986 | { |
| 9987 | &_process_method_info_stop, |
| 9988 | NULL |
| 9989 | }; |
| 9990 | |
| 9991 | static const _ExtendedGDBusInterfaceInfo _process_interface_info = |
| 9992 | { |
| 9993 | { |
| 9994 | -1, |
| 9995 | (gchar *) "org.openbmc.Process", |
| 9996 | (GDBusMethodInfo **) &_process_method_info_pointers, |
| 9997 | NULL, |
| 9998 | NULL, |
| 9999 | NULL |
| 10000 | }, |
| 10001 | "process", |
| 10002 | }; |
| 10003 | |
| 10004 | |
| 10005 | /** |
| 10006 | * process_interface_info: |
| 10007 | * |
| 10008 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface. |
| 10009 | * |
| 10010 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 10011 | */ |
| 10012 | GDBusInterfaceInfo * |
| 10013 | process_interface_info (void) |
| 10014 | { |
| 10015 | return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct; |
| 10016 | } |
| 10017 | |
| 10018 | /** |
| 10019 | * process_override_properties: |
| 10020 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 10021 | * @property_id_begin: The property id to assign to the first overridden property. |
| 10022 | * |
| 10023 | * Overrides all #GObject properties in the #Process interface for a concrete class. |
| 10024 | * The properties are overridden in the order they are defined. |
| 10025 | * |
| 10026 | * Returns: The last property id. |
| 10027 | */ |
| 10028 | guint |
| 10029 | process_override_properties (GObjectClass *klass, guint property_id_begin) |
| 10030 | { |
| 10031 | return property_id_begin - 1; |
| 10032 | } |
| 10033 | |
| 10034 | |
| 10035 | |
| 10036 | /** |
| 10037 | * Process: |
| 10038 | * |
| 10039 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10040 | */ |
| 10041 | |
| 10042 | /** |
| 10043 | * ProcessIface: |
| 10044 | * @parent_iface: The parent interface. |
| 10045 | * @handle_stop: Handler for the #Process::handle-stop signal. |
| 10046 | * |
| 10047 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10048 | */ |
| 10049 | |
| 10050 | typedef ProcessIface ProcessInterface; |
| 10051 | G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT); |
| 10052 | |
| 10053 | static void |
| 10054 | process_default_init (ProcessIface *iface) |
| 10055 | { |
| 10056 | /* GObject signals for incoming D-Bus method calls: */ |
| 10057 | /** |
| 10058 | * Process::handle-stop: |
| 10059 | * @object: A #Process. |
| 10060 | * @invocation: A #GDBusMethodInvocation. |
| 10061 | * |
| 10062 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. |
| 10063 | * |
| 10064 | * 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. |
| 10065 | * |
| 10066 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 10067 | */ |
| 10068 | g_signal_new ("handle-stop", |
| 10069 | G_TYPE_FROM_INTERFACE (iface), |
| 10070 | G_SIGNAL_RUN_LAST, |
| 10071 | G_STRUCT_OFFSET (ProcessIface, handle_stop), |
| 10072 | g_signal_accumulator_true_handled, |
| 10073 | NULL, |
| 10074 | g_cclosure_marshal_generic, |
| 10075 | G_TYPE_BOOLEAN, |
| 10076 | 1, |
| 10077 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 10078 | |
| 10079 | } |
| 10080 | |
| 10081 | /** |
| 10082 | * process_call_stop: |
| 10083 | * @proxy: A #ProcessProxy. |
| 10084 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10085 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 10086 | * @user_data: User data to pass to @callback. |
| 10087 | * |
| 10088 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. |
| 10089 | * 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. |
| 10090 | * You can then call process_call_stop_finish() to get the result of the operation. |
| 10091 | * |
| 10092 | * See process_call_stop_sync() for the synchronous, blocking version of this method. |
| 10093 | */ |
| 10094 | void |
| 10095 | process_call_stop ( |
| 10096 | Process *proxy, |
| 10097 | GCancellable *cancellable, |
| 10098 | GAsyncReadyCallback callback, |
| 10099 | gpointer user_data) |
| 10100 | { |
| 10101 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 10102 | "stop", |
| 10103 | g_variant_new ("()"), |
| 10104 | G_DBUS_CALL_FLAGS_NONE, |
| 10105 | -1, |
| 10106 | cancellable, |
| 10107 | callback, |
| 10108 | user_data); |
| 10109 | } |
| 10110 | |
| 10111 | /** |
| 10112 | * process_call_stop_finish: |
| 10113 | * @proxy: A #ProcessProxy. |
| 10114 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop(). |
| 10115 | * @error: Return location for error or %NULL. |
| 10116 | * |
| 10117 | * Finishes an operation started with process_call_stop(). |
| 10118 | * |
| 10119 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10120 | */ |
| 10121 | gboolean |
| 10122 | process_call_stop_finish ( |
| 10123 | Process *proxy, |
| 10124 | GAsyncResult *res, |
| 10125 | GError **error) |
| 10126 | { |
| 10127 | GVariant *_ret; |
| 10128 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 10129 | if (_ret == NULL) |
| 10130 | goto _out; |
| 10131 | g_variant_get (_ret, |
| 10132 | "()"); |
| 10133 | g_variant_unref (_ret); |
| 10134 | _out: |
| 10135 | return _ret != NULL; |
| 10136 | } |
| 10137 | |
| 10138 | /** |
| 10139 | * process_call_stop_sync: |
| 10140 | * @proxy: A #ProcessProxy. |
| 10141 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10142 | * @error: Return location for error or %NULL. |
| 10143 | * |
| 10144 | * 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. |
| 10145 | * |
| 10146 | * See process_call_stop() for the asynchronous version of this method. |
| 10147 | * |
| 10148 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10149 | */ |
| 10150 | gboolean |
| 10151 | process_call_stop_sync ( |
| 10152 | Process *proxy, |
| 10153 | GCancellable *cancellable, |
| 10154 | GError **error) |
| 10155 | { |
| 10156 | GVariant *_ret; |
| 10157 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 10158 | "stop", |
| 10159 | g_variant_new ("()"), |
| 10160 | G_DBUS_CALL_FLAGS_NONE, |
| 10161 | -1, |
| 10162 | cancellable, |
| 10163 | error); |
| 10164 | if (_ret == NULL) |
| 10165 | goto _out; |
| 10166 | g_variant_get (_ret, |
| 10167 | "()"); |
| 10168 | g_variant_unref (_ret); |
| 10169 | _out: |
| 10170 | return _ret != NULL; |
| 10171 | } |
| 10172 | |
| 10173 | /** |
| 10174 | * process_complete_stop: |
| 10175 | * @object: A #Process. |
| 10176 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 10177 | * |
| 10178 | * 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. |
| 10179 | * |
| 10180 | * This method will free @invocation, you cannot use it afterwards. |
| 10181 | */ |
| 10182 | void |
| 10183 | process_complete_stop ( |
| 10184 | Process *object, |
| 10185 | GDBusMethodInvocation *invocation) |
| 10186 | { |
| 10187 | g_dbus_method_invocation_return_value (invocation, |
| 10188 | g_variant_new ("()")); |
| 10189 | } |
| 10190 | |
| 10191 | /* ------------------------------------------------------------------------ */ |
| 10192 | |
| 10193 | /** |
| 10194 | * ProcessProxy: |
| 10195 | * |
| 10196 | * The #ProcessProxy structure contains only private data and should only be accessed using the provided API. |
| 10197 | */ |
| 10198 | |
| 10199 | /** |
| 10200 | * ProcessProxyClass: |
| 10201 | * @parent_class: The parent class. |
| 10202 | * |
| 10203 | * Class structure for #ProcessProxy. |
| 10204 | */ |
| 10205 | |
| 10206 | struct _ProcessProxyPrivate |
| 10207 | { |
| 10208 | GData *qdata; |
| 10209 | }; |
| 10210 | |
| 10211 | static void process_proxy_iface_init (ProcessIface *iface); |
| 10212 | |
| 10213 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10214 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 10215 | G_ADD_PRIVATE (ProcessProxy) |
| 10216 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 10217 | |
| 10218 | #else |
| 10219 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 10220 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 10221 | |
| 10222 | #endif |
| 10223 | static void |
| 10224 | process_proxy_finalize (GObject *object) |
| 10225 | { |
| 10226 | ProcessProxy *proxy = PROCESS_PROXY (object); |
| 10227 | g_datalist_clear (&proxy->priv->qdata); |
| 10228 | G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object); |
| 10229 | } |
| 10230 | |
| 10231 | static void |
| 10232 | process_proxy_get_property (GObject *object, |
| 10233 | guint prop_id, |
| 10234 | GValue *value, |
| 10235 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10236 | { |
| 10237 | } |
| 10238 | |
| 10239 | static void |
| 10240 | process_proxy_set_property (GObject *object, |
| 10241 | guint prop_id, |
| 10242 | const GValue *value, |
| 10243 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10244 | { |
| 10245 | } |
| 10246 | |
| 10247 | static void |
| 10248 | process_proxy_g_signal (GDBusProxy *proxy, |
| 10249 | const gchar *sender_name G_GNUC_UNUSED, |
| 10250 | const gchar *signal_name, |
| 10251 | GVariant *parameters) |
| 10252 | { |
| 10253 | _ExtendedGDBusSignalInfo *info; |
| 10254 | GVariantIter iter; |
| 10255 | GVariant *child; |
| 10256 | GValue *paramv; |
| 10257 | guint num_params; |
| 10258 | guint n; |
| 10259 | guint signal_id; |
| 10260 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name); |
| 10261 | if (info == NULL) |
| 10262 | return; |
| 10263 | num_params = g_variant_n_children (parameters); |
| 10264 | paramv = g_new0 (GValue, num_params + 1); |
| 10265 | g_value_init (¶mv[0], TYPE_PROCESS); |
| 10266 | g_value_set_object (¶mv[0], proxy); |
| 10267 | g_variant_iter_init (&iter, parameters); |
| 10268 | n = 1; |
| 10269 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10270 | { |
| 10271 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 10272 | if (arg_info->use_gvariant) |
| 10273 | { |
| 10274 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10275 | g_value_set_variant (¶mv[n], child); |
| 10276 | n++; |
| 10277 | } |
| 10278 | else |
| 10279 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10280 | g_variant_unref (child); |
| 10281 | } |
| 10282 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 10283 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 10284 | for (n = 0; n < num_params + 1; n++) |
| 10285 | g_value_unset (¶mv[n]); |
| 10286 | g_free (paramv); |
| 10287 | } |
| 10288 | |
| 10289 | static void |
| 10290 | process_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 10291 | GVariant *changed_properties, |
| 10292 | const gchar *const *invalidated_properties) |
| 10293 | { |
| 10294 | ProcessProxy *proxy = PROCESS_PROXY (_proxy); |
| 10295 | guint n; |
| 10296 | const gchar *key; |
| 10297 | GVariantIter *iter; |
| 10298 | _ExtendedGDBusPropertyInfo *info; |
| 10299 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 10300 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 10301 | { |
| 10302 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key); |
| 10303 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 10304 | if (info != NULL) |
| 10305 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10306 | } |
| 10307 | g_variant_iter_free (iter); |
| 10308 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 10309 | { |
| 10310 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]); |
| 10311 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 10312 | if (info != NULL) |
| 10313 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10314 | } |
| 10315 | } |
| 10316 | |
| 10317 | static void |
| 10318 | process_proxy_init (ProcessProxy *proxy) |
| 10319 | { |
| 10320 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10321 | proxy->priv = process_proxy_get_instance_private (proxy); |
| 10322 | #else |
| 10323 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate); |
| 10324 | #endif |
| 10325 | |
| 10326 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ()); |
| 10327 | } |
| 10328 | |
| 10329 | static void |
| 10330 | process_proxy_class_init (ProcessProxyClass *klass) |
| 10331 | { |
| 10332 | GObjectClass *gobject_class; |
| 10333 | GDBusProxyClass *proxy_class; |
| 10334 | |
| 10335 | gobject_class = G_OBJECT_CLASS (klass); |
| 10336 | gobject_class->finalize = process_proxy_finalize; |
| 10337 | gobject_class->get_property = process_proxy_get_property; |
| 10338 | gobject_class->set_property = process_proxy_set_property; |
| 10339 | |
| 10340 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 10341 | proxy_class->g_signal = process_proxy_g_signal; |
| 10342 | proxy_class->g_properties_changed = process_proxy_g_properties_changed; |
| 10343 | |
| 10344 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10345 | g_type_class_add_private (klass, sizeof (ProcessProxyPrivate)); |
| 10346 | #endif |
| 10347 | } |
| 10348 | |
| 10349 | static void |
| 10350 | process_proxy_iface_init (ProcessIface *iface) |
| 10351 | { |
| 10352 | } |
| 10353 | |
| 10354 | /** |
| 10355 | * process_proxy_new: |
| 10356 | * @connection: A #GDBusConnection. |
| 10357 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10358 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10359 | * @object_path: An object path. |
| 10360 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10361 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10362 | * @user_data: User data to pass to @callback. |
| 10363 | * |
| 10364 | * 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. |
| 10365 | * |
| 10366 | * 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. |
| 10367 | * You can then call process_proxy_new_finish() to get the result of the operation. |
| 10368 | * |
| 10369 | * See process_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 10370 | */ |
| 10371 | void |
| 10372 | process_proxy_new ( |
| 10373 | GDBusConnection *connection, |
| 10374 | GDBusProxyFlags flags, |
| 10375 | const gchar *name, |
| 10376 | const gchar *object_path, |
| 10377 | GCancellable *cancellable, |
| 10378 | GAsyncReadyCallback callback, |
| 10379 | gpointer user_data) |
| 10380 | { |
| 10381 | 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); |
| 10382 | } |
| 10383 | |
| 10384 | /** |
| 10385 | * process_proxy_new_finish: |
| 10386 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new(). |
| 10387 | * @error: Return location for error or %NULL |
| 10388 | * |
| 10389 | * Finishes an operation started with process_proxy_new(). |
| 10390 | * |
| 10391 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10392 | */ |
| 10393 | Process * |
| 10394 | process_proxy_new_finish ( |
| 10395 | GAsyncResult *res, |
| 10396 | GError **error) |
| 10397 | { |
| 10398 | GObject *ret; |
| 10399 | GObject *source_object; |
| 10400 | source_object = g_async_result_get_source_object (res); |
| 10401 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10402 | g_object_unref (source_object); |
| 10403 | if (ret != NULL) |
| 10404 | return PROCESS (ret); |
| 10405 | else |
| 10406 | return NULL; |
| 10407 | } |
| 10408 | |
| 10409 | /** |
| 10410 | * process_proxy_new_sync: |
| 10411 | * @connection: A #GDBusConnection. |
| 10412 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10413 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10414 | * @object_path: An object path. |
| 10415 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10416 | * @error: Return location for error or %NULL |
| 10417 | * |
| 10418 | * 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. |
| 10419 | * |
| 10420 | * The calling thread is blocked until a reply is received. |
| 10421 | * |
| 10422 | * See process_proxy_new() for the asynchronous version of this constructor. |
| 10423 | * |
| 10424 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10425 | */ |
| 10426 | Process * |
| 10427 | process_proxy_new_sync ( |
| 10428 | GDBusConnection *connection, |
| 10429 | GDBusProxyFlags flags, |
| 10430 | const gchar *name, |
| 10431 | const gchar *object_path, |
| 10432 | GCancellable *cancellable, |
| 10433 | GError **error) |
| 10434 | { |
| 10435 | GInitable *ret; |
| 10436 | 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); |
| 10437 | if (ret != NULL) |
| 10438 | return PROCESS (ret); |
| 10439 | else |
| 10440 | return NULL; |
| 10441 | } |
| 10442 | |
| 10443 | |
| 10444 | /** |
| 10445 | * process_proxy_new_for_bus: |
| 10446 | * @bus_type: A #GBusType. |
| 10447 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10448 | * @name: A bus name (well-known or unique). |
| 10449 | * @object_path: An object path. |
| 10450 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10451 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10452 | * @user_data: User data to pass to @callback. |
| 10453 | * |
| 10454 | * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 10455 | * |
| 10456 | * 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. |
| 10457 | * You can then call process_proxy_new_for_bus_finish() to get the result of the operation. |
| 10458 | * |
| 10459 | * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 10460 | */ |
| 10461 | void |
| 10462 | process_proxy_new_for_bus ( |
| 10463 | GBusType bus_type, |
| 10464 | GDBusProxyFlags flags, |
| 10465 | const gchar *name, |
| 10466 | const gchar *object_path, |
| 10467 | GCancellable *cancellable, |
| 10468 | GAsyncReadyCallback callback, |
| 10469 | gpointer user_data) |
| 10470 | { |
| 10471 | 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); |
| 10472 | } |
| 10473 | |
| 10474 | /** |
| 10475 | * process_proxy_new_for_bus_finish: |
| 10476 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus(). |
| 10477 | * @error: Return location for error or %NULL |
| 10478 | * |
| 10479 | * Finishes an operation started with process_proxy_new_for_bus(). |
| 10480 | * |
| 10481 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10482 | */ |
| 10483 | Process * |
| 10484 | process_proxy_new_for_bus_finish ( |
| 10485 | GAsyncResult *res, |
| 10486 | GError **error) |
| 10487 | { |
| 10488 | GObject *ret; |
| 10489 | GObject *source_object; |
| 10490 | source_object = g_async_result_get_source_object (res); |
| 10491 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10492 | g_object_unref (source_object); |
| 10493 | if (ret != NULL) |
| 10494 | return PROCESS (ret); |
| 10495 | else |
| 10496 | return NULL; |
| 10497 | } |
| 10498 | |
| 10499 | /** |
| 10500 | * process_proxy_new_for_bus_sync: |
| 10501 | * @bus_type: A #GBusType. |
| 10502 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10503 | * @name: A bus name (well-known or unique). |
| 10504 | * @object_path: An object path. |
| 10505 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10506 | * @error: Return location for error or %NULL |
| 10507 | * |
| 10508 | * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 10509 | * |
| 10510 | * The calling thread is blocked until a reply is received. |
| 10511 | * |
| 10512 | * See process_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 10513 | * |
| 10514 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10515 | */ |
| 10516 | Process * |
| 10517 | process_proxy_new_for_bus_sync ( |
| 10518 | GBusType bus_type, |
| 10519 | GDBusProxyFlags flags, |
| 10520 | const gchar *name, |
| 10521 | const gchar *object_path, |
| 10522 | GCancellable *cancellable, |
| 10523 | GError **error) |
| 10524 | { |
| 10525 | GInitable *ret; |
| 10526 | 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); |
| 10527 | if (ret != NULL) |
| 10528 | return PROCESS (ret); |
| 10529 | else |
| 10530 | return NULL; |
| 10531 | } |
| 10532 | |
| 10533 | |
| 10534 | /* ------------------------------------------------------------------------ */ |
| 10535 | |
| 10536 | /** |
| 10537 | * ProcessSkeleton: |
| 10538 | * |
| 10539 | * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API. |
| 10540 | */ |
| 10541 | |
| 10542 | /** |
| 10543 | * ProcessSkeletonClass: |
| 10544 | * @parent_class: The parent class. |
| 10545 | * |
| 10546 | * Class structure for #ProcessSkeleton. |
| 10547 | */ |
| 10548 | |
| 10549 | struct _ProcessSkeletonPrivate |
| 10550 | { |
| 10551 | GValue *properties; |
| 10552 | GList *changed_properties; |
| 10553 | GSource *changed_properties_idle_source; |
| 10554 | GMainContext *context; |
| 10555 | GMutex lock; |
| 10556 | }; |
| 10557 | |
| 10558 | static void |
| 10559 | _process_skeleton_handle_method_call ( |
| 10560 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10561 | const gchar *sender G_GNUC_UNUSED, |
| 10562 | const gchar *object_path G_GNUC_UNUSED, |
| 10563 | const gchar *interface_name, |
| 10564 | const gchar *method_name, |
| 10565 | GVariant *parameters, |
| 10566 | GDBusMethodInvocation *invocation, |
| 10567 | gpointer user_data) |
| 10568 | { |
| 10569 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 10570 | _ExtendedGDBusMethodInfo *info; |
| 10571 | GVariantIter iter; |
| 10572 | GVariant *child; |
| 10573 | GValue *paramv; |
| 10574 | guint num_params; |
| 10575 | guint num_extra; |
| 10576 | guint n; |
| 10577 | guint signal_id; |
| 10578 | GValue return_value = G_VALUE_INIT; |
| 10579 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 10580 | g_assert (info != NULL); |
| 10581 | num_params = g_variant_n_children (parameters); |
| 10582 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 10583 | n = 0; |
| 10584 | g_value_init (¶mv[n], TYPE_PROCESS); |
| 10585 | g_value_set_object (¶mv[n++], skeleton); |
| 10586 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 10587 | g_value_set_object (¶mv[n++], invocation); |
| 10588 | if (info->pass_fdlist) |
| 10589 | { |
| 10590 | #ifdef G_OS_UNIX |
| 10591 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 10592 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 10593 | #else |
| 10594 | g_assert_not_reached (); |
| 10595 | #endif |
| 10596 | } |
| 10597 | g_variant_iter_init (&iter, parameters); |
| 10598 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10599 | { |
| 10600 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 10601 | if (arg_info->use_gvariant) |
| 10602 | { |
| 10603 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10604 | g_value_set_variant (¶mv[n], child); |
| 10605 | n++; |
| 10606 | } |
| 10607 | else |
| 10608 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10609 | g_variant_unref (child); |
| 10610 | } |
| 10611 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 10612 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 10613 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 10614 | if (!g_value_get_boolean (&return_value)) |
| 10615 | 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); |
| 10616 | g_value_unset (&return_value); |
| 10617 | for (n = 0; n < num_params + num_extra; n++) |
| 10618 | g_value_unset (¶mv[n]); |
| 10619 | g_free (paramv); |
| 10620 | } |
| 10621 | |
| 10622 | static GVariant * |
| 10623 | _process_skeleton_handle_get_property ( |
| 10624 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10625 | const gchar *sender G_GNUC_UNUSED, |
| 10626 | const gchar *object_path G_GNUC_UNUSED, |
| 10627 | const gchar *interface_name G_GNUC_UNUSED, |
| 10628 | const gchar *property_name, |
| 10629 | GError **error, |
| 10630 | gpointer user_data) |
| 10631 | { |
| 10632 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 10633 | GValue value = G_VALUE_INIT; |
| 10634 | GParamSpec *pspec; |
| 10635 | _ExtendedGDBusPropertyInfo *info; |
| 10636 | GVariant *ret; |
| 10637 | ret = NULL; |
| 10638 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 10639 | g_assert (info != NULL); |
| 10640 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 10641 | if (pspec == NULL) |
| 10642 | { |
| 10643 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10644 | } |
| 10645 | else |
| 10646 | { |
| 10647 | g_value_init (&value, pspec->value_type); |
| 10648 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10649 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 10650 | g_value_unset (&value); |
| 10651 | } |
| 10652 | return ret; |
| 10653 | } |
| 10654 | |
| 10655 | static gboolean |
| 10656 | _process_skeleton_handle_set_property ( |
| 10657 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10658 | const gchar *sender G_GNUC_UNUSED, |
| 10659 | const gchar *object_path G_GNUC_UNUSED, |
| 10660 | const gchar *interface_name G_GNUC_UNUSED, |
| 10661 | const gchar *property_name, |
| 10662 | GVariant *variant, |
| 10663 | GError **error, |
| 10664 | gpointer user_data) |
| 10665 | { |
| 10666 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 10667 | GValue value = G_VALUE_INIT; |
| 10668 | GParamSpec *pspec; |
| 10669 | _ExtendedGDBusPropertyInfo *info; |
| 10670 | gboolean ret; |
| 10671 | ret = FALSE; |
| 10672 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 10673 | g_assert (info != NULL); |
| 10674 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 10675 | if (pspec == NULL) |
| 10676 | { |
| 10677 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10678 | } |
| 10679 | else |
| 10680 | { |
| 10681 | if (info->use_gvariant) |
| 10682 | g_value_set_variant (&value, variant); |
| 10683 | else |
| 10684 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 10685 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10686 | g_value_unset (&value); |
| 10687 | ret = TRUE; |
| 10688 | } |
| 10689 | return ret; |
| 10690 | } |
| 10691 | |
| 10692 | static const GDBusInterfaceVTable _process_skeleton_vtable = |
| 10693 | { |
| 10694 | _process_skeleton_handle_method_call, |
| 10695 | _process_skeleton_handle_get_property, |
| 10696 | _process_skeleton_handle_set_property, |
| 10697 | {NULL} |
| 10698 | }; |
| 10699 | |
| 10700 | static GDBusInterfaceInfo * |
| 10701 | process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10702 | { |
| 10703 | return process_interface_info (); |
| 10704 | } |
| 10705 | |
| 10706 | static GDBusInterfaceVTable * |
| 10707 | process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10708 | { |
| 10709 | return (GDBusInterfaceVTable *) &_process_skeleton_vtable; |
| 10710 | } |
| 10711 | |
| 10712 | static GVariant * |
| 10713 | process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 10714 | { |
| 10715 | ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton); |
| 10716 | |
| 10717 | GVariantBuilder builder; |
| 10718 | guint n; |
| 10719 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 10720 | if (_process_interface_info.parent_struct.properties == NULL) |
| 10721 | goto out; |
| 10722 | for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++) |
| 10723 | { |
| 10724 | GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n]; |
| 10725 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 10726 | { |
| 10727 | GVariant *value; |
| 10728 | 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); |
| 10729 | if (value != NULL) |
| 10730 | { |
| 10731 | g_variant_take_ref (value); |
| 10732 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 10733 | g_variant_unref (value); |
| 10734 | } |
| 10735 | } |
| 10736 | } |
| 10737 | out: |
| 10738 | return g_variant_builder_end (&builder); |
| 10739 | } |
| 10740 | |
| 10741 | static void |
| 10742 | process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 10743 | { |
| 10744 | } |
| 10745 | |
| 10746 | static void process_skeleton_iface_init (ProcessIface *iface); |
| 10747 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10748 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10749 | G_ADD_PRIVATE (ProcessSkeleton) |
| 10750 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 10751 | |
| 10752 | #else |
| 10753 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10754 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 10755 | |
| 10756 | #endif |
| 10757 | static void |
| 10758 | process_skeleton_finalize (GObject *object) |
| 10759 | { |
| 10760 | ProcessSkeleton *skeleton = PROCESS_SKELETON (object); |
| 10761 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 10762 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 10763 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 10764 | g_main_context_unref (skeleton->priv->context); |
| 10765 | g_mutex_clear (&skeleton->priv->lock); |
| 10766 | G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object); |
| 10767 | } |
| 10768 | |
| 10769 | static void |
| 10770 | process_skeleton_init (ProcessSkeleton *skeleton) |
| 10771 | { |
| 10772 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10773 | skeleton->priv = process_skeleton_get_instance_private (skeleton); |
| 10774 | #else |
| 10775 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate); |
| 10776 | #endif |
| 10777 | |
| 10778 | g_mutex_init (&skeleton->priv->lock); |
| 10779 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 10780 | } |
| 10781 | |
| 10782 | static void |
| 10783 | process_skeleton_class_init (ProcessSkeletonClass *klass) |
| 10784 | { |
| 10785 | GObjectClass *gobject_class; |
| 10786 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 10787 | |
| 10788 | gobject_class = G_OBJECT_CLASS (klass); |
| 10789 | gobject_class->finalize = process_skeleton_finalize; |
| 10790 | |
| 10791 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 10792 | skeleton_class->get_info = process_skeleton_dbus_interface_get_info; |
| 10793 | skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties; |
| 10794 | skeleton_class->flush = process_skeleton_dbus_interface_flush; |
| 10795 | skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable; |
| 10796 | |
| 10797 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10798 | g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate)); |
| 10799 | #endif |
| 10800 | } |
| 10801 | |
| 10802 | static void |
| 10803 | process_skeleton_iface_init (ProcessIface *iface) |
| 10804 | { |
| 10805 | } |
| 10806 | |
| 10807 | /** |
| 10808 | * process_skeleton_new: |
| 10809 | * |
| 10810 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10811 | * |
| 10812 | * Returns: (transfer full) (type ProcessSkeleton): The skeleton object. |
| 10813 | */ |
| 10814 | Process * |
| 10815 | process_skeleton_new (void) |
| 10816 | { |
| 10817 | return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL)); |
| 10818 | } |
| 10819 | |
| 10820 | /* ------------------------------------------------------------------------ |
| 10821 | * Code for interface org.openbmc.Control |
| 10822 | * ------------------------------------------------------------------------ |
| 10823 | */ |
| 10824 | |
| 10825 | /** |
| 10826 | * SECTION:Control |
| 10827 | * @title: Control |
| 10828 | * @short_description: Generated C code for the org.openbmc.Control D-Bus interface |
| 10829 | * |
| 10830 | * 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. |
| 10831 | */ |
| 10832 | |
| 10833 | /* ---- Introspection data for org.openbmc.Control ---- */ |
| 10834 | |
| 10835 | static const _ExtendedGDBusMethodInfo _control_method_info_init = |
| 10836 | { |
| 10837 | { |
| 10838 | -1, |
| 10839 | (gchar *) "init", |
| 10840 | NULL, |
| 10841 | NULL, |
| 10842 | NULL |
| 10843 | }, |
| 10844 | "handle-init", |
| 10845 | FALSE |
| 10846 | }; |
| 10847 | |
| 10848 | static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = |
| 10849 | { |
| 10850 | &_control_method_info_init, |
| 10851 | NULL |
| 10852 | }; |
| 10853 | |
| 10854 | static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name = |
| 10855 | { |
| 10856 | { |
| 10857 | -1, |
| 10858 | (gchar *) "bus_name", |
| 10859 | (gchar *) "s", |
| 10860 | NULL |
| 10861 | }, |
| 10862 | FALSE |
| 10863 | }; |
| 10864 | |
| 10865 | static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] = |
| 10866 | { |
| 10867 | &_control_signal_info_heartbeat_ARG_bus_name, |
| 10868 | NULL |
| 10869 | }; |
| 10870 | |
| 10871 | static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat = |
| 10872 | { |
| 10873 | { |
| 10874 | -1, |
| 10875 | (gchar *) "Heartbeat", |
| 10876 | (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers, |
| 10877 | NULL |
| 10878 | }, |
| 10879 | "heartbeat" |
| 10880 | }; |
| 10881 | |
| 10882 | static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name = |
| 10883 | { |
| 10884 | { |
| 10885 | -1, |
| 10886 | (gchar *) "state_name", |
| 10887 | (gchar *) "s", |
| 10888 | NULL |
| 10889 | }, |
| 10890 | FALSE |
| 10891 | }; |
| 10892 | |
| 10893 | static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] = |
| 10894 | { |
| 10895 | &_control_signal_info_goto_system_state_ARG_state_name, |
| 10896 | NULL |
| 10897 | }; |
| 10898 | |
| 10899 | static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state = |
| 10900 | { |
| 10901 | { |
| 10902 | -1, |
| 10903 | (gchar *) "GotoSystemState", |
| 10904 | (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers, |
| 10905 | NULL |
| 10906 | }, |
| 10907 | "goto-system-state" |
| 10908 | }; |
| 10909 | |
| 10910 | static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] = |
| 10911 | { |
| 10912 | &_control_signal_info_heartbeat, |
| 10913 | &_control_signal_info_goto_system_state, |
| 10914 | NULL |
| 10915 | }; |
| 10916 | |
| 10917 | static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = |
| 10918 | { |
| 10919 | { |
| 10920 | -1, |
| 10921 | (gchar *) "poll_interval", |
| 10922 | (gchar *) "i", |
| 10923 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 10924 | NULL |
| 10925 | }, |
| 10926 | "poll-interval", |
| 10927 | FALSE |
| 10928 | }; |
| 10929 | |
| 10930 | static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat = |
| 10931 | { |
| 10932 | { |
| 10933 | -1, |
| 10934 | (gchar *) "heatbeat", |
| 10935 | (gchar *) "i", |
| 10936 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 10937 | NULL |
| 10938 | }, |
| 10939 | "heatbeat", |
| 10940 | FALSE |
| 10941 | }; |
| 10942 | |
| 10943 | static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] = |
| 10944 | { |
| 10945 | &_control_property_info_poll_interval, |
| 10946 | &_control_property_info_heatbeat, |
| 10947 | NULL |
| 10948 | }; |
| 10949 | |
| 10950 | static const _ExtendedGDBusInterfaceInfo _control_interface_info = |
| 10951 | { |
| 10952 | { |
| 10953 | -1, |
| 10954 | (gchar *) "org.openbmc.Control", |
| 10955 | (GDBusMethodInfo **) &_control_method_info_pointers, |
| 10956 | (GDBusSignalInfo **) &_control_signal_info_pointers, |
| 10957 | (GDBusPropertyInfo **) &_control_property_info_pointers, |
| 10958 | NULL |
| 10959 | }, |
| 10960 | "control", |
| 10961 | }; |
| 10962 | |
| 10963 | |
| 10964 | /** |
| 10965 | * control_interface_info: |
| 10966 | * |
| 10967 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface. |
| 10968 | * |
| 10969 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 10970 | */ |
| 10971 | GDBusInterfaceInfo * |
| 10972 | control_interface_info (void) |
| 10973 | { |
| 10974 | return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct; |
| 10975 | } |
| 10976 | |
| 10977 | /** |
| 10978 | * control_override_properties: |
| 10979 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 10980 | * @property_id_begin: The property id to assign to the first overridden property. |
| 10981 | * |
| 10982 | * Overrides all #GObject properties in the #Control interface for a concrete class. |
| 10983 | * The properties are overridden in the order they are defined. |
| 10984 | * |
| 10985 | * Returns: The last property id. |
| 10986 | */ |
| 10987 | guint |
| 10988 | control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 10989 | { |
| 10990 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 10991 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 10992 | return property_id_begin - 1; |
| 10993 | } |
| 10994 | |
| 10995 | |
| 10996 | |
| 10997 | /** |
| 10998 | * Control: |
| 10999 | * |
| 11000 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11001 | */ |
| 11002 | |
| 11003 | /** |
| 11004 | * ControlIface: |
| 11005 | * @parent_iface: The parent interface. |
| 11006 | * @handle_init: Handler for the #Control::handle-init signal. |
| 11007 | * @get_heatbeat: Getter for the #Control:heatbeat property. |
| 11008 | * @get_poll_interval: Getter for the #Control:poll-interval property. |
| 11009 | * @goto_system_state: Handler for the #Control::goto-system-state signal. |
| 11010 | * @heartbeat: Handler for the #Control::heartbeat signal. |
| 11011 | * |
| 11012 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11013 | */ |
| 11014 | |
| 11015 | typedef ControlIface ControlInterface; |
| 11016 | G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT); |
| 11017 | |
| 11018 | static void |
| 11019 | control_default_init (ControlIface *iface) |
| 11020 | { |
| 11021 | /* GObject signals for incoming D-Bus method calls: */ |
| 11022 | /** |
| 11023 | * Control::handle-init: |
| 11024 | * @object: A #Control. |
| 11025 | * @invocation: A #GDBusMethodInvocation. |
| 11026 | * |
| 11027 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. |
| 11028 | * |
| 11029 | * 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. |
| 11030 | * |
| 11031 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11032 | */ |
| 11033 | g_signal_new ("handle-init", |
| 11034 | G_TYPE_FROM_INTERFACE (iface), |
| 11035 | G_SIGNAL_RUN_LAST, |
| 11036 | G_STRUCT_OFFSET (ControlIface, handle_init), |
| 11037 | g_signal_accumulator_true_handled, |
| 11038 | NULL, |
| 11039 | g_cclosure_marshal_generic, |
| 11040 | G_TYPE_BOOLEAN, |
| 11041 | 1, |
| 11042 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 11043 | |
| 11044 | /* GObject signals for received D-Bus signals: */ |
| 11045 | /** |
| 11046 | * Control::heartbeat: |
| 11047 | * @object: A #Control. |
| 11048 | * @arg_bus_name: Argument. |
| 11049 | * |
| 11050 | * 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. |
| 11051 | * |
| 11052 | * 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. |
| 11053 | */ |
| 11054 | g_signal_new ("heartbeat", |
| 11055 | G_TYPE_FROM_INTERFACE (iface), |
| 11056 | G_SIGNAL_RUN_LAST, |
| 11057 | G_STRUCT_OFFSET (ControlIface, heartbeat), |
| 11058 | NULL, |
| 11059 | NULL, |
| 11060 | g_cclosure_marshal_generic, |
| 11061 | G_TYPE_NONE, |
| 11062 | 1, G_TYPE_STRING); |
| 11063 | |
| 11064 | /** |
| 11065 | * Control::goto-system-state: |
| 11066 | * @object: A #Control. |
| 11067 | * @arg_state_name: Argument. |
| 11068 | * |
| 11069 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> is received. |
| 11070 | * |
| 11071 | * 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. |
| 11072 | */ |
| 11073 | g_signal_new ("goto-system-state", |
| 11074 | G_TYPE_FROM_INTERFACE (iface), |
| 11075 | G_SIGNAL_RUN_LAST, |
| 11076 | G_STRUCT_OFFSET (ControlIface, goto_system_state), |
| 11077 | NULL, |
| 11078 | NULL, |
| 11079 | g_cclosure_marshal_generic, |
| 11080 | G_TYPE_NONE, |
| 11081 | 1, G_TYPE_STRING); |
| 11082 | |
| 11083 | /* GObject properties for D-Bus properties: */ |
| 11084 | /** |
| 11085 | * Control:poll-interval: |
| 11086 | * |
| 11087 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. |
| 11088 | * |
| 11089 | * 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. |
| 11090 | */ |
| 11091 | g_object_interface_install_property (iface, |
| 11092 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11093 | /** |
| 11094 | * Control:heatbeat: |
| 11095 | * |
| 11096 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>. |
| 11097 | * |
| 11098 | * 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. |
| 11099 | */ |
| 11100 | g_object_interface_install_property (iface, |
| 11101 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11102 | } |
| 11103 | |
| 11104 | /** |
| 11105 | * control_get_poll_interval: (skip) |
| 11106 | * @object: A #Control. |
| 11107 | * |
| 11108 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. |
| 11109 | * |
| 11110 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 11111 | * |
| 11112 | * Returns: The property value. |
| 11113 | */ |
| 11114 | gint |
| 11115 | control_get_poll_interval (Control *object) |
| 11116 | { |
| 11117 | return CONTROL_GET_IFACE (object)->get_poll_interval (object); |
| 11118 | } |
| 11119 | |
| 11120 | /** |
| 11121 | * control_set_poll_interval: (skip) |
| 11122 | * @object: A #Control. |
| 11123 | * @value: The value to set. |
| 11124 | * |
| 11125 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 11126 | * |
| 11127 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 11128 | */ |
| 11129 | void |
| 11130 | control_set_poll_interval (Control *object, gint value) |
| 11131 | { |
| 11132 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 11133 | } |
| 11134 | |
| 11135 | /** |
| 11136 | * control_get_heatbeat: (skip) |
| 11137 | * @object: A #Control. |
| 11138 | * |
| 11139 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property. |
| 11140 | * |
| 11141 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 11142 | * |
| 11143 | * Returns: The property value. |
| 11144 | */ |
| 11145 | gint |
| 11146 | control_get_heatbeat (Control *object) |
| 11147 | { |
| 11148 | return CONTROL_GET_IFACE (object)->get_heatbeat (object); |
| 11149 | } |
| 11150 | |
| 11151 | /** |
| 11152 | * control_set_heatbeat: (skip) |
| 11153 | * @object: A #Control. |
| 11154 | * @value: The value to set. |
| 11155 | * |
| 11156 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 11157 | * |
| 11158 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 11159 | */ |
| 11160 | void |
| 11161 | control_set_heatbeat (Control *object, gint value) |
| 11162 | { |
| 11163 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 11164 | } |
| 11165 | |
| 11166 | /** |
| 11167 | * control_emit_heartbeat: |
| 11168 | * @object: A #Control. |
| 11169 | * @arg_bus_name: Argument to pass with the signal. |
| 11170 | * |
| 11171 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 11172 | */ |
| 11173 | void |
| 11174 | control_emit_heartbeat ( |
| 11175 | Control *object, |
| 11176 | const gchar *arg_bus_name) |
| 11177 | { |
| 11178 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 11179 | } |
| 11180 | |
| 11181 | /** |
| 11182 | * control_emit_goto_system_state: |
| 11183 | * @object: A #Control. |
| 11184 | * @arg_state_name: Argument to pass with the signal. |
| 11185 | * |
| 11186 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal. |
| 11187 | */ |
| 11188 | void |
| 11189 | control_emit_goto_system_state ( |
| 11190 | Control *object, |
| 11191 | const gchar *arg_state_name) |
| 11192 | { |
| 11193 | g_signal_emit_by_name (object, "goto-system-state", arg_state_name); |
| 11194 | } |
| 11195 | |
| 11196 | /** |
| 11197 | * control_call_init: |
| 11198 | * @proxy: A #ControlProxy. |
| 11199 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11200 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 11201 | * @user_data: User data to pass to @callback. |
| 11202 | * |
| 11203 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. |
| 11204 | * 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. |
| 11205 | * You can then call control_call_init_finish() to get the result of the operation. |
| 11206 | * |
| 11207 | * See control_call_init_sync() for the synchronous, blocking version of this method. |
| 11208 | */ |
| 11209 | void |
| 11210 | control_call_init ( |
| 11211 | Control *proxy, |
| 11212 | GCancellable *cancellable, |
| 11213 | GAsyncReadyCallback callback, |
| 11214 | gpointer user_data) |
| 11215 | { |
| 11216 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 11217 | "init", |
| 11218 | g_variant_new ("()"), |
| 11219 | G_DBUS_CALL_FLAGS_NONE, |
| 11220 | -1, |
| 11221 | cancellable, |
| 11222 | callback, |
| 11223 | user_data); |
| 11224 | } |
| 11225 | |
| 11226 | /** |
| 11227 | * control_call_init_finish: |
| 11228 | * @proxy: A #ControlProxy. |
| 11229 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). |
| 11230 | * @error: Return location for error or %NULL. |
| 11231 | * |
| 11232 | * Finishes an operation started with control_call_init(). |
| 11233 | * |
| 11234 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11235 | */ |
| 11236 | gboolean |
| 11237 | control_call_init_finish ( |
| 11238 | Control *proxy, |
| 11239 | GAsyncResult *res, |
| 11240 | GError **error) |
| 11241 | { |
| 11242 | GVariant *_ret; |
| 11243 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 11244 | if (_ret == NULL) |
| 11245 | goto _out; |
| 11246 | g_variant_get (_ret, |
| 11247 | "()"); |
| 11248 | g_variant_unref (_ret); |
| 11249 | _out: |
| 11250 | return _ret != NULL; |
| 11251 | } |
| 11252 | |
| 11253 | /** |
| 11254 | * control_call_init_sync: |
| 11255 | * @proxy: A #ControlProxy. |
| 11256 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11257 | * @error: Return location for error or %NULL. |
| 11258 | * |
| 11259 | * 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. |
| 11260 | * |
| 11261 | * See control_call_init() for the asynchronous version of this method. |
| 11262 | * |
| 11263 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11264 | */ |
| 11265 | gboolean |
| 11266 | control_call_init_sync ( |
| 11267 | Control *proxy, |
| 11268 | GCancellable *cancellable, |
| 11269 | GError **error) |
| 11270 | { |
| 11271 | GVariant *_ret; |
| 11272 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 11273 | "init", |
| 11274 | g_variant_new ("()"), |
| 11275 | G_DBUS_CALL_FLAGS_NONE, |
| 11276 | -1, |
| 11277 | cancellable, |
| 11278 | error); |
| 11279 | if (_ret == NULL) |
| 11280 | goto _out; |
| 11281 | g_variant_get (_ret, |
| 11282 | "()"); |
| 11283 | g_variant_unref (_ret); |
| 11284 | _out: |
| 11285 | return _ret != NULL; |
| 11286 | } |
| 11287 | |
| 11288 | /** |
| 11289 | * control_complete_init: |
| 11290 | * @object: A #Control. |
| 11291 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 11292 | * |
| 11293 | * 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. |
| 11294 | * |
| 11295 | * This method will free @invocation, you cannot use it afterwards. |
| 11296 | */ |
| 11297 | void |
| 11298 | control_complete_init ( |
| 11299 | Control *object, |
| 11300 | GDBusMethodInvocation *invocation) |
| 11301 | { |
| 11302 | g_dbus_method_invocation_return_value (invocation, |
| 11303 | g_variant_new ("()")); |
| 11304 | } |
| 11305 | |
| 11306 | /* ------------------------------------------------------------------------ */ |
| 11307 | |
| 11308 | /** |
| 11309 | * ControlProxy: |
| 11310 | * |
| 11311 | * The #ControlProxy structure contains only private data and should only be accessed using the provided API. |
| 11312 | */ |
| 11313 | |
| 11314 | /** |
| 11315 | * ControlProxyClass: |
| 11316 | * @parent_class: The parent class. |
| 11317 | * |
| 11318 | * Class structure for #ControlProxy. |
| 11319 | */ |
| 11320 | |
| 11321 | struct _ControlProxyPrivate |
| 11322 | { |
| 11323 | GData *qdata; |
| 11324 | }; |
| 11325 | |
| 11326 | static void control_proxy_iface_init (ControlIface *iface); |
| 11327 | |
| 11328 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11329 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 11330 | G_ADD_PRIVATE (ControlProxy) |
| 11331 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 11332 | |
| 11333 | #else |
| 11334 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 11335 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 11336 | |
| 11337 | #endif |
| 11338 | static void |
| 11339 | control_proxy_finalize (GObject *object) |
| 11340 | { |
| 11341 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11342 | g_datalist_clear (&proxy->priv->qdata); |
| 11343 | G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object); |
| 11344 | } |
| 11345 | |
| 11346 | static void |
| 11347 | control_proxy_get_property (GObject *object, |
| 11348 | guint prop_id, |
| 11349 | GValue *value, |
| 11350 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11351 | { |
| 11352 | const _ExtendedGDBusPropertyInfo *info; |
| 11353 | GVariant *variant; |
| 11354 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11355 | info = _control_property_info_pointers[prop_id - 1]; |
| 11356 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 11357 | if (info->use_gvariant) |
| 11358 | { |
| 11359 | g_value_set_variant (value, variant); |
| 11360 | } |
| 11361 | else |
| 11362 | { |
| 11363 | if (variant != NULL) |
| 11364 | g_dbus_gvariant_to_gvalue (variant, value); |
| 11365 | } |
| 11366 | if (variant != NULL) |
| 11367 | g_variant_unref (variant); |
| 11368 | } |
| 11369 | |
| 11370 | static void |
| 11371 | control_proxy_set_property_cb (GDBusProxy *proxy, |
| 11372 | GAsyncResult *res, |
| 11373 | gpointer user_data) |
| 11374 | { |
| 11375 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 11376 | GError *error; |
| 11377 | GVariant *_ret; |
| 11378 | error = NULL; |
| 11379 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 11380 | if (!_ret) |
| 11381 | { |
| 11382 | g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)", |
| 11383 | info->parent_struct.name, |
| 11384 | error->message, g_quark_to_string (error->domain), error->code); |
| 11385 | g_error_free (error); |
| 11386 | } |
| 11387 | else |
| 11388 | { |
| 11389 | g_variant_unref (_ret); |
| 11390 | } |
| 11391 | } |
| 11392 | |
| 11393 | static void |
| 11394 | control_proxy_set_property (GObject *object, |
| 11395 | guint prop_id, |
| 11396 | const GValue *value, |
| 11397 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11398 | { |
| 11399 | const _ExtendedGDBusPropertyInfo *info; |
| 11400 | GVariant *variant; |
| 11401 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11402 | info = _control_property_info_pointers[prop_id - 1]; |
| 11403 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11404 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 11405 | "org.freedesktop.DBus.Properties.Set", |
| 11406 | g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant), |
| 11407 | G_DBUS_CALL_FLAGS_NONE, |
| 11408 | -1, |
| 11409 | NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 11410 | g_variant_unref (variant); |
| 11411 | } |
| 11412 | |
| 11413 | static void |
| 11414 | control_proxy_g_signal (GDBusProxy *proxy, |
| 11415 | const gchar *sender_name G_GNUC_UNUSED, |
| 11416 | const gchar *signal_name, |
| 11417 | GVariant *parameters) |
| 11418 | { |
| 11419 | _ExtendedGDBusSignalInfo *info; |
| 11420 | GVariantIter iter; |
| 11421 | GVariant *child; |
| 11422 | GValue *paramv; |
| 11423 | guint num_params; |
| 11424 | guint n; |
| 11425 | guint signal_id; |
| 11426 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name); |
| 11427 | if (info == NULL) |
| 11428 | return; |
| 11429 | num_params = g_variant_n_children (parameters); |
| 11430 | paramv = g_new0 (GValue, num_params + 1); |
| 11431 | g_value_init (¶mv[0], TYPE_CONTROL); |
| 11432 | g_value_set_object (¶mv[0], proxy); |
| 11433 | g_variant_iter_init (&iter, parameters); |
| 11434 | n = 1; |
| 11435 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11436 | { |
| 11437 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 11438 | if (arg_info->use_gvariant) |
| 11439 | { |
| 11440 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11441 | g_value_set_variant (¶mv[n], child); |
| 11442 | n++; |
| 11443 | } |
| 11444 | else |
| 11445 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11446 | g_variant_unref (child); |
| 11447 | } |
| 11448 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 11449 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 11450 | for (n = 0; n < num_params + 1; n++) |
| 11451 | g_value_unset (¶mv[n]); |
| 11452 | g_free (paramv); |
| 11453 | } |
| 11454 | |
| 11455 | static void |
| 11456 | control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 11457 | GVariant *changed_properties, |
| 11458 | const gchar *const *invalidated_properties) |
| 11459 | { |
| 11460 | ControlProxy *proxy = CONTROL_PROXY (_proxy); |
| 11461 | guint n; |
| 11462 | const gchar *key; |
| 11463 | GVariantIter *iter; |
| 11464 | _ExtendedGDBusPropertyInfo *info; |
| 11465 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 11466 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 11467 | { |
| 11468 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key); |
| 11469 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 11470 | if (info != NULL) |
| 11471 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 11472 | } |
| 11473 | g_variant_iter_free (iter); |
| 11474 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 11475 | { |
| 11476 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]); |
| 11477 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 11478 | if (info != NULL) |
| 11479 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 11480 | } |
| 11481 | } |
| 11482 | |
| 11483 | static gint |
| 11484 | control_proxy_get_poll_interval (Control *object) |
| 11485 | { |
| 11486 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11487 | GVariant *variant; |
| 11488 | gint value = 0; |
| 11489 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 11490 | if (variant != NULL) |
| 11491 | { |
| 11492 | value = g_variant_get_int32 (variant); |
| 11493 | g_variant_unref (variant); |
| 11494 | } |
| 11495 | return value; |
| 11496 | } |
| 11497 | |
| 11498 | static gint |
| 11499 | control_proxy_get_heatbeat (Control *object) |
| 11500 | { |
| 11501 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11502 | GVariant *variant; |
| 11503 | gint value = 0; |
| 11504 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 11505 | if (variant != NULL) |
| 11506 | { |
| 11507 | value = g_variant_get_int32 (variant); |
| 11508 | g_variant_unref (variant); |
| 11509 | } |
| 11510 | return value; |
| 11511 | } |
| 11512 | |
| 11513 | static void |
| 11514 | control_proxy_init (ControlProxy *proxy) |
| 11515 | { |
| 11516 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11517 | proxy->priv = control_proxy_get_instance_private (proxy); |
| 11518 | #else |
| 11519 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate); |
| 11520 | #endif |
| 11521 | |
| 11522 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ()); |
| 11523 | } |
| 11524 | |
| 11525 | static void |
| 11526 | control_proxy_class_init (ControlProxyClass *klass) |
| 11527 | { |
| 11528 | GObjectClass *gobject_class; |
| 11529 | GDBusProxyClass *proxy_class; |
| 11530 | |
| 11531 | gobject_class = G_OBJECT_CLASS (klass); |
| 11532 | gobject_class->finalize = control_proxy_finalize; |
| 11533 | gobject_class->get_property = control_proxy_get_property; |
| 11534 | gobject_class->set_property = control_proxy_set_property; |
| 11535 | |
| 11536 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 11537 | proxy_class->g_signal = control_proxy_g_signal; |
| 11538 | proxy_class->g_properties_changed = control_proxy_g_properties_changed; |
| 11539 | |
| 11540 | control_override_properties (gobject_class, 1); |
| 11541 | |
| 11542 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 11543 | g_type_class_add_private (klass, sizeof (ControlProxyPrivate)); |
| 11544 | #endif |
| 11545 | } |
| 11546 | |
| 11547 | static void |
| 11548 | control_proxy_iface_init (ControlIface *iface) |
| 11549 | { |
| 11550 | iface->get_poll_interval = control_proxy_get_poll_interval; |
| 11551 | iface->get_heatbeat = control_proxy_get_heatbeat; |
| 11552 | } |
| 11553 | |
| 11554 | /** |
| 11555 | * control_proxy_new: |
| 11556 | * @connection: A #GDBusConnection. |
| 11557 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11558 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11559 | * @object_path: An object path. |
| 11560 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11561 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11562 | * @user_data: User data to pass to @callback. |
| 11563 | * |
| 11564 | * 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. |
| 11565 | * |
| 11566 | * 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. |
| 11567 | * You can then call control_proxy_new_finish() to get the result of the operation. |
| 11568 | * |
| 11569 | * See control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 11570 | */ |
| 11571 | void |
| 11572 | control_proxy_new ( |
| 11573 | GDBusConnection *connection, |
| 11574 | GDBusProxyFlags flags, |
| 11575 | const gchar *name, |
| 11576 | const gchar *object_path, |
| 11577 | GCancellable *cancellable, |
| 11578 | GAsyncReadyCallback callback, |
| 11579 | gpointer user_data) |
| 11580 | { |
| 11581 | 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); |
| 11582 | } |
| 11583 | |
| 11584 | /** |
| 11585 | * control_proxy_new_finish: |
| 11586 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new(). |
| 11587 | * @error: Return location for error or %NULL |
| 11588 | * |
| 11589 | * Finishes an operation started with control_proxy_new(). |
| 11590 | * |
| 11591 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11592 | */ |
| 11593 | Control * |
| 11594 | control_proxy_new_finish ( |
| 11595 | GAsyncResult *res, |
| 11596 | GError **error) |
| 11597 | { |
| 11598 | GObject *ret; |
| 11599 | GObject *source_object; |
| 11600 | source_object = g_async_result_get_source_object (res); |
| 11601 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11602 | g_object_unref (source_object); |
| 11603 | if (ret != NULL) |
| 11604 | return CONTROL (ret); |
| 11605 | else |
| 11606 | return NULL; |
| 11607 | } |
| 11608 | |
| 11609 | /** |
| 11610 | * control_proxy_new_sync: |
| 11611 | * @connection: A #GDBusConnection. |
| 11612 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11613 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11614 | * @object_path: An object path. |
| 11615 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11616 | * @error: Return location for error or %NULL |
| 11617 | * |
| 11618 | * 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. |
| 11619 | * |
| 11620 | * The calling thread is blocked until a reply is received. |
| 11621 | * |
| 11622 | * See control_proxy_new() for the asynchronous version of this constructor. |
| 11623 | * |
| 11624 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11625 | */ |
| 11626 | Control * |
| 11627 | control_proxy_new_sync ( |
| 11628 | GDBusConnection *connection, |
| 11629 | GDBusProxyFlags flags, |
| 11630 | const gchar *name, |
| 11631 | const gchar *object_path, |
| 11632 | GCancellable *cancellable, |
| 11633 | GError **error) |
| 11634 | { |
| 11635 | GInitable *ret; |
| 11636 | 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); |
| 11637 | if (ret != NULL) |
| 11638 | return CONTROL (ret); |
| 11639 | else |
| 11640 | return NULL; |
| 11641 | } |
| 11642 | |
| 11643 | |
| 11644 | /** |
| 11645 | * control_proxy_new_for_bus: |
| 11646 | * @bus_type: A #GBusType. |
| 11647 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11648 | * @name: A bus name (well-known or unique). |
| 11649 | * @object_path: An object path. |
| 11650 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11651 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11652 | * @user_data: User data to pass to @callback. |
| 11653 | * |
| 11654 | * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 11655 | * |
| 11656 | * 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. |
| 11657 | * You can then call control_proxy_new_for_bus_finish() to get the result of the operation. |
| 11658 | * |
| 11659 | * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 11660 | */ |
| 11661 | void |
| 11662 | control_proxy_new_for_bus ( |
| 11663 | GBusType bus_type, |
| 11664 | GDBusProxyFlags flags, |
| 11665 | const gchar *name, |
| 11666 | const gchar *object_path, |
| 11667 | GCancellable *cancellable, |
| 11668 | GAsyncReadyCallback callback, |
| 11669 | gpointer user_data) |
| 11670 | { |
| 11671 | 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); |
| 11672 | } |
| 11673 | |
| 11674 | /** |
| 11675 | * control_proxy_new_for_bus_finish: |
| 11676 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus(). |
| 11677 | * @error: Return location for error or %NULL |
| 11678 | * |
| 11679 | * Finishes an operation started with control_proxy_new_for_bus(). |
| 11680 | * |
| 11681 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11682 | */ |
| 11683 | Control * |
| 11684 | control_proxy_new_for_bus_finish ( |
| 11685 | GAsyncResult *res, |
| 11686 | GError **error) |
| 11687 | { |
| 11688 | GObject *ret; |
| 11689 | GObject *source_object; |
| 11690 | source_object = g_async_result_get_source_object (res); |
| 11691 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11692 | g_object_unref (source_object); |
| 11693 | if (ret != NULL) |
| 11694 | return CONTROL (ret); |
| 11695 | else |
| 11696 | return NULL; |
| 11697 | } |
| 11698 | |
| 11699 | /** |
| 11700 | * control_proxy_new_for_bus_sync: |
| 11701 | * @bus_type: A #GBusType. |
| 11702 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11703 | * @name: A bus name (well-known or unique). |
| 11704 | * @object_path: An object path. |
| 11705 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11706 | * @error: Return location for error or %NULL |
| 11707 | * |
| 11708 | * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 11709 | * |
| 11710 | * The calling thread is blocked until a reply is received. |
| 11711 | * |
| 11712 | * See control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 11713 | * |
| 11714 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11715 | */ |
| 11716 | Control * |
| 11717 | control_proxy_new_for_bus_sync ( |
| 11718 | GBusType bus_type, |
| 11719 | GDBusProxyFlags flags, |
| 11720 | const gchar *name, |
| 11721 | const gchar *object_path, |
| 11722 | GCancellable *cancellable, |
| 11723 | GError **error) |
| 11724 | { |
| 11725 | GInitable *ret; |
| 11726 | 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); |
| 11727 | if (ret != NULL) |
| 11728 | return CONTROL (ret); |
| 11729 | else |
| 11730 | return NULL; |
| 11731 | } |
| 11732 | |
| 11733 | |
| 11734 | /* ------------------------------------------------------------------------ */ |
| 11735 | |
| 11736 | /** |
| 11737 | * ControlSkeleton: |
| 11738 | * |
| 11739 | * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 11740 | */ |
| 11741 | |
| 11742 | /** |
| 11743 | * ControlSkeletonClass: |
| 11744 | * @parent_class: The parent class. |
| 11745 | * |
| 11746 | * Class structure for #ControlSkeleton. |
| 11747 | */ |
| 11748 | |
| 11749 | struct _ControlSkeletonPrivate |
| 11750 | { |
| 11751 | GValue *properties; |
| 11752 | GList *changed_properties; |
| 11753 | GSource *changed_properties_idle_source; |
| 11754 | GMainContext *context; |
| 11755 | GMutex lock; |
| 11756 | }; |
| 11757 | |
| 11758 | static void |
| 11759 | _control_skeleton_handle_method_call ( |
| 11760 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11761 | const gchar *sender G_GNUC_UNUSED, |
| 11762 | const gchar *object_path G_GNUC_UNUSED, |
| 11763 | const gchar *interface_name, |
| 11764 | const gchar *method_name, |
| 11765 | GVariant *parameters, |
| 11766 | GDBusMethodInvocation *invocation, |
| 11767 | gpointer user_data) |
| 11768 | { |
| 11769 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11770 | _ExtendedGDBusMethodInfo *info; |
| 11771 | GVariantIter iter; |
| 11772 | GVariant *child; |
| 11773 | GValue *paramv; |
| 11774 | guint num_params; |
| 11775 | guint num_extra; |
| 11776 | guint n; |
| 11777 | guint signal_id; |
| 11778 | GValue return_value = G_VALUE_INIT; |
| 11779 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 11780 | g_assert (info != NULL); |
| 11781 | num_params = g_variant_n_children (parameters); |
| 11782 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 11783 | n = 0; |
| 11784 | g_value_init (¶mv[n], TYPE_CONTROL); |
| 11785 | g_value_set_object (¶mv[n++], skeleton); |
| 11786 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 11787 | g_value_set_object (¶mv[n++], invocation); |
| 11788 | if (info->pass_fdlist) |
| 11789 | { |
| 11790 | #ifdef G_OS_UNIX |
| 11791 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 11792 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 11793 | #else |
| 11794 | g_assert_not_reached (); |
| 11795 | #endif |
| 11796 | } |
| 11797 | g_variant_iter_init (&iter, parameters); |
| 11798 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11799 | { |
| 11800 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 11801 | if (arg_info->use_gvariant) |
| 11802 | { |
| 11803 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11804 | g_value_set_variant (¶mv[n], child); |
| 11805 | n++; |
| 11806 | } |
| 11807 | else |
| 11808 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11809 | g_variant_unref (child); |
| 11810 | } |
| 11811 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 11812 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 11813 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 11814 | if (!g_value_get_boolean (&return_value)) |
| 11815 | 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); |
| 11816 | g_value_unset (&return_value); |
| 11817 | for (n = 0; n < num_params + num_extra; n++) |
| 11818 | g_value_unset (¶mv[n]); |
| 11819 | g_free (paramv); |
| 11820 | } |
| 11821 | |
| 11822 | static GVariant * |
| 11823 | _control_skeleton_handle_get_property ( |
| 11824 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11825 | const gchar *sender G_GNUC_UNUSED, |
| 11826 | const gchar *object_path G_GNUC_UNUSED, |
| 11827 | const gchar *interface_name G_GNUC_UNUSED, |
| 11828 | const gchar *property_name, |
| 11829 | GError **error, |
| 11830 | gpointer user_data) |
| 11831 | { |
| 11832 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11833 | GValue value = G_VALUE_INIT; |
| 11834 | GParamSpec *pspec; |
| 11835 | _ExtendedGDBusPropertyInfo *info; |
| 11836 | GVariant *ret; |
| 11837 | ret = NULL; |
| 11838 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 11839 | g_assert (info != NULL); |
| 11840 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11841 | if (pspec == NULL) |
| 11842 | { |
| 11843 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11844 | } |
| 11845 | else |
| 11846 | { |
| 11847 | g_value_init (&value, pspec->value_type); |
| 11848 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11849 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11850 | g_value_unset (&value); |
| 11851 | } |
| 11852 | return ret; |
| 11853 | } |
| 11854 | |
| 11855 | static gboolean |
| 11856 | _control_skeleton_handle_set_property ( |
| 11857 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11858 | const gchar *sender G_GNUC_UNUSED, |
| 11859 | const gchar *object_path G_GNUC_UNUSED, |
| 11860 | const gchar *interface_name G_GNUC_UNUSED, |
| 11861 | const gchar *property_name, |
| 11862 | GVariant *variant, |
| 11863 | GError **error, |
| 11864 | gpointer user_data) |
| 11865 | { |
| 11866 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11867 | GValue value = G_VALUE_INIT; |
| 11868 | GParamSpec *pspec; |
| 11869 | _ExtendedGDBusPropertyInfo *info; |
| 11870 | gboolean ret; |
| 11871 | ret = FALSE; |
| 11872 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 11873 | g_assert (info != NULL); |
| 11874 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11875 | if (pspec == NULL) |
| 11876 | { |
| 11877 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11878 | } |
| 11879 | else |
| 11880 | { |
| 11881 | if (info->use_gvariant) |
| 11882 | g_value_set_variant (&value, variant); |
| 11883 | else |
| 11884 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 11885 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11886 | g_value_unset (&value); |
| 11887 | ret = TRUE; |
| 11888 | } |
| 11889 | return ret; |
| 11890 | } |
| 11891 | |
| 11892 | static const GDBusInterfaceVTable _control_skeleton_vtable = |
| 11893 | { |
| 11894 | _control_skeleton_handle_method_call, |
| 11895 | _control_skeleton_handle_get_property, |
| 11896 | _control_skeleton_handle_set_property, |
| 11897 | {NULL} |
| 11898 | }; |
| 11899 | |
| 11900 | static GDBusInterfaceInfo * |
| 11901 | control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11902 | { |
| 11903 | return control_interface_info (); |
| 11904 | } |
| 11905 | |
| 11906 | static GDBusInterfaceVTable * |
| 11907 | control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11908 | { |
| 11909 | return (GDBusInterfaceVTable *) &_control_skeleton_vtable; |
| 11910 | } |
| 11911 | |
| 11912 | static GVariant * |
| 11913 | control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 11914 | { |
| 11915 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 11916 | |
| 11917 | GVariantBuilder builder; |
| 11918 | guint n; |
| 11919 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 11920 | if (_control_interface_info.parent_struct.properties == NULL) |
| 11921 | goto out; |
| 11922 | for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 11923 | { |
| 11924 | GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n]; |
| 11925 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 11926 | { |
| 11927 | GVariant *value; |
| 11928 | 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); |
| 11929 | if (value != NULL) |
| 11930 | { |
| 11931 | g_variant_take_ref (value); |
| 11932 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 11933 | g_variant_unref (value); |
| 11934 | } |
| 11935 | } |
| 11936 | } |
| 11937 | out: |
| 11938 | return g_variant_builder_end (&builder); |
| 11939 | } |
| 11940 | |
| 11941 | static gboolean _control_emit_changed (gpointer user_data); |
| 11942 | |
| 11943 | static void |
| 11944 | control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 11945 | { |
| 11946 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 11947 | gboolean emit_changed = FALSE; |
| 11948 | |
| 11949 | g_mutex_lock (&skeleton->priv->lock); |
| 11950 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 11951 | { |
| 11952 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 11953 | skeleton->priv->changed_properties_idle_source = NULL; |
| 11954 | emit_changed = TRUE; |
| 11955 | } |
| 11956 | g_mutex_unlock (&skeleton->priv->lock); |
| 11957 | |
| 11958 | if (emit_changed) |
| 11959 | _control_emit_changed (skeleton); |
| 11960 | } |
| 11961 | |
| 11962 | static void |
| 11963 | _control_on_signal_heartbeat ( |
| 11964 | Control *object, |
| 11965 | const gchar *arg_bus_name) |
| 11966 | { |
| 11967 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 11968 | |
| 11969 | GList *connections, *l; |
| 11970 | GVariant *signal_variant; |
| 11971 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 11972 | |
| 11973 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 11974 | arg_bus_name)); |
| 11975 | for (l = connections; l != NULL; l = l->next) |
| 11976 | { |
| 11977 | GDBusConnection *connection = l->data; |
| 11978 | g_dbus_connection_emit_signal (connection, |
| 11979 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat", |
| 11980 | signal_variant, NULL); |
| 11981 | } |
| 11982 | g_variant_unref (signal_variant); |
| 11983 | g_list_free_full (connections, g_object_unref); |
| 11984 | } |
| 11985 | |
| 11986 | static void |
| 11987 | _control_on_signal_goto_system_state ( |
| 11988 | Control *object, |
| 11989 | const gchar *arg_state_name) |
| 11990 | { |
| 11991 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 11992 | |
| 11993 | GList *connections, *l; |
| 11994 | GVariant *signal_variant; |
| 11995 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 11996 | |
| 11997 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 11998 | arg_state_name)); |
| 11999 | for (l = connections; l != NULL; l = l->next) |
| 12000 | { |
| 12001 | GDBusConnection *connection = l->data; |
| 12002 | g_dbus_connection_emit_signal (connection, |
| 12003 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState", |
| 12004 | signal_variant, NULL); |
| 12005 | } |
| 12006 | g_variant_unref (signal_variant); |
| 12007 | g_list_free_full (connections, g_object_unref); |
| 12008 | } |
| 12009 | |
| 12010 | static void control_skeleton_iface_init (ControlIface *iface); |
| 12011 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12012 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12013 | G_ADD_PRIVATE (ControlSkeleton) |
| 12014 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12015 | |
| 12016 | #else |
| 12017 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12018 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12019 | |
| 12020 | #endif |
| 12021 | static void |
| 12022 | control_skeleton_finalize (GObject *object) |
| 12023 | { |
| 12024 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12025 | guint n; |
| 12026 | for (n = 0; n < 2; n++) |
| 12027 | g_value_unset (&skeleton->priv->properties[n]); |
| 12028 | g_free (skeleton->priv->properties); |
| 12029 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12030 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12031 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12032 | g_main_context_unref (skeleton->priv->context); |
| 12033 | g_mutex_clear (&skeleton->priv->lock); |
| 12034 | G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object); |
| 12035 | } |
| 12036 | |
| 12037 | static void |
| 12038 | control_skeleton_get_property (GObject *object, |
| 12039 | guint prop_id, |
| 12040 | GValue *value, |
| 12041 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12042 | { |
| 12043 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12044 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12045 | g_mutex_lock (&skeleton->priv->lock); |
| 12046 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 12047 | g_mutex_unlock (&skeleton->priv->lock); |
| 12048 | } |
| 12049 | |
| 12050 | static gboolean |
| 12051 | _control_emit_changed (gpointer user_data) |
| 12052 | { |
| 12053 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12054 | GList *l; |
| 12055 | GVariantBuilder builder; |
| 12056 | GVariantBuilder invalidated_builder; |
| 12057 | guint num_changes; |
| 12058 | |
| 12059 | g_mutex_lock (&skeleton->priv->lock); |
| 12060 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12061 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 12062 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 12063 | { |
| 12064 | ChangedProperty *cp = l->data; |
| 12065 | GVariant *variant; |
| 12066 | const GValue *cur_value; |
| 12067 | |
| 12068 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 12069 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 12070 | { |
| 12071 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 12072 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 12073 | g_variant_unref (variant); |
| 12074 | num_changes++; |
| 12075 | } |
| 12076 | } |
| 12077 | if (num_changes > 0) |
| 12078 | { |
| 12079 | GList *connections, *ll; |
| 12080 | GVariant *signal_variant; |
| 12081 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control", |
| 12082 | &builder, &invalidated_builder)); |
| 12083 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12084 | for (ll = connections; ll != NULL; ll = ll->next) |
| 12085 | { |
| 12086 | GDBusConnection *connection = ll->data; |
| 12087 | |
| 12088 | g_dbus_connection_emit_signal (connection, |
| 12089 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 12090 | "org.freedesktop.DBus.Properties", |
| 12091 | "PropertiesChanged", |
| 12092 | signal_variant, |
| 12093 | NULL); |
| 12094 | } |
| 12095 | g_variant_unref (signal_variant); |
| 12096 | g_list_free_full (connections, g_object_unref); |
| 12097 | } |
| 12098 | else |
| 12099 | { |
| 12100 | g_variant_builder_clear (&builder); |
| 12101 | g_variant_builder_clear (&invalidated_builder); |
| 12102 | } |
| 12103 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12104 | skeleton->priv->changed_properties = NULL; |
| 12105 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12106 | g_mutex_unlock (&skeleton->priv->lock); |
| 12107 | return FALSE; |
| 12108 | } |
| 12109 | |
| 12110 | static void |
| 12111 | _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 12112 | { |
| 12113 | ChangedProperty *cp; |
| 12114 | GList *l; |
| 12115 | cp = NULL; |
| 12116 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 12117 | { |
| 12118 | ChangedProperty *i_cp = l->data; |
| 12119 | if (i_cp->info == info) |
| 12120 | { |
| 12121 | cp = i_cp; |
| 12122 | break; |
| 12123 | } |
| 12124 | } |
| 12125 | if (cp == NULL) |
| 12126 | { |
| 12127 | cp = g_new0 (ChangedProperty, 1); |
| 12128 | cp->prop_id = prop_id; |
| 12129 | cp->info = info; |
| 12130 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 12131 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 12132 | g_value_copy (orig_value, &cp->orig_value); |
| 12133 | } |
| 12134 | } |
| 12135 | |
| 12136 | static void |
| 12137 | control_skeleton_notify (GObject *object, |
| 12138 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12139 | { |
| 12140 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12141 | g_mutex_lock (&skeleton->priv->lock); |
| 12142 | if (skeleton->priv->changed_properties != NULL && |
| 12143 | skeleton->priv->changed_properties_idle_source == NULL) |
| 12144 | { |
| 12145 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 12146 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 12147 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 12148 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 12149 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 12150 | } |
| 12151 | g_mutex_unlock (&skeleton->priv->lock); |
| 12152 | } |
| 12153 | |
| 12154 | static void |
| 12155 | control_skeleton_set_property (GObject *object, |
| 12156 | guint prop_id, |
| 12157 | const GValue *value, |
| 12158 | GParamSpec *pspec) |
| 12159 | { |
| 12160 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12161 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12162 | g_mutex_lock (&skeleton->priv->lock); |
| 12163 | g_object_freeze_notify (object); |
| 12164 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 12165 | { |
| 12166 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 12167 | _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 12168 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 12169 | g_object_notify_by_pspec (object, pspec); |
| 12170 | } |
| 12171 | g_mutex_unlock (&skeleton->priv->lock); |
| 12172 | g_object_thaw_notify (object); |
| 12173 | } |
| 12174 | |
| 12175 | static void |
| 12176 | control_skeleton_init (ControlSkeleton *skeleton) |
| 12177 | { |
| 12178 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12179 | skeleton->priv = control_skeleton_get_instance_private (skeleton); |
| 12180 | #else |
| 12181 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate); |
| 12182 | #endif |
| 12183 | |
| 12184 | g_mutex_init (&skeleton->priv->lock); |
| 12185 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 12186 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 12187 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 12188 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 12189 | } |
| 12190 | |
| 12191 | static gint |
| 12192 | control_skeleton_get_poll_interval (Control *object) |
| 12193 | { |
| 12194 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12195 | gint value; |
| 12196 | g_mutex_lock (&skeleton->priv->lock); |
| 12197 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 12198 | g_mutex_unlock (&skeleton->priv->lock); |
| 12199 | return value; |
| 12200 | } |
| 12201 | |
| 12202 | static gint |
| 12203 | control_skeleton_get_heatbeat (Control *object) |
| 12204 | { |
| 12205 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12206 | gint value; |
| 12207 | g_mutex_lock (&skeleton->priv->lock); |
| 12208 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 12209 | g_mutex_unlock (&skeleton->priv->lock); |
| 12210 | return value; |
| 12211 | } |
| 12212 | |
| 12213 | static void |
| 12214 | control_skeleton_class_init (ControlSkeletonClass *klass) |
| 12215 | { |
| 12216 | GObjectClass *gobject_class; |
| 12217 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 12218 | |
| 12219 | gobject_class = G_OBJECT_CLASS (klass); |
| 12220 | gobject_class->finalize = control_skeleton_finalize; |
| 12221 | gobject_class->get_property = control_skeleton_get_property; |
| 12222 | gobject_class->set_property = control_skeleton_set_property; |
| 12223 | gobject_class->notify = control_skeleton_notify; |
| 12224 | |
| 12225 | |
| 12226 | control_override_properties (gobject_class, 1); |
| 12227 | |
| 12228 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 12229 | skeleton_class->get_info = control_skeleton_dbus_interface_get_info; |
| 12230 | skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties; |
| 12231 | skeleton_class->flush = control_skeleton_dbus_interface_flush; |
| 12232 | skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable; |
| 12233 | |
| 12234 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12235 | g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate)); |
| 12236 | #endif |
| 12237 | } |
| 12238 | |
| 12239 | static void |
| 12240 | control_skeleton_iface_init (ControlIface *iface) |
| 12241 | { |
| 12242 | iface->heartbeat = _control_on_signal_heartbeat; |
| 12243 | iface->goto_system_state = _control_on_signal_goto_system_state; |
| 12244 | iface->get_poll_interval = control_skeleton_get_poll_interval; |
| 12245 | iface->get_heatbeat = control_skeleton_get_heatbeat; |
| 12246 | } |
| 12247 | |
| 12248 | /** |
| 12249 | * control_skeleton_new: |
| 12250 | * |
| 12251 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 12252 | * |
| 12253 | * Returns: (transfer full) (type ControlSkeleton): The skeleton object. |
| 12254 | */ |
| 12255 | Control * |
| 12256 | control_skeleton_new (void) |
| 12257 | { |
| 12258 | return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL)); |
| 12259 | } |
| 12260 | |
| 12261 | /* ------------------------------------------------------------------------ |
| 12262 | * Code for interface org.openbmc.control.Bmc |
| 12263 | * ------------------------------------------------------------------------ |
| 12264 | */ |
| 12265 | |
| 12266 | /** |
| 12267 | * SECTION:ControlBmc |
| 12268 | * @title: ControlBmc |
| 12269 | * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface |
| 12270 | * |
| 12271 | * 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. |
| 12272 | */ |
| 12273 | |
| 12274 | /* ---- Introspection data for org.openbmc.control.Bmc ---- */ |
| 12275 | |
| 12276 | static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder = |
| 12277 | { |
| 12278 | { |
| 12279 | -1, |
| 12280 | (gchar *) "place_holder", |
| 12281 | NULL, |
| 12282 | NULL, |
| 12283 | NULL |
| 12284 | }, |
| 12285 | "handle-place-holder", |
| 12286 | FALSE |
| 12287 | }; |
| 12288 | |
| 12289 | static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] = |
| 12290 | { |
| 12291 | &_control_bmc_method_info_place_holder, |
| 12292 | NULL |
| 12293 | }; |
| 12294 | |
| 12295 | static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info = |
| 12296 | { |
| 12297 | { |
| 12298 | -1, |
| 12299 | (gchar *) "org.openbmc.control.Bmc", |
| 12300 | (GDBusMethodInfo **) &_control_bmc_method_info_pointers, |
| 12301 | NULL, |
| 12302 | NULL, |
| 12303 | NULL |
| 12304 | }, |
| 12305 | "control-bmc", |
| 12306 | }; |
| 12307 | |
| 12308 | |
| 12309 | /** |
| 12310 | * control_bmc_interface_info: |
| 12311 | * |
| 12312 | * 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. |
| 12313 | * |
| 12314 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 12315 | */ |
| 12316 | GDBusInterfaceInfo * |
| 12317 | control_bmc_interface_info (void) |
| 12318 | { |
| 12319 | return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct; |
| 12320 | } |
| 12321 | |
| 12322 | /** |
| 12323 | * control_bmc_override_properties: |
| 12324 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 12325 | * @property_id_begin: The property id to assign to the first overridden property. |
| 12326 | * |
| 12327 | * Overrides all #GObject properties in the #ControlBmc interface for a concrete class. |
| 12328 | * The properties are overridden in the order they are defined. |
| 12329 | * |
| 12330 | * Returns: The last property id. |
| 12331 | */ |
| 12332 | guint |
| 12333 | control_bmc_override_properties (GObjectClass *klass, guint property_id_begin) |
| 12334 | { |
| 12335 | return property_id_begin - 1; |
| 12336 | } |
| 12337 | |
| 12338 | |
| 12339 | |
| 12340 | /** |
| 12341 | * ControlBmc: |
| 12342 | * |
| 12343 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 12344 | */ |
| 12345 | |
| 12346 | /** |
| 12347 | * ControlBmcIface: |
| 12348 | * @parent_iface: The parent interface. |
| 12349 | * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal. |
| 12350 | * |
| 12351 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 12352 | */ |
| 12353 | |
| 12354 | typedef ControlBmcIface ControlBmcInterface; |
| 12355 | G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT); |
| 12356 | |
| 12357 | static void |
| 12358 | control_bmc_default_init (ControlBmcIface *iface) |
| 12359 | { |
| 12360 | /* GObject signals for incoming D-Bus method calls: */ |
| 12361 | /** |
| 12362 | * ControlBmc::handle-place-holder: |
| 12363 | * @object: A #ControlBmc. |
| 12364 | * @invocation: A #GDBusMethodInvocation. |
| 12365 | * |
| 12366 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method. |
| 12367 | * |
| 12368 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_place_holder() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 12369 | * |
| 12370 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 12371 | */ |
| 12372 | g_signal_new ("handle-place-holder", |
| 12373 | G_TYPE_FROM_INTERFACE (iface), |
| 12374 | G_SIGNAL_RUN_LAST, |
| 12375 | G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder), |
| 12376 | g_signal_accumulator_true_handled, |
| 12377 | NULL, |
| 12378 | g_cclosure_marshal_generic, |
| 12379 | G_TYPE_BOOLEAN, |
| 12380 | 1, |
| 12381 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 12382 | |
| 12383 | } |
| 12384 | |
| 12385 | /** |
| 12386 | * control_bmc_call_place_holder: |
| 12387 | * @proxy: A #ControlBmcProxy. |
| 12388 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12389 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 12390 | * @user_data: User data to pass to @callback. |
| 12391 | * |
| 12392 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. |
| 12393 | * 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. |
| 12394 | * You can then call control_bmc_call_place_holder_finish() to get the result of the operation. |
| 12395 | * |
| 12396 | * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method. |
| 12397 | */ |
| 12398 | void |
| 12399 | control_bmc_call_place_holder ( |
| 12400 | ControlBmc *proxy, |
| 12401 | GCancellable *cancellable, |
| 12402 | GAsyncReadyCallback callback, |
| 12403 | gpointer user_data) |
| 12404 | { |
| 12405 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 12406 | "place_holder", |
| 12407 | g_variant_new ("()"), |
| 12408 | G_DBUS_CALL_FLAGS_NONE, |
| 12409 | -1, |
| 12410 | cancellable, |
| 12411 | callback, |
| 12412 | user_data); |
| 12413 | } |
| 12414 | |
| 12415 | /** |
| 12416 | * control_bmc_call_place_holder_finish: |
| 12417 | * @proxy: A #ControlBmcProxy. |
| 12418 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder(). |
| 12419 | * @error: Return location for error or %NULL. |
| 12420 | * |
| 12421 | * Finishes an operation started with control_bmc_call_place_holder(). |
| 12422 | * |
| 12423 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12424 | */ |
| 12425 | gboolean |
| 12426 | control_bmc_call_place_holder_finish ( |
| 12427 | ControlBmc *proxy, |
| 12428 | GAsyncResult *res, |
| 12429 | GError **error) |
| 12430 | { |
| 12431 | GVariant *_ret; |
| 12432 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 12433 | if (_ret == NULL) |
| 12434 | goto _out; |
| 12435 | g_variant_get (_ret, |
| 12436 | "()"); |
| 12437 | g_variant_unref (_ret); |
| 12438 | _out: |
| 12439 | return _ret != NULL; |
| 12440 | } |
| 12441 | |
| 12442 | /** |
| 12443 | * control_bmc_call_place_holder_sync: |
| 12444 | * @proxy: A #ControlBmcProxy. |
| 12445 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12446 | * @error: Return location for error or %NULL. |
| 12447 | * |
| 12448 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 12449 | * |
| 12450 | * See control_bmc_call_place_holder() for the asynchronous version of this method. |
| 12451 | * |
| 12452 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12453 | */ |
| 12454 | gboolean |
| 12455 | control_bmc_call_place_holder_sync ( |
| 12456 | ControlBmc *proxy, |
| 12457 | GCancellable *cancellable, |
| 12458 | GError **error) |
| 12459 | { |
| 12460 | GVariant *_ret; |
| 12461 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 12462 | "place_holder", |
| 12463 | g_variant_new ("()"), |
| 12464 | G_DBUS_CALL_FLAGS_NONE, |
| 12465 | -1, |
| 12466 | cancellable, |
| 12467 | error); |
| 12468 | if (_ret == NULL) |
| 12469 | goto _out; |
| 12470 | g_variant_get (_ret, |
| 12471 | "()"); |
| 12472 | g_variant_unref (_ret); |
| 12473 | _out: |
| 12474 | return _ret != NULL; |
| 12475 | } |
| 12476 | |
| 12477 | /** |
| 12478 | * control_bmc_complete_place_holder: |
| 12479 | * @object: A #ControlBmc. |
| 12480 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 12481 | * |
| 12482 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 12483 | * |
| 12484 | * This method will free @invocation, you cannot use it afterwards. |
| 12485 | */ |
| 12486 | void |
| 12487 | control_bmc_complete_place_holder ( |
| 12488 | ControlBmc *object, |
| 12489 | GDBusMethodInvocation *invocation) |
| 12490 | { |
| 12491 | g_dbus_method_invocation_return_value (invocation, |
| 12492 | g_variant_new ("()")); |
| 12493 | } |
| 12494 | |
| 12495 | /* ------------------------------------------------------------------------ */ |
| 12496 | |
| 12497 | /** |
| 12498 | * ControlBmcProxy: |
| 12499 | * |
| 12500 | * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API. |
| 12501 | */ |
| 12502 | |
| 12503 | /** |
| 12504 | * ControlBmcProxyClass: |
| 12505 | * @parent_class: The parent class. |
| 12506 | * |
| 12507 | * Class structure for #ControlBmcProxy. |
| 12508 | */ |
| 12509 | |
| 12510 | struct _ControlBmcProxyPrivate |
| 12511 | { |
| 12512 | GData *qdata; |
| 12513 | }; |
| 12514 | |
| 12515 | static void control_bmc_proxy_iface_init (ControlBmcIface *iface); |
| 12516 | |
| 12517 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12518 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 12519 | G_ADD_PRIVATE (ControlBmcProxy) |
| 12520 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 12521 | |
| 12522 | #else |
| 12523 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 12524 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 12525 | |
| 12526 | #endif |
| 12527 | static void |
| 12528 | control_bmc_proxy_finalize (GObject *object) |
| 12529 | { |
| 12530 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object); |
| 12531 | g_datalist_clear (&proxy->priv->qdata); |
| 12532 | G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object); |
| 12533 | } |
| 12534 | |
| 12535 | static void |
| 12536 | control_bmc_proxy_get_property (GObject *object, |
| 12537 | guint prop_id, |
| 12538 | GValue *value, |
| 12539 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12540 | { |
| 12541 | } |
| 12542 | |
| 12543 | static void |
| 12544 | control_bmc_proxy_set_property (GObject *object, |
| 12545 | guint prop_id, |
| 12546 | const GValue *value, |
| 12547 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12548 | { |
| 12549 | } |
| 12550 | |
| 12551 | static void |
| 12552 | control_bmc_proxy_g_signal (GDBusProxy *proxy, |
| 12553 | const gchar *sender_name G_GNUC_UNUSED, |
| 12554 | const gchar *signal_name, |
| 12555 | GVariant *parameters) |
| 12556 | { |
| 12557 | _ExtendedGDBusSignalInfo *info; |
| 12558 | GVariantIter iter; |
| 12559 | GVariant *child; |
| 12560 | GValue *paramv; |
| 12561 | guint num_params; |
| 12562 | guint n; |
| 12563 | guint signal_id; |
| 12564 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name); |
| 12565 | if (info == NULL) |
| 12566 | return; |
| 12567 | num_params = g_variant_n_children (parameters); |
| 12568 | paramv = g_new0 (GValue, num_params + 1); |
| 12569 | g_value_init (¶mv[0], TYPE_CONTROL_BMC); |
| 12570 | g_value_set_object (¶mv[0], proxy); |
| 12571 | g_variant_iter_init (&iter, parameters); |
| 12572 | n = 1; |
| 12573 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12574 | { |
| 12575 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 12576 | if (arg_info->use_gvariant) |
| 12577 | { |
| 12578 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12579 | g_value_set_variant (¶mv[n], child); |
| 12580 | n++; |
| 12581 | } |
| 12582 | else |
| 12583 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12584 | g_variant_unref (child); |
| 12585 | } |
| 12586 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 12587 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 12588 | for (n = 0; n < num_params + 1; n++) |
| 12589 | g_value_unset (¶mv[n]); |
| 12590 | g_free (paramv); |
| 12591 | } |
| 12592 | |
| 12593 | static void |
| 12594 | control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 12595 | GVariant *changed_properties, |
| 12596 | const gchar *const *invalidated_properties) |
| 12597 | { |
| 12598 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy); |
| 12599 | guint n; |
| 12600 | const gchar *key; |
| 12601 | GVariantIter *iter; |
| 12602 | _ExtendedGDBusPropertyInfo *info; |
| 12603 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 12604 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 12605 | { |
| 12606 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key); |
| 12607 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 12608 | if (info != NULL) |
| 12609 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12610 | } |
| 12611 | g_variant_iter_free (iter); |
| 12612 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 12613 | { |
| 12614 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]); |
| 12615 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 12616 | if (info != NULL) |
| 12617 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12618 | } |
| 12619 | } |
| 12620 | |
| 12621 | static void |
| 12622 | control_bmc_proxy_init (ControlBmcProxy *proxy) |
| 12623 | { |
| 12624 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12625 | proxy->priv = control_bmc_proxy_get_instance_private (proxy); |
| 12626 | #else |
| 12627 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate); |
| 12628 | #endif |
| 12629 | |
| 12630 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ()); |
| 12631 | } |
| 12632 | |
| 12633 | static void |
| 12634 | control_bmc_proxy_class_init (ControlBmcProxyClass *klass) |
| 12635 | { |
| 12636 | GObjectClass *gobject_class; |
| 12637 | GDBusProxyClass *proxy_class; |
| 12638 | |
| 12639 | gobject_class = G_OBJECT_CLASS (klass); |
| 12640 | gobject_class->finalize = control_bmc_proxy_finalize; |
| 12641 | gobject_class->get_property = control_bmc_proxy_get_property; |
| 12642 | gobject_class->set_property = control_bmc_proxy_set_property; |
| 12643 | |
| 12644 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 12645 | proxy_class->g_signal = control_bmc_proxy_g_signal; |
| 12646 | proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed; |
| 12647 | |
| 12648 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12649 | g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate)); |
| 12650 | #endif |
| 12651 | } |
| 12652 | |
| 12653 | static void |
| 12654 | control_bmc_proxy_iface_init (ControlBmcIface *iface) |
| 12655 | { |
| 12656 | } |
| 12657 | |
| 12658 | /** |
| 12659 | * control_bmc_proxy_new: |
| 12660 | * @connection: A #GDBusConnection. |
| 12661 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12662 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12663 | * @object_path: An object path. |
| 12664 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12665 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12666 | * @user_data: User data to pass to @callback. |
| 12667 | * |
| 12668 | * 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. |
| 12669 | * |
| 12670 | * 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. |
| 12671 | * You can then call control_bmc_proxy_new_finish() to get the result of the operation. |
| 12672 | * |
| 12673 | * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 12674 | */ |
| 12675 | void |
| 12676 | control_bmc_proxy_new ( |
| 12677 | GDBusConnection *connection, |
| 12678 | GDBusProxyFlags flags, |
| 12679 | const gchar *name, |
| 12680 | const gchar *object_path, |
| 12681 | GCancellable *cancellable, |
| 12682 | GAsyncReadyCallback callback, |
| 12683 | gpointer user_data) |
| 12684 | { |
| 12685 | 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); |
| 12686 | } |
| 12687 | |
| 12688 | /** |
| 12689 | * control_bmc_proxy_new_finish: |
| 12690 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new(). |
| 12691 | * @error: Return location for error or %NULL |
| 12692 | * |
| 12693 | * Finishes an operation started with control_bmc_proxy_new(). |
| 12694 | * |
| 12695 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12696 | */ |
| 12697 | ControlBmc * |
| 12698 | control_bmc_proxy_new_finish ( |
| 12699 | GAsyncResult *res, |
| 12700 | GError **error) |
| 12701 | { |
| 12702 | GObject *ret; |
| 12703 | GObject *source_object; |
| 12704 | source_object = g_async_result_get_source_object (res); |
| 12705 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12706 | g_object_unref (source_object); |
| 12707 | if (ret != NULL) |
| 12708 | return CONTROL_BMC (ret); |
| 12709 | else |
| 12710 | return NULL; |
| 12711 | } |
| 12712 | |
| 12713 | /** |
| 12714 | * control_bmc_proxy_new_sync: |
| 12715 | * @connection: A #GDBusConnection. |
| 12716 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12717 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12718 | * @object_path: An object path. |
| 12719 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12720 | * @error: Return location for error or %NULL |
| 12721 | * |
| 12722 | * 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. |
| 12723 | * |
| 12724 | * The calling thread is blocked until a reply is received. |
| 12725 | * |
| 12726 | * See control_bmc_proxy_new() for the asynchronous version of this constructor. |
| 12727 | * |
| 12728 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12729 | */ |
| 12730 | ControlBmc * |
| 12731 | control_bmc_proxy_new_sync ( |
| 12732 | GDBusConnection *connection, |
| 12733 | GDBusProxyFlags flags, |
| 12734 | const gchar *name, |
| 12735 | const gchar *object_path, |
| 12736 | GCancellable *cancellable, |
| 12737 | GError **error) |
| 12738 | { |
| 12739 | GInitable *ret; |
| 12740 | 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); |
| 12741 | if (ret != NULL) |
| 12742 | return CONTROL_BMC (ret); |
| 12743 | else |
| 12744 | return NULL; |
| 12745 | } |
| 12746 | |
| 12747 | |
| 12748 | /** |
| 12749 | * control_bmc_proxy_new_for_bus: |
| 12750 | * @bus_type: A #GBusType. |
| 12751 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12752 | * @name: A bus name (well-known or unique). |
| 12753 | * @object_path: An object path. |
| 12754 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12755 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12756 | * @user_data: User data to pass to @callback. |
| 12757 | * |
| 12758 | * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 12759 | * |
| 12760 | * 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. |
| 12761 | * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation. |
| 12762 | * |
| 12763 | * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 12764 | */ |
| 12765 | void |
| 12766 | control_bmc_proxy_new_for_bus ( |
| 12767 | GBusType bus_type, |
| 12768 | GDBusProxyFlags flags, |
| 12769 | const gchar *name, |
| 12770 | const gchar *object_path, |
| 12771 | GCancellable *cancellable, |
| 12772 | GAsyncReadyCallback callback, |
| 12773 | gpointer user_data) |
| 12774 | { |
| 12775 | 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); |
| 12776 | } |
| 12777 | |
| 12778 | /** |
| 12779 | * control_bmc_proxy_new_for_bus_finish: |
| 12780 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus(). |
| 12781 | * @error: Return location for error or %NULL |
| 12782 | * |
| 12783 | * Finishes an operation started with control_bmc_proxy_new_for_bus(). |
| 12784 | * |
| 12785 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12786 | */ |
| 12787 | ControlBmc * |
| 12788 | control_bmc_proxy_new_for_bus_finish ( |
| 12789 | GAsyncResult *res, |
| 12790 | GError **error) |
| 12791 | { |
| 12792 | GObject *ret; |
| 12793 | GObject *source_object; |
| 12794 | source_object = g_async_result_get_source_object (res); |
| 12795 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12796 | g_object_unref (source_object); |
| 12797 | if (ret != NULL) |
| 12798 | return CONTROL_BMC (ret); |
| 12799 | else |
| 12800 | return NULL; |
| 12801 | } |
| 12802 | |
| 12803 | /** |
| 12804 | * control_bmc_proxy_new_for_bus_sync: |
| 12805 | * @bus_type: A #GBusType. |
| 12806 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12807 | * @name: A bus name (well-known or unique). |
| 12808 | * @object_path: An object path. |
| 12809 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12810 | * @error: Return location for error or %NULL |
| 12811 | * |
| 12812 | * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 12813 | * |
| 12814 | * The calling thread is blocked until a reply is received. |
| 12815 | * |
| 12816 | * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 12817 | * |
| 12818 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12819 | */ |
| 12820 | ControlBmc * |
| 12821 | control_bmc_proxy_new_for_bus_sync ( |
| 12822 | GBusType bus_type, |
| 12823 | GDBusProxyFlags flags, |
| 12824 | const gchar *name, |
| 12825 | const gchar *object_path, |
| 12826 | GCancellable *cancellable, |
| 12827 | GError **error) |
| 12828 | { |
| 12829 | GInitable *ret; |
| 12830 | 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); |
| 12831 | if (ret != NULL) |
| 12832 | return CONTROL_BMC (ret); |
| 12833 | else |
| 12834 | return NULL; |
| 12835 | } |
| 12836 | |
| 12837 | |
| 12838 | /* ------------------------------------------------------------------------ */ |
| 12839 | |
| 12840 | /** |
| 12841 | * ControlBmcSkeleton: |
| 12842 | * |
| 12843 | * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API. |
| 12844 | */ |
| 12845 | |
| 12846 | /** |
| 12847 | * ControlBmcSkeletonClass: |
| 12848 | * @parent_class: The parent class. |
| 12849 | * |
| 12850 | * Class structure for #ControlBmcSkeleton. |
| 12851 | */ |
| 12852 | |
| 12853 | struct _ControlBmcSkeletonPrivate |
| 12854 | { |
| 12855 | GValue *properties; |
| 12856 | GList *changed_properties; |
| 12857 | GSource *changed_properties_idle_source; |
| 12858 | GMainContext *context; |
| 12859 | GMutex lock; |
| 12860 | }; |
| 12861 | |
| 12862 | static void |
| 12863 | _control_bmc_skeleton_handle_method_call ( |
| 12864 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12865 | const gchar *sender G_GNUC_UNUSED, |
| 12866 | const gchar *object_path G_GNUC_UNUSED, |
| 12867 | const gchar *interface_name, |
| 12868 | const gchar *method_name, |
| 12869 | GVariant *parameters, |
| 12870 | GDBusMethodInvocation *invocation, |
| 12871 | gpointer user_data) |
| 12872 | { |
| 12873 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 12874 | _ExtendedGDBusMethodInfo *info; |
| 12875 | GVariantIter iter; |
| 12876 | GVariant *child; |
| 12877 | GValue *paramv; |
| 12878 | guint num_params; |
| 12879 | guint num_extra; |
| 12880 | guint n; |
| 12881 | guint signal_id; |
| 12882 | GValue return_value = G_VALUE_INIT; |
| 12883 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 12884 | g_assert (info != NULL); |
| 12885 | num_params = g_variant_n_children (parameters); |
| 12886 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 12887 | n = 0; |
| 12888 | g_value_init (¶mv[n], TYPE_CONTROL_BMC); |
| 12889 | g_value_set_object (¶mv[n++], skeleton); |
| 12890 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 12891 | g_value_set_object (¶mv[n++], invocation); |
| 12892 | if (info->pass_fdlist) |
| 12893 | { |
| 12894 | #ifdef G_OS_UNIX |
| 12895 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 12896 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 12897 | #else |
| 12898 | g_assert_not_reached (); |
| 12899 | #endif |
| 12900 | } |
| 12901 | g_variant_iter_init (&iter, parameters); |
| 12902 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12903 | { |
| 12904 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 12905 | if (arg_info->use_gvariant) |
| 12906 | { |
| 12907 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12908 | g_value_set_variant (¶mv[n], child); |
| 12909 | n++; |
| 12910 | } |
| 12911 | else |
| 12912 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12913 | g_variant_unref (child); |
| 12914 | } |
| 12915 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 12916 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 12917 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 12918 | if (!g_value_get_boolean (&return_value)) |
| 12919 | 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); |
| 12920 | g_value_unset (&return_value); |
| 12921 | for (n = 0; n < num_params + num_extra; n++) |
| 12922 | g_value_unset (¶mv[n]); |
| 12923 | g_free (paramv); |
| 12924 | } |
| 12925 | |
| 12926 | static GVariant * |
| 12927 | _control_bmc_skeleton_handle_get_property ( |
| 12928 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12929 | const gchar *sender G_GNUC_UNUSED, |
| 12930 | const gchar *object_path G_GNUC_UNUSED, |
| 12931 | const gchar *interface_name G_GNUC_UNUSED, |
| 12932 | const gchar *property_name, |
| 12933 | GError **error, |
| 12934 | gpointer user_data) |
| 12935 | { |
| 12936 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 12937 | GValue value = G_VALUE_INIT; |
| 12938 | GParamSpec *pspec; |
| 12939 | _ExtendedGDBusPropertyInfo *info; |
| 12940 | GVariant *ret; |
| 12941 | ret = NULL; |
| 12942 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 12943 | g_assert (info != NULL); |
| 12944 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12945 | if (pspec == NULL) |
| 12946 | { |
| 12947 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12948 | } |
| 12949 | else |
| 12950 | { |
| 12951 | g_value_init (&value, pspec->value_type); |
| 12952 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12953 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 12954 | g_value_unset (&value); |
| 12955 | } |
| 12956 | return ret; |
| 12957 | } |
| 12958 | |
| 12959 | static gboolean |
| 12960 | _control_bmc_skeleton_handle_set_property ( |
| 12961 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12962 | const gchar *sender G_GNUC_UNUSED, |
| 12963 | const gchar *object_path G_GNUC_UNUSED, |
| 12964 | const gchar *interface_name G_GNUC_UNUSED, |
| 12965 | const gchar *property_name, |
| 12966 | GVariant *variant, |
| 12967 | GError **error, |
| 12968 | gpointer user_data) |
| 12969 | { |
| 12970 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 12971 | GValue value = G_VALUE_INIT; |
| 12972 | GParamSpec *pspec; |
| 12973 | _ExtendedGDBusPropertyInfo *info; |
| 12974 | gboolean ret; |
| 12975 | ret = FALSE; |
| 12976 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 12977 | g_assert (info != NULL); |
| 12978 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12979 | if (pspec == NULL) |
| 12980 | { |
| 12981 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12982 | } |
| 12983 | else |
| 12984 | { |
| 12985 | if (info->use_gvariant) |
| 12986 | g_value_set_variant (&value, variant); |
| 12987 | else |
| 12988 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 12989 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12990 | g_value_unset (&value); |
| 12991 | ret = TRUE; |
| 12992 | } |
| 12993 | return ret; |
| 12994 | } |
| 12995 | |
| 12996 | static const GDBusInterfaceVTable _control_bmc_skeleton_vtable = |
| 12997 | { |
| 12998 | _control_bmc_skeleton_handle_method_call, |
| 12999 | _control_bmc_skeleton_handle_get_property, |
| 13000 | _control_bmc_skeleton_handle_set_property, |
| 13001 | {NULL} |
| 13002 | }; |
| 13003 | |
| 13004 | static GDBusInterfaceInfo * |
| 13005 | control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13006 | { |
| 13007 | return control_bmc_interface_info (); |
| 13008 | } |
| 13009 | |
| 13010 | static GDBusInterfaceVTable * |
| 13011 | control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13012 | { |
| 13013 | return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable; |
| 13014 | } |
| 13015 | |
| 13016 | static GVariant * |
| 13017 | control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 13018 | { |
| 13019 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton); |
| 13020 | |
| 13021 | GVariantBuilder builder; |
| 13022 | guint n; |
| 13023 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 13024 | if (_control_bmc_interface_info.parent_struct.properties == NULL) |
| 13025 | goto out; |
| 13026 | for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++) |
| 13027 | { |
| 13028 | GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n]; |
| 13029 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 13030 | { |
| 13031 | GVariant *value; |
| 13032 | 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); |
| 13033 | if (value != NULL) |
| 13034 | { |
| 13035 | g_variant_take_ref (value); |
| 13036 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 13037 | g_variant_unref (value); |
| 13038 | } |
| 13039 | } |
| 13040 | } |
| 13041 | out: |
| 13042 | return g_variant_builder_end (&builder); |
| 13043 | } |
| 13044 | |
| 13045 | static void |
| 13046 | control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 13047 | { |
| 13048 | } |
| 13049 | |
| 13050 | static void control_bmc_skeleton_iface_init (ControlBmcIface *iface); |
| 13051 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13052 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13053 | G_ADD_PRIVATE (ControlBmcSkeleton) |
| 13054 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13055 | |
| 13056 | #else |
| 13057 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13058 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13059 | |
| 13060 | #endif |
| 13061 | static void |
| 13062 | control_bmc_skeleton_finalize (GObject *object) |
| 13063 | { |
| 13064 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object); |
| 13065 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 13066 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 13067 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 13068 | g_main_context_unref (skeleton->priv->context); |
| 13069 | g_mutex_clear (&skeleton->priv->lock); |
| 13070 | G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object); |
| 13071 | } |
| 13072 | |
| 13073 | static void |
| 13074 | control_bmc_skeleton_init (ControlBmcSkeleton *skeleton) |
| 13075 | { |
| 13076 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13077 | skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton); |
| 13078 | #else |
| 13079 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate); |
| 13080 | #endif |
| 13081 | |
| 13082 | g_mutex_init (&skeleton->priv->lock); |
| 13083 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 13084 | } |
| 13085 | |
| 13086 | static void |
| 13087 | control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass) |
| 13088 | { |
| 13089 | GObjectClass *gobject_class; |
| 13090 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 13091 | |
| 13092 | gobject_class = G_OBJECT_CLASS (klass); |
| 13093 | gobject_class->finalize = control_bmc_skeleton_finalize; |
| 13094 | |
| 13095 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 13096 | skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info; |
| 13097 | skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties; |
| 13098 | skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush; |
| 13099 | skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable; |
| 13100 | |
| 13101 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13102 | g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate)); |
| 13103 | #endif |
| 13104 | } |
| 13105 | |
| 13106 | static void |
| 13107 | control_bmc_skeleton_iface_init (ControlBmcIface *iface) |
| 13108 | { |
| 13109 | } |
| 13110 | |
| 13111 | /** |
| 13112 | * control_bmc_skeleton_new: |
| 13113 | * |
| 13114 | * 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>. |
| 13115 | * |
| 13116 | * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object. |
| 13117 | */ |
| 13118 | ControlBmc * |
| 13119 | control_bmc_skeleton_new (void) |
| 13120 | { |
| 13121 | return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL)); |
| 13122 | } |
| 13123 | |
| 13124 | /* ------------------------------------------------------------------------ |
| 13125 | * Code for interface org.openbmc.control.Host |
| 13126 | * ------------------------------------------------------------------------ |
| 13127 | */ |
| 13128 | |
| 13129 | /** |
| 13130 | * SECTION:ControlHost |
| 13131 | * @title: ControlHost |
| 13132 | * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface |
| 13133 | * |
| 13134 | * 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. |
| 13135 | */ |
| 13136 | |
| 13137 | /* ---- Introspection data for org.openbmc.control.Host ---- */ |
| 13138 | |
| 13139 | static const _ExtendedGDBusMethodInfo _control_host_method_info_boot = |
| 13140 | { |
| 13141 | { |
| 13142 | -1, |
| 13143 | (gchar *) "boot", |
| 13144 | NULL, |
| 13145 | NULL, |
| 13146 | NULL |
| 13147 | }, |
| 13148 | "handle-boot", |
| 13149 | FALSE |
| 13150 | }; |
| 13151 | |
| 13152 | static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown = |
| 13153 | { |
| 13154 | { |
| 13155 | -1, |
| 13156 | (gchar *) "shutdown", |
| 13157 | NULL, |
| 13158 | NULL, |
| 13159 | NULL |
| 13160 | }, |
| 13161 | "handle-shutdown", |
| 13162 | FALSE |
| 13163 | }; |
| 13164 | |
| 13165 | static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot = |
| 13166 | { |
| 13167 | { |
| 13168 | -1, |
| 13169 | (gchar *) "reboot", |
| 13170 | NULL, |
| 13171 | NULL, |
| 13172 | NULL |
| 13173 | }, |
| 13174 | "handle-reboot", |
| 13175 | FALSE |
| 13176 | }; |
| 13177 | |
| 13178 | static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] = |
| 13179 | { |
| 13180 | &_control_host_method_info_boot, |
| 13181 | &_control_host_method_info_shutdown, |
| 13182 | &_control_host_method_info_reboot, |
| 13183 | NULL |
| 13184 | }; |
| 13185 | |
| 13186 | static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted = |
| 13187 | { |
| 13188 | { |
| 13189 | -1, |
| 13190 | (gchar *) "Booted", |
| 13191 | NULL, |
| 13192 | NULL |
| 13193 | }, |
| 13194 | "booted" |
| 13195 | }; |
| 13196 | |
| 13197 | static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] = |
| 13198 | { |
| 13199 | &_control_host_signal_info_booted, |
| 13200 | NULL |
| 13201 | }; |
| 13202 | |
| 13203 | static const _ExtendedGDBusInterfaceInfo _control_host_interface_info = |
| 13204 | { |
| 13205 | { |
| 13206 | -1, |
| 13207 | (gchar *) "org.openbmc.control.Host", |
| 13208 | (GDBusMethodInfo **) &_control_host_method_info_pointers, |
| 13209 | (GDBusSignalInfo **) &_control_host_signal_info_pointers, |
| 13210 | NULL, |
| 13211 | NULL |
| 13212 | }, |
| 13213 | "control-host", |
| 13214 | }; |
| 13215 | |
| 13216 | |
| 13217 | /** |
| 13218 | * control_host_interface_info: |
| 13219 | * |
| 13220 | * 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. |
| 13221 | * |
| 13222 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 13223 | */ |
| 13224 | GDBusInterfaceInfo * |
| 13225 | control_host_interface_info (void) |
| 13226 | { |
| 13227 | return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct; |
| 13228 | } |
| 13229 | |
| 13230 | /** |
| 13231 | * control_host_override_properties: |
| 13232 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 13233 | * @property_id_begin: The property id to assign to the first overridden property. |
| 13234 | * |
| 13235 | * Overrides all #GObject properties in the #ControlHost interface for a concrete class. |
| 13236 | * The properties are overridden in the order they are defined. |
| 13237 | * |
| 13238 | * Returns: The last property id. |
| 13239 | */ |
| 13240 | guint |
| 13241 | control_host_override_properties (GObjectClass *klass, guint property_id_begin) |
| 13242 | { |
| 13243 | return property_id_begin - 1; |
| 13244 | } |
| 13245 | |
| 13246 | |
| 13247 | |
| 13248 | /** |
| 13249 | * ControlHost: |
| 13250 | * |
| 13251 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 13252 | */ |
| 13253 | |
| 13254 | /** |
| 13255 | * ControlHostIface: |
| 13256 | * @parent_iface: The parent interface. |
| 13257 | * @handle_boot: Handler for the #ControlHost::handle-boot signal. |
| 13258 | * @handle_reboot: Handler for the #ControlHost::handle-reboot signal. |
| 13259 | * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal. |
| 13260 | * @booted: Handler for the #ControlHost::booted signal. |
| 13261 | * |
| 13262 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 13263 | */ |
| 13264 | |
| 13265 | typedef ControlHostIface ControlHostInterface; |
| 13266 | G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT); |
| 13267 | |
| 13268 | static void |
| 13269 | control_host_default_init (ControlHostIface *iface) |
| 13270 | { |
| 13271 | /* GObject signals for incoming D-Bus method calls: */ |
| 13272 | /** |
| 13273 | * ControlHost::handle-boot: |
| 13274 | * @object: A #ControlHost. |
| 13275 | * @invocation: A #GDBusMethodInvocation. |
| 13276 | * |
| 13277 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. |
| 13278 | * |
| 13279 | * 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. |
| 13280 | * |
| 13281 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13282 | */ |
| 13283 | g_signal_new ("handle-boot", |
| 13284 | G_TYPE_FROM_INTERFACE (iface), |
| 13285 | G_SIGNAL_RUN_LAST, |
| 13286 | G_STRUCT_OFFSET (ControlHostIface, handle_boot), |
| 13287 | g_signal_accumulator_true_handled, |
| 13288 | NULL, |
| 13289 | g_cclosure_marshal_generic, |
| 13290 | G_TYPE_BOOLEAN, |
| 13291 | 1, |
| 13292 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13293 | |
| 13294 | /** |
| 13295 | * ControlHost::handle-shutdown: |
| 13296 | * @object: A #ControlHost. |
| 13297 | * @invocation: A #GDBusMethodInvocation. |
| 13298 | * |
| 13299 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. |
| 13300 | * |
| 13301 | * 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. |
| 13302 | * |
| 13303 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13304 | */ |
| 13305 | g_signal_new ("handle-shutdown", |
| 13306 | G_TYPE_FROM_INTERFACE (iface), |
| 13307 | G_SIGNAL_RUN_LAST, |
| 13308 | G_STRUCT_OFFSET (ControlHostIface, handle_shutdown), |
| 13309 | g_signal_accumulator_true_handled, |
| 13310 | NULL, |
| 13311 | g_cclosure_marshal_generic, |
| 13312 | G_TYPE_BOOLEAN, |
| 13313 | 1, |
| 13314 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13315 | |
| 13316 | /** |
| 13317 | * ControlHost::handle-reboot: |
| 13318 | * @object: A #ControlHost. |
| 13319 | * @invocation: A #GDBusMethodInvocation. |
| 13320 | * |
| 13321 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. |
| 13322 | * |
| 13323 | * 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. |
| 13324 | * |
| 13325 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13326 | */ |
| 13327 | g_signal_new ("handle-reboot", |
| 13328 | G_TYPE_FROM_INTERFACE (iface), |
| 13329 | G_SIGNAL_RUN_LAST, |
| 13330 | G_STRUCT_OFFSET (ControlHostIface, handle_reboot), |
| 13331 | g_signal_accumulator_true_handled, |
| 13332 | NULL, |
| 13333 | g_cclosure_marshal_generic, |
| 13334 | G_TYPE_BOOLEAN, |
| 13335 | 1, |
| 13336 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13337 | |
| 13338 | /* GObject signals for received D-Bus signals: */ |
| 13339 | /** |
| 13340 | * ControlHost::booted: |
| 13341 | * @object: A #ControlHost. |
| 13342 | * |
| 13343 | * 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. |
| 13344 | * |
| 13345 | * 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. |
| 13346 | */ |
| 13347 | g_signal_new ("booted", |
| 13348 | G_TYPE_FROM_INTERFACE (iface), |
| 13349 | G_SIGNAL_RUN_LAST, |
| 13350 | G_STRUCT_OFFSET (ControlHostIface, booted), |
| 13351 | NULL, |
| 13352 | NULL, |
| 13353 | g_cclosure_marshal_generic, |
| 13354 | G_TYPE_NONE, |
| 13355 | 0); |
| 13356 | |
| 13357 | } |
| 13358 | |
| 13359 | /** |
| 13360 | * control_host_emit_booted: |
| 13361 | * @object: A #ControlHost. |
| 13362 | * |
| 13363 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal. |
| 13364 | */ |
| 13365 | void |
| 13366 | control_host_emit_booted ( |
| 13367 | ControlHost *object) |
| 13368 | { |
| 13369 | g_signal_emit_by_name (object, "booted"); |
| 13370 | } |
| 13371 | |
| 13372 | /** |
| 13373 | * control_host_call_boot: |
| 13374 | * @proxy: A #ControlHostProxy. |
| 13375 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13376 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13377 | * @user_data: User data to pass to @callback. |
| 13378 | * |
| 13379 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. |
| 13380 | * 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. |
| 13381 | * You can then call control_host_call_boot_finish() to get the result of the operation. |
| 13382 | * |
| 13383 | * See control_host_call_boot_sync() for the synchronous, blocking version of this method. |
| 13384 | */ |
| 13385 | void |
| 13386 | control_host_call_boot ( |
| 13387 | ControlHost *proxy, |
| 13388 | GCancellable *cancellable, |
| 13389 | GAsyncReadyCallback callback, |
| 13390 | gpointer user_data) |
| 13391 | { |
| 13392 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13393 | "boot", |
| 13394 | g_variant_new ("()"), |
| 13395 | G_DBUS_CALL_FLAGS_NONE, |
| 13396 | -1, |
| 13397 | cancellable, |
| 13398 | callback, |
| 13399 | user_data); |
| 13400 | } |
| 13401 | |
| 13402 | /** |
| 13403 | * control_host_call_boot_finish: |
| 13404 | * @proxy: A #ControlHostProxy. |
| 13405 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot(). |
| 13406 | * @error: Return location for error or %NULL. |
| 13407 | * |
| 13408 | * Finishes an operation started with control_host_call_boot(). |
| 13409 | * |
| 13410 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13411 | */ |
| 13412 | gboolean |
| 13413 | control_host_call_boot_finish ( |
| 13414 | ControlHost *proxy, |
| 13415 | GAsyncResult *res, |
| 13416 | GError **error) |
| 13417 | { |
| 13418 | GVariant *_ret; |
| 13419 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13420 | if (_ret == NULL) |
| 13421 | goto _out; |
| 13422 | g_variant_get (_ret, |
| 13423 | "()"); |
| 13424 | g_variant_unref (_ret); |
| 13425 | _out: |
| 13426 | return _ret != NULL; |
| 13427 | } |
| 13428 | |
| 13429 | /** |
| 13430 | * control_host_call_boot_sync: |
| 13431 | * @proxy: A #ControlHostProxy. |
| 13432 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13433 | * @error: Return location for error or %NULL. |
| 13434 | * |
| 13435 | * 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. |
| 13436 | * |
| 13437 | * See control_host_call_boot() for the asynchronous version of this method. |
| 13438 | * |
| 13439 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13440 | */ |
| 13441 | gboolean |
| 13442 | control_host_call_boot_sync ( |
| 13443 | ControlHost *proxy, |
| 13444 | GCancellable *cancellable, |
| 13445 | GError **error) |
| 13446 | { |
| 13447 | GVariant *_ret; |
| 13448 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13449 | "boot", |
| 13450 | g_variant_new ("()"), |
| 13451 | G_DBUS_CALL_FLAGS_NONE, |
| 13452 | -1, |
| 13453 | cancellable, |
| 13454 | error); |
| 13455 | if (_ret == NULL) |
| 13456 | goto _out; |
| 13457 | g_variant_get (_ret, |
| 13458 | "()"); |
| 13459 | g_variant_unref (_ret); |
| 13460 | _out: |
| 13461 | return _ret != NULL; |
| 13462 | } |
| 13463 | |
| 13464 | /** |
| 13465 | * control_host_call_shutdown: |
| 13466 | * @proxy: A #ControlHostProxy. |
| 13467 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13468 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13469 | * @user_data: User data to pass to @callback. |
| 13470 | * |
| 13471 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. |
| 13472 | * 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. |
| 13473 | * You can then call control_host_call_shutdown_finish() to get the result of the operation. |
| 13474 | * |
| 13475 | * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method. |
| 13476 | */ |
| 13477 | void |
| 13478 | control_host_call_shutdown ( |
| 13479 | ControlHost *proxy, |
| 13480 | GCancellable *cancellable, |
| 13481 | GAsyncReadyCallback callback, |
| 13482 | gpointer user_data) |
| 13483 | { |
| 13484 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13485 | "shutdown", |
| 13486 | g_variant_new ("()"), |
| 13487 | G_DBUS_CALL_FLAGS_NONE, |
| 13488 | -1, |
| 13489 | cancellable, |
| 13490 | callback, |
| 13491 | user_data); |
| 13492 | } |
| 13493 | |
| 13494 | /** |
| 13495 | * control_host_call_shutdown_finish: |
| 13496 | * @proxy: A #ControlHostProxy. |
| 13497 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown(). |
| 13498 | * @error: Return location for error or %NULL. |
| 13499 | * |
| 13500 | * Finishes an operation started with control_host_call_shutdown(). |
| 13501 | * |
| 13502 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13503 | */ |
| 13504 | gboolean |
| 13505 | control_host_call_shutdown_finish ( |
| 13506 | ControlHost *proxy, |
| 13507 | GAsyncResult *res, |
| 13508 | GError **error) |
| 13509 | { |
| 13510 | GVariant *_ret; |
| 13511 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13512 | if (_ret == NULL) |
| 13513 | goto _out; |
| 13514 | g_variant_get (_ret, |
| 13515 | "()"); |
| 13516 | g_variant_unref (_ret); |
| 13517 | _out: |
| 13518 | return _ret != NULL; |
| 13519 | } |
| 13520 | |
| 13521 | /** |
| 13522 | * control_host_call_shutdown_sync: |
| 13523 | * @proxy: A #ControlHostProxy. |
| 13524 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13525 | * @error: Return location for error or %NULL. |
| 13526 | * |
| 13527 | * 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. |
| 13528 | * |
| 13529 | * See control_host_call_shutdown() for the asynchronous version of this method. |
| 13530 | * |
| 13531 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13532 | */ |
| 13533 | gboolean |
| 13534 | control_host_call_shutdown_sync ( |
| 13535 | ControlHost *proxy, |
| 13536 | GCancellable *cancellable, |
| 13537 | GError **error) |
| 13538 | { |
| 13539 | GVariant *_ret; |
| 13540 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13541 | "shutdown", |
| 13542 | g_variant_new ("()"), |
| 13543 | G_DBUS_CALL_FLAGS_NONE, |
| 13544 | -1, |
| 13545 | cancellable, |
| 13546 | error); |
| 13547 | if (_ret == NULL) |
| 13548 | goto _out; |
| 13549 | g_variant_get (_ret, |
| 13550 | "()"); |
| 13551 | g_variant_unref (_ret); |
| 13552 | _out: |
| 13553 | return _ret != NULL; |
| 13554 | } |
| 13555 | |
| 13556 | /** |
| 13557 | * control_host_call_reboot: |
| 13558 | * @proxy: A #ControlHostProxy. |
| 13559 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13560 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13561 | * @user_data: User data to pass to @callback. |
| 13562 | * |
| 13563 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. |
| 13564 | * 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. |
| 13565 | * You can then call control_host_call_reboot_finish() to get the result of the operation. |
| 13566 | * |
| 13567 | * See control_host_call_reboot_sync() for the synchronous, blocking version of this method. |
| 13568 | */ |
| 13569 | void |
| 13570 | control_host_call_reboot ( |
| 13571 | ControlHost *proxy, |
| 13572 | GCancellable *cancellable, |
| 13573 | GAsyncReadyCallback callback, |
| 13574 | gpointer user_data) |
| 13575 | { |
| 13576 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13577 | "reboot", |
| 13578 | g_variant_new ("()"), |
| 13579 | G_DBUS_CALL_FLAGS_NONE, |
| 13580 | -1, |
| 13581 | cancellable, |
| 13582 | callback, |
| 13583 | user_data); |
| 13584 | } |
| 13585 | |
| 13586 | /** |
| 13587 | * control_host_call_reboot_finish: |
| 13588 | * @proxy: A #ControlHostProxy. |
| 13589 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot(). |
| 13590 | * @error: Return location for error or %NULL. |
| 13591 | * |
| 13592 | * Finishes an operation started with control_host_call_reboot(). |
| 13593 | * |
| 13594 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13595 | */ |
| 13596 | gboolean |
| 13597 | control_host_call_reboot_finish ( |
| 13598 | ControlHost *proxy, |
| 13599 | GAsyncResult *res, |
| 13600 | GError **error) |
| 13601 | { |
| 13602 | GVariant *_ret; |
| 13603 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13604 | if (_ret == NULL) |
| 13605 | goto _out; |
| 13606 | g_variant_get (_ret, |
| 13607 | "()"); |
| 13608 | g_variant_unref (_ret); |
| 13609 | _out: |
| 13610 | return _ret != NULL; |
| 13611 | } |
| 13612 | |
| 13613 | /** |
| 13614 | * control_host_call_reboot_sync: |
| 13615 | * @proxy: A #ControlHostProxy. |
| 13616 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13617 | * @error: Return location for error or %NULL. |
| 13618 | * |
| 13619 | * 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. |
| 13620 | * |
| 13621 | * See control_host_call_reboot() for the asynchronous version of this method. |
| 13622 | * |
| 13623 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13624 | */ |
| 13625 | gboolean |
| 13626 | control_host_call_reboot_sync ( |
| 13627 | ControlHost *proxy, |
| 13628 | GCancellable *cancellable, |
| 13629 | GError **error) |
| 13630 | { |
| 13631 | GVariant *_ret; |
| 13632 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13633 | "reboot", |
| 13634 | g_variant_new ("()"), |
| 13635 | G_DBUS_CALL_FLAGS_NONE, |
| 13636 | -1, |
| 13637 | cancellable, |
| 13638 | error); |
| 13639 | if (_ret == NULL) |
| 13640 | goto _out; |
| 13641 | g_variant_get (_ret, |
| 13642 | "()"); |
| 13643 | g_variant_unref (_ret); |
| 13644 | _out: |
| 13645 | return _ret != NULL; |
| 13646 | } |
| 13647 | |
| 13648 | /** |
| 13649 | * control_host_complete_boot: |
| 13650 | * @object: A #ControlHost. |
| 13651 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13652 | * |
| 13653 | * 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. |
| 13654 | * |
| 13655 | * This method will free @invocation, you cannot use it afterwards. |
| 13656 | */ |
| 13657 | void |
| 13658 | control_host_complete_boot ( |
| 13659 | ControlHost *object, |
| 13660 | GDBusMethodInvocation *invocation) |
| 13661 | { |
| 13662 | g_dbus_method_invocation_return_value (invocation, |
| 13663 | g_variant_new ("()")); |
| 13664 | } |
| 13665 | |
| 13666 | /** |
| 13667 | * control_host_complete_shutdown: |
| 13668 | * @object: A #ControlHost. |
| 13669 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13670 | * |
| 13671 | * 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. |
| 13672 | * |
| 13673 | * This method will free @invocation, you cannot use it afterwards. |
| 13674 | */ |
| 13675 | void |
| 13676 | control_host_complete_shutdown ( |
| 13677 | ControlHost *object, |
| 13678 | GDBusMethodInvocation *invocation) |
| 13679 | { |
| 13680 | g_dbus_method_invocation_return_value (invocation, |
| 13681 | g_variant_new ("()")); |
| 13682 | } |
| 13683 | |
| 13684 | /** |
| 13685 | * control_host_complete_reboot: |
| 13686 | * @object: A #ControlHost. |
| 13687 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13688 | * |
| 13689 | * 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. |
| 13690 | * |
| 13691 | * This method will free @invocation, you cannot use it afterwards. |
| 13692 | */ |
| 13693 | void |
| 13694 | control_host_complete_reboot ( |
| 13695 | ControlHost *object, |
| 13696 | GDBusMethodInvocation *invocation) |
| 13697 | { |
| 13698 | g_dbus_method_invocation_return_value (invocation, |
| 13699 | g_variant_new ("()")); |
| 13700 | } |
| 13701 | |
| 13702 | /* ------------------------------------------------------------------------ */ |
| 13703 | |
| 13704 | /** |
| 13705 | * ControlHostProxy: |
| 13706 | * |
| 13707 | * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API. |
| 13708 | */ |
| 13709 | |
| 13710 | /** |
| 13711 | * ControlHostProxyClass: |
| 13712 | * @parent_class: The parent class. |
| 13713 | * |
| 13714 | * Class structure for #ControlHostProxy. |
| 13715 | */ |
| 13716 | |
| 13717 | struct _ControlHostProxyPrivate |
| 13718 | { |
| 13719 | GData *qdata; |
| 13720 | }; |
| 13721 | |
| 13722 | static void control_host_proxy_iface_init (ControlHostIface *iface); |
| 13723 | |
| 13724 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13725 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 13726 | G_ADD_PRIVATE (ControlHostProxy) |
| 13727 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 13728 | |
| 13729 | #else |
| 13730 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 13731 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 13732 | |
| 13733 | #endif |
| 13734 | static void |
| 13735 | control_host_proxy_finalize (GObject *object) |
| 13736 | { |
| 13737 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 13738 | g_datalist_clear (&proxy->priv->qdata); |
| 13739 | G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object); |
| 13740 | } |
| 13741 | |
| 13742 | static void |
| 13743 | control_host_proxy_get_property (GObject *object, |
| 13744 | guint prop_id, |
| 13745 | GValue *value, |
| 13746 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13747 | { |
| 13748 | } |
| 13749 | |
| 13750 | static void |
| 13751 | control_host_proxy_set_property (GObject *object, |
| 13752 | guint prop_id, |
| 13753 | const GValue *value, |
| 13754 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13755 | { |
| 13756 | } |
| 13757 | |
| 13758 | static void |
| 13759 | control_host_proxy_g_signal (GDBusProxy *proxy, |
| 13760 | const gchar *sender_name G_GNUC_UNUSED, |
| 13761 | const gchar *signal_name, |
| 13762 | GVariant *parameters) |
| 13763 | { |
| 13764 | _ExtendedGDBusSignalInfo *info; |
| 13765 | GVariantIter iter; |
| 13766 | GVariant *child; |
| 13767 | GValue *paramv; |
| 13768 | guint num_params; |
| 13769 | guint n; |
| 13770 | guint signal_id; |
| 13771 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name); |
| 13772 | if (info == NULL) |
| 13773 | return; |
| 13774 | num_params = g_variant_n_children (parameters); |
| 13775 | paramv = g_new0 (GValue, num_params + 1); |
| 13776 | g_value_init (¶mv[0], TYPE_CONTROL_HOST); |
| 13777 | g_value_set_object (¶mv[0], proxy); |
| 13778 | g_variant_iter_init (&iter, parameters); |
| 13779 | n = 1; |
| 13780 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13781 | { |
| 13782 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 13783 | if (arg_info->use_gvariant) |
| 13784 | { |
| 13785 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13786 | g_value_set_variant (¶mv[n], child); |
| 13787 | n++; |
| 13788 | } |
| 13789 | else |
| 13790 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13791 | g_variant_unref (child); |
| 13792 | } |
| 13793 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 13794 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 13795 | for (n = 0; n < num_params + 1; n++) |
| 13796 | g_value_unset (¶mv[n]); |
| 13797 | g_free (paramv); |
| 13798 | } |
| 13799 | |
| 13800 | static void |
| 13801 | control_host_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 13802 | GVariant *changed_properties, |
| 13803 | const gchar *const *invalidated_properties) |
| 13804 | { |
| 13805 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy); |
| 13806 | guint n; |
| 13807 | const gchar *key; |
| 13808 | GVariantIter *iter; |
| 13809 | _ExtendedGDBusPropertyInfo *info; |
| 13810 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 13811 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 13812 | { |
| 13813 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key); |
| 13814 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 13815 | if (info != NULL) |
| 13816 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13817 | } |
| 13818 | g_variant_iter_free (iter); |
| 13819 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 13820 | { |
| 13821 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]); |
| 13822 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 13823 | if (info != NULL) |
| 13824 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13825 | } |
| 13826 | } |
| 13827 | |
| 13828 | static void |
| 13829 | control_host_proxy_init (ControlHostProxy *proxy) |
| 13830 | { |
| 13831 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13832 | proxy->priv = control_host_proxy_get_instance_private (proxy); |
| 13833 | #else |
| 13834 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate); |
| 13835 | #endif |
| 13836 | |
| 13837 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ()); |
| 13838 | } |
| 13839 | |
| 13840 | static void |
| 13841 | control_host_proxy_class_init (ControlHostProxyClass *klass) |
| 13842 | { |
| 13843 | GObjectClass *gobject_class; |
| 13844 | GDBusProxyClass *proxy_class; |
| 13845 | |
| 13846 | gobject_class = G_OBJECT_CLASS (klass); |
| 13847 | gobject_class->finalize = control_host_proxy_finalize; |
| 13848 | gobject_class->get_property = control_host_proxy_get_property; |
| 13849 | gobject_class->set_property = control_host_proxy_set_property; |
| 13850 | |
| 13851 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 13852 | proxy_class->g_signal = control_host_proxy_g_signal; |
| 13853 | proxy_class->g_properties_changed = control_host_proxy_g_properties_changed; |
| 13854 | |
| 13855 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13856 | g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate)); |
| 13857 | #endif |
| 13858 | } |
| 13859 | |
| 13860 | static void |
| 13861 | control_host_proxy_iface_init (ControlHostIface *iface) |
| 13862 | { |
| 13863 | } |
| 13864 | |
| 13865 | /** |
| 13866 | * control_host_proxy_new: |
| 13867 | * @connection: A #GDBusConnection. |
| 13868 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13869 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13870 | * @object_path: An object path. |
| 13871 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13872 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13873 | * @user_data: User data to pass to @callback. |
| 13874 | * |
| 13875 | * 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. |
| 13876 | * |
| 13877 | * 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. |
| 13878 | * You can then call control_host_proxy_new_finish() to get the result of the operation. |
| 13879 | * |
| 13880 | * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 13881 | */ |
| 13882 | void |
| 13883 | control_host_proxy_new ( |
| 13884 | GDBusConnection *connection, |
| 13885 | GDBusProxyFlags flags, |
| 13886 | const gchar *name, |
| 13887 | const gchar *object_path, |
| 13888 | GCancellable *cancellable, |
| 13889 | GAsyncReadyCallback callback, |
| 13890 | gpointer user_data) |
| 13891 | { |
| 13892 | 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); |
| 13893 | } |
| 13894 | |
| 13895 | /** |
| 13896 | * control_host_proxy_new_finish: |
| 13897 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new(). |
| 13898 | * @error: Return location for error or %NULL |
| 13899 | * |
| 13900 | * Finishes an operation started with control_host_proxy_new(). |
| 13901 | * |
| 13902 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 13903 | */ |
| 13904 | ControlHost * |
| 13905 | control_host_proxy_new_finish ( |
| 13906 | GAsyncResult *res, |
| 13907 | GError **error) |
| 13908 | { |
| 13909 | GObject *ret; |
| 13910 | GObject *source_object; |
| 13911 | source_object = g_async_result_get_source_object (res); |
| 13912 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 13913 | g_object_unref (source_object); |
| 13914 | if (ret != NULL) |
| 13915 | return CONTROL_HOST (ret); |
| 13916 | else |
| 13917 | return NULL; |
| 13918 | } |
| 13919 | |
| 13920 | /** |
| 13921 | * control_host_proxy_new_sync: |
| 13922 | * @connection: A #GDBusConnection. |
| 13923 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13924 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13925 | * @object_path: An object path. |
| 13926 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13927 | * @error: Return location for error or %NULL |
| 13928 | * |
| 13929 | * 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. |
| 13930 | * |
| 13931 | * The calling thread is blocked until a reply is received. |
| 13932 | * |
| 13933 | * See control_host_proxy_new() for the asynchronous version of this constructor. |
| 13934 | * |
| 13935 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 13936 | */ |
| 13937 | ControlHost * |
| 13938 | control_host_proxy_new_sync ( |
| 13939 | GDBusConnection *connection, |
| 13940 | GDBusProxyFlags flags, |
| 13941 | const gchar *name, |
| 13942 | const gchar *object_path, |
| 13943 | GCancellable *cancellable, |
| 13944 | GError **error) |
| 13945 | { |
| 13946 | GInitable *ret; |
| 13947 | 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); |
| 13948 | if (ret != NULL) |
| 13949 | return CONTROL_HOST (ret); |
| 13950 | else |
| 13951 | return NULL; |
| 13952 | } |
| 13953 | |
| 13954 | |
| 13955 | /** |
| 13956 | * control_host_proxy_new_for_bus: |
| 13957 | * @bus_type: A #GBusType. |
| 13958 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13959 | * @name: A bus name (well-known or unique). |
| 13960 | * @object_path: An object path. |
| 13961 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13962 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13963 | * @user_data: User data to pass to @callback. |
| 13964 | * |
| 13965 | * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 13966 | * |
| 13967 | * 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. |
| 13968 | * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation. |
| 13969 | * |
| 13970 | * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 13971 | */ |
| 13972 | void |
| 13973 | control_host_proxy_new_for_bus ( |
| 13974 | GBusType bus_type, |
| 13975 | GDBusProxyFlags flags, |
| 13976 | const gchar *name, |
| 13977 | const gchar *object_path, |
| 13978 | GCancellable *cancellable, |
| 13979 | GAsyncReadyCallback callback, |
| 13980 | gpointer user_data) |
| 13981 | { |
| 13982 | 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); |
| 13983 | } |
| 13984 | |
| 13985 | /** |
| 13986 | * control_host_proxy_new_for_bus_finish: |
| 13987 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus(). |
| 13988 | * @error: Return location for error or %NULL |
| 13989 | * |
| 13990 | * Finishes an operation started with control_host_proxy_new_for_bus(). |
| 13991 | * |
| 13992 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 13993 | */ |
| 13994 | ControlHost * |
| 13995 | control_host_proxy_new_for_bus_finish ( |
| 13996 | GAsyncResult *res, |
| 13997 | GError **error) |
| 13998 | { |
| 13999 | GObject *ret; |
| 14000 | GObject *source_object; |
| 14001 | source_object = g_async_result_get_source_object (res); |
| 14002 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 14003 | g_object_unref (source_object); |
| 14004 | if (ret != NULL) |
| 14005 | return CONTROL_HOST (ret); |
| 14006 | else |
| 14007 | return NULL; |
| 14008 | } |
| 14009 | |
| 14010 | /** |
| 14011 | * control_host_proxy_new_for_bus_sync: |
| 14012 | * @bus_type: A #GBusType. |
| 14013 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14014 | * @name: A bus name (well-known or unique). |
| 14015 | * @object_path: An object path. |
| 14016 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14017 | * @error: Return location for error or %NULL |
| 14018 | * |
| 14019 | * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 14020 | * |
| 14021 | * The calling thread is blocked until a reply is received. |
| 14022 | * |
| 14023 | * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 14024 | * |
| 14025 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 14026 | */ |
| 14027 | ControlHost * |
| 14028 | control_host_proxy_new_for_bus_sync ( |
| 14029 | GBusType bus_type, |
| 14030 | GDBusProxyFlags flags, |
| 14031 | const gchar *name, |
| 14032 | const gchar *object_path, |
| 14033 | GCancellable *cancellable, |
| 14034 | GError **error) |
| 14035 | { |
| 14036 | GInitable *ret; |
| 14037 | 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); |
| 14038 | if (ret != NULL) |
| 14039 | return CONTROL_HOST (ret); |
| 14040 | else |
| 14041 | return NULL; |
| 14042 | } |
| 14043 | |
| 14044 | |
| 14045 | /* ------------------------------------------------------------------------ */ |
| 14046 | |
| 14047 | /** |
| 14048 | * ControlHostSkeleton: |
| 14049 | * |
| 14050 | * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API. |
| 14051 | */ |
| 14052 | |
| 14053 | /** |
| 14054 | * ControlHostSkeletonClass: |
| 14055 | * @parent_class: The parent class. |
| 14056 | * |
| 14057 | * Class structure for #ControlHostSkeleton. |
| 14058 | */ |
| 14059 | |
| 14060 | struct _ControlHostSkeletonPrivate |
| 14061 | { |
| 14062 | GValue *properties; |
| 14063 | GList *changed_properties; |
| 14064 | GSource *changed_properties_idle_source; |
| 14065 | GMainContext *context; |
| 14066 | GMutex lock; |
| 14067 | }; |
| 14068 | |
| 14069 | static void |
| 14070 | _control_host_skeleton_handle_method_call ( |
| 14071 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14072 | const gchar *sender G_GNUC_UNUSED, |
| 14073 | const gchar *object_path G_GNUC_UNUSED, |
| 14074 | const gchar *interface_name, |
| 14075 | const gchar *method_name, |
| 14076 | GVariant *parameters, |
| 14077 | GDBusMethodInvocation *invocation, |
| 14078 | gpointer user_data) |
| 14079 | { |
| 14080 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14081 | _ExtendedGDBusMethodInfo *info; |
| 14082 | GVariantIter iter; |
| 14083 | GVariant *child; |
| 14084 | GValue *paramv; |
| 14085 | guint num_params; |
| 14086 | guint num_extra; |
| 14087 | guint n; |
| 14088 | guint signal_id; |
| 14089 | GValue return_value = G_VALUE_INIT; |
| 14090 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 14091 | g_assert (info != NULL); |
| 14092 | num_params = g_variant_n_children (parameters); |
| 14093 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 14094 | n = 0; |
| 14095 | g_value_init (¶mv[n], TYPE_CONTROL_HOST); |
| 14096 | g_value_set_object (¶mv[n++], skeleton); |
| 14097 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 14098 | g_value_set_object (¶mv[n++], invocation); |
| 14099 | if (info->pass_fdlist) |
| 14100 | { |
| 14101 | #ifdef G_OS_UNIX |
| 14102 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 14103 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 14104 | #else |
| 14105 | g_assert_not_reached (); |
| 14106 | #endif |
| 14107 | } |
| 14108 | g_variant_iter_init (&iter, parameters); |
| 14109 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 14110 | { |
| 14111 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 14112 | if (arg_info->use_gvariant) |
| 14113 | { |
| 14114 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 14115 | g_value_set_variant (¶mv[n], child); |
| 14116 | n++; |
| 14117 | } |
| 14118 | else |
| 14119 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 14120 | g_variant_unref (child); |
| 14121 | } |
| 14122 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 14123 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 14124 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 14125 | if (!g_value_get_boolean (&return_value)) |
| 14126 | 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); |
| 14127 | g_value_unset (&return_value); |
| 14128 | for (n = 0; n < num_params + num_extra; n++) |
| 14129 | g_value_unset (¶mv[n]); |
| 14130 | g_free (paramv); |
| 14131 | } |
| 14132 | |
| 14133 | static GVariant * |
| 14134 | _control_host_skeleton_handle_get_property ( |
| 14135 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14136 | const gchar *sender G_GNUC_UNUSED, |
| 14137 | const gchar *object_path G_GNUC_UNUSED, |
| 14138 | const gchar *interface_name G_GNUC_UNUSED, |
| 14139 | const gchar *property_name, |
| 14140 | GError **error, |
| 14141 | gpointer user_data) |
| 14142 | { |
| 14143 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14144 | GValue value = G_VALUE_INIT; |
| 14145 | GParamSpec *pspec; |
| 14146 | _ExtendedGDBusPropertyInfo *info; |
| 14147 | GVariant *ret; |
| 14148 | ret = NULL; |
| 14149 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 14150 | g_assert (info != NULL); |
| 14151 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 14152 | if (pspec == NULL) |
| 14153 | { |
| 14154 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 14155 | } |
| 14156 | else |
| 14157 | { |
| 14158 | g_value_init (&value, pspec->value_type); |
| 14159 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 14160 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 14161 | g_value_unset (&value); |
| 14162 | } |
| 14163 | return ret; |
| 14164 | } |
| 14165 | |
| 14166 | static gboolean |
| 14167 | _control_host_skeleton_handle_set_property ( |
| 14168 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14169 | const gchar *sender G_GNUC_UNUSED, |
| 14170 | const gchar *object_path G_GNUC_UNUSED, |
| 14171 | const gchar *interface_name G_GNUC_UNUSED, |
| 14172 | const gchar *property_name, |
| 14173 | GVariant *variant, |
| 14174 | GError **error, |
| 14175 | gpointer user_data) |
| 14176 | { |
| 14177 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14178 | GValue value = G_VALUE_INIT; |
| 14179 | GParamSpec *pspec; |
| 14180 | _ExtendedGDBusPropertyInfo *info; |
| 14181 | gboolean ret; |
| 14182 | ret = FALSE; |
| 14183 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 14184 | g_assert (info != NULL); |
| 14185 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 14186 | if (pspec == NULL) |
| 14187 | { |
| 14188 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 14189 | } |
| 14190 | else |
| 14191 | { |
| 14192 | if (info->use_gvariant) |
| 14193 | g_value_set_variant (&value, variant); |
| 14194 | else |
| 14195 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 14196 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 14197 | g_value_unset (&value); |
| 14198 | ret = TRUE; |
| 14199 | } |
| 14200 | return ret; |
| 14201 | } |
| 14202 | |
| 14203 | static const GDBusInterfaceVTable _control_host_skeleton_vtable = |
| 14204 | { |
| 14205 | _control_host_skeleton_handle_method_call, |
| 14206 | _control_host_skeleton_handle_get_property, |
| 14207 | _control_host_skeleton_handle_set_property, |
| 14208 | {NULL} |
| 14209 | }; |
| 14210 | |
| 14211 | static GDBusInterfaceInfo * |
| 14212 | control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14213 | { |
| 14214 | return control_host_interface_info (); |
| 14215 | } |
| 14216 | |
| 14217 | static GDBusInterfaceVTable * |
| 14218 | control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14219 | { |
| 14220 | return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable; |
| 14221 | } |
| 14222 | |
| 14223 | static GVariant * |
| 14224 | control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 14225 | { |
| 14226 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 14227 | |
| 14228 | GVariantBuilder builder; |
| 14229 | guint n; |
| 14230 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 14231 | if (_control_host_interface_info.parent_struct.properties == NULL) |
| 14232 | goto out; |
| 14233 | for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++) |
| 14234 | { |
| 14235 | GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n]; |
| 14236 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 14237 | { |
| 14238 | GVariant *value; |
| 14239 | 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); |
| 14240 | if (value != NULL) |
| 14241 | { |
| 14242 | g_variant_take_ref (value); |
| 14243 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 14244 | g_variant_unref (value); |
| 14245 | } |
| 14246 | } |
| 14247 | } |
| 14248 | out: |
| 14249 | return g_variant_builder_end (&builder); |
| 14250 | } |
| 14251 | |
| 14252 | static void |
| 14253 | control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 14254 | { |
| 14255 | } |
| 14256 | |
| 14257 | static void |
| 14258 | _control_host_on_signal_booted ( |
| 14259 | ControlHost *object) |
| 14260 | { |
| 14261 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 14262 | |
| 14263 | GList *connections, *l; |
| 14264 | GVariant *signal_variant; |
| 14265 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14266 | |
| 14267 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 14268 | for (l = connections; l != NULL; l = l->next) |
| 14269 | { |
| 14270 | GDBusConnection *connection = l->data; |
| 14271 | g_dbus_connection_emit_signal (connection, |
| 14272 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted", |
| 14273 | signal_variant, NULL); |
| 14274 | } |
| 14275 | g_variant_unref (signal_variant); |
| 14276 | g_list_free_full (connections, g_object_unref); |
| 14277 | } |
| 14278 | |
| 14279 | static void control_host_skeleton_iface_init (ControlHostIface *iface); |
| 14280 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14281 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14282 | G_ADD_PRIVATE (ControlHostSkeleton) |
| 14283 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 14284 | |
| 14285 | #else |
| 14286 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14287 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 14288 | |
| 14289 | #endif |
| 14290 | static void |
| 14291 | control_host_skeleton_finalize (GObject *object) |
| 14292 | { |
| 14293 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 14294 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 14295 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 14296 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 14297 | g_main_context_unref (skeleton->priv->context); |
| 14298 | g_mutex_clear (&skeleton->priv->lock); |
| 14299 | G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object); |
| 14300 | } |
| 14301 | |
| 14302 | static void |
| 14303 | control_host_skeleton_init (ControlHostSkeleton *skeleton) |
| 14304 | { |
| 14305 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14306 | skeleton->priv = control_host_skeleton_get_instance_private (skeleton); |
| 14307 | #else |
| 14308 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate); |
| 14309 | #endif |
| 14310 | |
| 14311 | g_mutex_init (&skeleton->priv->lock); |
| 14312 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 14313 | } |
| 14314 | |
| 14315 | static void |
| 14316 | control_host_skeleton_class_init (ControlHostSkeletonClass *klass) |
| 14317 | { |
| 14318 | GObjectClass *gobject_class; |
| 14319 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 14320 | |
| 14321 | gobject_class = G_OBJECT_CLASS (klass); |
| 14322 | gobject_class->finalize = control_host_skeleton_finalize; |
| 14323 | |
| 14324 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 14325 | skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info; |
| 14326 | skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties; |
| 14327 | skeleton_class->flush = control_host_skeleton_dbus_interface_flush; |
| 14328 | skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable; |
| 14329 | |
| 14330 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 14331 | g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate)); |
| 14332 | #endif |
| 14333 | } |
| 14334 | |
| 14335 | static void |
| 14336 | control_host_skeleton_iface_init (ControlHostIface *iface) |
| 14337 | { |
| 14338 | iface->booted = _control_host_on_signal_booted; |
| 14339 | } |
| 14340 | |
| 14341 | /** |
| 14342 | * control_host_skeleton_new: |
| 14343 | * |
| 14344 | * 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>. |
| 14345 | * |
| 14346 | * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object. |
| 14347 | */ |
| 14348 | ControlHost * |
| 14349 | control_host_skeleton_new (void) |
| 14350 | { |
| 14351 | return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL)); |
| 14352 | } |
| 14353 | |
| 14354 | /* ------------------------------------------------------------------------ |
| 14355 | * Code for interface org.openbmc.control.Power |
| 14356 | * ------------------------------------------------------------------------ |
| 14357 | */ |
| 14358 | |
| 14359 | /** |
| 14360 | * SECTION:ControlPower |
| 14361 | * @title: ControlPower |
| 14362 | * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface |
| 14363 | * |
| 14364 | * 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. |
| 14365 | */ |
| 14366 | |
| 14367 | /* ---- Introspection data for org.openbmc.control.Power ---- */ |
| 14368 | |
| 14369 | static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state = |
| 14370 | { |
| 14371 | { |
| 14372 | -1, |
| 14373 | (gchar *) "state", |
| 14374 | (gchar *) "i", |
| 14375 | NULL |
| 14376 | }, |
| 14377 | FALSE |
| 14378 | }; |
| 14379 | |
| 14380 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] = |
| 14381 | { |
| 14382 | &_control_power_method_info_set_power_state_IN_ARG_state, |
| 14383 | NULL |
| 14384 | }; |
| 14385 | |
| 14386 | static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state = |
| 14387 | { |
| 14388 | { |
| 14389 | -1, |
| 14390 | (gchar *) "setPowerState", |
| 14391 | (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers, |
| 14392 | NULL, |
| 14393 | NULL |
| 14394 | }, |
| 14395 | "handle-set-power-state", |
| 14396 | FALSE |
| 14397 | }; |
| 14398 | |
| 14399 | static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state = |
| 14400 | { |
| 14401 | { |
| 14402 | -1, |
| 14403 | (gchar *) "state", |
| 14404 | (gchar *) "i", |
| 14405 | NULL |
| 14406 | }, |
| 14407 | FALSE |
| 14408 | }; |
| 14409 | |
| 14410 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] = |
| 14411 | { |
| 14412 | &_control_power_method_info_get_power_state_OUT_ARG_state, |
| 14413 | NULL |
| 14414 | }; |
| 14415 | |
| 14416 | static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state = |
| 14417 | { |
| 14418 | { |
| 14419 | -1, |
| 14420 | (gchar *) "getPowerState", |
| 14421 | NULL, |
| 14422 | (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers, |
| 14423 | NULL |
| 14424 | }, |
| 14425 | "handle-get-power-state", |
| 14426 | FALSE |
| 14427 | }; |
| 14428 | |
| 14429 | static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] = |
| 14430 | { |
| 14431 | &_control_power_method_info_set_power_state, |
| 14432 | &_control_power_method_info_get_power_state, |
| 14433 | NULL |
| 14434 | }; |
| 14435 | |
| 14436 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good = |
| 14437 | { |
| 14438 | { |
| 14439 | -1, |
| 14440 | (gchar *) "PowerGood", |
| 14441 | NULL, |
| 14442 | NULL |
| 14443 | }, |
| 14444 | "power-good" |
| 14445 | }; |
| 14446 | |
| 14447 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost = |
| 14448 | { |
| 14449 | { |
| 14450 | -1, |
| 14451 | (gchar *) "PowerLost", |
| 14452 | NULL, |
| 14453 | NULL |
| 14454 | }, |
| 14455 | "power-lost" |
| 14456 | }; |
| 14457 | |
| 14458 | static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] = |
| 14459 | { |
| 14460 | &_control_power_signal_info_power_good, |
| 14461 | &_control_power_signal_info_power_lost, |
| 14462 | NULL |
| 14463 | }; |
| 14464 | |
| 14465 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood = |
| 14466 | { |
| 14467 | { |
| 14468 | -1, |
| 14469 | (gchar *) "pgood", |
| 14470 | (gchar *) "i", |
| 14471 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 14472 | NULL |
| 14473 | }, |
| 14474 | "pgood", |
| 14475 | FALSE |
| 14476 | }; |
| 14477 | |
| 14478 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_state = |
| 14479 | { |
| 14480 | { |
| 14481 | -1, |
| 14482 | (gchar *) "state", |
| 14483 | (gchar *) "i", |
| 14484 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 14485 | NULL |
| 14486 | }, |
| 14487 | "state", |
| 14488 | FALSE |
| 14489 | }; |
| 14490 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14491 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout = |
| 14492 | { |
| 14493 | { |
| 14494 | -1, |
| 14495 | (gchar *) "pgood_timeout", |
| 14496 | (gchar *) "i", |
| 14497 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 14498 | NULL |
| 14499 | }, |
| 14500 | "pgood-timeout", |
| 14501 | FALSE |
| 14502 | }; |
| 14503 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14504 | static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] = |
| 14505 | { |
| 14506 | &_control_power_property_info_pgood, |
| 14507 | &_control_power_property_info_state, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14508 | &_control_power_property_info_pgood_timeout, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14509 | NULL |
| 14510 | }; |
| 14511 | |
| 14512 | static const _ExtendedGDBusInterfaceInfo _control_power_interface_info = |
| 14513 | { |
| 14514 | { |
| 14515 | -1, |
| 14516 | (gchar *) "org.openbmc.control.Power", |
| 14517 | (GDBusMethodInfo **) &_control_power_method_info_pointers, |
| 14518 | (GDBusSignalInfo **) &_control_power_signal_info_pointers, |
| 14519 | (GDBusPropertyInfo **) &_control_power_property_info_pointers, |
| 14520 | NULL |
| 14521 | }, |
| 14522 | "control-power", |
| 14523 | }; |
| 14524 | |
| 14525 | |
| 14526 | /** |
| 14527 | * control_power_interface_info: |
| 14528 | * |
| 14529 | * 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. |
| 14530 | * |
| 14531 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 14532 | */ |
| 14533 | GDBusInterfaceInfo * |
| 14534 | control_power_interface_info (void) |
| 14535 | { |
| 14536 | return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct; |
| 14537 | } |
| 14538 | |
| 14539 | /** |
| 14540 | * control_power_override_properties: |
| 14541 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 14542 | * @property_id_begin: The property id to assign to the first overridden property. |
| 14543 | * |
| 14544 | * Overrides all #GObject properties in the #ControlPower interface for a concrete class. |
| 14545 | * The properties are overridden in the order they are defined. |
| 14546 | * |
| 14547 | * Returns: The last property id. |
| 14548 | */ |
| 14549 | guint |
| 14550 | control_power_override_properties (GObjectClass *klass, guint property_id_begin) |
| 14551 | { |
| 14552 | g_object_class_override_property (klass, property_id_begin++, "pgood"); |
| 14553 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14554 | g_object_class_override_property (klass, property_id_begin++, "pgood-timeout"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14555 | return property_id_begin - 1; |
| 14556 | } |
| 14557 | |
| 14558 | |
| 14559 | |
| 14560 | /** |
| 14561 | * ControlPower: |
| 14562 | * |
| 14563 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 14564 | */ |
| 14565 | |
| 14566 | /** |
| 14567 | * ControlPowerIface: |
| 14568 | * @parent_iface: The parent interface. |
| 14569 | * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal. |
| 14570 | * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal. |
| 14571 | * @get_pgood: Getter for the #ControlPower:pgood property. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14572 | * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14573 | * @get_state: Getter for the #ControlPower:state property. |
| 14574 | * @power_good: Handler for the #ControlPower::power-good signal. |
| 14575 | * @power_lost: Handler for the #ControlPower::power-lost signal. |
| 14576 | * |
| 14577 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 14578 | */ |
| 14579 | |
| 14580 | typedef ControlPowerIface ControlPowerInterface; |
| 14581 | G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT); |
| 14582 | |
| 14583 | static void |
| 14584 | control_power_default_init (ControlPowerIface *iface) |
| 14585 | { |
| 14586 | /* GObject signals for incoming D-Bus method calls: */ |
| 14587 | /** |
| 14588 | * ControlPower::handle-set-power-state: |
| 14589 | * @object: A #ControlPower. |
| 14590 | * @invocation: A #GDBusMethodInvocation. |
| 14591 | * @arg_state: Argument passed by remote caller. |
| 14592 | * |
| 14593 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. |
| 14594 | * |
| 14595 | * 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. |
| 14596 | * |
| 14597 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14598 | */ |
| 14599 | g_signal_new ("handle-set-power-state", |
| 14600 | G_TYPE_FROM_INTERFACE (iface), |
| 14601 | G_SIGNAL_RUN_LAST, |
| 14602 | G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state), |
| 14603 | g_signal_accumulator_true_handled, |
| 14604 | NULL, |
| 14605 | g_cclosure_marshal_generic, |
| 14606 | G_TYPE_BOOLEAN, |
| 14607 | 2, |
| 14608 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 14609 | |
| 14610 | /** |
| 14611 | * ControlPower::handle-get-power-state: |
| 14612 | * @object: A #ControlPower. |
| 14613 | * @invocation: A #GDBusMethodInvocation. |
| 14614 | * |
| 14615 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. |
| 14616 | * |
| 14617 | * 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. |
| 14618 | * |
| 14619 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14620 | */ |
| 14621 | g_signal_new ("handle-get-power-state", |
| 14622 | G_TYPE_FROM_INTERFACE (iface), |
| 14623 | G_SIGNAL_RUN_LAST, |
| 14624 | G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state), |
| 14625 | g_signal_accumulator_true_handled, |
| 14626 | NULL, |
| 14627 | g_cclosure_marshal_generic, |
| 14628 | G_TYPE_BOOLEAN, |
| 14629 | 1, |
| 14630 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14631 | |
| 14632 | /* GObject signals for received D-Bus signals: */ |
| 14633 | /** |
| 14634 | * ControlPower::power-good: |
| 14635 | * @object: A #ControlPower. |
| 14636 | * |
| 14637 | * 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. |
| 14638 | * |
| 14639 | * 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. |
| 14640 | */ |
| 14641 | g_signal_new ("power-good", |
| 14642 | G_TYPE_FROM_INTERFACE (iface), |
| 14643 | G_SIGNAL_RUN_LAST, |
| 14644 | G_STRUCT_OFFSET (ControlPowerIface, power_good), |
| 14645 | NULL, |
| 14646 | NULL, |
| 14647 | g_cclosure_marshal_generic, |
| 14648 | G_TYPE_NONE, |
| 14649 | 0); |
| 14650 | |
| 14651 | /** |
| 14652 | * ControlPower::power-lost: |
| 14653 | * @object: A #ControlPower. |
| 14654 | * |
| 14655 | * 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. |
| 14656 | * |
| 14657 | * 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. |
| 14658 | */ |
| 14659 | g_signal_new ("power-lost", |
| 14660 | G_TYPE_FROM_INTERFACE (iface), |
| 14661 | G_SIGNAL_RUN_LAST, |
| 14662 | G_STRUCT_OFFSET (ControlPowerIface, power_lost), |
| 14663 | NULL, |
| 14664 | NULL, |
| 14665 | g_cclosure_marshal_generic, |
| 14666 | G_TYPE_NONE, |
| 14667 | 0); |
| 14668 | |
| 14669 | /* GObject properties for D-Bus properties: */ |
| 14670 | /** |
| 14671 | * ControlPower:pgood: |
| 14672 | * |
| 14673 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>. |
| 14674 | * |
| 14675 | * 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. |
| 14676 | */ |
| 14677 | g_object_interface_install_property (iface, |
| 14678 | g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 14679 | /** |
| 14680 | * ControlPower:state: |
| 14681 | * |
| 14682 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>. |
| 14683 | * |
| 14684 | * 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. |
| 14685 | */ |
| 14686 | g_object_interface_install_property (iface, |
| 14687 | g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14688 | /** |
| 14689 | * ControlPower:pgood-timeout: |
| 14690 | * |
| 14691 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>. |
| 14692 | * |
| 14693 | * 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. |
| 14694 | */ |
| 14695 | g_object_interface_install_property (iface, |
| 14696 | g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14697 | } |
| 14698 | |
| 14699 | /** |
| 14700 | * control_power_get_pgood: (skip) |
| 14701 | * @object: A #ControlPower. |
| 14702 | * |
| 14703 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property. |
| 14704 | * |
| 14705 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 14706 | * |
| 14707 | * Returns: The property value. |
| 14708 | */ |
| 14709 | gint |
| 14710 | control_power_get_pgood (ControlPower *object) |
| 14711 | { |
| 14712 | return CONTROL_POWER_GET_IFACE (object)->get_pgood (object); |
| 14713 | } |
| 14714 | |
| 14715 | /** |
| 14716 | * control_power_set_pgood: (skip) |
| 14717 | * @object: A #ControlPower. |
| 14718 | * @value: The value to set. |
| 14719 | * |
| 14720 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value. |
| 14721 | * |
| 14722 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 14723 | */ |
| 14724 | void |
| 14725 | control_power_set_pgood (ControlPower *object, gint value) |
| 14726 | { |
| 14727 | g_object_set (G_OBJECT (object), "pgood", value, NULL); |
| 14728 | } |
| 14729 | |
| 14730 | /** |
| 14731 | * control_power_get_state: (skip) |
| 14732 | * @object: A #ControlPower. |
| 14733 | * |
| 14734 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property. |
| 14735 | * |
| 14736 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 14737 | * |
| 14738 | * Returns: The property value. |
| 14739 | */ |
| 14740 | gint |
| 14741 | control_power_get_state (ControlPower *object) |
| 14742 | { |
| 14743 | return CONTROL_POWER_GET_IFACE (object)->get_state (object); |
| 14744 | } |
| 14745 | |
| 14746 | /** |
| 14747 | * control_power_set_state: (skip) |
| 14748 | * @object: A #ControlPower. |
| 14749 | * @value: The value to set. |
| 14750 | * |
| 14751 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value. |
| 14752 | * |
| 14753 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 14754 | */ |
| 14755 | void |
| 14756 | control_power_set_state (ControlPower *object, gint value) |
| 14757 | { |
| 14758 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 14759 | } |
| 14760 | |
| 14761 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14762 | * control_power_get_pgood_timeout: (skip) |
| 14763 | * @object: A #ControlPower. |
| 14764 | * |
| 14765 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property. |
| 14766 | * |
| 14767 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14768 | * |
| 14769 | * Returns: The property value. |
| 14770 | */ |
| 14771 | gint |
| 14772 | control_power_get_pgood_timeout (ControlPower *object) |
| 14773 | { |
| 14774 | return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object); |
| 14775 | } |
| 14776 | |
| 14777 | /** |
| 14778 | * control_power_set_pgood_timeout: (skip) |
| 14779 | * @object: A #ControlPower. |
| 14780 | * @value: The value to set. |
| 14781 | * |
| 14782 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value. |
| 14783 | * |
| 14784 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14785 | */ |
| 14786 | void |
| 14787 | control_power_set_pgood_timeout (ControlPower *object, gint value) |
| 14788 | { |
| 14789 | g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL); |
| 14790 | } |
| 14791 | |
| 14792 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14793 | * control_power_emit_power_good: |
| 14794 | * @object: A #ControlPower. |
| 14795 | * |
| 14796 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal. |
| 14797 | */ |
| 14798 | void |
| 14799 | control_power_emit_power_good ( |
| 14800 | ControlPower *object) |
| 14801 | { |
| 14802 | g_signal_emit_by_name (object, "power-good"); |
| 14803 | } |
| 14804 | |
| 14805 | /** |
| 14806 | * control_power_emit_power_lost: |
| 14807 | * @object: A #ControlPower. |
| 14808 | * |
| 14809 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal. |
| 14810 | */ |
| 14811 | void |
| 14812 | control_power_emit_power_lost ( |
| 14813 | ControlPower *object) |
| 14814 | { |
| 14815 | g_signal_emit_by_name (object, "power-lost"); |
| 14816 | } |
| 14817 | |
| 14818 | /** |
| 14819 | * control_power_call_set_power_state: |
| 14820 | * @proxy: A #ControlPowerProxy. |
| 14821 | * @arg_state: Argument to pass with the method invocation. |
| 14822 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14823 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14824 | * @user_data: User data to pass to @callback. |
| 14825 | * |
| 14826 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. |
| 14827 | * 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. |
| 14828 | * You can then call control_power_call_set_power_state_finish() to get the result of the operation. |
| 14829 | * |
| 14830 | * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method. |
| 14831 | */ |
| 14832 | void |
| 14833 | control_power_call_set_power_state ( |
| 14834 | ControlPower *proxy, |
| 14835 | gint arg_state, |
| 14836 | GCancellable *cancellable, |
| 14837 | GAsyncReadyCallback callback, |
| 14838 | gpointer user_data) |
| 14839 | { |
| 14840 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14841 | "setPowerState", |
| 14842 | g_variant_new ("(i)", |
| 14843 | arg_state), |
| 14844 | G_DBUS_CALL_FLAGS_NONE, |
| 14845 | -1, |
| 14846 | cancellable, |
| 14847 | callback, |
| 14848 | user_data); |
| 14849 | } |
| 14850 | |
| 14851 | /** |
| 14852 | * control_power_call_set_power_state_finish: |
| 14853 | * @proxy: A #ControlPowerProxy. |
| 14854 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state(). |
| 14855 | * @error: Return location for error or %NULL. |
| 14856 | * |
| 14857 | * Finishes an operation started with control_power_call_set_power_state(). |
| 14858 | * |
| 14859 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14860 | */ |
| 14861 | gboolean |
| 14862 | control_power_call_set_power_state_finish ( |
| 14863 | ControlPower *proxy, |
| 14864 | GAsyncResult *res, |
| 14865 | GError **error) |
| 14866 | { |
| 14867 | GVariant *_ret; |
| 14868 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14869 | if (_ret == NULL) |
| 14870 | goto _out; |
| 14871 | g_variant_get (_ret, |
| 14872 | "()"); |
| 14873 | g_variant_unref (_ret); |
| 14874 | _out: |
| 14875 | return _ret != NULL; |
| 14876 | } |
| 14877 | |
| 14878 | /** |
| 14879 | * control_power_call_set_power_state_sync: |
| 14880 | * @proxy: A #ControlPowerProxy. |
| 14881 | * @arg_state: Argument to pass with the method invocation. |
| 14882 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14883 | * @error: Return location for error or %NULL. |
| 14884 | * |
| 14885 | * 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. |
| 14886 | * |
| 14887 | * See control_power_call_set_power_state() for the asynchronous version of this method. |
| 14888 | * |
| 14889 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14890 | */ |
| 14891 | gboolean |
| 14892 | control_power_call_set_power_state_sync ( |
| 14893 | ControlPower *proxy, |
| 14894 | gint arg_state, |
| 14895 | GCancellable *cancellable, |
| 14896 | GError **error) |
| 14897 | { |
| 14898 | GVariant *_ret; |
| 14899 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14900 | "setPowerState", |
| 14901 | g_variant_new ("(i)", |
| 14902 | arg_state), |
| 14903 | G_DBUS_CALL_FLAGS_NONE, |
| 14904 | -1, |
| 14905 | cancellable, |
| 14906 | error); |
| 14907 | if (_ret == NULL) |
| 14908 | goto _out; |
| 14909 | g_variant_get (_ret, |
| 14910 | "()"); |
| 14911 | g_variant_unref (_ret); |
| 14912 | _out: |
| 14913 | return _ret != NULL; |
| 14914 | } |
| 14915 | |
| 14916 | /** |
| 14917 | * control_power_call_get_power_state: |
| 14918 | * @proxy: A #ControlPowerProxy. |
| 14919 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14920 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14921 | * @user_data: User data to pass to @callback. |
| 14922 | * |
| 14923 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. |
| 14924 | * 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. |
| 14925 | * You can then call control_power_call_get_power_state_finish() to get the result of the operation. |
| 14926 | * |
| 14927 | * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method. |
| 14928 | */ |
| 14929 | void |
| 14930 | control_power_call_get_power_state ( |
| 14931 | ControlPower *proxy, |
| 14932 | GCancellable *cancellable, |
| 14933 | GAsyncReadyCallback callback, |
| 14934 | gpointer user_data) |
| 14935 | { |
| 14936 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14937 | "getPowerState", |
| 14938 | g_variant_new ("()"), |
| 14939 | G_DBUS_CALL_FLAGS_NONE, |
| 14940 | -1, |
| 14941 | cancellable, |
| 14942 | callback, |
| 14943 | user_data); |
| 14944 | } |
| 14945 | |
| 14946 | /** |
| 14947 | * control_power_call_get_power_state_finish: |
| 14948 | * @proxy: A #ControlPowerProxy. |
| 14949 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 14950 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state(). |
| 14951 | * @error: Return location for error or %NULL. |
| 14952 | * |
| 14953 | * Finishes an operation started with control_power_call_get_power_state(). |
| 14954 | * |
| 14955 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14956 | */ |
| 14957 | gboolean |
| 14958 | control_power_call_get_power_state_finish ( |
| 14959 | ControlPower *proxy, |
| 14960 | gint *out_state, |
| 14961 | GAsyncResult *res, |
| 14962 | GError **error) |
| 14963 | { |
| 14964 | GVariant *_ret; |
| 14965 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14966 | if (_ret == NULL) |
| 14967 | goto _out; |
| 14968 | g_variant_get (_ret, |
| 14969 | "(i)", |
| 14970 | out_state); |
| 14971 | g_variant_unref (_ret); |
| 14972 | _out: |
| 14973 | return _ret != NULL; |
| 14974 | } |
| 14975 | |
| 14976 | /** |
| 14977 | * control_power_call_get_power_state_sync: |
| 14978 | * @proxy: A #ControlPowerProxy. |
| 14979 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 14980 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14981 | * @error: Return location for error or %NULL. |
| 14982 | * |
| 14983 | * 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. |
| 14984 | * |
| 14985 | * See control_power_call_get_power_state() for the asynchronous version of this method. |
| 14986 | * |
| 14987 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14988 | */ |
| 14989 | gboolean |
| 14990 | control_power_call_get_power_state_sync ( |
| 14991 | ControlPower *proxy, |
| 14992 | gint *out_state, |
| 14993 | GCancellable *cancellable, |
| 14994 | GError **error) |
| 14995 | { |
| 14996 | GVariant *_ret; |
| 14997 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14998 | "getPowerState", |
| 14999 | g_variant_new ("()"), |
| 15000 | G_DBUS_CALL_FLAGS_NONE, |
| 15001 | -1, |
| 15002 | cancellable, |
| 15003 | error); |
| 15004 | if (_ret == NULL) |
| 15005 | goto _out; |
| 15006 | g_variant_get (_ret, |
| 15007 | "(i)", |
| 15008 | out_state); |
| 15009 | g_variant_unref (_ret); |
| 15010 | _out: |
| 15011 | return _ret != NULL; |
| 15012 | } |
| 15013 | |
| 15014 | /** |
| 15015 | * control_power_complete_set_power_state: |
| 15016 | * @object: A #ControlPower. |
| 15017 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15018 | * |
| 15019 | * 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. |
| 15020 | * |
| 15021 | * This method will free @invocation, you cannot use it afterwards. |
| 15022 | */ |
| 15023 | void |
| 15024 | control_power_complete_set_power_state ( |
| 15025 | ControlPower *object, |
| 15026 | GDBusMethodInvocation *invocation) |
| 15027 | { |
| 15028 | g_dbus_method_invocation_return_value (invocation, |
| 15029 | g_variant_new ("()")); |
| 15030 | } |
| 15031 | |
| 15032 | /** |
| 15033 | * control_power_complete_get_power_state: |
| 15034 | * @object: A #ControlPower. |
| 15035 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15036 | * @state: Parameter to return. |
| 15037 | * |
| 15038 | * 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. |
| 15039 | * |
| 15040 | * This method will free @invocation, you cannot use it afterwards. |
| 15041 | */ |
| 15042 | void |
| 15043 | control_power_complete_get_power_state ( |
| 15044 | ControlPower *object, |
| 15045 | GDBusMethodInvocation *invocation, |
| 15046 | gint state) |
| 15047 | { |
| 15048 | g_dbus_method_invocation_return_value (invocation, |
| 15049 | g_variant_new ("(i)", |
| 15050 | state)); |
| 15051 | } |
| 15052 | |
| 15053 | /* ------------------------------------------------------------------------ */ |
| 15054 | |
| 15055 | /** |
| 15056 | * ControlPowerProxy: |
| 15057 | * |
| 15058 | * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API. |
| 15059 | */ |
| 15060 | |
| 15061 | /** |
| 15062 | * ControlPowerProxyClass: |
| 15063 | * @parent_class: The parent class. |
| 15064 | * |
| 15065 | * Class structure for #ControlPowerProxy. |
| 15066 | */ |
| 15067 | |
| 15068 | struct _ControlPowerProxyPrivate |
| 15069 | { |
| 15070 | GData *qdata; |
| 15071 | }; |
| 15072 | |
| 15073 | static void control_power_proxy_iface_init (ControlPowerIface *iface); |
| 15074 | |
| 15075 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15076 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 15077 | G_ADD_PRIVATE (ControlPowerProxy) |
| 15078 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 15079 | |
| 15080 | #else |
| 15081 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 15082 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 15083 | |
| 15084 | #endif |
| 15085 | static void |
| 15086 | control_power_proxy_finalize (GObject *object) |
| 15087 | { |
| 15088 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15089 | g_datalist_clear (&proxy->priv->qdata); |
| 15090 | G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object); |
| 15091 | } |
| 15092 | |
| 15093 | static void |
| 15094 | control_power_proxy_get_property (GObject *object, |
| 15095 | guint prop_id, |
| 15096 | GValue *value, |
| 15097 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15098 | { |
| 15099 | const _ExtendedGDBusPropertyInfo *info; |
| 15100 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15101 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15102 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 15103 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 15104 | if (info->use_gvariant) |
| 15105 | { |
| 15106 | g_value_set_variant (value, variant); |
| 15107 | } |
| 15108 | else |
| 15109 | { |
| 15110 | if (variant != NULL) |
| 15111 | g_dbus_gvariant_to_gvalue (variant, value); |
| 15112 | } |
| 15113 | if (variant != NULL) |
| 15114 | g_variant_unref (variant); |
| 15115 | } |
| 15116 | |
| 15117 | static void |
| 15118 | control_power_proxy_set_property_cb (GDBusProxy *proxy, |
| 15119 | GAsyncResult *res, |
| 15120 | gpointer user_data) |
| 15121 | { |
| 15122 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 15123 | GError *error; |
| 15124 | GVariant *_ret; |
| 15125 | error = NULL; |
| 15126 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 15127 | if (!_ret) |
| 15128 | { |
| 15129 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)", |
| 15130 | info->parent_struct.name, |
| 15131 | error->message, g_quark_to_string (error->domain), error->code); |
| 15132 | g_error_free (error); |
| 15133 | } |
| 15134 | else |
| 15135 | { |
| 15136 | g_variant_unref (_ret); |
| 15137 | } |
| 15138 | } |
| 15139 | |
| 15140 | static void |
| 15141 | control_power_proxy_set_property (GObject *object, |
| 15142 | guint prop_id, |
| 15143 | const GValue *value, |
| 15144 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15145 | { |
| 15146 | const _ExtendedGDBusPropertyInfo *info; |
| 15147 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15148 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15149 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 15150 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15151 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 15152 | "org.freedesktop.DBus.Properties.Set", |
| 15153 | g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant), |
| 15154 | G_DBUS_CALL_FLAGS_NONE, |
| 15155 | -1, |
| 15156 | NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 15157 | g_variant_unref (variant); |
| 15158 | } |
| 15159 | |
| 15160 | static void |
| 15161 | control_power_proxy_g_signal (GDBusProxy *proxy, |
| 15162 | const gchar *sender_name G_GNUC_UNUSED, |
| 15163 | const gchar *signal_name, |
| 15164 | GVariant *parameters) |
| 15165 | { |
| 15166 | _ExtendedGDBusSignalInfo *info; |
| 15167 | GVariantIter iter; |
| 15168 | GVariant *child; |
| 15169 | GValue *paramv; |
| 15170 | guint num_params; |
| 15171 | guint n; |
| 15172 | guint signal_id; |
| 15173 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name); |
| 15174 | if (info == NULL) |
| 15175 | return; |
| 15176 | num_params = g_variant_n_children (parameters); |
| 15177 | paramv = g_new0 (GValue, num_params + 1); |
| 15178 | g_value_init (¶mv[0], TYPE_CONTROL_POWER); |
| 15179 | g_value_set_object (¶mv[0], proxy); |
| 15180 | g_variant_iter_init (&iter, parameters); |
| 15181 | n = 1; |
| 15182 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15183 | { |
| 15184 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 15185 | if (arg_info->use_gvariant) |
| 15186 | { |
| 15187 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15188 | g_value_set_variant (¶mv[n], child); |
| 15189 | n++; |
| 15190 | } |
| 15191 | else |
| 15192 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15193 | g_variant_unref (child); |
| 15194 | } |
| 15195 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 15196 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 15197 | for (n = 0; n < num_params + 1; n++) |
| 15198 | g_value_unset (¶mv[n]); |
| 15199 | g_free (paramv); |
| 15200 | } |
| 15201 | |
| 15202 | static void |
| 15203 | control_power_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 15204 | GVariant *changed_properties, |
| 15205 | const gchar *const *invalidated_properties) |
| 15206 | { |
| 15207 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy); |
| 15208 | guint n; |
| 15209 | const gchar *key; |
| 15210 | GVariantIter *iter; |
| 15211 | _ExtendedGDBusPropertyInfo *info; |
| 15212 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 15213 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 15214 | { |
| 15215 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key); |
| 15216 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 15217 | if (info != NULL) |
| 15218 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 15219 | } |
| 15220 | g_variant_iter_free (iter); |
| 15221 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 15222 | { |
| 15223 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]); |
| 15224 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 15225 | if (info != NULL) |
| 15226 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 15227 | } |
| 15228 | } |
| 15229 | |
| 15230 | static gint |
| 15231 | control_power_proxy_get_pgood (ControlPower *object) |
| 15232 | { |
| 15233 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15234 | GVariant *variant; |
| 15235 | gint value = 0; |
| 15236 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood"); |
| 15237 | if (variant != NULL) |
| 15238 | { |
| 15239 | value = g_variant_get_int32 (variant); |
| 15240 | g_variant_unref (variant); |
| 15241 | } |
| 15242 | return value; |
| 15243 | } |
| 15244 | |
| 15245 | static gint |
| 15246 | control_power_proxy_get_state (ControlPower *object) |
| 15247 | { |
| 15248 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15249 | GVariant *variant; |
| 15250 | gint value = 0; |
| 15251 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 15252 | if (variant != NULL) |
| 15253 | { |
| 15254 | value = g_variant_get_int32 (variant); |
| 15255 | g_variant_unref (variant); |
| 15256 | } |
| 15257 | return value; |
| 15258 | } |
| 15259 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15260 | static gint |
| 15261 | control_power_proxy_get_pgood_timeout (ControlPower *object) |
| 15262 | { |
| 15263 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15264 | GVariant *variant; |
| 15265 | gint value = 0; |
| 15266 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout"); |
| 15267 | if (variant != NULL) |
| 15268 | { |
| 15269 | value = g_variant_get_int32 (variant); |
| 15270 | g_variant_unref (variant); |
| 15271 | } |
| 15272 | return value; |
| 15273 | } |
| 15274 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15275 | static void |
| 15276 | control_power_proxy_init (ControlPowerProxy *proxy) |
| 15277 | { |
| 15278 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15279 | proxy->priv = control_power_proxy_get_instance_private (proxy); |
| 15280 | #else |
| 15281 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate); |
| 15282 | #endif |
| 15283 | |
| 15284 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ()); |
| 15285 | } |
| 15286 | |
| 15287 | static void |
| 15288 | control_power_proxy_class_init (ControlPowerProxyClass *klass) |
| 15289 | { |
| 15290 | GObjectClass *gobject_class; |
| 15291 | GDBusProxyClass *proxy_class; |
| 15292 | |
| 15293 | gobject_class = G_OBJECT_CLASS (klass); |
| 15294 | gobject_class->finalize = control_power_proxy_finalize; |
| 15295 | gobject_class->get_property = control_power_proxy_get_property; |
| 15296 | gobject_class->set_property = control_power_proxy_set_property; |
| 15297 | |
| 15298 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 15299 | proxy_class->g_signal = control_power_proxy_g_signal; |
| 15300 | proxy_class->g_properties_changed = control_power_proxy_g_properties_changed; |
| 15301 | |
| 15302 | control_power_override_properties (gobject_class, 1); |
| 15303 | |
| 15304 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 15305 | g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate)); |
| 15306 | #endif |
| 15307 | } |
| 15308 | |
| 15309 | static void |
| 15310 | control_power_proxy_iface_init (ControlPowerIface *iface) |
| 15311 | { |
| 15312 | iface->get_pgood = control_power_proxy_get_pgood; |
| 15313 | iface->get_state = control_power_proxy_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15314 | iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15315 | } |
| 15316 | |
| 15317 | /** |
| 15318 | * control_power_proxy_new: |
| 15319 | * @connection: A #GDBusConnection. |
| 15320 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15321 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15322 | * @object_path: An object path. |
| 15323 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15324 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15325 | * @user_data: User data to pass to @callback. |
| 15326 | * |
| 15327 | * 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. |
| 15328 | * |
| 15329 | * 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. |
| 15330 | * You can then call control_power_proxy_new_finish() to get the result of the operation. |
| 15331 | * |
| 15332 | * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 15333 | */ |
| 15334 | void |
| 15335 | control_power_proxy_new ( |
| 15336 | GDBusConnection *connection, |
| 15337 | GDBusProxyFlags flags, |
| 15338 | const gchar *name, |
| 15339 | const gchar *object_path, |
| 15340 | GCancellable *cancellable, |
| 15341 | GAsyncReadyCallback callback, |
| 15342 | gpointer user_data) |
| 15343 | { |
| 15344 | 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); |
| 15345 | } |
| 15346 | |
| 15347 | /** |
| 15348 | * control_power_proxy_new_finish: |
| 15349 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new(). |
| 15350 | * @error: Return location for error or %NULL |
| 15351 | * |
| 15352 | * Finishes an operation started with control_power_proxy_new(). |
| 15353 | * |
| 15354 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15355 | */ |
| 15356 | ControlPower * |
| 15357 | control_power_proxy_new_finish ( |
| 15358 | GAsyncResult *res, |
| 15359 | GError **error) |
| 15360 | { |
| 15361 | GObject *ret; |
| 15362 | GObject *source_object; |
| 15363 | source_object = g_async_result_get_source_object (res); |
| 15364 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15365 | g_object_unref (source_object); |
| 15366 | if (ret != NULL) |
| 15367 | return CONTROL_POWER (ret); |
| 15368 | else |
| 15369 | return NULL; |
| 15370 | } |
| 15371 | |
| 15372 | /** |
| 15373 | * control_power_proxy_new_sync: |
| 15374 | * @connection: A #GDBusConnection. |
| 15375 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15376 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15377 | * @object_path: An object path. |
| 15378 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15379 | * @error: Return location for error or %NULL |
| 15380 | * |
| 15381 | * 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. |
| 15382 | * |
| 15383 | * The calling thread is blocked until a reply is received. |
| 15384 | * |
| 15385 | * See control_power_proxy_new() for the asynchronous version of this constructor. |
| 15386 | * |
| 15387 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15388 | */ |
| 15389 | ControlPower * |
| 15390 | control_power_proxy_new_sync ( |
| 15391 | GDBusConnection *connection, |
| 15392 | GDBusProxyFlags flags, |
| 15393 | const gchar *name, |
| 15394 | const gchar *object_path, |
| 15395 | GCancellable *cancellable, |
| 15396 | GError **error) |
| 15397 | { |
| 15398 | GInitable *ret; |
| 15399 | 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); |
| 15400 | if (ret != NULL) |
| 15401 | return CONTROL_POWER (ret); |
| 15402 | else |
| 15403 | return NULL; |
| 15404 | } |
| 15405 | |
| 15406 | |
| 15407 | /** |
| 15408 | * control_power_proxy_new_for_bus: |
| 15409 | * @bus_type: A #GBusType. |
| 15410 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15411 | * @name: A bus name (well-known or unique). |
| 15412 | * @object_path: An object path. |
| 15413 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15414 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15415 | * @user_data: User data to pass to @callback. |
| 15416 | * |
| 15417 | * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 15418 | * |
| 15419 | * 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. |
| 15420 | * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation. |
| 15421 | * |
| 15422 | * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 15423 | */ |
| 15424 | void |
| 15425 | control_power_proxy_new_for_bus ( |
| 15426 | GBusType bus_type, |
| 15427 | GDBusProxyFlags flags, |
| 15428 | const gchar *name, |
| 15429 | const gchar *object_path, |
| 15430 | GCancellable *cancellable, |
| 15431 | GAsyncReadyCallback callback, |
| 15432 | gpointer user_data) |
| 15433 | { |
| 15434 | 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); |
| 15435 | } |
| 15436 | |
| 15437 | /** |
| 15438 | * control_power_proxy_new_for_bus_finish: |
| 15439 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus(). |
| 15440 | * @error: Return location for error or %NULL |
| 15441 | * |
| 15442 | * Finishes an operation started with control_power_proxy_new_for_bus(). |
| 15443 | * |
| 15444 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15445 | */ |
| 15446 | ControlPower * |
| 15447 | control_power_proxy_new_for_bus_finish ( |
| 15448 | GAsyncResult *res, |
| 15449 | GError **error) |
| 15450 | { |
| 15451 | GObject *ret; |
| 15452 | GObject *source_object; |
| 15453 | source_object = g_async_result_get_source_object (res); |
| 15454 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15455 | g_object_unref (source_object); |
| 15456 | if (ret != NULL) |
| 15457 | return CONTROL_POWER (ret); |
| 15458 | else |
| 15459 | return NULL; |
| 15460 | } |
| 15461 | |
| 15462 | /** |
| 15463 | * control_power_proxy_new_for_bus_sync: |
| 15464 | * @bus_type: A #GBusType. |
| 15465 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15466 | * @name: A bus name (well-known or unique). |
| 15467 | * @object_path: An object path. |
| 15468 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15469 | * @error: Return location for error or %NULL |
| 15470 | * |
| 15471 | * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 15472 | * |
| 15473 | * The calling thread is blocked until a reply is received. |
| 15474 | * |
| 15475 | * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 15476 | * |
| 15477 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15478 | */ |
| 15479 | ControlPower * |
| 15480 | control_power_proxy_new_for_bus_sync ( |
| 15481 | GBusType bus_type, |
| 15482 | GDBusProxyFlags flags, |
| 15483 | const gchar *name, |
| 15484 | const gchar *object_path, |
| 15485 | GCancellable *cancellable, |
| 15486 | GError **error) |
| 15487 | { |
| 15488 | GInitable *ret; |
| 15489 | 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); |
| 15490 | if (ret != NULL) |
| 15491 | return CONTROL_POWER (ret); |
| 15492 | else |
| 15493 | return NULL; |
| 15494 | } |
| 15495 | |
| 15496 | |
| 15497 | /* ------------------------------------------------------------------------ */ |
| 15498 | |
| 15499 | /** |
| 15500 | * ControlPowerSkeleton: |
| 15501 | * |
| 15502 | * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API. |
| 15503 | */ |
| 15504 | |
| 15505 | /** |
| 15506 | * ControlPowerSkeletonClass: |
| 15507 | * @parent_class: The parent class. |
| 15508 | * |
| 15509 | * Class structure for #ControlPowerSkeleton. |
| 15510 | */ |
| 15511 | |
| 15512 | struct _ControlPowerSkeletonPrivate |
| 15513 | { |
| 15514 | GValue *properties; |
| 15515 | GList *changed_properties; |
| 15516 | GSource *changed_properties_idle_source; |
| 15517 | GMainContext *context; |
| 15518 | GMutex lock; |
| 15519 | }; |
| 15520 | |
| 15521 | static void |
| 15522 | _control_power_skeleton_handle_method_call ( |
| 15523 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15524 | const gchar *sender G_GNUC_UNUSED, |
| 15525 | const gchar *object_path G_GNUC_UNUSED, |
| 15526 | const gchar *interface_name, |
| 15527 | const gchar *method_name, |
| 15528 | GVariant *parameters, |
| 15529 | GDBusMethodInvocation *invocation, |
| 15530 | gpointer user_data) |
| 15531 | { |
| 15532 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15533 | _ExtendedGDBusMethodInfo *info; |
| 15534 | GVariantIter iter; |
| 15535 | GVariant *child; |
| 15536 | GValue *paramv; |
| 15537 | guint num_params; |
| 15538 | guint num_extra; |
| 15539 | guint n; |
| 15540 | guint signal_id; |
| 15541 | GValue return_value = G_VALUE_INIT; |
| 15542 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 15543 | g_assert (info != NULL); |
| 15544 | num_params = g_variant_n_children (parameters); |
| 15545 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 15546 | n = 0; |
| 15547 | g_value_init (¶mv[n], TYPE_CONTROL_POWER); |
| 15548 | g_value_set_object (¶mv[n++], skeleton); |
| 15549 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 15550 | g_value_set_object (¶mv[n++], invocation); |
| 15551 | if (info->pass_fdlist) |
| 15552 | { |
| 15553 | #ifdef G_OS_UNIX |
| 15554 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 15555 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 15556 | #else |
| 15557 | g_assert_not_reached (); |
| 15558 | #endif |
| 15559 | } |
| 15560 | g_variant_iter_init (&iter, parameters); |
| 15561 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15562 | { |
| 15563 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 15564 | if (arg_info->use_gvariant) |
| 15565 | { |
| 15566 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15567 | g_value_set_variant (¶mv[n], child); |
| 15568 | n++; |
| 15569 | } |
| 15570 | else |
| 15571 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15572 | g_variant_unref (child); |
| 15573 | } |
| 15574 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 15575 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 15576 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 15577 | if (!g_value_get_boolean (&return_value)) |
| 15578 | 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); |
| 15579 | g_value_unset (&return_value); |
| 15580 | for (n = 0; n < num_params + num_extra; n++) |
| 15581 | g_value_unset (¶mv[n]); |
| 15582 | g_free (paramv); |
| 15583 | } |
| 15584 | |
| 15585 | static GVariant * |
| 15586 | _control_power_skeleton_handle_get_property ( |
| 15587 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15588 | const gchar *sender G_GNUC_UNUSED, |
| 15589 | const gchar *object_path G_GNUC_UNUSED, |
| 15590 | const gchar *interface_name G_GNUC_UNUSED, |
| 15591 | const gchar *property_name, |
| 15592 | GError **error, |
| 15593 | gpointer user_data) |
| 15594 | { |
| 15595 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15596 | GValue value = G_VALUE_INIT; |
| 15597 | GParamSpec *pspec; |
| 15598 | _ExtendedGDBusPropertyInfo *info; |
| 15599 | GVariant *ret; |
| 15600 | ret = NULL; |
| 15601 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 15602 | g_assert (info != NULL); |
| 15603 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15604 | if (pspec == NULL) |
| 15605 | { |
| 15606 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15607 | } |
| 15608 | else |
| 15609 | { |
| 15610 | g_value_init (&value, pspec->value_type); |
| 15611 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15612 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15613 | g_value_unset (&value); |
| 15614 | } |
| 15615 | return ret; |
| 15616 | } |
| 15617 | |
| 15618 | static gboolean |
| 15619 | _control_power_skeleton_handle_set_property ( |
| 15620 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15621 | const gchar *sender G_GNUC_UNUSED, |
| 15622 | const gchar *object_path G_GNUC_UNUSED, |
| 15623 | const gchar *interface_name G_GNUC_UNUSED, |
| 15624 | const gchar *property_name, |
| 15625 | GVariant *variant, |
| 15626 | GError **error, |
| 15627 | gpointer user_data) |
| 15628 | { |
| 15629 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15630 | GValue value = G_VALUE_INIT; |
| 15631 | GParamSpec *pspec; |
| 15632 | _ExtendedGDBusPropertyInfo *info; |
| 15633 | gboolean ret; |
| 15634 | ret = FALSE; |
| 15635 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 15636 | g_assert (info != NULL); |
| 15637 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15638 | if (pspec == NULL) |
| 15639 | { |
| 15640 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15641 | } |
| 15642 | else |
| 15643 | { |
| 15644 | if (info->use_gvariant) |
| 15645 | g_value_set_variant (&value, variant); |
| 15646 | else |
| 15647 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 15648 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15649 | g_value_unset (&value); |
| 15650 | ret = TRUE; |
| 15651 | } |
| 15652 | return ret; |
| 15653 | } |
| 15654 | |
| 15655 | static const GDBusInterfaceVTable _control_power_skeleton_vtable = |
| 15656 | { |
| 15657 | _control_power_skeleton_handle_method_call, |
| 15658 | _control_power_skeleton_handle_get_property, |
| 15659 | _control_power_skeleton_handle_set_property, |
| 15660 | {NULL} |
| 15661 | }; |
| 15662 | |
| 15663 | static GDBusInterfaceInfo * |
| 15664 | control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15665 | { |
| 15666 | return control_power_interface_info (); |
| 15667 | } |
| 15668 | |
| 15669 | static GDBusInterfaceVTable * |
| 15670 | control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15671 | { |
| 15672 | return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable; |
| 15673 | } |
| 15674 | |
| 15675 | static GVariant * |
| 15676 | control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 15677 | { |
| 15678 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 15679 | |
| 15680 | GVariantBuilder builder; |
| 15681 | guint n; |
| 15682 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15683 | if (_control_power_interface_info.parent_struct.properties == NULL) |
| 15684 | goto out; |
| 15685 | for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++) |
| 15686 | { |
| 15687 | GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n]; |
| 15688 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 15689 | { |
| 15690 | GVariant *value; |
| 15691 | 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); |
| 15692 | if (value != NULL) |
| 15693 | { |
| 15694 | g_variant_take_ref (value); |
| 15695 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 15696 | g_variant_unref (value); |
| 15697 | } |
| 15698 | } |
| 15699 | } |
| 15700 | out: |
| 15701 | return g_variant_builder_end (&builder); |
| 15702 | } |
| 15703 | |
| 15704 | static gboolean _control_power_emit_changed (gpointer user_data); |
| 15705 | |
| 15706 | static void |
| 15707 | control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 15708 | { |
| 15709 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 15710 | gboolean emit_changed = FALSE; |
| 15711 | |
| 15712 | g_mutex_lock (&skeleton->priv->lock); |
| 15713 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15714 | { |
| 15715 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15716 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15717 | emit_changed = TRUE; |
| 15718 | } |
| 15719 | g_mutex_unlock (&skeleton->priv->lock); |
| 15720 | |
| 15721 | if (emit_changed) |
| 15722 | _control_power_emit_changed (skeleton); |
| 15723 | } |
| 15724 | |
| 15725 | static void |
| 15726 | _control_power_on_signal_power_good ( |
| 15727 | ControlPower *object) |
| 15728 | { |
| 15729 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15730 | |
| 15731 | GList *connections, *l; |
| 15732 | GVariant *signal_variant; |
| 15733 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15734 | |
| 15735 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 15736 | for (l = connections; l != NULL; l = l->next) |
| 15737 | { |
| 15738 | GDBusConnection *connection = l->data; |
| 15739 | g_dbus_connection_emit_signal (connection, |
| 15740 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood", |
| 15741 | signal_variant, NULL); |
| 15742 | } |
| 15743 | g_variant_unref (signal_variant); |
| 15744 | g_list_free_full (connections, g_object_unref); |
| 15745 | } |
| 15746 | |
| 15747 | static void |
| 15748 | _control_power_on_signal_power_lost ( |
| 15749 | ControlPower *object) |
| 15750 | { |
| 15751 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15752 | |
| 15753 | GList *connections, *l; |
| 15754 | GVariant *signal_variant; |
| 15755 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15756 | |
| 15757 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 15758 | for (l = connections; l != NULL; l = l->next) |
| 15759 | { |
| 15760 | GDBusConnection *connection = l->data; |
| 15761 | g_dbus_connection_emit_signal (connection, |
| 15762 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost", |
| 15763 | signal_variant, NULL); |
| 15764 | } |
| 15765 | g_variant_unref (signal_variant); |
| 15766 | g_list_free_full (connections, g_object_unref); |
| 15767 | } |
| 15768 | |
| 15769 | static void control_power_skeleton_iface_init (ControlPowerIface *iface); |
| 15770 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15771 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15772 | G_ADD_PRIVATE (ControlPowerSkeleton) |
| 15773 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 15774 | |
| 15775 | #else |
| 15776 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15777 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 15778 | |
| 15779 | #endif |
| 15780 | static void |
| 15781 | control_power_skeleton_finalize (GObject *object) |
| 15782 | { |
| 15783 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15784 | guint n; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15785 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15786 | g_value_unset (&skeleton->priv->properties[n]); |
| 15787 | g_free (skeleton->priv->properties); |
| 15788 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15789 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15790 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15791 | g_main_context_unref (skeleton->priv->context); |
| 15792 | g_mutex_clear (&skeleton->priv->lock); |
| 15793 | G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object); |
| 15794 | } |
| 15795 | |
| 15796 | static void |
| 15797 | control_power_skeleton_get_property (GObject *object, |
| 15798 | guint prop_id, |
| 15799 | GValue *value, |
| 15800 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15801 | { |
| 15802 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15803 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15804 | g_mutex_lock (&skeleton->priv->lock); |
| 15805 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 15806 | g_mutex_unlock (&skeleton->priv->lock); |
| 15807 | } |
| 15808 | |
| 15809 | static gboolean |
| 15810 | _control_power_emit_changed (gpointer user_data) |
| 15811 | { |
| 15812 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15813 | GList *l; |
| 15814 | GVariantBuilder builder; |
| 15815 | GVariantBuilder invalidated_builder; |
| 15816 | guint num_changes; |
| 15817 | |
| 15818 | g_mutex_lock (&skeleton->priv->lock); |
| 15819 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15820 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 15821 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 15822 | { |
| 15823 | ChangedProperty *cp = l->data; |
| 15824 | GVariant *variant; |
| 15825 | const GValue *cur_value; |
| 15826 | |
| 15827 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 15828 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 15829 | { |
| 15830 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 15831 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 15832 | g_variant_unref (variant); |
| 15833 | num_changes++; |
| 15834 | } |
| 15835 | } |
| 15836 | if (num_changes > 0) |
| 15837 | { |
| 15838 | GList *connections, *ll; |
| 15839 | GVariant *signal_variant; |
| 15840 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power", |
| 15841 | &builder, &invalidated_builder)); |
| 15842 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15843 | for (ll = connections; ll != NULL; ll = ll->next) |
| 15844 | { |
| 15845 | GDBusConnection *connection = ll->data; |
| 15846 | |
| 15847 | g_dbus_connection_emit_signal (connection, |
| 15848 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 15849 | "org.freedesktop.DBus.Properties", |
| 15850 | "PropertiesChanged", |
| 15851 | signal_variant, |
| 15852 | NULL); |
| 15853 | } |
| 15854 | g_variant_unref (signal_variant); |
| 15855 | g_list_free_full (connections, g_object_unref); |
| 15856 | } |
| 15857 | else |
| 15858 | { |
| 15859 | g_variant_builder_clear (&builder); |
| 15860 | g_variant_builder_clear (&invalidated_builder); |
| 15861 | } |
| 15862 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15863 | skeleton->priv->changed_properties = NULL; |
| 15864 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15865 | g_mutex_unlock (&skeleton->priv->lock); |
| 15866 | return FALSE; |
| 15867 | } |
| 15868 | |
| 15869 | static void |
| 15870 | _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 15871 | { |
| 15872 | ChangedProperty *cp; |
| 15873 | GList *l; |
| 15874 | cp = NULL; |
| 15875 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 15876 | { |
| 15877 | ChangedProperty *i_cp = l->data; |
| 15878 | if (i_cp->info == info) |
| 15879 | { |
| 15880 | cp = i_cp; |
| 15881 | break; |
| 15882 | } |
| 15883 | } |
| 15884 | if (cp == NULL) |
| 15885 | { |
| 15886 | cp = g_new0 (ChangedProperty, 1); |
| 15887 | cp->prop_id = prop_id; |
| 15888 | cp->info = info; |
| 15889 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 15890 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 15891 | g_value_copy (orig_value, &cp->orig_value); |
| 15892 | } |
| 15893 | } |
| 15894 | |
| 15895 | static void |
| 15896 | control_power_skeleton_notify (GObject *object, |
| 15897 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15898 | { |
| 15899 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15900 | g_mutex_lock (&skeleton->priv->lock); |
| 15901 | if (skeleton->priv->changed_properties != NULL && |
| 15902 | skeleton->priv->changed_properties_idle_source == NULL) |
| 15903 | { |
| 15904 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 15905 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 15906 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 15907 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 15908 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 15909 | } |
| 15910 | g_mutex_unlock (&skeleton->priv->lock); |
| 15911 | } |
| 15912 | |
| 15913 | static void |
| 15914 | control_power_skeleton_set_property (GObject *object, |
| 15915 | guint prop_id, |
| 15916 | const GValue *value, |
| 15917 | GParamSpec *pspec) |
| 15918 | { |
| 15919 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15920 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15921 | g_mutex_lock (&skeleton->priv->lock); |
| 15922 | g_object_freeze_notify (object); |
| 15923 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 15924 | { |
| 15925 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 15926 | _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 15927 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 15928 | g_object_notify_by_pspec (object, pspec); |
| 15929 | } |
| 15930 | g_mutex_unlock (&skeleton->priv->lock); |
| 15931 | g_object_thaw_notify (object); |
| 15932 | } |
| 15933 | |
| 15934 | static void |
| 15935 | control_power_skeleton_init (ControlPowerSkeleton *skeleton) |
| 15936 | { |
| 15937 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15938 | skeleton->priv = control_power_skeleton_get_instance_private (skeleton); |
| 15939 | #else |
| 15940 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate); |
| 15941 | #endif |
| 15942 | |
| 15943 | g_mutex_init (&skeleton->priv->lock); |
| 15944 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15945 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15946 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 15947 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15948 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15949 | } |
| 15950 | |
| 15951 | static gint |
| 15952 | control_power_skeleton_get_pgood (ControlPower *object) |
| 15953 | { |
| 15954 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15955 | gint value; |
| 15956 | g_mutex_lock (&skeleton->priv->lock); |
| 15957 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 15958 | g_mutex_unlock (&skeleton->priv->lock); |
| 15959 | return value; |
| 15960 | } |
| 15961 | |
| 15962 | static gint |
| 15963 | control_power_skeleton_get_state (ControlPower *object) |
| 15964 | { |
| 15965 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15966 | gint value; |
| 15967 | g_mutex_lock (&skeleton->priv->lock); |
| 15968 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 15969 | g_mutex_unlock (&skeleton->priv->lock); |
| 15970 | return value; |
| 15971 | } |
| 15972 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15973 | static gint |
| 15974 | control_power_skeleton_get_pgood_timeout (ControlPower *object) |
| 15975 | { |
| 15976 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15977 | gint value; |
| 15978 | g_mutex_lock (&skeleton->priv->lock); |
| 15979 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 15980 | g_mutex_unlock (&skeleton->priv->lock); |
| 15981 | return value; |
| 15982 | } |
| 15983 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15984 | static void |
| 15985 | control_power_skeleton_class_init (ControlPowerSkeletonClass *klass) |
| 15986 | { |
| 15987 | GObjectClass *gobject_class; |
| 15988 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 15989 | |
| 15990 | gobject_class = G_OBJECT_CLASS (klass); |
| 15991 | gobject_class->finalize = control_power_skeleton_finalize; |
| 15992 | gobject_class->get_property = control_power_skeleton_get_property; |
| 15993 | gobject_class->set_property = control_power_skeleton_set_property; |
| 15994 | gobject_class->notify = control_power_skeleton_notify; |
| 15995 | |
| 15996 | |
| 15997 | control_power_override_properties (gobject_class, 1); |
| 15998 | |
| 15999 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 16000 | skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info; |
| 16001 | skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties; |
| 16002 | skeleton_class->flush = control_power_skeleton_dbus_interface_flush; |
| 16003 | skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable; |
| 16004 | |
| 16005 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16006 | g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate)); |
| 16007 | #endif |
| 16008 | } |
| 16009 | |
| 16010 | static void |
| 16011 | control_power_skeleton_iface_init (ControlPowerIface *iface) |
| 16012 | { |
| 16013 | iface->power_good = _control_power_on_signal_power_good; |
| 16014 | iface->power_lost = _control_power_on_signal_power_lost; |
| 16015 | iface->get_pgood = control_power_skeleton_get_pgood; |
| 16016 | iface->get_state = control_power_skeleton_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16017 | iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16018 | } |
| 16019 | |
| 16020 | /** |
| 16021 | * control_power_skeleton_new: |
| 16022 | * |
| 16023 | * 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>. |
| 16024 | * |
| 16025 | * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object. |
| 16026 | */ |
| 16027 | ControlPower * |
| 16028 | control_power_skeleton_new (void) |
| 16029 | { |
| 16030 | return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL)); |
| 16031 | } |
| 16032 | |
| 16033 | /* ------------------------------------------------------------------------ |
| 16034 | * Code for interface org.openbmc.Watchdog |
| 16035 | * ------------------------------------------------------------------------ |
| 16036 | */ |
| 16037 | |
| 16038 | /** |
| 16039 | * SECTION:Watchdog |
| 16040 | * @title: Watchdog |
| 16041 | * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface |
| 16042 | * |
| 16043 | * 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. |
| 16044 | */ |
| 16045 | |
| 16046 | /* ---- Introspection data for org.openbmc.Watchdog ---- */ |
| 16047 | |
| 16048 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = |
| 16049 | { |
| 16050 | { |
| 16051 | -1, |
| 16052 | (gchar *) "start", |
| 16053 | NULL, |
| 16054 | NULL, |
| 16055 | NULL |
| 16056 | }, |
| 16057 | "handle-start", |
| 16058 | FALSE |
| 16059 | }; |
| 16060 | |
| 16061 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = |
| 16062 | { |
| 16063 | { |
| 16064 | -1, |
| 16065 | (gchar *) "poke", |
| 16066 | NULL, |
| 16067 | NULL, |
| 16068 | NULL |
| 16069 | }, |
| 16070 | "handle-poke", |
| 16071 | FALSE |
| 16072 | }; |
| 16073 | |
| 16074 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = |
| 16075 | { |
| 16076 | { |
| 16077 | -1, |
| 16078 | (gchar *) "stop", |
| 16079 | NULL, |
| 16080 | NULL, |
| 16081 | NULL |
| 16082 | }, |
| 16083 | "handle-stop", |
| 16084 | FALSE |
| 16085 | }; |
| 16086 | |
| 16087 | static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = |
| 16088 | { |
| 16089 | &_watchdog_method_info_start, |
| 16090 | &_watchdog_method_info_poke, |
| 16091 | &_watchdog_method_info_stop, |
| 16092 | NULL |
| 16093 | }; |
| 16094 | |
| 16095 | static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = |
| 16096 | { |
| 16097 | { |
| 16098 | -1, |
| 16099 | (gchar *) "WatchdogError", |
| 16100 | NULL, |
| 16101 | NULL |
| 16102 | }, |
| 16103 | "watchdog-error" |
| 16104 | }; |
| 16105 | |
| 16106 | static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = |
| 16107 | { |
| 16108 | &_watchdog_signal_info_watchdog_error, |
| 16109 | NULL |
| 16110 | }; |
| 16111 | |
| 16112 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = |
| 16113 | { |
| 16114 | { |
| 16115 | -1, |
| 16116 | (gchar *) "watchdog", |
| 16117 | (gchar *) "i", |
| 16118 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 16119 | NULL |
| 16120 | }, |
| 16121 | "watchdog", |
| 16122 | FALSE |
| 16123 | }; |
| 16124 | |
| 16125 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = |
| 16126 | { |
| 16127 | { |
| 16128 | -1, |
| 16129 | (gchar *) "poll_interval", |
| 16130 | (gchar *) "i", |
| 16131 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 16132 | NULL |
| 16133 | }, |
| 16134 | "poll-interval", |
| 16135 | FALSE |
| 16136 | }; |
| 16137 | |
| 16138 | static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = |
| 16139 | { |
| 16140 | &_watchdog_property_info_watchdog, |
| 16141 | &_watchdog_property_info_poll_interval, |
| 16142 | NULL |
| 16143 | }; |
| 16144 | |
| 16145 | static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = |
| 16146 | { |
| 16147 | { |
| 16148 | -1, |
| 16149 | (gchar *) "org.openbmc.Watchdog", |
| 16150 | (GDBusMethodInfo **) &_watchdog_method_info_pointers, |
| 16151 | (GDBusSignalInfo **) &_watchdog_signal_info_pointers, |
| 16152 | (GDBusPropertyInfo **) &_watchdog_property_info_pointers, |
| 16153 | NULL |
| 16154 | }, |
| 16155 | "watchdog", |
| 16156 | }; |
| 16157 | |
| 16158 | |
| 16159 | /** |
| 16160 | * watchdog_interface_info: |
| 16161 | * |
| 16162 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. |
| 16163 | * |
| 16164 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 16165 | */ |
| 16166 | GDBusInterfaceInfo * |
| 16167 | watchdog_interface_info (void) |
| 16168 | { |
| 16169 | return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; |
| 16170 | } |
| 16171 | |
| 16172 | /** |
| 16173 | * watchdog_override_properties: |
| 16174 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 16175 | * @property_id_begin: The property id to assign to the first overridden property. |
| 16176 | * |
| 16177 | * Overrides all #GObject properties in the #Watchdog interface for a concrete class. |
| 16178 | * The properties are overridden in the order they are defined. |
| 16179 | * |
| 16180 | * Returns: The last property id. |
| 16181 | */ |
| 16182 | guint |
| 16183 | watchdog_override_properties (GObjectClass *klass, guint property_id_begin) |
| 16184 | { |
| 16185 | g_object_class_override_property (klass, property_id_begin++, "watchdog"); |
| 16186 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 16187 | return property_id_begin - 1; |
| 16188 | } |
| 16189 | |
| 16190 | |
| 16191 | |
| 16192 | /** |
| 16193 | * Watchdog: |
| 16194 | * |
| 16195 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 16196 | */ |
| 16197 | |
| 16198 | /** |
| 16199 | * WatchdogIface: |
| 16200 | * @parent_iface: The parent interface. |
| 16201 | * @handle_poke: Handler for the #Watchdog::handle-poke signal. |
| 16202 | * @handle_start: Handler for the #Watchdog::handle-start signal. |
| 16203 | * @handle_stop: Handler for the #Watchdog::handle-stop signal. |
| 16204 | * @get_poll_interval: Getter for the #Watchdog:poll-interval property. |
| 16205 | * @get_watchdog: Getter for the #Watchdog:watchdog property. |
| 16206 | * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. |
| 16207 | * |
| 16208 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 16209 | */ |
| 16210 | |
| 16211 | typedef WatchdogIface WatchdogInterface; |
| 16212 | G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); |
| 16213 | |
| 16214 | static void |
| 16215 | watchdog_default_init (WatchdogIface *iface) |
| 16216 | { |
| 16217 | /* GObject signals for incoming D-Bus method calls: */ |
| 16218 | /** |
| 16219 | * Watchdog::handle-start: |
| 16220 | * @object: A #Watchdog. |
| 16221 | * @invocation: A #GDBusMethodInvocation. |
| 16222 | * |
| 16223 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. |
| 16224 | * |
| 16225 | * 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. |
| 16226 | * |
| 16227 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16228 | */ |
| 16229 | g_signal_new ("handle-start", |
| 16230 | G_TYPE_FROM_INTERFACE (iface), |
| 16231 | G_SIGNAL_RUN_LAST, |
| 16232 | G_STRUCT_OFFSET (WatchdogIface, handle_start), |
| 16233 | g_signal_accumulator_true_handled, |
| 16234 | NULL, |
| 16235 | g_cclosure_marshal_generic, |
| 16236 | G_TYPE_BOOLEAN, |
| 16237 | 1, |
| 16238 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16239 | |
| 16240 | /** |
| 16241 | * Watchdog::handle-poke: |
| 16242 | * @object: A #Watchdog. |
| 16243 | * @invocation: A #GDBusMethodInvocation. |
| 16244 | * |
| 16245 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. |
| 16246 | * |
| 16247 | * 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. |
| 16248 | * |
| 16249 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16250 | */ |
| 16251 | g_signal_new ("handle-poke", |
| 16252 | G_TYPE_FROM_INTERFACE (iface), |
| 16253 | G_SIGNAL_RUN_LAST, |
| 16254 | G_STRUCT_OFFSET (WatchdogIface, handle_poke), |
| 16255 | g_signal_accumulator_true_handled, |
| 16256 | NULL, |
| 16257 | g_cclosure_marshal_generic, |
| 16258 | G_TYPE_BOOLEAN, |
| 16259 | 1, |
| 16260 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16261 | |
| 16262 | /** |
| 16263 | * Watchdog::handle-stop: |
| 16264 | * @object: A #Watchdog. |
| 16265 | * @invocation: A #GDBusMethodInvocation. |
| 16266 | * |
| 16267 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. |
| 16268 | * |
| 16269 | * 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. |
| 16270 | * |
| 16271 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16272 | */ |
| 16273 | g_signal_new ("handle-stop", |
| 16274 | G_TYPE_FROM_INTERFACE (iface), |
| 16275 | G_SIGNAL_RUN_LAST, |
| 16276 | G_STRUCT_OFFSET (WatchdogIface, handle_stop), |
| 16277 | g_signal_accumulator_true_handled, |
| 16278 | NULL, |
| 16279 | g_cclosure_marshal_generic, |
| 16280 | G_TYPE_BOOLEAN, |
| 16281 | 1, |
| 16282 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16283 | |
| 16284 | /* GObject signals for received D-Bus signals: */ |
| 16285 | /** |
| 16286 | * Watchdog::watchdog-error: |
| 16287 | * @object: A #Watchdog. |
| 16288 | * |
| 16289 | * 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. |
| 16290 | * |
| 16291 | * 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. |
| 16292 | */ |
| 16293 | g_signal_new ("watchdog-error", |
| 16294 | G_TYPE_FROM_INTERFACE (iface), |
| 16295 | G_SIGNAL_RUN_LAST, |
| 16296 | G_STRUCT_OFFSET (WatchdogIface, watchdog_error), |
| 16297 | NULL, |
| 16298 | NULL, |
| 16299 | g_cclosure_marshal_generic, |
| 16300 | G_TYPE_NONE, |
| 16301 | 0); |
| 16302 | |
| 16303 | /* GObject properties for D-Bus properties: */ |
| 16304 | /** |
| 16305 | * Watchdog:watchdog: |
| 16306 | * |
| 16307 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. |
| 16308 | * |
| 16309 | * 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. |
| 16310 | */ |
| 16311 | g_object_interface_install_property (iface, |
| 16312 | g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 16313 | /** |
| 16314 | * Watchdog:poll-interval: |
| 16315 | * |
| 16316 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. |
| 16317 | * |
| 16318 | * 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. |
| 16319 | */ |
| 16320 | g_object_interface_install_property (iface, |
| 16321 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 16322 | } |
| 16323 | |
| 16324 | /** |
| 16325 | * watchdog_get_watchdog: (skip) |
| 16326 | * @object: A #Watchdog. |
| 16327 | * |
| 16328 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. |
| 16329 | * |
| 16330 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16331 | * |
| 16332 | * Returns: The property value. |
| 16333 | */ |
| 16334 | gint |
| 16335 | watchdog_get_watchdog (Watchdog *object) |
| 16336 | { |
| 16337 | return WATCHDOG_GET_IFACE (object)->get_watchdog (object); |
| 16338 | } |
| 16339 | |
| 16340 | /** |
| 16341 | * watchdog_set_watchdog: (skip) |
| 16342 | * @object: A #Watchdog. |
| 16343 | * @value: The value to set. |
| 16344 | * |
| 16345 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. |
| 16346 | * |
| 16347 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16348 | */ |
| 16349 | void |
| 16350 | watchdog_set_watchdog (Watchdog *object, gint value) |
| 16351 | { |
| 16352 | g_object_set (G_OBJECT (object), "watchdog", value, NULL); |
| 16353 | } |
| 16354 | |
| 16355 | /** |
| 16356 | * watchdog_get_poll_interval: (skip) |
| 16357 | * @object: A #Watchdog. |
| 16358 | * |
| 16359 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. |
| 16360 | * |
| 16361 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16362 | * |
| 16363 | * Returns: The property value. |
| 16364 | */ |
| 16365 | gint |
| 16366 | watchdog_get_poll_interval (Watchdog *object) |
| 16367 | { |
| 16368 | return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); |
| 16369 | } |
| 16370 | |
| 16371 | /** |
| 16372 | * watchdog_set_poll_interval: (skip) |
| 16373 | * @object: A #Watchdog. |
| 16374 | * @value: The value to set. |
| 16375 | * |
| 16376 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 16377 | * |
| 16378 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16379 | */ |
| 16380 | void |
| 16381 | watchdog_set_poll_interval (Watchdog *object, gint value) |
| 16382 | { |
| 16383 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 16384 | } |
| 16385 | |
| 16386 | /** |
| 16387 | * watchdog_emit_watchdog_error: |
| 16388 | * @object: A #Watchdog. |
| 16389 | * |
| 16390 | * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. |
| 16391 | */ |
| 16392 | void |
| 16393 | watchdog_emit_watchdog_error ( |
| 16394 | Watchdog *object) |
| 16395 | { |
| 16396 | g_signal_emit_by_name (object, "watchdog-error"); |
| 16397 | } |
| 16398 | |
| 16399 | /** |
| 16400 | * watchdog_call_start: |
| 16401 | * @proxy: A #WatchdogProxy. |
| 16402 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16403 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16404 | * @user_data: User data to pass to @callback. |
| 16405 | * |
| 16406 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. |
| 16407 | * 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. |
| 16408 | * You can then call watchdog_call_start_finish() to get the result of the operation. |
| 16409 | * |
| 16410 | * See watchdog_call_start_sync() for the synchronous, blocking version of this method. |
| 16411 | */ |
| 16412 | void |
| 16413 | watchdog_call_start ( |
| 16414 | Watchdog *proxy, |
| 16415 | GCancellable *cancellable, |
| 16416 | GAsyncReadyCallback callback, |
| 16417 | gpointer user_data) |
| 16418 | { |
| 16419 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16420 | "start", |
| 16421 | g_variant_new ("()"), |
| 16422 | G_DBUS_CALL_FLAGS_NONE, |
| 16423 | -1, |
| 16424 | cancellable, |
| 16425 | callback, |
| 16426 | user_data); |
| 16427 | } |
| 16428 | |
| 16429 | /** |
| 16430 | * watchdog_call_start_finish: |
| 16431 | * @proxy: A #WatchdogProxy. |
| 16432 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). |
| 16433 | * @error: Return location for error or %NULL. |
| 16434 | * |
| 16435 | * Finishes an operation started with watchdog_call_start(). |
| 16436 | * |
| 16437 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16438 | */ |
| 16439 | gboolean |
| 16440 | watchdog_call_start_finish ( |
| 16441 | Watchdog *proxy, |
| 16442 | GAsyncResult *res, |
| 16443 | GError **error) |
| 16444 | { |
| 16445 | GVariant *_ret; |
| 16446 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16447 | if (_ret == NULL) |
| 16448 | goto _out; |
| 16449 | g_variant_get (_ret, |
| 16450 | "()"); |
| 16451 | g_variant_unref (_ret); |
| 16452 | _out: |
| 16453 | return _ret != NULL; |
| 16454 | } |
| 16455 | |
| 16456 | /** |
| 16457 | * watchdog_call_start_sync: |
| 16458 | * @proxy: A #WatchdogProxy. |
| 16459 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16460 | * @error: Return location for error or %NULL. |
| 16461 | * |
| 16462 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 16463 | * |
| 16464 | * See watchdog_call_start() for the asynchronous version of this method. |
| 16465 | * |
| 16466 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16467 | */ |
| 16468 | gboolean |
| 16469 | watchdog_call_start_sync ( |
| 16470 | Watchdog *proxy, |
| 16471 | GCancellable *cancellable, |
| 16472 | GError **error) |
| 16473 | { |
| 16474 | GVariant *_ret; |
| 16475 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16476 | "start", |
| 16477 | g_variant_new ("()"), |
| 16478 | G_DBUS_CALL_FLAGS_NONE, |
| 16479 | -1, |
| 16480 | cancellable, |
| 16481 | error); |
| 16482 | if (_ret == NULL) |
| 16483 | goto _out; |
| 16484 | g_variant_get (_ret, |
| 16485 | "()"); |
| 16486 | g_variant_unref (_ret); |
| 16487 | _out: |
| 16488 | return _ret != NULL; |
| 16489 | } |
| 16490 | |
| 16491 | /** |
| 16492 | * watchdog_call_poke: |
| 16493 | * @proxy: A #WatchdogProxy. |
| 16494 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16495 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16496 | * @user_data: User data to pass to @callback. |
| 16497 | * |
| 16498 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. |
| 16499 | * 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. |
| 16500 | * You can then call watchdog_call_poke_finish() to get the result of the operation. |
| 16501 | * |
| 16502 | * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. |
| 16503 | */ |
| 16504 | void |
| 16505 | watchdog_call_poke ( |
| 16506 | Watchdog *proxy, |
| 16507 | GCancellable *cancellable, |
| 16508 | GAsyncReadyCallback callback, |
| 16509 | gpointer user_data) |
| 16510 | { |
| 16511 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16512 | "poke", |
| 16513 | g_variant_new ("()"), |
| 16514 | G_DBUS_CALL_FLAGS_NONE, |
| 16515 | -1, |
| 16516 | cancellable, |
| 16517 | callback, |
| 16518 | user_data); |
| 16519 | } |
| 16520 | |
| 16521 | /** |
| 16522 | * watchdog_call_poke_finish: |
| 16523 | * @proxy: A #WatchdogProxy. |
| 16524 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). |
| 16525 | * @error: Return location for error or %NULL. |
| 16526 | * |
| 16527 | * Finishes an operation started with watchdog_call_poke(). |
| 16528 | * |
| 16529 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16530 | */ |
| 16531 | gboolean |
| 16532 | watchdog_call_poke_finish ( |
| 16533 | Watchdog *proxy, |
| 16534 | GAsyncResult *res, |
| 16535 | GError **error) |
| 16536 | { |
| 16537 | GVariant *_ret; |
| 16538 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16539 | if (_ret == NULL) |
| 16540 | goto _out; |
| 16541 | g_variant_get (_ret, |
| 16542 | "()"); |
| 16543 | g_variant_unref (_ret); |
| 16544 | _out: |
| 16545 | return _ret != NULL; |
| 16546 | } |
| 16547 | |
| 16548 | /** |
| 16549 | * watchdog_call_poke_sync: |
| 16550 | * @proxy: A #WatchdogProxy. |
| 16551 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16552 | * @error: Return location for error or %NULL. |
| 16553 | * |
| 16554 | * 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. |
| 16555 | * |
| 16556 | * See watchdog_call_poke() for the asynchronous version of this method. |
| 16557 | * |
| 16558 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16559 | */ |
| 16560 | gboolean |
| 16561 | watchdog_call_poke_sync ( |
| 16562 | Watchdog *proxy, |
| 16563 | GCancellable *cancellable, |
| 16564 | GError **error) |
| 16565 | { |
| 16566 | GVariant *_ret; |
| 16567 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16568 | "poke", |
| 16569 | g_variant_new ("()"), |
| 16570 | G_DBUS_CALL_FLAGS_NONE, |
| 16571 | -1, |
| 16572 | cancellable, |
| 16573 | error); |
| 16574 | if (_ret == NULL) |
| 16575 | goto _out; |
| 16576 | g_variant_get (_ret, |
| 16577 | "()"); |
| 16578 | g_variant_unref (_ret); |
| 16579 | _out: |
| 16580 | return _ret != NULL; |
| 16581 | } |
| 16582 | |
| 16583 | /** |
| 16584 | * watchdog_call_stop: |
| 16585 | * @proxy: A #WatchdogProxy. |
| 16586 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16587 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16588 | * @user_data: User data to pass to @callback. |
| 16589 | * |
| 16590 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. |
| 16591 | * 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. |
| 16592 | * You can then call watchdog_call_stop_finish() to get the result of the operation. |
| 16593 | * |
| 16594 | * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. |
| 16595 | */ |
| 16596 | void |
| 16597 | watchdog_call_stop ( |
| 16598 | Watchdog *proxy, |
| 16599 | GCancellable *cancellable, |
| 16600 | GAsyncReadyCallback callback, |
| 16601 | gpointer user_data) |
| 16602 | { |
| 16603 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16604 | "stop", |
| 16605 | g_variant_new ("()"), |
| 16606 | G_DBUS_CALL_FLAGS_NONE, |
| 16607 | -1, |
| 16608 | cancellable, |
| 16609 | callback, |
| 16610 | user_data); |
| 16611 | } |
| 16612 | |
| 16613 | /** |
| 16614 | * watchdog_call_stop_finish: |
| 16615 | * @proxy: A #WatchdogProxy. |
| 16616 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). |
| 16617 | * @error: Return location for error or %NULL. |
| 16618 | * |
| 16619 | * Finishes an operation started with watchdog_call_stop(). |
| 16620 | * |
| 16621 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16622 | */ |
| 16623 | gboolean |
| 16624 | watchdog_call_stop_finish ( |
| 16625 | Watchdog *proxy, |
| 16626 | GAsyncResult *res, |
| 16627 | GError **error) |
| 16628 | { |
| 16629 | GVariant *_ret; |
| 16630 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16631 | if (_ret == NULL) |
| 16632 | goto _out; |
| 16633 | g_variant_get (_ret, |
| 16634 | "()"); |
| 16635 | g_variant_unref (_ret); |
| 16636 | _out: |
| 16637 | return _ret != NULL; |
| 16638 | } |
| 16639 | |
| 16640 | /** |
| 16641 | * watchdog_call_stop_sync: |
| 16642 | * @proxy: A #WatchdogProxy. |
| 16643 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16644 | * @error: Return location for error or %NULL. |
| 16645 | * |
| 16646 | * 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. |
| 16647 | * |
| 16648 | * See watchdog_call_stop() for the asynchronous version of this method. |
| 16649 | * |
| 16650 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16651 | */ |
| 16652 | gboolean |
| 16653 | watchdog_call_stop_sync ( |
| 16654 | Watchdog *proxy, |
| 16655 | GCancellable *cancellable, |
| 16656 | GError **error) |
| 16657 | { |
| 16658 | GVariant *_ret; |
| 16659 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16660 | "stop", |
| 16661 | g_variant_new ("()"), |
| 16662 | G_DBUS_CALL_FLAGS_NONE, |
| 16663 | -1, |
| 16664 | cancellable, |
| 16665 | error); |
| 16666 | if (_ret == NULL) |
| 16667 | goto _out; |
| 16668 | g_variant_get (_ret, |
| 16669 | "()"); |
| 16670 | g_variant_unref (_ret); |
| 16671 | _out: |
| 16672 | return _ret != NULL; |
| 16673 | } |
| 16674 | |
| 16675 | /** |
| 16676 | * watchdog_complete_start: |
| 16677 | * @object: A #Watchdog. |
| 16678 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16679 | * |
| 16680 | * 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. |
| 16681 | * |
| 16682 | * This method will free @invocation, you cannot use it afterwards. |
| 16683 | */ |
| 16684 | void |
| 16685 | watchdog_complete_start ( |
| 16686 | Watchdog *object, |
| 16687 | GDBusMethodInvocation *invocation) |
| 16688 | { |
| 16689 | g_dbus_method_invocation_return_value (invocation, |
| 16690 | g_variant_new ("()")); |
| 16691 | } |
| 16692 | |
| 16693 | /** |
| 16694 | * watchdog_complete_poke: |
| 16695 | * @object: A #Watchdog. |
| 16696 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16697 | * |
| 16698 | * 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. |
| 16699 | * |
| 16700 | * This method will free @invocation, you cannot use it afterwards. |
| 16701 | */ |
| 16702 | void |
| 16703 | watchdog_complete_poke ( |
| 16704 | Watchdog *object, |
| 16705 | GDBusMethodInvocation *invocation) |
| 16706 | { |
| 16707 | g_dbus_method_invocation_return_value (invocation, |
| 16708 | g_variant_new ("()")); |
| 16709 | } |
| 16710 | |
| 16711 | /** |
| 16712 | * watchdog_complete_stop: |
| 16713 | * @object: A #Watchdog. |
| 16714 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16715 | * |
| 16716 | * 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. |
| 16717 | * |
| 16718 | * This method will free @invocation, you cannot use it afterwards. |
| 16719 | */ |
| 16720 | void |
| 16721 | watchdog_complete_stop ( |
| 16722 | Watchdog *object, |
| 16723 | GDBusMethodInvocation *invocation) |
| 16724 | { |
| 16725 | g_dbus_method_invocation_return_value (invocation, |
| 16726 | g_variant_new ("()")); |
| 16727 | } |
| 16728 | |
| 16729 | /* ------------------------------------------------------------------------ */ |
| 16730 | |
| 16731 | /** |
| 16732 | * WatchdogProxy: |
| 16733 | * |
| 16734 | * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. |
| 16735 | */ |
| 16736 | |
| 16737 | /** |
| 16738 | * WatchdogProxyClass: |
| 16739 | * @parent_class: The parent class. |
| 16740 | * |
| 16741 | * Class structure for #WatchdogProxy. |
| 16742 | */ |
| 16743 | |
| 16744 | struct _WatchdogProxyPrivate |
| 16745 | { |
| 16746 | GData *qdata; |
| 16747 | }; |
| 16748 | |
| 16749 | static void watchdog_proxy_iface_init (WatchdogIface *iface); |
| 16750 | |
| 16751 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16752 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 16753 | G_ADD_PRIVATE (WatchdogProxy) |
| 16754 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 16755 | |
| 16756 | #else |
| 16757 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 16758 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 16759 | |
| 16760 | #endif |
| 16761 | static void |
| 16762 | watchdog_proxy_finalize (GObject *object) |
| 16763 | { |
| 16764 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 16765 | g_datalist_clear (&proxy->priv->qdata); |
| 16766 | G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); |
| 16767 | } |
| 16768 | |
| 16769 | static void |
| 16770 | watchdog_proxy_get_property (GObject *object, |
| 16771 | guint prop_id, |
| 16772 | GValue *value, |
| 16773 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16774 | { |
| 16775 | const _ExtendedGDBusPropertyInfo *info; |
| 16776 | GVariant *variant; |
| 16777 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16778 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 16779 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 16780 | if (info->use_gvariant) |
| 16781 | { |
| 16782 | g_value_set_variant (value, variant); |
| 16783 | } |
| 16784 | else |
| 16785 | { |
| 16786 | if (variant != NULL) |
| 16787 | g_dbus_gvariant_to_gvalue (variant, value); |
| 16788 | } |
| 16789 | if (variant != NULL) |
| 16790 | g_variant_unref (variant); |
| 16791 | } |
| 16792 | |
| 16793 | static void |
| 16794 | watchdog_proxy_set_property_cb (GDBusProxy *proxy, |
| 16795 | GAsyncResult *res, |
| 16796 | gpointer user_data) |
| 16797 | { |
| 16798 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 16799 | GError *error; |
| 16800 | GVariant *_ret; |
| 16801 | error = NULL; |
| 16802 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 16803 | if (!_ret) |
| 16804 | { |
| 16805 | g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", |
| 16806 | info->parent_struct.name, |
| 16807 | error->message, g_quark_to_string (error->domain), error->code); |
| 16808 | g_error_free (error); |
| 16809 | } |
| 16810 | else |
| 16811 | { |
| 16812 | g_variant_unref (_ret); |
| 16813 | } |
| 16814 | } |
| 16815 | |
| 16816 | static void |
| 16817 | watchdog_proxy_set_property (GObject *object, |
| 16818 | guint prop_id, |
| 16819 | const GValue *value, |
| 16820 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16821 | { |
| 16822 | const _ExtendedGDBusPropertyInfo *info; |
| 16823 | GVariant *variant; |
| 16824 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16825 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 16826 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16827 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 16828 | "org.freedesktop.DBus.Properties.Set", |
| 16829 | g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), |
| 16830 | G_DBUS_CALL_FLAGS_NONE, |
| 16831 | -1, |
| 16832 | NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 16833 | g_variant_unref (variant); |
| 16834 | } |
| 16835 | |
| 16836 | static void |
| 16837 | watchdog_proxy_g_signal (GDBusProxy *proxy, |
| 16838 | const gchar *sender_name G_GNUC_UNUSED, |
| 16839 | const gchar *signal_name, |
| 16840 | GVariant *parameters) |
| 16841 | { |
| 16842 | _ExtendedGDBusSignalInfo *info; |
| 16843 | GVariantIter iter; |
| 16844 | GVariant *child; |
| 16845 | GValue *paramv; |
| 16846 | guint num_params; |
| 16847 | guint n; |
| 16848 | guint signal_id; |
| 16849 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); |
| 16850 | if (info == NULL) |
| 16851 | return; |
| 16852 | num_params = g_variant_n_children (parameters); |
| 16853 | paramv = g_new0 (GValue, num_params + 1); |
| 16854 | g_value_init (¶mv[0], TYPE_WATCHDOG); |
| 16855 | g_value_set_object (¶mv[0], proxy); |
| 16856 | g_variant_iter_init (&iter, parameters); |
| 16857 | n = 1; |
| 16858 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16859 | { |
| 16860 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 16861 | if (arg_info->use_gvariant) |
| 16862 | { |
| 16863 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16864 | g_value_set_variant (¶mv[n], child); |
| 16865 | n++; |
| 16866 | } |
| 16867 | else |
| 16868 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16869 | g_variant_unref (child); |
| 16870 | } |
| 16871 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 16872 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 16873 | for (n = 0; n < num_params + 1; n++) |
| 16874 | g_value_unset (¶mv[n]); |
| 16875 | g_free (paramv); |
| 16876 | } |
| 16877 | |
| 16878 | static void |
| 16879 | watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 16880 | GVariant *changed_properties, |
| 16881 | const gchar *const *invalidated_properties) |
| 16882 | { |
| 16883 | WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); |
| 16884 | guint n; |
| 16885 | const gchar *key; |
| 16886 | GVariantIter *iter; |
| 16887 | _ExtendedGDBusPropertyInfo *info; |
| 16888 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 16889 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 16890 | { |
| 16891 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); |
| 16892 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 16893 | if (info != NULL) |
| 16894 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16895 | } |
| 16896 | g_variant_iter_free (iter); |
| 16897 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 16898 | { |
| 16899 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); |
| 16900 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 16901 | if (info != NULL) |
| 16902 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16903 | } |
| 16904 | } |
| 16905 | |
| 16906 | static gint |
| 16907 | watchdog_proxy_get_watchdog (Watchdog *object) |
| 16908 | { |
| 16909 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 16910 | GVariant *variant; |
| 16911 | gint value = 0; |
| 16912 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); |
| 16913 | if (variant != NULL) |
| 16914 | { |
| 16915 | value = g_variant_get_int32 (variant); |
| 16916 | g_variant_unref (variant); |
| 16917 | } |
| 16918 | return value; |
| 16919 | } |
| 16920 | |
| 16921 | static gint |
| 16922 | watchdog_proxy_get_poll_interval (Watchdog *object) |
| 16923 | { |
| 16924 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 16925 | GVariant *variant; |
| 16926 | gint value = 0; |
| 16927 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 16928 | if (variant != NULL) |
| 16929 | { |
| 16930 | value = g_variant_get_int32 (variant); |
| 16931 | g_variant_unref (variant); |
| 16932 | } |
| 16933 | return value; |
| 16934 | } |
| 16935 | |
| 16936 | static void |
| 16937 | watchdog_proxy_init (WatchdogProxy *proxy) |
| 16938 | { |
| 16939 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16940 | proxy->priv = watchdog_proxy_get_instance_private (proxy); |
| 16941 | #else |
| 16942 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); |
| 16943 | #endif |
| 16944 | |
| 16945 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); |
| 16946 | } |
| 16947 | |
| 16948 | static void |
| 16949 | watchdog_proxy_class_init (WatchdogProxyClass *klass) |
| 16950 | { |
| 16951 | GObjectClass *gobject_class; |
| 16952 | GDBusProxyClass *proxy_class; |
| 16953 | |
| 16954 | gobject_class = G_OBJECT_CLASS (klass); |
| 16955 | gobject_class->finalize = watchdog_proxy_finalize; |
| 16956 | gobject_class->get_property = watchdog_proxy_get_property; |
| 16957 | gobject_class->set_property = watchdog_proxy_set_property; |
| 16958 | |
| 16959 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 16960 | proxy_class->g_signal = watchdog_proxy_g_signal; |
| 16961 | proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; |
| 16962 | |
| 16963 | watchdog_override_properties (gobject_class, 1); |
| 16964 | |
| 16965 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16966 | g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); |
| 16967 | #endif |
| 16968 | } |
| 16969 | |
| 16970 | static void |
| 16971 | watchdog_proxy_iface_init (WatchdogIface *iface) |
| 16972 | { |
| 16973 | iface->get_watchdog = watchdog_proxy_get_watchdog; |
| 16974 | iface->get_poll_interval = watchdog_proxy_get_poll_interval; |
| 16975 | } |
| 16976 | |
| 16977 | /** |
| 16978 | * watchdog_proxy_new: |
| 16979 | * @connection: A #GDBusConnection. |
| 16980 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16981 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 16982 | * @object_path: An object path. |
| 16983 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16984 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 16985 | * @user_data: User data to pass to @callback. |
| 16986 | * |
| 16987 | * 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. |
| 16988 | * |
| 16989 | * 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. |
| 16990 | * You can then call watchdog_proxy_new_finish() to get the result of the operation. |
| 16991 | * |
| 16992 | * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 16993 | */ |
| 16994 | void |
| 16995 | watchdog_proxy_new ( |
| 16996 | GDBusConnection *connection, |
| 16997 | GDBusProxyFlags flags, |
| 16998 | const gchar *name, |
| 16999 | const gchar *object_path, |
| 17000 | GCancellable *cancellable, |
| 17001 | GAsyncReadyCallback callback, |
| 17002 | gpointer user_data) |
| 17003 | { |
| 17004 | 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); |
| 17005 | } |
| 17006 | |
| 17007 | /** |
| 17008 | * watchdog_proxy_new_finish: |
| 17009 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). |
| 17010 | * @error: Return location for error or %NULL |
| 17011 | * |
| 17012 | * Finishes an operation started with watchdog_proxy_new(). |
| 17013 | * |
| 17014 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17015 | */ |
| 17016 | Watchdog * |
| 17017 | watchdog_proxy_new_finish ( |
| 17018 | GAsyncResult *res, |
| 17019 | GError **error) |
| 17020 | { |
| 17021 | GObject *ret; |
| 17022 | GObject *source_object; |
| 17023 | source_object = g_async_result_get_source_object (res); |
| 17024 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 17025 | g_object_unref (source_object); |
| 17026 | if (ret != NULL) |
| 17027 | return WATCHDOG (ret); |
| 17028 | else |
| 17029 | return NULL; |
| 17030 | } |
| 17031 | |
| 17032 | /** |
| 17033 | * watchdog_proxy_new_sync: |
| 17034 | * @connection: A #GDBusConnection. |
| 17035 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17036 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17037 | * @object_path: An object path. |
| 17038 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17039 | * @error: Return location for error or %NULL |
| 17040 | * |
| 17041 | * 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. |
| 17042 | * |
| 17043 | * The calling thread is blocked until a reply is received. |
| 17044 | * |
| 17045 | * See watchdog_proxy_new() for the asynchronous version of this constructor. |
| 17046 | * |
| 17047 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17048 | */ |
| 17049 | Watchdog * |
| 17050 | watchdog_proxy_new_sync ( |
| 17051 | GDBusConnection *connection, |
| 17052 | GDBusProxyFlags flags, |
| 17053 | const gchar *name, |
| 17054 | const gchar *object_path, |
| 17055 | GCancellable *cancellable, |
| 17056 | GError **error) |
| 17057 | { |
| 17058 | GInitable *ret; |
| 17059 | 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); |
| 17060 | if (ret != NULL) |
| 17061 | return WATCHDOG (ret); |
| 17062 | else |
| 17063 | return NULL; |
| 17064 | } |
| 17065 | |
| 17066 | |
| 17067 | /** |
| 17068 | * watchdog_proxy_new_for_bus: |
| 17069 | * @bus_type: A #GBusType. |
| 17070 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17071 | * @name: A bus name (well-known or unique). |
| 17072 | * @object_path: An object path. |
| 17073 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17074 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17075 | * @user_data: User data to pass to @callback. |
| 17076 | * |
| 17077 | * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 17078 | * |
| 17079 | * 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. |
| 17080 | * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. |
| 17081 | * |
| 17082 | * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 17083 | */ |
| 17084 | void |
| 17085 | watchdog_proxy_new_for_bus ( |
| 17086 | GBusType bus_type, |
| 17087 | GDBusProxyFlags flags, |
| 17088 | const gchar *name, |
| 17089 | const gchar *object_path, |
| 17090 | GCancellable *cancellable, |
| 17091 | GAsyncReadyCallback callback, |
| 17092 | gpointer user_data) |
| 17093 | { |
| 17094 | 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); |
| 17095 | } |
| 17096 | |
| 17097 | /** |
| 17098 | * watchdog_proxy_new_for_bus_finish: |
| 17099 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). |
| 17100 | * @error: Return location for error or %NULL |
| 17101 | * |
| 17102 | * Finishes an operation started with watchdog_proxy_new_for_bus(). |
| 17103 | * |
| 17104 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17105 | */ |
| 17106 | Watchdog * |
| 17107 | watchdog_proxy_new_for_bus_finish ( |
| 17108 | GAsyncResult *res, |
| 17109 | GError **error) |
| 17110 | { |
| 17111 | GObject *ret; |
| 17112 | GObject *source_object; |
| 17113 | source_object = g_async_result_get_source_object (res); |
| 17114 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 17115 | g_object_unref (source_object); |
| 17116 | if (ret != NULL) |
| 17117 | return WATCHDOG (ret); |
| 17118 | else |
| 17119 | return NULL; |
| 17120 | } |
| 17121 | |
| 17122 | /** |
| 17123 | * watchdog_proxy_new_for_bus_sync: |
| 17124 | * @bus_type: A #GBusType. |
| 17125 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17126 | * @name: A bus name (well-known or unique). |
| 17127 | * @object_path: An object path. |
| 17128 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17129 | * @error: Return location for error or %NULL |
| 17130 | * |
| 17131 | * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 17132 | * |
| 17133 | * The calling thread is blocked until a reply is received. |
| 17134 | * |
| 17135 | * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 17136 | * |
| 17137 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17138 | */ |
| 17139 | Watchdog * |
| 17140 | watchdog_proxy_new_for_bus_sync ( |
| 17141 | GBusType bus_type, |
| 17142 | GDBusProxyFlags flags, |
| 17143 | const gchar *name, |
| 17144 | const gchar *object_path, |
| 17145 | GCancellable *cancellable, |
| 17146 | GError **error) |
| 17147 | { |
| 17148 | GInitable *ret; |
| 17149 | 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); |
| 17150 | if (ret != NULL) |
| 17151 | return WATCHDOG (ret); |
| 17152 | else |
| 17153 | return NULL; |
| 17154 | } |
| 17155 | |
| 17156 | |
| 17157 | /* ------------------------------------------------------------------------ */ |
| 17158 | |
| 17159 | /** |
| 17160 | * WatchdogSkeleton: |
| 17161 | * |
| 17162 | * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 17163 | */ |
| 17164 | |
| 17165 | /** |
| 17166 | * WatchdogSkeletonClass: |
| 17167 | * @parent_class: The parent class. |
| 17168 | * |
| 17169 | * Class structure for #WatchdogSkeleton. |
| 17170 | */ |
| 17171 | |
| 17172 | struct _WatchdogSkeletonPrivate |
| 17173 | { |
| 17174 | GValue *properties; |
| 17175 | GList *changed_properties; |
| 17176 | GSource *changed_properties_idle_source; |
| 17177 | GMainContext *context; |
| 17178 | GMutex lock; |
| 17179 | }; |
| 17180 | |
| 17181 | static void |
| 17182 | _watchdog_skeleton_handle_method_call ( |
| 17183 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17184 | const gchar *sender G_GNUC_UNUSED, |
| 17185 | const gchar *object_path G_GNUC_UNUSED, |
| 17186 | const gchar *interface_name, |
| 17187 | const gchar *method_name, |
| 17188 | GVariant *parameters, |
| 17189 | GDBusMethodInvocation *invocation, |
| 17190 | gpointer user_data) |
| 17191 | { |
| 17192 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17193 | _ExtendedGDBusMethodInfo *info; |
| 17194 | GVariantIter iter; |
| 17195 | GVariant *child; |
| 17196 | GValue *paramv; |
| 17197 | guint num_params; |
| 17198 | guint num_extra; |
| 17199 | guint n; |
| 17200 | guint signal_id; |
| 17201 | GValue return_value = G_VALUE_INIT; |
| 17202 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 17203 | g_assert (info != NULL); |
| 17204 | num_params = g_variant_n_children (parameters); |
| 17205 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 17206 | n = 0; |
| 17207 | g_value_init (¶mv[n], TYPE_WATCHDOG); |
| 17208 | g_value_set_object (¶mv[n++], skeleton); |
| 17209 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 17210 | g_value_set_object (¶mv[n++], invocation); |
| 17211 | if (info->pass_fdlist) |
| 17212 | { |
| 17213 | #ifdef G_OS_UNIX |
| 17214 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 17215 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 17216 | #else |
| 17217 | g_assert_not_reached (); |
| 17218 | #endif |
| 17219 | } |
| 17220 | g_variant_iter_init (&iter, parameters); |
| 17221 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 17222 | { |
| 17223 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 17224 | if (arg_info->use_gvariant) |
| 17225 | { |
| 17226 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 17227 | g_value_set_variant (¶mv[n], child); |
| 17228 | n++; |
| 17229 | } |
| 17230 | else |
| 17231 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 17232 | g_variant_unref (child); |
| 17233 | } |
| 17234 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 17235 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 17236 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 17237 | if (!g_value_get_boolean (&return_value)) |
| 17238 | 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); |
| 17239 | g_value_unset (&return_value); |
| 17240 | for (n = 0; n < num_params + num_extra; n++) |
| 17241 | g_value_unset (¶mv[n]); |
| 17242 | g_free (paramv); |
| 17243 | } |
| 17244 | |
| 17245 | static GVariant * |
| 17246 | _watchdog_skeleton_handle_get_property ( |
| 17247 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17248 | const gchar *sender G_GNUC_UNUSED, |
| 17249 | const gchar *object_path G_GNUC_UNUSED, |
| 17250 | const gchar *interface_name G_GNUC_UNUSED, |
| 17251 | const gchar *property_name, |
| 17252 | GError **error, |
| 17253 | gpointer user_data) |
| 17254 | { |
| 17255 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17256 | GValue value = G_VALUE_INIT; |
| 17257 | GParamSpec *pspec; |
| 17258 | _ExtendedGDBusPropertyInfo *info; |
| 17259 | GVariant *ret; |
| 17260 | ret = NULL; |
| 17261 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 17262 | g_assert (info != NULL); |
| 17263 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 17264 | if (pspec == NULL) |
| 17265 | { |
| 17266 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 17267 | } |
| 17268 | else |
| 17269 | { |
| 17270 | g_value_init (&value, pspec->value_type); |
| 17271 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 17272 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 17273 | g_value_unset (&value); |
| 17274 | } |
| 17275 | return ret; |
| 17276 | } |
| 17277 | |
| 17278 | static gboolean |
| 17279 | _watchdog_skeleton_handle_set_property ( |
| 17280 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17281 | const gchar *sender G_GNUC_UNUSED, |
| 17282 | const gchar *object_path G_GNUC_UNUSED, |
| 17283 | const gchar *interface_name G_GNUC_UNUSED, |
| 17284 | const gchar *property_name, |
| 17285 | GVariant *variant, |
| 17286 | GError **error, |
| 17287 | gpointer user_data) |
| 17288 | { |
| 17289 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17290 | GValue value = G_VALUE_INIT; |
| 17291 | GParamSpec *pspec; |
| 17292 | _ExtendedGDBusPropertyInfo *info; |
| 17293 | gboolean ret; |
| 17294 | ret = FALSE; |
| 17295 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 17296 | g_assert (info != NULL); |
| 17297 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 17298 | if (pspec == NULL) |
| 17299 | { |
| 17300 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 17301 | } |
| 17302 | else |
| 17303 | { |
| 17304 | if (info->use_gvariant) |
| 17305 | g_value_set_variant (&value, variant); |
| 17306 | else |
| 17307 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 17308 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 17309 | g_value_unset (&value); |
| 17310 | ret = TRUE; |
| 17311 | } |
| 17312 | return ret; |
| 17313 | } |
| 17314 | |
| 17315 | static const GDBusInterfaceVTable _watchdog_skeleton_vtable = |
| 17316 | { |
| 17317 | _watchdog_skeleton_handle_method_call, |
| 17318 | _watchdog_skeleton_handle_get_property, |
| 17319 | _watchdog_skeleton_handle_set_property, |
| 17320 | {NULL} |
| 17321 | }; |
| 17322 | |
| 17323 | static GDBusInterfaceInfo * |
| 17324 | watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17325 | { |
| 17326 | return watchdog_interface_info (); |
| 17327 | } |
| 17328 | |
| 17329 | static GDBusInterfaceVTable * |
| 17330 | watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17331 | { |
| 17332 | return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; |
| 17333 | } |
| 17334 | |
| 17335 | static GVariant * |
| 17336 | watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 17337 | { |
| 17338 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 17339 | |
| 17340 | GVariantBuilder builder; |
| 17341 | guint n; |
| 17342 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17343 | if (_watchdog_interface_info.parent_struct.properties == NULL) |
| 17344 | goto out; |
| 17345 | for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) |
| 17346 | { |
| 17347 | GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; |
| 17348 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 17349 | { |
| 17350 | GVariant *value; |
| 17351 | 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); |
| 17352 | if (value != NULL) |
| 17353 | { |
| 17354 | g_variant_take_ref (value); |
| 17355 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 17356 | g_variant_unref (value); |
| 17357 | } |
| 17358 | } |
| 17359 | } |
| 17360 | out: |
| 17361 | return g_variant_builder_end (&builder); |
| 17362 | } |
| 17363 | |
| 17364 | static gboolean _watchdog_emit_changed (gpointer user_data); |
| 17365 | |
| 17366 | static void |
| 17367 | watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 17368 | { |
| 17369 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 17370 | gboolean emit_changed = FALSE; |
| 17371 | |
| 17372 | g_mutex_lock (&skeleton->priv->lock); |
| 17373 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17374 | { |
| 17375 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17376 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17377 | emit_changed = TRUE; |
| 17378 | } |
| 17379 | g_mutex_unlock (&skeleton->priv->lock); |
| 17380 | |
| 17381 | if (emit_changed) |
| 17382 | _watchdog_emit_changed (skeleton); |
| 17383 | } |
| 17384 | |
| 17385 | static void |
| 17386 | _watchdog_on_signal_watchdog_error ( |
| 17387 | Watchdog *object) |
| 17388 | { |
| 17389 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17390 | |
| 17391 | GList *connections, *l; |
| 17392 | GVariant *signal_variant; |
| 17393 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17394 | |
| 17395 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 17396 | for (l = connections; l != NULL; l = l->next) |
| 17397 | { |
| 17398 | GDBusConnection *connection = l->data; |
| 17399 | g_dbus_connection_emit_signal (connection, |
| 17400 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", |
| 17401 | signal_variant, NULL); |
| 17402 | } |
| 17403 | g_variant_unref (signal_variant); |
| 17404 | g_list_free_full (connections, g_object_unref); |
| 17405 | } |
| 17406 | |
| 17407 | static void watchdog_skeleton_iface_init (WatchdogIface *iface); |
| 17408 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17409 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17410 | G_ADD_PRIVATE (WatchdogSkeleton) |
| 17411 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 17412 | |
| 17413 | #else |
| 17414 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17415 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 17416 | |
| 17417 | #endif |
| 17418 | static void |
| 17419 | watchdog_skeleton_finalize (GObject *object) |
| 17420 | { |
| 17421 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17422 | guint n; |
| 17423 | for (n = 0; n < 2; n++) |
| 17424 | g_value_unset (&skeleton->priv->properties[n]); |
| 17425 | g_free (skeleton->priv->properties); |
| 17426 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17427 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17428 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17429 | g_main_context_unref (skeleton->priv->context); |
| 17430 | g_mutex_clear (&skeleton->priv->lock); |
| 17431 | G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); |
| 17432 | } |
| 17433 | |
| 17434 | static void |
| 17435 | watchdog_skeleton_get_property (GObject *object, |
| 17436 | guint prop_id, |
| 17437 | GValue *value, |
| 17438 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17439 | { |
| 17440 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17441 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 17442 | g_mutex_lock (&skeleton->priv->lock); |
| 17443 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 17444 | g_mutex_unlock (&skeleton->priv->lock); |
| 17445 | } |
| 17446 | |
| 17447 | static gboolean |
| 17448 | _watchdog_emit_changed (gpointer user_data) |
| 17449 | { |
| 17450 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17451 | GList *l; |
| 17452 | GVariantBuilder builder; |
| 17453 | GVariantBuilder invalidated_builder; |
| 17454 | guint num_changes; |
| 17455 | |
| 17456 | g_mutex_lock (&skeleton->priv->lock); |
| 17457 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17458 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 17459 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 17460 | { |
| 17461 | ChangedProperty *cp = l->data; |
| 17462 | GVariant *variant; |
| 17463 | const GValue *cur_value; |
| 17464 | |
| 17465 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 17466 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 17467 | { |
| 17468 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 17469 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 17470 | g_variant_unref (variant); |
| 17471 | num_changes++; |
| 17472 | } |
| 17473 | } |
| 17474 | if (num_changes > 0) |
| 17475 | { |
| 17476 | GList *connections, *ll; |
| 17477 | GVariant *signal_variant; |
| 17478 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", |
| 17479 | &builder, &invalidated_builder)); |
| 17480 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17481 | for (ll = connections; ll != NULL; ll = ll->next) |
| 17482 | { |
| 17483 | GDBusConnection *connection = ll->data; |
| 17484 | |
| 17485 | g_dbus_connection_emit_signal (connection, |
| 17486 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 17487 | "org.freedesktop.DBus.Properties", |
| 17488 | "PropertiesChanged", |
| 17489 | signal_variant, |
| 17490 | NULL); |
| 17491 | } |
| 17492 | g_variant_unref (signal_variant); |
| 17493 | g_list_free_full (connections, g_object_unref); |
| 17494 | } |
| 17495 | else |
| 17496 | { |
| 17497 | g_variant_builder_clear (&builder); |
| 17498 | g_variant_builder_clear (&invalidated_builder); |
| 17499 | } |
| 17500 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17501 | skeleton->priv->changed_properties = NULL; |
| 17502 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17503 | g_mutex_unlock (&skeleton->priv->lock); |
| 17504 | return FALSE; |
| 17505 | } |
| 17506 | |
| 17507 | static void |
| 17508 | _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 17509 | { |
| 17510 | ChangedProperty *cp; |
| 17511 | GList *l; |
| 17512 | cp = NULL; |
| 17513 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 17514 | { |
| 17515 | ChangedProperty *i_cp = l->data; |
| 17516 | if (i_cp->info == info) |
| 17517 | { |
| 17518 | cp = i_cp; |
| 17519 | break; |
| 17520 | } |
| 17521 | } |
| 17522 | if (cp == NULL) |
| 17523 | { |
| 17524 | cp = g_new0 (ChangedProperty, 1); |
| 17525 | cp->prop_id = prop_id; |
| 17526 | cp->info = info; |
| 17527 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 17528 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 17529 | g_value_copy (orig_value, &cp->orig_value); |
| 17530 | } |
| 17531 | } |
| 17532 | |
| 17533 | static void |
| 17534 | watchdog_skeleton_notify (GObject *object, |
| 17535 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17536 | { |
| 17537 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17538 | g_mutex_lock (&skeleton->priv->lock); |
| 17539 | if (skeleton->priv->changed_properties != NULL && |
| 17540 | skeleton->priv->changed_properties_idle_source == NULL) |
| 17541 | { |
| 17542 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 17543 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 17544 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 17545 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 17546 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 17547 | } |
| 17548 | g_mutex_unlock (&skeleton->priv->lock); |
| 17549 | } |
| 17550 | |
| 17551 | static void |
| 17552 | watchdog_skeleton_set_property (GObject *object, |
| 17553 | guint prop_id, |
| 17554 | const GValue *value, |
| 17555 | GParamSpec *pspec) |
| 17556 | { |
| 17557 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17558 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 17559 | g_mutex_lock (&skeleton->priv->lock); |
| 17560 | g_object_freeze_notify (object); |
| 17561 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 17562 | { |
| 17563 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 17564 | _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 17565 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 17566 | g_object_notify_by_pspec (object, pspec); |
| 17567 | } |
| 17568 | g_mutex_unlock (&skeleton->priv->lock); |
| 17569 | g_object_thaw_notify (object); |
| 17570 | } |
| 17571 | |
| 17572 | static void |
| 17573 | watchdog_skeleton_init (WatchdogSkeleton *skeleton) |
| 17574 | { |
| 17575 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17576 | skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); |
| 17577 | #else |
| 17578 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); |
| 17579 | #endif |
| 17580 | |
| 17581 | g_mutex_init (&skeleton->priv->lock); |
| 17582 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 17583 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 17584 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 17585 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 17586 | } |
| 17587 | |
| 17588 | static gint |
| 17589 | watchdog_skeleton_get_watchdog (Watchdog *object) |
| 17590 | { |
| 17591 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17592 | gint value; |
| 17593 | g_mutex_lock (&skeleton->priv->lock); |
| 17594 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 17595 | g_mutex_unlock (&skeleton->priv->lock); |
| 17596 | return value; |
| 17597 | } |
| 17598 | |
| 17599 | static gint |
| 17600 | watchdog_skeleton_get_poll_interval (Watchdog *object) |
| 17601 | { |
| 17602 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17603 | gint value; |
| 17604 | g_mutex_lock (&skeleton->priv->lock); |
| 17605 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 17606 | g_mutex_unlock (&skeleton->priv->lock); |
| 17607 | return value; |
| 17608 | } |
| 17609 | |
| 17610 | static void |
| 17611 | watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) |
| 17612 | { |
| 17613 | GObjectClass *gobject_class; |
| 17614 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 17615 | |
| 17616 | gobject_class = G_OBJECT_CLASS (klass); |
| 17617 | gobject_class->finalize = watchdog_skeleton_finalize; |
| 17618 | gobject_class->get_property = watchdog_skeleton_get_property; |
| 17619 | gobject_class->set_property = watchdog_skeleton_set_property; |
| 17620 | gobject_class->notify = watchdog_skeleton_notify; |
| 17621 | |
| 17622 | |
| 17623 | watchdog_override_properties (gobject_class, 1); |
| 17624 | |
| 17625 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 17626 | skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; |
| 17627 | skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; |
| 17628 | skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; |
| 17629 | skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; |
| 17630 | |
| 17631 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17632 | g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); |
| 17633 | #endif |
| 17634 | } |
| 17635 | |
| 17636 | static void |
| 17637 | watchdog_skeleton_iface_init (WatchdogIface *iface) |
| 17638 | { |
| 17639 | iface->watchdog_error = _watchdog_on_signal_watchdog_error; |
| 17640 | iface->get_watchdog = watchdog_skeleton_get_watchdog; |
| 17641 | iface->get_poll_interval = watchdog_skeleton_get_poll_interval; |
| 17642 | } |
| 17643 | |
| 17644 | /** |
| 17645 | * watchdog_skeleton_new: |
| 17646 | * |
| 17647 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 17648 | * |
| 17649 | * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. |
| 17650 | */ |
| 17651 | Watchdog * |
| 17652 | watchdog_skeleton_new (void) |
| 17653 | { |
| 17654 | return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); |
| 17655 | } |
| 17656 | |
| 17657 | /* ------------------------------------------------------------------------ |
| 17658 | * Code for interface org.openbmc.EventLog |
| 17659 | * ------------------------------------------------------------------------ |
| 17660 | */ |
| 17661 | |
| 17662 | /** |
| 17663 | * SECTION:EventLog |
| 17664 | * @title: EventLog |
| 17665 | * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface |
| 17666 | * |
| 17667 | * 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. |
| 17668 | */ |
| 17669 | |
| 17670 | /* ---- Introspection data for org.openbmc.EventLog ---- */ |
| 17671 | |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17672 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17673 | { |
| 17674 | { |
| 17675 | -1, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17676 | (gchar *) "priority", |
| 17677 | (gchar *) "i", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17678 | NULL |
| 17679 | }, |
| 17680 | FALSE |
| 17681 | }; |
| 17682 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17683 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message = |
| 17684 | { |
| 17685 | { |
| 17686 | -1, |
| 17687 | (gchar *) "message", |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17688 | (gchar *) "s", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17689 | NULL |
| 17690 | }, |
| 17691 | FALSE |
| 17692 | }; |
| 17693 | |
| 17694 | static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] = |
| 17695 | { |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17696 | &_event_log_signal_info_event_log_ARG_priority, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17697 | &_event_log_signal_info_event_log_ARG_message, |
| 17698 | NULL |
| 17699 | }; |
| 17700 | |
| 17701 | static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log = |
| 17702 | { |
| 17703 | { |
| 17704 | -1, |
| 17705 | (gchar *) "EventLog", |
| 17706 | (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers, |
| 17707 | NULL |
| 17708 | }, |
| 17709 | "event-log" |
| 17710 | }; |
| 17711 | |
| 17712 | static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] = |
| 17713 | { |
| 17714 | &_event_log_signal_info_event_log, |
| 17715 | NULL |
| 17716 | }; |
| 17717 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17718 | static const _ExtendedGDBusInterfaceInfo _event_log_interface_info = |
| 17719 | { |
| 17720 | { |
| 17721 | -1, |
| 17722 | (gchar *) "org.openbmc.EventLog", |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17723 | NULL, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17724 | (GDBusSignalInfo **) &_event_log_signal_info_pointers, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17725 | NULL, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17726 | NULL |
| 17727 | }, |
| 17728 | "event-log", |
| 17729 | }; |
| 17730 | |
| 17731 | |
| 17732 | /** |
| 17733 | * event_log_interface_info: |
| 17734 | * |
| 17735 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface. |
| 17736 | * |
| 17737 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 17738 | */ |
| 17739 | GDBusInterfaceInfo * |
| 17740 | event_log_interface_info (void) |
| 17741 | { |
| 17742 | return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct; |
| 17743 | } |
| 17744 | |
| 17745 | /** |
| 17746 | * event_log_override_properties: |
| 17747 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 17748 | * @property_id_begin: The property id to assign to the first overridden property. |
| 17749 | * |
| 17750 | * Overrides all #GObject properties in the #EventLog interface for a concrete class. |
| 17751 | * The properties are overridden in the order they are defined. |
| 17752 | * |
| 17753 | * Returns: The last property id. |
| 17754 | */ |
| 17755 | guint |
| 17756 | event_log_override_properties (GObjectClass *klass, guint property_id_begin) |
| 17757 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17758 | return property_id_begin - 1; |
| 17759 | } |
| 17760 | |
| 17761 | |
| 17762 | |
| 17763 | /** |
| 17764 | * EventLog: |
| 17765 | * |
| 17766 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 17767 | */ |
| 17768 | |
| 17769 | /** |
| 17770 | * EventLogIface: |
| 17771 | * @parent_iface: The parent interface. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17772 | * @event_log: Handler for the #EventLog::event-log signal. |
| 17773 | * |
| 17774 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 17775 | */ |
| 17776 | |
| 17777 | typedef EventLogIface EventLogInterface; |
| 17778 | G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT); |
| 17779 | |
| 17780 | static void |
| 17781 | event_log_default_init (EventLogIface *iface) |
| 17782 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17783 | /* GObject signals for received D-Bus signals: */ |
| 17784 | /** |
| 17785 | * EventLog::event-log: |
| 17786 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17787 | * @arg_priority: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17788 | * @arg_message: Argument. |
| 17789 | * |
| 17790 | * 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. |
| 17791 | * |
| 17792 | * 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. |
| 17793 | */ |
| 17794 | g_signal_new ("event-log", |
| 17795 | G_TYPE_FROM_INTERFACE (iface), |
| 17796 | G_SIGNAL_RUN_LAST, |
| 17797 | G_STRUCT_OFFSET (EventLogIface, event_log), |
| 17798 | NULL, |
| 17799 | NULL, |
| 17800 | g_cclosure_marshal_generic, |
| 17801 | G_TYPE_NONE, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17802 | 2, G_TYPE_INT, G_TYPE_STRING); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17803 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17804 | } |
| 17805 | |
| 17806 | /** |
| 17807 | * event_log_emit_event_log: |
| 17808 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17809 | * @arg_priority: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17810 | * @arg_message: Argument to pass with the signal. |
| 17811 | * |
| 17812 | * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal. |
| 17813 | */ |
| 17814 | void |
| 17815 | event_log_emit_event_log ( |
| 17816 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17817 | gint arg_priority, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17818 | const gchar *arg_message) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17819 | { |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17820 | g_signal_emit_by_name (object, "event-log", arg_priority, arg_message); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17821 | } |
| 17822 | |
| 17823 | /* ------------------------------------------------------------------------ */ |
| 17824 | |
| 17825 | /** |
| 17826 | * EventLogProxy: |
| 17827 | * |
| 17828 | * The #EventLogProxy structure contains only private data and should only be accessed using the provided API. |
| 17829 | */ |
| 17830 | |
| 17831 | /** |
| 17832 | * EventLogProxyClass: |
| 17833 | * @parent_class: The parent class. |
| 17834 | * |
| 17835 | * Class structure for #EventLogProxy. |
| 17836 | */ |
| 17837 | |
| 17838 | struct _EventLogProxyPrivate |
| 17839 | { |
| 17840 | GData *qdata; |
| 17841 | }; |
| 17842 | |
| 17843 | static void event_log_proxy_iface_init (EventLogIface *iface); |
| 17844 | |
| 17845 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17846 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 17847 | G_ADD_PRIVATE (EventLogProxy) |
| 17848 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 17849 | |
| 17850 | #else |
| 17851 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 17852 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 17853 | |
| 17854 | #endif |
| 17855 | static void |
| 17856 | event_log_proxy_finalize (GObject *object) |
| 17857 | { |
| 17858 | EventLogProxy *proxy = EVENT_LOG_PROXY (object); |
| 17859 | g_datalist_clear (&proxy->priv->qdata); |
| 17860 | G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object); |
| 17861 | } |
| 17862 | |
| 17863 | static void |
| 17864 | event_log_proxy_get_property (GObject *object, |
| 17865 | guint prop_id, |
| 17866 | GValue *value, |
| 17867 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17868 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17869 | } |
| 17870 | |
| 17871 | static void |
| 17872 | event_log_proxy_set_property (GObject *object, |
| 17873 | guint prop_id, |
| 17874 | const GValue *value, |
| 17875 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17876 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17877 | } |
| 17878 | |
| 17879 | static void |
| 17880 | event_log_proxy_g_signal (GDBusProxy *proxy, |
| 17881 | const gchar *sender_name G_GNUC_UNUSED, |
| 17882 | const gchar *signal_name, |
| 17883 | GVariant *parameters) |
| 17884 | { |
| 17885 | _ExtendedGDBusSignalInfo *info; |
| 17886 | GVariantIter iter; |
| 17887 | GVariant *child; |
| 17888 | GValue *paramv; |
| 17889 | guint num_params; |
| 17890 | guint n; |
| 17891 | guint signal_id; |
| 17892 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name); |
| 17893 | if (info == NULL) |
| 17894 | return; |
| 17895 | num_params = g_variant_n_children (parameters); |
| 17896 | paramv = g_new0 (GValue, num_params + 1); |
| 17897 | g_value_init (¶mv[0], TYPE_EVENT_LOG); |
| 17898 | g_value_set_object (¶mv[0], proxy); |
| 17899 | g_variant_iter_init (&iter, parameters); |
| 17900 | n = 1; |
| 17901 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 17902 | { |
| 17903 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 17904 | if (arg_info->use_gvariant) |
| 17905 | { |
| 17906 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 17907 | g_value_set_variant (¶mv[n], child); |
| 17908 | n++; |
| 17909 | } |
| 17910 | else |
| 17911 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 17912 | g_variant_unref (child); |
| 17913 | } |
| 17914 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 17915 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 17916 | for (n = 0; n < num_params + 1; n++) |
| 17917 | g_value_unset (¶mv[n]); |
| 17918 | g_free (paramv); |
| 17919 | } |
| 17920 | |
| 17921 | static void |
| 17922 | event_log_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 17923 | GVariant *changed_properties, |
| 17924 | const gchar *const *invalidated_properties) |
| 17925 | { |
| 17926 | EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy); |
| 17927 | guint n; |
| 17928 | const gchar *key; |
| 17929 | GVariantIter *iter; |
| 17930 | _ExtendedGDBusPropertyInfo *info; |
| 17931 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 17932 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 17933 | { |
| 17934 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key); |
| 17935 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 17936 | if (info != NULL) |
| 17937 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17938 | } |
| 17939 | g_variant_iter_free (iter); |
| 17940 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 17941 | { |
| 17942 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]); |
| 17943 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 17944 | if (info != NULL) |
| 17945 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17946 | } |
| 17947 | } |
| 17948 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17949 | static void |
| 17950 | event_log_proxy_init (EventLogProxy *proxy) |
| 17951 | { |
| 17952 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17953 | proxy->priv = event_log_proxy_get_instance_private (proxy); |
| 17954 | #else |
| 17955 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate); |
| 17956 | #endif |
| 17957 | |
| 17958 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ()); |
| 17959 | } |
| 17960 | |
| 17961 | static void |
| 17962 | event_log_proxy_class_init (EventLogProxyClass *klass) |
| 17963 | { |
| 17964 | GObjectClass *gobject_class; |
| 17965 | GDBusProxyClass *proxy_class; |
| 17966 | |
| 17967 | gobject_class = G_OBJECT_CLASS (klass); |
| 17968 | gobject_class->finalize = event_log_proxy_finalize; |
| 17969 | gobject_class->get_property = event_log_proxy_get_property; |
| 17970 | gobject_class->set_property = event_log_proxy_set_property; |
| 17971 | |
| 17972 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 17973 | proxy_class->g_signal = event_log_proxy_g_signal; |
| 17974 | proxy_class->g_properties_changed = event_log_proxy_g_properties_changed; |
| 17975 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17976 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17977 | g_type_class_add_private (klass, sizeof (EventLogProxyPrivate)); |
| 17978 | #endif |
| 17979 | } |
| 17980 | |
| 17981 | static void |
| 17982 | event_log_proxy_iface_init (EventLogIface *iface) |
| 17983 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17984 | } |
| 17985 | |
| 17986 | /** |
| 17987 | * event_log_proxy_new: |
| 17988 | * @connection: A #GDBusConnection. |
| 17989 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17990 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17991 | * @object_path: An object path. |
| 17992 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17993 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17994 | * @user_data: User data to pass to @callback. |
| 17995 | * |
| 17996 | * 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. |
| 17997 | * |
| 17998 | * 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. |
| 17999 | * You can then call event_log_proxy_new_finish() to get the result of the operation. |
| 18000 | * |
| 18001 | * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 18002 | */ |
| 18003 | void |
| 18004 | event_log_proxy_new ( |
| 18005 | GDBusConnection *connection, |
| 18006 | GDBusProxyFlags flags, |
| 18007 | const gchar *name, |
| 18008 | const gchar *object_path, |
| 18009 | GCancellable *cancellable, |
| 18010 | GAsyncReadyCallback callback, |
| 18011 | gpointer user_data) |
| 18012 | { |
| 18013 | 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); |
| 18014 | } |
| 18015 | |
| 18016 | /** |
| 18017 | * event_log_proxy_new_finish: |
| 18018 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new(). |
| 18019 | * @error: Return location for error or %NULL |
| 18020 | * |
| 18021 | * Finishes an operation started with event_log_proxy_new(). |
| 18022 | * |
| 18023 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18024 | */ |
| 18025 | EventLog * |
| 18026 | event_log_proxy_new_finish ( |
| 18027 | GAsyncResult *res, |
| 18028 | GError **error) |
| 18029 | { |
| 18030 | GObject *ret; |
| 18031 | GObject *source_object; |
| 18032 | source_object = g_async_result_get_source_object (res); |
| 18033 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18034 | g_object_unref (source_object); |
| 18035 | if (ret != NULL) |
| 18036 | return EVENT_LOG (ret); |
| 18037 | else |
| 18038 | return NULL; |
| 18039 | } |
| 18040 | |
| 18041 | /** |
| 18042 | * event_log_proxy_new_sync: |
| 18043 | * @connection: A #GDBusConnection. |
| 18044 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18045 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 18046 | * @object_path: An object path. |
| 18047 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18048 | * @error: Return location for error or %NULL |
| 18049 | * |
| 18050 | * 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. |
| 18051 | * |
| 18052 | * The calling thread is blocked until a reply is received. |
| 18053 | * |
| 18054 | * See event_log_proxy_new() for the asynchronous version of this constructor. |
| 18055 | * |
| 18056 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18057 | */ |
| 18058 | EventLog * |
| 18059 | event_log_proxy_new_sync ( |
| 18060 | GDBusConnection *connection, |
| 18061 | GDBusProxyFlags flags, |
| 18062 | const gchar *name, |
| 18063 | const gchar *object_path, |
| 18064 | GCancellable *cancellable, |
| 18065 | GError **error) |
| 18066 | { |
| 18067 | GInitable *ret; |
| 18068 | 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); |
| 18069 | if (ret != NULL) |
| 18070 | return EVENT_LOG (ret); |
| 18071 | else |
| 18072 | return NULL; |
| 18073 | } |
| 18074 | |
| 18075 | |
| 18076 | /** |
| 18077 | * event_log_proxy_new_for_bus: |
| 18078 | * @bus_type: A #GBusType. |
| 18079 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18080 | * @name: A bus name (well-known or unique). |
| 18081 | * @object_path: An object path. |
| 18082 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18083 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 18084 | * @user_data: User data to pass to @callback. |
| 18085 | * |
| 18086 | * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 18087 | * |
| 18088 | * 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. |
| 18089 | * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation. |
| 18090 | * |
| 18091 | * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 18092 | */ |
| 18093 | void |
| 18094 | event_log_proxy_new_for_bus ( |
| 18095 | GBusType bus_type, |
| 18096 | GDBusProxyFlags flags, |
| 18097 | const gchar *name, |
| 18098 | const gchar *object_path, |
| 18099 | GCancellable *cancellable, |
| 18100 | GAsyncReadyCallback callback, |
| 18101 | gpointer user_data) |
| 18102 | { |
| 18103 | 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); |
| 18104 | } |
| 18105 | |
| 18106 | /** |
| 18107 | * event_log_proxy_new_for_bus_finish: |
| 18108 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus(). |
| 18109 | * @error: Return location for error or %NULL |
| 18110 | * |
| 18111 | * Finishes an operation started with event_log_proxy_new_for_bus(). |
| 18112 | * |
| 18113 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18114 | */ |
| 18115 | EventLog * |
| 18116 | event_log_proxy_new_for_bus_finish ( |
| 18117 | GAsyncResult *res, |
| 18118 | GError **error) |
| 18119 | { |
| 18120 | GObject *ret; |
| 18121 | GObject *source_object; |
| 18122 | source_object = g_async_result_get_source_object (res); |
| 18123 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18124 | g_object_unref (source_object); |
| 18125 | if (ret != NULL) |
| 18126 | return EVENT_LOG (ret); |
| 18127 | else |
| 18128 | return NULL; |
| 18129 | } |
| 18130 | |
| 18131 | /** |
| 18132 | * event_log_proxy_new_for_bus_sync: |
| 18133 | * @bus_type: A #GBusType. |
| 18134 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18135 | * @name: A bus name (well-known or unique). |
| 18136 | * @object_path: An object path. |
| 18137 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18138 | * @error: Return location for error or %NULL |
| 18139 | * |
| 18140 | * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 18141 | * |
| 18142 | * The calling thread is blocked until a reply is received. |
| 18143 | * |
| 18144 | * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 18145 | * |
| 18146 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18147 | */ |
| 18148 | EventLog * |
| 18149 | event_log_proxy_new_for_bus_sync ( |
| 18150 | GBusType bus_type, |
| 18151 | GDBusProxyFlags flags, |
| 18152 | const gchar *name, |
| 18153 | const gchar *object_path, |
| 18154 | GCancellable *cancellable, |
| 18155 | GError **error) |
| 18156 | { |
| 18157 | GInitable *ret; |
| 18158 | 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); |
| 18159 | if (ret != NULL) |
| 18160 | return EVENT_LOG (ret); |
| 18161 | else |
| 18162 | return NULL; |
| 18163 | } |
| 18164 | |
| 18165 | |
| 18166 | /* ------------------------------------------------------------------------ */ |
| 18167 | |
| 18168 | /** |
| 18169 | * EventLogSkeleton: |
| 18170 | * |
| 18171 | * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 18172 | */ |
| 18173 | |
| 18174 | /** |
| 18175 | * EventLogSkeletonClass: |
| 18176 | * @parent_class: The parent class. |
| 18177 | * |
| 18178 | * Class structure for #EventLogSkeleton. |
| 18179 | */ |
| 18180 | |
| 18181 | struct _EventLogSkeletonPrivate |
| 18182 | { |
| 18183 | GValue *properties; |
| 18184 | GList *changed_properties; |
| 18185 | GSource *changed_properties_idle_source; |
| 18186 | GMainContext *context; |
| 18187 | GMutex lock; |
| 18188 | }; |
| 18189 | |
| 18190 | static void |
| 18191 | _event_log_skeleton_handle_method_call ( |
| 18192 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18193 | const gchar *sender G_GNUC_UNUSED, |
| 18194 | const gchar *object_path G_GNUC_UNUSED, |
| 18195 | const gchar *interface_name, |
| 18196 | const gchar *method_name, |
| 18197 | GVariant *parameters, |
| 18198 | GDBusMethodInvocation *invocation, |
| 18199 | gpointer user_data) |
| 18200 | { |
| 18201 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18202 | _ExtendedGDBusMethodInfo *info; |
| 18203 | GVariantIter iter; |
| 18204 | GVariant *child; |
| 18205 | GValue *paramv; |
| 18206 | guint num_params; |
| 18207 | guint num_extra; |
| 18208 | guint n; |
| 18209 | guint signal_id; |
| 18210 | GValue return_value = G_VALUE_INIT; |
| 18211 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 18212 | g_assert (info != NULL); |
| 18213 | num_params = g_variant_n_children (parameters); |
| 18214 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 18215 | n = 0; |
| 18216 | g_value_init (¶mv[n], TYPE_EVENT_LOG); |
| 18217 | g_value_set_object (¶mv[n++], skeleton); |
| 18218 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 18219 | g_value_set_object (¶mv[n++], invocation); |
| 18220 | if (info->pass_fdlist) |
| 18221 | { |
| 18222 | #ifdef G_OS_UNIX |
| 18223 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 18224 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 18225 | #else |
| 18226 | g_assert_not_reached (); |
| 18227 | #endif |
| 18228 | } |
| 18229 | g_variant_iter_init (&iter, parameters); |
| 18230 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18231 | { |
| 18232 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 18233 | if (arg_info->use_gvariant) |
| 18234 | { |
| 18235 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18236 | g_value_set_variant (¶mv[n], child); |
| 18237 | n++; |
| 18238 | } |
| 18239 | else |
| 18240 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18241 | g_variant_unref (child); |
| 18242 | } |
| 18243 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 18244 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 18245 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 18246 | if (!g_value_get_boolean (&return_value)) |
| 18247 | 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); |
| 18248 | g_value_unset (&return_value); |
| 18249 | for (n = 0; n < num_params + num_extra; n++) |
| 18250 | g_value_unset (¶mv[n]); |
| 18251 | g_free (paramv); |
| 18252 | } |
| 18253 | |
| 18254 | static GVariant * |
| 18255 | _event_log_skeleton_handle_get_property ( |
| 18256 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18257 | const gchar *sender G_GNUC_UNUSED, |
| 18258 | const gchar *object_path G_GNUC_UNUSED, |
| 18259 | const gchar *interface_name G_GNUC_UNUSED, |
| 18260 | const gchar *property_name, |
| 18261 | GError **error, |
| 18262 | gpointer user_data) |
| 18263 | { |
| 18264 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18265 | GValue value = G_VALUE_INIT; |
| 18266 | GParamSpec *pspec; |
| 18267 | _ExtendedGDBusPropertyInfo *info; |
| 18268 | GVariant *ret; |
| 18269 | ret = NULL; |
| 18270 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 18271 | g_assert (info != NULL); |
| 18272 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18273 | if (pspec == NULL) |
| 18274 | { |
| 18275 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18276 | } |
| 18277 | else |
| 18278 | { |
| 18279 | g_value_init (&value, pspec->value_type); |
| 18280 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18281 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 18282 | g_value_unset (&value); |
| 18283 | } |
| 18284 | return ret; |
| 18285 | } |
| 18286 | |
| 18287 | static gboolean |
| 18288 | _event_log_skeleton_handle_set_property ( |
| 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 G_GNUC_UNUSED, |
| 18293 | const gchar *property_name, |
| 18294 | GVariant *variant, |
| 18295 | GError **error, |
| 18296 | gpointer user_data) |
| 18297 | { |
| 18298 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18299 | GValue value = G_VALUE_INIT; |
| 18300 | GParamSpec *pspec; |
| 18301 | _ExtendedGDBusPropertyInfo *info; |
| 18302 | gboolean ret; |
| 18303 | ret = FALSE; |
| 18304 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 18305 | g_assert (info != NULL); |
| 18306 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18307 | if (pspec == NULL) |
| 18308 | { |
| 18309 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18310 | } |
| 18311 | else |
| 18312 | { |
| 18313 | if (info->use_gvariant) |
| 18314 | g_value_set_variant (&value, variant); |
| 18315 | else |
| 18316 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 18317 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18318 | g_value_unset (&value); |
| 18319 | ret = TRUE; |
| 18320 | } |
| 18321 | return ret; |
| 18322 | } |
| 18323 | |
| 18324 | static const GDBusInterfaceVTable _event_log_skeleton_vtable = |
| 18325 | { |
| 18326 | _event_log_skeleton_handle_method_call, |
| 18327 | _event_log_skeleton_handle_get_property, |
| 18328 | _event_log_skeleton_handle_set_property, |
| 18329 | {NULL} |
| 18330 | }; |
| 18331 | |
| 18332 | static GDBusInterfaceInfo * |
| 18333 | event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18334 | { |
| 18335 | return event_log_interface_info (); |
| 18336 | } |
| 18337 | |
| 18338 | static GDBusInterfaceVTable * |
| 18339 | event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18340 | { |
| 18341 | return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable; |
| 18342 | } |
| 18343 | |
| 18344 | static GVariant * |
| 18345 | event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 18346 | { |
| 18347 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton); |
| 18348 | |
| 18349 | GVariantBuilder builder; |
| 18350 | guint n; |
| 18351 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18352 | if (_event_log_interface_info.parent_struct.properties == NULL) |
| 18353 | goto out; |
| 18354 | for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++) |
| 18355 | { |
| 18356 | GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n]; |
| 18357 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 18358 | { |
| 18359 | GVariant *value; |
| 18360 | 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); |
| 18361 | if (value != NULL) |
| 18362 | { |
| 18363 | g_variant_take_ref (value); |
| 18364 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 18365 | g_variant_unref (value); |
| 18366 | } |
| 18367 | } |
| 18368 | } |
| 18369 | out: |
| 18370 | return g_variant_builder_end (&builder); |
| 18371 | } |
| 18372 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18373 | static void |
| 18374 | event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 18375 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18376 | } |
| 18377 | |
| 18378 | static void |
| 18379 | _event_log_on_signal_event_log ( |
| 18380 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 18381 | gint arg_priority, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18382 | const gchar *arg_message) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18383 | { |
| 18384 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
| 18385 | |
| 18386 | GList *connections, *l; |
| 18387 | GVariant *signal_variant; |
| 18388 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18389 | |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 18390 | signal_variant = g_variant_ref_sink (g_variant_new ("(is)", |
| 18391 | arg_priority, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18392 | arg_message)); |
| 18393 | for (l = connections; l != NULL; l = l->next) |
| 18394 | { |
| 18395 | GDBusConnection *connection = l->data; |
| 18396 | g_dbus_connection_emit_signal (connection, |
| 18397 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog", |
| 18398 | signal_variant, NULL); |
| 18399 | } |
| 18400 | g_variant_unref (signal_variant); |
| 18401 | g_list_free_full (connections, g_object_unref); |
| 18402 | } |
| 18403 | |
| 18404 | static void event_log_skeleton_iface_init (EventLogIface *iface); |
| 18405 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18406 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18407 | G_ADD_PRIVATE (EventLogSkeleton) |
| 18408 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 18409 | |
| 18410 | #else |
| 18411 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18412 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 18413 | |
| 18414 | #endif |
| 18415 | static void |
| 18416 | event_log_skeleton_finalize (GObject *object) |
| 18417 | { |
| 18418 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18419 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 18420 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18421 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18422 | g_main_context_unref (skeleton->priv->context); |
| 18423 | g_mutex_clear (&skeleton->priv->lock); |
| 18424 | G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object); |
| 18425 | } |
| 18426 | |
| 18427 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18428 | event_log_skeleton_init (EventLogSkeleton *skeleton) |
| 18429 | { |
| 18430 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18431 | skeleton->priv = event_log_skeleton_get_instance_private (skeleton); |
| 18432 | #else |
| 18433 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate); |
| 18434 | #endif |
| 18435 | |
| 18436 | g_mutex_init (&skeleton->priv->lock); |
| 18437 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18438 | } |
| 18439 | |
| 18440 | static void |
| 18441 | event_log_skeleton_class_init (EventLogSkeletonClass *klass) |
| 18442 | { |
| 18443 | GObjectClass *gobject_class; |
| 18444 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 18445 | |
| 18446 | gobject_class = G_OBJECT_CLASS (klass); |
| 18447 | gobject_class->finalize = event_log_skeleton_finalize; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18448 | |
| 18449 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 18450 | skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info; |
| 18451 | skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties; |
| 18452 | skeleton_class->flush = event_log_skeleton_dbus_interface_flush; |
| 18453 | skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable; |
| 18454 | |
| 18455 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 18456 | g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate)); |
| 18457 | #endif |
| 18458 | } |
| 18459 | |
| 18460 | static void |
| 18461 | event_log_skeleton_iface_init (EventLogIface *iface) |
| 18462 | { |
| 18463 | iface->event_log = _event_log_on_signal_event_log; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18464 | } |
| 18465 | |
| 18466 | /** |
| 18467 | * event_log_skeleton_new: |
| 18468 | * |
| 18469 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 18470 | * |
| 18471 | * Returns: (transfer full) (type EventLogSkeleton): The skeleton object. |
| 18472 | */ |
| 18473 | EventLog * |
| 18474 | event_log_skeleton_new (void) |
| 18475 | { |
| 18476 | return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL)); |
| 18477 | } |
| 18478 | |
| 18479 | /* ------------------------------------------------------------------------ |
| 18480 | * Code for interface org.openbmc.Flash |
| 18481 | * ------------------------------------------------------------------------ |
| 18482 | */ |
| 18483 | |
| 18484 | /** |
| 18485 | * SECTION:Flash |
| 18486 | * @title: Flash |
| 18487 | * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface |
| 18488 | * |
| 18489 | * 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. |
| 18490 | */ |
| 18491 | |
| 18492 | /* ---- Introspection data for org.openbmc.Flash ---- */ |
| 18493 | |
| 18494 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file = |
| 18495 | { |
| 18496 | { |
| 18497 | -1, |
| 18498 | (gchar *) "file", |
| 18499 | (gchar *) "s", |
| 18500 | NULL |
| 18501 | }, |
| 18502 | FALSE |
| 18503 | }; |
| 18504 | |
| 18505 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] = |
| 18506 | { |
| 18507 | &_flash_method_info_update_via_file_IN_ARG_file, |
| 18508 | NULL |
| 18509 | }; |
| 18510 | |
| 18511 | static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file = |
| 18512 | { |
| 18513 | { |
| 18514 | -1, |
| 18515 | (gchar *) "updateViaFile", |
| 18516 | (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers, |
| 18517 | NULL, |
| 18518 | NULL |
| 18519 | }, |
| 18520 | "handle-update-via-file", |
| 18521 | FALSE |
| 18522 | }; |
| 18523 | |
| 18524 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url = |
| 18525 | { |
| 18526 | { |
| 18527 | -1, |
| 18528 | (gchar *) "url", |
| 18529 | (gchar *) "s", |
| 18530 | NULL |
| 18531 | }, |
| 18532 | FALSE |
| 18533 | }; |
| 18534 | |
| 18535 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] = |
| 18536 | { |
| 18537 | &_flash_method_info_update_via_http_IN_ARG_url, |
| 18538 | NULL |
| 18539 | }; |
| 18540 | |
| 18541 | static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http = |
| 18542 | { |
| 18543 | { |
| 18544 | -1, |
| 18545 | (gchar *) "updateViaHttp", |
| 18546 | (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers, |
| 18547 | NULL, |
| 18548 | NULL |
| 18549 | }, |
| 18550 | "handle-update-via-http", |
| 18551 | FALSE |
| 18552 | }; |
| 18553 | |
| 18554 | static const _ExtendedGDBusMethodInfo _flash_method_info_erase = |
| 18555 | { |
| 18556 | { |
| 18557 | -1, |
| 18558 | (gchar *) "erase", |
| 18559 | NULL, |
| 18560 | NULL, |
| 18561 | NULL |
| 18562 | }, |
| 18563 | "handle-erase", |
| 18564 | FALSE |
| 18565 | }; |
| 18566 | |
| 18567 | static const _ExtendedGDBusMethodInfo _flash_method_info_init = |
| 18568 | { |
| 18569 | { |
| 18570 | -1, |
| 18571 | (gchar *) "init", |
| 18572 | NULL, |
| 18573 | NULL, |
| 18574 | NULL |
| 18575 | }, |
| 18576 | "handle-init", |
| 18577 | FALSE |
| 18578 | }; |
| 18579 | |
| 18580 | static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] = |
| 18581 | { |
| 18582 | &_flash_method_info_update_via_file, |
| 18583 | &_flash_method_info_update_via_http, |
| 18584 | &_flash_method_info_erase, |
| 18585 | &_flash_method_info_init, |
| 18586 | NULL |
| 18587 | }; |
| 18588 | |
| 18589 | static const _ExtendedGDBusSignalInfo _flash_signal_info_updated = |
| 18590 | { |
| 18591 | { |
| 18592 | -1, |
| 18593 | (gchar *) "Updated", |
| 18594 | NULL, |
| 18595 | NULL |
| 18596 | }, |
| 18597 | "updated" |
| 18598 | }; |
| 18599 | |
| 18600 | static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] = |
| 18601 | { |
| 18602 | &_flash_signal_info_updated, |
| 18603 | NULL |
| 18604 | }; |
| 18605 | |
| 18606 | static const _ExtendedGDBusInterfaceInfo _flash_interface_info = |
| 18607 | { |
| 18608 | { |
| 18609 | -1, |
| 18610 | (gchar *) "org.openbmc.Flash", |
| 18611 | (GDBusMethodInfo **) &_flash_method_info_pointers, |
| 18612 | (GDBusSignalInfo **) &_flash_signal_info_pointers, |
| 18613 | NULL, |
| 18614 | NULL |
| 18615 | }, |
| 18616 | "flash", |
| 18617 | }; |
| 18618 | |
| 18619 | |
| 18620 | /** |
| 18621 | * flash_interface_info: |
| 18622 | * |
| 18623 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface. |
| 18624 | * |
| 18625 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 18626 | */ |
| 18627 | GDBusInterfaceInfo * |
| 18628 | flash_interface_info (void) |
| 18629 | { |
| 18630 | return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct; |
| 18631 | } |
| 18632 | |
| 18633 | /** |
| 18634 | * flash_override_properties: |
| 18635 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 18636 | * @property_id_begin: The property id to assign to the first overridden property. |
| 18637 | * |
| 18638 | * Overrides all #GObject properties in the #Flash interface for a concrete class. |
| 18639 | * The properties are overridden in the order they are defined. |
| 18640 | * |
| 18641 | * Returns: The last property id. |
| 18642 | */ |
| 18643 | guint |
| 18644 | flash_override_properties (GObjectClass *klass, guint property_id_begin) |
| 18645 | { |
| 18646 | return property_id_begin - 1; |
| 18647 | } |
| 18648 | |
| 18649 | |
| 18650 | |
| 18651 | /** |
| 18652 | * Flash: |
| 18653 | * |
| 18654 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 18655 | */ |
| 18656 | |
| 18657 | /** |
| 18658 | * FlashIface: |
| 18659 | * @parent_iface: The parent interface. |
| 18660 | * @handle_erase: Handler for the #Flash::handle-erase signal. |
| 18661 | * @handle_init: Handler for the #Flash::handle-init signal. |
| 18662 | * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal. |
| 18663 | * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal. |
| 18664 | * @updated: Handler for the #Flash::updated signal. |
| 18665 | * |
| 18666 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 18667 | */ |
| 18668 | |
| 18669 | typedef FlashIface FlashInterface; |
| 18670 | G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT); |
| 18671 | |
| 18672 | static void |
| 18673 | flash_default_init (FlashIface *iface) |
| 18674 | { |
| 18675 | /* GObject signals for incoming D-Bus method calls: */ |
| 18676 | /** |
| 18677 | * Flash::handle-update-via-file: |
| 18678 | * @object: A #Flash. |
| 18679 | * @invocation: A #GDBusMethodInvocation. |
| 18680 | * @arg_file: Argument passed by remote caller. |
| 18681 | * |
| 18682 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method. |
| 18683 | * |
| 18684 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_file() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 18685 | * |
| 18686 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18687 | */ |
| 18688 | g_signal_new ("handle-update-via-file", |
| 18689 | G_TYPE_FROM_INTERFACE (iface), |
| 18690 | G_SIGNAL_RUN_LAST, |
| 18691 | G_STRUCT_OFFSET (FlashIface, handle_update_via_file), |
| 18692 | g_signal_accumulator_true_handled, |
| 18693 | NULL, |
| 18694 | g_cclosure_marshal_generic, |
| 18695 | G_TYPE_BOOLEAN, |
| 18696 | 2, |
| 18697 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 18698 | |
| 18699 | /** |
| 18700 | * Flash::handle-update-via-http: |
| 18701 | * @object: A #Flash. |
| 18702 | * @invocation: A #GDBusMethodInvocation. |
| 18703 | * @arg_url: Argument passed by remote caller. |
| 18704 | * |
| 18705 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method. |
| 18706 | * |
| 18707 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_http() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 18708 | * |
| 18709 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18710 | */ |
| 18711 | g_signal_new ("handle-update-via-http", |
| 18712 | G_TYPE_FROM_INTERFACE (iface), |
| 18713 | G_SIGNAL_RUN_LAST, |
| 18714 | G_STRUCT_OFFSET (FlashIface, handle_update_via_http), |
| 18715 | g_signal_accumulator_true_handled, |
| 18716 | NULL, |
| 18717 | g_cclosure_marshal_generic, |
| 18718 | G_TYPE_BOOLEAN, |
| 18719 | 2, |
| 18720 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 18721 | |
| 18722 | /** |
| 18723 | * Flash::handle-erase: |
| 18724 | * @object: A #Flash. |
| 18725 | * @invocation: A #GDBusMethodInvocation. |
| 18726 | * |
| 18727 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method. |
| 18728 | * |
| 18729 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_erase() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 18730 | * |
| 18731 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18732 | */ |
| 18733 | g_signal_new ("handle-erase", |
| 18734 | G_TYPE_FROM_INTERFACE (iface), |
| 18735 | G_SIGNAL_RUN_LAST, |
| 18736 | G_STRUCT_OFFSET (FlashIface, handle_erase), |
| 18737 | g_signal_accumulator_true_handled, |
| 18738 | NULL, |
| 18739 | g_cclosure_marshal_generic, |
| 18740 | G_TYPE_BOOLEAN, |
| 18741 | 1, |
| 18742 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 18743 | |
| 18744 | /** |
| 18745 | * Flash::handle-init: |
| 18746 | * @object: A #Flash. |
| 18747 | * @invocation: A #GDBusMethodInvocation. |
| 18748 | * |
| 18749 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. |
| 18750 | * |
| 18751 | * 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. |
| 18752 | * |
| 18753 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18754 | */ |
| 18755 | g_signal_new ("handle-init", |
| 18756 | G_TYPE_FROM_INTERFACE (iface), |
| 18757 | G_SIGNAL_RUN_LAST, |
| 18758 | G_STRUCT_OFFSET (FlashIface, handle_init), |
| 18759 | g_signal_accumulator_true_handled, |
| 18760 | NULL, |
| 18761 | g_cclosure_marshal_generic, |
| 18762 | G_TYPE_BOOLEAN, |
| 18763 | 1, |
| 18764 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 18765 | |
| 18766 | /* GObject signals for received D-Bus signals: */ |
| 18767 | /** |
| 18768 | * Flash::updated: |
| 18769 | * @object: A #Flash. |
| 18770 | * |
| 18771 | * 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. |
| 18772 | * |
| 18773 | * 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. |
| 18774 | */ |
| 18775 | g_signal_new ("updated", |
| 18776 | G_TYPE_FROM_INTERFACE (iface), |
| 18777 | G_SIGNAL_RUN_LAST, |
| 18778 | G_STRUCT_OFFSET (FlashIface, updated), |
| 18779 | NULL, |
| 18780 | NULL, |
| 18781 | g_cclosure_marshal_generic, |
| 18782 | G_TYPE_NONE, |
| 18783 | 0); |
| 18784 | |
| 18785 | } |
| 18786 | |
| 18787 | /** |
| 18788 | * flash_emit_updated: |
| 18789 | * @object: A #Flash. |
| 18790 | * |
| 18791 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal. |
| 18792 | */ |
| 18793 | void |
| 18794 | flash_emit_updated ( |
| 18795 | Flash *object) |
| 18796 | { |
| 18797 | g_signal_emit_by_name (object, "updated"); |
| 18798 | } |
| 18799 | |
| 18800 | /** |
| 18801 | * flash_call_update_via_file: |
| 18802 | * @proxy: A #FlashProxy. |
| 18803 | * @arg_file: Argument to pass with the method invocation. |
| 18804 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18805 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 18806 | * @user_data: User data to pass to @callback. |
| 18807 | * |
| 18808 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy. |
| 18809 | * 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. |
| 18810 | * You can then call flash_call_update_via_file_finish() to get the result of the operation. |
| 18811 | * |
| 18812 | * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method. |
| 18813 | */ |
| 18814 | void |
| 18815 | flash_call_update_via_file ( |
| 18816 | Flash *proxy, |
| 18817 | const gchar *arg_file, |
| 18818 | GCancellable *cancellable, |
| 18819 | GAsyncReadyCallback callback, |
| 18820 | gpointer user_data) |
| 18821 | { |
| 18822 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 18823 | "updateViaFile", |
| 18824 | g_variant_new ("(s)", |
| 18825 | arg_file), |
| 18826 | G_DBUS_CALL_FLAGS_NONE, |
| 18827 | -1, |
| 18828 | cancellable, |
| 18829 | callback, |
| 18830 | user_data); |
| 18831 | } |
| 18832 | |
| 18833 | /** |
| 18834 | * flash_call_update_via_file_finish: |
| 18835 | * @proxy: A #FlashProxy. |
| 18836 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file(). |
| 18837 | * @error: Return location for error or %NULL. |
| 18838 | * |
| 18839 | * Finishes an operation started with flash_call_update_via_file(). |
| 18840 | * |
| 18841 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18842 | */ |
| 18843 | gboolean |
| 18844 | flash_call_update_via_file_finish ( |
| 18845 | Flash *proxy, |
| 18846 | GAsyncResult *res, |
| 18847 | GError **error) |
| 18848 | { |
| 18849 | GVariant *_ret; |
| 18850 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 18851 | if (_ret == NULL) |
| 18852 | goto _out; |
| 18853 | g_variant_get (_ret, |
| 18854 | "()"); |
| 18855 | g_variant_unref (_ret); |
| 18856 | _out: |
| 18857 | return _ret != NULL; |
| 18858 | } |
| 18859 | |
| 18860 | /** |
| 18861 | * flash_call_update_via_file_sync: |
| 18862 | * @proxy: A #FlashProxy. |
| 18863 | * @arg_file: Argument to pass with the method invocation. |
| 18864 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18865 | * @error: Return location for error or %NULL. |
| 18866 | * |
| 18867 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 18868 | * |
| 18869 | * See flash_call_update_via_file() for the asynchronous version of this method. |
| 18870 | * |
| 18871 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18872 | */ |
| 18873 | gboolean |
| 18874 | flash_call_update_via_file_sync ( |
| 18875 | Flash *proxy, |
| 18876 | const gchar *arg_file, |
| 18877 | GCancellable *cancellable, |
| 18878 | GError **error) |
| 18879 | { |
| 18880 | GVariant *_ret; |
| 18881 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 18882 | "updateViaFile", |
| 18883 | g_variant_new ("(s)", |
| 18884 | arg_file), |
| 18885 | G_DBUS_CALL_FLAGS_NONE, |
| 18886 | -1, |
| 18887 | cancellable, |
| 18888 | error); |
| 18889 | if (_ret == NULL) |
| 18890 | goto _out; |
| 18891 | g_variant_get (_ret, |
| 18892 | "()"); |
| 18893 | g_variant_unref (_ret); |
| 18894 | _out: |
| 18895 | return _ret != NULL; |
| 18896 | } |
| 18897 | |
| 18898 | /** |
| 18899 | * flash_call_update_via_http: |
| 18900 | * @proxy: A #FlashProxy. |
| 18901 | * @arg_url: Argument to pass with the method invocation. |
| 18902 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18903 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 18904 | * @user_data: User data to pass to @callback. |
| 18905 | * |
| 18906 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy. |
| 18907 | * 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. |
| 18908 | * You can then call flash_call_update_via_http_finish() to get the result of the operation. |
| 18909 | * |
| 18910 | * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method. |
| 18911 | */ |
| 18912 | void |
| 18913 | flash_call_update_via_http ( |
| 18914 | Flash *proxy, |
| 18915 | const gchar *arg_url, |
| 18916 | GCancellable *cancellable, |
| 18917 | GAsyncReadyCallback callback, |
| 18918 | gpointer user_data) |
| 18919 | { |
| 18920 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 18921 | "updateViaHttp", |
| 18922 | g_variant_new ("(s)", |
| 18923 | arg_url), |
| 18924 | G_DBUS_CALL_FLAGS_NONE, |
| 18925 | -1, |
| 18926 | cancellable, |
| 18927 | callback, |
| 18928 | user_data); |
| 18929 | } |
| 18930 | |
| 18931 | /** |
| 18932 | * flash_call_update_via_http_finish: |
| 18933 | * @proxy: A #FlashProxy. |
| 18934 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http(). |
| 18935 | * @error: Return location for error or %NULL. |
| 18936 | * |
| 18937 | * Finishes an operation started with flash_call_update_via_http(). |
| 18938 | * |
| 18939 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18940 | */ |
| 18941 | gboolean |
| 18942 | flash_call_update_via_http_finish ( |
| 18943 | Flash *proxy, |
| 18944 | GAsyncResult *res, |
| 18945 | GError **error) |
| 18946 | { |
| 18947 | GVariant *_ret; |
| 18948 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 18949 | if (_ret == NULL) |
| 18950 | goto _out; |
| 18951 | g_variant_get (_ret, |
| 18952 | "()"); |
| 18953 | g_variant_unref (_ret); |
| 18954 | _out: |
| 18955 | return _ret != NULL; |
| 18956 | } |
| 18957 | |
| 18958 | /** |
| 18959 | * flash_call_update_via_http_sync: |
| 18960 | * @proxy: A #FlashProxy. |
| 18961 | * @arg_url: Argument to pass with the method invocation. |
| 18962 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18963 | * @error: Return location for error or %NULL. |
| 18964 | * |
| 18965 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 18966 | * |
| 18967 | * See flash_call_update_via_http() for the asynchronous version of this method. |
| 18968 | * |
| 18969 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18970 | */ |
| 18971 | gboolean |
| 18972 | flash_call_update_via_http_sync ( |
| 18973 | Flash *proxy, |
| 18974 | const gchar *arg_url, |
| 18975 | GCancellable *cancellable, |
| 18976 | GError **error) |
| 18977 | { |
| 18978 | GVariant *_ret; |
| 18979 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 18980 | "updateViaHttp", |
| 18981 | g_variant_new ("(s)", |
| 18982 | arg_url), |
| 18983 | G_DBUS_CALL_FLAGS_NONE, |
| 18984 | -1, |
| 18985 | cancellable, |
| 18986 | error); |
| 18987 | if (_ret == NULL) |
| 18988 | goto _out; |
| 18989 | g_variant_get (_ret, |
| 18990 | "()"); |
| 18991 | g_variant_unref (_ret); |
| 18992 | _out: |
| 18993 | return _ret != NULL; |
| 18994 | } |
| 18995 | |
| 18996 | /** |
| 18997 | * flash_call_erase: |
| 18998 | * @proxy: A #FlashProxy. |
| 18999 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19000 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19001 | * @user_data: User data to pass to @callback. |
| 19002 | * |
| 19003 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy. |
| 19004 | * 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. |
| 19005 | * You can then call flash_call_erase_finish() to get the result of the operation. |
| 19006 | * |
| 19007 | * See flash_call_erase_sync() for the synchronous, blocking version of this method. |
| 19008 | */ |
| 19009 | void |
| 19010 | flash_call_erase ( |
| 19011 | Flash *proxy, |
| 19012 | GCancellable *cancellable, |
| 19013 | GAsyncReadyCallback callback, |
| 19014 | gpointer user_data) |
| 19015 | { |
| 19016 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19017 | "erase", |
| 19018 | g_variant_new ("()"), |
| 19019 | G_DBUS_CALL_FLAGS_NONE, |
| 19020 | -1, |
| 19021 | cancellable, |
| 19022 | callback, |
| 19023 | user_data); |
| 19024 | } |
| 19025 | |
| 19026 | /** |
| 19027 | * flash_call_erase_finish: |
| 19028 | * @proxy: A #FlashProxy. |
| 19029 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase(). |
| 19030 | * @error: Return location for error or %NULL. |
| 19031 | * |
| 19032 | * Finishes an operation started with flash_call_erase(). |
| 19033 | * |
| 19034 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19035 | */ |
| 19036 | gboolean |
| 19037 | flash_call_erase_finish ( |
| 19038 | Flash *proxy, |
| 19039 | GAsyncResult *res, |
| 19040 | GError **error) |
| 19041 | { |
| 19042 | GVariant *_ret; |
| 19043 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19044 | if (_ret == NULL) |
| 19045 | goto _out; |
| 19046 | g_variant_get (_ret, |
| 19047 | "()"); |
| 19048 | g_variant_unref (_ret); |
| 19049 | _out: |
| 19050 | return _ret != NULL; |
| 19051 | } |
| 19052 | |
| 19053 | /** |
| 19054 | * flash_call_erase_sync: |
| 19055 | * @proxy: A #FlashProxy. |
| 19056 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19057 | * @error: Return location for error or %NULL. |
| 19058 | * |
| 19059 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 19060 | * |
| 19061 | * See flash_call_erase() for the asynchronous version of this method. |
| 19062 | * |
| 19063 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19064 | */ |
| 19065 | gboolean |
| 19066 | flash_call_erase_sync ( |
| 19067 | Flash *proxy, |
| 19068 | GCancellable *cancellable, |
| 19069 | GError **error) |
| 19070 | { |
| 19071 | GVariant *_ret; |
| 19072 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19073 | "erase", |
| 19074 | g_variant_new ("()"), |
| 19075 | G_DBUS_CALL_FLAGS_NONE, |
| 19076 | -1, |
| 19077 | cancellable, |
| 19078 | error); |
| 19079 | if (_ret == NULL) |
| 19080 | goto _out; |
| 19081 | g_variant_get (_ret, |
| 19082 | "()"); |
| 19083 | g_variant_unref (_ret); |
| 19084 | _out: |
| 19085 | return _ret != NULL; |
| 19086 | } |
| 19087 | |
| 19088 | /** |
| 19089 | * flash_call_init: |
| 19090 | * @proxy: A #FlashProxy. |
| 19091 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19092 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19093 | * @user_data: User data to pass to @callback. |
| 19094 | * |
| 19095 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. |
| 19096 | * 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. |
| 19097 | * You can then call flash_call_init_finish() to get the result of the operation. |
| 19098 | * |
| 19099 | * See flash_call_init_sync() for the synchronous, blocking version of this method. |
| 19100 | */ |
| 19101 | void |
| 19102 | flash_call_init ( |
| 19103 | Flash *proxy, |
| 19104 | GCancellable *cancellable, |
| 19105 | GAsyncReadyCallback callback, |
| 19106 | gpointer user_data) |
| 19107 | { |
| 19108 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19109 | "init", |
| 19110 | g_variant_new ("()"), |
| 19111 | G_DBUS_CALL_FLAGS_NONE, |
| 19112 | -1, |
| 19113 | cancellable, |
| 19114 | callback, |
| 19115 | user_data); |
| 19116 | } |
| 19117 | |
| 19118 | /** |
| 19119 | * flash_call_init_finish: |
| 19120 | * @proxy: A #FlashProxy. |
| 19121 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init(). |
| 19122 | * @error: Return location for error or %NULL. |
| 19123 | * |
| 19124 | * Finishes an operation started with flash_call_init(). |
| 19125 | * |
| 19126 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19127 | */ |
| 19128 | gboolean |
| 19129 | flash_call_init_finish ( |
| 19130 | Flash *proxy, |
| 19131 | GAsyncResult *res, |
| 19132 | GError **error) |
| 19133 | { |
| 19134 | GVariant *_ret; |
| 19135 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19136 | if (_ret == NULL) |
| 19137 | goto _out; |
| 19138 | g_variant_get (_ret, |
| 19139 | "()"); |
| 19140 | g_variant_unref (_ret); |
| 19141 | _out: |
| 19142 | return _ret != NULL; |
| 19143 | } |
| 19144 | |
| 19145 | /** |
| 19146 | * flash_call_init_sync: |
| 19147 | * @proxy: A #FlashProxy. |
| 19148 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19149 | * @error: Return location for error or %NULL. |
| 19150 | * |
| 19151 | * 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. |
| 19152 | * |
| 19153 | * See flash_call_init() for the asynchronous version of this method. |
| 19154 | * |
| 19155 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19156 | */ |
| 19157 | gboolean |
| 19158 | flash_call_init_sync ( |
| 19159 | Flash *proxy, |
| 19160 | GCancellable *cancellable, |
| 19161 | GError **error) |
| 19162 | { |
| 19163 | GVariant *_ret; |
| 19164 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19165 | "init", |
| 19166 | g_variant_new ("()"), |
| 19167 | G_DBUS_CALL_FLAGS_NONE, |
| 19168 | -1, |
| 19169 | cancellable, |
| 19170 | error); |
| 19171 | if (_ret == NULL) |
| 19172 | goto _out; |
| 19173 | g_variant_get (_ret, |
| 19174 | "()"); |
| 19175 | g_variant_unref (_ret); |
| 19176 | _out: |
| 19177 | return _ret != NULL; |
| 19178 | } |
| 19179 | |
| 19180 | /** |
| 19181 | * flash_complete_update_via_file: |
| 19182 | * @object: A #Flash. |
| 19183 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19184 | * |
| 19185 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 19186 | * |
| 19187 | * This method will free @invocation, you cannot use it afterwards. |
| 19188 | */ |
| 19189 | void |
| 19190 | flash_complete_update_via_file ( |
| 19191 | Flash *object, |
| 19192 | GDBusMethodInvocation *invocation) |
| 19193 | { |
| 19194 | g_dbus_method_invocation_return_value (invocation, |
| 19195 | g_variant_new ("()")); |
| 19196 | } |
| 19197 | |
| 19198 | /** |
| 19199 | * flash_complete_update_via_http: |
| 19200 | * @object: A #Flash. |
| 19201 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19202 | * |
| 19203 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 19204 | * |
| 19205 | * This method will free @invocation, you cannot use it afterwards. |
| 19206 | */ |
| 19207 | void |
| 19208 | flash_complete_update_via_http ( |
| 19209 | Flash *object, |
| 19210 | GDBusMethodInvocation *invocation) |
| 19211 | { |
| 19212 | g_dbus_method_invocation_return_value (invocation, |
| 19213 | g_variant_new ("()")); |
| 19214 | } |
| 19215 | |
| 19216 | /** |
| 19217 | * flash_complete_erase: |
| 19218 | * @object: A #Flash. |
| 19219 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19220 | * |
| 19221 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 19222 | * |
| 19223 | * This method will free @invocation, you cannot use it afterwards. |
| 19224 | */ |
| 19225 | void |
| 19226 | flash_complete_erase ( |
| 19227 | Flash *object, |
| 19228 | GDBusMethodInvocation *invocation) |
| 19229 | { |
| 19230 | g_dbus_method_invocation_return_value (invocation, |
| 19231 | g_variant_new ("()")); |
| 19232 | } |
| 19233 | |
| 19234 | /** |
| 19235 | * flash_complete_init: |
| 19236 | * @object: A #Flash. |
| 19237 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19238 | * |
| 19239 | * 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. |
| 19240 | * |
| 19241 | * This method will free @invocation, you cannot use it afterwards. |
| 19242 | */ |
| 19243 | void |
| 19244 | flash_complete_init ( |
| 19245 | Flash *object, |
| 19246 | GDBusMethodInvocation *invocation) |
| 19247 | { |
| 19248 | g_dbus_method_invocation_return_value (invocation, |
| 19249 | g_variant_new ("()")); |
| 19250 | } |
| 19251 | |
| 19252 | /* ------------------------------------------------------------------------ */ |
| 19253 | |
| 19254 | /** |
| 19255 | * FlashProxy: |
| 19256 | * |
| 19257 | * The #FlashProxy structure contains only private data and should only be accessed using the provided API. |
| 19258 | */ |
| 19259 | |
| 19260 | /** |
| 19261 | * FlashProxyClass: |
| 19262 | * @parent_class: The parent class. |
| 19263 | * |
| 19264 | * Class structure for #FlashProxy. |
| 19265 | */ |
| 19266 | |
| 19267 | struct _FlashProxyPrivate |
| 19268 | { |
| 19269 | GData *qdata; |
| 19270 | }; |
| 19271 | |
| 19272 | static void flash_proxy_iface_init (FlashIface *iface); |
| 19273 | |
| 19274 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19275 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 19276 | G_ADD_PRIVATE (FlashProxy) |
| 19277 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 19278 | |
| 19279 | #else |
| 19280 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 19281 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 19282 | |
| 19283 | #endif |
| 19284 | static void |
| 19285 | flash_proxy_finalize (GObject *object) |
| 19286 | { |
| 19287 | FlashProxy *proxy = FLASH_PROXY (object); |
| 19288 | g_datalist_clear (&proxy->priv->qdata); |
| 19289 | G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object); |
| 19290 | } |
| 19291 | |
| 19292 | static void |
| 19293 | flash_proxy_get_property (GObject *object, |
| 19294 | guint prop_id, |
| 19295 | GValue *value, |
| 19296 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19297 | { |
| 19298 | } |
| 19299 | |
| 19300 | static void |
| 19301 | flash_proxy_set_property (GObject *object, |
| 19302 | guint prop_id, |
| 19303 | const GValue *value, |
| 19304 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19305 | { |
| 19306 | } |
| 19307 | |
| 19308 | static void |
| 19309 | flash_proxy_g_signal (GDBusProxy *proxy, |
| 19310 | const gchar *sender_name G_GNUC_UNUSED, |
| 19311 | const gchar *signal_name, |
| 19312 | GVariant *parameters) |
| 19313 | { |
| 19314 | _ExtendedGDBusSignalInfo *info; |
| 19315 | GVariantIter iter; |
| 19316 | GVariant *child; |
| 19317 | GValue *paramv; |
| 19318 | guint num_params; |
| 19319 | guint n; |
| 19320 | guint signal_id; |
| 19321 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name); |
| 19322 | if (info == NULL) |
| 19323 | return; |
| 19324 | num_params = g_variant_n_children (parameters); |
| 19325 | paramv = g_new0 (GValue, num_params + 1); |
| 19326 | g_value_init (¶mv[0], TYPE_FLASH); |
| 19327 | g_value_set_object (¶mv[0], proxy); |
| 19328 | g_variant_iter_init (&iter, parameters); |
| 19329 | n = 1; |
| 19330 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19331 | { |
| 19332 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 19333 | if (arg_info->use_gvariant) |
| 19334 | { |
| 19335 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19336 | g_value_set_variant (¶mv[n], child); |
| 19337 | n++; |
| 19338 | } |
| 19339 | else |
| 19340 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19341 | g_variant_unref (child); |
| 19342 | } |
| 19343 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 19344 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 19345 | for (n = 0; n < num_params + 1; n++) |
| 19346 | g_value_unset (¶mv[n]); |
| 19347 | g_free (paramv); |
| 19348 | } |
| 19349 | |
| 19350 | static void |
| 19351 | flash_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 19352 | GVariant *changed_properties, |
| 19353 | const gchar *const *invalidated_properties) |
| 19354 | { |
| 19355 | FlashProxy *proxy = FLASH_PROXY (_proxy); |
| 19356 | guint n; |
| 19357 | const gchar *key; |
| 19358 | GVariantIter *iter; |
| 19359 | _ExtendedGDBusPropertyInfo *info; |
| 19360 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 19361 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 19362 | { |
| 19363 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key); |
| 19364 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 19365 | if (info != NULL) |
| 19366 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19367 | } |
| 19368 | g_variant_iter_free (iter); |
| 19369 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 19370 | { |
| 19371 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]); |
| 19372 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 19373 | if (info != NULL) |
| 19374 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19375 | } |
| 19376 | } |
| 19377 | |
| 19378 | static void |
| 19379 | flash_proxy_init (FlashProxy *proxy) |
| 19380 | { |
| 19381 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19382 | proxy->priv = flash_proxy_get_instance_private (proxy); |
| 19383 | #else |
| 19384 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate); |
| 19385 | #endif |
| 19386 | |
| 19387 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ()); |
| 19388 | } |
| 19389 | |
| 19390 | static void |
| 19391 | flash_proxy_class_init (FlashProxyClass *klass) |
| 19392 | { |
| 19393 | GObjectClass *gobject_class; |
| 19394 | GDBusProxyClass *proxy_class; |
| 19395 | |
| 19396 | gobject_class = G_OBJECT_CLASS (klass); |
| 19397 | gobject_class->finalize = flash_proxy_finalize; |
| 19398 | gobject_class->get_property = flash_proxy_get_property; |
| 19399 | gobject_class->set_property = flash_proxy_set_property; |
| 19400 | |
| 19401 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 19402 | proxy_class->g_signal = flash_proxy_g_signal; |
| 19403 | proxy_class->g_properties_changed = flash_proxy_g_properties_changed; |
| 19404 | |
| 19405 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 19406 | g_type_class_add_private (klass, sizeof (FlashProxyPrivate)); |
| 19407 | #endif |
| 19408 | } |
| 19409 | |
| 19410 | static void |
| 19411 | flash_proxy_iface_init (FlashIface *iface) |
| 19412 | { |
| 19413 | } |
| 19414 | |
| 19415 | /** |
| 19416 | * flash_proxy_new: |
| 19417 | * @connection: A #GDBusConnection. |
| 19418 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19419 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19420 | * @object_path: An object path. |
| 19421 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19422 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19423 | * @user_data: User data to pass to @callback. |
| 19424 | * |
| 19425 | * 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. |
| 19426 | * |
| 19427 | * 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. |
| 19428 | * You can then call flash_proxy_new_finish() to get the result of the operation. |
| 19429 | * |
| 19430 | * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 19431 | */ |
| 19432 | void |
| 19433 | flash_proxy_new ( |
| 19434 | GDBusConnection *connection, |
| 19435 | GDBusProxyFlags flags, |
| 19436 | const gchar *name, |
| 19437 | const gchar *object_path, |
| 19438 | GCancellable *cancellable, |
| 19439 | GAsyncReadyCallback callback, |
| 19440 | gpointer user_data) |
| 19441 | { |
| 19442 | 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); |
| 19443 | } |
| 19444 | |
| 19445 | /** |
| 19446 | * flash_proxy_new_finish: |
| 19447 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new(). |
| 19448 | * @error: Return location for error or %NULL |
| 19449 | * |
| 19450 | * Finishes an operation started with flash_proxy_new(). |
| 19451 | * |
| 19452 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 19453 | */ |
| 19454 | Flash * |
| 19455 | flash_proxy_new_finish ( |
| 19456 | GAsyncResult *res, |
| 19457 | GError **error) |
| 19458 | { |
| 19459 | GObject *ret; |
| 19460 | GObject *source_object; |
| 19461 | source_object = g_async_result_get_source_object (res); |
| 19462 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19463 | g_object_unref (source_object); |
| 19464 | if (ret != NULL) |
| 19465 | return FLASH (ret); |
| 19466 | else |
| 19467 | return NULL; |
| 19468 | } |
| 19469 | |
| 19470 | /** |
| 19471 | * flash_proxy_new_sync: |
| 19472 | * @connection: A #GDBusConnection. |
| 19473 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19474 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19475 | * @object_path: An object path. |
| 19476 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19477 | * @error: Return location for error or %NULL |
| 19478 | * |
| 19479 | * 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. |
| 19480 | * |
| 19481 | * The calling thread is blocked until a reply is received. |
| 19482 | * |
| 19483 | * See flash_proxy_new() for the asynchronous version of this constructor. |
| 19484 | * |
| 19485 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 19486 | */ |
| 19487 | Flash * |
| 19488 | flash_proxy_new_sync ( |
| 19489 | GDBusConnection *connection, |
| 19490 | GDBusProxyFlags flags, |
| 19491 | const gchar *name, |
| 19492 | const gchar *object_path, |
| 19493 | GCancellable *cancellable, |
| 19494 | GError **error) |
| 19495 | { |
| 19496 | GInitable *ret; |
| 19497 | 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); |
| 19498 | if (ret != NULL) |
| 19499 | return FLASH (ret); |
| 19500 | else |
| 19501 | return NULL; |
| 19502 | } |
| 19503 | |
| 19504 | |
| 19505 | /** |
| 19506 | * flash_proxy_new_for_bus: |
| 19507 | * @bus_type: A #GBusType. |
| 19508 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19509 | * @name: A bus name (well-known or unique). |
| 19510 | * @object_path: An object path. |
| 19511 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19512 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19513 | * @user_data: User data to pass to @callback. |
| 19514 | * |
| 19515 | * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 19516 | * |
| 19517 | * 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. |
| 19518 | * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation. |
| 19519 | * |
| 19520 | * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 19521 | */ |
| 19522 | void |
| 19523 | flash_proxy_new_for_bus ( |
| 19524 | GBusType bus_type, |
| 19525 | GDBusProxyFlags flags, |
| 19526 | const gchar *name, |
| 19527 | const gchar *object_path, |
| 19528 | GCancellable *cancellable, |
| 19529 | GAsyncReadyCallback callback, |
| 19530 | gpointer user_data) |
| 19531 | { |
| 19532 | 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); |
| 19533 | } |
| 19534 | |
| 19535 | /** |
| 19536 | * flash_proxy_new_for_bus_finish: |
| 19537 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus(). |
| 19538 | * @error: Return location for error or %NULL |
| 19539 | * |
| 19540 | * Finishes an operation started with flash_proxy_new_for_bus(). |
| 19541 | * |
| 19542 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 19543 | */ |
| 19544 | Flash * |
| 19545 | flash_proxy_new_for_bus_finish ( |
| 19546 | GAsyncResult *res, |
| 19547 | GError **error) |
| 19548 | { |
| 19549 | GObject *ret; |
| 19550 | GObject *source_object; |
| 19551 | source_object = g_async_result_get_source_object (res); |
| 19552 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19553 | g_object_unref (source_object); |
| 19554 | if (ret != NULL) |
| 19555 | return FLASH (ret); |
| 19556 | else |
| 19557 | return NULL; |
| 19558 | } |
| 19559 | |
| 19560 | /** |
| 19561 | * flash_proxy_new_for_bus_sync: |
| 19562 | * @bus_type: A #GBusType. |
| 19563 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19564 | * @name: A bus name (well-known or unique). |
| 19565 | * @object_path: An object path. |
| 19566 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19567 | * @error: Return location for error or %NULL |
| 19568 | * |
| 19569 | * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 19570 | * |
| 19571 | * The calling thread is blocked until a reply is received. |
| 19572 | * |
| 19573 | * See flash_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 19574 | * |
| 19575 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 19576 | */ |
| 19577 | Flash * |
| 19578 | flash_proxy_new_for_bus_sync ( |
| 19579 | GBusType bus_type, |
| 19580 | GDBusProxyFlags flags, |
| 19581 | const gchar *name, |
| 19582 | const gchar *object_path, |
| 19583 | GCancellable *cancellable, |
| 19584 | GError **error) |
| 19585 | { |
| 19586 | GInitable *ret; |
| 19587 | 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); |
| 19588 | if (ret != NULL) |
| 19589 | return FLASH (ret); |
| 19590 | else |
| 19591 | return NULL; |
| 19592 | } |
| 19593 | |
| 19594 | |
| 19595 | /* ------------------------------------------------------------------------ */ |
| 19596 | |
| 19597 | /** |
| 19598 | * FlashSkeleton: |
| 19599 | * |
| 19600 | * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API. |
| 19601 | */ |
| 19602 | |
| 19603 | /** |
| 19604 | * FlashSkeletonClass: |
| 19605 | * @parent_class: The parent class. |
| 19606 | * |
| 19607 | * Class structure for #FlashSkeleton. |
| 19608 | */ |
| 19609 | |
| 19610 | struct _FlashSkeletonPrivate |
| 19611 | { |
| 19612 | GValue *properties; |
| 19613 | GList *changed_properties; |
| 19614 | GSource *changed_properties_idle_source; |
| 19615 | GMainContext *context; |
| 19616 | GMutex lock; |
| 19617 | }; |
| 19618 | |
| 19619 | static void |
| 19620 | _flash_skeleton_handle_method_call ( |
| 19621 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19622 | const gchar *sender G_GNUC_UNUSED, |
| 19623 | const gchar *object_path G_GNUC_UNUSED, |
| 19624 | const gchar *interface_name, |
| 19625 | const gchar *method_name, |
| 19626 | GVariant *parameters, |
| 19627 | GDBusMethodInvocation *invocation, |
| 19628 | gpointer user_data) |
| 19629 | { |
| 19630 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 19631 | _ExtendedGDBusMethodInfo *info; |
| 19632 | GVariantIter iter; |
| 19633 | GVariant *child; |
| 19634 | GValue *paramv; |
| 19635 | guint num_params; |
| 19636 | guint num_extra; |
| 19637 | guint n; |
| 19638 | guint signal_id; |
| 19639 | GValue return_value = G_VALUE_INIT; |
| 19640 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 19641 | g_assert (info != NULL); |
| 19642 | num_params = g_variant_n_children (parameters); |
| 19643 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 19644 | n = 0; |
| 19645 | g_value_init (¶mv[n], TYPE_FLASH); |
| 19646 | g_value_set_object (¶mv[n++], skeleton); |
| 19647 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 19648 | g_value_set_object (¶mv[n++], invocation); |
| 19649 | if (info->pass_fdlist) |
| 19650 | { |
| 19651 | #ifdef G_OS_UNIX |
| 19652 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 19653 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 19654 | #else |
| 19655 | g_assert_not_reached (); |
| 19656 | #endif |
| 19657 | } |
| 19658 | g_variant_iter_init (&iter, parameters); |
| 19659 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19660 | { |
| 19661 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 19662 | if (arg_info->use_gvariant) |
| 19663 | { |
| 19664 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19665 | g_value_set_variant (¶mv[n], child); |
| 19666 | n++; |
| 19667 | } |
| 19668 | else |
| 19669 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19670 | g_variant_unref (child); |
| 19671 | } |
| 19672 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 19673 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 19674 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 19675 | if (!g_value_get_boolean (&return_value)) |
| 19676 | 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); |
| 19677 | g_value_unset (&return_value); |
| 19678 | for (n = 0; n < num_params + num_extra; n++) |
| 19679 | g_value_unset (¶mv[n]); |
| 19680 | g_free (paramv); |
| 19681 | } |
| 19682 | |
| 19683 | static GVariant * |
| 19684 | _flash_skeleton_handle_get_property ( |
| 19685 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19686 | const gchar *sender G_GNUC_UNUSED, |
| 19687 | const gchar *object_path G_GNUC_UNUSED, |
| 19688 | const gchar *interface_name G_GNUC_UNUSED, |
| 19689 | const gchar *property_name, |
| 19690 | GError **error, |
| 19691 | gpointer user_data) |
| 19692 | { |
| 19693 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 19694 | GValue value = G_VALUE_INIT; |
| 19695 | GParamSpec *pspec; |
| 19696 | _ExtendedGDBusPropertyInfo *info; |
| 19697 | GVariant *ret; |
| 19698 | ret = NULL; |
| 19699 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 19700 | g_assert (info != NULL); |
| 19701 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 19702 | if (pspec == NULL) |
| 19703 | { |
| 19704 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 19705 | } |
| 19706 | else |
| 19707 | { |
| 19708 | g_value_init (&value, pspec->value_type); |
| 19709 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 19710 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 19711 | g_value_unset (&value); |
| 19712 | } |
| 19713 | return ret; |
| 19714 | } |
| 19715 | |
| 19716 | static gboolean |
| 19717 | _flash_skeleton_handle_set_property ( |
| 19718 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19719 | const gchar *sender G_GNUC_UNUSED, |
| 19720 | const gchar *object_path G_GNUC_UNUSED, |
| 19721 | const gchar *interface_name G_GNUC_UNUSED, |
| 19722 | const gchar *property_name, |
| 19723 | GVariant *variant, |
| 19724 | GError **error, |
| 19725 | gpointer user_data) |
| 19726 | { |
| 19727 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 19728 | GValue value = G_VALUE_INIT; |
| 19729 | GParamSpec *pspec; |
| 19730 | _ExtendedGDBusPropertyInfo *info; |
| 19731 | gboolean ret; |
| 19732 | ret = FALSE; |
| 19733 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 19734 | g_assert (info != NULL); |
| 19735 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 19736 | if (pspec == NULL) |
| 19737 | { |
| 19738 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 19739 | } |
| 19740 | else |
| 19741 | { |
| 19742 | if (info->use_gvariant) |
| 19743 | g_value_set_variant (&value, variant); |
| 19744 | else |
| 19745 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 19746 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 19747 | g_value_unset (&value); |
| 19748 | ret = TRUE; |
| 19749 | } |
| 19750 | return ret; |
| 19751 | } |
| 19752 | |
| 19753 | static const GDBusInterfaceVTable _flash_skeleton_vtable = |
| 19754 | { |
| 19755 | _flash_skeleton_handle_method_call, |
| 19756 | _flash_skeleton_handle_get_property, |
| 19757 | _flash_skeleton_handle_set_property, |
| 19758 | {NULL} |
| 19759 | }; |
| 19760 | |
| 19761 | static GDBusInterfaceInfo * |
| 19762 | flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 19763 | { |
| 19764 | return flash_interface_info (); |
| 19765 | } |
| 19766 | |
| 19767 | static GDBusInterfaceVTable * |
| 19768 | flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 19769 | { |
| 19770 | return (GDBusInterfaceVTable *) &_flash_skeleton_vtable; |
| 19771 | } |
| 19772 | |
| 19773 | static GVariant * |
| 19774 | flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 19775 | { |
| 19776 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 19777 | |
| 19778 | GVariantBuilder builder; |
| 19779 | guint n; |
| 19780 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 19781 | if (_flash_interface_info.parent_struct.properties == NULL) |
| 19782 | goto out; |
| 19783 | for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++) |
| 19784 | { |
| 19785 | GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n]; |
| 19786 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 19787 | { |
| 19788 | GVariant *value; |
| 19789 | 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); |
| 19790 | if (value != NULL) |
| 19791 | { |
| 19792 | g_variant_take_ref (value); |
| 19793 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 19794 | g_variant_unref (value); |
| 19795 | } |
| 19796 | } |
| 19797 | } |
| 19798 | out: |
| 19799 | return g_variant_builder_end (&builder); |
| 19800 | } |
| 19801 | |
| 19802 | static void |
| 19803 | flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 19804 | { |
| 19805 | } |
| 19806 | |
| 19807 | static void |
| 19808 | _flash_on_signal_updated ( |
| 19809 | Flash *object) |
| 19810 | { |
| 19811 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 19812 | |
| 19813 | GList *connections, *l; |
| 19814 | GVariant *signal_variant; |
| 19815 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 19816 | |
| 19817 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 19818 | for (l = connections; l != NULL; l = l->next) |
| 19819 | { |
| 19820 | GDBusConnection *connection = l->data; |
| 19821 | g_dbus_connection_emit_signal (connection, |
| 19822 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated", |
| 19823 | signal_variant, NULL); |
| 19824 | } |
| 19825 | g_variant_unref (signal_variant); |
| 19826 | g_list_free_full (connections, g_object_unref); |
| 19827 | } |
| 19828 | |
| 19829 | static void flash_skeleton_iface_init (FlashIface *iface); |
| 19830 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19831 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 19832 | G_ADD_PRIVATE (FlashSkeleton) |
| 19833 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 19834 | |
| 19835 | #else |
| 19836 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 19837 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 19838 | |
| 19839 | #endif |
| 19840 | static void |
| 19841 | flash_skeleton_finalize (GObject *object) |
| 19842 | { |
| 19843 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 19844 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 19845 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 19846 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 19847 | g_main_context_unref (skeleton->priv->context); |
| 19848 | g_mutex_clear (&skeleton->priv->lock); |
| 19849 | G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object); |
| 19850 | } |
| 19851 | |
| 19852 | static void |
| 19853 | flash_skeleton_init (FlashSkeleton *skeleton) |
| 19854 | { |
| 19855 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19856 | skeleton->priv = flash_skeleton_get_instance_private (skeleton); |
| 19857 | #else |
| 19858 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate); |
| 19859 | #endif |
| 19860 | |
| 19861 | g_mutex_init (&skeleton->priv->lock); |
| 19862 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 19863 | } |
| 19864 | |
| 19865 | static void |
| 19866 | flash_skeleton_class_init (FlashSkeletonClass *klass) |
| 19867 | { |
| 19868 | GObjectClass *gobject_class; |
| 19869 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 19870 | |
| 19871 | gobject_class = G_OBJECT_CLASS (klass); |
| 19872 | gobject_class->finalize = flash_skeleton_finalize; |
| 19873 | |
| 19874 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 19875 | skeleton_class->get_info = flash_skeleton_dbus_interface_get_info; |
| 19876 | skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties; |
| 19877 | skeleton_class->flush = flash_skeleton_dbus_interface_flush; |
| 19878 | skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable; |
| 19879 | |
| 19880 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 19881 | g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate)); |
| 19882 | #endif |
| 19883 | } |
| 19884 | |
| 19885 | static void |
| 19886 | flash_skeleton_iface_init (FlashIface *iface) |
| 19887 | { |
| 19888 | iface->updated = _flash_on_signal_updated; |
| 19889 | } |
| 19890 | |
| 19891 | /** |
| 19892 | * flash_skeleton_new: |
| 19893 | * |
| 19894 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 19895 | * |
| 19896 | * Returns: (transfer full) (type FlashSkeleton): The skeleton object. |
| 19897 | */ |
| 19898 | Flash * |
| 19899 | flash_skeleton_new (void) |
| 19900 | { |
| 19901 | return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL)); |
| 19902 | } |
| 19903 | |
| 19904 | /* ------------------------------------------------------------------------ |
| 19905 | * Code for interface org.openbmc.Button |
| 19906 | * ------------------------------------------------------------------------ |
| 19907 | */ |
| 19908 | |
| 19909 | /** |
| 19910 | * SECTION:Button |
| 19911 | * @title: Button |
| 19912 | * @short_description: Generated C code for the org.openbmc.Button D-Bus interface |
| 19913 | * |
| 19914 | * 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. |
| 19915 | */ |
| 19916 | |
| 19917 | /* ---- Introspection data for org.openbmc.Button ---- */ |
| 19918 | |
| 19919 | static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state = |
| 19920 | { |
| 19921 | { |
| 19922 | -1, |
| 19923 | (gchar *) "state", |
| 19924 | (gchar *) "b", |
| 19925 | NULL |
| 19926 | }, |
| 19927 | FALSE |
| 19928 | }; |
| 19929 | |
| 19930 | static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] = |
| 19931 | { |
| 19932 | &_button_method_info_is_on_OUT_ARG_state, |
| 19933 | NULL |
| 19934 | }; |
| 19935 | |
| 19936 | static const _ExtendedGDBusMethodInfo _button_method_info_is_on = |
| 19937 | { |
| 19938 | { |
| 19939 | -1, |
| 19940 | (gchar *) "isOn", |
| 19941 | NULL, |
| 19942 | (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers, |
| 19943 | NULL |
| 19944 | }, |
| 19945 | "handle-is-on", |
| 19946 | FALSE |
| 19947 | }; |
| 19948 | |
| 19949 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press = |
| 19950 | { |
| 19951 | { |
| 19952 | -1, |
| 19953 | (gchar *) "simButtonPress", |
| 19954 | NULL, |
| 19955 | NULL, |
| 19956 | NULL |
| 19957 | }, |
| 19958 | "handle-sim-button-press", |
| 19959 | FALSE |
| 19960 | }; |
| 19961 | |
| 19962 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press = |
| 19963 | { |
| 19964 | { |
| 19965 | -1, |
| 19966 | (gchar *) "simButtonLongPress", |
| 19967 | NULL, |
| 19968 | NULL, |
| 19969 | NULL |
| 19970 | }, |
| 19971 | "handle-sim-button-long-press", |
| 19972 | FALSE |
| 19973 | }; |
| 19974 | |
| 19975 | static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] = |
| 19976 | { |
| 19977 | &_button_method_info_is_on, |
| 19978 | &_button_method_info_sim_button_press, |
| 19979 | &_button_method_info_sim_button_long_press, |
| 19980 | NULL |
| 19981 | }; |
| 19982 | |
| 19983 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_release = |
| 19984 | { |
| 19985 | { |
| 19986 | -1, |
| 19987 | (gchar *) "ButtonRelease", |
| 19988 | NULL, |
| 19989 | NULL |
| 19990 | }, |
| 19991 | "button-release" |
| 19992 | }; |
| 19993 | |
| 19994 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed = |
| 19995 | { |
| 19996 | { |
| 19997 | -1, |
| 19998 | (gchar *) "ButtonPressed", |
| 19999 | NULL, |
| 20000 | NULL |
| 20001 | }, |
| 20002 | "button-pressed" |
| 20003 | }; |
| 20004 | |
| 20005 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long = |
| 20006 | { |
| 20007 | { |
| 20008 | -1, |
| 20009 | (gchar *) "ButtonPressedLong", |
| 20010 | NULL, |
| 20011 | NULL |
| 20012 | }, |
| 20013 | "button-pressed-long" |
| 20014 | }; |
| 20015 | |
| 20016 | static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] = |
| 20017 | { |
| 20018 | &_button_signal_info_button_release, |
| 20019 | &_button_signal_info_button_pressed, |
| 20020 | &_button_signal_info_button_pressed_long, |
| 20021 | NULL |
| 20022 | }; |
| 20023 | |
| 20024 | static const _ExtendedGDBusPropertyInfo _button_property_info_state = |
| 20025 | { |
| 20026 | { |
| 20027 | -1, |
| 20028 | (gchar *) "state", |
| 20029 | (gchar *) "b", |
| 20030 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20031 | NULL |
| 20032 | }, |
| 20033 | "state", |
| 20034 | FALSE |
| 20035 | }; |
| 20036 | |
| 20037 | static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] = |
| 20038 | { |
| 20039 | &_button_property_info_state, |
| 20040 | NULL |
| 20041 | }; |
| 20042 | |
| 20043 | static const _ExtendedGDBusInterfaceInfo _button_interface_info = |
| 20044 | { |
| 20045 | { |
| 20046 | -1, |
| 20047 | (gchar *) "org.openbmc.Button", |
| 20048 | (GDBusMethodInfo **) &_button_method_info_pointers, |
| 20049 | (GDBusSignalInfo **) &_button_signal_info_pointers, |
| 20050 | (GDBusPropertyInfo **) &_button_property_info_pointers, |
| 20051 | NULL |
| 20052 | }, |
| 20053 | "button", |
| 20054 | }; |
| 20055 | |
| 20056 | |
| 20057 | /** |
| 20058 | * button_interface_info: |
| 20059 | * |
| 20060 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface. |
| 20061 | * |
| 20062 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 20063 | */ |
| 20064 | GDBusInterfaceInfo * |
| 20065 | button_interface_info (void) |
| 20066 | { |
| 20067 | return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct; |
| 20068 | } |
| 20069 | |
| 20070 | /** |
| 20071 | * button_override_properties: |
| 20072 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 20073 | * @property_id_begin: The property id to assign to the first overridden property. |
| 20074 | * |
| 20075 | * Overrides all #GObject properties in the #Button interface for a concrete class. |
| 20076 | * The properties are overridden in the order they are defined. |
| 20077 | * |
| 20078 | * Returns: The last property id. |
| 20079 | */ |
| 20080 | guint |
| 20081 | button_override_properties (GObjectClass *klass, guint property_id_begin) |
| 20082 | { |
| 20083 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 20084 | return property_id_begin - 1; |
| 20085 | } |
| 20086 | |
| 20087 | |
| 20088 | |
| 20089 | /** |
| 20090 | * Button: |
| 20091 | * |
| 20092 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 20093 | */ |
| 20094 | |
| 20095 | /** |
| 20096 | * ButtonIface: |
| 20097 | * @parent_iface: The parent interface. |
| 20098 | * @handle_is_on: Handler for the #Button::handle-is-on signal. |
| 20099 | * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal. |
| 20100 | * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal. |
| 20101 | * @get_state: Getter for the #Button:state property. |
| 20102 | * @button_pressed: Handler for the #Button::button-pressed signal. |
| 20103 | * @button_pressed_long: Handler for the #Button::button-pressed-long signal. |
| 20104 | * @button_release: Handler for the #Button::button-release signal. |
| 20105 | * |
| 20106 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 20107 | */ |
| 20108 | |
| 20109 | typedef ButtonIface ButtonInterface; |
| 20110 | G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT); |
| 20111 | |
| 20112 | static void |
| 20113 | button_default_init (ButtonIface *iface) |
| 20114 | { |
| 20115 | /* GObject signals for incoming D-Bus method calls: */ |
| 20116 | /** |
| 20117 | * Button::handle-is-on: |
| 20118 | * @object: A #Button. |
| 20119 | * @invocation: A #GDBusMethodInvocation. |
| 20120 | * |
| 20121 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. |
| 20122 | * |
| 20123 | * 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. |
| 20124 | * |
| 20125 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20126 | */ |
| 20127 | g_signal_new ("handle-is-on", |
| 20128 | G_TYPE_FROM_INTERFACE (iface), |
| 20129 | G_SIGNAL_RUN_LAST, |
| 20130 | G_STRUCT_OFFSET (ButtonIface, handle_is_on), |
| 20131 | g_signal_accumulator_true_handled, |
| 20132 | NULL, |
| 20133 | g_cclosure_marshal_generic, |
| 20134 | G_TYPE_BOOLEAN, |
| 20135 | 1, |
| 20136 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20137 | |
| 20138 | /** |
| 20139 | * Button::handle-sim-button-press: |
| 20140 | * @object: A #Button. |
| 20141 | * @invocation: A #GDBusMethodInvocation. |
| 20142 | * |
| 20143 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method. |
| 20144 | * |
| 20145 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_button_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 20146 | * |
| 20147 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20148 | */ |
| 20149 | g_signal_new ("handle-sim-button-press", |
| 20150 | G_TYPE_FROM_INTERFACE (iface), |
| 20151 | G_SIGNAL_RUN_LAST, |
| 20152 | G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press), |
| 20153 | g_signal_accumulator_true_handled, |
| 20154 | NULL, |
| 20155 | g_cclosure_marshal_generic, |
| 20156 | G_TYPE_BOOLEAN, |
| 20157 | 1, |
| 20158 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20159 | |
| 20160 | /** |
| 20161 | * Button::handle-sim-button-long-press: |
| 20162 | * @object: A #Button. |
| 20163 | * @invocation: A #GDBusMethodInvocation. |
| 20164 | * |
| 20165 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method. |
| 20166 | * |
| 20167 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_button_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 20168 | * |
| 20169 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20170 | */ |
| 20171 | g_signal_new ("handle-sim-button-long-press", |
| 20172 | G_TYPE_FROM_INTERFACE (iface), |
| 20173 | G_SIGNAL_RUN_LAST, |
| 20174 | G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press), |
| 20175 | g_signal_accumulator_true_handled, |
| 20176 | NULL, |
| 20177 | g_cclosure_marshal_generic, |
| 20178 | G_TYPE_BOOLEAN, |
| 20179 | 1, |
| 20180 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20181 | |
| 20182 | /* GObject signals for received D-Bus signals: */ |
| 20183 | /** |
| 20184 | * Button::button-release: |
| 20185 | * @object: A #Button. |
| 20186 | * |
| 20187 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> is received. |
| 20188 | * |
| 20189 | * 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. |
| 20190 | */ |
| 20191 | g_signal_new ("button-release", |
| 20192 | G_TYPE_FROM_INTERFACE (iface), |
| 20193 | G_SIGNAL_RUN_LAST, |
| 20194 | G_STRUCT_OFFSET (ButtonIface, button_release), |
| 20195 | NULL, |
| 20196 | NULL, |
| 20197 | g_cclosure_marshal_generic, |
| 20198 | G_TYPE_NONE, |
| 20199 | 0); |
| 20200 | |
| 20201 | /** |
| 20202 | * Button::button-pressed: |
| 20203 | * @object: A #Button. |
| 20204 | * |
| 20205 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> is received. |
| 20206 | * |
| 20207 | * 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. |
| 20208 | */ |
| 20209 | g_signal_new ("button-pressed", |
| 20210 | G_TYPE_FROM_INTERFACE (iface), |
| 20211 | G_SIGNAL_RUN_LAST, |
| 20212 | G_STRUCT_OFFSET (ButtonIface, button_pressed), |
| 20213 | NULL, |
| 20214 | NULL, |
| 20215 | g_cclosure_marshal_generic, |
| 20216 | G_TYPE_NONE, |
| 20217 | 0); |
| 20218 | |
| 20219 | /** |
| 20220 | * Button::button-pressed-long: |
| 20221 | * @object: A #Button. |
| 20222 | * |
| 20223 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> is received. |
| 20224 | * |
| 20225 | * 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. |
| 20226 | */ |
| 20227 | g_signal_new ("button-pressed-long", |
| 20228 | G_TYPE_FROM_INTERFACE (iface), |
| 20229 | G_SIGNAL_RUN_LAST, |
| 20230 | G_STRUCT_OFFSET (ButtonIface, button_pressed_long), |
| 20231 | NULL, |
| 20232 | NULL, |
| 20233 | g_cclosure_marshal_generic, |
| 20234 | G_TYPE_NONE, |
| 20235 | 0); |
| 20236 | |
| 20237 | /* GObject properties for D-Bus properties: */ |
| 20238 | /** |
| 20239 | * Button:state: |
| 20240 | * |
| 20241 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>. |
| 20242 | * |
| 20243 | * 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. |
| 20244 | */ |
| 20245 | g_object_interface_install_property (iface, |
| 20246 | g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 20247 | } |
| 20248 | |
| 20249 | /** |
| 20250 | * button_get_state: (skip) |
| 20251 | * @object: A #Button. |
| 20252 | * |
| 20253 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property. |
| 20254 | * |
| 20255 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20256 | * |
| 20257 | * Returns: The property value. |
| 20258 | */ |
| 20259 | gboolean |
| 20260 | button_get_state (Button *object) |
| 20261 | { |
| 20262 | return BUTTON_GET_IFACE (object)->get_state (object); |
| 20263 | } |
| 20264 | |
| 20265 | /** |
| 20266 | * button_set_state: (skip) |
| 20267 | * @object: A #Button. |
| 20268 | * @value: The value to set. |
| 20269 | * |
| 20270 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value. |
| 20271 | * |
| 20272 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 20273 | */ |
| 20274 | void |
| 20275 | button_set_state (Button *object, gboolean value) |
| 20276 | { |
| 20277 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 20278 | } |
| 20279 | |
| 20280 | /** |
| 20281 | * button_emit_button_release: |
| 20282 | * @object: A #Button. |
| 20283 | * |
| 20284 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal. |
| 20285 | */ |
| 20286 | void |
| 20287 | button_emit_button_release ( |
| 20288 | Button *object) |
| 20289 | { |
| 20290 | g_signal_emit_by_name (object, "button-release"); |
| 20291 | } |
| 20292 | |
| 20293 | /** |
| 20294 | * button_emit_button_pressed: |
| 20295 | * @object: A #Button. |
| 20296 | * |
| 20297 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal. |
| 20298 | */ |
| 20299 | void |
| 20300 | button_emit_button_pressed ( |
| 20301 | Button *object) |
| 20302 | { |
| 20303 | g_signal_emit_by_name (object, "button-pressed"); |
| 20304 | } |
| 20305 | |
| 20306 | /** |
| 20307 | * button_emit_button_pressed_long: |
| 20308 | * @object: A #Button. |
| 20309 | * |
| 20310 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal. |
| 20311 | */ |
| 20312 | void |
| 20313 | button_emit_button_pressed_long ( |
| 20314 | Button *object) |
| 20315 | { |
| 20316 | g_signal_emit_by_name (object, "button-pressed-long"); |
| 20317 | } |
| 20318 | |
| 20319 | /** |
| 20320 | * button_call_is_on: |
| 20321 | * @proxy: A #ButtonProxy. |
| 20322 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20323 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 20324 | * @user_data: User data to pass to @callback. |
| 20325 | * |
| 20326 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. |
| 20327 | * 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. |
| 20328 | * You can then call button_call_is_on_finish() to get the result of the operation. |
| 20329 | * |
| 20330 | * See button_call_is_on_sync() for the synchronous, blocking version of this method. |
| 20331 | */ |
| 20332 | void |
| 20333 | button_call_is_on ( |
| 20334 | Button *proxy, |
| 20335 | GCancellable *cancellable, |
| 20336 | GAsyncReadyCallback callback, |
| 20337 | gpointer user_data) |
| 20338 | { |
| 20339 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 20340 | "isOn", |
| 20341 | g_variant_new ("()"), |
| 20342 | G_DBUS_CALL_FLAGS_NONE, |
| 20343 | -1, |
| 20344 | cancellable, |
| 20345 | callback, |
| 20346 | user_data); |
| 20347 | } |
| 20348 | |
| 20349 | /** |
| 20350 | * button_call_is_on_finish: |
| 20351 | * @proxy: A #ButtonProxy. |
| 20352 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 20353 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on(). |
| 20354 | * @error: Return location for error or %NULL. |
| 20355 | * |
| 20356 | * Finishes an operation started with button_call_is_on(). |
| 20357 | * |
| 20358 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20359 | */ |
| 20360 | gboolean |
| 20361 | button_call_is_on_finish ( |
| 20362 | Button *proxy, |
| 20363 | gboolean *out_state, |
| 20364 | GAsyncResult *res, |
| 20365 | GError **error) |
| 20366 | { |
| 20367 | GVariant *_ret; |
| 20368 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 20369 | if (_ret == NULL) |
| 20370 | goto _out; |
| 20371 | g_variant_get (_ret, |
| 20372 | "(b)", |
| 20373 | out_state); |
| 20374 | g_variant_unref (_ret); |
| 20375 | _out: |
| 20376 | return _ret != NULL; |
| 20377 | } |
| 20378 | |
| 20379 | /** |
| 20380 | * button_call_is_on_sync: |
| 20381 | * @proxy: A #ButtonProxy. |
| 20382 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 20383 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20384 | * @error: Return location for error or %NULL. |
| 20385 | * |
| 20386 | * 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. |
| 20387 | * |
| 20388 | * See button_call_is_on() for the asynchronous version of this method. |
| 20389 | * |
| 20390 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20391 | */ |
| 20392 | gboolean |
| 20393 | button_call_is_on_sync ( |
| 20394 | Button *proxy, |
| 20395 | gboolean *out_state, |
| 20396 | GCancellable *cancellable, |
| 20397 | GError **error) |
| 20398 | { |
| 20399 | GVariant *_ret; |
| 20400 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 20401 | "isOn", |
| 20402 | g_variant_new ("()"), |
| 20403 | G_DBUS_CALL_FLAGS_NONE, |
| 20404 | -1, |
| 20405 | cancellable, |
| 20406 | error); |
| 20407 | if (_ret == NULL) |
| 20408 | goto _out; |
| 20409 | g_variant_get (_ret, |
| 20410 | "(b)", |
| 20411 | out_state); |
| 20412 | g_variant_unref (_ret); |
| 20413 | _out: |
| 20414 | return _ret != NULL; |
| 20415 | } |
| 20416 | |
| 20417 | /** |
| 20418 | * button_call_sim_button_press: |
| 20419 | * @proxy: A #ButtonProxy. |
| 20420 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20421 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 20422 | * @user_data: User data to pass to @callback. |
| 20423 | * |
| 20424 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. |
| 20425 | * 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. |
| 20426 | * You can then call button_call_sim_button_press_finish() to get the result of the operation. |
| 20427 | * |
| 20428 | * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method. |
| 20429 | */ |
| 20430 | void |
| 20431 | button_call_sim_button_press ( |
| 20432 | Button *proxy, |
| 20433 | GCancellable *cancellable, |
| 20434 | GAsyncReadyCallback callback, |
| 20435 | gpointer user_data) |
| 20436 | { |
| 20437 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 20438 | "simButtonPress", |
| 20439 | g_variant_new ("()"), |
| 20440 | G_DBUS_CALL_FLAGS_NONE, |
| 20441 | -1, |
| 20442 | cancellable, |
| 20443 | callback, |
| 20444 | user_data); |
| 20445 | } |
| 20446 | |
| 20447 | /** |
| 20448 | * button_call_sim_button_press_finish: |
| 20449 | * @proxy: A #ButtonProxy. |
| 20450 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press(). |
| 20451 | * @error: Return location for error or %NULL. |
| 20452 | * |
| 20453 | * Finishes an operation started with button_call_sim_button_press(). |
| 20454 | * |
| 20455 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20456 | */ |
| 20457 | gboolean |
| 20458 | button_call_sim_button_press_finish ( |
| 20459 | Button *proxy, |
| 20460 | GAsyncResult *res, |
| 20461 | GError **error) |
| 20462 | { |
| 20463 | GVariant *_ret; |
| 20464 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 20465 | if (_ret == NULL) |
| 20466 | goto _out; |
| 20467 | g_variant_get (_ret, |
| 20468 | "()"); |
| 20469 | g_variant_unref (_ret); |
| 20470 | _out: |
| 20471 | return _ret != NULL; |
| 20472 | } |
| 20473 | |
| 20474 | /** |
| 20475 | * button_call_sim_button_press_sync: |
| 20476 | * @proxy: A #ButtonProxy. |
| 20477 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20478 | * @error: Return location for error or %NULL. |
| 20479 | * |
| 20480 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 20481 | * |
| 20482 | * See button_call_sim_button_press() for the asynchronous version of this method. |
| 20483 | * |
| 20484 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20485 | */ |
| 20486 | gboolean |
| 20487 | button_call_sim_button_press_sync ( |
| 20488 | Button *proxy, |
| 20489 | GCancellable *cancellable, |
| 20490 | GError **error) |
| 20491 | { |
| 20492 | GVariant *_ret; |
| 20493 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 20494 | "simButtonPress", |
| 20495 | g_variant_new ("()"), |
| 20496 | G_DBUS_CALL_FLAGS_NONE, |
| 20497 | -1, |
| 20498 | cancellable, |
| 20499 | error); |
| 20500 | if (_ret == NULL) |
| 20501 | goto _out; |
| 20502 | g_variant_get (_ret, |
| 20503 | "()"); |
| 20504 | g_variant_unref (_ret); |
| 20505 | _out: |
| 20506 | return _ret != NULL; |
| 20507 | } |
| 20508 | |
| 20509 | /** |
| 20510 | * button_call_sim_button_long_press: |
| 20511 | * @proxy: A #ButtonProxy. |
| 20512 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20513 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 20514 | * @user_data: User data to pass to @callback. |
| 20515 | * |
| 20516 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. |
| 20517 | * 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. |
| 20518 | * You can then call button_call_sim_button_long_press_finish() to get the result of the operation. |
| 20519 | * |
| 20520 | * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method. |
| 20521 | */ |
| 20522 | void |
| 20523 | button_call_sim_button_long_press ( |
| 20524 | Button *proxy, |
| 20525 | GCancellable *cancellable, |
| 20526 | GAsyncReadyCallback callback, |
| 20527 | gpointer user_data) |
| 20528 | { |
| 20529 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 20530 | "simButtonLongPress", |
| 20531 | g_variant_new ("()"), |
| 20532 | G_DBUS_CALL_FLAGS_NONE, |
| 20533 | -1, |
| 20534 | cancellable, |
| 20535 | callback, |
| 20536 | user_data); |
| 20537 | } |
| 20538 | |
| 20539 | /** |
| 20540 | * button_call_sim_button_long_press_finish: |
| 20541 | * @proxy: A #ButtonProxy. |
| 20542 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press(). |
| 20543 | * @error: Return location for error or %NULL. |
| 20544 | * |
| 20545 | * Finishes an operation started with button_call_sim_button_long_press(). |
| 20546 | * |
| 20547 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20548 | */ |
| 20549 | gboolean |
| 20550 | button_call_sim_button_long_press_finish ( |
| 20551 | Button *proxy, |
| 20552 | GAsyncResult *res, |
| 20553 | GError **error) |
| 20554 | { |
| 20555 | GVariant *_ret; |
| 20556 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 20557 | if (_ret == NULL) |
| 20558 | goto _out; |
| 20559 | g_variant_get (_ret, |
| 20560 | "()"); |
| 20561 | g_variant_unref (_ret); |
| 20562 | _out: |
| 20563 | return _ret != NULL; |
| 20564 | } |
| 20565 | |
| 20566 | /** |
| 20567 | * button_call_sim_button_long_press_sync: |
| 20568 | * @proxy: A #ButtonProxy. |
| 20569 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20570 | * @error: Return location for error or %NULL. |
| 20571 | * |
| 20572 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 20573 | * |
| 20574 | * See button_call_sim_button_long_press() for the asynchronous version of this method. |
| 20575 | * |
| 20576 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20577 | */ |
| 20578 | gboolean |
| 20579 | button_call_sim_button_long_press_sync ( |
| 20580 | Button *proxy, |
| 20581 | GCancellable *cancellable, |
| 20582 | GError **error) |
| 20583 | { |
| 20584 | GVariant *_ret; |
| 20585 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 20586 | "simButtonLongPress", |
| 20587 | g_variant_new ("()"), |
| 20588 | G_DBUS_CALL_FLAGS_NONE, |
| 20589 | -1, |
| 20590 | cancellable, |
| 20591 | error); |
| 20592 | if (_ret == NULL) |
| 20593 | goto _out; |
| 20594 | g_variant_get (_ret, |
| 20595 | "()"); |
| 20596 | g_variant_unref (_ret); |
| 20597 | _out: |
| 20598 | return _ret != NULL; |
| 20599 | } |
| 20600 | |
| 20601 | /** |
| 20602 | * button_complete_is_on: |
| 20603 | * @object: A #Button. |
| 20604 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 20605 | * @state: Parameter to return. |
| 20606 | * |
| 20607 | * 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. |
| 20608 | * |
| 20609 | * This method will free @invocation, you cannot use it afterwards. |
| 20610 | */ |
| 20611 | void |
| 20612 | button_complete_is_on ( |
| 20613 | Button *object, |
| 20614 | GDBusMethodInvocation *invocation, |
| 20615 | gboolean state) |
| 20616 | { |
| 20617 | g_dbus_method_invocation_return_value (invocation, |
| 20618 | g_variant_new ("(b)", |
| 20619 | state)); |
| 20620 | } |
| 20621 | |
| 20622 | /** |
| 20623 | * button_complete_sim_button_press: |
| 20624 | * @object: A #Button. |
| 20625 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 20626 | * |
| 20627 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 20628 | * |
| 20629 | * This method will free @invocation, you cannot use it afterwards. |
| 20630 | */ |
| 20631 | void |
| 20632 | button_complete_sim_button_press ( |
| 20633 | Button *object, |
| 20634 | GDBusMethodInvocation *invocation) |
| 20635 | { |
| 20636 | g_dbus_method_invocation_return_value (invocation, |
| 20637 | g_variant_new ("()")); |
| 20638 | } |
| 20639 | |
| 20640 | /** |
| 20641 | * button_complete_sim_button_long_press: |
| 20642 | * @object: A #Button. |
| 20643 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 20644 | * |
| 20645 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 20646 | * |
| 20647 | * This method will free @invocation, you cannot use it afterwards. |
| 20648 | */ |
| 20649 | void |
| 20650 | button_complete_sim_button_long_press ( |
| 20651 | Button *object, |
| 20652 | GDBusMethodInvocation *invocation) |
| 20653 | { |
| 20654 | g_dbus_method_invocation_return_value (invocation, |
| 20655 | g_variant_new ("()")); |
| 20656 | } |
| 20657 | |
| 20658 | /* ------------------------------------------------------------------------ */ |
| 20659 | |
| 20660 | /** |
| 20661 | * ButtonProxy: |
| 20662 | * |
| 20663 | * The #ButtonProxy structure contains only private data and should only be accessed using the provided API. |
| 20664 | */ |
| 20665 | |
| 20666 | /** |
| 20667 | * ButtonProxyClass: |
| 20668 | * @parent_class: The parent class. |
| 20669 | * |
| 20670 | * Class structure for #ButtonProxy. |
| 20671 | */ |
| 20672 | |
| 20673 | struct _ButtonProxyPrivate |
| 20674 | { |
| 20675 | GData *qdata; |
| 20676 | }; |
| 20677 | |
| 20678 | static void button_proxy_iface_init (ButtonIface *iface); |
| 20679 | |
| 20680 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20681 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 20682 | G_ADD_PRIVATE (ButtonProxy) |
| 20683 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 20684 | |
| 20685 | #else |
| 20686 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 20687 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 20688 | |
| 20689 | #endif |
| 20690 | static void |
| 20691 | button_proxy_finalize (GObject *object) |
| 20692 | { |
| 20693 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 20694 | g_datalist_clear (&proxy->priv->qdata); |
| 20695 | G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object); |
| 20696 | } |
| 20697 | |
| 20698 | static void |
| 20699 | button_proxy_get_property (GObject *object, |
| 20700 | guint prop_id, |
| 20701 | GValue *value, |
| 20702 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20703 | { |
| 20704 | const _ExtendedGDBusPropertyInfo *info; |
| 20705 | GVariant *variant; |
| 20706 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 20707 | info = _button_property_info_pointers[prop_id - 1]; |
| 20708 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 20709 | if (info->use_gvariant) |
| 20710 | { |
| 20711 | g_value_set_variant (value, variant); |
| 20712 | } |
| 20713 | else |
| 20714 | { |
| 20715 | if (variant != NULL) |
| 20716 | g_dbus_gvariant_to_gvalue (variant, value); |
| 20717 | } |
| 20718 | if (variant != NULL) |
| 20719 | g_variant_unref (variant); |
| 20720 | } |
| 20721 | |
| 20722 | static void |
| 20723 | button_proxy_set_property_cb (GDBusProxy *proxy, |
| 20724 | GAsyncResult *res, |
| 20725 | gpointer user_data) |
| 20726 | { |
| 20727 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 20728 | GError *error; |
| 20729 | GVariant *_ret; |
| 20730 | error = NULL; |
| 20731 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 20732 | if (!_ret) |
| 20733 | { |
| 20734 | g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)", |
| 20735 | info->parent_struct.name, |
| 20736 | error->message, g_quark_to_string (error->domain), error->code); |
| 20737 | g_error_free (error); |
| 20738 | } |
| 20739 | else |
| 20740 | { |
| 20741 | g_variant_unref (_ret); |
| 20742 | } |
| 20743 | } |
| 20744 | |
| 20745 | static void |
| 20746 | button_proxy_set_property (GObject *object, |
| 20747 | guint prop_id, |
| 20748 | const GValue *value, |
| 20749 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20750 | { |
| 20751 | const _ExtendedGDBusPropertyInfo *info; |
| 20752 | GVariant *variant; |
| 20753 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 20754 | info = _button_property_info_pointers[prop_id - 1]; |
| 20755 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 20756 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 20757 | "org.freedesktop.DBus.Properties.Set", |
| 20758 | g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant), |
| 20759 | G_DBUS_CALL_FLAGS_NONE, |
| 20760 | -1, |
| 20761 | NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 20762 | g_variant_unref (variant); |
| 20763 | } |
| 20764 | |
| 20765 | static void |
| 20766 | button_proxy_g_signal (GDBusProxy *proxy, |
| 20767 | const gchar *sender_name G_GNUC_UNUSED, |
| 20768 | const gchar *signal_name, |
| 20769 | GVariant *parameters) |
| 20770 | { |
| 20771 | _ExtendedGDBusSignalInfo *info; |
| 20772 | GVariantIter iter; |
| 20773 | GVariant *child; |
| 20774 | GValue *paramv; |
| 20775 | guint num_params; |
| 20776 | guint n; |
| 20777 | guint signal_id; |
| 20778 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name); |
| 20779 | if (info == NULL) |
| 20780 | return; |
| 20781 | num_params = g_variant_n_children (parameters); |
| 20782 | paramv = g_new0 (GValue, num_params + 1); |
| 20783 | g_value_init (¶mv[0], TYPE_BUTTON); |
| 20784 | g_value_set_object (¶mv[0], proxy); |
| 20785 | g_variant_iter_init (&iter, parameters); |
| 20786 | n = 1; |
| 20787 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 20788 | { |
| 20789 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 20790 | if (arg_info->use_gvariant) |
| 20791 | { |
| 20792 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 20793 | g_value_set_variant (¶mv[n], child); |
| 20794 | n++; |
| 20795 | } |
| 20796 | else |
| 20797 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 20798 | g_variant_unref (child); |
| 20799 | } |
| 20800 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 20801 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 20802 | for (n = 0; n < num_params + 1; n++) |
| 20803 | g_value_unset (¶mv[n]); |
| 20804 | g_free (paramv); |
| 20805 | } |
| 20806 | |
| 20807 | static void |
| 20808 | button_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 20809 | GVariant *changed_properties, |
| 20810 | const gchar *const *invalidated_properties) |
| 20811 | { |
| 20812 | ButtonProxy *proxy = BUTTON_PROXY (_proxy); |
| 20813 | guint n; |
| 20814 | const gchar *key; |
| 20815 | GVariantIter *iter; |
| 20816 | _ExtendedGDBusPropertyInfo *info; |
| 20817 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 20818 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 20819 | { |
| 20820 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key); |
| 20821 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 20822 | if (info != NULL) |
| 20823 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 20824 | } |
| 20825 | g_variant_iter_free (iter); |
| 20826 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 20827 | { |
| 20828 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]); |
| 20829 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 20830 | if (info != NULL) |
| 20831 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 20832 | } |
| 20833 | } |
| 20834 | |
| 20835 | static gboolean |
| 20836 | button_proxy_get_state (Button *object) |
| 20837 | { |
| 20838 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 20839 | GVariant *variant; |
| 20840 | gboolean value = 0; |
| 20841 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 20842 | if (variant != NULL) |
| 20843 | { |
| 20844 | value = g_variant_get_boolean (variant); |
| 20845 | g_variant_unref (variant); |
| 20846 | } |
| 20847 | return value; |
| 20848 | } |
| 20849 | |
| 20850 | static void |
| 20851 | button_proxy_init (ButtonProxy *proxy) |
| 20852 | { |
| 20853 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20854 | proxy->priv = button_proxy_get_instance_private (proxy); |
| 20855 | #else |
| 20856 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate); |
| 20857 | #endif |
| 20858 | |
| 20859 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ()); |
| 20860 | } |
| 20861 | |
| 20862 | static void |
| 20863 | button_proxy_class_init (ButtonProxyClass *klass) |
| 20864 | { |
| 20865 | GObjectClass *gobject_class; |
| 20866 | GDBusProxyClass *proxy_class; |
| 20867 | |
| 20868 | gobject_class = G_OBJECT_CLASS (klass); |
| 20869 | gobject_class->finalize = button_proxy_finalize; |
| 20870 | gobject_class->get_property = button_proxy_get_property; |
| 20871 | gobject_class->set_property = button_proxy_set_property; |
| 20872 | |
| 20873 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 20874 | proxy_class->g_signal = button_proxy_g_signal; |
| 20875 | proxy_class->g_properties_changed = button_proxy_g_properties_changed; |
| 20876 | |
| 20877 | button_override_properties (gobject_class, 1); |
| 20878 | |
| 20879 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20880 | g_type_class_add_private (klass, sizeof (ButtonProxyPrivate)); |
| 20881 | #endif |
| 20882 | } |
| 20883 | |
| 20884 | static void |
| 20885 | button_proxy_iface_init (ButtonIface *iface) |
| 20886 | { |
| 20887 | iface->get_state = button_proxy_get_state; |
| 20888 | } |
| 20889 | |
| 20890 | /** |
| 20891 | * button_proxy_new: |
| 20892 | * @connection: A #GDBusConnection. |
| 20893 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20894 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20895 | * @object_path: An object path. |
| 20896 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20897 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 20898 | * @user_data: User data to pass to @callback. |
| 20899 | * |
| 20900 | * 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. |
| 20901 | * |
| 20902 | * 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. |
| 20903 | * You can then call button_proxy_new_finish() to get the result of the operation. |
| 20904 | * |
| 20905 | * See button_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 20906 | */ |
| 20907 | void |
| 20908 | button_proxy_new ( |
| 20909 | GDBusConnection *connection, |
| 20910 | GDBusProxyFlags flags, |
| 20911 | const gchar *name, |
| 20912 | const gchar *object_path, |
| 20913 | GCancellable *cancellable, |
| 20914 | GAsyncReadyCallback callback, |
| 20915 | gpointer user_data) |
| 20916 | { |
| 20917 | 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); |
| 20918 | } |
| 20919 | |
| 20920 | /** |
| 20921 | * button_proxy_new_finish: |
| 20922 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new(). |
| 20923 | * @error: Return location for error or %NULL |
| 20924 | * |
| 20925 | * Finishes an operation started with button_proxy_new(). |
| 20926 | * |
| 20927 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 20928 | */ |
| 20929 | Button * |
| 20930 | button_proxy_new_finish ( |
| 20931 | GAsyncResult *res, |
| 20932 | GError **error) |
| 20933 | { |
| 20934 | GObject *ret; |
| 20935 | GObject *source_object; |
| 20936 | source_object = g_async_result_get_source_object (res); |
| 20937 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 20938 | g_object_unref (source_object); |
| 20939 | if (ret != NULL) |
| 20940 | return BUTTON (ret); |
| 20941 | else |
| 20942 | return NULL; |
| 20943 | } |
| 20944 | |
| 20945 | /** |
| 20946 | * button_proxy_new_sync: |
| 20947 | * @connection: A #GDBusConnection. |
| 20948 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20949 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20950 | * @object_path: An object path. |
| 20951 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20952 | * @error: Return location for error or %NULL |
| 20953 | * |
| 20954 | * 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. |
| 20955 | * |
| 20956 | * The calling thread is blocked until a reply is received. |
| 20957 | * |
| 20958 | * See button_proxy_new() for the asynchronous version of this constructor. |
| 20959 | * |
| 20960 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 20961 | */ |
| 20962 | Button * |
| 20963 | button_proxy_new_sync ( |
| 20964 | GDBusConnection *connection, |
| 20965 | GDBusProxyFlags flags, |
| 20966 | const gchar *name, |
| 20967 | const gchar *object_path, |
| 20968 | GCancellable *cancellable, |
| 20969 | GError **error) |
| 20970 | { |
| 20971 | GInitable *ret; |
| 20972 | 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); |
| 20973 | if (ret != NULL) |
| 20974 | return BUTTON (ret); |
| 20975 | else |
| 20976 | return NULL; |
| 20977 | } |
| 20978 | |
| 20979 | |
| 20980 | /** |
| 20981 | * button_proxy_new_for_bus: |
| 20982 | * @bus_type: A #GBusType. |
| 20983 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20984 | * @name: A bus name (well-known or unique). |
| 20985 | * @object_path: An object path. |
| 20986 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20987 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 20988 | * @user_data: User data to pass to @callback. |
| 20989 | * |
| 20990 | * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 20991 | * |
| 20992 | * 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. |
| 20993 | * You can then call button_proxy_new_for_bus_finish() to get the result of the operation. |
| 20994 | * |
| 20995 | * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 20996 | */ |
| 20997 | void |
| 20998 | button_proxy_new_for_bus ( |
| 20999 | GBusType bus_type, |
| 21000 | GDBusProxyFlags flags, |
| 21001 | const gchar *name, |
| 21002 | const gchar *object_path, |
| 21003 | GCancellable *cancellable, |
| 21004 | GAsyncReadyCallback callback, |
| 21005 | gpointer user_data) |
| 21006 | { |
| 21007 | 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); |
| 21008 | } |
| 21009 | |
| 21010 | /** |
| 21011 | * button_proxy_new_for_bus_finish: |
| 21012 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus(). |
| 21013 | * @error: Return location for error or %NULL |
| 21014 | * |
| 21015 | * Finishes an operation started with button_proxy_new_for_bus(). |
| 21016 | * |
| 21017 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 21018 | */ |
| 21019 | Button * |
| 21020 | button_proxy_new_for_bus_finish ( |
| 21021 | GAsyncResult *res, |
| 21022 | GError **error) |
| 21023 | { |
| 21024 | GObject *ret; |
| 21025 | GObject *source_object; |
| 21026 | source_object = g_async_result_get_source_object (res); |
| 21027 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 21028 | g_object_unref (source_object); |
| 21029 | if (ret != NULL) |
| 21030 | return BUTTON (ret); |
| 21031 | else |
| 21032 | return NULL; |
| 21033 | } |
| 21034 | |
| 21035 | /** |
| 21036 | * button_proxy_new_for_bus_sync: |
| 21037 | * @bus_type: A #GBusType. |
| 21038 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21039 | * @name: A bus name (well-known or unique). |
| 21040 | * @object_path: An object path. |
| 21041 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21042 | * @error: Return location for error or %NULL |
| 21043 | * |
| 21044 | * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 21045 | * |
| 21046 | * The calling thread is blocked until a reply is received. |
| 21047 | * |
| 21048 | * See button_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 21049 | * |
| 21050 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 21051 | */ |
| 21052 | Button * |
| 21053 | button_proxy_new_for_bus_sync ( |
| 21054 | GBusType bus_type, |
| 21055 | GDBusProxyFlags flags, |
| 21056 | const gchar *name, |
| 21057 | const gchar *object_path, |
| 21058 | GCancellable *cancellable, |
| 21059 | GError **error) |
| 21060 | { |
| 21061 | GInitable *ret; |
| 21062 | 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); |
| 21063 | if (ret != NULL) |
| 21064 | return BUTTON (ret); |
| 21065 | else |
| 21066 | return NULL; |
| 21067 | } |
| 21068 | |
| 21069 | |
| 21070 | /* ------------------------------------------------------------------------ */ |
| 21071 | |
| 21072 | /** |
| 21073 | * ButtonSkeleton: |
| 21074 | * |
| 21075 | * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API. |
| 21076 | */ |
| 21077 | |
| 21078 | /** |
| 21079 | * ButtonSkeletonClass: |
| 21080 | * @parent_class: The parent class. |
| 21081 | * |
| 21082 | * Class structure for #ButtonSkeleton. |
| 21083 | */ |
| 21084 | |
| 21085 | struct _ButtonSkeletonPrivate |
| 21086 | { |
| 21087 | GValue *properties; |
| 21088 | GList *changed_properties; |
| 21089 | GSource *changed_properties_idle_source; |
| 21090 | GMainContext *context; |
| 21091 | GMutex lock; |
| 21092 | }; |
| 21093 | |
| 21094 | static void |
| 21095 | _button_skeleton_handle_method_call ( |
| 21096 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21097 | const gchar *sender G_GNUC_UNUSED, |
| 21098 | const gchar *object_path G_GNUC_UNUSED, |
| 21099 | const gchar *interface_name, |
| 21100 | const gchar *method_name, |
| 21101 | GVariant *parameters, |
| 21102 | GDBusMethodInvocation *invocation, |
| 21103 | gpointer user_data) |
| 21104 | { |
| 21105 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 21106 | _ExtendedGDBusMethodInfo *info; |
| 21107 | GVariantIter iter; |
| 21108 | GVariant *child; |
| 21109 | GValue *paramv; |
| 21110 | guint num_params; |
| 21111 | guint num_extra; |
| 21112 | guint n; |
| 21113 | guint signal_id; |
| 21114 | GValue return_value = G_VALUE_INIT; |
| 21115 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 21116 | g_assert (info != NULL); |
| 21117 | num_params = g_variant_n_children (parameters); |
| 21118 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 21119 | n = 0; |
| 21120 | g_value_init (¶mv[n], TYPE_BUTTON); |
| 21121 | g_value_set_object (¶mv[n++], skeleton); |
| 21122 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 21123 | g_value_set_object (¶mv[n++], invocation); |
| 21124 | if (info->pass_fdlist) |
| 21125 | { |
| 21126 | #ifdef G_OS_UNIX |
| 21127 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 21128 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 21129 | #else |
| 21130 | g_assert_not_reached (); |
| 21131 | #endif |
| 21132 | } |
| 21133 | g_variant_iter_init (&iter, parameters); |
| 21134 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 21135 | { |
| 21136 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 21137 | if (arg_info->use_gvariant) |
| 21138 | { |
| 21139 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 21140 | g_value_set_variant (¶mv[n], child); |
| 21141 | n++; |
| 21142 | } |
| 21143 | else |
| 21144 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 21145 | g_variant_unref (child); |
| 21146 | } |
| 21147 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 21148 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 21149 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 21150 | if (!g_value_get_boolean (&return_value)) |
| 21151 | 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); |
| 21152 | g_value_unset (&return_value); |
| 21153 | for (n = 0; n < num_params + num_extra; n++) |
| 21154 | g_value_unset (¶mv[n]); |
| 21155 | g_free (paramv); |
| 21156 | } |
| 21157 | |
| 21158 | static GVariant * |
| 21159 | _button_skeleton_handle_get_property ( |
| 21160 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21161 | const gchar *sender G_GNUC_UNUSED, |
| 21162 | const gchar *object_path G_GNUC_UNUSED, |
| 21163 | const gchar *interface_name G_GNUC_UNUSED, |
| 21164 | const gchar *property_name, |
| 21165 | GError **error, |
| 21166 | gpointer user_data) |
| 21167 | { |
| 21168 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 21169 | GValue value = G_VALUE_INIT; |
| 21170 | GParamSpec *pspec; |
| 21171 | _ExtendedGDBusPropertyInfo *info; |
| 21172 | GVariant *ret; |
| 21173 | ret = NULL; |
| 21174 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 21175 | g_assert (info != NULL); |
| 21176 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 21177 | if (pspec == NULL) |
| 21178 | { |
| 21179 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 21180 | } |
| 21181 | else |
| 21182 | { |
| 21183 | g_value_init (&value, pspec->value_type); |
| 21184 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 21185 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 21186 | g_value_unset (&value); |
| 21187 | } |
| 21188 | return ret; |
| 21189 | } |
| 21190 | |
| 21191 | static gboolean |
| 21192 | _button_skeleton_handle_set_property ( |
| 21193 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21194 | const gchar *sender G_GNUC_UNUSED, |
| 21195 | const gchar *object_path G_GNUC_UNUSED, |
| 21196 | const gchar *interface_name G_GNUC_UNUSED, |
| 21197 | const gchar *property_name, |
| 21198 | GVariant *variant, |
| 21199 | GError **error, |
| 21200 | gpointer user_data) |
| 21201 | { |
| 21202 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 21203 | GValue value = G_VALUE_INIT; |
| 21204 | GParamSpec *pspec; |
| 21205 | _ExtendedGDBusPropertyInfo *info; |
| 21206 | gboolean ret; |
| 21207 | ret = FALSE; |
| 21208 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 21209 | g_assert (info != NULL); |
| 21210 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 21211 | if (pspec == NULL) |
| 21212 | { |
| 21213 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 21214 | } |
| 21215 | else |
| 21216 | { |
| 21217 | if (info->use_gvariant) |
| 21218 | g_value_set_variant (&value, variant); |
| 21219 | else |
| 21220 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 21221 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 21222 | g_value_unset (&value); |
| 21223 | ret = TRUE; |
| 21224 | } |
| 21225 | return ret; |
| 21226 | } |
| 21227 | |
| 21228 | static const GDBusInterfaceVTable _button_skeleton_vtable = |
| 21229 | { |
| 21230 | _button_skeleton_handle_method_call, |
| 21231 | _button_skeleton_handle_get_property, |
| 21232 | _button_skeleton_handle_set_property, |
| 21233 | {NULL} |
| 21234 | }; |
| 21235 | |
| 21236 | static GDBusInterfaceInfo * |
| 21237 | button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 21238 | { |
| 21239 | return button_interface_info (); |
| 21240 | } |
| 21241 | |
| 21242 | static GDBusInterfaceVTable * |
| 21243 | button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 21244 | { |
| 21245 | return (GDBusInterfaceVTable *) &_button_skeleton_vtable; |
| 21246 | } |
| 21247 | |
| 21248 | static GVariant * |
| 21249 | button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 21250 | { |
| 21251 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 21252 | |
| 21253 | GVariantBuilder builder; |
| 21254 | guint n; |
| 21255 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 21256 | if (_button_interface_info.parent_struct.properties == NULL) |
| 21257 | goto out; |
| 21258 | for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++) |
| 21259 | { |
| 21260 | GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n]; |
| 21261 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 21262 | { |
| 21263 | GVariant *value; |
| 21264 | 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); |
| 21265 | if (value != NULL) |
| 21266 | { |
| 21267 | g_variant_take_ref (value); |
| 21268 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 21269 | g_variant_unref (value); |
| 21270 | } |
| 21271 | } |
| 21272 | } |
| 21273 | out: |
| 21274 | return g_variant_builder_end (&builder); |
| 21275 | } |
| 21276 | |
| 21277 | static gboolean _button_emit_changed (gpointer user_data); |
| 21278 | |
| 21279 | static void |
| 21280 | button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 21281 | { |
| 21282 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 21283 | gboolean emit_changed = FALSE; |
| 21284 | |
| 21285 | g_mutex_lock (&skeleton->priv->lock); |
| 21286 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 21287 | { |
| 21288 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 21289 | skeleton->priv->changed_properties_idle_source = NULL; |
| 21290 | emit_changed = TRUE; |
| 21291 | } |
| 21292 | g_mutex_unlock (&skeleton->priv->lock); |
| 21293 | |
| 21294 | if (emit_changed) |
| 21295 | _button_emit_changed (skeleton); |
| 21296 | } |
| 21297 | |
| 21298 | static void |
| 21299 | _button_on_signal_button_release ( |
| 21300 | Button *object) |
| 21301 | { |
| 21302 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21303 | |
| 21304 | GList *connections, *l; |
| 21305 | GVariant *signal_variant; |
| 21306 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 21307 | |
| 21308 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 21309 | for (l = connections; l != NULL; l = l->next) |
| 21310 | { |
| 21311 | GDBusConnection *connection = l->data; |
| 21312 | g_dbus_connection_emit_signal (connection, |
| 21313 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease", |
| 21314 | signal_variant, NULL); |
| 21315 | } |
| 21316 | g_variant_unref (signal_variant); |
| 21317 | g_list_free_full (connections, g_object_unref); |
| 21318 | } |
| 21319 | |
| 21320 | static void |
| 21321 | _button_on_signal_button_pressed ( |
| 21322 | Button *object) |
| 21323 | { |
| 21324 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21325 | |
| 21326 | GList *connections, *l; |
| 21327 | GVariant *signal_variant; |
| 21328 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 21329 | |
| 21330 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 21331 | for (l = connections; l != NULL; l = l->next) |
| 21332 | { |
| 21333 | GDBusConnection *connection = l->data; |
| 21334 | g_dbus_connection_emit_signal (connection, |
| 21335 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed", |
| 21336 | signal_variant, NULL); |
| 21337 | } |
| 21338 | g_variant_unref (signal_variant); |
| 21339 | g_list_free_full (connections, g_object_unref); |
| 21340 | } |
| 21341 | |
| 21342 | static void |
| 21343 | _button_on_signal_button_pressed_long ( |
| 21344 | Button *object) |
| 21345 | { |
| 21346 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21347 | |
| 21348 | GList *connections, *l; |
| 21349 | GVariant *signal_variant; |
| 21350 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 21351 | |
| 21352 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 21353 | for (l = connections; l != NULL; l = l->next) |
| 21354 | { |
| 21355 | GDBusConnection *connection = l->data; |
| 21356 | g_dbus_connection_emit_signal (connection, |
| 21357 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong", |
| 21358 | signal_variant, NULL); |
| 21359 | } |
| 21360 | g_variant_unref (signal_variant); |
| 21361 | g_list_free_full (connections, g_object_unref); |
| 21362 | } |
| 21363 | |
| 21364 | static void button_skeleton_iface_init (ButtonIface *iface); |
| 21365 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21366 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 21367 | G_ADD_PRIVATE (ButtonSkeleton) |
| 21368 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 21369 | |
| 21370 | #else |
| 21371 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 21372 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 21373 | |
| 21374 | #endif |
| 21375 | static void |
| 21376 | button_skeleton_finalize (GObject *object) |
| 21377 | { |
| 21378 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21379 | guint n; |
| 21380 | for (n = 0; n < 1; n++) |
| 21381 | g_value_unset (&skeleton->priv->properties[n]); |
| 21382 | g_free (skeleton->priv->properties); |
| 21383 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 21384 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 21385 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 21386 | g_main_context_unref (skeleton->priv->context); |
| 21387 | g_mutex_clear (&skeleton->priv->lock); |
| 21388 | G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object); |
| 21389 | } |
| 21390 | |
| 21391 | static void |
| 21392 | button_skeleton_get_property (GObject *object, |
| 21393 | guint prop_id, |
| 21394 | GValue *value, |
| 21395 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21396 | { |
| 21397 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21398 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 21399 | g_mutex_lock (&skeleton->priv->lock); |
| 21400 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 21401 | g_mutex_unlock (&skeleton->priv->lock); |
| 21402 | } |
| 21403 | |
| 21404 | static gboolean |
| 21405 | _button_emit_changed (gpointer user_data) |
| 21406 | { |
| 21407 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 21408 | GList *l; |
| 21409 | GVariantBuilder builder; |
| 21410 | GVariantBuilder invalidated_builder; |
| 21411 | guint num_changes; |
| 21412 | |
| 21413 | g_mutex_lock (&skeleton->priv->lock); |
| 21414 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 21415 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 21416 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 21417 | { |
| 21418 | ChangedProperty *cp = l->data; |
| 21419 | GVariant *variant; |
| 21420 | const GValue *cur_value; |
| 21421 | |
| 21422 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 21423 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 21424 | { |
| 21425 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 21426 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 21427 | g_variant_unref (variant); |
| 21428 | num_changes++; |
| 21429 | } |
| 21430 | } |
| 21431 | if (num_changes > 0) |
| 21432 | { |
| 21433 | GList *connections, *ll; |
| 21434 | GVariant *signal_variant; |
| 21435 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button", |
| 21436 | &builder, &invalidated_builder)); |
| 21437 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 21438 | for (ll = connections; ll != NULL; ll = ll->next) |
| 21439 | { |
| 21440 | GDBusConnection *connection = ll->data; |
| 21441 | |
| 21442 | g_dbus_connection_emit_signal (connection, |
| 21443 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 21444 | "org.freedesktop.DBus.Properties", |
| 21445 | "PropertiesChanged", |
| 21446 | signal_variant, |
| 21447 | NULL); |
| 21448 | } |
| 21449 | g_variant_unref (signal_variant); |
| 21450 | g_list_free_full (connections, g_object_unref); |
| 21451 | } |
| 21452 | else |
| 21453 | { |
| 21454 | g_variant_builder_clear (&builder); |
| 21455 | g_variant_builder_clear (&invalidated_builder); |
| 21456 | } |
| 21457 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 21458 | skeleton->priv->changed_properties = NULL; |
| 21459 | skeleton->priv->changed_properties_idle_source = NULL; |
| 21460 | g_mutex_unlock (&skeleton->priv->lock); |
| 21461 | return FALSE; |
| 21462 | } |
| 21463 | |
| 21464 | static void |
| 21465 | _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 21466 | { |
| 21467 | ChangedProperty *cp; |
| 21468 | GList *l; |
| 21469 | cp = NULL; |
| 21470 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 21471 | { |
| 21472 | ChangedProperty *i_cp = l->data; |
| 21473 | if (i_cp->info == info) |
| 21474 | { |
| 21475 | cp = i_cp; |
| 21476 | break; |
| 21477 | } |
| 21478 | } |
| 21479 | if (cp == NULL) |
| 21480 | { |
| 21481 | cp = g_new0 (ChangedProperty, 1); |
| 21482 | cp->prop_id = prop_id; |
| 21483 | cp->info = info; |
| 21484 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 21485 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 21486 | g_value_copy (orig_value, &cp->orig_value); |
| 21487 | } |
| 21488 | } |
| 21489 | |
| 21490 | static void |
| 21491 | button_skeleton_notify (GObject *object, |
| 21492 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21493 | { |
| 21494 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21495 | g_mutex_lock (&skeleton->priv->lock); |
| 21496 | if (skeleton->priv->changed_properties != NULL && |
| 21497 | skeleton->priv->changed_properties_idle_source == NULL) |
| 21498 | { |
| 21499 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 21500 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 21501 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 21502 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 21503 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 21504 | } |
| 21505 | g_mutex_unlock (&skeleton->priv->lock); |
| 21506 | } |
| 21507 | |
| 21508 | static void |
| 21509 | button_skeleton_set_property (GObject *object, |
| 21510 | guint prop_id, |
| 21511 | const GValue *value, |
| 21512 | GParamSpec *pspec) |
| 21513 | { |
| 21514 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21515 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 21516 | g_mutex_lock (&skeleton->priv->lock); |
| 21517 | g_object_freeze_notify (object); |
| 21518 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 21519 | { |
| 21520 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 21521 | _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 21522 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 21523 | g_object_notify_by_pspec (object, pspec); |
| 21524 | } |
| 21525 | g_mutex_unlock (&skeleton->priv->lock); |
| 21526 | g_object_thaw_notify (object); |
| 21527 | } |
| 21528 | |
| 21529 | static void |
| 21530 | button_skeleton_init (ButtonSkeleton *skeleton) |
| 21531 | { |
| 21532 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21533 | skeleton->priv = button_skeleton_get_instance_private (skeleton); |
| 21534 | #else |
| 21535 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate); |
| 21536 | #endif |
| 21537 | |
| 21538 | g_mutex_init (&skeleton->priv->lock); |
| 21539 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 21540 | skeleton->priv->properties = g_new0 (GValue, 1); |
| 21541 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
| 21542 | } |
| 21543 | |
| 21544 | static gboolean |
| 21545 | button_skeleton_get_state (Button *object) |
| 21546 | { |
| 21547 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 21548 | gboolean value; |
| 21549 | g_mutex_lock (&skeleton->priv->lock); |
| 21550 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 21551 | g_mutex_unlock (&skeleton->priv->lock); |
| 21552 | return value; |
| 21553 | } |
| 21554 | |
| 21555 | static void |
| 21556 | button_skeleton_class_init (ButtonSkeletonClass *klass) |
| 21557 | { |
| 21558 | GObjectClass *gobject_class; |
| 21559 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 21560 | |
| 21561 | gobject_class = G_OBJECT_CLASS (klass); |
| 21562 | gobject_class->finalize = button_skeleton_finalize; |
| 21563 | gobject_class->get_property = button_skeleton_get_property; |
| 21564 | gobject_class->set_property = button_skeleton_set_property; |
| 21565 | gobject_class->notify = button_skeleton_notify; |
| 21566 | |
| 21567 | |
| 21568 | button_override_properties (gobject_class, 1); |
| 21569 | |
| 21570 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 21571 | skeleton_class->get_info = button_skeleton_dbus_interface_get_info; |
| 21572 | skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties; |
| 21573 | skeleton_class->flush = button_skeleton_dbus_interface_flush; |
| 21574 | skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable; |
| 21575 | |
| 21576 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 21577 | g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate)); |
| 21578 | #endif |
| 21579 | } |
| 21580 | |
| 21581 | static void |
| 21582 | button_skeleton_iface_init (ButtonIface *iface) |
| 21583 | { |
| 21584 | iface->button_release = _button_on_signal_button_release; |
| 21585 | iface->button_pressed = _button_on_signal_button_pressed; |
| 21586 | iface->button_pressed_long = _button_on_signal_button_pressed_long; |
| 21587 | iface->get_state = button_skeleton_get_state; |
| 21588 | } |
| 21589 | |
| 21590 | /** |
| 21591 | * button_skeleton_new: |
| 21592 | * |
| 21593 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 21594 | * |
| 21595 | * Returns: (transfer full) (type ButtonSkeleton): The skeleton object. |
| 21596 | */ |
| 21597 | Button * |
| 21598 | button_skeleton_new (void) |
| 21599 | { |
| 21600 | return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL)); |
| 21601 | } |
| 21602 | |
| 21603 | /* ------------------------------------------------------------------------ |
| 21604 | * Code for interface org.openbmc.Led |
| 21605 | * ------------------------------------------------------------------------ |
| 21606 | */ |
| 21607 | |
| 21608 | /** |
| 21609 | * SECTION:Led |
| 21610 | * @title: Led |
| 21611 | * @short_description: Generated C code for the org.openbmc.Led D-Bus interface |
| 21612 | * |
| 21613 | * 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. |
| 21614 | */ |
| 21615 | |
| 21616 | /* ---- Introspection data for org.openbmc.Led ---- */ |
| 21617 | |
| 21618 | static const _ExtendedGDBusMethodInfo _led_method_info_set_on = |
| 21619 | { |
| 21620 | { |
| 21621 | -1, |
| 21622 | (gchar *) "setOn", |
| 21623 | NULL, |
| 21624 | NULL, |
| 21625 | NULL |
| 21626 | }, |
| 21627 | "handle-set-on", |
| 21628 | FALSE |
| 21629 | }; |
| 21630 | |
| 21631 | static const _ExtendedGDBusMethodInfo _led_method_info_set_off = |
| 21632 | { |
| 21633 | { |
| 21634 | -1, |
| 21635 | (gchar *) "setOff", |
| 21636 | NULL, |
| 21637 | NULL, |
| 21638 | NULL |
| 21639 | }, |
| 21640 | "handle-set-off", |
| 21641 | FALSE |
| 21642 | }; |
| 21643 | |
| 21644 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow = |
| 21645 | { |
| 21646 | { |
| 21647 | -1, |
| 21648 | (gchar *) "setBlinkSlow", |
| 21649 | NULL, |
| 21650 | NULL, |
| 21651 | NULL |
| 21652 | }, |
| 21653 | "handle-set-blink-slow", |
| 21654 | FALSE |
| 21655 | }; |
| 21656 | |
| 21657 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast = |
| 21658 | { |
| 21659 | { |
| 21660 | -1, |
| 21661 | (gchar *) "setBlinkFast", |
| 21662 | NULL, |
| 21663 | NULL, |
| 21664 | NULL |
| 21665 | }, |
| 21666 | "handle-set-blink-fast", |
| 21667 | FALSE |
| 21668 | }; |
| 21669 | |
| 21670 | static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] = |
| 21671 | { |
| 21672 | &_led_method_info_set_on, |
| 21673 | &_led_method_info_set_off, |
| 21674 | &_led_method_info_set_blink_slow, |
| 21675 | &_led_method_info_set_blink_fast, |
| 21676 | NULL |
| 21677 | }; |
| 21678 | |
| 21679 | static const _ExtendedGDBusPropertyInfo _led_property_info_color = |
| 21680 | { |
| 21681 | { |
| 21682 | -1, |
| 21683 | (gchar *) "color", |
| 21684 | (gchar *) "i", |
| 21685 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21686 | NULL |
| 21687 | }, |
| 21688 | "color", |
| 21689 | FALSE |
| 21690 | }; |
| 21691 | |
| 21692 | static const _ExtendedGDBusPropertyInfo _led_property_info_function = |
| 21693 | { |
| 21694 | { |
| 21695 | -1, |
| 21696 | (gchar *) "function", |
| 21697 | (gchar *) "s", |
| 21698 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21699 | NULL |
| 21700 | }, |
| 21701 | "function", |
| 21702 | FALSE |
| 21703 | }; |
| 21704 | |
| 21705 | static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] = |
| 21706 | { |
| 21707 | &_led_property_info_color, |
| 21708 | &_led_property_info_function, |
| 21709 | NULL |
| 21710 | }; |
| 21711 | |
| 21712 | static const _ExtendedGDBusInterfaceInfo _led_interface_info = |
| 21713 | { |
| 21714 | { |
| 21715 | -1, |
| 21716 | (gchar *) "org.openbmc.Led", |
| 21717 | (GDBusMethodInfo **) &_led_method_info_pointers, |
| 21718 | NULL, |
| 21719 | (GDBusPropertyInfo **) &_led_property_info_pointers, |
| 21720 | NULL |
| 21721 | }, |
| 21722 | "led", |
| 21723 | }; |
| 21724 | |
| 21725 | |
| 21726 | /** |
| 21727 | * led_interface_info: |
| 21728 | * |
| 21729 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface. |
| 21730 | * |
| 21731 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 21732 | */ |
| 21733 | GDBusInterfaceInfo * |
| 21734 | led_interface_info (void) |
| 21735 | { |
| 21736 | return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct; |
| 21737 | } |
| 21738 | |
| 21739 | /** |
| 21740 | * led_override_properties: |
| 21741 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 21742 | * @property_id_begin: The property id to assign to the first overridden property. |
| 21743 | * |
| 21744 | * Overrides all #GObject properties in the #Led interface for a concrete class. |
| 21745 | * The properties are overridden in the order they are defined. |
| 21746 | * |
| 21747 | * Returns: The last property id. |
| 21748 | */ |
| 21749 | guint |
| 21750 | led_override_properties (GObjectClass *klass, guint property_id_begin) |
| 21751 | { |
| 21752 | g_object_class_override_property (klass, property_id_begin++, "color"); |
| 21753 | g_object_class_override_property (klass, property_id_begin++, "function"); |
| 21754 | return property_id_begin - 1; |
| 21755 | } |
| 21756 | |
| 21757 | |
| 21758 | |
| 21759 | /** |
| 21760 | * Led: |
| 21761 | * |
| 21762 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 21763 | */ |
| 21764 | |
| 21765 | /** |
| 21766 | * LedIface: |
| 21767 | * @parent_iface: The parent interface. |
| 21768 | * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal. |
| 21769 | * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal. |
| 21770 | * @handle_set_off: Handler for the #Led::handle-set-off signal. |
| 21771 | * @handle_set_on: Handler for the #Led::handle-set-on signal. |
| 21772 | * @get_color: Getter for the #Led:color property. |
| 21773 | * @get_function: Getter for the #Led:function property. |
| 21774 | * |
| 21775 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 21776 | */ |
| 21777 | |
| 21778 | typedef LedIface LedInterface; |
| 21779 | G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT); |
| 21780 | |
| 21781 | static void |
| 21782 | led_default_init (LedIface *iface) |
| 21783 | { |
| 21784 | /* GObject signals for incoming D-Bus method calls: */ |
| 21785 | /** |
| 21786 | * Led::handle-set-on: |
| 21787 | * @object: A #Led. |
| 21788 | * @invocation: A #GDBusMethodInvocation. |
| 21789 | * |
| 21790 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. |
| 21791 | * |
| 21792 | * 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. |
| 21793 | * |
| 21794 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21795 | */ |
| 21796 | g_signal_new ("handle-set-on", |
| 21797 | G_TYPE_FROM_INTERFACE (iface), |
| 21798 | G_SIGNAL_RUN_LAST, |
| 21799 | G_STRUCT_OFFSET (LedIface, handle_set_on), |
| 21800 | g_signal_accumulator_true_handled, |
| 21801 | NULL, |
| 21802 | g_cclosure_marshal_generic, |
| 21803 | G_TYPE_BOOLEAN, |
| 21804 | 1, |
| 21805 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21806 | |
| 21807 | /** |
| 21808 | * Led::handle-set-off: |
| 21809 | * @object: A #Led. |
| 21810 | * @invocation: A #GDBusMethodInvocation. |
| 21811 | * |
| 21812 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. |
| 21813 | * |
| 21814 | * 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. |
| 21815 | * |
| 21816 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21817 | */ |
| 21818 | g_signal_new ("handle-set-off", |
| 21819 | G_TYPE_FROM_INTERFACE (iface), |
| 21820 | G_SIGNAL_RUN_LAST, |
| 21821 | G_STRUCT_OFFSET (LedIface, handle_set_off), |
| 21822 | g_signal_accumulator_true_handled, |
| 21823 | NULL, |
| 21824 | g_cclosure_marshal_generic, |
| 21825 | G_TYPE_BOOLEAN, |
| 21826 | 1, |
| 21827 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21828 | |
| 21829 | /** |
| 21830 | * Led::handle-set-blink-slow: |
| 21831 | * @object: A #Led. |
| 21832 | * @invocation: A #GDBusMethodInvocation. |
| 21833 | * |
| 21834 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. |
| 21835 | * |
| 21836 | * 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. |
| 21837 | * |
| 21838 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21839 | */ |
| 21840 | g_signal_new ("handle-set-blink-slow", |
| 21841 | G_TYPE_FROM_INTERFACE (iface), |
| 21842 | G_SIGNAL_RUN_LAST, |
| 21843 | G_STRUCT_OFFSET (LedIface, handle_set_blink_slow), |
| 21844 | g_signal_accumulator_true_handled, |
| 21845 | NULL, |
| 21846 | g_cclosure_marshal_generic, |
| 21847 | G_TYPE_BOOLEAN, |
| 21848 | 1, |
| 21849 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21850 | |
| 21851 | /** |
| 21852 | * Led::handle-set-blink-fast: |
| 21853 | * @object: A #Led. |
| 21854 | * @invocation: A #GDBusMethodInvocation. |
| 21855 | * |
| 21856 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. |
| 21857 | * |
| 21858 | * 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. |
| 21859 | * |
| 21860 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21861 | */ |
| 21862 | g_signal_new ("handle-set-blink-fast", |
| 21863 | G_TYPE_FROM_INTERFACE (iface), |
| 21864 | G_SIGNAL_RUN_LAST, |
| 21865 | G_STRUCT_OFFSET (LedIface, handle_set_blink_fast), |
| 21866 | g_signal_accumulator_true_handled, |
| 21867 | NULL, |
| 21868 | g_cclosure_marshal_generic, |
| 21869 | G_TYPE_BOOLEAN, |
| 21870 | 1, |
| 21871 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21872 | |
| 21873 | /* GObject properties for D-Bus properties: */ |
| 21874 | /** |
| 21875 | * Led:color: |
| 21876 | * |
| 21877 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>. |
| 21878 | * |
| 21879 | * 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. |
| 21880 | */ |
| 21881 | g_object_interface_install_property (iface, |
| 21882 | g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21883 | /** |
| 21884 | * Led:function: |
| 21885 | * |
| 21886 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>. |
| 21887 | * |
| 21888 | * 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. |
| 21889 | */ |
| 21890 | g_object_interface_install_property (iface, |
| 21891 | g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21892 | } |
| 21893 | |
| 21894 | /** |
| 21895 | * led_get_color: (skip) |
| 21896 | * @object: A #Led. |
| 21897 | * |
| 21898 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property. |
| 21899 | * |
| 21900 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21901 | * |
| 21902 | * Returns: The property value. |
| 21903 | */ |
| 21904 | gint |
| 21905 | led_get_color (Led *object) |
| 21906 | { |
| 21907 | return LED_GET_IFACE (object)->get_color (object); |
| 21908 | } |
| 21909 | |
| 21910 | /** |
| 21911 | * led_set_color: (skip) |
| 21912 | * @object: A #Led. |
| 21913 | * @value: The value to set. |
| 21914 | * |
| 21915 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value. |
| 21916 | * |
| 21917 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 21918 | */ |
| 21919 | void |
| 21920 | led_set_color (Led *object, gint value) |
| 21921 | { |
| 21922 | g_object_set (G_OBJECT (object), "color", value, NULL); |
| 21923 | } |
| 21924 | |
| 21925 | /** |
| 21926 | * led_get_function: (skip) |
| 21927 | * @object: A #Led. |
| 21928 | * |
| 21929 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 21930 | * |
| 21931 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21932 | * |
| 21933 | * <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> |
| 21934 | * |
| 21935 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 21936 | */ |
| 21937 | const gchar * |
| 21938 | led_get_function (Led *object) |
| 21939 | { |
| 21940 | return LED_GET_IFACE (object)->get_function (object); |
| 21941 | } |
| 21942 | |
| 21943 | /** |
| 21944 | * led_dup_function: (skip) |
| 21945 | * @object: A #Led. |
| 21946 | * |
| 21947 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 21948 | * |
| 21949 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21950 | * |
| 21951 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 21952 | */ |
| 21953 | gchar * |
| 21954 | led_dup_function (Led *object) |
| 21955 | { |
| 21956 | gchar *value; |
| 21957 | g_object_get (G_OBJECT (object), "function", &value, NULL); |
| 21958 | return value; |
| 21959 | } |
| 21960 | |
| 21961 | /** |
| 21962 | * led_set_function: (skip) |
| 21963 | * @object: A #Led. |
| 21964 | * @value: The value to set. |
| 21965 | * |
| 21966 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value. |
| 21967 | * |
| 21968 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 21969 | */ |
| 21970 | void |
| 21971 | led_set_function (Led *object, const gchar *value) |
| 21972 | { |
| 21973 | g_object_set (G_OBJECT (object), "function", value, NULL); |
| 21974 | } |
| 21975 | |
| 21976 | /** |
| 21977 | * led_call_set_on: |
| 21978 | * @proxy: A #LedProxy. |
| 21979 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21980 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21981 | * @user_data: User data to pass to @callback. |
| 21982 | * |
| 21983 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. |
| 21984 | * 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. |
| 21985 | * You can then call led_call_set_on_finish() to get the result of the operation. |
| 21986 | * |
| 21987 | * See led_call_set_on_sync() for the synchronous, blocking version of this method. |
| 21988 | */ |
| 21989 | void |
| 21990 | led_call_set_on ( |
| 21991 | Led *proxy, |
| 21992 | GCancellable *cancellable, |
| 21993 | GAsyncReadyCallback callback, |
| 21994 | gpointer user_data) |
| 21995 | { |
| 21996 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21997 | "setOn", |
| 21998 | g_variant_new ("()"), |
| 21999 | G_DBUS_CALL_FLAGS_NONE, |
| 22000 | -1, |
| 22001 | cancellable, |
| 22002 | callback, |
| 22003 | user_data); |
| 22004 | } |
| 22005 | |
| 22006 | /** |
| 22007 | * led_call_set_on_finish: |
| 22008 | * @proxy: A #LedProxy. |
| 22009 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on(). |
| 22010 | * @error: Return location for error or %NULL. |
| 22011 | * |
| 22012 | * Finishes an operation started with led_call_set_on(). |
| 22013 | * |
| 22014 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22015 | */ |
| 22016 | gboolean |
| 22017 | led_call_set_on_finish ( |
| 22018 | Led *proxy, |
| 22019 | GAsyncResult *res, |
| 22020 | GError **error) |
| 22021 | { |
| 22022 | GVariant *_ret; |
| 22023 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22024 | if (_ret == NULL) |
| 22025 | goto _out; |
| 22026 | g_variant_get (_ret, |
| 22027 | "()"); |
| 22028 | g_variant_unref (_ret); |
| 22029 | _out: |
| 22030 | return _ret != NULL; |
| 22031 | } |
| 22032 | |
| 22033 | /** |
| 22034 | * led_call_set_on_sync: |
| 22035 | * @proxy: A #LedProxy. |
| 22036 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22037 | * @error: Return location for error or %NULL. |
| 22038 | * |
| 22039 | * 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. |
| 22040 | * |
| 22041 | * See led_call_set_on() for the asynchronous version of this method. |
| 22042 | * |
| 22043 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22044 | */ |
| 22045 | gboolean |
| 22046 | led_call_set_on_sync ( |
| 22047 | Led *proxy, |
| 22048 | GCancellable *cancellable, |
| 22049 | GError **error) |
| 22050 | { |
| 22051 | GVariant *_ret; |
| 22052 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22053 | "setOn", |
| 22054 | g_variant_new ("()"), |
| 22055 | G_DBUS_CALL_FLAGS_NONE, |
| 22056 | -1, |
| 22057 | cancellable, |
| 22058 | error); |
| 22059 | if (_ret == NULL) |
| 22060 | goto _out; |
| 22061 | g_variant_get (_ret, |
| 22062 | "()"); |
| 22063 | g_variant_unref (_ret); |
| 22064 | _out: |
| 22065 | return _ret != NULL; |
| 22066 | } |
| 22067 | |
| 22068 | /** |
| 22069 | * led_call_set_off: |
| 22070 | * @proxy: A #LedProxy. |
| 22071 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22072 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22073 | * @user_data: User data to pass to @callback. |
| 22074 | * |
| 22075 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. |
| 22076 | * 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. |
| 22077 | * You can then call led_call_set_off_finish() to get the result of the operation. |
| 22078 | * |
| 22079 | * See led_call_set_off_sync() for the synchronous, blocking version of this method. |
| 22080 | */ |
| 22081 | void |
| 22082 | led_call_set_off ( |
| 22083 | Led *proxy, |
| 22084 | GCancellable *cancellable, |
| 22085 | GAsyncReadyCallback callback, |
| 22086 | gpointer user_data) |
| 22087 | { |
| 22088 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22089 | "setOff", |
| 22090 | g_variant_new ("()"), |
| 22091 | G_DBUS_CALL_FLAGS_NONE, |
| 22092 | -1, |
| 22093 | cancellable, |
| 22094 | callback, |
| 22095 | user_data); |
| 22096 | } |
| 22097 | |
| 22098 | /** |
| 22099 | * led_call_set_off_finish: |
| 22100 | * @proxy: A #LedProxy. |
| 22101 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off(). |
| 22102 | * @error: Return location for error or %NULL. |
| 22103 | * |
| 22104 | * Finishes an operation started with led_call_set_off(). |
| 22105 | * |
| 22106 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22107 | */ |
| 22108 | gboolean |
| 22109 | led_call_set_off_finish ( |
| 22110 | Led *proxy, |
| 22111 | GAsyncResult *res, |
| 22112 | GError **error) |
| 22113 | { |
| 22114 | GVariant *_ret; |
| 22115 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22116 | if (_ret == NULL) |
| 22117 | goto _out; |
| 22118 | g_variant_get (_ret, |
| 22119 | "()"); |
| 22120 | g_variant_unref (_ret); |
| 22121 | _out: |
| 22122 | return _ret != NULL; |
| 22123 | } |
| 22124 | |
| 22125 | /** |
| 22126 | * led_call_set_off_sync: |
| 22127 | * @proxy: A #LedProxy. |
| 22128 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22129 | * @error: Return location for error or %NULL. |
| 22130 | * |
| 22131 | * 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. |
| 22132 | * |
| 22133 | * See led_call_set_off() for the asynchronous version of this method. |
| 22134 | * |
| 22135 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22136 | */ |
| 22137 | gboolean |
| 22138 | led_call_set_off_sync ( |
| 22139 | Led *proxy, |
| 22140 | GCancellable *cancellable, |
| 22141 | GError **error) |
| 22142 | { |
| 22143 | GVariant *_ret; |
| 22144 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22145 | "setOff", |
| 22146 | g_variant_new ("()"), |
| 22147 | G_DBUS_CALL_FLAGS_NONE, |
| 22148 | -1, |
| 22149 | cancellable, |
| 22150 | error); |
| 22151 | if (_ret == NULL) |
| 22152 | goto _out; |
| 22153 | g_variant_get (_ret, |
| 22154 | "()"); |
| 22155 | g_variant_unref (_ret); |
| 22156 | _out: |
| 22157 | return _ret != NULL; |
| 22158 | } |
| 22159 | |
| 22160 | /** |
| 22161 | * led_call_set_blink_slow: |
| 22162 | * @proxy: A #LedProxy. |
| 22163 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22164 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22165 | * @user_data: User data to pass to @callback. |
| 22166 | * |
| 22167 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. |
| 22168 | * 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. |
| 22169 | * You can then call led_call_set_blink_slow_finish() to get the result of the operation. |
| 22170 | * |
| 22171 | * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method. |
| 22172 | */ |
| 22173 | void |
| 22174 | led_call_set_blink_slow ( |
| 22175 | Led *proxy, |
| 22176 | GCancellable *cancellable, |
| 22177 | GAsyncReadyCallback callback, |
| 22178 | gpointer user_data) |
| 22179 | { |
| 22180 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22181 | "setBlinkSlow", |
| 22182 | g_variant_new ("()"), |
| 22183 | G_DBUS_CALL_FLAGS_NONE, |
| 22184 | -1, |
| 22185 | cancellable, |
| 22186 | callback, |
| 22187 | user_data); |
| 22188 | } |
| 22189 | |
| 22190 | /** |
| 22191 | * led_call_set_blink_slow_finish: |
| 22192 | * @proxy: A #LedProxy. |
| 22193 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow(). |
| 22194 | * @error: Return location for error or %NULL. |
| 22195 | * |
| 22196 | * Finishes an operation started with led_call_set_blink_slow(). |
| 22197 | * |
| 22198 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22199 | */ |
| 22200 | gboolean |
| 22201 | led_call_set_blink_slow_finish ( |
| 22202 | Led *proxy, |
| 22203 | GAsyncResult *res, |
| 22204 | GError **error) |
| 22205 | { |
| 22206 | GVariant *_ret; |
| 22207 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22208 | if (_ret == NULL) |
| 22209 | goto _out; |
| 22210 | g_variant_get (_ret, |
| 22211 | "()"); |
| 22212 | g_variant_unref (_ret); |
| 22213 | _out: |
| 22214 | return _ret != NULL; |
| 22215 | } |
| 22216 | |
| 22217 | /** |
| 22218 | * led_call_set_blink_slow_sync: |
| 22219 | * @proxy: A #LedProxy. |
| 22220 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22221 | * @error: Return location for error or %NULL. |
| 22222 | * |
| 22223 | * 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. |
| 22224 | * |
| 22225 | * See led_call_set_blink_slow() for the asynchronous version of this method. |
| 22226 | * |
| 22227 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22228 | */ |
| 22229 | gboolean |
| 22230 | led_call_set_blink_slow_sync ( |
| 22231 | Led *proxy, |
| 22232 | GCancellable *cancellable, |
| 22233 | GError **error) |
| 22234 | { |
| 22235 | GVariant *_ret; |
| 22236 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22237 | "setBlinkSlow", |
| 22238 | g_variant_new ("()"), |
| 22239 | G_DBUS_CALL_FLAGS_NONE, |
| 22240 | -1, |
| 22241 | cancellable, |
| 22242 | error); |
| 22243 | if (_ret == NULL) |
| 22244 | goto _out; |
| 22245 | g_variant_get (_ret, |
| 22246 | "()"); |
| 22247 | g_variant_unref (_ret); |
| 22248 | _out: |
| 22249 | return _ret != NULL; |
| 22250 | } |
| 22251 | |
| 22252 | /** |
| 22253 | * led_call_set_blink_fast: |
| 22254 | * @proxy: A #LedProxy. |
| 22255 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22256 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22257 | * @user_data: User data to pass to @callback. |
| 22258 | * |
| 22259 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. |
| 22260 | * 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. |
| 22261 | * You can then call led_call_set_blink_fast_finish() to get the result of the operation. |
| 22262 | * |
| 22263 | * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method. |
| 22264 | */ |
| 22265 | void |
| 22266 | led_call_set_blink_fast ( |
| 22267 | Led *proxy, |
| 22268 | GCancellable *cancellable, |
| 22269 | GAsyncReadyCallback callback, |
| 22270 | gpointer user_data) |
| 22271 | { |
| 22272 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22273 | "setBlinkFast", |
| 22274 | g_variant_new ("()"), |
| 22275 | G_DBUS_CALL_FLAGS_NONE, |
| 22276 | -1, |
| 22277 | cancellable, |
| 22278 | callback, |
| 22279 | user_data); |
| 22280 | } |
| 22281 | |
| 22282 | /** |
| 22283 | * led_call_set_blink_fast_finish: |
| 22284 | * @proxy: A #LedProxy. |
| 22285 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast(). |
| 22286 | * @error: Return location for error or %NULL. |
| 22287 | * |
| 22288 | * Finishes an operation started with led_call_set_blink_fast(). |
| 22289 | * |
| 22290 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22291 | */ |
| 22292 | gboolean |
| 22293 | led_call_set_blink_fast_finish ( |
| 22294 | Led *proxy, |
| 22295 | GAsyncResult *res, |
| 22296 | GError **error) |
| 22297 | { |
| 22298 | GVariant *_ret; |
| 22299 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22300 | if (_ret == NULL) |
| 22301 | goto _out; |
| 22302 | g_variant_get (_ret, |
| 22303 | "()"); |
| 22304 | g_variant_unref (_ret); |
| 22305 | _out: |
| 22306 | return _ret != NULL; |
| 22307 | } |
| 22308 | |
| 22309 | /** |
| 22310 | * led_call_set_blink_fast_sync: |
| 22311 | * @proxy: A #LedProxy. |
| 22312 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22313 | * @error: Return location for error or %NULL. |
| 22314 | * |
| 22315 | * 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. |
| 22316 | * |
| 22317 | * See led_call_set_blink_fast() for the asynchronous version of this method. |
| 22318 | * |
| 22319 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22320 | */ |
| 22321 | gboolean |
| 22322 | led_call_set_blink_fast_sync ( |
| 22323 | Led *proxy, |
| 22324 | GCancellable *cancellable, |
| 22325 | GError **error) |
| 22326 | { |
| 22327 | GVariant *_ret; |
| 22328 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22329 | "setBlinkFast", |
| 22330 | g_variant_new ("()"), |
| 22331 | G_DBUS_CALL_FLAGS_NONE, |
| 22332 | -1, |
| 22333 | cancellable, |
| 22334 | error); |
| 22335 | if (_ret == NULL) |
| 22336 | goto _out; |
| 22337 | g_variant_get (_ret, |
| 22338 | "()"); |
| 22339 | g_variant_unref (_ret); |
| 22340 | _out: |
| 22341 | return _ret != NULL; |
| 22342 | } |
| 22343 | |
| 22344 | /** |
| 22345 | * led_complete_set_on: |
| 22346 | * @object: A #Led. |
| 22347 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22348 | * |
| 22349 | * 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. |
| 22350 | * |
| 22351 | * This method will free @invocation, you cannot use it afterwards. |
| 22352 | */ |
| 22353 | void |
| 22354 | led_complete_set_on ( |
| 22355 | Led *object, |
| 22356 | GDBusMethodInvocation *invocation) |
| 22357 | { |
| 22358 | g_dbus_method_invocation_return_value (invocation, |
| 22359 | g_variant_new ("()")); |
| 22360 | } |
| 22361 | |
| 22362 | /** |
| 22363 | * led_complete_set_off: |
| 22364 | * @object: A #Led. |
| 22365 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22366 | * |
| 22367 | * 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. |
| 22368 | * |
| 22369 | * This method will free @invocation, you cannot use it afterwards. |
| 22370 | */ |
| 22371 | void |
| 22372 | led_complete_set_off ( |
| 22373 | Led *object, |
| 22374 | GDBusMethodInvocation *invocation) |
| 22375 | { |
| 22376 | g_dbus_method_invocation_return_value (invocation, |
| 22377 | g_variant_new ("()")); |
| 22378 | } |
| 22379 | |
| 22380 | /** |
| 22381 | * led_complete_set_blink_slow: |
| 22382 | * @object: A #Led. |
| 22383 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22384 | * |
| 22385 | * 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. |
| 22386 | * |
| 22387 | * This method will free @invocation, you cannot use it afterwards. |
| 22388 | */ |
| 22389 | void |
| 22390 | led_complete_set_blink_slow ( |
| 22391 | Led *object, |
| 22392 | GDBusMethodInvocation *invocation) |
| 22393 | { |
| 22394 | g_dbus_method_invocation_return_value (invocation, |
| 22395 | g_variant_new ("()")); |
| 22396 | } |
| 22397 | |
| 22398 | /** |
| 22399 | * led_complete_set_blink_fast: |
| 22400 | * @object: A #Led. |
| 22401 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22402 | * |
| 22403 | * 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. |
| 22404 | * |
| 22405 | * This method will free @invocation, you cannot use it afterwards. |
| 22406 | */ |
| 22407 | void |
| 22408 | led_complete_set_blink_fast ( |
| 22409 | Led *object, |
| 22410 | GDBusMethodInvocation *invocation) |
| 22411 | { |
| 22412 | g_dbus_method_invocation_return_value (invocation, |
| 22413 | g_variant_new ("()")); |
| 22414 | } |
| 22415 | |
| 22416 | /* ------------------------------------------------------------------------ */ |
| 22417 | |
| 22418 | /** |
| 22419 | * LedProxy: |
| 22420 | * |
| 22421 | * The #LedProxy structure contains only private data and should only be accessed using the provided API. |
| 22422 | */ |
| 22423 | |
| 22424 | /** |
| 22425 | * LedProxyClass: |
| 22426 | * @parent_class: The parent class. |
| 22427 | * |
| 22428 | * Class structure for #LedProxy. |
| 22429 | */ |
| 22430 | |
| 22431 | struct _LedProxyPrivate |
| 22432 | { |
| 22433 | GData *qdata; |
| 22434 | }; |
| 22435 | |
| 22436 | static void led_proxy_iface_init (LedIface *iface); |
| 22437 | |
| 22438 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22439 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 22440 | G_ADD_PRIVATE (LedProxy) |
| 22441 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 22442 | |
| 22443 | #else |
| 22444 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 22445 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 22446 | |
| 22447 | #endif |
| 22448 | static void |
| 22449 | led_proxy_finalize (GObject *object) |
| 22450 | { |
| 22451 | LedProxy *proxy = LED_PROXY (object); |
| 22452 | g_datalist_clear (&proxy->priv->qdata); |
| 22453 | G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object); |
| 22454 | } |
| 22455 | |
| 22456 | static void |
| 22457 | led_proxy_get_property (GObject *object, |
| 22458 | guint prop_id, |
| 22459 | GValue *value, |
| 22460 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22461 | { |
| 22462 | const _ExtendedGDBusPropertyInfo *info; |
| 22463 | GVariant *variant; |
| 22464 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 22465 | info = _led_property_info_pointers[prop_id - 1]; |
| 22466 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 22467 | if (info->use_gvariant) |
| 22468 | { |
| 22469 | g_value_set_variant (value, variant); |
| 22470 | } |
| 22471 | else |
| 22472 | { |
| 22473 | if (variant != NULL) |
| 22474 | g_dbus_gvariant_to_gvalue (variant, value); |
| 22475 | } |
| 22476 | if (variant != NULL) |
| 22477 | g_variant_unref (variant); |
| 22478 | } |
| 22479 | |
| 22480 | static void |
| 22481 | led_proxy_set_property_cb (GDBusProxy *proxy, |
| 22482 | GAsyncResult *res, |
| 22483 | gpointer user_data) |
| 22484 | { |
| 22485 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 22486 | GError *error; |
| 22487 | GVariant *_ret; |
| 22488 | error = NULL; |
| 22489 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 22490 | if (!_ret) |
| 22491 | { |
| 22492 | g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)", |
| 22493 | info->parent_struct.name, |
| 22494 | error->message, g_quark_to_string (error->domain), error->code); |
| 22495 | g_error_free (error); |
| 22496 | } |
| 22497 | else |
| 22498 | { |
| 22499 | g_variant_unref (_ret); |
| 22500 | } |
| 22501 | } |
| 22502 | |
| 22503 | static void |
| 22504 | led_proxy_set_property (GObject *object, |
| 22505 | guint prop_id, |
| 22506 | const GValue *value, |
| 22507 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22508 | { |
| 22509 | const _ExtendedGDBusPropertyInfo *info; |
| 22510 | GVariant *variant; |
| 22511 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 22512 | info = _led_property_info_pointers[prop_id - 1]; |
| 22513 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 22514 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 22515 | "org.freedesktop.DBus.Properties.Set", |
| 22516 | g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant), |
| 22517 | G_DBUS_CALL_FLAGS_NONE, |
| 22518 | -1, |
| 22519 | NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 22520 | g_variant_unref (variant); |
| 22521 | } |
| 22522 | |
| 22523 | static void |
| 22524 | led_proxy_g_signal (GDBusProxy *proxy, |
| 22525 | const gchar *sender_name G_GNUC_UNUSED, |
| 22526 | const gchar *signal_name, |
| 22527 | GVariant *parameters) |
| 22528 | { |
| 22529 | _ExtendedGDBusSignalInfo *info; |
| 22530 | GVariantIter iter; |
| 22531 | GVariant *child; |
| 22532 | GValue *paramv; |
| 22533 | guint num_params; |
| 22534 | guint n; |
| 22535 | guint signal_id; |
| 22536 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name); |
| 22537 | if (info == NULL) |
| 22538 | return; |
| 22539 | num_params = g_variant_n_children (parameters); |
| 22540 | paramv = g_new0 (GValue, num_params + 1); |
| 22541 | g_value_init (¶mv[0], TYPE_LED); |
| 22542 | g_value_set_object (¶mv[0], proxy); |
| 22543 | g_variant_iter_init (&iter, parameters); |
| 22544 | n = 1; |
| 22545 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 22546 | { |
| 22547 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 22548 | if (arg_info->use_gvariant) |
| 22549 | { |
| 22550 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 22551 | g_value_set_variant (¶mv[n], child); |
| 22552 | n++; |
| 22553 | } |
| 22554 | else |
| 22555 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 22556 | g_variant_unref (child); |
| 22557 | } |
| 22558 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 22559 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 22560 | for (n = 0; n < num_params + 1; n++) |
| 22561 | g_value_unset (¶mv[n]); |
| 22562 | g_free (paramv); |
| 22563 | } |
| 22564 | |
| 22565 | static void |
| 22566 | led_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 22567 | GVariant *changed_properties, |
| 22568 | const gchar *const *invalidated_properties) |
| 22569 | { |
| 22570 | LedProxy *proxy = LED_PROXY (_proxy); |
| 22571 | guint n; |
| 22572 | const gchar *key; |
| 22573 | GVariantIter *iter; |
| 22574 | _ExtendedGDBusPropertyInfo *info; |
| 22575 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 22576 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 22577 | { |
| 22578 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key); |
| 22579 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 22580 | if (info != NULL) |
| 22581 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 22582 | } |
| 22583 | g_variant_iter_free (iter); |
| 22584 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 22585 | { |
| 22586 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]); |
| 22587 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 22588 | if (info != NULL) |
| 22589 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 22590 | } |
| 22591 | } |
| 22592 | |
| 22593 | static gint |
| 22594 | led_proxy_get_color (Led *object) |
| 22595 | { |
| 22596 | LedProxy *proxy = LED_PROXY (object); |
| 22597 | GVariant *variant; |
| 22598 | gint value = 0; |
| 22599 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color"); |
| 22600 | if (variant != NULL) |
| 22601 | { |
| 22602 | value = g_variant_get_int32 (variant); |
| 22603 | g_variant_unref (variant); |
| 22604 | } |
| 22605 | return value; |
| 22606 | } |
| 22607 | |
| 22608 | static const gchar * |
| 22609 | led_proxy_get_function (Led *object) |
| 22610 | { |
| 22611 | LedProxy *proxy = LED_PROXY (object); |
| 22612 | GVariant *variant; |
| 22613 | const gchar *value = NULL; |
| 22614 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function"); |
| 22615 | if (variant != NULL) |
| 22616 | { |
| 22617 | value = g_variant_get_string (variant, NULL); |
| 22618 | g_variant_unref (variant); |
| 22619 | } |
| 22620 | return value; |
| 22621 | } |
| 22622 | |
| 22623 | static void |
| 22624 | led_proxy_init (LedProxy *proxy) |
| 22625 | { |
| 22626 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22627 | proxy->priv = led_proxy_get_instance_private (proxy); |
| 22628 | #else |
| 22629 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate); |
| 22630 | #endif |
| 22631 | |
| 22632 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ()); |
| 22633 | } |
| 22634 | |
| 22635 | static void |
| 22636 | led_proxy_class_init (LedProxyClass *klass) |
| 22637 | { |
| 22638 | GObjectClass *gobject_class; |
| 22639 | GDBusProxyClass *proxy_class; |
| 22640 | |
| 22641 | gobject_class = G_OBJECT_CLASS (klass); |
| 22642 | gobject_class->finalize = led_proxy_finalize; |
| 22643 | gobject_class->get_property = led_proxy_get_property; |
| 22644 | gobject_class->set_property = led_proxy_set_property; |
| 22645 | |
| 22646 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 22647 | proxy_class->g_signal = led_proxy_g_signal; |
| 22648 | proxy_class->g_properties_changed = led_proxy_g_properties_changed; |
| 22649 | |
| 22650 | led_override_properties (gobject_class, 1); |
| 22651 | |
| 22652 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 22653 | g_type_class_add_private (klass, sizeof (LedProxyPrivate)); |
| 22654 | #endif |
| 22655 | } |
| 22656 | |
| 22657 | static void |
| 22658 | led_proxy_iface_init (LedIface *iface) |
| 22659 | { |
| 22660 | iface->get_color = led_proxy_get_color; |
| 22661 | iface->get_function = led_proxy_get_function; |
| 22662 | } |
| 22663 | |
| 22664 | /** |
| 22665 | * led_proxy_new: |
| 22666 | * @connection: A #GDBusConnection. |
| 22667 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22668 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 22669 | * @object_path: An object path. |
| 22670 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22671 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 22672 | * @user_data: User data to pass to @callback. |
| 22673 | * |
| 22674 | * 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. |
| 22675 | * |
| 22676 | * 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. |
| 22677 | * You can then call led_proxy_new_finish() to get the result of the operation. |
| 22678 | * |
| 22679 | * See led_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 22680 | */ |
| 22681 | void |
| 22682 | led_proxy_new ( |
| 22683 | GDBusConnection *connection, |
| 22684 | GDBusProxyFlags flags, |
| 22685 | const gchar *name, |
| 22686 | const gchar *object_path, |
| 22687 | GCancellable *cancellable, |
| 22688 | GAsyncReadyCallback callback, |
| 22689 | gpointer user_data) |
| 22690 | { |
| 22691 | 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); |
| 22692 | } |
| 22693 | |
| 22694 | /** |
| 22695 | * led_proxy_new_finish: |
| 22696 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new(). |
| 22697 | * @error: Return location for error or %NULL |
| 22698 | * |
| 22699 | * Finishes an operation started with led_proxy_new(). |
| 22700 | * |
| 22701 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 22702 | */ |
| 22703 | Led * |
| 22704 | led_proxy_new_finish ( |
| 22705 | GAsyncResult *res, |
| 22706 | GError **error) |
| 22707 | { |
| 22708 | GObject *ret; |
| 22709 | GObject *source_object; |
| 22710 | source_object = g_async_result_get_source_object (res); |
| 22711 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 22712 | g_object_unref (source_object); |
| 22713 | if (ret != NULL) |
| 22714 | return LED (ret); |
| 22715 | else |
| 22716 | return NULL; |
| 22717 | } |
| 22718 | |
| 22719 | /** |
| 22720 | * led_proxy_new_sync: |
| 22721 | * @connection: A #GDBusConnection. |
| 22722 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22723 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 22724 | * @object_path: An object path. |
| 22725 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22726 | * @error: Return location for error or %NULL |
| 22727 | * |
| 22728 | * 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. |
| 22729 | * |
| 22730 | * The calling thread is blocked until a reply is received. |
| 22731 | * |
| 22732 | * See led_proxy_new() for the asynchronous version of this constructor. |
| 22733 | * |
| 22734 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 22735 | */ |
| 22736 | Led * |
| 22737 | led_proxy_new_sync ( |
| 22738 | GDBusConnection *connection, |
| 22739 | GDBusProxyFlags flags, |
| 22740 | const gchar *name, |
| 22741 | const gchar *object_path, |
| 22742 | GCancellable *cancellable, |
| 22743 | GError **error) |
| 22744 | { |
| 22745 | GInitable *ret; |
| 22746 | 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); |
| 22747 | if (ret != NULL) |
| 22748 | return LED (ret); |
| 22749 | else |
| 22750 | return NULL; |
| 22751 | } |
| 22752 | |
| 22753 | |
| 22754 | /** |
| 22755 | * led_proxy_new_for_bus: |
| 22756 | * @bus_type: A #GBusType. |
| 22757 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22758 | * @name: A bus name (well-known or unique). |
| 22759 | * @object_path: An object path. |
| 22760 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22761 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 22762 | * @user_data: User data to pass to @callback. |
| 22763 | * |
| 22764 | * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 22765 | * |
| 22766 | * 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. |
| 22767 | * You can then call led_proxy_new_for_bus_finish() to get the result of the operation. |
| 22768 | * |
| 22769 | * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 22770 | */ |
| 22771 | void |
| 22772 | led_proxy_new_for_bus ( |
| 22773 | GBusType bus_type, |
| 22774 | GDBusProxyFlags flags, |
| 22775 | const gchar *name, |
| 22776 | const gchar *object_path, |
| 22777 | GCancellable *cancellable, |
| 22778 | GAsyncReadyCallback callback, |
| 22779 | gpointer user_data) |
| 22780 | { |
| 22781 | 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); |
| 22782 | } |
| 22783 | |
| 22784 | /** |
| 22785 | * led_proxy_new_for_bus_finish: |
| 22786 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus(). |
| 22787 | * @error: Return location for error or %NULL |
| 22788 | * |
| 22789 | * Finishes an operation started with led_proxy_new_for_bus(). |
| 22790 | * |
| 22791 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 22792 | */ |
| 22793 | Led * |
| 22794 | led_proxy_new_for_bus_finish ( |
| 22795 | GAsyncResult *res, |
| 22796 | GError **error) |
| 22797 | { |
| 22798 | GObject *ret; |
| 22799 | GObject *source_object; |
| 22800 | source_object = g_async_result_get_source_object (res); |
| 22801 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 22802 | g_object_unref (source_object); |
| 22803 | if (ret != NULL) |
| 22804 | return LED (ret); |
| 22805 | else |
| 22806 | return NULL; |
| 22807 | } |
| 22808 | |
| 22809 | /** |
| 22810 | * led_proxy_new_for_bus_sync: |
| 22811 | * @bus_type: A #GBusType. |
| 22812 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22813 | * @name: A bus name (well-known or unique). |
| 22814 | * @object_path: An object path. |
| 22815 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22816 | * @error: Return location for error or %NULL |
| 22817 | * |
| 22818 | * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 22819 | * |
| 22820 | * The calling thread is blocked until a reply is received. |
| 22821 | * |
| 22822 | * See led_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 22823 | * |
| 22824 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 22825 | */ |
| 22826 | Led * |
| 22827 | led_proxy_new_for_bus_sync ( |
| 22828 | GBusType bus_type, |
| 22829 | GDBusProxyFlags flags, |
| 22830 | const gchar *name, |
| 22831 | const gchar *object_path, |
| 22832 | GCancellable *cancellable, |
| 22833 | GError **error) |
| 22834 | { |
| 22835 | GInitable *ret; |
| 22836 | 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); |
| 22837 | if (ret != NULL) |
| 22838 | return LED (ret); |
| 22839 | else |
| 22840 | return NULL; |
| 22841 | } |
| 22842 | |
| 22843 | |
| 22844 | /* ------------------------------------------------------------------------ */ |
| 22845 | |
| 22846 | /** |
| 22847 | * LedSkeleton: |
| 22848 | * |
| 22849 | * The #LedSkeleton structure contains only private data and should only be accessed using the provided API. |
| 22850 | */ |
| 22851 | |
| 22852 | /** |
| 22853 | * LedSkeletonClass: |
| 22854 | * @parent_class: The parent class. |
| 22855 | * |
| 22856 | * Class structure for #LedSkeleton. |
| 22857 | */ |
| 22858 | |
| 22859 | struct _LedSkeletonPrivate |
| 22860 | { |
| 22861 | GValue *properties; |
| 22862 | GList *changed_properties; |
| 22863 | GSource *changed_properties_idle_source; |
| 22864 | GMainContext *context; |
| 22865 | GMutex lock; |
| 22866 | }; |
| 22867 | |
| 22868 | static void |
| 22869 | _led_skeleton_handle_method_call ( |
| 22870 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22871 | const gchar *sender G_GNUC_UNUSED, |
| 22872 | const gchar *object_path G_GNUC_UNUSED, |
| 22873 | const gchar *interface_name, |
| 22874 | const gchar *method_name, |
| 22875 | GVariant *parameters, |
| 22876 | GDBusMethodInvocation *invocation, |
| 22877 | gpointer user_data) |
| 22878 | { |
| 22879 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 22880 | _ExtendedGDBusMethodInfo *info; |
| 22881 | GVariantIter iter; |
| 22882 | GVariant *child; |
| 22883 | GValue *paramv; |
| 22884 | guint num_params; |
| 22885 | guint num_extra; |
| 22886 | guint n; |
| 22887 | guint signal_id; |
| 22888 | GValue return_value = G_VALUE_INIT; |
| 22889 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 22890 | g_assert (info != NULL); |
| 22891 | num_params = g_variant_n_children (parameters); |
| 22892 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 22893 | n = 0; |
| 22894 | g_value_init (¶mv[n], TYPE_LED); |
| 22895 | g_value_set_object (¶mv[n++], skeleton); |
| 22896 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 22897 | g_value_set_object (¶mv[n++], invocation); |
| 22898 | if (info->pass_fdlist) |
| 22899 | { |
| 22900 | #ifdef G_OS_UNIX |
| 22901 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 22902 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 22903 | #else |
| 22904 | g_assert_not_reached (); |
| 22905 | #endif |
| 22906 | } |
| 22907 | g_variant_iter_init (&iter, parameters); |
| 22908 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 22909 | { |
| 22910 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 22911 | if (arg_info->use_gvariant) |
| 22912 | { |
| 22913 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 22914 | g_value_set_variant (¶mv[n], child); |
| 22915 | n++; |
| 22916 | } |
| 22917 | else |
| 22918 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 22919 | g_variant_unref (child); |
| 22920 | } |
| 22921 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 22922 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 22923 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 22924 | if (!g_value_get_boolean (&return_value)) |
| 22925 | 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); |
| 22926 | g_value_unset (&return_value); |
| 22927 | for (n = 0; n < num_params + num_extra; n++) |
| 22928 | g_value_unset (¶mv[n]); |
| 22929 | g_free (paramv); |
| 22930 | } |
| 22931 | |
| 22932 | static GVariant * |
| 22933 | _led_skeleton_handle_get_property ( |
| 22934 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22935 | const gchar *sender G_GNUC_UNUSED, |
| 22936 | const gchar *object_path G_GNUC_UNUSED, |
| 22937 | const gchar *interface_name G_GNUC_UNUSED, |
| 22938 | const gchar *property_name, |
| 22939 | GError **error, |
| 22940 | gpointer user_data) |
| 22941 | { |
| 22942 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 22943 | GValue value = G_VALUE_INIT; |
| 22944 | GParamSpec *pspec; |
| 22945 | _ExtendedGDBusPropertyInfo *info; |
| 22946 | GVariant *ret; |
| 22947 | ret = NULL; |
| 22948 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 22949 | g_assert (info != NULL); |
| 22950 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22951 | if (pspec == NULL) |
| 22952 | { |
| 22953 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22954 | } |
| 22955 | else |
| 22956 | { |
| 22957 | g_value_init (&value, pspec->value_type); |
| 22958 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22959 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 22960 | g_value_unset (&value); |
| 22961 | } |
| 22962 | return ret; |
| 22963 | } |
| 22964 | |
| 22965 | static gboolean |
| 22966 | _led_skeleton_handle_set_property ( |
| 22967 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22968 | const gchar *sender G_GNUC_UNUSED, |
| 22969 | const gchar *object_path G_GNUC_UNUSED, |
| 22970 | const gchar *interface_name G_GNUC_UNUSED, |
| 22971 | const gchar *property_name, |
| 22972 | GVariant *variant, |
| 22973 | GError **error, |
| 22974 | gpointer user_data) |
| 22975 | { |
| 22976 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 22977 | GValue value = G_VALUE_INIT; |
| 22978 | GParamSpec *pspec; |
| 22979 | _ExtendedGDBusPropertyInfo *info; |
| 22980 | gboolean ret; |
| 22981 | ret = FALSE; |
| 22982 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 22983 | g_assert (info != NULL); |
| 22984 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22985 | if (pspec == NULL) |
| 22986 | { |
| 22987 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22988 | } |
| 22989 | else |
| 22990 | { |
| 22991 | if (info->use_gvariant) |
| 22992 | g_value_set_variant (&value, variant); |
| 22993 | else |
| 22994 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 22995 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22996 | g_value_unset (&value); |
| 22997 | ret = TRUE; |
| 22998 | } |
| 22999 | return ret; |
| 23000 | } |
| 23001 | |
| 23002 | static const GDBusInterfaceVTable _led_skeleton_vtable = |
| 23003 | { |
| 23004 | _led_skeleton_handle_method_call, |
| 23005 | _led_skeleton_handle_get_property, |
| 23006 | _led_skeleton_handle_set_property, |
| 23007 | {NULL} |
| 23008 | }; |
| 23009 | |
| 23010 | static GDBusInterfaceInfo * |
| 23011 | led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23012 | { |
| 23013 | return led_interface_info (); |
| 23014 | } |
| 23015 | |
| 23016 | static GDBusInterfaceVTable * |
| 23017 | led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23018 | { |
| 23019 | return (GDBusInterfaceVTable *) &_led_skeleton_vtable; |
| 23020 | } |
| 23021 | |
| 23022 | static GVariant * |
| 23023 | led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 23024 | { |
| 23025 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 23026 | |
| 23027 | GVariantBuilder builder; |
| 23028 | guint n; |
| 23029 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23030 | if (_led_interface_info.parent_struct.properties == NULL) |
| 23031 | goto out; |
| 23032 | for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++) |
| 23033 | { |
| 23034 | GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n]; |
| 23035 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 23036 | { |
| 23037 | GVariant *value; |
| 23038 | 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); |
| 23039 | if (value != NULL) |
| 23040 | { |
| 23041 | g_variant_take_ref (value); |
| 23042 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 23043 | g_variant_unref (value); |
| 23044 | } |
| 23045 | } |
| 23046 | } |
| 23047 | out: |
| 23048 | return g_variant_builder_end (&builder); |
| 23049 | } |
| 23050 | |
| 23051 | static gboolean _led_emit_changed (gpointer user_data); |
| 23052 | |
| 23053 | static void |
| 23054 | led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 23055 | { |
| 23056 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 23057 | gboolean emit_changed = FALSE; |
| 23058 | |
| 23059 | g_mutex_lock (&skeleton->priv->lock); |
| 23060 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23061 | { |
| 23062 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23063 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23064 | emit_changed = TRUE; |
| 23065 | } |
| 23066 | g_mutex_unlock (&skeleton->priv->lock); |
| 23067 | |
| 23068 | if (emit_changed) |
| 23069 | _led_emit_changed (skeleton); |
| 23070 | } |
| 23071 | |
| 23072 | static void led_skeleton_iface_init (LedIface *iface); |
| 23073 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23074 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23075 | G_ADD_PRIVATE (LedSkeleton) |
| 23076 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 23077 | |
| 23078 | #else |
| 23079 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23080 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 23081 | |
| 23082 | #endif |
| 23083 | static void |
| 23084 | led_skeleton_finalize (GObject *object) |
| 23085 | { |
| 23086 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23087 | guint n; |
| 23088 | for (n = 0; n < 2; n++) |
| 23089 | g_value_unset (&skeleton->priv->properties[n]); |
| 23090 | g_free (skeleton->priv->properties); |
| 23091 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 23092 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23093 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23094 | g_main_context_unref (skeleton->priv->context); |
| 23095 | g_mutex_clear (&skeleton->priv->lock); |
| 23096 | G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object); |
| 23097 | } |
| 23098 | |
| 23099 | static void |
| 23100 | led_skeleton_get_property (GObject *object, |
| 23101 | guint prop_id, |
| 23102 | GValue *value, |
| 23103 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23104 | { |
| 23105 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23106 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 23107 | g_mutex_lock (&skeleton->priv->lock); |
| 23108 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 23109 | g_mutex_unlock (&skeleton->priv->lock); |
| 23110 | } |
| 23111 | |
| 23112 | static gboolean |
| 23113 | _led_emit_changed (gpointer user_data) |
| 23114 | { |
| 23115 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 23116 | GList *l; |
| 23117 | GVariantBuilder builder; |
| 23118 | GVariantBuilder invalidated_builder; |
| 23119 | guint num_changes; |
| 23120 | |
| 23121 | g_mutex_lock (&skeleton->priv->lock); |
| 23122 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23123 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 23124 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 23125 | { |
| 23126 | ChangedProperty *cp = l->data; |
| 23127 | GVariant *variant; |
| 23128 | const GValue *cur_value; |
| 23129 | |
| 23130 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 23131 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 23132 | { |
| 23133 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 23134 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 23135 | g_variant_unref (variant); |
| 23136 | num_changes++; |
| 23137 | } |
| 23138 | } |
| 23139 | if (num_changes > 0) |
| 23140 | { |
| 23141 | GList *connections, *ll; |
| 23142 | GVariant *signal_variant; |
| 23143 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led", |
| 23144 | &builder, &invalidated_builder)); |
| 23145 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23146 | for (ll = connections; ll != NULL; ll = ll->next) |
| 23147 | { |
| 23148 | GDBusConnection *connection = ll->data; |
| 23149 | |
| 23150 | g_dbus_connection_emit_signal (connection, |
| 23151 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 23152 | "org.freedesktop.DBus.Properties", |
| 23153 | "PropertiesChanged", |
| 23154 | signal_variant, |
| 23155 | NULL); |
| 23156 | } |
| 23157 | g_variant_unref (signal_variant); |
| 23158 | g_list_free_full (connections, g_object_unref); |
| 23159 | } |
| 23160 | else |
| 23161 | { |
| 23162 | g_variant_builder_clear (&builder); |
| 23163 | g_variant_builder_clear (&invalidated_builder); |
| 23164 | } |
| 23165 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 23166 | skeleton->priv->changed_properties = NULL; |
| 23167 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23168 | g_mutex_unlock (&skeleton->priv->lock); |
| 23169 | return FALSE; |
| 23170 | } |
| 23171 | |
| 23172 | static void |
| 23173 | _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 23174 | { |
| 23175 | ChangedProperty *cp; |
| 23176 | GList *l; |
| 23177 | cp = NULL; |
| 23178 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 23179 | { |
| 23180 | ChangedProperty *i_cp = l->data; |
| 23181 | if (i_cp->info == info) |
| 23182 | { |
| 23183 | cp = i_cp; |
| 23184 | break; |
| 23185 | } |
| 23186 | } |
| 23187 | if (cp == NULL) |
| 23188 | { |
| 23189 | cp = g_new0 (ChangedProperty, 1); |
| 23190 | cp->prop_id = prop_id; |
| 23191 | cp->info = info; |
| 23192 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 23193 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 23194 | g_value_copy (orig_value, &cp->orig_value); |
| 23195 | } |
| 23196 | } |
| 23197 | |
| 23198 | static void |
| 23199 | led_skeleton_notify (GObject *object, |
| 23200 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23201 | { |
| 23202 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23203 | g_mutex_lock (&skeleton->priv->lock); |
| 23204 | if (skeleton->priv->changed_properties != NULL && |
| 23205 | skeleton->priv->changed_properties_idle_source == NULL) |
| 23206 | { |
| 23207 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 23208 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 23209 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 23210 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 23211 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 23212 | } |
| 23213 | g_mutex_unlock (&skeleton->priv->lock); |
| 23214 | } |
| 23215 | |
| 23216 | static void |
| 23217 | led_skeleton_set_property (GObject *object, |
| 23218 | guint prop_id, |
| 23219 | const GValue *value, |
| 23220 | GParamSpec *pspec) |
| 23221 | { |
| 23222 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23223 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 23224 | g_mutex_lock (&skeleton->priv->lock); |
| 23225 | g_object_freeze_notify (object); |
| 23226 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 23227 | { |
| 23228 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 23229 | _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 23230 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 23231 | g_object_notify_by_pspec (object, pspec); |
| 23232 | } |
| 23233 | g_mutex_unlock (&skeleton->priv->lock); |
| 23234 | g_object_thaw_notify (object); |
| 23235 | } |
| 23236 | |
| 23237 | static void |
| 23238 | led_skeleton_init (LedSkeleton *skeleton) |
| 23239 | { |
| 23240 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23241 | skeleton->priv = led_skeleton_get_instance_private (skeleton); |
| 23242 | #else |
| 23243 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate); |
| 23244 | #endif |
| 23245 | |
| 23246 | g_mutex_init (&skeleton->priv->lock); |
| 23247 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 23248 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 23249 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 23250 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 23251 | } |
| 23252 | |
| 23253 | static gint |
| 23254 | led_skeleton_get_color (Led *object) |
| 23255 | { |
| 23256 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23257 | gint value; |
| 23258 | g_mutex_lock (&skeleton->priv->lock); |
| 23259 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 23260 | g_mutex_unlock (&skeleton->priv->lock); |
| 23261 | return value; |
| 23262 | } |
| 23263 | |
| 23264 | static const gchar * |
| 23265 | led_skeleton_get_function (Led *object) |
| 23266 | { |
| 23267 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 23268 | const gchar *value; |
| 23269 | g_mutex_lock (&skeleton->priv->lock); |
| 23270 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 23271 | g_mutex_unlock (&skeleton->priv->lock); |
| 23272 | return value; |
| 23273 | } |
| 23274 | |
| 23275 | static void |
| 23276 | led_skeleton_class_init (LedSkeletonClass *klass) |
| 23277 | { |
| 23278 | GObjectClass *gobject_class; |
| 23279 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 23280 | |
| 23281 | gobject_class = G_OBJECT_CLASS (klass); |
| 23282 | gobject_class->finalize = led_skeleton_finalize; |
| 23283 | gobject_class->get_property = led_skeleton_get_property; |
| 23284 | gobject_class->set_property = led_skeleton_set_property; |
| 23285 | gobject_class->notify = led_skeleton_notify; |
| 23286 | |
| 23287 | |
| 23288 | led_override_properties (gobject_class, 1); |
| 23289 | |
| 23290 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 23291 | skeleton_class->get_info = led_skeleton_dbus_interface_get_info; |
| 23292 | skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties; |
| 23293 | skeleton_class->flush = led_skeleton_dbus_interface_flush; |
| 23294 | skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable; |
| 23295 | |
| 23296 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 23297 | g_type_class_add_private (klass, sizeof (LedSkeletonPrivate)); |
| 23298 | #endif |
| 23299 | } |
| 23300 | |
| 23301 | static void |
| 23302 | led_skeleton_iface_init (LedIface *iface) |
| 23303 | { |
| 23304 | iface->get_color = led_skeleton_get_color; |
| 23305 | iface->get_function = led_skeleton_get_function; |
| 23306 | } |
| 23307 | |
| 23308 | /** |
| 23309 | * led_skeleton_new: |
| 23310 | * |
| 23311 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 23312 | * |
| 23313 | * Returns: (transfer full) (type LedSkeleton): The skeleton object. |
| 23314 | */ |
| 23315 | Led * |
| 23316 | led_skeleton_new (void) |
| 23317 | { |
| 23318 | return LED (g_object_new (TYPE_LED_SKELETON, NULL)); |
| 23319 | } |
| 23320 | |
| 23321 | /* ------------------------------------------------------------------------ |
| 23322 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 23323 | * ------------------------------------------------------------------------ |
| 23324 | */ |
| 23325 | |
| 23326 | /** |
| 23327 | * SECTION:Object |
| 23328 | * @title: Object |
| 23329 | * @short_description: Specialized GDBusObject types |
| 23330 | * |
| 23331 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 23332 | */ |
| 23333 | |
| 23334 | /** |
| 23335 | * Object: |
| 23336 | * |
| 23337 | * The #Object type is a specialized container of interfaces. |
| 23338 | */ |
| 23339 | |
| 23340 | /** |
| 23341 | * ObjectIface: |
| 23342 | * @parent_iface: The parent interface. |
| 23343 | * |
| 23344 | * Virtual table for the #Object interface. |
| 23345 | */ |
| 23346 | |
| 23347 | typedef ObjectIface ObjectInterface; |
| 23348 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 23349 | |
| 23350 | static void |
| 23351 | object_default_init (ObjectIface *iface) |
| 23352 | { |
| 23353 | /** |
| 23354 | * Object:occ: |
| 23355 | * |
| 23356 | * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>, if any. |
| 23357 | * |
| 23358 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23359 | */ |
| 23360 | g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23361 | |
| 23362 | /** |
| 23363 | * Object:fan: |
| 23364 | * |
| 23365 | * 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. |
| 23366 | * |
| 23367 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23368 | */ |
| 23369 | g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23370 | |
| 23371 | /** |
| 23372 | * Object:sensor-value: |
| 23373 | * |
| 23374 | * 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. |
| 23375 | * |
| 23376 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23377 | */ |
| 23378 | 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)); |
| 23379 | |
| 23380 | /** |
| 23381 | * Object:sensor-threshold: |
| 23382 | * |
| 23383 | * 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. |
| 23384 | * |
| 23385 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23386 | */ |
| 23387 | 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)); |
| 23388 | |
| 23389 | /** |
| 23390 | * Object:sensor-i2c: |
| 23391 | * |
| 23392 | * 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. |
| 23393 | * |
| 23394 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23395 | */ |
| 23396 | 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)); |
| 23397 | |
| 23398 | /** |
| 23399 | * Object:sensor-match: |
| 23400 | * |
| 23401 | * 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. |
| 23402 | * |
| 23403 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23404 | */ |
| 23405 | 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)); |
| 23406 | |
| 23407 | /** |
| 23408 | * Object:process: |
| 23409 | * |
| 23410 | * 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. |
| 23411 | * |
| 23412 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23413 | */ |
| 23414 | g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23415 | |
| 23416 | /** |
| 23417 | * Object:control: |
| 23418 | * |
| 23419 | * 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. |
| 23420 | * |
| 23421 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23422 | */ |
| 23423 | g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23424 | |
| 23425 | /** |
| 23426 | * Object:control-bmc: |
| 23427 | * |
| 23428 | * 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. |
| 23429 | * |
| 23430 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23431 | */ |
| 23432 | 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)); |
| 23433 | |
| 23434 | /** |
| 23435 | * Object:control-host: |
| 23436 | * |
| 23437 | * 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. |
| 23438 | * |
| 23439 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23440 | */ |
| 23441 | 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)); |
| 23442 | |
| 23443 | /** |
| 23444 | * Object:control-power: |
| 23445 | * |
| 23446 | * 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. |
| 23447 | * |
| 23448 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23449 | */ |
| 23450 | 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)); |
| 23451 | |
| 23452 | /** |
| 23453 | * Object:watchdog: |
| 23454 | * |
| 23455 | * 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. |
| 23456 | * |
| 23457 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23458 | */ |
| 23459 | g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23460 | |
| 23461 | /** |
| 23462 | * Object:event-log: |
| 23463 | * |
| 23464 | * 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. |
| 23465 | * |
| 23466 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23467 | */ |
| 23468 | 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)); |
| 23469 | |
| 23470 | /** |
| 23471 | * Object:flash: |
| 23472 | * |
| 23473 | * 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. |
| 23474 | * |
| 23475 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23476 | */ |
| 23477 | g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23478 | |
| 23479 | /** |
| 23480 | * Object:button: |
| 23481 | * |
| 23482 | * 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. |
| 23483 | * |
| 23484 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23485 | */ |
| 23486 | g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23487 | |
| 23488 | /** |
| 23489 | * Object:led: |
| 23490 | * |
| 23491 | * 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. |
| 23492 | * |
| 23493 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 23494 | */ |
| 23495 | g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 23496 | |
| 23497 | } |
| 23498 | |
| 23499 | /** |
| 23500 | * object_get_occ: |
| 23501 | * @object: A #Object. |
| 23502 | * |
| 23503 | * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any. |
| 23504 | * |
| 23505 | * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23506 | */ |
| 23507 | Occ *object_get_occ (Object *object) |
| 23508 | { |
| 23509 | GDBusInterface *ret; |
| 23510 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ"); |
| 23511 | if (ret == NULL) |
| 23512 | return NULL; |
| 23513 | return OCC (ret); |
| 23514 | } |
| 23515 | |
| 23516 | /** |
| 23517 | * object_get_fan: |
| 23518 | * @object: A #Object. |
| 23519 | * |
| 23520 | * 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. |
| 23521 | * |
| 23522 | * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23523 | */ |
| 23524 | Fan *object_get_fan (Object *object) |
| 23525 | { |
| 23526 | GDBusInterface *ret; |
| 23527 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 23528 | if (ret == NULL) |
| 23529 | return NULL; |
| 23530 | return FAN (ret); |
| 23531 | } |
| 23532 | |
| 23533 | /** |
| 23534 | * object_get_sensor_value: |
| 23535 | * @object: A #Object. |
| 23536 | * |
| 23537 | * 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. |
| 23538 | * |
| 23539 | * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23540 | */ |
| 23541 | SensorValue *object_get_sensor_value (Object *object) |
| 23542 | { |
| 23543 | GDBusInterface *ret; |
| 23544 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 23545 | if (ret == NULL) |
| 23546 | return NULL; |
| 23547 | return SENSOR_VALUE (ret); |
| 23548 | } |
| 23549 | |
| 23550 | /** |
| 23551 | * object_get_sensor_threshold: |
| 23552 | * @object: A #Object. |
| 23553 | * |
| 23554 | * 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. |
| 23555 | * |
| 23556 | * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23557 | */ |
| 23558 | SensorThreshold *object_get_sensor_threshold (Object *object) |
| 23559 | { |
| 23560 | GDBusInterface *ret; |
| 23561 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 23562 | if (ret == NULL) |
| 23563 | return NULL; |
| 23564 | return SENSOR_THRESHOLD (ret); |
| 23565 | } |
| 23566 | |
| 23567 | /** |
| 23568 | * object_get_sensor_i2c: |
| 23569 | * @object: A #Object. |
| 23570 | * |
| 23571 | * 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. |
| 23572 | * |
| 23573 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23574 | */ |
| 23575 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 23576 | { |
| 23577 | GDBusInterface *ret; |
| 23578 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 23579 | if (ret == NULL) |
| 23580 | return NULL; |
| 23581 | return SENSOR_I2C (ret); |
| 23582 | } |
| 23583 | |
| 23584 | /** |
| 23585 | * object_get_sensor_match: |
| 23586 | * @object: A #Object. |
| 23587 | * |
| 23588 | * 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. |
| 23589 | * |
| 23590 | * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23591 | */ |
| 23592 | SensorMatch *object_get_sensor_match (Object *object) |
| 23593 | { |
| 23594 | GDBusInterface *ret; |
| 23595 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 23596 | if (ret == NULL) |
| 23597 | return NULL; |
| 23598 | return SENSOR_MATCH (ret); |
| 23599 | } |
| 23600 | |
| 23601 | /** |
| 23602 | * object_get_process: |
| 23603 | * @object: A #Object. |
| 23604 | * |
| 23605 | * 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. |
| 23606 | * |
| 23607 | * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23608 | */ |
| 23609 | Process *object_get_process (Object *object) |
| 23610 | { |
| 23611 | GDBusInterface *ret; |
| 23612 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 23613 | if (ret == NULL) |
| 23614 | return NULL; |
| 23615 | return PROCESS (ret); |
| 23616 | } |
| 23617 | |
| 23618 | /** |
| 23619 | * object_get_control: |
| 23620 | * @object: A #Object. |
| 23621 | * |
| 23622 | * 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. |
| 23623 | * |
| 23624 | * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23625 | */ |
| 23626 | Control *object_get_control (Object *object) |
| 23627 | { |
| 23628 | GDBusInterface *ret; |
| 23629 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 23630 | if (ret == NULL) |
| 23631 | return NULL; |
| 23632 | return CONTROL (ret); |
| 23633 | } |
| 23634 | |
| 23635 | /** |
| 23636 | * object_get_control_bmc: |
| 23637 | * @object: A #Object. |
| 23638 | * |
| 23639 | * 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. |
| 23640 | * |
| 23641 | * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23642 | */ |
| 23643 | ControlBmc *object_get_control_bmc (Object *object) |
| 23644 | { |
| 23645 | GDBusInterface *ret; |
| 23646 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 23647 | if (ret == NULL) |
| 23648 | return NULL; |
| 23649 | return CONTROL_BMC (ret); |
| 23650 | } |
| 23651 | |
| 23652 | /** |
| 23653 | * object_get_control_host: |
| 23654 | * @object: A #Object. |
| 23655 | * |
| 23656 | * 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. |
| 23657 | * |
| 23658 | * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23659 | */ |
| 23660 | ControlHost *object_get_control_host (Object *object) |
| 23661 | { |
| 23662 | GDBusInterface *ret; |
| 23663 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 23664 | if (ret == NULL) |
| 23665 | return NULL; |
| 23666 | return CONTROL_HOST (ret); |
| 23667 | } |
| 23668 | |
| 23669 | /** |
| 23670 | * object_get_control_power: |
| 23671 | * @object: A #Object. |
| 23672 | * |
| 23673 | * 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. |
| 23674 | * |
| 23675 | * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23676 | */ |
| 23677 | ControlPower *object_get_control_power (Object *object) |
| 23678 | { |
| 23679 | GDBusInterface *ret; |
| 23680 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 23681 | if (ret == NULL) |
| 23682 | return NULL; |
| 23683 | return CONTROL_POWER (ret); |
| 23684 | } |
| 23685 | |
| 23686 | /** |
| 23687 | * object_get_watchdog: |
| 23688 | * @object: A #Object. |
| 23689 | * |
| 23690 | * 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. |
| 23691 | * |
| 23692 | * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23693 | */ |
| 23694 | Watchdog *object_get_watchdog (Object *object) |
| 23695 | { |
| 23696 | GDBusInterface *ret; |
| 23697 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 23698 | if (ret == NULL) |
| 23699 | return NULL; |
| 23700 | return WATCHDOG (ret); |
| 23701 | } |
| 23702 | |
| 23703 | /** |
| 23704 | * object_get_event_log: |
| 23705 | * @object: A #Object. |
| 23706 | * |
| 23707 | * 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. |
| 23708 | * |
| 23709 | * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23710 | */ |
| 23711 | EventLog *object_get_event_log (Object *object) |
| 23712 | { |
| 23713 | GDBusInterface *ret; |
| 23714 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 23715 | if (ret == NULL) |
| 23716 | return NULL; |
| 23717 | return EVENT_LOG (ret); |
| 23718 | } |
| 23719 | |
| 23720 | /** |
| 23721 | * object_get_flash: |
| 23722 | * @object: A #Object. |
| 23723 | * |
| 23724 | * 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. |
| 23725 | * |
| 23726 | * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23727 | */ |
| 23728 | Flash *object_get_flash (Object *object) |
| 23729 | { |
| 23730 | GDBusInterface *ret; |
| 23731 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 23732 | if (ret == NULL) |
| 23733 | return NULL; |
| 23734 | return FLASH (ret); |
| 23735 | } |
| 23736 | |
| 23737 | /** |
| 23738 | * object_get_button: |
| 23739 | * @object: A #Object. |
| 23740 | * |
| 23741 | * 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. |
| 23742 | * |
| 23743 | * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23744 | */ |
| 23745 | Button *object_get_button (Object *object) |
| 23746 | { |
| 23747 | GDBusInterface *ret; |
| 23748 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 23749 | if (ret == NULL) |
| 23750 | return NULL; |
| 23751 | return BUTTON (ret); |
| 23752 | } |
| 23753 | |
| 23754 | /** |
| 23755 | * object_get_led: |
| 23756 | * @object: A #Object. |
| 23757 | * |
| 23758 | * 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. |
| 23759 | * |
| 23760 | * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 23761 | */ |
| 23762 | Led *object_get_led (Object *object) |
| 23763 | { |
| 23764 | GDBusInterface *ret; |
| 23765 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 23766 | if (ret == NULL) |
| 23767 | return NULL; |
| 23768 | return LED (ret); |
| 23769 | } |
| 23770 | |
| 23771 | |
| 23772 | /** |
| 23773 | * object_peek_occ: (skip) |
| 23774 | * @object: A #Object. |
| 23775 | * |
| 23776 | * Like object_get_occ() but doesn't increase the reference count on the returned object. |
| 23777 | * |
| 23778 | * <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> |
| 23779 | * |
| 23780 | * Returns: (transfer none): A #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 23781 | */ |
| 23782 | Occ *object_peek_occ (Object *object) |
| 23783 | { |
| 23784 | GDBusInterface *ret; |
| 23785 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ"); |
| 23786 | if (ret == NULL) |
| 23787 | return NULL; |
| 23788 | g_object_unref (ret); |
| 23789 | return OCC (ret); |
| 23790 | } |
| 23791 | |
| 23792 | /** |
| 23793 | * object_peek_fan: (skip) |
| 23794 | * @object: A #Object. |
| 23795 | * |
| 23796 | * Like object_get_fan() but doesn't increase the reference count on the returned object. |
| 23797 | * |
| 23798 | * <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> |
| 23799 | * |
| 23800 | * 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. |
| 23801 | */ |
| 23802 | Fan *object_peek_fan (Object *object) |
| 23803 | { |
| 23804 | GDBusInterface *ret; |
| 23805 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 23806 | if (ret == NULL) |
| 23807 | return NULL; |
| 23808 | g_object_unref (ret); |
| 23809 | return FAN (ret); |
| 23810 | } |
| 23811 | |
| 23812 | /** |
| 23813 | * object_peek_sensor_value: (skip) |
| 23814 | * @object: A #Object. |
| 23815 | * |
| 23816 | * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. |
| 23817 | * |
| 23818 | * <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> |
| 23819 | * |
| 23820 | * 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. |
| 23821 | */ |
| 23822 | SensorValue *object_peek_sensor_value (Object *object) |
| 23823 | { |
| 23824 | GDBusInterface *ret; |
| 23825 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 23826 | if (ret == NULL) |
| 23827 | return NULL; |
| 23828 | g_object_unref (ret); |
| 23829 | return SENSOR_VALUE (ret); |
| 23830 | } |
| 23831 | |
| 23832 | /** |
| 23833 | * object_peek_sensor_threshold: (skip) |
| 23834 | * @object: A #Object. |
| 23835 | * |
| 23836 | * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. |
| 23837 | * |
| 23838 | * <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> |
| 23839 | * |
| 23840 | * 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. |
| 23841 | */ |
| 23842 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
| 23843 | { |
| 23844 | GDBusInterface *ret; |
| 23845 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 23846 | if (ret == NULL) |
| 23847 | return NULL; |
| 23848 | g_object_unref (ret); |
| 23849 | return SENSOR_THRESHOLD (ret); |
| 23850 | } |
| 23851 | |
| 23852 | /** |
| 23853 | * object_peek_sensor_i2c: (skip) |
| 23854 | * @object: A #Object. |
| 23855 | * |
| 23856 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 23857 | * |
| 23858 | * <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> |
| 23859 | * |
| 23860 | * 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. |
| 23861 | */ |
| 23862 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 23863 | { |
| 23864 | GDBusInterface *ret; |
| 23865 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 23866 | if (ret == NULL) |
| 23867 | return NULL; |
| 23868 | g_object_unref (ret); |
| 23869 | return SENSOR_I2C (ret); |
| 23870 | } |
| 23871 | |
| 23872 | /** |
| 23873 | * object_peek_sensor_match: (skip) |
| 23874 | * @object: A #Object. |
| 23875 | * |
| 23876 | * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. |
| 23877 | * |
| 23878 | * <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> |
| 23879 | * |
| 23880 | * 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. |
| 23881 | */ |
| 23882 | SensorMatch *object_peek_sensor_match (Object *object) |
| 23883 | { |
| 23884 | GDBusInterface *ret; |
| 23885 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 23886 | if (ret == NULL) |
| 23887 | return NULL; |
| 23888 | g_object_unref (ret); |
| 23889 | return SENSOR_MATCH (ret); |
| 23890 | } |
| 23891 | |
| 23892 | /** |
| 23893 | * object_peek_process: (skip) |
| 23894 | * @object: A #Object. |
| 23895 | * |
| 23896 | * Like object_get_process() but doesn't increase the reference count on the returned object. |
| 23897 | * |
| 23898 | * <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> |
| 23899 | * |
| 23900 | * 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. |
| 23901 | */ |
| 23902 | Process *object_peek_process (Object *object) |
| 23903 | { |
| 23904 | GDBusInterface *ret; |
| 23905 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 23906 | if (ret == NULL) |
| 23907 | return NULL; |
| 23908 | g_object_unref (ret); |
| 23909 | return PROCESS (ret); |
| 23910 | } |
| 23911 | |
| 23912 | /** |
| 23913 | * object_peek_control: (skip) |
| 23914 | * @object: A #Object. |
| 23915 | * |
| 23916 | * Like object_get_control() but doesn't increase the reference count on the returned object. |
| 23917 | * |
| 23918 | * <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> |
| 23919 | * |
| 23920 | * 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. |
| 23921 | */ |
| 23922 | Control *object_peek_control (Object *object) |
| 23923 | { |
| 23924 | GDBusInterface *ret; |
| 23925 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 23926 | if (ret == NULL) |
| 23927 | return NULL; |
| 23928 | g_object_unref (ret); |
| 23929 | return CONTROL (ret); |
| 23930 | } |
| 23931 | |
| 23932 | /** |
| 23933 | * object_peek_control_bmc: (skip) |
| 23934 | * @object: A #Object. |
| 23935 | * |
| 23936 | * Like object_get_control_bmc() but doesn't increase the reference count on the returned object. |
| 23937 | * |
| 23938 | * <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> |
| 23939 | * |
| 23940 | * 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. |
| 23941 | */ |
| 23942 | ControlBmc *object_peek_control_bmc (Object *object) |
| 23943 | { |
| 23944 | GDBusInterface *ret; |
| 23945 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 23946 | if (ret == NULL) |
| 23947 | return NULL; |
| 23948 | g_object_unref (ret); |
| 23949 | return CONTROL_BMC (ret); |
| 23950 | } |
| 23951 | |
| 23952 | /** |
| 23953 | * object_peek_control_host: (skip) |
| 23954 | * @object: A #Object. |
| 23955 | * |
| 23956 | * Like object_get_control_host() but doesn't increase the reference count on the returned object. |
| 23957 | * |
| 23958 | * <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> |
| 23959 | * |
| 23960 | * 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. |
| 23961 | */ |
| 23962 | ControlHost *object_peek_control_host (Object *object) |
| 23963 | { |
| 23964 | GDBusInterface *ret; |
| 23965 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 23966 | if (ret == NULL) |
| 23967 | return NULL; |
| 23968 | g_object_unref (ret); |
| 23969 | return CONTROL_HOST (ret); |
| 23970 | } |
| 23971 | |
| 23972 | /** |
| 23973 | * object_peek_control_power: (skip) |
| 23974 | * @object: A #Object. |
| 23975 | * |
| 23976 | * Like object_get_control_power() but doesn't increase the reference count on the returned object. |
| 23977 | * |
| 23978 | * <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> |
| 23979 | * |
| 23980 | * 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. |
| 23981 | */ |
| 23982 | ControlPower *object_peek_control_power (Object *object) |
| 23983 | { |
| 23984 | GDBusInterface *ret; |
| 23985 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 23986 | if (ret == NULL) |
| 23987 | return NULL; |
| 23988 | g_object_unref (ret); |
| 23989 | return CONTROL_POWER (ret); |
| 23990 | } |
| 23991 | |
| 23992 | /** |
| 23993 | * object_peek_watchdog: (skip) |
| 23994 | * @object: A #Object. |
| 23995 | * |
| 23996 | * Like object_get_watchdog() but doesn't increase the reference count on the returned object. |
| 23997 | * |
| 23998 | * <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> |
| 23999 | * |
| 24000 | * 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. |
| 24001 | */ |
| 24002 | Watchdog *object_peek_watchdog (Object *object) |
| 24003 | { |
| 24004 | GDBusInterface *ret; |
| 24005 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 24006 | if (ret == NULL) |
| 24007 | return NULL; |
| 24008 | g_object_unref (ret); |
| 24009 | return WATCHDOG (ret); |
| 24010 | } |
| 24011 | |
| 24012 | /** |
| 24013 | * object_peek_event_log: (skip) |
| 24014 | * @object: A #Object. |
| 24015 | * |
| 24016 | * Like object_get_event_log() but doesn't increase the reference count on the returned object. |
| 24017 | * |
| 24018 | * <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> |
| 24019 | * |
| 24020 | * 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. |
| 24021 | */ |
| 24022 | EventLog *object_peek_event_log (Object *object) |
| 24023 | { |
| 24024 | GDBusInterface *ret; |
| 24025 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 24026 | if (ret == NULL) |
| 24027 | return NULL; |
| 24028 | g_object_unref (ret); |
| 24029 | return EVENT_LOG (ret); |
| 24030 | } |
| 24031 | |
| 24032 | /** |
| 24033 | * object_peek_flash: (skip) |
| 24034 | * @object: A #Object. |
| 24035 | * |
| 24036 | * Like object_get_flash() but doesn't increase the reference count on the returned object. |
| 24037 | * |
| 24038 | * <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> |
| 24039 | * |
| 24040 | * 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. |
| 24041 | */ |
| 24042 | Flash *object_peek_flash (Object *object) |
| 24043 | { |
| 24044 | GDBusInterface *ret; |
| 24045 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 24046 | if (ret == NULL) |
| 24047 | return NULL; |
| 24048 | g_object_unref (ret); |
| 24049 | return FLASH (ret); |
| 24050 | } |
| 24051 | |
| 24052 | /** |
| 24053 | * object_peek_button: (skip) |
| 24054 | * @object: A #Object. |
| 24055 | * |
| 24056 | * Like object_get_button() but doesn't increase the reference count on the returned object. |
| 24057 | * |
| 24058 | * <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> |
| 24059 | * |
| 24060 | * 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. |
| 24061 | */ |
| 24062 | Button *object_peek_button (Object *object) |
| 24063 | { |
| 24064 | GDBusInterface *ret; |
| 24065 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 24066 | if (ret == NULL) |
| 24067 | return NULL; |
| 24068 | g_object_unref (ret); |
| 24069 | return BUTTON (ret); |
| 24070 | } |
| 24071 | |
| 24072 | /** |
| 24073 | * object_peek_led: (skip) |
| 24074 | * @object: A #Object. |
| 24075 | * |
| 24076 | * Like object_get_led() but doesn't increase the reference count on the returned object. |
| 24077 | * |
| 24078 | * <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> |
| 24079 | * |
| 24080 | * 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. |
| 24081 | */ |
| 24082 | Led *object_peek_led (Object *object) |
| 24083 | { |
| 24084 | GDBusInterface *ret; |
| 24085 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 24086 | if (ret == NULL) |
| 24087 | return NULL; |
| 24088 | g_object_unref (ret); |
| 24089 | return LED (ret); |
| 24090 | } |
| 24091 | |
| 24092 | |
| 24093 | static void |
| 24094 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 24095 | { |
| 24096 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 24097 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 24098 | * anything about, for example old generated code in this process talking to |
| 24099 | * newer generated code in the other process. */ |
| 24100 | if (info != NULL) |
| 24101 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 24102 | } |
| 24103 | |
| 24104 | /** |
| 24105 | * ObjectProxy: |
| 24106 | * |
| 24107 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 24108 | */ |
| 24109 | |
| 24110 | /** |
| 24111 | * ObjectProxyClass: |
| 24112 | * @parent_class: The parent class. |
| 24113 | * |
| 24114 | * Class structure for #ObjectProxy. |
| 24115 | */ |
| 24116 | |
| 24117 | static void |
| 24118 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 24119 | { |
| 24120 | } |
| 24121 | |
| 24122 | static void |
| 24123 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 24124 | { |
| 24125 | iface->interface_added = object_notify; |
| 24126 | iface->interface_removed = object_notify; |
| 24127 | } |
| 24128 | |
| 24129 | |
| 24130 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 24131 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 24132 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 24133 | |
| 24134 | static void |
| 24135 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 24136 | { |
| 24137 | } |
| 24138 | |
| 24139 | static void |
| 24140 | object_proxy_set_property (GObject *gobject, |
| 24141 | guint prop_id, |
| 24142 | const GValue *value G_GNUC_UNUSED, |
| 24143 | GParamSpec *pspec) |
| 24144 | { |
| 24145 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 24146 | } |
| 24147 | |
| 24148 | static void |
| 24149 | object_proxy_get_property (GObject *gobject, |
| 24150 | guint prop_id, |
| 24151 | GValue *value, |
| 24152 | GParamSpec *pspec) |
| 24153 | { |
| 24154 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 24155 | GDBusInterface *interface; |
| 24156 | |
| 24157 | switch (prop_id) |
| 24158 | { |
| 24159 | case 1: |
| 24160 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ"); |
| 24161 | g_value_take_object (value, interface); |
| 24162 | break; |
| 24163 | |
| 24164 | case 2: |
| 24165 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 24166 | g_value_take_object (value, interface); |
| 24167 | break; |
| 24168 | |
| 24169 | case 3: |
| 24170 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 24171 | g_value_take_object (value, interface); |
| 24172 | break; |
| 24173 | |
| 24174 | case 4: |
| 24175 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 24176 | g_value_take_object (value, interface); |
| 24177 | break; |
| 24178 | |
| 24179 | case 5: |
| 24180 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 24181 | g_value_take_object (value, interface); |
| 24182 | break; |
| 24183 | |
| 24184 | case 6: |
| 24185 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 24186 | g_value_take_object (value, interface); |
| 24187 | break; |
| 24188 | |
| 24189 | case 7: |
| 24190 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 24191 | g_value_take_object (value, interface); |
| 24192 | break; |
| 24193 | |
| 24194 | case 8: |
| 24195 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 24196 | g_value_take_object (value, interface); |
| 24197 | break; |
| 24198 | |
| 24199 | case 9: |
| 24200 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 24201 | g_value_take_object (value, interface); |
| 24202 | break; |
| 24203 | |
| 24204 | case 10: |
| 24205 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 24206 | g_value_take_object (value, interface); |
| 24207 | break; |
| 24208 | |
| 24209 | case 11: |
| 24210 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 24211 | g_value_take_object (value, interface); |
| 24212 | break; |
| 24213 | |
| 24214 | case 12: |
| 24215 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 24216 | g_value_take_object (value, interface); |
| 24217 | break; |
| 24218 | |
| 24219 | case 13: |
| 24220 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 24221 | g_value_take_object (value, interface); |
| 24222 | break; |
| 24223 | |
| 24224 | case 14: |
| 24225 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 24226 | g_value_take_object (value, interface); |
| 24227 | break; |
| 24228 | |
| 24229 | case 15: |
| 24230 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 24231 | g_value_take_object (value, interface); |
| 24232 | break; |
| 24233 | |
| 24234 | case 16: |
| 24235 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 24236 | g_value_take_object (value, interface); |
| 24237 | break; |
| 24238 | |
| 24239 | default: |
| 24240 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 24241 | break; |
| 24242 | } |
| 24243 | } |
| 24244 | |
| 24245 | static void |
| 24246 | object_proxy_class_init (ObjectProxyClass *klass) |
| 24247 | { |
| 24248 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 24249 | |
| 24250 | gobject_class->set_property = object_proxy_set_property; |
| 24251 | gobject_class->get_property = object_proxy_get_property; |
| 24252 | |
| 24253 | g_object_class_override_property (gobject_class, 1, "occ"); |
| 24254 | g_object_class_override_property (gobject_class, 2, "fan"); |
| 24255 | g_object_class_override_property (gobject_class, 3, "sensor-value"); |
| 24256 | g_object_class_override_property (gobject_class, 4, "sensor-threshold"); |
| 24257 | g_object_class_override_property (gobject_class, 5, "sensor-i2c"); |
| 24258 | g_object_class_override_property (gobject_class, 6, "sensor-match"); |
| 24259 | g_object_class_override_property (gobject_class, 7, "process"); |
| 24260 | g_object_class_override_property (gobject_class, 8, "control"); |
| 24261 | g_object_class_override_property (gobject_class, 9, "control-bmc"); |
| 24262 | g_object_class_override_property (gobject_class, 10, "control-host"); |
| 24263 | g_object_class_override_property (gobject_class, 11, "control-power"); |
| 24264 | g_object_class_override_property (gobject_class, 12, "watchdog"); |
| 24265 | g_object_class_override_property (gobject_class, 13, "event-log"); |
| 24266 | g_object_class_override_property (gobject_class, 14, "flash"); |
| 24267 | g_object_class_override_property (gobject_class, 15, "button"); |
| 24268 | g_object_class_override_property (gobject_class, 16, "led"); |
| 24269 | } |
| 24270 | |
| 24271 | /** |
| 24272 | * object_proxy_new: |
| 24273 | * @connection: A #GDBusConnection. |
| 24274 | * @object_path: An object path. |
| 24275 | * |
| 24276 | * Creates a new proxy object. |
| 24277 | * |
| 24278 | * Returns: (transfer full): The proxy object. |
| 24279 | */ |
| 24280 | ObjectProxy * |
| 24281 | object_proxy_new (GDBusConnection *connection, |
| 24282 | const gchar *object_path) |
| 24283 | { |
| 24284 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 24285 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 24286 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 24287 | } |
| 24288 | |
| 24289 | /** |
| 24290 | * ObjectSkeleton: |
| 24291 | * |
| 24292 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 24293 | */ |
| 24294 | |
| 24295 | /** |
| 24296 | * ObjectSkeletonClass: |
| 24297 | * @parent_class: The parent class. |
| 24298 | * |
| 24299 | * Class structure for #ObjectSkeleton. |
| 24300 | */ |
| 24301 | |
| 24302 | static void |
| 24303 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 24304 | { |
| 24305 | } |
| 24306 | |
| 24307 | |
| 24308 | static void |
| 24309 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 24310 | { |
| 24311 | iface->interface_added = object_notify; |
| 24312 | iface->interface_removed = object_notify; |
| 24313 | } |
| 24314 | |
| 24315 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 24316 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 24317 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 24318 | |
| 24319 | static void |
| 24320 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 24321 | { |
| 24322 | } |
| 24323 | |
| 24324 | static void |
| 24325 | object_skeleton_set_property (GObject *gobject, |
| 24326 | guint prop_id, |
| 24327 | const GValue *value, |
| 24328 | GParamSpec *pspec) |
| 24329 | { |
| 24330 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 24331 | GDBusInterfaceSkeleton *interface; |
| 24332 | |
| 24333 | switch (prop_id) |
| 24334 | { |
| 24335 | case 1: |
| 24336 | interface = g_value_get_object (value); |
| 24337 | if (interface != NULL) |
| 24338 | { |
| 24339 | g_warn_if_fail (IS_OCC (interface)); |
| 24340 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24341 | } |
| 24342 | else |
| 24343 | { |
| 24344 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ"); |
| 24345 | } |
| 24346 | break; |
| 24347 | |
| 24348 | case 2: |
| 24349 | interface = g_value_get_object (value); |
| 24350 | if (interface != NULL) |
| 24351 | { |
| 24352 | g_warn_if_fail (IS_FAN (interface)); |
| 24353 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24354 | } |
| 24355 | else |
| 24356 | { |
| 24357 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan"); |
| 24358 | } |
| 24359 | break; |
| 24360 | |
| 24361 | case 3: |
| 24362 | interface = g_value_get_object (value); |
| 24363 | if (interface != NULL) |
| 24364 | { |
| 24365 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
| 24366 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24367 | } |
| 24368 | else |
| 24369 | { |
| 24370 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); |
| 24371 | } |
| 24372 | break; |
| 24373 | |
| 24374 | case 4: |
| 24375 | interface = g_value_get_object (value); |
| 24376 | if (interface != NULL) |
| 24377 | { |
| 24378 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
| 24379 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24380 | } |
| 24381 | else |
| 24382 | { |
| 24383 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); |
| 24384 | } |
| 24385 | break; |
| 24386 | |
| 24387 | case 5: |
| 24388 | interface = g_value_get_object (value); |
| 24389 | if (interface != NULL) |
| 24390 | { |
| 24391 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
| 24392 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24393 | } |
| 24394 | else |
| 24395 | { |
| 24396 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); |
| 24397 | } |
| 24398 | break; |
| 24399 | |
| 24400 | case 6: |
| 24401 | interface = g_value_get_object (value); |
| 24402 | if (interface != NULL) |
| 24403 | { |
| 24404 | g_warn_if_fail (IS_SENSOR_MATCH (interface)); |
| 24405 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24406 | } |
| 24407 | else |
| 24408 | { |
| 24409 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); |
| 24410 | } |
| 24411 | break; |
| 24412 | |
| 24413 | case 7: |
| 24414 | interface = g_value_get_object (value); |
| 24415 | if (interface != NULL) |
| 24416 | { |
| 24417 | g_warn_if_fail (IS_PROCESS (interface)); |
| 24418 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24419 | } |
| 24420 | else |
| 24421 | { |
| 24422 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process"); |
| 24423 | } |
| 24424 | break; |
| 24425 | |
| 24426 | case 8: |
| 24427 | interface = g_value_get_object (value); |
| 24428 | if (interface != NULL) |
| 24429 | { |
| 24430 | g_warn_if_fail (IS_CONTROL (interface)); |
| 24431 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24432 | } |
| 24433 | else |
| 24434 | { |
| 24435 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control"); |
| 24436 | } |
| 24437 | break; |
| 24438 | |
| 24439 | case 9: |
| 24440 | interface = g_value_get_object (value); |
| 24441 | if (interface != NULL) |
| 24442 | { |
| 24443 | g_warn_if_fail (IS_CONTROL_BMC (interface)); |
| 24444 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24445 | } |
| 24446 | else |
| 24447 | { |
| 24448 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc"); |
| 24449 | } |
| 24450 | break; |
| 24451 | |
| 24452 | case 10: |
| 24453 | interface = g_value_get_object (value); |
| 24454 | if (interface != NULL) |
| 24455 | { |
| 24456 | g_warn_if_fail (IS_CONTROL_HOST (interface)); |
| 24457 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24458 | } |
| 24459 | else |
| 24460 | { |
| 24461 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host"); |
| 24462 | } |
| 24463 | break; |
| 24464 | |
| 24465 | case 11: |
| 24466 | interface = g_value_get_object (value); |
| 24467 | if (interface != NULL) |
| 24468 | { |
| 24469 | g_warn_if_fail (IS_CONTROL_POWER (interface)); |
| 24470 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24471 | } |
| 24472 | else |
| 24473 | { |
| 24474 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power"); |
| 24475 | } |
| 24476 | break; |
| 24477 | |
| 24478 | case 12: |
| 24479 | interface = g_value_get_object (value); |
| 24480 | if (interface != NULL) |
| 24481 | { |
| 24482 | g_warn_if_fail (IS_WATCHDOG (interface)); |
| 24483 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24484 | } |
| 24485 | else |
| 24486 | { |
| 24487 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); |
| 24488 | } |
| 24489 | break; |
| 24490 | |
| 24491 | case 13: |
| 24492 | interface = g_value_get_object (value); |
| 24493 | if (interface != NULL) |
| 24494 | { |
| 24495 | g_warn_if_fail (IS_EVENT_LOG (interface)); |
| 24496 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24497 | } |
| 24498 | else |
| 24499 | { |
| 24500 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog"); |
| 24501 | } |
| 24502 | break; |
| 24503 | |
| 24504 | case 14: |
| 24505 | interface = g_value_get_object (value); |
| 24506 | if (interface != NULL) |
| 24507 | { |
| 24508 | g_warn_if_fail (IS_FLASH (interface)); |
| 24509 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24510 | } |
| 24511 | else |
| 24512 | { |
| 24513 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash"); |
| 24514 | } |
| 24515 | break; |
| 24516 | |
| 24517 | case 15: |
| 24518 | interface = g_value_get_object (value); |
| 24519 | if (interface != NULL) |
| 24520 | { |
| 24521 | g_warn_if_fail (IS_BUTTON (interface)); |
| 24522 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24523 | } |
| 24524 | else |
| 24525 | { |
| 24526 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button"); |
| 24527 | } |
| 24528 | break; |
| 24529 | |
| 24530 | case 16: |
| 24531 | interface = g_value_get_object (value); |
| 24532 | if (interface != NULL) |
| 24533 | { |
| 24534 | g_warn_if_fail (IS_LED (interface)); |
| 24535 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 24536 | } |
| 24537 | else |
| 24538 | { |
| 24539 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led"); |
| 24540 | } |
| 24541 | break; |
| 24542 | |
| 24543 | default: |
| 24544 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 24545 | break; |
| 24546 | } |
| 24547 | } |
| 24548 | |
| 24549 | static void |
| 24550 | object_skeleton_get_property (GObject *gobject, |
| 24551 | guint prop_id, |
| 24552 | GValue *value, |
| 24553 | GParamSpec *pspec) |
| 24554 | { |
| 24555 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 24556 | GDBusInterface *interface; |
| 24557 | |
| 24558 | switch (prop_id) |
| 24559 | { |
| 24560 | case 1: |
| 24561 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ"); |
| 24562 | g_value_take_object (value, interface); |
| 24563 | break; |
| 24564 | |
| 24565 | case 2: |
| 24566 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 24567 | g_value_take_object (value, interface); |
| 24568 | break; |
| 24569 | |
| 24570 | case 3: |
| 24571 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 24572 | g_value_take_object (value, interface); |
| 24573 | break; |
| 24574 | |
| 24575 | case 4: |
| 24576 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 24577 | g_value_take_object (value, interface); |
| 24578 | break; |
| 24579 | |
| 24580 | case 5: |
| 24581 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 24582 | g_value_take_object (value, interface); |
| 24583 | break; |
| 24584 | |
| 24585 | case 6: |
| 24586 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 24587 | g_value_take_object (value, interface); |
| 24588 | break; |
| 24589 | |
| 24590 | case 7: |
| 24591 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 24592 | g_value_take_object (value, interface); |
| 24593 | break; |
| 24594 | |
| 24595 | case 8: |
| 24596 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 24597 | g_value_take_object (value, interface); |
| 24598 | break; |
| 24599 | |
| 24600 | case 9: |
| 24601 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 24602 | g_value_take_object (value, interface); |
| 24603 | break; |
| 24604 | |
| 24605 | case 10: |
| 24606 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 24607 | g_value_take_object (value, interface); |
| 24608 | break; |
| 24609 | |
| 24610 | case 11: |
| 24611 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 24612 | g_value_take_object (value, interface); |
| 24613 | break; |
| 24614 | |
| 24615 | case 12: |
| 24616 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 24617 | g_value_take_object (value, interface); |
| 24618 | break; |
| 24619 | |
| 24620 | case 13: |
| 24621 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 24622 | g_value_take_object (value, interface); |
| 24623 | break; |
| 24624 | |
| 24625 | case 14: |
| 24626 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 24627 | g_value_take_object (value, interface); |
| 24628 | break; |
| 24629 | |
| 24630 | case 15: |
| 24631 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 24632 | g_value_take_object (value, interface); |
| 24633 | break; |
| 24634 | |
| 24635 | case 16: |
| 24636 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 24637 | g_value_take_object (value, interface); |
| 24638 | break; |
| 24639 | |
| 24640 | default: |
| 24641 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 24642 | break; |
| 24643 | } |
| 24644 | } |
| 24645 | |
| 24646 | static void |
| 24647 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 24648 | { |
| 24649 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 24650 | |
| 24651 | gobject_class->set_property = object_skeleton_set_property; |
| 24652 | gobject_class->get_property = object_skeleton_get_property; |
| 24653 | |
| 24654 | g_object_class_override_property (gobject_class, 1, "occ"); |
| 24655 | g_object_class_override_property (gobject_class, 2, "fan"); |
| 24656 | g_object_class_override_property (gobject_class, 3, "sensor-value"); |
| 24657 | g_object_class_override_property (gobject_class, 4, "sensor-threshold"); |
| 24658 | g_object_class_override_property (gobject_class, 5, "sensor-i2c"); |
| 24659 | g_object_class_override_property (gobject_class, 6, "sensor-match"); |
| 24660 | g_object_class_override_property (gobject_class, 7, "process"); |
| 24661 | g_object_class_override_property (gobject_class, 8, "control"); |
| 24662 | g_object_class_override_property (gobject_class, 9, "control-bmc"); |
| 24663 | g_object_class_override_property (gobject_class, 10, "control-host"); |
| 24664 | g_object_class_override_property (gobject_class, 11, "control-power"); |
| 24665 | g_object_class_override_property (gobject_class, 12, "watchdog"); |
| 24666 | g_object_class_override_property (gobject_class, 13, "event-log"); |
| 24667 | g_object_class_override_property (gobject_class, 14, "flash"); |
| 24668 | g_object_class_override_property (gobject_class, 15, "button"); |
| 24669 | g_object_class_override_property (gobject_class, 16, "led"); |
| 24670 | } |
| 24671 | |
| 24672 | /** |
| 24673 | * object_skeleton_new: |
| 24674 | * @object_path: An object path. |
| 24675 | * |
| 24676 | * Creates a new skeleton object. |
| 24677 | * |
| 24678 | * Returns: (transfer full): The skeleton object. |
| 24679 | */ |
| 24680 | ObjectSkeleton * |
| 24681 | object_skeleton_new (const gchar *object_path) |
| 24682 | { |
| 24683 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 24684 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 24685 | } |
| 24686 | |
| 24687 | /** |
| 24688 | * object_skeleton_set_occ: |
| 24689 | * @object: A #ObjectSkeleton. |
| 24690 | * @interface_: (allow-none): A #Occ or %NULL to clear the interface. |
| 24691 | * |
| 24692 | * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object. |
| 24693 | */ |
| 24694 | void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_) |
| 24695 | { |
| 24696 | g_object_set (G_OBJECT (object), "occ", interface_, NULL); |
| 24697 | } |
| 24698 | |
| 24699 | /** |
| 24700 | * object_skeleton_set_fan: |
| 24701 | * @object: A #ObjectSkeleton. |
| 24702 | * @interface_: (allow-none): A #Fan or %NULL to clear the interface. |
| 24703 | * |
| 24704 | * 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. |
| 24705 | */ |
| 24706 | void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_) |
| 24707 | { |
| 24708 | g_object_set (G_OBJECT (object), "fan", interface_, NULL); |
| 24709 | } |
| 24710 | |
| 24711 | /** |
| 24712 | * object_skeleton_set_sensor_value: |
| 24713 | * @object: A #ObjectSkeleton. |
| 24714 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
| 24715 | * |
| 24716 | * 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. |
| 24717 | */ |
| 24718 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
| 24719 | { |
| 24720 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
| 24721 | } |
| 24722 | |
| 24723 | /** |
| 24724 | * object_skeleton_set_sensor_threshold: |
| 24725 | * @object: A #ObjectSkeleton. |
| 24726 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
| 24727 | * |
| 24728 | * 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. |
| 24729 | */ |
| 24730 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
| 24731 | { |
| 24732 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
| 24733 | } |
| 24734 | |
| 24735 | /** |
| 24736 | * object_skeleton_set_sensor_i2c: |
| 24737 | * @object: A #ObjectSkeleton. |
| 24738 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 24739 | * |
| 24740 | * 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. |
| 24741 | */ |
| 24742 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 24743 | { |
| 24744 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 24745 | } |
| 24746 | |
| 24747 | /** |
| 24748 | * object_skeleton_set_sensor_match: |
| 24749 | * @object: A #ObjectSkeleton. |
| 24750 | * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. |
| 24751 | * |
| 24752 | * 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. |
| 24753 | */ |
| 24754 | void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) |
| 24755 | { |
| 24756 | g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); |
| 24757 | } |
| 24758 | |
| 24759 | /** |
| 24760 | * object_skeleton_set_process: |
| 24761 | * @object: A #ObjectSkeleton. |
| 24762 | * @interface_: (allow-none): A #Process or %NULL to clear the interface. |
| 24763 | * |
| 24764 | * 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. |
| 24765 | */ |
| 24766 | void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_) |
| 24767 | { |
| 24768 | g_object_set (G_OBJECT (object), "process", interface_, NULL); |
| 24769 | } |
| 24770 | |
| 24771 | /** |
| 24772 | * object_skeleton_set_control: |
| 24773 | * @object: A #ObjectSkeleton. |
| 24774 | * @interface_: (allow-none): A #Control or %NULL to clear the interface. |
| 24775 | * |
| 24776 | * 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. |
| 24777 | */ |
| 24778 | void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_) |
| 24779 | { |
| 24780 | g_object_set (G_OBJECT (object), "control", interface_, NULL); |
| 24781 | } |
| 24782 | |
| 24783 | /** |
| 24784 | * object_skeleton_set_control_bmc: |
| 24785 | * @object: A #ObjectSkeleton. |
| 24786 | * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface. |
| 24787 | * |
| 24788 | * 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. |
| 24789 | */ |
| 24790 | void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_) |
| 24791 | { |
| 24792 | g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL); |
| 24793 | } |
| 24794 | |
| 24795 | /** |
| 24796 | * object_skeleton_set_control_host: |
| 24797 | * @object: A #ObjectSkeleton. |
| 24798 | * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface. |
| 24799 | * |
| 24800 | * 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. |
| 24801 | */ |
| 24802 | void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_) |
| 24803 | { |
| 24804 | g_object_set (G_OBJECT (object), "control-host", interface_, NULL); |
| 24805 | } |
| 24806 | |
| 24807 | /** |
| 24808 | * object_skeleton_set_control_power: |
| 24809 | * @object: A #ObjectSkeleton. |
| 24810 | * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface. |
| 24811 | * |
| 24812 | * 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. |
| 24813 | */ |
| 24814 | void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_) |
| 24815 | { |
| 24816 | g_object_set (G_OBJECT (object), "control-power", interface_, NULL); |
| 24817 | } |
| 24818 | |
| 24819 | /** |
| 24820 | * object_skeleton_set_watchdog: |
| 24821 | * @object: A #ObjectSkeleton. |
| 24822 | * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. |
| 24823 | * |
| 24824 | * 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. |
| 24825 | */ |
| 24826 | void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) |
| 24827 | { |
| 24828 | g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); |
| 24829 | } |
| 24830 | |
| 24831 | /** |
| 24832 | * object_skeleton_set_event_log: |
| 24833 | * @object: A #ObjectSkeleton. |
| 24834 | * @interface_: (allow-none): A #EventLog or %NULL to clear the interface. |
| 24835 | * |
| 24836 | * 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. |
| 24837 | */ |
| 24838 | void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_) |
| 24839 | { |
| 24840 | g_object_set (G_OBJECT (object), "event-log", interface_, NULL); |
| 24841 | } |
| 24842 | |
| 24843 | /** |
| 24844 | * object_skeleton_set_flash: |
| 24845 | * @object: A #ObjectSkeleton. |
| 24846 | * @interface_: (allow-none): A #Flash or %NULL to clear the interface. |
| 24847 | * |
| 24848 | * 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. |
| 24849 | */ |
| 24850 | void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_) |
| 24851 | { |
| 24852 | g_object_set (G_OBJECT (object), "flash", interface_, NULL); |
| 24853 | } |
| 24854 | |
| 24855 | /** |
| 24856 | * object_skeleton_set_button: |
| 24857 | * @object: A #ObjectSkeleton. |
| 24858 | * @interface_: (allow-none): A #Button or %NULL to clear the interface. |
| 24859 | * |
| 24860 | * 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. |
| 24861 | */ |
| 24862 | void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_) |
| 24863 | { |
| 24864 | g_object_set (G_OBJECT (object), "button", interface_, NULL); |
| 24865 | } |
| 24866 | |
| 24867 | /** |
| 24868 | * object_skeleton_set_led: |
| 24869 | * @object: A #ObjectSkeleton. |
| 24870 | * @interface_: (allow-none): A #Led or %NULL to clear the interface. |
| 24871 | * |
| 24872 | * 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. |
| 24873 | */ |
| 24874 | void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_) |
| 24875 | { |
| 24876 | g_object_set (G_OBJECT (object), "led", interface_, NULL); |
| 24877 | } |
| 24878 | |
| 24879 | |
| 24880 | /* ------------------------------------------------------------------------ |
| 24881 | * Code for ObjectManager client |
| 24882 | * ------------------------------------------------------------------------ |
| 24883 | */ |
| 24884 | |
| 24885 | /** |
| 24886 | * SECTION:ObjectManagerClient |
| 24887 | * @title: ObjectManagerClient |
| 24888 | * @short_description: Generated GDBusObjectManagerClient type |
| 24889 | * |
| 24890 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 24891 | */ |
| 24892 | |
| 24893 | /** |
| 24894 | * ObjectManagerClient: |
| 24895 | * |
| 24896 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 24897 | */ |
| 24898 | |
| 24899 | /** |
| 24900 | * ObjectManagerClientClass: |
| 24901 | * @parent_class: The parent class. |
| 24902 | * |
| 24903 | * Class structure for #ObjectManagerClient. |
| 24904 | */ |
| 24905 | |
| 24906 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 24907 | |
| 24908 | static void |
| 24909 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 24910 | { |
| 24911 | } |
| 24912 | |
| 24913 | static void |
| 24914 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 24915 | { |
| 24916 | } |
| 24917 | |
| 24918 | /** |
| 24919 | * object_manager_client_get_proxy_type: |
| 24920 | * @manager: A #GDBusObjectManagerClient. |
| 24921 | * @object_path: The object path of the remote object (unused). |
| 24922 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 24923 | * @user_data: User data (unused). |
| 24924 | * |
| 24925 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 24926 | * |
| 24927 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 24928 | */ |
| 24929 | GType |
| 24930 | 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) |
| 24931 | { |
| 24932 | static gsize once_init_value = 0; |
| 24933 | static GHashTable *lookup_hash; |
| 24934 | GType ret; |
| 24935 | |
| 24936 | if (interface_name == NULL) |
| 24937 | return TYPE_OBJECT_PROXY; |
| 24938 | if (g_once_init_enter (&once_init_value)) |
| 24939 | { |
| 24940 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 24941 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY)); |
| 24942 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY)); |
| 24943 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); |
| 24944 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); |
| 24945 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
| 24946 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); |
| 24947 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY)); |
| 24948 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY)); |
| 24949 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY)); |
| 24950 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY)); |
| 24951 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY)); |
| 24952 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); |
| 24953 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY)); |
| 24954 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY)); |
| 24955 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY)); |
| 24956 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY)); |
| 24957 | g_once_init_leave (&once_init_value, 1); |
| 24958 | } |
| 24959 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 24960 | if (ret == (GType) 0) |
| 24961 | ret = G_TYPE_DBUS_PROXY; |
| 24962 | return ret; |
| 24963 | } |
| 24964 | |
| 24965 | /** |
| 24966 | * object_manager_client_new: |
| 24967 | * @connection: A #GDBusConnection. |
| 24968 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 24969 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 24970 | * @object_path: An object path. |
| 24971 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24972 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 24973 | * @user_data: User data to pass to @callback. |
| 24974 | * |
| 24975 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 24976 | * |
| 24977 | * 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. |
| 24978 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 24979 | * |
| 24980 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 24981 | */ |
| 24982 | void |
| 24983 | object_manager_client_new ( |
| 24984 | GDBusConnection *connection, |
| 24985 | GDBusObjectManagerClientFlags flags, |
| 24986 | const gchar *name, |
| 24987 | const gchar *object_path, |
| 24988 | GCancellable *cancellable, |
| 24989 | GAsyncReadyCallback callback, |
| 24990 | gpointer user_data) |
| 24991 | { |
| 24992 | 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); |
| 24993 | } |
| 24994 | |
| 24995 | /** |
| 24996 | * object_manager_client_new_finish: |
| 24997 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 24998 | * @error: Return location for error or %NULL |
| 24999 | * |
| 25000 | * Finishes an operation started with object_manager_client_new(). |
| 25001 | * |
| 25002 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 25003 | */ |
| 25004 | GDBusObjectManager * |
| 25005 | object_manager_client_new_finish ( |
| 25006 | GAsyncResult *res, |
| 25007 | GError **error) |
| 25008 | { |
| 25009 | GObject *ret; |
| 25010 | GObject *source_object; |
| 25011 | source_object = g_async_result_get_source_object (res); |
| 25012 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25013 | g_object_unref (source_object); |
| 25014 | if (ret != NULL) |
| 25015 | return G_DBUS_OBJECT_MANAGER (ret); |
| 25016 | else |
| 25017 | return NULL; |
| 25018 | } |
| 25019 | |
| 25020 | /** |
| 25021 | * object_manager_client_new_sync: |
| 25022 | * @connection: A #GDBusConnection. |
| 25023 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 25024 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 25025 | * @object_path: An object path. |
| 25026 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25027 | * @error: Return location for error or %NULL |
| 25028 | * |
| 25029 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 25030 | * |
| 25031 | * The calling thread is blocked until a reply is received. |
| 25032 | * |
| 25033 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 25034 | * |
| 25035 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 25036 | */ |
| 25037 | GDBusObjectManager * |
| 25038 | object_manager_client_new_sync ( |
| 25039 | GDBusConnection *connection, |
| 25040 | GDBusObjectManagerClientFlags flags, |
| 25041 | const gchar *name, |
| 25042 | const gchar *object_path, |
| 25043 | GCancellable *cancellable, |
| 25044 | GError **error) |
| 25045 | { |
| 25046 | GInitable *ret; |
| 25047 | 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); |
| 25048 | if (ret != NULL) |
| 25049 | return G_DBUS_OBJECT_MANAGER (ret); |
| 25050 | else |
| 25051 | return NULL; |
| 25052 | } |
| 25053 | |
| 25054 | |
| 25055 | /** |
| 25056 | * object_manager_client_new_for_bus: |
| 25057 | * @bus_type: A #GBusType. |
| 25058 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 25059 | * @name: A bus name (well-known or unique). |
| 25060 | * @object_path: An object path. |
| 25061 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25062 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 25063 | * @user_data: User data to pass to @callback. |
| 25064 | * |
| 25065 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 25066 | * |
| 25067 | * 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. |
| 25068 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 25069 | * |
| 25070 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 25071 | */ |
| 25072 | void |
| 25073 | object_manager_client_new_for_bus ( |
| 25074 | GBusType bus_type, |
| 25075 | GDBusObjectManagerClientFlags flags, |
| 25076 | const gchar *name, |
| 25077 | const gchar *object_path, |
| 25078 | GCancellable *cancellable, |
| 25079 | GAsyncReadyCallback callback, |
| 25080 | gpointer user_data) |
| 25081 | { |
| 25082 | 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); |
| 25083 | } |
| 25084 | |
| 25085 | /** |
| 25086 | * object_manager_client_new_for_bus_finish: |
| 25087 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 25088 | * @error: Return location for error or %NULL |
| 25089 | * |
| 25090 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 25091 | * |
| 25092 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 25093 | */ |
| 25094 | GDBusObjectManager * |
| 25095 | object_manager_client_new_for_bus_finish ( |
| 25096 | GAsyncResult *res, |
| 25097 | GError **error) |
| 25098 | { |
| 25099 | GObject *ret; |
| 25100 | GObject *source_object; |
| 25101 | source_object = g_async_result_get_source_object (res); |
| 25102 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25103 | g_object_unref (source_object); |
| 25104 | if (ret != NULL) |
| 25105 | return G_DBUS_OBJECT_MANAGER (ret); |
| 25106 | else |
| 25107 | return NULL; |
| 25108 | } |
| 25109 | |
| 25110 | /** |
| 25111 | * object_manager_client_new_for_bus_sync: |
| 25112 | * @bus_type: A #GBusType. |
| 25113 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 25114 | * @name: A bus name (well-known or unique). |
| 25115 | * @object_path: An object path. |
| 25116 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25117 | * @error: Return location for error or %NULL |
| 25118 | * |
| 25119 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 25120 | * |
| 25121 | * The calling thread is blocked until a reply is received. |
| 25122 | * |
| 25123 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 25124 | * |
| 25125 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 25126 | */ |
| 25127 | GDBusObjectManager * |
| 25128 | object_manager_client_new_for_bus_sync ( |
| 25129 | GBusType bus_type, |
| 25130 | GDBusObjectManagerClientFlags flags, |
| 25131 | const gchar *name, |
| 25132 | const gchar *object_path, |
| 25133 | GCancellable *cancellable, |
| 25134 | GError **error) |
| 25135 | { |
| 25136 | GInitable *ret; |
| 25137 | 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); |
| 25138 | if (ret != NULL) |
| 25139 | return G_DBUS_OBJECT_MANAGER (ret); |
| 25140 | else |
| 25141 | return NULL; |
| 25142 | } |
| 25143 | |
| 25144 | |