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 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 152 | * Code for interface org.openbmc.Fan |
| 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * SECTION:Fan |
| 158 | * @title: Fan |
| 159 | * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface |
| 160 | * |
| 161 | * 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. |
| 162 | */ |
| 163 | |
| 164 | /* ---- Introspection data for org.openbmc.Fan ---- */ |
| 165 | |
| 166 | static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone = |
| 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "cooling_zone", |
| 171 | (gchar *) "i", |
| 172 | NULL |
| 173 | }, |
| 174 | FALSE |
| 175 | }; |
| 176 | |
| 177 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] = |
| 178 | { |
| 179 | &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone, |
| 180 | NULL |
| 181 | }; |
| 182 | |
| 183 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone = |
| 184 | { |
| 185 | { |
| 186 | -1, |
| 187 | (gchar *) "setCoolingZone", |
| 188 | (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers, |
| 189 | NULL, |
| 190 | NULL |
| 191 | }, |
| 192 | "handle-set-cooling-zone", |
| 193 | FALSE |
| 194 | }; |
| 195 | |
| 196 | static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed = |
| 197 | { |
| 198 | { |
| 199 | -1, |
| 200 | (gchar *) "speed", |
| 201 | (gchar *) "i", |
| 202 | NULL |
| 203 | }, |
| 204 | FALSE |
| 205 | }; |
| 206 | |
| 207 | static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] = |
| 208 | { |
| 209 | &_fan_method_info_get_speed_OUT_ARG_speed, |
| 210 | NULL |
| 211 | }; |
| 212 | |
| 213 | static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed = |
| 214 | { |
| 215 | { |
| 216 | -1, |
| 217 | (gchar *) "getSpeed", |
| 218 | NULL, |
| 219 | (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers, |
| 220 | NULL |
| 221 | }, |
| 222 | "handle-get-speed", |
| 223 | FALSE |
| 224 | }; |
| 225 | |
| 226 | static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed = |
| 227 | { |
| 228 | { |
| 229 | -1, |
| 230 | (gchar *) "speed", |
| 231 | (gchar *) "i", |
| 232 | NULL |
| 233 | }, |
| 234 | FALSE |
| 235 | }; |
| 236 | |
| 237 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] = |
| 238 | { |
| 239 | &_fan_method_info_set_speed_IN_ARG_speed, |
| 240 | NULL |
| 241 | }; |
| 242 | |
| 243 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed = |
| 244 | { |
| 245 | { |
| 246 | -1, |
| 247 | (gchar *) "setSpeed", |
| 248 | (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers, |
| 249 | NULL, |
| 250 | NULL |
| 251 | }, |
| 252 | "handle-set-speed", |
| 253 | FALSE |
| 254 | }; |
| 255 | |
| 256 | static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] = |
| 257 | { |
| 258 | &_fan_method_info_set_cooling_zone, |
| 259 | &_fan_method_info_get_speed, |
| 260 | &_fan_method_info_set_speed, |
| 261 | NULL |
| 262 | }; |
| 263 | |
| 264 | static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed = |
| 265 | { |
| 266 | { |
| 267 | -1, |
| 268 | (gchar *) "speed", |
| 269 | (gchar *) "i", |
| 270 | NULL |
| 271 | }, |
| 272 | FALSE |
| 273 | }; |
| 274 | |
| 275 | static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] = |
| 276 | { |
| 277 | &_fan_signal_info_speed_changed_ARG_speed, |
| 278 | NULL |
| 279 | }; |
| 280 | |
| 281 | static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed = |
| 282 | { |
| 283 | { |
| 284 | -1, |
| 285 | (gchar *) "SpeedChanged", |
| 286 | (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers, |
| 287 | NULL |
| 288 | }, |
| 289 | "speed-changed" |
| 290 | }; |
| 291 | |
| 292 | static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error = |
| 293 | { |
| 294 | { |
| 295 | -1, |
| 296 | (gchar *) "TachError", |
| 297 | NULL, |
| 298 | NULL |
| 299 | }, |
| 300 | "tach-error" |
| 301 | }; |
| 302 | |
| 303 | static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] = |
| 304 | { |
| 305 | &_fan_signal_info_speed_changed, |
| 306 | &_fan_signal_info_tach_error, |
| 307 | NULL |
| 308 | }; |
| 309 | |
| 310 | static const _ExtendedGDBusPropertyInfo _fan_property_info_speed = |
| 311 | { |
| 312 | { |
| 313 | -1, |
| 314 | (gchar *) "speed", |
| 315 | (gchar *) "i", |
| 316 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 317 | NULL |
| 318 | }, |
| 319 | "speed", |
| 320 | FALSE |
| 321 | }; |
| 322 | |
| 323 | static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone = |
| 324 | { |
| 325 | { |
| 326 | -1, |
| 327 | (gchar *) "cooling_zone", |
| 328 | (gchar *) "i", |
| 329 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 330 | NULL |
| 331 | }, |
| 332 | "cooling-zone", |
| 333 | FALSE |
| 334 | }; |
| 335 | |
| 336 | static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num = |
| 337 | { |
| 338 | { |
| 339 | -1, |
| 340 | (gchar *) "pwm_num", |
| 341 | (gchar *) "i", |
| 342 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 343 | NULL |
| 344 | }, |
| 345 | "pwm-num", |
| 346 | FALSE |
| 347 | }; |
| 348 | |
| 349 | static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] = |
| 350 | { |
| 351 | &_fan_property_info_speed, |
| 352 | &_fan_property_info_cooling_zone, |
| 353 | &_fan_property_info_pwm_num, |
| 354 | NULL |
| 355 | }; |
| 356 | |
| 357 | static const _ExtendedGDBusInterfaceInfo _fan_interface_info = |
| 358 | { |
| 359 | { |
| 360 | -1, |
| 361 | (gchar *) "org.openbmc.Fan", |
| 362 | (GDBusMethodInfo **) &_fan_method_info_pointers, |
| 363 | (GDBusSignalInfo **) &_fan_signal_info_pointers, |
| 364 | (GDBusPropertyInfo **) &_fan_property_info_pointers, |
| 365 | NULL |
| 366 | }, |
| 367 | "fan", |
| 368 | }; |
| 369 | |
| 370 | |
| 371 | /** |
| 372 | * fan_interface_info: |
| 373 | * |
| 374 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface. |
| 375 | * |
| 376 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 377 | */ |
| 378 | GDBusInterfaceInfo * |
| 379 | fan_interface_info (void) |
| 380 | { |
| 381 | return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * fan_override_properties: |
| 386 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 387 | * @property_id_begin: The property id to assign to the first overridden property. |
| 388 | * |
| 389 | * Overrides all #GObject properties in the #Fan interface for a concrete class. |
| 390 | * The properties are overridden in the order they are defined. |
| 391 | * |
| 392 | * Returns: The last property id. |
| 393 | */ |
| 394 | guint |
| 395 | fan_override_properties (GObjectClass *klass, guint property_id_begin) |
| 396 | { |
| 397 | g_object_class_override_property (klass, property_id_begin++, "speed"); |
| 398 | g_object_class_override_property (klass, property_id_begin++, "cooling-zone"); |
| 399 | g_object_class_override_property (klass, property_id_begin++, "pwm-num"); |
| 400 | return property_id_begin - 1; |
| 401 | } |
| 402 | |
| 403 | |
| 404 | |
| 405 | /** |
| 406 | * Fan: |
| 407 | * |
| 408 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 409 | */ |
| 410 | |
| 411 | /** |
| 412 | * FanIface: |
| 413 | * @parent_iface: The parent interface. |
| 414 | * @handle_get_speed: Handler for the #Fan::handle-get-speed signal. |
| 415 | * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal. |
| 416 | * @handle_set_speed: Handler for the #Fan::handle-set-speed signal. |
| 417 | * @get_cooling_zone: Getter for the #Fan:cooling-zone property. |
| 418 | * @get_pwm_num: Getter for the #Fan:pwm-num property. |
| 419 | * @get_speed: Getter for the #Fan:speed property. |
| 420 | * @speed_changed: Handler for the #Fan::speed-changed signal. |
| 421 | * @tach_error: Handler for the #Fan::tach-error signal. |
| 422 | * |
| 423 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 424 | */ |
| 425 | |
| 426 | typedef FanIface FanInterface; |
| 427 | G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT); |
| 428 | |
| 429 | static void |
| 430 | fan_default_init (FanIface *iface) |
| 431 | { |
| 432 | /* GObject signals for incoming D-Bus method calls: */ |
| 433 | /** |
| 434 | * Fan::handle-set-cooling-zone: |
| 435 | * @object: A #Fan. |
| 436 | * @invocation: A #GDBusMethodInvocation. |
| 437 | * @arg_cooling_zone: Argument passed by remote caller. |
| 438 | * |
| 439 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. |
| 440 | * |
| 441 | * 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. |
| 442 | * |
| 443 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 444 | */ |
| 445 | g_signal_new ("handle-set-cooling-zone", |
| 446 | G_TYPE_FROM_INTERFACE (iface), |
| 447 | G_SIGNAL_RUN_LAST, |
| 448 | G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone), |
| 449 | g_signal_accumulator_true_handled, |
| 450 | NULL, |
| 451 | g_cclosure_marshal_generic, |
| 452 | G_TYPE_BOOLEAN, |
| 453 | 2, |
| 454 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 455 | |
| 456 | /** |
| 457 | * Fan::handle-get-speed: |
| 458 | * @object: A #Fan. |
| 459 | * @invocation: A #GDBusMethodInvocation. |
| 460 | * |
| 461 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. |
| 462 | * |
| 463 | * 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. |
| 464 | * |
| 465 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 466 | */ |
| 467 | g_signal_new ("handle-get-speed", |
| 468 | G_TYPE_FROM_INTERFACE (iface), |
| 469 | G_SIGNAL_RUN_LAST, |
| 470 | G_STRUCT_OFFSET (FanIface, handle_get_speed), |
| 471 | g_signal_accumulator_true_handled, |
| 472 | NULL, |
| 473 | g_cclosure_marshal_generic, |
| 474 | G_TYPE_BOOLEAN, |
| 475 | 1, |
| 476 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 477 | |
| 478 | /** |
| 479 | * Fan::handle-set-speed: |
| 480 | * @object: A #Fan. |
| 481 | * @invocation: A #GDBusMethodInvocation. |
| 482 | * @arg_speed: Argument passed by remote caller. |
| 483 | * |
| 484 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. |
| 485 | * |
| 486 | * 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. |
| 487 | * |
| 488 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 489 | */ |
| 490 | g_signal_new ("handle-set-speed", |
| 491 | G_TYPE_FROM_INTERFACE (iface), |
| 492 | G_SIGNAL_RUN_LAST, |
| 493 | G_STRUCT_OFFSET (FanIface, handle_set_speed), |
| 494 | g_signal_accumulator_true_handled, |
| 495 | NULL, |
| 496 | g_cclosure_marshal_generic, |
| 497 | G_TYPE_BOOLEAN, |
| 498 | 2, |
| 499 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 500 | |
| 501 | /* GObject signals for received D-Bus signals: */ |
| 502 | /** |
| 503 | * Fan::speed-changed: |
| 504 | * @object: A #Fan. |
| 505 | * @arg_speed: Argument. |
| 506 | * |
| 507 | * 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. |
| 508 | * |
| 509 | * 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. |
| 510 | */ |
| 511 | g_signal_new ("speed-changed", |
| 512 | G_TYPE_FROM_INTERFACE (iface), |
| 513 | G_SIGNAL_RUN_LAST, |
| 514 | G_STRUCT_OFFSET (FanIface, speed_changed), |
| 515 | NULL, |
| 516 | NULL, |
| 517 | g_cclosure_marshal_generic, |
| 518 | G_TYPE_NONE, |
| 519 | 1, G_TYPE_INT); |
| 520 | |
| 521 | /** |
| 522 | * Fan::tach-error: |
| 523 | * @object: A #Fan. |
| 524 | * |
| 525 | * 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. |
| 526 | * |
| 527 | * 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. |
| 528 | */ |
| 529 | g_signal_new ("tach-error", |
| 530 | G_TYPE_FROM_INTERFACE (iface), |
| 531 | G_SIGNAL_RUN_LAST, |
| 532 | G_STRUCT_OFFSET (FanIface, tach_error), |
| 533 | NULL, |
| 534 | NULL, |
| 535 | g_cclosure_marshal_generic, |
| 536 | G_TYPE_NONE, |
| 537 | 0); |
| 538 | |
| 539 | /* GObject properties for D-Bus properties: */ |
| 540 | /** |
| 541 | * Fan:speed: |
| 542 | * |
| 543 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>. |
| 544 | * |
| 545 | * 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. |
| 546 | */ |
| 547 | g_object_interface_install_property (iface, |
| 548 | g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 549 | /** |
| 550 | * Fan:cooling-zone: |
| 551 | * |
| 552 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>. |
| 553 | * |
| 554 | * 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. |
| 555 | */ |
| 556 | g_object_interface_install_property (iface, |
| 557 | g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 558 | /** |
| 559 | * Fan:pwm-num: |
| 560 | * |
| 561 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>. |
| 562 | * |
| 563 | * 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. |
| 564 | */ |
| 565 | g_object_interface_install_property (iface, |
| 566 | g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 567 | } |
| 568 | |
| 569 | /** |
| 570 | * fan_get_speed: (skip) |
| 571 | * @object: A #Fan. |
| 572 | * |
| 573 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property. |
| 574 | * |
| 575 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 576 | * |
| 577 | * Returns: The property value. |
| 578 | */ |
| 579 | gint |
| 580 | fan_get_speed (Fan *object) |
| 581 | { |
| 582 | return FAN_GET_IFACE (object)->get_speed (object); |
| 583 | } |
| 584 | |
| 585 | /** |
| 586 | * fan_set_speed: (skip) |
| 587 | * @object: A #Fan. |
| 588 | * @value: The value to set. |
| 589 | * |
| 590 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value. |
| 591 | * |
| 592 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 593 | */ |
| 594 | void |
| 595 | fan_set_speed (Fan *object, gint value) |
| 596 | { |
| 597 | g_object_set (G_OBJECT (object), "speed", value, NULL); |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * fan_get_cooling_zone: (skip) |
| 602 | * @object: A #Fan. |
| 603 | * |
| 604 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property. |
| 605 | * |
| 606 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 607 | * |
| 608 | * Returns: The property value. |
| 609 | */ |
| 610 | gint |
| 611 | fan_get_cooling_zone (Fan *object) |
| 612 | { |
| 613 | return FAN_GET_IFACE (object)->get_cooling_zone (object); |
| 614 | } |
| 615 | |
| 616 | /** |
| 617 | * fan_set_cooling_zone: (skip) |
| 618 | * @object: A #Fan. |
| 619 | * @value: The value to set. |
| 620 | * |
| 621 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value. |
| 622 | * |
| 623 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 624 | */ |
| 625 | void |
| 626 | fan_set_cooling_zone (Fan *object, gint value) |
| 627 | { |
| 628 | g_object_set (G_OBJECT (object), "cooling-zone", value, NULL); |
| 629 | } |
| 630 | |
| 631 | /** |
| 632 | * fan_get_pwm_num: (skip) |
| 633 | * @object: A #Fan. |
| 634 | * |
| 635 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property. |
| 636 | * |
| 637 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 638 | * |
| 639 | * Returns: The property value. |
| 640 | */ |
| 641 | gint |
| 642 | fan_get_pwm_num (Fan *object) |
| 643 | { |
| 644 | return FAN_GET_IFACE (object)->get_pwm_num (object); |
| 645 | } |
| 646 | |
| 647 | /** |
| 648 | * fan_set_pwm_num: (skip) |
| 649 | * @object: A #Fan. |
| 650 | * @value: The value to set. |
| 651 | * |
| 652 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value. |
| 653 | * |
| 654 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 655 | */ |
| 656 | void |
| 657 | fan_set_pwm_num (Fan *object, gint value) |
| 658 | { |
| 659 | g_object_set (G_OBJECT (object), "pwm-num", value, NULL); |
| 660 | } |
| 661 | |
| 662 | /** |
| 663 | * fan_emit_speed_changed: |
| 664 | * @object: A #Fan. |
| 665 | * @arg_speed: Argument to pass with the signal. |
| 666 | * |
| 667 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal. |
| 668 | */ |
| 669 | void |
| 670 | fan_emit_speed_changed ( |
| 671 | Fan *object, |
| 672 | gint arg_speed) |
| 673 | { |
| 674 | g_signal_emit_by_name (object, "speed-changed", arg_speed); |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * fan_emit_tach_error: |
| 679 | * @object: A #Fan. |
| 680 | * |
| 681 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal. |
| 682 | */ |
| 683 | void |
| 684 | fan_emit_tach_error ( |
| 685 | Fan *object) |
| 686 | { |
| 687 | g_signal_emit_by_name (object, "tach-error"); |
| 688 | } |
| 689 | |
| 690 | /** |
| 691 | * fan_call_set_cooling_zone: |
| 692 | * @proxy: A #FanProxy. |
| 693 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 694 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 695 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 696 | * @user_data: User data to pass to @callback. |
| 697 | * |
| 698 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. |
| 699 | * 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. |
| 700 | * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation. |
| 701 | * |
| 702 | * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method. |
| 703 | */ |
| 704 | void |
| 705 | fan_call_set_cooling_zone ( |
| 706 | Fan *proxy, |
| 707 | gint arg_cooling_zone, |
| 708 | GCancellable *cancellable, |
| 709 | GAsyncReadyCallback callback, |
| 710 | gpointer user_data) |
| 711 | { |
| 712 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 713 | "setCoolingZone", |
| 714 | g_variant_new ("(i)", |
| 715 | arg_cooling_zone), |
| 716 | G_DBUS_CALL_FLAGS_NONE, |
| 717 | -1, |
| 718 | cancellable, |
| 719 | callback, |
| 720 | user_data); |
| 721 | } |
| 722 | |
| 723 | /** |
| 724 | * fan_call_set_cooling_zone_finish: |
| 725 | * @proxy: A #FanProxy. |
| 726 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone(). |
| 727 | * @error: Return location for error or %NULL. |
| 728 | * |
| 729 | * Finishes an operation started with fan_call_set_cooling_zone(). |
| 730 | * |
| 731 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 732 | */ |
| 733 | gboolean |
| 734 | fan_call_set_cooling_zone_finish ( |
| 735 | Fan *proxy, |
| 736 | GAsyncResult *res, |
| 737 | GError **error) |
| 738 | { |
| 739 | GVariant *_ret; |
| 740 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 741 | if (_ret == NULL) |
| 742 | goto _out; |
| 743 | g_variant_get (_ret, |
| 744 | "()"); |
| 745 | g_variant_unref (_ret); |
| 746 | _out: |
| 747 | return _ret != NULL; |
| 748 | } |
| 749 | |
| 750 | /** |
| 751 | * fan_call_set_cooling_zone_sync: |
| 752 | * @proxy: A #FanProxy. |
| 753 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 754 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 755 | * @error: Return location for error or %NULL. |
| 756 | * |
| 757 | * 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. |
| 758 | * |
| 759 | * See fan_call_set_cooling_zone() for the asynchronous version of this method. |
| 760 | * |
| 761 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 762 | */ |
| 763 | gboolean |
| 764 | fan_call_set_cooling_zone_sync ( |
| 765 | Fan *proxy, |
| 766 | gint arg_cooling_zone, |
| 767 | GCancellable *cancellable, |
| 768 | GError **error) |
| 769 | { |
| 770 | GVariant *_ret; |
| 771 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 772 | "setCoolingZone", |
| 773 | g_variant_new ("(i)", |
| 774 | arg_cooling_zone), |
| 775 | G_DBUS_CALL_FLAGS_NONE, |
| 776 | -1, |
| 777 | cancellable, |
| 778 | error); |
| 779 | if (_ret == NULL) |
| 780 | goto _out; |
| 781 | g_variant_get (_ret, |
| 782 | "()"); |
| 783 | g_variant_unref (_ret); |
| 784 | _out: |
| 785 | return _ret != NULL; |
| 786 | } |
| 787 | |
| 788 | /** |
| 789 | * fan_call_get_speed: |
| 790 | * @proxy: A #FanProxy. |
| 791 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 792 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 793 | * @user_data: User data to pass to @callback. |
| 794 | * |
| 795 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. |
| 796 | * 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. |
| 797 | * You can then call fan_call_get_speed_finish() to get the result of the operation. |
| 798 | * |
| 799 | * See fan_call_get_speed_sync() for the synchronous, blocking version of this method. |
| 800 | */ |
| 801 | void |
| 802 | fan_call_get_speed ( |
| 803 | Fan *proxy, |
| 804 | GCancellable *cancellable, |
| 805 | GAsyncReadyCallback callback, |
| 806 | gpointer user_data) |
| 807 | { |
| 808 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 809 | "getSpeed", |
| 810 | g_variant_new ("()"), |
| 811 | G_DBUS_CALL_FLAGS_NONE, |
| 812 | -1, |
| 813 | cancellable, |
| 814 | callback, |
| 815 | user_data); |
| 816 | } |
| 817 | |
| 818 | /** |
| 819 | * fan_call_get_speed_finish: |
| 820 | * @proxy: A #FanProxy. |
| 821 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 822 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed(). |
| 823 | * @error: Return location for error or %NULL. |
| 824 | * |
| 825 | * Finishes an operation started with fan_call_get_speed(). |
| 826 | * |
| 827 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 828 | */ |
| 829 | gboolean |
| 830 | fan_call_get_speed_finish ( |
| 831 | Fan *proxy, |
| 832 | gint *out_speed, |
| 833 | GAsyncResult *res, |
| 834 | GError **error) |
| 835 | { |
| 836 | GVariant *_ret; |
| 837 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 838 | if (_ret == NULL) |
| 839 | goto _out; |
| 840 | g_variant_get (_ret, |
| 841 | "(i)", |
| 842 | out_speed); |
| 843 | g_variant_unref (_ret); |
| 844 | _out: |
| 845 | return _ret != NULL; |
| 846 | } |
| 847 | |
| 848 | /** |
| 849 | * fan_call_get_speed_sync: |
| 850 | * @proxy: A #FanProxy. |
| 851 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 852 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 853 | * @error: Return location for error or %NULL. |
| 854 | * |
| 855 | * 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. |
| 856 | * |
| 857 | * See fan_call_get_speed() for the asynchronous version of this method. |
| 858 | * |
| 859 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 860 | */ |
| 861 | gboolean |
| 862 | fan_call_get_speed_sync ( |
| 863 | Fan *proxy, |
| 864 | gint *out_speed, |
| 865 | GCancellable *cancellable, |
| 866 | GError **error) |
| 867 | { |
| 868 | GVariant *_ret; |
| 869 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 870 | "getSpeed", |
| 871 | g_variant_new ("()"), |
| 872 | G_DBUS_CALL_FLAGS_NONE, |
| 873 | -1, |
| 874 | cancellable, |
| 875 | error); |
| 876 | if (_ret == NULL) |
| 877 | goto _out; |
| 878 | g_variant_get (_ret, |
| 879 | "(i)", |
| 880 | out_speed); |
| 881 | g_variant_unref (_ret); |
| 882 | _out: |
| 883 | return _ret != NULL; |
| 884 | } |
| 885 | |
| 886 | /** |
| 887 | * fan_call_set_speed: |
| 888 | * @proxy: A #FanProxy. |
| 889 | * @arg_speed: Argument to pass with the method invocation. |
| 890 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 891 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 892 | * @user_data: User data to pass to @callback. |
| 893 | * |
| 894 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. |
| 895 | * 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. |
| 896 | * You can then call fan_call_set_speed_finish() to get the result of the operation. |
| 897 | * |
| 898 | * See fan_call_set_speed_sync() for the synchronous, blocking version of this method. |
| 899 | */ |
| 900 | void |
| 901 | fan_call_set_speed ( |
| 902 | Fan *proxy, |
| 903 | gint arg_speed, |
| 904 | GCancellable *cancellable, |
| 905 | GAsyncReadyCallback callback, |
| 906 | gpointer user_data) |
| 907 | { |
| 908 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 909 | "setSpeed", |
| 910 | g_variant_new ("(i)", |
| 911 | arg_speed), |
| 912 | G_DBUS_CALL_FLAGS_NONE, |
| 913 | -1, |
| 914 | cancellable, |
| 915 | callback, |
| 916 | user_data); |
| 917 | } |
| 918 | |
| 919 | /** |
| 920 | * fan_call_set_speed_finish: |
| 921 | * @proxy: A #FanProxy. |
| 922 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed(). |
| 923 | * @error: Return location for error or %NULL. |
| 924 | * |
| 925 | * Finishes an operation started with fan_call_set_speed(). |
| 926 | * |
| 927 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 928 | */ |
| 929 | gboolean |
| 930 | fan_call_set_speed_finish ( |
| 931 | Fan *proxy, |
| 932 | GAsyncResult *res, |
| 933 | GError **error) |
| 934 | { |
| 935 | GVariant *_ret; |
| 936 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 937 | if (_ret == NULL) |
| 938 | goto _out; |
| 939 | g_variant_get (_ret, |
| 940 | "()"); |
| 941 | g_variant_unref (_ret); |
| 942 | _out: |
| 943 | return _ret != NULL; |
| 944 | } |
| 945 | |
| 946 | /** |
| 947 | * fan_call_set_speed_sync: |
| 948 | * @proxy: A #FanProxy. |
| 949 | * @arg_speed: Argument to pass with the method invocation. |
| 950 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 951 | * @error: Return location for error or %NULL. |
| 952 | * |
| 953 | * 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. |
| 954 | * |
| 955 | * See fan_call_set_speed() for the asynchronous version of this method. |
| 956 | * |
| 957 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 958 | */ |
| 959 | gboolean |
| 960 | fan_call_set_speed_sync ( |
| 961 | Fan *proxy, |
| 962 | gint arg_speed, |
| 963 | GCancellable *cancellable, |
| 964 | GError **error) |
| 965 | { |
| 966 | GVariant *_ret; |
| 967 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 968 | "setSpeed", |
| 969 | g_variant_new ("(i)", |
| 970 | arg_speed), |
| 971 | G_DBUS_CALL_FLAGS_NONE, |
| 972 | -1, |
| 973 | cancellable, |
| 974 | error); |
| 975 | if (_ret == NULL) |
| 976 | goto _out; |
| 977 | g_variant_get (_ret, |
| 978 | "()"); |
| 979 | g_variant_unref (_ret); |
| 980 | _out: |
| 981 | return _ret != NULL; |
| 982 | } |
| 983 | |
| 984 | /** |
| 985 | * fan_complete_set_cooling_zone: |
| 986 | * @object: A #Fan. |
| 987 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 988 | * |
| 989 | * 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. |
| 990 | * |
| 991 | * This method will free @invocation, you cannot use it afterwards. |
| 992 | */ |
| 993 | void |
| 994 | fan_complete_set_cooling_zone ( |
| 995 | Fan *object, |
| 996 | GDBusMethodInvocation *invocation) |
| 997 | { |
| 998 | g_dbus_method_invocation_return_value (invocation, |
| 999 | g_variant_new ("()")); |
| 1000 | } |
| 1001 | |
| 1002 | /** |
| 1003 | * fan_complete_get_speed: |
| 1004 | * @object: A #Fan. |
| 1005 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1006 | * @speed: Parameter to return. |
| 1007 | * |
| 1008 | * 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. |
| 1009 | * |
| 1010 | * This method will free @invocation, you cannot use it afterwards. |
| 1011 | */ |
| 1012 | void |
| 1013 | fan_complete_get_speed ( |
| 1014 | Fan *object, |
| 1015 | GDBusMethodInvocation *invocation, |
| 1016 | gint speed) |
| 1017 | { |
| 1018 | g_dbus_method_invocation_return_value (invocation, |
| 1019 | g_variant_new ("(i)", |
| 1020 | speed)); |
| 1021 | } |
| 1022 | |
| 1023 | /** |
| 1024 | * fan_complete_set_speed: |
| 1025 | * @object: A #Fan. |
| 1026 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1027 | * |
| 1028 | * 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. |
| 1029 | * |
| 1030 | * This method will free @invocation, you cannot use it afterwards. |
| 1031 | */ |
| 1032 | void |
| 1033 | fan_complete_set_speed ( |
| 1034 | Fan *object, |
| 1035 | GDBusMethodInvocation *invocation) |
| 1036 | { |
| 1037 | g_dbus_method_invocation_return_value (invocation, |
| 1038 | g_variant_new ("()")); |
| 1039 | } |
| 1040 | |
| 1041 | /* ------------------------------------------------------------------------ */ |
| 1042 | |
| 1043 | /** |
| 1044 | * FanProxy: |
| 1045 | * |
| 1046 | * The #FanProxy structure contains only private data and should only be accessed using the provided API. |
| 1047 | */ |
| 1048 | |
| 1049 | /** |
| 1050 | * FanProxyClass: |
| 1051 | * @parent_class: The parent class. |
| 1052 | * |
| 1053 | * Class structure for #FanProxy. |
| 1054 | */ |
| 1055 | |
| 1056 | struct _FanProxyPrivate |
| 1057 | { |
| 1058 | GData *qdata; |
| 1059 | }; |
| 1060 | |
| 1061 | static void fan_proxy_iface_init (FanIface *iface); |
| 1062 | |
| 1063 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1064 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 1065 | G_ADD_PRIVATE (FanProxy) |
| 1066 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 1067 | |
| 1068 | #else |
| 1069 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 1070 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 1071 | |
| 1072 | #endif |
| 1073 | static void |
| 1074 | fan_proxy_finalize (GObject *object) |
| 1075 | { |
| 1076 | FanProxy *proxy = FAN_PROXY (object); |
| 1077 | g_datalist_clear (&proxy->priv->qdata); |
| 1078 | G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object); |
| 1079 | } |
| 1080 | |
| 1081 | static void |
| 1082 | fan_proxy_get_property (GObject *object, |
| 1083 | guint prop_id, |
| 1084 | GValue *value, |
| 1085 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1086 | { |
| 1087 | const _ExtendedGDBusPropertyInfo *info; |
| 1088 | GVariant *variant; |
| 1089 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1090 | info = _fan_property_info_pointers[prop_id - 1]; |
| 1091 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1092 | if (info->use_gvariant) |
| 1093 | { |
| 1094 | g_value_set_variant (value, variant); |
| 1095 | } |
| 1096 | else |
| 1097 | { |
| 1098 | if (variant != NULL) |
| 1099 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1100 | } |
| 1101 | if (variant != NULL) |
| 1102 | g_variant_unref (variant); |
| 1103 | } |
| 1104 | |
| 1105 | static void |
| 1106 | fan_proxy_set_property_cb (GDBusProxy *proxy, |
| 1107 | GAsyncResult *res, |
| 1108 | gpointer user_data) |
| 1109 | { |
| 1110 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1111 | GError *error; |
| 1112 | GVariant *_ret; |
| 1113 | error = NULL; |
| 1114 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1115 | if (!_ret) |
| 1116 | { |
| 1117 | g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)", |
| 1118 | info->parent_struct.name, |
| 1119 | error->message, g_quark_to_string (error->domain), error->code); |
| 1120 | g_error_free (error); |
| 1121 | } |
| 1122 | else |
| 1123 | { |
| 1124 | g_variant_unref (_ret); |
| 1125 | } |
| 1126 | } |
| 1127 | |
| 1128 | static void |
| 1129 | fan_proxy_set_property (GObject *object, |
| 1130 | guint prop_id, |
| 1131 | const GValue *value, |
| 1132 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1133 | { |
| 1134 | const _ExtendedGDBusPropertyInfo *info; |
| 1135 | GVariant *variant; |
| 1136 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1137 | info = _fan_property_info_pointers[prop_id - 1]; |
| 1138 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1139 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1140 | "org.freedesktop.DBus.Properties.Set", |
| 1141 | g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant), |
| 1142 | G_DBUS_CALL_FLAGS_NONE, |
| 1143 | -1, |
| 1144 | NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 1145 | g_variant_unref (variant); |
| 1146 | } |
| 1147 | |
| 1148 | static void |
| 1149 | fan_proxy_g_signal (GDBusProxy *proxy, |
| 1150 | const gchar *sender_name G_GNUC_UNUSED, |
| 1151 | const gchar *signal_name, |
| 1152 | GVariant *parameters) |
| 1153 | { |
| 1154 | _ExtendedGDBusSignalInfo *info; |
| 1155 | GVariantIter iter; |
| 1156 | GVariant *child; |
| 1157 | GValue *paramv; |
| 1158 | guint num_params; |
| 1159 | guint n; |
| 1160 | guint signal_id; |
| 1161 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name); |
| 1162 | if (info == NULL) |
| 1163 | return; |
| 1164 | num_params = g_variant_n_children (parameters); |
| 1165 | paramv = g_new0 (GValue, num_params + 1); |
| 1166 | g_value_init (¶mv[0], TYPE_FAN); |
| 1167 | g_value_set_object (¶mv[0], proxy); |
| 1168 | g_variant_iter_init (&iter, parameters); |
| 1169 | n = 1; |
| 1170 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1171 | { |
| 1172 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1173 | if (arg_info->use_gvariant) |
| 1174 | { |
| 1175 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1176 | g_value_set_variant (¶mv[n], child); |
| 1177 | n++; |
| 1178 | } |
| 1179 | else |
| 1180 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1181 | g_variant_unref (child); |
| 1182 | } |
| 1183 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 1184 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1185 | for (n = 0; n < num_params + 1; n++) |
| 1186 | g_value_unset (¶mv[n]); |
| 1187 | g_free (paramv); |
| 1188 | } |
| 1189 | |
| 1190 | static void |
| 1191 | fan_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 1192 | GVariant *changed_properties, |
| 1193 | const gchar *const *invalidated_properties) |
| 1194 | { |
| 1195 | FanProxy *proxy = FAN_PROXY (_proxy); |
| 1196 | guint n; |
| 1197 | const gchar *key; |
| 1198 | GVariantIter *iter; |
| 1199 | _ExtendedGDBusPropertyInfo *info; |
| 1200 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 1201 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1202 | { |
| 1203 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key); |
| 1204 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1205 | if (info != NULL) |
| 1206 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1207 | } |
| 1208 | g_variant_iter_free (iter); |
| 1209 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1210 | { |
| 1211 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]); |
| 1212 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1213 | if (info != NULL) |
| 1214 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1215 | } |
| 1216 | } |
| 1217 | |
| 1218 | static gint |
| 1219 | fan_proxy_get_speed (Fan *object) |
| 1220 | { |
| 1221 | FanProxy *proxy = FAN_PROXY (object); |
| 1222 | GVariant *variant; |
| 1223 | gint value = 0; |
| 1224 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed"); |
| 1225 | if (variant != NULL) |
| 1226 | { |
| 1227 | value = g_variant_get_int32 (variant); |
| 1228 | g_variant_unref (variant); |
| 1229 | } |
| 1230 | return value; |
| 1231 | } |
| 1232 | |
| 1233 | static gint |
| 1234 | fan_proxy_get_cooling_zone (Fan *object) |
| 1235 | { |
| 1236 | FanProxy *proxy = FAN_PROXY (object); |
| 1237 | GVariant *variant; |
| 1238 | gint value = 0; |
| 1239 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone"); |
| 1240 | if (variant != NULL) |
| 1241 | { |
| 1242 | value = g_variant_get_int32 (variant); |
| 1243 | g_variant_unref (variant); |
| 1244 | } |
| 1245 | return value; |
| 1246 | } |
| 1247 | |
| 1248 | static gint |
| 1249 | fan_proxy_get_pwm_num (Fan *object) |
| 1250 | { |
| 1251 | FanProxy *proxy = FAN_PROXY (object); |
| 1252 | GVariant *variant; |
| 1253 | gint value = 0; |
| 1254 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num"); |
| 1255 | if (variant != NULL) |
| 1256 | { |
| 1257 | value = g_variant_get_int32 (variant); |
| 1258 | g_variant_unref (variant); |
| 1259 | } |
| 1260 | return value; |
| 1261 | } |
| 1262 | |
| 1263 | static void |
| 1264 | fan_proxy_init (FanProxy *proxy) |
| 1265 | { |
| 1266 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1267 | proxy->priv = fan_proxy_get_instance_private (proxy); |
| 1268 | #else |
| 1269 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate); |
| 1270 | #endif |
| 1271 | |
| 1272 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ()); |
| 1273 | } |
| 1274 | |
| 1275 | static void |
| 1276 | fan_proxy_class_init (FanProxyClass *klass) |
| 1277 | { |
| 1278 | GObjectClass *gobject_class; |
| 1279 | GDBusProxyClass *proxy_class; |
| 1280 | |
| 1281 | gobject_class = G_OBJECT_CLASS (klass); |
| 1282 | gobject_class->finalize = fan_proxy_finalize; |
| 1283 | gobject_class->get_property = fan_proxy_get_property; |
| 1284 | gobject_class->set_property = fan_proxy_set_property; |
| 1285 | |
| 1286 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 1287 | proxy_class->g_signal = fan_proxy_g_signal; |
| 1288 | proxy_class->g_properties_changed = fan_proxy_g_properties_changed; |
| 1289 | |
| 1290 | fan_override_properties (gobject_class, 1); |
| 1291 | |
| 1292 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1293 | g_type_class_add_private (klass, sizeof (FanProxyPrivate)); |
| 1294 | #endif |
| 1295 | } |
| 1296 | |
| 1297 | static void |
| 1298 | fan_proxy_iface_init (FanIface *iface) |
| 1299 | { |
| 1300 | iface->get_speed = fan_proxy_get_speed; |
| 1301 | iface->get_cooling_zone = fan_proxy_get_cooling_zone; |
| 1302 | iface->get_pwm_num = fan_proxy_get_pwm_num; |
| 1303 | } |
| 1304 | |
| 1305 | /** |
| 1306 | * fan_proxy_new: |
| 1307 | * @connection: A #GDBusConnection. |
| 1308 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1309 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1310 | * @object_path: An object path. |
| 1311 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1312 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1313 | * @user_data: User data to pass to @callback. |
| 1314 | * |
| 1315 | * 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. |
| 1316 | * |
| 1317 | * 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. |
| 1318 | * You can then call fan_proxy_new_finish() to get the result of the operation. |
| 1319 | * |
| 1320 | * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 1321 | */ |
| 1322 | void |
| 1323 | fan_proxy_new ( |
| 1324 | GDBusConnection *connection, |
| 1325 | GDBusProxyFlags flags, |
| 1326 | const gchar *name, |
| 1327 | const gchar *object_path, |
| 1328 | GCancellable *cancellable, |
| 1329 | GAsyncReadyCallback callback, |
| 1330 | gpointer user_data) |
| 1331 | { |
| 1332 | 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); |
| 1333 | } |
| 1334 | |
| 1335 | /** |
| 1336 | * fan_proxy_new_finish: |
| 1337 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new(). |
| 1338 | * @error: Return location for error or %NULL |
| 1339 | * |
| 1340 | * Finishes an operation started with fan_proxy_new(). |
| 1341 | * |
| 1342 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 1343 | */ |
| 1344 | Fan * |
| 1345 | fan_proxy_new_finish ( |
| 1346 | GAsyncResult *res, |
| 1347 | GError **error) |
| 1348 | { |
| 1349 | GObject *ret; |
| 1350 | GObject *source_object; |
| 1351 | source_object = g_async_result_get_source_object (res); |
| 1352 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1353 | g_object_unref (source_object); |
| 1354 | if (ret != NULL) |
| 1355 | return FAN (ret); |
| 1356 | else |
| 1357 | return NULL; |
| 1358 | } |
| 1359 | |
| 1360 | /** |
| 1361 | * fan_proxy_new_sync: |
| 1362 | * @connection: A #GDBusConnection. |
| 1363 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1364 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1365 | * @object_path: An object path. |
| 1366 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1367 | * @error: Return location for error or %NULL |
| 1368 | * |
| 1369 | * 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. |
| 1370 | * |
| 1371 | * The calling thread is blocked until a reply is received. |
| 1372 | * |
| 1373 | * See fan_proxy_new() for the asynchronous version of this constructor. |
| 1374 | * |
| 1375 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 1376 | */ |
| 1377 | Fan * |
| 1378 | fan_proxy_new_sync ( |
| 1379 | GDBusConnection *connection, |
| 1380 | GDBusProxyFlags flags, |
| 1381 | const gchar *name, |
| 1382 | const gchar *object_path, |
| 1383 | GCancellable *cancellable, |
| 1384 | GError **error) |
| 1385 | { |
| 1386 | GInitable *ret; |
| 1387 | 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); |
| 1388 | if (ret != NULL) |
| 1389 | return FAN (ret); |
| 1390 | else |
| 1391 | return NULL; |
| 1392 | } |
| 1393 | |
| 1394 | |
| 1395 | /** |
| 1396 | * fan_proxy_new_for_bus: |
| 1397 | * @bus_type: A #GBusType. |
| 1398 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1399 | * @name: A bus name (well-known or unique). |
| 1400 | * @object_path: An object path. |
| 1401 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1402 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1403 | * @user_data: User data to pass to @callback. |
| 1404 | * |
| 1405 | * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 1406 | * |
| 1407 | * 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. |
| 1408 | * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation. |
| 1409 | * |
| 1410 | * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 1411 | */ |
| 1412 | void |
| 1413 | fan_proxy_new_for_bus ( |
| 1414 | GBusType bus_type, |
| 1415 | GDBusProxyFlags flags, |
| 1416 | const gchar *name, |
| 1417 | const gchar *object_path, |
| 1418 | GCancellable *cancellable, |
| 1419 | GAsyncReadyCallback callback, |
| 1420 | gpointer user_data) |
| 1421 | { |
| 1422 | 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); |
| 1423 | } |
| 1424 | |
| 1425 | /** |
| 1426 | * fan_proxy_new_for_bus_finish: |
| 1427 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus(). |
| 1428 | * @error: Return location for error or %NULL |
| 1429 | * |
| 1430 | * Finishes an operation started with fan_proxy_new_for_bus(). |
| 1431 | * |
| 1432 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 1433 | */ |
| 1434 | Fan * |
| 1435 | fan_proxy_new_for_bus_finish ( |
| 1436 | GAsyncResult *res, |
| 1437 | GError **error) |
| 1438 | { |
| 1439 | GObject *ret; |
| 1440 | GObject *source_object; |
| 1441 | source_object = g_async_result_get_source_object (res); |
| 1442 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1443 | g_object_unref (source_object); |
| 1444 | if (ret != NULL) |
| 1445 | return FAN (ret); |
| 1446 | else |
| 1447 | return NULL; |
| 1448 | } |
| 1449 | |
| 1450 | /** |
| 1451 | * fan_proxy_new_for_bus_sync: |
| 1452 | * @bus_type: A #GBusType. |
| 1453 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1454 | * @name: A bus name (well-known or unique). |
| 1455 | * @object_path: An object path. |
| 1456 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1457 | * @error: Return location for error or %NULL |
| 1458 | * |
| 1459 | * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 1460 | * |
| 1461 | * The calling thread is blocked until a reply is received. |
| 1462 | * |
| 1463 | * See fan_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 1464 | * |
| 1465 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 1466 | */ |
| 1467 | Fan * |
| 1468 | fan_proxy_new_for_bus_sync ( |
| 1469 | GBusType bus_type, |
| 1470 | GDBusProxyFlags flags, |
| 1471 | const gchar *name, |
| 1472 | const gchar *object_path, |
| 1473 | GCancellable *cancellable, |
| 1474 | GError **error) |
| 1475 | { |
| 1476 | GInitable *ret; |
| 1477 | 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); |
| 1478 | if (ret != NULL) |
| 1479 | return FAN (ret); |
| 1480 | else |
| 1481 | return NULL; |
| 1482 | } |
| 1483 | |
| 1484 | |
| 1485 | /* ------------------------------------------------------------------------ */ |
| 1486 | |
| 1487 | /** |
| 1488 | * FanSkeleton: |
| 1489 | * |
| 1490 | * The #FanSkeleton structure contains only private data and should only be accessed using the provided API. |
| 1491 | */ |
| 1492 | |
| 1493 | /** |
| 1494 | * FanSkeletonClass: |
| 1495 | * @parent_class: The parent class. |
| 1496 | * |
| 1497 | * Class structure for #FanSkeleton. |
| 1498 | */ |
| 1499 | |
| 1500 | struct _FanSkeletonPrivate |
| 1501 | { |
| 1502 | GValue *properties; |
| 1503 | GList *changed_properties; |
| 1504 | GSource *changed_properties_idle_source; |
| 1505 | GMainContext *context; |
| 1506 | GMutex lock; |
| 1507 | }; |
| 1508 | |
| 1509 | static void |
| 1510 | _fan_skeleton_handle_method_call ( |
| 1511 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1512 | const gchar *sender G_GNUC_UNUSED, |
| 1513 | const gchar *object_path G_GNUC_UNUSED, |
| 1514 | const gchar *interface_name, |
| 1515 | const gchar *method_name, |
| 1516 | GVariant *parameters, |
| 1517 | GDBusMethodInvocation *invocation, |
| 1518 | gpointer user_data) |
| 1519 | { |
| 1520 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 1521 | _ExtendedGDBusMethodInfo *info; |
| 1522 | GVariantIter iter; |
| 1523 | GVariant *child; |
| 1524 | GValue *paramv; |
| 1525 | guint num_params; |
| 1526 | guint num_extra; |
| 1527 | guint n; |
| 1528 | guint signal_id; |
| 1529 | GValue return_value = G_VALUE_INIT; |
| 1530 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1531 | g_assert (info != NULL); |
| 1532 | num_params = g_variant_n_children (parameters); |
| 1533 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1534 | n = 0; |
| 1535 | g_value_init (¶mv[n], TYPE_FAN); |
| 1536 | g_value_set_object (¶mv[n++], skeleton); |
| 1537 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1538 | g_value_set_object (¶mv[n++], invocation); |
| 1539 | if (info->pass_fdlist) |
| 1540 | { |
| 1541 | #ifdef G_OS_UNIX |
| 1542 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1543 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1544 | #else |
| 1545 | g_assert_not_reached (); |
| 1546 | #endif |
| 1547 | } |
| 1548 | g_variant_iter_init (&iter, parameters); |
| 1549 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1550 | { |
| 1551 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1552 | if (arg_info->use_gvariant) |
| 1553 | { |
| 1554 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1555 | g_value_set_variant (¶mv[n], child); |
| 1556 | n++; |
| 1557 | } |
| 1558 | else |
| 1559 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1560 | g_variant_unref (child); |
| 1561 | } |
| 1562 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 1563 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1564 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1565 | if (!g_value_get_boolean (&return_value)) |
| 1566 | 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); |
| 1567 | g_value_unset (&return_value); |
| 1568 | for (n = 0; n < num_params + num_extra; n++) |
| 1569 | g_value_unset (¶mv[n]); |
| 1570 | g_free (paramv); |
| 1571 | } |
| 1572 | |
| 1573 | static GVariant * |
| 1574 | _fan_skeleton_handle_get_property ( |
| 1575 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1576 | const gchar *sender G_GNUC_UNUSED, |
| 1577 | const gchar *object_path G_GNUC_UNUSED, |
| 1578 | const gchar *interface_name G_GNUC_UNUSED, |
| 1579 | const gchar *property_name, |
| 1580 | GError **error, |
| 1581 | gpointer user_data) |
| 1582 | { |
| 1583 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 1584 | GValue value = G_VALUE_INIT; |
| 1585 | GParamSpec *pspec; |
| 1586 | _ExtendedGDBusPropertyInfo *info; |
| 1587 | GVariant *ret; |
| 1588 | ret = NULL; |
| 1589 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 1590 | g_assert (info != NULL); |
| 1591 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1592 | if (pspec == NULL) |
| 1593 | { |
| 1594 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1595 | } |
| 1596 | else |
| 1597 | { |
| 1598 | g_value_init (&value, pspec->value_type); |
| 1599 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1600 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1601 | g_value_unset (&value); |
| 1602 | } |
| 1603 | return ret; |
| 1604 | } |
| 1605 | |
| 1606 | static gboolean |
| 1607 | _fan_skeleton_handle_set_property ( |
| 1608 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1609 | const gchar *sender G_GNUC_UNUSED, |
| 1610 | const gchar *object_path G_GNUC_UNUSED, |
| 1611 | const gchar *interface_name G_GNUC_UNUSED, |
| 1612 | const gchar *property_name, |
| 1613 | GVariant *variant, |
| 1614 | GError **error, |
| 1615 | gpointer user_data) |
| 1616 | { |
| 1617 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 1618 | GValue value = G_VALUE_INIT; |
| 1619 | GParamSpec *pspec; |
| 1620 | _ExtendedGDBusPropertyInfo *info; |
| 1621 | gboolean ret; |
| 1622 | ret = FALSE; |
| 1623 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 1624 | g_assert (info != NULL); |
| 1625 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1626 | if (pspec == NULL) |
| 1627 | { |
| 1628 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1629 | } |
| 1630 | else |
| 1631 | { |
| 1632 | if (info->use_gvariant) |
| 1633 | g_value_set_variant (&value, variant); |
| 1634 | else |
| 1635 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1636 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1637 | g_value_unset (&value); |
| 1638 | ret = TRUE; |
| 1639 | } |
| 1640 | return ret; |
| 1641 | } |
| 1642 | |
| 1643 | static const GDBusInterfaceVTable _fan_skeleton_vtable = |
| 1644 | { |
| 1645 | _fan_skeleton_handle_method_call, |
| 1646 | _fan_skeleton_handle_get_property, |
| 1647 | _fan_skeleton_handle_set_property, |
| 1648 | {NULL} |
| 1649 | }; |
| 1650 | |
| 1651 | static GDBusInterfaceInfo * |
| 1652 | fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1653 | { |
| 1654 | return fan_interface_info (); |
| 1655 | } |
| 1656 | |
| 1657 | static GDBusInterfaceVTable * |
| 1658 | fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1659 | { |
| 1660 | return (GDBusInterfaceVTable *) &_fan_skeleton_vtable; |
| 1661 | } |
| 1662 | |
| 1663 | static GVariant * |
| 1664 | fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 1665 | { |
| 1666 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 1667 | |
| 1668 | GVariantBuilder builder; |
| 1669 | guint n; |
| 1670 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1671 | if (_fan_interface_info.parent_struct.properties == NULL) |
| 1672 | goto out; |
| 1673 | for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++) |
| 1674 | { |
| 1675 | GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n]; |
| 1676 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1677 | { |
| 1678 | GVariant *value; |
| 1679 | 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); |
| 1680 | if (value != NULL) |
| 1681 | { |
| 1682 | g_variant_take_ref (value); |
| 1683 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1684 | g_variant_unref (value); |
| 1685 | } |
| 1686 | } |
| 1687 | } |
| 1688 | out: |
| 1689 | return g_variant_builder_end (&builder); |
| 1690 | } |
| 1691 | |
| 1692 | static gboolean _fan_emit_changed (gpointer user_data); |
| 1693 | |
| 1694 | static void |
| 1695 | fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 1696 | { |
| 1697 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 1698 | gboolean emit_changed = FALSE; |
| 1699 | |
| 1700 | g_mutex_lock (&skeleton->priv->lock); |
| 1701 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1702 | { |
| 1703 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1704 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1705 | emit_changed = TRUE; |
| 1706 | } |
| 1707 | g_mutex_unlock (&skeleton->priv->lock); |
| 1708 | |
| 1709 | if (emit_changed) |
| 1710 | _fan_emit_changed (skeleton); |
| 1711 | } |
| 1712 | |
| 1713 | static void |
| 1714 | _fan_on_signal_speed_changed ( |
| 1715 | Fan *object, |
| 1716 | gint arg_speed) |
| 1717 | { |
| 1718 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1719 | |
| 1720 | GList *connections, *l; |
| 1721 | GVariant *signal_variant; |
| 1722 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1723 | |
| 1724 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 1725 | arg_speed)); |
| 1726 | for (l = connections; l != NULL; l = l->next) |
| 1727 | { |
| 1728 | GDBusConnection *connection = l->data; |
| 1729 | g_dbus_connection_emit_signal (connection, |
| 1730 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged", |
| 1731 | signal_variant, NULL); |
| 1732 | } |
| 1733 | g_variant_unref (signal_variant); |
| 1734 | g_list_free_full (connections, g_object_unref); |
| 1735 | } |
| 1736 | |
| 1737 | static void |
| 1738 | _fan_on_signal_tach_error ( |
| 1739 | Fan *object) |
| 1740 | { |
| 1741 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1742 | |
| 1743 | GList *connections, *l; |
| 1744 | GVariant *signal_variant; |
| 1745 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1746 | |
| 1747 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 1748 | for (l = connections; l != NULL; l = l->next) |
| 1749 | { |
| 1750 | GDBusConnection *connection = l->data; |
| 1751 | g_dbus_connection_emit_signal (connection, |
| 1752 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError", |
| 1753 | signal_variant, NULL); |
| 1754 | } |
| 1755 | g_variant_unref (signal_variant); |
| 1756 | g_list_free_full (connections, g_object_unref); |
| 1757 | } |
| 1758 | |
| 1759 | static void fan_skeleton_iface_init (FanIface *iface); |
| 1760 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1761 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1762 | G_ADD_PRIVATE (FanSkeleton) |
| 1763 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 1764 | |
| 1765 | #else |
| 1766 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1767 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 1768 | |
| 1769 | #endif |
| 1770 | static void |
| 1771 | fan_skeleton_finalize (GObject *object) |
| 1772 | { |
| 1773 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1774 | guint n; |
| 1775 | for (n = 0; n < 3; n++) |
| 1776 | g_value_unset (&skeleton->priv->properties[n]); |
| 1777 | g_free (skeleton->priv->properties); |
| 1778 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1779 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1780 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1781 | g_main_context_unref (skeleton->priv->context); |
| 1782 | g_mutex_clear (&skeleton->priv->lock); |
| 1783 | G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object); |
| 1784 | } |
| 1785 | |
| 1786 | static void |
| 1787 | fan_skeleton_get_property (GObject *object, |
| 1788 | guint prop_id, |
| 1789 | GValue *value, |
| 1790 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1791 | { |
| 1792 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1793 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1794 | g_mutex_lock (&skeleton->priv->lock); |
| 1795 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1796 | g_mutex_unlock (&skeleton->priv->lock); |
| 1797 | } |
| 1798 | |
| 1799 | static gboolean |
| 1800 | _fan_emit_changed (gpointer user_data) |
| 1801 | { |
| 1802 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 1803 | GList *l; |
| 1804 | GVariantBuilder builder; |
| 1805 | GVariantBuilder invalidated_builder; |
| 1806 | guint num_changes; |
| 1807 | |
| 1808 | g_mutex_lock (&skeleton->priv->lock); |
| 1809 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1810 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1811 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1812 | { |
| 1813 | ChangedProperty *cp = l->data; |
| 1814 | GVariant *variant; |
| 1815 | const GValue *cur_value; |
| 1816 | |
| 1817 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1818 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1819 | { |
| 1820 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1821 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1822 | g_variant_unref (variant); |
| 1823 | num_changes++; |
| 1824 | } |
| 1825 | } |
| 1826 | if (num_changes > 0) |
| 1827 | { |
| 1828 | GList *connections, *ll; |
| 1829 | GVariant *signal_variant; |
| 1830 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan", |
| 1831 | &builder, &invalidated_builder)); |
| 1832 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1833 | for (ll = connections; ll != NULL; ll = ll->next) |
| 1834 | { |
| 1835 | GDBusConnection *connection = ll->data; |
| 1836 | |
| 1837 | g_dbus_connection_emit_signal (connection, |
| 1838 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 1839 | "org.freedesktop.DBus.Properties", |
| 1840 | "PropertiesChanged", |
| 1841 | signal_variant, |
| 1842 | NULL); |
| 1843 | } |
| 1844 | g_variant_unref (signal_variant); |
| 1845 | g_list_free_full (connections, g_object_unref); |
| 1846 | } |
| 1847 | else |
| 1848 | { |
| 1849 | g_variant_builder_clear (&builder); |
| 1850 | g_variant_builder_clear (&invalidated_builder); |
| 1851 | } |
| 1852 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1853 | skeleton->priv->changed_properties = NULL; |
| 1854 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1855 | g_mutex_unlock (&skeleton->priv->lock); |
| 1856 | return FALSE; |
| 1857 | } |
| 1858 | |
| 1859 | static void |
| 1860 | _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 1861 | { |
| 1862 | ChangedProperty *cp; |
| 1863 | GList *l; |
| 1864 | cp = NULL; |
| 1865 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 1866 | { |
| 1867 | ChangedProperty *i_cp = l->data; |
| 1868 | if (i_cp->info == info) |
| 1869 | { |
| 1870 | cp = i_cp; |
| 1871 | break; |
| 1872 | } |
| 1873 | } |
| 1874 | if (cp == NULL) |
| 1875 | { |
| 1876 | cp = g_new0 (ChangedProperty, 1); |
| 1877 | cp->prop_id = prop_id; |
| 1878 | cp->info = info; |
| 1879 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 1880 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 1881 | g_value_copy (orig_value, &cp->orig_value); |
| 1882 | } |
| 1883 | } |
| 1884 | |
| 1885 | static void |
| 1886 | fan_skeleton_notify (GObject *object, |
| 1887 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1888 | { |
| 1889 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1890 | g_mutex_lock (&skeleton->priv->lock); |
| 1891 | if (skeleton->priv->changed_properties != NULL && |
| 1892 | skeleton->priv->changed_properties_idle_source == NULL) |
| 1893 | { |
| 1894 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 1895 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 1896 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 1897 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 1898 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 1899 | } |
| 1900 | g_mutex_unlock (&skeleton->priv->lock); |
| 1901 | } |
| 1902 | |
| 1903 | static void |
| 1904 | fan_skeleton_set_property (GObject *object, |
| 1905 | guint prop_id, |
| 1906 | const GValue *value, |
| 1907 | GParamSpec *pspec) |
| 1908 | { |
| 1909 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1910 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1911 | g_mutex_lock (&skeleton->priv->lock); |
| 1912 | g_object_freeze_notify (object); |
| 1913 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 1914 | { |
| 1915 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 1916 | _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 1917 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 1918 | g_object_notify_by_pspec (object, pspec); |
| 1919 | } |
| 1920 | g_mutex_unlock (&skeleton->priv->lock); |
| 1921 | g_object_thaw_notify (object); |
| 1922 | } |
| 1923 | |
| 1924 | static void |
| 1925 | fan_skeleton_init (FanSkeleton *skeleton) |
| 1926 | { |
| 1927 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1928 | skeleton->priv = fan_skeleton_get_instance_private (skeleton); |
| 1929 | #else |
| 1930 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate); |
| 1931 | #endif |
| 1932 | |
| 1933 | g_mutex_init (&skeleton->priv->lock); |
| 1934 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 1935 | skeleton->priv->properties = g_new0 (GValue, 3); |
| 1936 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 1937 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 1938 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 1939 | } |
| 1940 | |
| 1941 | static gint |
| 1942 | fan_skeleton_get_speed (Fan *object) |
| 1943 | { |
| 1944 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1945 | gint value; |
| 1946 | g_mutex_lock (&skeleton->priv->lock); |
| 1947 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 1948 | g_mutex_unlock (&skeleton->priv->lock); |
| 1949 | return value; |
| 1950 | } |
| 1951 | |
| 1952 | static gint |
| 1953 | fan_skeleton_get_cooling_zone (Fan *object) |
| 1954 | { |
| 1955 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1956 | gint value; |
| 1957 | g_mutex_lock (&skeleton->priv->lock); |
| 1958 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 1959 | g_mutex_unlock (&skeleton->priv->lock); |
| 1960 | return value; |
| 1961 | } |
| 1962 | |
| 1963 | static gint |
| 1964 | fan_skeleton_get_pwm_num (Fan *object) |
| 1965 | { |
| 1966 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 1967 | gint value; |
| 1968 | g_mutex_lock (&skeleton->priv->lock); |
| 1969 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 1970 | g_mutex_unlock (&skeleton->priv->lock); |
| 1971 | return value; |
| 1972 | } |
| 1973 | |
| 1974 | static void |
| 1975 | fan_skeleton_class_init (FanSkeletonClass *klass) |
| 1976 | { |
| 1977 | GObjectClass *gobject_class; |
| 1978 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 1979 | |
| 1980 | gobject_class = G_OBJECT_CLASS (klass); |
| 1981 | gobject_class->finalize = fan_skeleton_finalize; |
| 1982 | gobject_class->get_property = fan_skeleton_get_property; |
| 1983 | gobject_class->set_property = fan_skeleton_set_property; |
| 1984 | gobject_class->notify = fan_skeleton_notify; |
| 1985 | |
| 1986 | |
| 1987 | fan_override_properties (gobject_class, 1); |
| 1988 | |
| 1989 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 1990 | skeleton_class->get_info = fan_skeleton_dbus_interface_get_info; |
| 1991 | skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties; |
| 1992 | skeleton_class->flush = fan_skeleton_dbus_interface_flush; |
| 1993 | skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable; |
| 1994 | |
| 1995 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1996 | g_type_class_add_private (klass, sizeof (FanSkeletonPrivate)); |
| 1997 | #endif |
| 1998 | } |
| 1999 | |
| 2000 | static void |
| 2001 | fan_skeleton_iface_init (FanIface *iface) |
| 2002 | { |
| 2003 | iface->speed_changed = _fan_on_signal_speed_changed; |
| 2004 | iface->tach_error = _fan_on_signal_tach_error; |
| 2005 | iface->get_speed = fan_skeleton_get_speed; |
| 2006 | iface->get_cooling_zone = fan_skeleton_get_cooling_zone; |
| 2007 | iface->get_pwm_num = fan_skeleton_get_pwm_num; |
| 2008 | } |
| 2009 | |
| 2010 | /** |
| 2011 | * fan_skeleton_new: |
| 2012 | * |
| 2013 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 2014 | * |
| 2015 | * Returns: (transfer full) (type FanSkeleton): The skeleton object. |
| 2016 | */ |
| 2017 | Fan * |
| 2018 | fan_skeleton_new (void) |
| 2019 | { |
| 2020 | return FAN (g_object_new (TYPE_FAN_SKELETON, NULL)); |
| 2021 | } |
| 2022 | |
| 2023 | /* ------------------------------------------------------------------------ |
| 2024 | * Code for interface org.openbmc.SensorValue |
| 2025 | * ------------------------------------------------------------------------ |
| 2026 | */ |
| 2027 | |
| 2028 | /** |
| 2029 | * SECTION:SensorValue |
| 2030 | * @title: SensorValue |
| 2031 | * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface |
| 2032 | * |
| 2033 | * 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. |
| 2034 | */ |
| 2035 | |
| 2036 | /* ---- Introspection data for org.openbmc.SensorValue ---- */ |
| 2037 | |
| 2038 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = |
| 2039 | { |
| 2040 | { |
| 2041 | -1, |
| 2042 | (gchar *) "init", |
| 2043 | NULL, |
| 2044 | NULL, |
| 2045 | NULL |
| 2046 | }, |
| 2047 | "handle-init", |
| 2048 | FALSE |
| 2049 | }; |
| 2050 | |
| 2051 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = |
| 2052 | { |
| 2053 | { |
| 2054 | -1, |
| 2055 | (gchar *) "value", |
| 2056 | (gchar *) "v", |
| 2057 | NULL |
| 2058 | }, |
| 2059 | FALSE |
| 2060 | }; |
| 2061 | |
| 2062 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = |
| 2063 | { |
| 2064 | &_sensor_value_method_info_get_value_OUT_ARG_value, |
| 2065 | NULL |
| 2066 | }; |
| 2067 | |
| 2068 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = |
| 2069 | { |
| 2070 | { |
| 2071 | -1, |
| 2072 | (gchar *) "getValue", |
| 2073 | NULL, |
| 2074 | (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, |
| 2075 | NULL |
| 2076 | }, |
| 2077 | "handle-get-value", |
| 2078 | FALSE |
| 2079 | }; |
| 2080 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2081 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = |
| 2082 | { |
| 2083 | { |
| 2084 | -1, |
| 2085 | (gchar *) "value", |
| 2086 | (gchar *) "v", |
| 2087 | NULL |
| 2088 | }, |
| 2089 | FALSE |
| 2090 | }; |
| 2091 | |
| 2092 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = |
| 2093 | { |
| 2094 | &_sensor_value_method_info_set_value_IN_ARG_value, |
| 2095 | NULL |
| 2096 | }; |
| 2097 | |
| 2098 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = |
| 2099 | { |
| 2100 | { |
| 2101 | -1, |
| 2102 | (gchar *) "setValue", |
| 2103 | (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, |
| 2104 | NULL, |
| 2105 | NULL |
| 2106 | }, |
| 2107 | "handle-set-value", |
| 2108 | FALSE |
| 2109 | }; |
| 2110 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2111 | static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = |
| 2112 | { |
| 2113 | &_sensor_value_method_info_init, |
| 2114 | &_sensor_value_method_info_get_value, |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2115 | &_sensor_value_method_info_set_value, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2116 | NULL |
| 2117 | }; |
| 2118 | |
| 2119 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = |
| 2120 | { |
| 2121 | { |
| 2122 | -1, |
| 2123 | (gchar *) "value", |
| 2124 | (gchar *) "v", |
| 2125 | NULL |
| 2126 | }, |
| 2127 | FALSE |
| 2128 | }; |
| 2129 | |
| 2130 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = |
| 2131 | { |
| 2132 | { |
| 2133 | -1, |
| 2134 | (gchar *) "units", |
| 2135 | (gchar *) "s", |
| 2136 | NULL |
| 2137 | }, |
| 2138 | FALSE |
| 2139 | }; |
| 2140 | |
| 2141 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = |
| 2142 | { |
| 2143 | &_sensor_value_signal_info_changed_ARG_value, |
| 2144 | &_sensor_value_signal_info_changed_ARG_units, |
| 2145 | NULL |
| 2146 | }; |
| 2147 | |
| 2148 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = |
| 2149 | { |
| 2150 | { |
| 2151 | -1, |
| 2152 | (gchar *) "Changed", |
| 2153 | (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, |
| 2154 | NULL |
| 2155 | }, |
| 2156 | "changed" |
| 2157 | }; |
| 2158 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2159 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error = |
| 2160 | { |
| 2161 | { |
| 2162 | -1, |
| 2163 | (gchar *) "Error", |
| 2164 | NULL, |
| 2165 | NULL |
| 2166 | }, |
| 2167 | "error" |
| 2168 | }; |
| 2169 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2170 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = |
| 2171 | { |
| 2172 | { |
| 2173 | -1, |
| 2174 | (gchar *) "bus_name", |
| 2175 | (gchar *) "s", |
| 2176 | NULL |
| 2177 | }, |
| 2178 | FALSE |
| 2179 | }; |
| 2180 | |
| 2181 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = |
| 2182 | { |
| 2183 | &_sensor_value_signal_info_heartbeat_ARG_bus_name, |
| 2184 | NULL |
| 2185 | }; |
| 2186 | |
| 2187 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = |
| 2188 | { |
| 2189 | { |
| 2190 | -1, |
| 2191 | (gchar *) "Heartbeat", |
| 2192 | (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, |
| 2193 | NULL |
| 2194 | }, |
| 2195 | "heartbeat" |
| 2196 | }; |
| 2197 | |
| 2198 | static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = |
| 2199 | { |
| 2200 | &_sensor_value_signal_info_changed, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2201 | &_sensor_value_signal_info_error, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2202 | &_sensor_value_signal_info_heartbeat, |
| 2203 | NULL |
| 2204 | }; |
| 2205 | |
| 2206 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = |
| 2207 | { |
| 2208 | { |
| 2209 | -1, |
| 2210 | (gchar *) "value", |
| 2211 | (gchar *) "v", |
| 2212 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2213 | NULL |
| 2214 | }, |
| 2215 | "value", |
| 2216 | FALSE |
| 2217 | }; |
| 2218 | |
| 2219 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = |
| 2220 | { |
| 2221 | { |
| 2222 | -1, |
| 2223 | (gchar *) "units", |
| 2224 | (gchar *) "s", |
| 2225 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2226 | NULL |
| 2227 | }, |
| 2228 | "units", |
| 2229 | FALSE |
| 2230 | }; |
| 2231 | |
| 2232 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = |
| 2233 | { |
| 2234 | { |
| 2235 | -1, |
| 2236 | (gchar *) "poll_interval", |
| 2237 | (gchar *) "i", |
| 2238 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2239 | NULL |
| 2240 | }, |
| 2241 | "poll-interval", |
| 2242 | FALSE |
| 2243 | }; |
| 2244 | |
| 2245 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = |
| 2246 | { |
| 2247 | { |
| 2248 | -1, |
| 2249 | (gchar *) "heatbeat", |
| 2250 | (gchar *) "i", |
| 2251 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2252 | NULL |
| 2253 | }, |
| 2254 | "heatbeat", |
| 2255 | FALSE |
| 2256 | }; |
| 2257 | |
| 2258 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = |
| 2259 | { |
| 2260 | { |
| 2261 | -1, |
| 2262 | (gchar *) "settable", |
| 2263 | (gchar *) "b", |
| 2264 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2265 | NULL |
| 2266 | }, |
| 2267 | "settable", |
| 2268 | FALSE |
| 2269 | }; |
| 2270 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2271 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
| 2272 | { |
| 2273 | &_sensor_value_property_info_value, |
| 2274 | &_sensor_value_property_info_units, |
| 2275 | &_sensor_value_property_info_poll_interval, |
| 2276 | &_sensor_value_property_info_heatbeat, |
| 2277 | &_sensor_value_property_info_settable, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2278 | NULL |
| 2279 | }; |
| 2280 | |
| 2281 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
| 2282 | { |
| 2283 | { |
| 2284 | -1, |
| 2285 | (gchar *) "org.openbmc.SensorValue", |
| 2286 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 2287 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 2288 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
| 2289 | NULL |
| 2290 | }, |
| 2291 | "sensor-value", |
| 2292 | }; |
| 2293 | |
| 2294 | |
| 2295 | /** |
| 2296 | * sensor_value_interface_info: |
| 2297 | * |
| 2298 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. |
| 2299 | * |
| 2300 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 2301 | */ |
| 2302 | GDBusInterfaceInfo * |
| 2303 | sensor_value_interface_info (void) |
| 2304 | { |
| 2305 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
| 2306 | } |
| 2307 | |
| 2308 | /** |
| 2309 | * sensor_value_override_properties: |
| 2310 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 2311 | * @property_id_begin: The property id to assign to the first overridden property. |
| 2312 | * |
| 2313 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
| 2314 | * The properties are overridden in the order they are defined. |
| 2315 | * |
| 2316 | * Returns: The last property id. |
| 2317 | */ |
| 2318 | guint |
| 2319 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
| 2320 | { |
| 2321 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 2322 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 2323 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 2324 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 2325 | g_object_class_override_property (klass, property_id_begin++, "settable"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2326 | return property_id_begin - 1; |
| 2327 | } |
| 2328 | |
| 2329 | |
| 2330 | |
| 2331 | /** |
| 2332 | * SensorValue: |
| 2333 | * |
| 2334 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 2335 | */ |
| 2336 | |
| 2337 | /** |
| 2338 | * SensorValueIface: |
| 2339 | * @parent_iface: The parent interface. |
| 2340 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 2341 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2342 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2343 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2344 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
| 2345 | * @get_settable: Getter for the #SensorValue:settable property. |
| 2346 | * @get_units: Getter for the #SensorValue:units property. |
| 2347 | * @get_value: Getter for the #SensorValue:value property. |
| 2348 | * @changed: Handler for the #SensorValue::changed signal. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2349 | * @error: Handler for the #SensorValue::error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2350 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
| 2351 | * |
| 2352 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 2353 | */ |
| 2354 | |
| 2355 | typedef SensorValueIface SensorValueInterface; |
| 2356 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
| 2357 | |
| 2358 | static void |
| 2359 | sensor_value_default_init (SensorValueIface *iface) |
| 2360 | { |
| 2361 | /* GObject signals for incoming D-Bus method calls: */ |
| 2362 | /** |
| 2363 | * SensorValue::handle-init: |
| 2364 | * @object: A #SensorValue. |
| 2365 | * @invocation: A #GDBusMethodInvocation. |
| 2366 | * |
| 2367 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. |
| 2368 | * |
| 2369 | * 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. |
| 2370 | * |
| 2371 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2372 | */ |
| 2373 | g_signal_new ("handle-init", |
| 2374 | G_TYPE_FROM_INTERFACE (iface), |
| 2375 | G_SIGNAL_RUN_LAST, |
| 2376 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
| 2377 | g_signal_accumulator_true_handled, |
| 2378 | NULL, |
| 2379 | g_cclosure_marshal_generic, |
| 2380 | G_TYPE_BOOLEAN, |
| 2381 | 1, |
| 2382 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 2383 | |
| 2384 | /** |
| 2385 | * SensorValue::handle-get-value: |
| 2386 | * @object: A #SensorValue. |
| 2387 | * @invocation: A #GDBusMethodInvocation. |
| 2388 | * |
| 2389 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. |
| 2390 | * |
| 2391 | * 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. |
| 2392 | * |
| 2393 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2394 | */ |
| 2395 | g_signal_new ("handle-get-value", |
| 2396 | G_TYPE_FROM_INTERFACE (iface), |
| 2397 | G_SIGNAL_RUN_LAST, |
| 2398 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
| 2399 | g_signal_accumulator_true_handled, |
| 2400 | NULL, |
| 2401 | g_cclosure_marshal_generic, |
| 2402 | G_TYPE_BOOLEAN, |
| 2403 | 1, |
| 2404 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 2405 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2406 | /** |
| 2407 | * SensorValue::handle-set-value: |
| 2408 | * @object: A #SensorValue. |
| 2409 | * @invocation: A #GDBusMethodInvocation. |
| 2410 | * @arg_value: Argument passed by remote caller. |
| 2411 | * |
| 2412 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. |
| 2413 | * |
| 2414 | * 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. |
| 2415 | * |
| 2416 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2417 | */ |
| 2418 | g_signal_new ("handle-set-value", |
| 2419 | G_TYPE_FROM_INTERFACE (iface), |
| 2420 | G_SIGNAL_RUN_LAST, |
| 2421 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
| 2422 | g_signal_accumulator_true_handled, |
| 2423 | NULL, |
| 2424 | g_cclosure_marshal_generic, |
| 2425 | G_TYPE_BOOLEAN, |
| 2426 | 2, |
| 2427 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 2428 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2429 | /* GObject signals for received D-Bus signals: */ |
| 2430 | /** |
| 2431 | * SensorValue::changed: |
| 2432 | * @object: A #SensorValue. |
| 2433 | * @arg_value: Argument. |
| 2434 | * @arg_units: Argument. |
| 2435 | * |
| 2436 | * 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. |
| 2437 | * |
| 2438 | * 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. |
| 2439 | */ |
| 2440 | g_signal_new ("changed", |
| 2441 | G_TYPE_FROM_INTERFACE (iface), |
| 2442 | G_SIGNAL_RUN_LAST, |
| 2443 | G_STRUCT_OFFSET (SensorValueIface, changed), |
| 2444 | NULL, |
| 2445 | NULL, |
| 2446 | g_cclosure_marshal_generic, |
| 2447 | G_TYPE_NONE, |
| 2448 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
| 2449 | |
| 2450 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2451 | * SensorValue::error: |
| 2452 | * @object: A #SensorValue. |
| 2453 | * |
| 2454 | * 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. |
| 2455 | * |
| 2456 | * 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. |
| 2457 | */ |
| 2458 | g_signal_new ("error", |
| 2459 | G_TYPE_FROM_INTERFACE (iface), |
| 2460 | G_SIGNAL_RUN_LAST, |
| 2461 | G_STRUCT_OFFSET (SensorValueIface, error), |
| 2462 | NULL, |
| 2463 | NULL, |
| 2464 | g_cclosure_marshal_generic, |
| 2465 | G_TYPE_NONE, |
| 2466 | 0); |
| 2467 | |
| 2468 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2469 | * SensorValue::heartbeat: |
| 2470 | * @object: A #SensorValue. |
| 2471 | * @arg_bus_name: Argument. |
| 2472 | * |
| 2473 | * 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. |
| 2474 | * |
| 2475 | * 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. |
| 2476 | */ |
| 2477 | g_signal_new ("heartbeat", |
| 2478 | G_TYPE_FROM_INTERFACE (iface), |
| 2479 | G_SIGNAL_RUN_LAST, |
| 2480 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
| 2481 | NULL, |
| 2482 | NULL, |
| 2483 | g_cclosure_marshal_generic, |
| 2484 | G_TYPE_NONE, |
| 2485 | 1, G_TYPE_STRING); |
| 2486 | |
| 2487 | /* GObject properties for D-Bus properties: */ |
| 2488 | /** |
| 2489 | * SensorValue:value: |
| 2490 | * |
| 2491 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. |
| 2492 | * |
| 2493 | * 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. |
| 2494 | */ |
| 2495 | g_object_interface_install_property (iface, |
| 2496 | g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2497 | /** |
| 2498 | * SensorValue:units: |
| 2499 | * |
| 2500 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. |
| 2501 | * |
| 2502 | * 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. |
| 2503 | */ |
| 2504 | g_object_interface_install_property (iface, |
| 2505 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2506 | /** |
| 2507 | * SensorValue:poll-interval: |
| 2508 | * |
| 2509 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. |
| 2510 | * |
| 2511 | * 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. |
| 2512 | */ |
| 2513 | g_object_interface_install_property (iface, |
| 2514 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2515 | /** |
| 2516 | * SensorValue:heatbeat: |
| 2517 | * |
| 2518 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. |
| 2519 | * |
| 2520 | * 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. |
| 2521 | */ |
| 2522 | g_object_interface_install_property (iface, |
| 2523 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2524 | /** |
| 2525 | * SensorValue:settable: |
| 2526 | * |
| 2527 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. |
| 2528 | * |
| 2529 | * 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. |
| 2530 | */ |
| 2531 | g_object_interface_install_property (iface, |
| 2532 | g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2533 | } |
| 2534 | |
| 2535 | /** |
| 2536 | * sensor_value_get_value: (skip) |
| 2537 | * @object: A #SensorValue. |
| 2538 | * |
| 2539 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 2540 | * |
| 2541 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2542 | * |
| 2543 | * <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> |
| 2544 | * |
| 2545 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 2546 | */ |
| 2547 | GVariant * |
| 2548 | sensor_value_get_value (SensorValue *object) |
| 2549 | { |
| 2550 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
| 2551 | } |
| 2552 | |
| 2553 | /** |
| 2554 | * sensor_value_dup_value: (skip) |
| 2555 | * @object: A #SensorValue. |
| 2556 | * |
| 2557 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 2558 | * |
| 2559 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2560 | * |
| 2561 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2562 | */ |
| 2563 | GVariant * |
| 2564 | sensor_value_dup_value (SensorValue *object) |
| 2565 | { |
| 2566 | GVariant *value; |
| 2567 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 2568 | return value; |
| 2569 | } |
| 2570 | |
| 2571 | /** |
| 2572 | * sensor_value_set_value: (skip) |
| 2573 | * @object: A #SensorValue. |
| 2574 | * @value: The value to set. |
| 2575 | * |
| 2576 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. |
| 2577 | * |
| 2578 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2579 | */ |
| 2580 | void |
| 2581 | sensor_value_set_value (SensorValue *object, GVariant *value) |
| 2582 | { |
| 2583 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 2584 | } |
| 2585 | |
| 2586 | /** |
| 2587 | * sensor_value_get_units: (skip) |
| 2588 | * @object: A #SensorValue. |
| 2589 | * |
| 2590 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 2591 | * |
| 2592 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2593 | * |
| 2594 | * <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> |
| 2595 | * |
| 2596 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 2597 | */ |
| 2598 | const gchar * |
| 2599 | sensor_value_get_units (SensorValue *object) |
| 2600 | { |
| 2601 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
| 2602 | } |
| 2603 | |
| 2604 | /** |
| 2605 | * sensor_value_dup_units: (skip) |
| 2606 | * @object: A #SensorValue. |
| 2607 | * |
| 2608 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 2609 | * |
| 2610 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2611 | * |
| 2612 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 2613 | */ |
| 2614 | gchar * |
| 2615 | sensor_value_dup_units (SensorValue *object) |
| 2616 | { |
| 2617 | gchar *value; |
| 2618 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 2619 | return value; |
| 2620 | } |
| 2621 | |
| 2622 | /** |
| 2623 | * sensor_value_set_units: (skip) |
| 2624 | * @object: A #SensorValue. |
| 2625 | * @value: The value to set. |
| 2626 | * |
| 2627 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. |
| 2628 | * |
| 2629 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2630 | */ |
| 2631 | void |
| 2632 | sensor_value_set_units (SensorValue *object, const gchar *value) |
| 2633 | { |
| 2634 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 2635 | } |
| 2636 | |
| 2637 | /** |
| 2638 | * sensor_value_get_poll_interval: (skip) |
| 2639 | * @object: A #SensorValue. |
| 2640 | * |
| 2641 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. |
| 2642 | * |
| 2643 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2644 | * |
| 2645 | * Returns: The property value. |
| 2646 | */ |
| 2647 | gint |
| 2648 | sensor_value_get_poll_interval (SensorValue *object) |
| 2649 | { |
| 2650 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
| 2651 | } |
| 2652 | |
| 2653 | /** |
| 2654 | * sensor_value_set_poll_interval: (skip) |
| 2655 | * @object: A #SensorValue. |
| 2656 | * @value: The value to set. |
| 2657 | * |
| 2658 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 2659 | * |
| 2660 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2661 | */ |
| 2662 | void |
| 2663 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
| 2664 | { |
| 2665 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 2666 | } |
| 2667 | |
| 2668 | /** |
| 2669 | * sensor_value_get_heatbeat: (skip) |
| 2670 | * @object: A #SensorValue. |
| 2671 | * |
| 2672 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. |
| 2673 | * |
| 2674 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2675 | * |
| 2676 | * Returns: The property value. |
| 2677 | */ |
| 2678 | gint |
| 2679 | sensor_value_get_heatbeat (SensorValue *object) |
| 2680 | { |
| 2681 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
| 2682 | } |
| 2683 | |
| 2684 | /** |
| 2685 | * sensor_value_set_heatbeat: (skip) |
| 2686 | * @object: A #SensorValue. |
| 2687 | * @value: The value to set. |
| 2688 | * |
| 2689 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 2690 | * |
| 2691 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2692 | */ |
| 2693 | void |
| 2694 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
| 2695 | { |
| 2696 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 2697 | } |
| 2698 | |
| 2699 | /** |
| 2700 | * sensor_value_get_settable: (skip) |
| 2701 | * @object: A #SensorValue. |
| 2702 | * |
| 2703 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. |
| 2704 | * |
| 2705 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2706 | * |
| 2707 | * Returns: The property value. |
| 2708 | */ |
| 2709 | gboolean |
| 2710 | sensor_value_get_settable (SensorValue *object) |
| 2711 | { |
| 2712 | return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); |
| 2713 | } |
| 2714 | |
| 2715 | /** |
| 2716 | * sensor_value_set_settable: (skip) |
| 2717 | * @object: A #SensorValue. |
| 2718 | * @value: The value to set. |
| 2719 | * |
| 2720 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. |
| 2721 | * |
| 2722 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2723 | */ |
| 2724 | void |
| 2725 | sensor_value_set_settable (SensorValue *object, gboolean value) |
| 2726 | { |
| 2727 | g_object_set (G_OBJECT (object), "settable", value, NULL); |
| 2728 | } |
| 2729 | |
| 2730 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2731 | * sensor_value_emit_changed: |
| 2732 | * @object: A #SensorValue. |
| 2733 | * @arg_value: Argument to pass with the signal. |
| 2734 | * @arg_units: Argument to pass with the signal. |
| 2735 | * |
| 2736 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. |
| 2737 | */ |
| 2738 | void |
| 2739 | sensor_value_emit_changed ( |
| 2740 | SensorValue *object, |
| 2741 | GVariant *arg_value, |
| 2742 | const gchar *arg_units) |
| 2743 | { |
| 2744 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
| 2745 | } |
| 2746 | |
| 2747 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2748 | * sensor_value_emit_error: |
| 2749 | * @object: A #SensorValue. |
| 2750 | * |
| 2751 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal. |
| 2752 | */ |
| 2753 | void |
| 2754 | sensor_value_emit_error ( |
| 2755 | SensorValue *object) |
| 2756 | { |
| 2757 | g_signal_emit_by_name (object, "error"); |
| 2758 | } |
| 2759 | |
| 2760 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2761 | * sensor_value_emit_heartbeat: |
| 2762 | * @object: A #SensorValue. |
| 2763 | * @arg_bus_name: Argument to pass with the signal. |
| 2764 | * |
| 2765 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 2766 | */ |
| 2767 | void |
| 2768 | sensor_value_emit_heartbeat ( |
| 2769 | SensorValue *object, |
| 2770 | const gchar *arg_bus_name) |
| 2771 | { |
| 2772 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 2773 | } |
| 2774 | |
| 2775 | /** |
| 2776 | * sensor_value_call_init: |
| 2777 | * @proxy: A #SensorValueProxy. |
| 2778 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2779 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2780 | * @user_data: User data to pass to @callback. |
| 2781 | * |
| 2782 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. |
| 2783 | * 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. |
| 2784 | * You can then call sensor_value_call_init_finish() to get the result of the operation. |
| 2785 | * |
| 2786 | * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. |
| 2787 | */ |
| 2788 | void |
| 2789 | sensor_value_call_init ( |
| 2790 | SensorValue *proxy, |
| 2791 | GCancellable *cancellable, |
| 2792 | GAsyncReadyCallback callback, |
| 2793 | gpointer user_data) |
| 2794 | { |
| 2795 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2796 | "init", |
| 2797 | g_variant_new ("()"), |
| 2798 | G_DBUS_CALL_FLAGS_NONE, |
| 2799 | -1, |
| 2800 | cancellable, |
| 2801 | callback, |
| 2802 | user_data); |
| 2803 | } |
| 2804 | |
| 2805 | /** |
| 2806 | * sensor_value_call_init_finish: |
| 2807 | * @proxy: A #SensorValueProxy. |
| 2808 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). |
| 2809 | * @error: Return location for error or %NULL. |
| 2810 | * |
| 2811 | * Finishes an operation started with sensor_value_call_init(). |
| 2812 | * |
| 2813 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2814 | */ |
| 2815 | gboolean |
| 2816 | sensor_value_call_init_finish ( |
| 2817 | SensorValue *proxy, |
| 2818 | GAsyncResult *res, |
| 2819 | GError **error) |
| 2820 | { |
| 2821 | GVariant *_ret; |
| 2822 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2823 | if (_ret == NULL) |
| 2824 | goto _out; |
| 2825 | g_variant_get (_ret, |
| 2826 | "()"); |
| 2827 | g_variant_unref (_ret); |
| 2828 | _out: |
| 2829 | return _ret != NULL; |
| 2830 | } |
| 2831 | |
| 2832 | /** |
| 2833 | * sensor_value_call_init_sync: |
| 2834 | * @proxy: A #SensorValueProxy. |
| 2835 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2836 | * @error: Return location for error or %NULL. |
| 2837 | * |
| 2838 | * 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. |
| 2839 | * |
| 2840 | * See sensor_value_call_init() for the asynchronous version of this method. |
| 2841 | * |
| 2842 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2843 | */ |
| 2844 | gboolean |
| 2845 | sensor_value_call_init_sync ( |
| 2846 | SensorValue *proxy, |
| 2847 | GCancellable *cancellable, |
| 2848 | GError **error) |
| 2849 | { |
| 2850 | GVariant *_ret; |
| 2851 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2852 | "init", |
| 2853 | g_variant_new ("()"), |
| 2854 | G_DBUS_CALL_FLAGS_NONE, |
| 2855 | -1, |
| 2856 | cancellable, |
| 2857 | error); |
| 2858 | if (_ret == NULL) |
| 2859 | goto _out; |
| 2860 | g_variant_get (_ret, |
| 2861 | "()"); |
| 2862 | g_variant_unref (_ret); |
| 2863 | _out: |
| 2864 | return _ret != NULL; |
| 2865 | } |
| 2866 | |
| 2867 | /** |
| 2868 | * sensor_value_call_get_value: |
| 2869 | * @proxy: A #SensorValueProxy. |
| 2870 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2871 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2872 | * @user_data: User data to pass to @callback. |
| 2873 | * |
| 2874 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. |
| 2875 | * 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. |
| 2876 | * You can then call sensor_value_call_get_value_finish() to get the result of the operation. |
| 2877 | * |
| 2878 | * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. |
| 2879 | */ |
| 2880 | void |
| 2881 | sensor_value_call_get_value ( |
| 2882 | SensorValue *proxy, |
| 2883 | GCancellable *cancellable, |
| 2884 | GAsyncReadyCallback callback, |
| 2885 | gpointer user_data) |
| 2886 | { |
| 2887 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2888 | "getValue", |
| 2889 | g_variant_new ("()"), |
| 2890 | G_DBUS_CALL_FLAGS_NONE, |
| 2891 | -1, |
| 2892 | cancellable, |
| 2893 | callback, |
| 2894 | user_data); |
| 2895 | } |
| 2896 | |
| 2897 | /** |
| 2898 | * sensor_value_call_get_value_finish: |
| 2899 | * @proxy: A #SensorValueProxy. |
| 2900 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 2901 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). |
| 2902 | * @error: Return location for error or %NULL. |
| 2903 | * |
| 2904 | * Finishes an operation started with sensor_value_call_get_value(). |
| 2905 | * |
| 2906 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2907 | */ |
| 2908 | gboolean |
| 2909 | sensor_value_call_get_value_finish ( |
| 2910 | SensorValue *proxy, |
| 2911 | GVariant **out_value, |
| 2912 | GAsyncResult *res, |
| 2913 | GError **error) |
| 2914 | { |
| 2915 | GVariant *_ret; |
| 2916 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2917 | if (_ret == NULL) |
| 2918 | goto _out; |
| 2919 | g_variant_get (_ret, |
| 2920 | "(@v)", |
| 2921 | out_value); |
| 2922 | g_variant_unref (_ret); |
| 2923 | _out: |
| 2924 | return _ret != NULL; |
| 2925 | } |
| 2926 | |
| 2927 | /** |
| 2928 | * sensor_value_call_get_value_sync: |
| 2929 | * @proxy: A #SensorValueProxy. |
| 2930 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 2931 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2932 | * @error: Return location for error or %NULL. |
| 2933 | * |
| 2934 | * 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. |
| 2935 | * |
| 2936 | * See sensor_value_call_get_value() for the asynchronous version of this method. |
| 2937 | * |
| 2938 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2939 | */ |
| 2940 | gboolean |
| 2941 | sensor_value_call_get_value_sync ( |
| 2942 | SensorValue *proxy, |
| 2943 | GVariant **out_value, |
| 2944 | GCancellable *cancellable, |
| 2945 | GError **error) |
| 2946 | { |
| 2947 | GVariant *_ret; |
| 2948 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2949 | "getValue", |
| 2950 | g_variant_new ("()"), |
| 2951 | G_DBUS_CALL_FLAGS_NONE, |
| 2952 | -1, |
| 2953 | cancellable, |
| 2954 | error); |
| 2955 | if (_ret == NULL) |
| 2956 | goto _out; |
| 2957 | g_variant_get (_ret, |
| 2958 | "(@v)", |
| 2959 | out_value); |
| 2960 | g_variant_unref (_ret); |
| 2961 | _out: |
| 2962 | return _ret != NULL; |
| 2963 | } |
| 2964 | |
| 2965 | /** |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2966 | * sensor_value_call_set_value: |
| 2967 | * @proxy: A #SensorValueProxy. |
| 2968 | * @arg_value: Argument to pass with the method invocation. |
| 2969 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2970 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2971 | * @user_data: User data to pass to @callback. |
| 2972 | * |
| 2973 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. |
| 2974 | * 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. |
| 2975 | * You can then call sensor_value_call_set_value_finish() to get the result of the operation. |
| 2976 | * |
| 2977 | * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. |
| 2978 | */ |
| 2979 | void |
| 2980 | sensor_value_call_set_value ( |
| 2981 | SensorValue *proxy, |
| 2982 | GVariant *arg_value, |
| 2983 | GCancellable *cancellable, |
| 2984 | GAsyncReadyCallback callback, |
| 2985 | gpointer user_data) |
| 2986 | { |
| 2987 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2988 | "setValue", |
| 2989 | g_variant_new ("(@v)", |
| 2990 | arg_value), |
| 2991 | G_DBUS_CALL_FLAGS_NONE, |
| 2992 | -1, |
| 2993 | cancellable, |
| 2994 | callback, |
| 2995 | user_data); |
| 2996 | } |
| 2997 | |
| 2998 | /** |
| 2999 | * sensor_value_call_set_value_finish: |
| 3000 | * @proxy: A #SensorValueProxy. |
| 3001 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). |
| 3002 | * @error: Return location for error or %NULL. |
| 3003 | * |
| 3004 | * Finishes an operation started with sensor_value_call_set_value(). |
| 3005 | * |
| 3006 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3007 | */ |
| 3008 | gboolean |
| 3009 | sensor_value_call_set_value_finish ( |
| 3010 | SensorValue *proxy, |
| 3011 | GAsyncResult *res, |
| 3012 | GError **error) |
| 3013 | { |
| 3014 | GVariant *_ret; |
| 3015 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3016 | if (_ret == NULL) |
| 3017 | goto _out; |
| 3018 | g_variant_get (_ret, |
| 3019 | "()"); |
| 3020 | g_variant_unref (_ret); |
| 3021 | _out: |
| 3022 | return _ret != NULL; |
| 3023 | } |
| 3024 | |
| 3025 | /** |
| 3026 | * sensor_value_call_set_value_sync: |
| 3027 | * @proxy: A #SensorValueProxy. |
| 3028 | * @arg_value: Argument to pass with the method invocation. |
| 3029 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3030 | * @error: Return location for error or %NULL. |
| 3031 | * |
| 3032 | * 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. |
| 3033 | * |
| 3034 | * See sensor_value_call_set_value() for the asynchronous version of this method. |
| 3035 | * |
| 3036 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3037 | */ |
| 3038 | gboolean |
| 3039 | sensor_value_call_set_value_sync ( |
| 3040 | SensorValue *proxy, |
| 3041 | GVariant *arg_value, |
| 3042 | GCancellable *cancellable, |
| 3043 | GError **error) |
| 3044 | { |
| 3045 | GVariant *_ret; |
| 3046 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3047 | "setValue", |
| 3048 | g_variant_new ("(@v)", |
| 3049 | arg_value), |
| 3050 | G_DBUS_CALL_FLAGS_NONE, |
| 3051 | -1, |
| 3052 | cancellable, |
| 3053 | error); |
| 3054 | if (_ret == NULL) |
| 3055 | goto _out; |
| 3056 | g_variant_get (_ret, |
| 3057 | "()"); |
| 3058 | g_variant_unref (_ret); |
| 3059 | _out: |
| 3060 | return _ret != NULL; |
| 3061 | } |
| 3062 | |
| 3063 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3064 | * sensor_value_complete_init: |
| 3065 | * @object: A #SensorValue. |
| 3066 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3067 | * |
| 3068 | * 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. |
| 3069 | * |
| 3070 | * This method will free @invocation, you cannot use it afterwards. |
| 3071 | */ |
| 3072 | void |
| 3073 | sensor_value_complete_init ( |
| 3074 | SensorValue *object, |
| 3075 | GDBusMethodInvocation *invocation) |
| 3076 | { |
| 3077 | g_dbus_method_invocation_return_value (invocation, |
| 3078 | g_variant_new ("()")); |
| 3079 | } |
| 3080 | |
| 3081 | /** |
| 3082 | * sensor_value_complete_get_value: |
| 3083 | * @object: A #SensorValue. |
| 3084 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3085 | * @value: Parameter to return. |
| 3086 | * |
| 3087 | * 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. |
| 3088 | * |
| 3089 | * This method will free @invocation, you cannot use it afterwards. |
| 3090 | */ |
| 3091 | void |
| 3092 | sensor_value_complete_get_value ( |
| 3093 | SensorValue *object, |
| 3094 | GDBusMethodInvocation *invocation, |
| 3095 | GVariant *value) |
| 3096 | { |
| 3097 | g_dbus_method_invocation_return_value (invocation, |
| 3098 | g_variant_new ("(@v)", |
| 3099 | value)); |
| 3100 | } |
| 3101 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 3102 | /** |
| 3103 | * sensor_value_complete_set_value: |
| 3104 | * @object: A #SensorValue. |
| 3105 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3106 | * |
| 3107 | * 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. |
| 3108 | * |
| 3109 | * This method will free @invocation, you cannot use it afterwards. |
| 3110 | */ |
| 3111 | void |
| 3112 | sensor_value_complete_set_value ( |
| 3113 | SensorValue *object, |
| 3114 | GDBusMethodInvocation *invocation) |
| 3115 | { |
| 3116 | g_dbus_method_invocation_return_value (invocation, |
| 3117 | g_variant_new ("()")); |
| 3118 | } |
| 3119 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3120 | /* ------------------------------------------------------------------------ */ |
| 3121 | |
| 3122 | /** |
| 3123 | * SensorValueProxy: |
| 3124 | * |
| 3125 | * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. |
| 3126 | */ |
| 3127 | |
| 3128 | /** |
| 3129 | * SensorValueProxyClass: |
| 3130 | * @parent_class: The parent class. |
| 3131 | * |
| 3132 | * Class structure for #SensorValueProxy. |
| 3133 | */ |
| 3134 | |
| 3135 | struct _SensorValueProxyPrivate |
| 3136 | { |
| 3137 | GData *qdata; |
| 3138 | }; |
| 3139 | |
| 3140 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
| 3141 | |
| 3142 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3143 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 3144 | G_ADD_PRIVATE (SensorValueProxy) |
| 3145 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 3146 | |
| 3147 | #else |
| 3148 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 3149 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 3150 | |
| 3151 | #endif |
| 3152 | static void |
| 3153 | sensor_value_proxy_finalize (GObject *object) |
| 3154 | { |
| 3155 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3156 | g_datalist_clear (&proxy->priv->qdata); |
| 3157 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
| 3158 | } |
| 3159 | |
| 3160 | static void |
| 3161 | sensor_value_proxy_get_property (GObject *object, |
| 3162 | guint prop_id, |
| 3163 | GValue *value, |
| 3164 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3165 | { |
| 3166 | const _ExtendedGDBusPropertyInfo *info; |
| 3167 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 3168 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3169 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 3170 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3171 | if (info->use_gvariant) |
| 3172 | { |
| 3173 | g_value_set_variant (value, variant); |
| 3174 | } |
| 3175 | else |
| 3176 | { |
| 3177 | if (variant != NULL) |
| 3178 | g_dbus_gvariant_to_gvalue (variant, value); |
| 3179 | } |
| 3180 | if (variant != NULL) |
| 3181 | g_variant_unref (variant); |
| 3182 | } |
| 3183 | |
| 3184 | static void |
| 3185 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
| 3186 | GAsyncResult *res, |
| 3187 | gpointer user_data) |
| 3188 | { |
| 3189 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 3190 | GError *error; |
| 3191 | GVariant *_ret; |
| 3192 | error = NULL; |
| 3193 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 3194 | if (!_ret) |
| 3195 | { |
| 3196 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", |
| 3197 | info->parent_struct.name, |
| 3198 | error->message, g_quark_to_string (error->domain), error->code); |
| 3199 | g_error_free (error); |
| 3200 | } |
| 3201 | else |
| 3202 | { |
| 3203 | g_variant_unref (_ret); |
| 3204 | } |
| 3205 | } |
| 3206 | |
| 3207 | static void |
| 3208 | sensor_value_proxy_set_property (GObject *object, |
| 3209 | guint prop_id, |
| 3210 | const GValue *value, |
| 3211 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3212 | { |
| 3213 | const _ExtendedGDBusPropertyInfo *info; |
| 3214 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 3215 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3216 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 3217 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3218 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 3219 | "org.freedesktop.DBus.Properties.Set", |
| 3220 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
| 3221 | G_DBUS_CALL_FLAGS_NONE, |
| 3222 | -1, |
| 3223 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 3224 | g_variant_unref (variant); |
| 3225 | } |
| 3226 | |
| 3227 | static void |
| 3228 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
| 3229 | const gchar *sender_name G_GNUC_UNUSED, |
| 3230 | const gchar *signal_name, |
| 3231 | GVariant *parameters) |
| 3232 | { |
| 3233 | _ExtendedGDBusSignalInfo *info; |
| 3234 | GVariantIter iter; |
| 3235 | GVariant *child; |
| 3236 | GValue *paramv; |
| 3237 | guint num_params; |
| 3238 | guint n; |
| 3239 | guint signal_id; |
| 3240 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); |
| 3241 | if (info == NULL) |
| 3242 | return; |
| 3243 | num_params = g_variant_n_children (parameters); |
| 3244 | paramv = g_new0 (GValue, num_params + 1); |
| 3245 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
| 3246 | g_value_set_object (¶mv[0], proxy); |
| 3247 | g_variant_iter_init (&iter, parameters); |
| 3248 | n = 1; |
| 3249 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3250 | { |
| 3251 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 3252 | if (arg_info->use_gvariant) |
| 3253 | { |
| 3254 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3255 | g_value_set_variant (¶mv[n], child); |
| 3256 | n++; |
| 3257 | } |
| 3258 | else |
| 3259 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3260 | g_variant_unref (child); |
| 3261 | } |
| 3262 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 3263 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 3264 | for (n = 0; n < num_params + 1; n++) |
| 3265 | g_value_unset (¶mv[n]); |
| 3266 | g_free (paramv); |
| 3267 | } |
| 3268 | |
| 3269 | static void |
| 3270 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 3271 | GVariant *changed_properties, |
| 3272 | const gchar *const *invalidated_properties) |
| 3273 | { |
| 3274 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
| 3275 | guint n; |
| 3276 | const gchar *key; |
| 3277 | GVariantIter *iter; |
| 3278 | _ExtendedGDBusPropertyInfo *info; |
| 3279 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 3280 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 3281 | { |
| 3282 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); |
| 3283 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 3284 | if (info != NULL) |
| 3285 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3286 | } |
| 3287 | g_variant_iter_free (iter); |
| 3288 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 3289 | { |
| 3290 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); |
| 3291 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 3292 | if (info != NULL) |
| 3293 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3294 | } |
| 3295 | } |
| 3296 | |
| 3297 | static GVariant * |
| 3298 | sensor_value_proxy_get_value (SensorValue *object) |
| 3299 | { |
| 3300 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3301 | GVariant *variant; |
| 3302 | GVariant *value = NULL; |
| 3303 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 3304 | value = variant; |
| 3305 | if (variant != NULL) |
| 3306 | g_variant_unref (variant); |
| 3307 | return value; |
| 3308 | } |
| 3309 | |
| 3310 | static const gchar * |
| 3311 | sensor_value_proxy_get_units (SensorValue *object) |
| 3312 | { |
| 3313 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3314 | GVariant *variant; |
| 3315 | const gchar *value = NULL; |
| 3316 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 3317 | if (variant != NULL) |
| 3318 | { |
| 3319 | value = g_variant_get_string (variant, NULL); |
| 3320 | g_variant_unref (variant); |
| 3321 | } |
| 3322 | return value; |
| 3323 | } |
| 3324 | |
| 3325 | static gint |
| 3326 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
| 3327 | { |
| 3328 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3329 | GVariant *variant; |
| 3330 | gint value = 0; |
| 3331 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 3332 | if (variant != NULL) |
| 3333 | { |
| 3334 | value = g_variant_get_int32 (variant); |
| 3335 | g_variant_unref (variant); |
| 3336 | } |
| 3337 | return value; |
| 3338 | } |
| 3339 | |
| 3340 | static gint |
| 3341 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
| 3342 | { |
| 3343 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3344 | GVariant *variant; |
| 3345 | gint value = 0; |
| 3346 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 3347 | if (variant != NULL) |
| 3348 | { |
| 3349 | value = g_variant_get_int32 (variant); |
| 3350 | g_variant_unref (variant); |
| 3351 | } |
| 3352 | return value; |
| 3353 | } |
| 3354 | |
| 3355 | static gboolean |
| 3356 | sensor_value_proxy_get_settable (SensorValue *object) |
| 3357 | { |
| 3358 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3359 | GVariant *variant; |
| 3360 | gboolean value = 0; |
| 3361 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); |
| 3362 | if (variant != NULL) |
| 3363 | { |
| 3364 | value = g_variant_get_boolean (variant); |
| 3365 | g_variant_unref (variant); |
| 3366 | } |
| 3367 | return value; |
| 3368 | } |
| 3369 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3370 | static void |
| 3371 | sensor_value_proxy_init (SensorValueProxy *proxy) |
| 3372 | { |
| 3373 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3374 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
| 3375 | #else |
| 3376 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); |
| 3377 | #endif |
| 3378 | |
| 3379 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); |
| 3380 | } |
| 3381 | |
| 3382 | static void |
| 3383 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
| 3384 | { |
| 3385 | GObjectClass *gobject_class; |
| 3386 | GDBusProxyClass *proxy_class; |
| 3387 | |
| 3388 | gobject_class = G_OBJECT_CLASS (klass); |
| 3389 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 3390 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 3391 | gobject_class->set_property = sensor_value_proxy_set_property; |
| 3392 | |
| 3393 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 3394 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 3395 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
| 3396 | |
| 3397 | sensor_value_override_properties (gobject_class, 1); |
| 3398 | |
| 3399 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 3400 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
| 3401 | #endif |
| 3402 | } |
| 3403 | |
| 3404 | static void |
| 3405 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
| 3406 | { |
| 3407 | iface->get_value = sensor_value_proxy_get_value; |
| 3408 | iface->get_units = sensor_value_proxy_get_units; |
| 3409 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 3410 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
| 3411 | iface->get_settable = sensor_value_proxy_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3412 | } |
| 3413 | |
| 3414 | /** |
| 3415 | * sensor_value_proxy_new: |
| 3416 | * @connection: A #GDBusConnection. |
| 3417 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3418 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3419 | * @object_path: An object path. |
| 3420 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3421 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3422 | * @user_data: User data to pass to @callback. |
| 3423 | * |
| 3424 | * 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. |
| 3425 | * |
| 3426 | * 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. |
| 3427 | * You can then call sensor_value_proxy_new_finish() to get the result of the operation. |
| 3428 | * |
| 3429 | * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 3430 | */ |
| 3431 | void |
| 3432 | sensor_value_proxy_new ( |
| 3433 | GDBusConnection *connection, |
| 3434 | GDBusProxyFlags flags, |
| 3435 | const gchar *name, |
| 3436 | const gchar *object_path, |
| 3437 | GCancellable *cancellable, |
| 3438 | GAsyncReadyCallback callback, |
| 3439 | gpointer user_data) |
| 3440 | { |
| 3441 | 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); |
| 3442 | } |
| 3443 | |
| 3444 | /** |
| 3445 | * sensor_value_proxy_new_finish: |
| 3446 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). |
| 3447 | * @error: Return location for error or %NULL |
| 3448 | * |
| 3449 | * Finishes an operation started with sensor_value_proxy_new(). |
| 3450 | * |
| 3451 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 3452 | */ |
| 3453 | SensorValue * |
| 3454 | sensor_value_proxy_new_finish ( |
| 3455 | GAsyncResult *res, |
| 3456 | GError **error) |
| 3457 | { |
| 3458 | GObject *ret; |
| 3459 | GObject *source_object; |
| 3460 | source_object = g_async_result_get_source_object (res); |
| 3461 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3462 | g_object_unref (source_object); |
| 3463 | if (ret != NULL) |
| 3464 | return SENSOR_VALUE (ret); |
| 3465 | else |
| 3466 | return NULL; |
| 3467 | } |
| 3468 | |
| 3469 | /** |
| 3470 | * sensor_value_proxy_new_sync: |
| 3471 | * @connection: A #GDBusConnection. |
| 3472 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3473 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3474 | * @object_path: An object path. |
| 3475 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3476 | * @error: Return location for error or %NULL |
| 3477 | * |
| 3478 | * 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. |
| 3479 | * |
| 3480 | * The calling thread is blocked until a reply is received. |
| 3481 | * |
| 3482 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
| 3483 | * |
| 3484 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 3485 | */ |
| 3486 | SensorValue * |
| 3487 | sensor_value_proxy_new_sync ( |
| 3488 | GDBusConnection *connection, |
| 3489 | GDBusProxyFlags flags, |
| 3490 | const gchar *name, |
| 3491 | const gchar *object_path, |
| 3492 | GCancellable *cancellable, |
| 3493 | GError **error) |
| 3494 | { |
| 3495 | GInitable *ret; |
| 3496 | 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); |
| 3497 | if (ret != NULL) |
| 3498 | return SENSOR_VALUE (ret); |
| 3499 | else |
| 3500 | return NULL; |
| 3501 | } |
| 3502 | |
| 3503 | |
| 3504 | /** |
| 3505 | * sensor_value_proxy_new_for_bus: |
| 3506 | * @bus_type: A #GBusType. |
| 3507 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3508 | * @name: A bus name (well-known or unique). |
| 3509 | * @object_path: An object path. |
| 3510 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3511 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3512 | * @user_data: User data to pass to @callback. |
| 3513 | * |
| 3514 | * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 3515 | * |
| 3516 | * 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. |
| 3517 | * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. |
| 3518 | * |
| 3519 | * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 3520 | */ |
| 3521 | void |
| 3522 | sensor_value_proxy_new_for_bus ( |
| 3523 | GBusType bus_type, |
| 3524 | GDBusProxyFlags flags, |
| 3525 | const gchar *name, |
| 3526 | const gchar *object_path, |
| 3527 | GCancellable *cancellable, |
| 3528 | GAsyncReadyCallback callback, |
| 3529 | gpointer user_data) |
| 3530 | { |
| 3531 | 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); |
| 3532 | } |
| 3533 | |
| 3534 | /** |
| 3535 | * sensor_value_proxy_new_for_bus_finish: |
| 3536 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). |
| 3537 | * @error: Return location for error or %NULL |
| 3538 | * |
| 3539 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
| 3540 | * |
| 3541 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 3542 | */ |
| 3543 | SensorValue * |
| 3544 | sensor_value_proxy_new_for_bus_finish ( |
| 3545 | GAsyncResult *res, |
| 3546 | GError **error) |
| 3547 | { |
| 3548 | GObject *ret; |
| 3549 | GObject *source_object; |
| 3550 | source_object = g_async_result_get_source_object (res); |
| 3551 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3552 | g_object_unref (source_object); |
| 3553 | if (ret != NULL) |
| 3554 | return SENSOR_VALUE (ret); |
| 3555 | else |
| 3556 | return NULL; |
| 3557 | } |
| 3558 | |
| 3559 | /** |
| 3560 | * sensor_value_proxy_new_for_bus_sync: |
| 3561 | * @bus_type: A #GBusType. |
| 3562 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3563 | * @name: A bus name (well-known or unique). |
| 3564 | * @object_path: An object path. |
| 3565 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3566 | * @error: Return location for error or %NULL |
| 3567 | * |
| 3568 | * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 3569 | * |
| 3570 | * The calling thread is blocked until a reply is received. |
| 3571 | * |
| 3572 | * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 3573 | * |
| 3574 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 3575 | */ |
| 3576 | SensorValue * |
| 3577 | sensor_value_proxy_new_for_bus_sync ( |
| 3578 | GBusType bus_type, |
| 3579 | GDBusProxyFlags flags, |
| 3580 | const gchar *name, |
| 3581 | const gchar *object_path, |
| 3582 | GCancellable *cancellable, |
| 3583 | GError **error) |
| 3584 | { |
| 3585 | GInitable *ret; |
| 3586 | 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); |
| 3587 | if (ret != NULL) |
| 3588 | return SENSOR_VALUE (ret); |
| 3589 | else |
| 3590 | return NULL; |
| 3591 | } |
| 3592 | |
| 3593 | |
| 3594 | /* ------------------------------------------------------------------------ */ |
| 3595 | |
| 3596 | /** |
| 3597 | * SensorValueSkeleton: |
| 3598 | * |
| 3599 | * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. |
| 3600 | */ |
| 3601 | |
| 3602 | /** |
| 3603 | * SensorValueSkeletonClass: |
| 3604 | * @parent_class: The parent class. |
| 3605 | * |
| 3606 | * Class structure for #SensorValueSkeleton. |
| 3607 | */ |
| 3608 | |
| 3609 | struct _SensorValueSkeletonPrivate |
| 3610 | { |
| 3611 | GValue *properties; |
| 3612 | GList *changed_properties; |
| 3613 | GSource *changed_properties_idle_source; |
| 3614 | GMainContext *context; |
| 3615 | GMutex lock; |
| 3616 | }; |
| 3617 | |
| 3618 | static void |
| 3619 | _sensor_value_skeleton_handle_method_call ( |
| 3620 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3621 | const gchar *sender G_GNUC_UNUSED, |
| 3622 | const gchar *object_path G_GNUC_UNUSED, |
| 3623 | const gchar *interface_name, |
| 3624 | const gchar *method_name, |
| 3625 | GVariant *parameters, |
| 3626 | GDBusMethodInvocation *invocation, |
| 3627 | gpointer user_data) |
| 3628 | { |
| 3629 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 3630 | _ExtendedGDBusMethodInfo *info; |
| 3631 | GVariantIter iter; |
| 3632 | GVariant *child; |
| 3633 | GValue *paramv; |
| 3634 | guint num_params; |
| 3635 | guint num_extra; |
| 3636 | guint n; |
| 3637 | guint signal_id; |
| 3638 | GValue return_value = G_VALUE_INIT; |
| 3639 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 3640 | g_assert (info != NULL); |
| 3641 | num_params = g_variant_n_children (parameters); |
| 3642 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 3643 | n = 0; |
| 3644 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
| 3645 | g_value_set_object (¶mv[n++], skeleton); |
| 3646 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 3647 | g_value_set_object (¶mv[n++], invocation); |
| 3648 | if (info->pass_fdlist) |
| 3649 | { |
| 3650 | #ifdef G_OS_UNIX |
| 3651 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 3652 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 3653 | #else |
| 3654 | g_assert_not_reached (); |
| 3655 | #endif |
| 3656 | } |
| 3657 | g_variant_iter_init (&iter, parameters); |
| 3658 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3659 | { |
| 3660 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 3661 | if (arg_info->use_gvariant) |
| 3662 | { |
| 3663 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3664 | g_value_set_variant (¶mv[n], child); |
| 3665 | n++; |
| 3666 | } |
| 3667 | else |
| 3668 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3669 | g_variant_unref (child); |
| 3670 | } |
| 3671 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 3672 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 3673 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 3674 | if (!g_value_get_boolean (&return_value)) |
| 3675 | 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); |
| 3676 | g_value_unset (&return_value); |
| 3677 | for (n = 0; n < num_params + num_extra; n++) |
| 3678 | g_value_unset (¶mv[n]); |
| 3679 | g_free (paramv); |
| 3680 | } |
| 3681 | |
| 3682 | static GVariant * |
| 3683 | _sensor_value_skeleton_handle_get_property ( |
| 3684 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3685 | const gchar *sender G_GNUC_UNUSED, |
| 3686 | const gchar *object_path G_GNUC_UNUSED, |
| 3687 | const gchar *interface_name G_GNUC_UNUSED, |
| 3688 | const gchar *property_name, |
| 3689 | GError **error, |
| 3690 | gpointer user_data) |
| 3691 | { |
| 3692 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 3693 | GValue value = G_VALUE_INIT; |
| 3694 | GParamSpec *pspec; |
| 3695 | _ExtendedGDBusPropertyInfo *info; |
| 3696 | GVariant *ret; |
| 3697 | ret = NULL; |
| 3698 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 3699 | g_assert (info != NULL); |
| 3700 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3701 | if (pspec == NULL) |
| 3702 | { |
| 3703 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3704 | } |
| 3705 | else |
| 3706 | { |
| 3707 | g_value_init (&value, pspec->value_type); |
| 3708 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3709 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3710 | g_value_unset (&value); |
| 3711 | } |
| 3712 | return ret; |
| 3713 | } |
| 3714 | |
| 3715 | static gboolean |
| 3716 | _sensor_value_skeleton_handle_set_property ( |
| 3717 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3718 | const gchar *sender G_GNUC_UNUSED, |
| 3719 | const gchar *object_path G_GNUC_UNUSED, |
| 3720 | const gchar *interface_name G_GNUC_UNUSED, |
| 3721 | const gchar *property_name, |
| 3722 | GVariant *variant, |
| 3723 | GError **error, |
| 3724 | gpointer user_data) |
| 3725 | { |
| 3726 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 3727 | GValue value = G_VALUE_INIT; |
| 3728 | GParamSpec *pspec; |
| 3729 | _ExtendedGDBusPropertyInfo *info; |
| 3730 | gboolean ret; |
| 3731 | ret = FALSE; |
| 3732 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 3733 | g_assert (info != NULL); |
| 3734 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3735 | if (pspec == NULL) |
| 3736 | { |
| 3737 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3738 | } |
| 3739 | else |
| 3740 | { |
| 3741 | if (info->use_gvariant) |
| 3742 | g_value_set_variant (&value, variant); |
| 3743 | else |
| 3744 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 3745 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3746 | g_value_unset (&value); |
| 3747 | ret = TRUE; |
| 3748 | } |
| 3749 | return ret; |
| 3750 | } |
| 3751 | |
| 3752 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
| 3753 | { |
| 3754 | _sensor_value_skeleton_handle_method_call, |
| 3755 | _sensor_value_skeleton_handle_get_property, |
| 3756 | _sensor_value_skeleton_handle_set_property, |
| 3757 | {NULL} |
| 3758 | }; |
| 3759 | |
| 3760 | static GDBusInterfaceInfo * |
| 3761 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3762 | { |
| 3763 | return sensor_value_interface_info (); |
| 3764 | } |
| 3765 | |
| 3766 | static GDBusInterfaceVTable * |
| 3767 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3768 | { |
| 3769 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
| 3770 | } |
| 3771 | |
| 3772 | static GVariant * |
| 3773 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 3774 | { |
| 3775 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 3776 | |
| 3777 | GVariantBuilder builder; |
| 3778 | guint n; |
| 3779 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3780 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
| 3781 | goto out; |
| 3782 | for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) |
| 3783 | { |
| 3784 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
| 3785 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3786 | { |
| 3787 | GVariant *value; |
| 3788 | 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); |
| 3789 | if (value != NULL) |
| 3790 | { |
| 3791 | g_variant_take_ref (value); |
| 3792 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3793 | g_variant_unref (value); |
| 3794 | } |
| 3795 | } |
| 3796 | } |
| 3797 | out: |
| 3798 | return g_variant_builder_end (&builder); |
| 3799 | } |
| 3800 | |
| 3801 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
| 3802 | |
| 3803 | static void |
| 3804 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 3805 | { |
| 3806 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 3807 | gboolean emit_changed = FALSE; |
| 3808 | |
| 3809 | g_mutex_lock (&skeleton->priv->lock); |
| 3810 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3811 | { |
| 3812 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3813 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3814 | emit_changed = TRUE; |
| 3815 | } |
| 3816 | g_mutex_unlock (&skeleton->priv->lock); |
| 3817 | |
| 3818 | if (emit_changed) |
| 3819 | _sensor_value_emit_changed (skeleton); |
| 3820 | } |
| 3821 | |
| 3822 | static void |
| 3823 | _sensor_value_on_signal_changed ( |
| 3824 | SensorValue *object, |
| 3825 | GVariant *arg_value, |
| 3826 | const gchar *arg_units) |
| 3827 | { |
| 3828 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 3829 | |
| 3830 | GList *connections, *l; |
| 3831 | GVariant *signal_variant; |
| 3832 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3833 | |
| 3834 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
| 3835 | arg_value, |
| 3836 | arg_units)); |
| 3837 | for (l = connections; l != NULL; l = l->next) |
| 3838 | { |
| 3839 | GDBusConnection *connection = l->data; |
| 3840 | g_dbus_connection_emit_signal (connection, |
| 3841 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", |
| 3842 | signal_variant, NULL); |
| 3843 | } |
| 3844 | g_variant_unref (signal_variant); |
| 3845 | g_list_free_full (connections, g_object_unref); |
| 3846 | } |
| 3847 | |
| 3848 | static void |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3849 | _sensor_value_on_signal_error ( |
| 3850 | SensorValue *object) |
| 3851 | { |
| 3852 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 3853 | |
| 3854 | GList *connections, *l; |
| 3855 | GVariant *signal_variant; |
| 3856 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3857 | |
| 3858 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 3859 | for (l = connections; l != NULL; l = l->next) |
| 3860 | { |
| 3861 | GDBusConnection *connection = l->data; |
| 3862 | g_dbus_connection_emit_signal (connection, |
| 3863 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error", |
| 3864 | signal_variant, NULL); |
| 3865 | } |
| 3866 | g_variant_unref (signal_variant); |
| 3867 | g_list_free_full (connections, g_object_unref); |
| 3868 | } |
| 3869 | |
| 3870 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3871 | _sensor_value_on_signal_heartbeat ( |
| 3872 | SensorValue *object, |
| 3873 | const gchar *arg_bus_name) |
| 3874 | { |
| 3875 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 3876 | |
| 3877 | GList *connections, *l; |
| 3878 | GVariant *signal_variant; |
| 3879 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3880 | |
| 3881 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 3882 | arg_bus_name)); |
| 3883 | for (l = connections; l != NULL; l = l->next) |
| 3884 | { |
| 3885 | GDBusConnection *connection = l->data; |
| 3886 | g_dbus_connection_emit_signal (connection, |
| 3887 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", |
| 3888 | signal_variant, NULL); |
| 3889 | } |
| 3890 | g_variant_unref (signal_variant); |
| 3891 | g_list_free_full (connections, g_object_unref); |
| 3892 | } |
| 3893 | |
| 3894 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
| 3895 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3896 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3897 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 3898 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 3899 | |
| 3900 | #else |
| 3901 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3902 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 3903 | |
| 3904 | #endif |
| 3905 | static void |
| 3906 | sensor_value_skeleton_finalize (GObject *object) |
| 3907 | { |
| 3908 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 3909 | guint n; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 3910 | for (n = 0; n < 5; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3911 | g_value_unset (&skeleton->priv->properties[n]); |
| 3912 | g_free (skeleton->priv->properties); |
| 3913 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3914 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3915 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3916 | g_main_context_unref (skeleton->priv->context); |
| 3917 | g_mutex_clear (&skeleton->priv->lock); |
| 3918 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
| 3919 | } |
| 3920 | |
| 3921 | static void |
| 3922 | sensor_value_skeleton_get_property (GObject *object, |
| 3923 | guint prop_id, |
| 3924 | GValue *value, |
| 3925 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3926 | { |
| 3927 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 3928 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3929 | g_mutex_lock (&skeleton->priv->lock); |
| 3930 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 3931 | g_mutex_unlock (&skeleton->priv->lock); |
| 3932 | } |
| 3933 | |
| 3934 | static gboolean |
| 3935 | _sensor_value_emit_changed (gpointer user_data) |
| 3936 | { |
| 3937 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 3938 | GList *l; |
| 3939 | GVariantBuilder builder; |
| 3940 | GVariantBuilder invalidated_builder; |
| 3941 | guint num_changes; |
| 3942 | |
| 3943 | g_mutex_lock (&skeleton->priv->lock); |
| 3944 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3945 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 3946 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3947 | { |
| 3948 | ChangedProperty *cp = l->data; |
| 3949 | GVariant *variant; |
| 3950 | const GValue *cur_value; |
| 3951 | |
| 3952 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3953 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3954 | { |
| 3955 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3956 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3957 | g_variant_unref (variant); |
| 3958 | num_changes++; |
| 3959 | } |
| 3960 | } |
| 3961 | if (num_changes > 0) |
| 3962 | { |
| 3963 | GList *connections, *ll; |
| 3964 | GVariant *signal_variant; |
| 3965 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", |
| 3966 | &builder, &invalidated_builder)); |
| 3967 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3968 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3969 | { |
| 3970 | GDBusConnection *connection = ll->data; |
| 3971 | |
| 3972 | g_dbus_connection_emit_signal (connection, |
| 3973 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3974 | "org.freedesktop.DBus.Properties", |
| 3975 | "PropertiesChanged", |
| 3976 | signal_variant, |
| 3977 | NULL); |
| 3978 | } |
| 3979 | g_variant_unref (signal_variant); |
| 3980 | g_list_free_full (connections, g_object_unref); |
| 3981 | } |
| 3982 | else |
| 3983 | { |
| 3984 | g_variant_builder_clear (&builder); |
| 3985 | g_variant_builder_clear (&invalidated_builder); |
| 3986 | } |
| 3987 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3988 | skeleton->priv->changed_properties = NULL; |
| 3989 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3990 | g_mutex_unlock (&skeleton->priv->lock); |
| 3991 | return FALSE; |
| 3992 | } |
| 3993 | |
| 3994 | static void |
| 3995 | _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 3996 | { |
| 3997 | ChangedProperty *cp; |
| 3998 | GList *l; |
| 3999 | cp = NULL; |
| 4000 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 4001 | { |
| 4002 | ChangedProperty *i_cp = l->data; |
| 4003 | if (i_cp->info == info) |
| 4004 | { |
| 4005 | cp = i_cp; |
| 4006 | break; |
| 4007 | } |
| 4008 | } |
| 4009 | if (cp == NULL) |
| 4010 | { |
| 4011 | cp = g_new0 (ChangedProperty, 1); |
| 4012 | cp->prop_id = prop_id; |
| 4013 | cp->info = info; |
| 4014 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 4015 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 4016 | g_value_copy (orig_value, &cp->orig_value); |
| 4017 | } |
| 4018 | } |
| 4019 | |
| 4020 | static void |
| 4021 | sensor_value_skeleton_notify (GObject *object, |
| 4022 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4023 | { |
| 4024 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4025 | g_mutex_lock (&skeleton->priv->lock); |
| 4026 | if (skeleton->priv->changed_properties != NULL && |
| 4027 | skeleton->priv->changed_properties_idle_source == NULL) |
| 4028 | { |
| 4029 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 4030 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 4031 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 4032 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 4033 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 4034 | } |
| 4035 | g_mutex_unlock (&skeleton->priv->lock); |
| 4036 | } |
| 4037 | |
| 4038 | static void |
| 4039 | sensor_value_skeleton_set_property (GObject *object, |
| 4040 | guint prop_id, |
| 4041 | const GValue *value, |
| 4042 | GParamSpec *pspec) |
| 4043 | { |
| 4044 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4045 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4046 | g_mutex_lock (&skeleton->priv->lock); |
| 4047 | g_object_freeze_notify (object); |
| 4048 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 4049 | { |
| 4050 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 4051 | _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 4052 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 4053 | g_object_notify_by_pspec (object, pspec); |
| 4054 | } |
| 4055 | g_mutex_unlock (&skeleton->priv->lock); |
| 4056 | g_object_thaw_notify (object); |
| 4057 | } |
| 4058 | |
| 4059 | static void |
| 4060 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
| 4061 | { |
| 4062 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4063 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
| 4064 | #else |
| 4065 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); |
| 4066 | #endif |
| 4067 | |
| 4068 | g_mutex_init (&skeleton->priv->lock); |
| 4069 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4070 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4071 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 4072 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 4073 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 4074 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 4075 | g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4076 | } |
| 4077 | |
| 4078 | static GVariant * |
| 4079 | sensor_value_skeleton_get_value (SensorValue *object) |
| 4080 | { |
| 4081 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4082 | GVariant *value; |
| 4083 | g_mutex_lock (&skeleton->priv->lock); |
| 4084 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 4085 | g_mutex_unlock (&skeleton->priv->lock); |
| 4086 | return value; |
| 4087 | } |
| 4088 | |
| 4089 | static const gchar * |
| 4090 | sensor_value_skeleton_get_units (SensorValue *object) |
| 4091 | { |
| 4092 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4093 | const gchar *value; |
| 4094 | g_mutex_lock (&skeleton->priv->lock); |
| 4095 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 4096 | g_mutex_unlock (&skeleton->priv->lock); |
| 4097 | return value; |
| 4098 | } |
| 4099 | |
| 4100 | static gint |
| 4101 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
| 4102 | { |
| 4103 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4104 | gint value; |
| 4105 | g_mutex_lock (&skeleton->priv->lock); |
| 4106 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 4107 | g_mutex_unlock (&skeleton->priv->lock); |
| 4108 | return value; |
| 4109 | } |
| 4110 | |
| 4111 | static gint |
| 4112 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
| 4113 | { |
| 4114 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4115 | gint value; |
| 4116 | g_mutex_lock (&skeleton->priv->lock); |
| 4117 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 4118 | g_mutex_unlock (&skeleton->priv->lock); |
| 4119 | return value; |
| 4120 | } |
| 4121 | |
| 4122 | static gboolean |
| 4123 | sensor_value_skeleton_get_settable (SensorValue *object) |
| 4124 | { |
| 4125 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4126 | gboolean value; |
| 4127 | g_mutex_lock (&skeleton->priv->lock); |
| 4128 | value = g_value_get_boolean (&(skeleton->priv->properties[4])); |
| 4129 | g_mutex_unlock (&skeleton->priv->lock); |
| 4130 | return value; |
| 4131 | } |
| 4132 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4133 | static void |
| 4134 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
| 4135 | { |
| 4136 | GObjectClass *gobject_class; |
| 4137 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 4138 | |
| 4139 | gobject_class = G_OBJECT_CLASS (klass); |
| 4140 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 4141 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 4142 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 4143 | gobject_class->notify = sensor_value_skeleton_notify; |
| 4144 | |
| 4145 | |
| 4146 | sensor_value_override_properties (gobject_class, 1); |
| 4147 | |
| 4148 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 4149 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 4150 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 4151 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 4152 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
| 4153 | |
| 4154 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4155 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
| 4156 | #endif |
| 4157 | } |
| 4158 | |
| 4159 | static void |
| 4160 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
| 4161 | { |
| 4162 | iface->changed = _sensor_value_on_signal_changed; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4163 | iface->error = _sensor_value_on_signal_error; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4164 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 4165 | iface->get_value = sensor_value_skeleton_get_value; |
| 4166 | iface->get_units = sensor_value_skeleton_get_units; |
| 4167 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 4168 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
| 4169 | iface->get_settable = sensor_value_skeleton_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4170 | } |
| 4171 | |
| 4172 | /** |
| 4173 | * sensor_value_skeleton_new: |
| 4174 | * |
| 4175 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 4176 | * |
| 4177 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
| 4178 | */ |
| 4179 | SensorValue * |
| 4180 | sensor_value_skeleton_new (void) |
| 4181 | { |
| 4182 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
| 4183 | } |
| 4184 | |
| 4185 | /* ------------------------------------------------------------------------ |
| 4186 | * Code for interface org.openbmc.SensorThreshold |
| 4187 | * ------------------------------------------------------------------------ |
| 4188 | */ |
| 4189 | |
| 4190 | /** |
| 4191 | * SECTION:SensorThreshold |
| 4192 | * @title: SensorThreshold |
| 4193 | * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface |
| 4194 | * |
| 4195 | * 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. |
| 4196 | */ |
| 4197 | |
| 4198 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
| 4199 | |
| 4200 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
| 4201 | { |
| 4202 | { |
| 4203 | -1, |
| 4204 | (gchar *) "state", |
| 4205 | (gchar *) "y", |
| 4206 | NULL |
| 4207 | }, |
| 4208 | FALSE |
| 4209 | }; |
| 4210 | |
| 4211 | static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = |
| 4212 | { |
| 4213 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
| 4214 | NULL |
| 4215 | }; |
| 4216 | |
| 4217 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
| 4218 | { |
| 4219 | { |
| 4220 | -1, |
| 4221 | (gchar *) "getState", |
| 4222 | NULL, |
| 4223 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
| 4224 | NULL |
| 4225 | }, |
| 4226 | "handle-get-state", |
| 4227 | FALSE |
| 4228 | }; |
| 4229 | |
| 4230 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
| 4231 | { |
| 4232 | &_sensor_threshold_method_info_get_state, |
| 4233 | NULL |
| 4234 | }; |
| 4235 | |
| 4236 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
| 4237 | { |
| 4238 | { |
| 4239 | -1, |
| 4240 | (gchar *) "Warning", |
| 4241 | NULL, |
| 4242 | NULL |
| 4243 | }, |
| 4244 | "warning" |
| 4245 | }; |
| 4246 | |
| 4247 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
| 4248 | { |
| 4249 | { |
| 4250 | -1, |
| 4251 | (gchar *) "Critical", |
| 4252 | NULL, |
| 4253 | NULL |
| 4254 | }, |
| 4255 | "critical" |
| 4256 | }; |
| 4257 | |
| 4258 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
| 4259 | { |
| 4260 | { |
| 4261 | -1, |
| 4262 | (gchar *) "Normal", |
| 4263 | NULL, |
| 4264 | NULL |
| 4265 | }, |
| 4266 | "normal" |
| 4267 | }; |
| 4268 | |
| 4269 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
| 4270 | { |
| 4271 | &_sensor_threshold_signal_info_warning, |
| 4272 | &_sensor_threshold_signal_info_critical, |
| 4273 | &_sensor_threshold_signal_info_normal, |
| 4274 | NULL |
| 4275 | }; |
| 4276 | |
| 4277 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
| 4278 | { |
| 4279 | { |
| 4280 | -1, |
| 4281 | (gchar *) "lower_critical", |
| 4282 | (gchar *) "v", |
| 4283 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4284 | NULL |
| 4285 | }, |
| 4286 | "lower-critical", |
| 4287 | FALSE |
| 4288 | }; |
| 4289 | |
| 4290 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
| 4291 | { |
| 4292 | { |
| 4293 | -1, |
| 4294 | (gchar *) "lower_warning", |
| 4295 | (gchar *) "v", |
| 4296 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4297 | NULL |
| 4298 | }, |
| 4299 | "lower-warning", |
| 4300 | FALSE |
| 4301 | }; |
| 4302 | |
| 4303 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
| 4304 | { |
| 4305 | { |
| 4306 | -1, |
| 4307 | (gchar *) "upper_warning", |
| 4308 | (gchar *) "v", |
| 4309 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4310 | NULL |
| 4311 | }, |
| 4312 | "upper-warning", |
| 4313 | FALSE |
| 4314 | }; |
| 4315 | |
| 4316 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
| 4317 | { |
| 4318 | { |
| 4319 | -1, |
| 4320 | (gchar *) "upper_critical", |
| 4321 | (gchar *) "v", |
| 4322 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4323 | NULL |
| 4324 | }, |
| 4325 | "upper-critical", |
| 4326 | FALSE |
| 4327 | }; |
| 4328 | |
| 4329 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
| 4330 | { |
| 4331 | { |
| 4332 | -1, |
| 4333 | (gchar *) "state", |
| 4334 | (gchar *) "y", |
| 4335 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4336 | NULL |
| 4337 | }, |
| 4338 | "state", |
| 4339 | FALSE |
| 4340 | }; |
| 4341 | |
| 4342 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
| 4343 | { |
| 4344 | &_sensor_threshold_property_info_lower_critical, |
| 4345 | &_sensor_threshold_property_info_lower_warning, |
| 4346 | &_sensor_threshold_property_info_upper_warning, |
| 4347 | &_sensor_threshold_property_info_upper_critical, |
| 4348 | &_sensor_threshold_property_info_state, |
| 4349 | NULL |
| 4350 | }; |
| 4351 | |
| 4352 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
| 4353 | { |
| 4354 | { |
| 4355 | -1, |
| 4356 | (gchar *) "org.openbmc.SensorThreshold", |
| 4357 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 4358 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 4359 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
| 4360 | NULL |
| 4361 | }, |
| 4362 | "sensor-threshold", |
| 4363 | }; |
| 4364 | |
| 4365 | |
| 4366 | /** |
| 4367 | * sensor_threshold_interface_info: |
| 4368 | * |
| 4369 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. |
| 4370 | * |
| 4371 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 4372 | */ |
| 4373 | GDBusInterfaceInfo * |
| 4374 | sensor_threshold_interface_info (void) |
| 4375 | { |
| 4376 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
| 4377 | } |
| 4378 | |
| 4379 | /** |
| 4380 | * sensor_threshold_override_properties: |
| 4381 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 4382 | * @property_id_begin: The property id to assign to the first overridden property. |
| 4383 | * |
| 4384 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
| 4385 | * The properties are overridden in the order they are defined. |
| 4386 | * |
| 4387 | * Returns: The last property id. |
| 4388 | */ |
| 4389 | guint |
| 4390 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 4391 | { |
| 4392 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 4393 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 4394 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 4395 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 4396 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 4397 | return property_id_begin - 1; |
| 4398 | } |
| 4399 | |
| 4400 | |
| 4401 | |
| 4402 | /** |
| 4403 | * SensorThreshold: |
| 4404 | * |
| 4405 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 4406 | */ |
| 4407 | |
| 4408 | /** |
| 4409 | * SensorThresholdIface: |
| 4410 | * @parent_iface: The parent interface. |
| 4411 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 4412 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 4413 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 4414 | * @get_state: Getter for the #SensorThreshold:state property. |
| 4415 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 4416 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 4417 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 4418 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 4419 | * @warning: Handler for the #SensorThreshold::warning signal. |
| 4420 | * |
| 4421 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 4422 | */ |
| 4423 | |
| 4424 | typedef SensorThresholdIface SensorThresholdInterface; |
| 4425 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
| 4426 | |
| 4427 | static void |
| 4428 | sensor_threshold_default_init (SensorThresholdIface *iface) |
| 4429 | { |
| 4430 | /* GObject signals for incoming D-Bus method calls: */ |
| 4431 | /** |
| 4432 | * SensorThreshold::handle-get-state: |
| 4433 | * @object: A #SensorThreshold. |
| 4434 | * @invocation: A #GDBusMethodInvocation. |
| 4435 | * |
| 4436 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. |
| 4437 | * |
| 4438 | * 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. |
| 4439 | * |
| 4440 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 4441 | */ |
| 4442 | g_signal_new ("handle-get-state", |
| 4443 | G_TYPE_FROM_INTERFACE (iface), |
| 4444 | G_SIGNAL_RUN_LAST, |
| 4445 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
| 4446 | g_signal_accumulator_true_handled, |
| 4447 | NULL, |
| 4448 | g_cclosure_marshal_generic, |
| 4449 | G_TYPE_BOOLEAN, |
| 4450 | 1, |
| 4451 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 4452 | |
| 4453 | /* GObject signals for received D-Bus signals: */ |
| 4454 | /** |
| 4455 | * SensorThreshold::warning: |
| 4456 | * @object: A #SensorThreshold. |
| 4457 | * |
| 4458 | * 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. |
| 4459 | * |
| 4460 | * 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. |
| 4461 | */ |
| 4462 | g_signal_new ("warning", |
| 4463 | G_TYPE_FROM_INTERFACE (iface), |
| 4464 | G_SIGNAL_RUN_LAST, |
| 4465 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
| 4466 | NULL, |
| 4467 | NULL, |
| 4468 | g_cclosure_marshal_generic, |
| 4469 | G_TYPE_NONE, |
| 4470 | 0); |
| 4471 | |
| 4472 | /** |
| 4473 | * SensorThreshold::critical: |
| 4474 | * @object: A #SensorThreshold. |
| 4475 | * |
| 4476 | * 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. |
| 4477 | * |
| 4478 | * 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. |
| 4479 | */ |
| 4480 | g_signal_new ("critical", |
| 4481 | G_TYPE_FROM_INTERFACE (iface), |
| 4482 | G_SIGNAL_RUN_LAST, |
| 4483 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
| 4484 | NULL, |
| 4485 | NULL, |
| 4486 | g_cclosure_marshal_generic, |
| 4487 | G_TYPE_NONE, |
| 4488 | 0); |
| 4489 | |
| 4490 | /** |
| 4491 | * SensorThreshold::normal: |
| 4492 | * @object: A #SensorThreshold. |
| 4493 | * |
| 4494 | * 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. |
| 4495 | * |
| 4496 | * 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. |
| 4497 | */ |
| 4498 | g_signal_new ("normal", |
| 4499 | G_TYPE_FROM_INTERFACE (iface), |
| 4500 | G_SIGNAL_RUN_LAST, |
| 4501 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
| 4502 | NULL, |
| 4503 | NULL, |
| 4504 | g_cclosure_marshal_generic, |
| 4505 | G_TYPE_NONE, |
| 4506 | 0); |
| 4507 | |
| 4508 | /* GObject properties for D-Bus properties: */ |
| 4509 | /** |
| 4510 | * SensorThreshold:lower-critical: |
| 4511 | * |
| 4512 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. |
| 4513 | * |
| 4514 | * 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. |
| 4515 | */ |
| 4516 | g_object_interface_install_property (iface, |
| 4517 | g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4518 | /** |
| 4519 | * SensorThreshold:lower-warning: |
| 4520 | * |
| 4521 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. |
| 4522 | * |
| 4523 | * 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. |
| 4524 | */ |
| 4525 | g_object_interface_install_property (iface, |
| 4526 | g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4527 | /** |
| 4528 | * SensorThreshold:upper-warning: |
| 4529 | * |
| 4530 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. |
| 4531 | * |
| 4532 | * 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. |
| 4533 | */ |
| 4534 | g_object_interface_install_property (iface, |
| 4535 | g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4536 | /** |
| 4537 | * SensorThreshold:upper-critical: |
| 4538 | * |
| 4539 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. |
| 4540 | * |
| 4541 | * 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. |
| 4542 | */ |
| 4543 | g_object_interface_install_property (iface, |
| 4544 | g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4545 | /** |
| 4546 | * SensorThreshold:state: |
| 4547 | * |
| 4548 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. |
| 4549 | * |
| 4550 | * 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. |
| 4551 | */ |
| 4552 | g_object_interface_install_property (iface, |
| 4553 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4554 | } |
| 4555 | |
| 4556 | /** |
| 4557 | * sensor_threshold_get_lower_critical: (skip) |
| 4558 | * @object: A #SensorThreshold. |
| 4559 | * |
| 4560 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 4561 | * |
| 4562 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4563 | * |
| 4564 | * <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> |
| 4565 | * |
| 4566 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4567 | */ |
| 4568 | GVariant * |
| 4569 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
| 4570 | { |
| 4571 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
| 4572 | } |
| 4573 | |
| 4574 | /** |
| 4575 | * sensor_threshold_dup_lower_critical: (skip) |
| 4576 | * @object: A #SensorThreshold. |
| 4577 | * |
| 4578 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 4579 | * |
| 4580 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4581 | * |
| 4582 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4583 | */ |
| 4584 | GVariant * |
| 4585 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 4586 | { |
| 4587 | GVariant *value; |
| 4588 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 4589 | return value; |
| 4590 | } |
| 4591 | |
| 4592 | /** |
| 4593 | * sensor_threshold_set_lower_critical: (skip) |
| 4594 | * @object: A #SensorThreshold. |
| 4595 | * @value: The value to set. |
| 4596 | * |
| 4597 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. |
| 4598 | * |
| 4599 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4600 | */ |
| 4601 | void |
| 4602 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
| 4603 | { |
| 4604 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 4605 | } |
| 4606 | |
| 4607 | /** |
| 4608 | * sensor_threshold_get_lower_warning: (skip) |
| 4609 | * @object: A #SensorThreshold. |
| 4610 | * |
| 4611 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 4612 | * |
| 4613 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4614 | * |
| 4615 | * <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> |
| 4616 | * |
| 4617 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4618 | */ |
| 4619 | GVariant * |
| 4620 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
| 4621 | { |
| 4622 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
| 4623 | } |
| 4624 | |
| 4625 | /** |
| 4626 | * sensor_threshold_dup_lower_warning: (skip) |
| 4627 | * @object: A #SensorThreshold. |
| 4628 | * |
| 4629 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 4630 | * |
| 4631 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4632 | * |
| 4633 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4634 | */ |
| 4635 | GVariant * |
| 4636 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 4637 | { |
| 4638 | GVariant *value; |
| 4639 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 4640 | return value; |
| 4641 | } |
| 4642 | |
| 4643 | /** |
| 4644 | * sensor_threshold_set_lower_warning: (skip) |
| 4645 | * @object: A #SensorThreshold. |
| 4646 | * @value: The value to set. |
| 4647 | * |
| 4648 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. |
| 4649 | * |
| 4650 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4651 | */ |
| 4652 | void |
| 4653 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
| 4654 | { |
| 4655 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 4656 | } |
| 4657 | |
| 4658 | /** |
| 4659 | * sensor_threshold_get_upper_warning: (skip) |
| 4660 | * @object: A #SensorThreshold. |
| 4661 | * |
| 4662 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 4663 | * |
| 4664 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4665 | * |
| 4666 | * <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> |
| 4667 | * |
| 4668 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4669 | */ |
| 4670 | GVariant * |
| 4671 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
| 4672 | { |
| 4673 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
| 4674 | } |
| 4675 | |
| 4676 | /** |
| 4677 | * sensor_threshold_dup_upper_warning: (skip) |
| 4678 | * @object: A #SensorThreshold. |
| 4679 | * |
| 4680 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 4681 | * |
| 4682 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4683 | * |
| 4684 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4685 | */ |
| 4686 | GVariant * |
| 4687 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 4688 | { |
| 4689 | GVariant *value; |
| 4690 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 4691 | return value; |
| 4692 | } |
| 4693 | |
| 4694 | /** |
| 4695 | * sensor_threshold_set_upper_warning: (skip) |
| 4696 | * @object: A #SensorThreshold. |
| 4697 | * @value: The value to set. |
| 4698 | * |
| 4699 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. |
| 4700 | * |
| 4701 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4702 | */ |
| 4703 | void |
| 4704 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
| 4705 | { |
| 4706 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 4707 | } |
| 4708 | |
| 4709 | /** |
| 4710 | * sensor_threshold_get_upper_critical: (skip) |
| 4711 | * @object: A #SensorThreshold. |
| 4712 | * |
| 4713 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 4714 | * |
| 4715 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4716 | * |
| 4717 | * <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> |
| 4718 | * |
| 4719 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4720 | */ |
| 4721 | GVariant * |
| 4722 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
| 4723 | { |
| 4724 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
| 4725 | } |
| 4726 | |
| 4727 | /** |
| 4728 | * sensor_threshold_dup_upper_critical: (skip) |
| 4729 | * @object: A #SensorThreshold. |
| 4730 | * |
| 4731 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 4732 | * |
| 4733 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4734 | * |
| 4735 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4736 | */ |
| 4737 | GVariant * |
| 4738 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 4739 | { |
| 4740 | GVariant *value; |
| 4741 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 4742 | return value; |
| 4743 | } |
| 4744 | |
| 4745 | /** |
| 4746 | * sensor_threshold_set_upper_critical: (skip) |
| 4747 | * @object: A #SensorThreshold. |
| 4748 | * @value: The value to set. |
| 4749 | * |
| 4750 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. |
| 4751 | * |
| 4752 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4753 | */ |
| 4754 | void |
| 4755 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
| 4756 | { |
| 4757 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 4758 | } |
| 4759 | |
| 4760 | /** |
| 4761 | * sensor_threshold_get_state: (skip) |
| 4762 | * @object: A #SensorThreshold. |
| 4763 | * |
| 4764 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. |
| 4765 | * |
| 4766 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4767 | * |
| 4768 | * Returns: The property value. |
| 4769 | */ |
| 4770 | guchar |
| 4771 | sensor_threshold_get_state (SensorThreshold *object) |
| 4772 | { |
| 4773 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
| 4774 | } |
| 4775 | |
| 4776 | /** |
| 4777 | * sensor_threshold_set_state: (skip) |
| 4778 | * @object: A #SensorThreshold. |
| 4779 | * @value: The value to set. |
| 4780 | * |
| 4781 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. |
| 4782 | * |
| 4783 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4784 | */ |
| 4785 | void |
| 4786 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
| 4787 | { |
| 4788 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 4789 | } |
| 4790 | |
| 4791 | /** |
| 4792 | * sensor_threshold_emit_warning: |
| 4793 | * @object: A #SensorThreshold. |
| 4794 | * |
| 4795 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. |
| 4796 | */ |
| 4797 | void |
| 4798 | sensor_threshold_emit_warning ( |
| 4799 | SensorThreshold *object) |
| 4800 | { |
| 4801 | g_signal_emit_by_name (object, "warning"); |
| 4802 | } |
| 4803 | |
| 4804 | /** |
| 4805 | * sensor_threshold_emit_critical: |
| 4806 | * @object: A #SensorThreshold. |
| 4807 | * |
| 4808 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. |
| 4809 | */ |
| 4810 | void |
| 4811 | sensor_threshold_emit_critical ( |
| 4812 | SensorThreshold *object) |
| 4813 | { |
| 4814 | g_signal_emit_by_name (object, "critical"); |
| 4815 | } |
| 4816 | |
| 4817 | /** |
| 4818 | * sensor_threshold_emit_normal: |
| 4819 | * @object: A #SensorThreshold. |
| 4820 | * |
| 4821 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. |
| 4822 | */ |
| 4823 | void |
| 4824 | sensor_threshold_emit_normal ( |
| 4825 | SensorThreshold *object) |
| 4826 | { |
| 4827 | g_signal_emit_by_name (object, "normal"); |
| 4828 | } |
| 4829 | |
| 4830 | /** |
| 4831 | * sensor_threshold_call_get_state: |
| 4832 | * @proxy: A #SensorThresholdProxy. |
| 4833 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4834 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4835 | * @user_data: User data to pass to @callback. |
| 4836 | * |
| 4837 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. |
| 4838 | * 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. |
| 4839 | * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. |
| 4840 | * |
| 4841 | * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. |
| 4842 | */ |
| 4843 | void |
| 4844 | sensor_threshold_call_get_state ( |
| 4845 | SensorThreshold *proxy, |
| 4846 | GCancellable *cancellable, |
| 4847 | GAsyncReadyCallback callback, |
| 4848 | gpointer user_data) |
| 4849 | { |
| 4850 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4851 | "getState", |
| 4852 | g_variant_new ("()"), |
| 4853 | G_DBUS_CALL_FLAGS_NONE, |
| 4854 | -1, |
| 4855 | cancellable, |
| 4856 | callback, |
| 4857 | user_data); |
| 4858 | } |
| 4859 | |
| 4860 | /** |
| 4861 | * sensor_threshold_call_get_state_finish: |
| 4862 | * @proxy: A #SensorThresholdProxy. |
| 4863 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 4864 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). |
| 4865 | * @error: Return location for error or %NULL. |
| 4866 | * |
| 4867 | * Finishes an operation started with sensor_threshold_call_get_state(). |
| 4868 | * |
| 4869 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4870 | */ |
| 4871 | gboolean |
| 4872 | sensor_threshold_call_get_state_finish ( |
| 4873 | SensorThreshold *proxy, |
| 4874 | guchar *out_state, |
| 4875 | GAsyncResult *res, |
| 4876 | GError **error) |
| 4877 | { |
| 4878 | GVariant *_ret; |
| 4879 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4880 | if (_ret == NULL) |
| 4881 | goto _out; |
| 4882 | g_variant_get (_ret, |
| 4883 | "(y)", |
| 4884 | out_state); |
| 4885 | g_variant_unref (_ret); |
| 4886 | _out: |
| 4887 | return _ret != NULL; |
| 4888 | } |
| 4889 | |
| 4890 | /** |
| 4891 | * sensor_threshold_call_get_state_sync: |
| 4892 | * @proxy: A #SensorThresholdProxy. |
| 4893 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 4894 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4895 | * @error: Return location for error or %NULL. |
| 4896 | * |
| 4897 | * 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. |
| 4898 | * |
| 4899 | * See sensor_threshold_call_get_state() for the asynchronous version of this method. |
| 4900 | * |
| 4901 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4902 | */ |
| 4903 | gboolean |
| 4904 | sensor_threshold_call_get_state_sync ( |
| 4905 | SensorThreshold *proxy, |
| 4906 | guchar *out_state, |
| 4907 | GCancellable *cancellable, |
| 4908 | GError **error) |
| 4909 | { |
| 4910 | GVariant *_ret; |
| 4911 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4912 | "getState", |
| 4913 | g_variant_new ("()"), |
| 4914 | G_DBUS_CALL_FLAGS_NONE, |
| 4915 | -1, |
| 4916 | cancellable, |
| 4917 | error); |
| 4918 | if (_ret == NULL) |
| 4919 | goto _out; |
| 4920 | g_variant_get (_ret, |
| 4921 | "(y)", |
| 4922 | out_state); |
| 4923 | g_variant_unref (_ret); |
| 4924 | _out: |
| 4925 | return _ret != NULL; |
| 4926 | } |
| 4927 | |
| 4928 | /** |
| 4929 | * sensor_threshold_complete_get_state: |
| 4930 | * @object: A #SensorThreshold. |
| 4931 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 4932 | * @state: Parameter to return. |
| 4933 | * |
| 4934 | * 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. |
| 4935 | * |
| 4936 | * This method will free @invocation, you cannot use it afterwards. |
| 4937 | */ |
| 4938 | void |
| 4939 | sensor_threshold_complete_get_state ( |
| 4940 | SensorThreshold *object, |
| 4941 | GDBusMethodInvocation *invocation, |
| 4942 | guchar state) |
| 4943 | { |
| 4944 | g_dbus_method_invocation_return_value (invocation, |
| 4945 | g_variant_new ("(y)", |
| 4946 | state)); |
| 4947 | } |
| 4948 | |
| 4949 | /* ------------------------------------------------------------------------ */ |
| 4950 | |
| 4951 | /** |
| 4952 | * SensorThresholdProxy: |
| 4953 | * |
| 4954 | * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 4955 | */ |
| 4956 | |
| 4957 | /** |
| 4958 | * SensorThresholdProxyClass: |
| 4959 | * @parent_class: The parent class. |
| 4960 | * |
| 4961 | * Class structure for #SensorThresholdProxy. |
| 4962 | */ |
| 4963 | |
| 4964 | struct _SensorThresholdProxyPrivate |
| 4965 | { |
| 4966 | GData *qdata; |
| 4967 | }; |
| 4968 | |
| 4969 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
| 4970 | |
| 4971 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4972 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 4973 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 4974 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 4975 | |
| 4976 | #else |
| 4977 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 4978 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 4979 | |
| 4980 | #endif |
| 4981 | static void |
| 4982 | sensor_threshold_proxy_finalize (GObject *object) |
| 4983 | { |
| 4984 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 4985 | g_datalist_clear (&proxy->priv->qdata); |
| 4986 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
| 4987 | } |
| 4988 | |
| 4989 | static void |
| 4990 | sensor_threshold_proxy_get_property (GObject *object, |
| 4991 | guint prop_id, |
| 4992 | GValue *value, |
| 4993 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4994 | { |
| 4995 | const _ExtendedGDBusPropertyInfo *info; |
| 4996 | GVariant *variant; |
| 4997 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 4998 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 4999 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5000 | if (info->use_gvariant) |
| 5001 | { |
| 5002 | g_value_set_variant (value, variant); |
| 5003 | } |
| 5004 | else |
| 5005 | { |
| 5006 | if (variant != NULL) |
| 5007 | g_dbus_gvariant_to_gvalue (variant, value); |
| 5008 | } |
| 5009 | if (variant != NULL) |
| 5010 | g_variant_unref (variant); |
| 5011 | } |
| 5012 | |
| 5013 | static void |
| 5014 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 5015 | GAsyncResult *res, |
| 5016 | gpointer user_data) |
| 5017 | { |
| 5018 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5019 | GError *error; |
| 5020 | GVariant *_ret; |
| 5021 | error = NULL; |
| 5022 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5023 | if (!_ret) |
| 5024 | { |
| 5025 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", |
| 5026 | info->parent_struct.name, |
| 5027 | error->message, g_quark_to_string (error->domain), error->code); |
| 5028 | g_error_free (error); |
| 5029 | } |
| 5030 | else |
| 5031 | { |
| 5032 | g_variant_unref (_ret); |
| 5033 | } |
| 5034 | } |
| 5035 | |
| 5036 | static void |
| 5037 | sensor_threshold_proxy_set_property (GObject *object, |
| 5038 | guint prop_id, |
| 5039 | const GValue *value, |
| 5040 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5041 | { |
| 5042 | const _ExtendedGDBusPropertyInfo *info; |
| 5043 | GVariant *variant; |
| 5044 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 5045 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 5046 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5047 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5048 | "org.freedesktop.DBus.Properties.Set", |
| 5049 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
| 5050 | G_DBUS_CALL_FLAGS_NONE, |
| 5051 | -1, |
| 5052 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5053 | g_variant_unref (variant); |
| 5054 | } |
| 5055 | |
| 5056 | static void |
| 5057 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 5058 | const gchar *sender_name G_GNUC_UNUSED, |
| 5059 | const gchar *signal_name, |
| 5060 | GVariant *parameters) |
| 5061 | { |
| 5062 | _ExtendedGDBusSignalInfo *info; |
| 5063 | GVariantIter iter; |
| 5064 | GVariant *child; |
| 5065 | GValue *paramv; |
| 5066 | guint num_params; |
| 5067 | guint n; |
| 5068 | guint signal_id; |
| 5069 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); |
| 5070 | if (info == NULL) |
| 5071 | return; |
| 5072 | num_params = g_variant_n_children (parameters); |
| 5073 | paramv = g_new0 (GValue, num_params + 1); |
| 5074 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
| 5075 | g_value_set_object (¶mv[0], proxy); |
| 5076 | g_variant_iter_init (&iter, parameters); |
| 5077 | n = 1; |
| 5078 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5079 | { |
| 5080 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5081 | if (arg_info->use_gvariant) |
| 5082 | { |
| 5083 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5084 | g_value_set_variant (¶mv[n], child); |
| 5085 | n++; |
| 5086 | } |
| 5087 | else |
| 5088 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5089 | g_variant_unref (child); |
| 5090 | } |
| 5091 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 5092 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5093 | for (n = 0; n < num_params + 1; n++) |
| 5094 | g_value_unset (¶mv[n]); |
| 5095 | g_free (paramv); |
| 5096 | } |
| 5097 | |
| 5098 | static void |
| 5099 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5100 | GVariant *changed_properties, |
| 5101 | const gchar *const *invalidated_properties) |
| 5102 | { |
| 5103 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
| 5104 | guint n; |
| 5105 | const gchar *key; |
| 5106 | GVariantIter *iter; |
| 5107 | _ExtendedGDBusPropertyInfo *info; |
| 5108 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 5109 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5110 | { |
| 5111 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); |
| 5112 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5113 | if (info != NULL) |
| 5114 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5115 | } |
| 5116 | g_variant_iter_free (iter); |
| 5117 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5118 | { |
| 5119 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 5120 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5121 | if (info != NULL) |
| 5122 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5123 | } |
| 5124 | } |
| 5125 | |
| 5126 | static GVariant * |
| 5127 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
| 5128 | { |
| 5129 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5130 | GVariant *variant; |
| 5131 | GVariant *value = NULL; |
| 5132 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); |
| 5133 | value = variant; |
| 5134 | if (variant != NULL) |
| 5135 | g_variant_unref (variant); |
| 5136 | return value; |
| 5137 | } |
| 5138 | |
| 5139 | static GVariant * |
| 5140 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
| 5141 | { |
| 5142 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5143 | GVariant *variant; |
| 5144 | GVariant *value = NULL; |
| 5145 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); |
| 5146 | value = variant; |
| 5147 | if (variant != NULL) |
| 5148 | g_variant_unref (variant); |
| 5149 | return value; |
| 5150 | } |
| 5151 | |
| 5152 | static GVariant * |
| 5153 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
| 5154 | { |
| 5155 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5156 | GVariant *variant; |
| 5157 | GVariant *value = NULL; |
| 5158 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); |
| 5159 | value = variant; |
| 5160 | if (variant != NULL) |
| 5161 | g_variant_unref (variant); |
| 5162 | return value; |
| 5163 | } |
| 5164 | |
| 5165 | static GVariant * |
| 5166 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
| 5167 | { |
| 5168 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5169 | GVariant *variant; |
| 5170 | GVariant *value = NULL; |
| 5171 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); |
| 5172 | value = variant; |
| 5173 | if (variant != NULL) |
| 5174 | g_variant_unref (variant); |
| 5175 | return value; |
| 5176 | } |
| 5177 | |
| 5178 | static guchar |
| 5179 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
| 5180 | { |
| 5181 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5182 | GVariant *variant; |
| 5183 | guchar value = 0; |
| 5184 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 5185 | if (variant != NULL) |
| 5186 | { |
| 5187 | value = g_variant_get_byte (variant); |
| 5188 | g_variant_unref (variant); |
| 5189 | } |
| 5190 | return value; |
| 5191 | } |
| 5192 | |
| 5193 | static void |
| 5194 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
| 5195 | { |
| 5196 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5197 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
| 5198 | #else |
| 5199 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); |
| 5200 | #endif |
| 5201 | |
| 5202 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); |
| 5203 | } |
| 5204 | |
| 5205 | static void |
| 5206 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
| 5207 | { |
| 5208 | GObjectClass *gobject_class; |
| 5209 | GDBusProxyClass *proxy_class; |
| 5210 | |
| 5211 | gobject_class = G_OBJECT_CLASS (klass); |
| 5212 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 5213 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 5214 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
| 5215 | |
| 5216 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 5217 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 5218 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
| 5219 | |
| 5220 | sensor_threshold_override_properties (gobject_class, 1); |
| 5221 | |
| 5222 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5223 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
| 5224 | #endif |
| 5225 | } |
| 5226 | |
| 5227 | static void |
| 5228 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
| 5229 | { |
| 5230 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 5231 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 5232 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 5233 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 5234 | iface->get_state = sensor_threshold_proxy_get_state; |
| 5235 | } |
| 5236 | |
| 5237 | /** |
| 5238 | * sensor_threshold_proxy_new: |
| 5239 | * @connection: A #GDBusConnection. |
| 5240 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5241 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5242 | * @object_path: An object path. |
| 5243 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5244 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5245 | * @user_data: User data to pass to @callback. |
| 5246 | * |
| 5247 | * 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. |
| 5248 | * |
| 5249 | * 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. |
| 5250 | * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. |
| 5251 | * |
| 5252 | * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 5253 | */ |
| 5254 | void |
| 5255 | sensor_threshold_proxy_new ( |
| 5256 | GDBusConnection *connection, |
| 5257 | GDBusProxyFlags flags, |
| 5258 | const gchar *name, |
| 5259 | const gchar *object_path, |
| 5260 | GCancellable *cancellable, |
| 5261 | GAsyncReadyCallback callback, |
| 5262 | gpointer user_data) |
| 5263 | { |
| 5264 | 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); |
| 5265 | } |
| 5266 | |
| 5267 | /** |
| 5268 | * sensor_threshold_proxy_new_finish: |
| 5269 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). |
| 5270 | * @error: Return location for error or %NULL |
| 5271 | * |
| 5272 | * Finishes an operation started with sensor_threshold_proxy_new(). |
| 5273 | * |
| 5274 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 5275 | */ |
| 5276 | SensorThreshold * |
| 5277 | sensor_threshold_proxy_new_finish ( |
| 5278 | GAsyncResult *res, |
| 5279 | GError **error) |
| 5280 | { |
| 5281 | GObject *ret; |
| 5282 | GObject *source_object; |
| 5283 | source_object = g_async_result_get_source_object (res); |
| 5284 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5285 | g_object_unref (source_object); |
| 5286 | if (ret != NULL) |
| 5287 | return SENSOR_THRESHOLD (ret); |
| 5288 | else |
| 5289 | return NULL; |
| 5290 | } |
| 5291 | |
| 5292 | /** |
| 5293 | * sensor_threshold_proxy_new_sync: |
| 5294 | * @connection: A #GDBusConnection. |
| 5295 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5296 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5297 | * @object_path: An object path. |
| 5298 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5299 | * @error: Return location for error or %NULL |
| 5300 | * |
| 5301 | * 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. |
| 5302 | * |
| 5303 | * The calling thread is blocked until a reply is received. |
| 5304 | * |
| 5305 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
| 5306 | * |
| 5307 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 5308 | */ |
| 5309 | SensorThreshold * |
| 5310 | sensor_threshold_proxy_new_sync ( |
| 5311 | GDBusConnection *connection, |
| 5312 | GDBusProxyFlags flags, |
| 5313 | const gchar *name, |
| 5314 | const gchar *object_path, |
| 5315 | GCancellable *cancellable, |
| 5316 | GError **error) |
| 5317 | { |
| 5318 | GInitable *ret; |
| 5319 | 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); |
| 5320 | if (ret != NULL) |
| 5321 | return SENSOR_THRESHOLD (ret); |
| 5322 | else |
| 5323 | return NULL; |
| 5324 | } |
| 5325 | |
| 5326 | |
| 5327 | /** |
| 5328 | * sensor_threshold_proxy_new_for_bus: |
| 5329 | * @bus_type: A #GBusType. |
| 5330 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5331 | * @name: A bus name (well-known or unique). |
| 5332 | * @object_path: An object path. |
| 5333 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5334 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5335 | * @user_data: User data to pass to @callback. |
| 5336 | * |
| 5337 | * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 5338 | * |
| 5339 | * 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. |
| 5340 | * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 5341 | * |
| 5342 | * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 5343 | */ |
| 5344 | void |
| 5345 | sensor_threshold_proxy_new_for_bus ( |
| 5346 | GBusType bus_type, |
| 5347 | GDBusProxyFlags flags, |
| 5348 | const gchar *name, |
| 5349 | const gchar *object_path, |
| 5350 | GCancellable *cancellable, |
| 5351 | GAsyncReadyCallback callback, |
| 5352 | gpointer user_data) |
| 5353 | { |
| 5354 | 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); |
| 5355 | } |
| 5356 | |
| 5357 | /** |
| 5358 | * sensor_threshold_proxy_new_for_bus_finish: |
| 5359 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). |
| 5360 | * @error: Return location for error or %NULL |
| 5361 | * |
| 5362 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
| 5363 | * |
| 5364 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 5365 | */ |
| 5366 | SensorThreshold * |
| 5367 | sensor_threshold_proxy_new_for_bus_finish ( |
| 5368 | GAsyncResult *res, |
| 5369 | GError **error) |
| 5370 | { |
| 5371 | GObject *ret; |
| 5372 | GObject *source_object; |
| 5373 | source_object = g_async_result_get_source_object (res); |
| 5374 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5375 | g_object_unref (source_object); |
| 5376 | if (ret != NULL) |
| 5377 | return SENSOR_THRESHOLD (ret); |
| 5378 | else |
| 5379 | return NULL; |
| 5380 | } |
| 5381 | |
| 5382 | /** |
| 5383 | * sensor_threshold_proxy_new_for_bus_sync: |
| 5384 | * @bus_type: A #GBusType. |
| 5385 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5386 | * @name: A bus name (well-known or unique). |
| 5387 | * @object_path: An object path. |
| 5388 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5389 | * @error: Return location for error or %NULL |
| 5390 | * |
| 5391 | * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 5392 | * |
| 5393 | * The calling thread is blocked until a reply is received. |
| 5394 | * |
| 5395 | * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 5396 | * |
| 5397 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 5398 | */ |
| 5399 | SensorThreshold * |
| 5400 | sensor_threshold_proxy_new_for_bus_sync ( |
| 5401 | GBusType bus_type, |
| 5402 | GDBusProxyFlags flags, |
| 5403 | const gchar *name, |
| 5404 | const gchar *object_path, |
| 5405 | GCancellable *cancellable, |
| 5406 | GError **error) |
| 5407 | { |
| 5408 | GInitable *ret; |
| 5409 | 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); |
| 5410 | if (ret != NULL) |
| 5411 | return SENSOR_THRESHOLD (ret); |
| 5412 | else |
| 5413 | return NULL; |
| 5414 | } |
| 5415 | |
| 5416 | |
| 5417 | /* ------------------------------------------------------------------------ */ |
| 5418 | |
| 5419 | /** |
| 5420 | * SensorThresholdSkeleton: |
| 5421 | * |
| 5422 | * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 5423 | */ |
| 5424 | |
| 5425 | /** |
| 5426 | * SensorThresholdSkeletonClass: |
| 5427 | * @parent_class: The parent class. |
| 5428 | * |
| 5429 | * Class structure for #SensorThresholdSkeleton. |
| 5430 | */ |
| 5431 | |
| 5432 | struct _SensorThresholdSkeletonPrivate |
| 5433 | { |
| 5434 | GValue *properties; |
| 5435 | GList *changed_properties; |
| 5436 | GSource *changed_properties_idle_source; |
| 5437 | GMainContext *context; |
| 5438 | GMutex lock; |
| 5439 | }; |
| 5440 | |
| 5441 | static void |
| 5442 | _sensor_threshold_skeleton_handle_method_call ( |
| 5443 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5444 | const gchar *sender G_GNUC_UNUSED, |
| 5445 | const gchar *object_path G_GNUC_UNUSED, |
| 5446 | const gchar *interface_name, |
| 5447 | const gchar *method_name, |
| 5448 | GVariant *parameters, |
| 5449 | GDBusMethodInvocation *invocation, |
| 5450 | gpointer user_data) |
| 5451 | { |
| 5452 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 5453 | _ExtendedGDBusMethodInfo *info; |
| 5454 | GVariantIter iter; |
| 5455 | GVariant *child; |
| 5456 | GValue *paramv; |
| 5457 | guint num_params; |
| 5458 | guint num_extra; |
| 5459 | guint n; |
| 5460 | guint signal_id; |
| 5461 | GValue return_value = G_VALUE_INIT; |
| 5462 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 5463 | g_assert (info != NULL); |
| 5464 | num_params = g_variant_n_children (parameters); |
| 5465 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 5466 | n = 0; |
| 5467 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
| 5468 | g_value_set_object (¶mv[n++], skeleton); |
| 5469 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 5470 | g_value_set_object (¶mv[n++], invocation); |
| 5471 | if (info->pass_fdlist) |
| 5472 | { |
| 5473 | #ifdef G_OS_UNIX |
| 5474 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 5475 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 5476 | #else |
| 5477 | g_assert_not_reached (); |
| 5478 | #endif |
| 5479 | } |
| 5480 | g_variant_iter_init (&iter, parameters); |
| 5481 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5482 | { |
| 5483 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 5484 | if (arg_info->use_gvariant) |
| 5485 | { |
| 5486 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5487 | g_value_set_variant (¶mv[n], child); |
| 5488 | n++; |
| 5489 | } |
| 5490 | else |
| 5491 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5492 | g_variant_unref (child); |
| 5493 | } |
| 5494 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 5495 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 5496 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 5497 | if (!g_value_get_boolean (&return_value)) |
| 5498 | 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); |
| 5499 | g_value_unset (&return_value); |
| 5500 | for (n = 0; n < num_params + num_extra; n++) |
| 5501 | g_value_unset (¶mv[n]); |
| 5502 | g_free (paramv); |
| 5503 | } |
| 5504 | |
| 5505 | static GVariant * |
| 5506 | _sensor_threshold_skeleton_handle_get_property ( |
| 5507 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5508 | const gchar *sender G_GNUC_UNUSED, |
| 5509 | const gchar *object_path G_GNUC_UNUSED, |
| 5510 | const gchar *interface_name G_GNUC_UNUSED, |
| 5511 | const gchar *property_name, |
| 5512 | GError **error, |
| 5513 | gpointer user_data) |
| 5514 | { |
| 5515 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 5516 | GValue value = G_VALUE_INIT; |
| 5517 | GParamSpec *pspec; |
| 5518 | _ExtendedGDBusPropertyInfo *info; |
| 5519 | GVariant *ret; |
| 5520 | ret = NULL; |
| 5521 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 5522 | g_assert (info != NULL); |
| 5523 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5524 | if (pspec == NULL) |
| 5525 | { |
| 5526 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5527 | } |
| 5528 | else |
| 5529 | { |
| 5530 | g_value_init (&value, pspec->value_type); |
| 5531 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5532 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5533 | g_value_unset (&value); |
| 5534 | } |
| 5535 | return ret; |
| 5536 | } |
| 5537 | |
| 5538 | static gboolean |
| 5539 | _sensor_threshold_skeleton_handle_set_property ( |
| 5540 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5541 | const gchar *sender G_GNUC_UNUSED, |
| 5542 | const gchar *object_path G_GNUC_UNUSED, |
| 5543 | const gchar *interface_name G_GNUC_UNUSED, |
| 5544 | const gchar *property_name, |
| 5545 | GVariant *variant, |
| 5546 | GError **error, |
| 5547 | gpointer user_data) |
| 5548 | { |
| 5549 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 5550 | GValue value = G_VALUE_INIT; |
| 5551 | GParamSpec *pspec; |
| 5552 | _ExtendedGDBusPropertyInfo *info; |
| 5553 | gboolean ret; |
| 5554 | ret = FALSE; |
| 5555 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 5556 | g_assert (info != NULL); |
| 5557 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5558 | if (pspec == NULL) |
| 5559 | { |
| 5560 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5561 | } |
| 5562 | else |
| 5563 | { |
| 5564 | if (info->use_gvariant) |
| 5565 | g_value_set_variant (&value, variant); |
| 5566 | else |
| 5567 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 5568 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5569 | g_value_unset (&value); |
| 5570 | ret = TRUE; |
| 5571 | } |
| 5572 | return ret; |
| 5573 | } |
| 5574 | |
| 5575 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
| 5576 | { |
| 5577 | _sensor_threshold_skeleton_handle_method_call, |
| 5578 | _sensor_threshold_skeleton_handle_get_property, |
| 5579 | _sensor_threshold_skeleton_handle_set_property, |
| 5580 | {NULL} |
| 5581 | }; |
| 5582 | |
| 5583 | static GDBusInterfaceInfo * |
| 5584 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5585 | { |
| 5586 | return sensor_threshold_interface_info (); |
| 5587 | } |
| 5588 | |
| 5589 | static GDBusInterfaceVTable * |
| 5590 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5591 | { |
| 5592 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
| 5593 | } |
| 5594 | |
| 5595 | static GVariant * |
| 5596 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 5597 | { |
| 5598 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 5599 | |
| 5600 | GVariantBuilder builder; |
| 5601 | guint n; |
| 5602 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5603 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
| 5604 | goto out; |
| 5605 | for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 5606 | { |
| 5607 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
| 5608 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 5609 | { |
| 5610 | GVariant *value; |
| 5611 | 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); |
| 5612 | if (value != NULL) |
| 5613 | { |
| 5614 | g_variant_take_ref (value); |
| 5615 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 5616 | g_variant_unref (value); |
| 5617 | } |
| 5618 | } |
| 5619 | } |
| 5620 | out: |
| 5621 | return g_variant_builder_end (&builder); |
| 5622 | } |
| 5623 | |
| 5624 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
| 5625 | |
| 5626 | static void |
| 5627 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 5628 | { |
| 5629 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 5630 | gboolean emit_changed = FALSE; |
| 5631 | |
| 5632 | g_mutex_lock (&skeleton->priv->lock); |
| 5633 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5634 | { |
| 5635 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5636 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5637 | emit_changed = TRUE; |
| 5638 | } |
| 5639 | g_mutex_unlock (&skeleton->priv->lock); |
| 5640 | |
| 5641 | if (emit_changed) |
| 5642 | _sensor_threshold_emit_changed (skeleton); |
| 5643 | } |
| 5644 | |
| 5645 | static void |
| 5646 | _sensor_threshold_on_signal_warning ( |
| 5647 | SensorThreshold *object) |
| 5648 | { |
| 5649 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5650 | |
| 5651 | GList *connections, *l; |
| 5652 | GVariant *signal_variant; |
| 5653 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5654 | |
| 5655 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 5656 | for (l = connections; l != NULL; l = l->next) |
| 5657 | { |
| 5658 | GDBusConnection *connection = l->data; |
| 5659 | g_dbus_connection_emit_signal (connection, |
| 5660 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", |
| 5661 | signal_variant, NULL); |
| 5662 | } |
| 5663 | g_variant_unref (signal_variant); |
| 5664 | g_list_free_full (connections, g_object_unref); |
| 5665 | } |
| 5666 | |
| 5667 | static void |
| 5668 | _sensor_threshold_on_signal_critical ( |
| 5669 | SensorThreshold *object) |
| 5670 | { |
| 5671 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5672 | |
| 5673 | GList *connections, *l; |
| 5674 | GVariant *signal_variant; |
| 5675 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5676 | |
| 5677 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 5678 | for (l = connections; l != NULL; l = l->next) |
| 5679 | { |
| 5680 | GDBusConnection *connection = l->data; |
| 5681 | g_dbus_connection_emit_signal (connection, |
| 5682 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", |
| 5683 | signal_variant, NULL); |
| 5684 | } |
| 5685 | g_variant_unref (signal_variant); |
| 5686 | g_list_free_full (connections, g_object_unref); |
| 5687 | } |
| 5688 | |
| 5689 | static void |
| 5690 | _sensor_threshold_on_signal_normal ( |
| 5691 | SensorThreshold *object) |
| 5692 | { |
| 5693 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5694 | |
| 5695 | GList *connections, *l; |
| 5696 | GVariant *signal_variant; |
| 5697 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5698 | |
| 5699 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 5700 | for (l = connections; l != NULL; l = l->next) |
| 5701 | { |
| 5702 | GDBusConnection *connection = l->data; |
| 5703 | g_dbus_connection_emit_signal (connection, |
| 5704 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", |
| 5705 | signal_variant, NULL); |
| 5706 | } |
| 5707 | g_variant_unref (signal_variant); |
| 5708 | g_list_free_full (connections, g_object_unref); |
| 5709 | } |
| 5710 | |
| 5711 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
| 5712 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5713 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5714 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 5715 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 5716 | |
| 5717 | #else |
| 5718 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5719 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 5720 | |
| 5721 | #endif |
| 5722 | static void |
| 5723 | sensor_threshold_skeleton_finalize (GObject *object) |
| 5724 | { |
| 5725 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5726 | guint n; |
| 5727 | for (n = 0; n < 5; n++) |
| 5728 | g_value_unset (&skeleton->priv->properties[n]); |
| 5729 | g_free (skeleton->priv->properties); |
| 5730 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5731 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5732 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5733 | g_main_context_unref (skeleton->priv->context); |
| 5734 | g_mutex_clear (&skeleton->priv->lock); |
| 5735 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
| 5736 | } |
| 5737 | |
| 5738 | static void |
| 5739 | sensor_threshold_skeleton_get_property (GObject *object, |
| 5740 | guint prop_id, |
| 5741 | GValue *value, |
| 5742 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5743 | { |
| 5744 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5745 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 5746 | g_mutex_lock (&skeleton->priv->lock); |
| 5747 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 5748 | g_mutex_unlock (&skeleton->priv->lock); |
| 5749 | } |
| 5750 | |
| 5751 | static gboolean |
| 5752 | _sensor_threshold_emit_changed (gpointer user_data) |
| 5753 | { |
| 5754 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 5755 | GList *l; |
| 5756 | GVariantBuilder builder; |
| 5757 | GVariantBuilder invalidated_builder; |
| 5758 | guint num_changes; |
| 5759 | |
| 5760 | g_mutex_lock (&skeleton->priv->lock); |
| 5761 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5762 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 5763 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 5764 | { |
| 5765 | ChangedProperty *cp = l->data; |
| 5766 | GVariant *variant; |
| 5767 | const GValue *cur_value; |
| 5768 | |
| 5769 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 5770 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 5771 | { |
| 5772 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 5773 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 5774 | g_variant_unref (variant); |
| 5775 | num_changes++; |
| 5776 | } |
| 5777 | } |
| 5778 | if (num_changes > 0) |
| 5779 | { |
| 5780 | GList *connections, *ll; |
| 5781 | GVariant *signal_variant; |
| 5782 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", |
| 5783 | &builder, &invalidated_builder)); |
| 5784 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5785 | for (ll = connections; ll != NULL; ll = ll->next) |
| 5786 | { |
| 5787 | GDBusConnection *connection = ll->data; |
| 5788 | |
| 5789 | g_dbus_connection_emit_signal (connection, |
| 5790 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 5791 | "org.freedesktop.DBus.Properties", |
| 5792 | "PropertiesChanged", |
| 5793 | signal_variant, |
| 5794 | NULL); |
| 5795 | } |
| 5796 | g_variant_unref (signal_variant); |
| 5797 | g_list_free_full (connections, g_object_unref); |
| 5798 | } |
| 5799 | else |
| 5800 | { |
| 5801 | g_variant_builder_clear (&builder); |
| 5802 | g_variant_builder_clear (&invalidated_builder); |
| 5803 | } |
| 5804 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5805 | skeleton->priv->changed_properties = NULL; |
| 5806 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5807 | g_mutex_unlock (&skeleton->priv->lock); |
| 5808 | return FALSE; |
| 5809 | } |
| 5810 | |
| 5811 | static void |
| 5812 | _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 5813 | { |
| 5814 | ChangedProperty *cp; |
| 5815 | GList *l; |
| 5816 | cp = NULL; |
| 5817 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 5818 | { |
| 5819 | ChangedProperty *i_cp = l->data; |
| 5820 | if (i_cp->info == info) |
| 5821 | { |
| 5822 | cp = i_cp; |
| 5823 | break; |
| 5824 | } |
| 5825 | } |
| 5826 | if (cp == NULL) |
| 5827 | { |
| 5828 | cp = g_new0 (ChangedProperty, 1); |
| 5829 | cp->prop_id = prop_id; |
| 5830 | cp->info = info; |
| 5831 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 5832 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 5833 | g_value_copy (orig_value, &cp->orig_value); |
| 5834 | } |
| 5835 | } |
| 5836 | |
| 5837 | static void |
| 5838 | sensor_threshold_skeleton_notify (GObject *object, |
| 5839 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5840 | { |
| 5841 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5842 | g_mutex_lock (&skeleton->priv->lock); |
| 5843 | if (skeleton->priv->changed_properties != NULL && |
| 5844 | skeleton->priv->changed_properties_idle_source == NULL) |
| 5845 | { |
| 5846 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 5847 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 5848 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 5849 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 5850 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 5851 | } |
| 5852 | g_mutex_unlock (&skeleton->priv->lock); |
| 5853 | } |
| 5854 | |
| 5855 | static void |
| 5856 | sensor_threshold_skeleton_set_property (GObject *object, |
| 5857 | guint prop_id, |
| 5858 | const GValue *value, |
| 5859 | GParamSpec *pspec) |
| 5860 | { |
| 5861 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5862 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 5863 | g_mutex_lock (&skeleton->priv->lock); |
| 5864 | g_object_freeze_notify (object); |
| 5865 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 5866 | { |
| 5867 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 5868 | _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 5869 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 5870 | g_object_notify_by_pspec (object, pspec); |
| 5871 | } |
| 5872 | g_mutex_unlock (&skeleton->priv->lock); |
| 5873 | g_object_thaw_notify (object); |
| 5874 | } |
| 5875 | |
| 5876 | static void |
| 5877 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
| 5878 | { |
| 5879 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5880 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
| 5881 | #else |
| 5882 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); |
| 5883 | #endif |
| 5884 | |
| 5885 | g_mutex_init (&skeleton->priv->lock); |
| 5886 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 5887 | skeleton->priv->properties = g_new0 (GValue, 5); |
| 5888 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 5889 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 5890 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 5891 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 5892 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
| 5893 | } |
| 5894 | |
| 5895 | static GVariant * |
| 5896 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
| 5897 | { |
| 5898 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5899 | GVariant *value; |
| 5900 | g_mutex_lock (&skeleton->priv->lock); |
| 5901 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 5902 | g_mutex_unlock (&skeleton->priv->lock); |
| 5903 | return value; |
| 5904 | } |
| 5905 | |
| 5906 | static GVariant * |
| 5907 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
| 5908 | { |
| 5909 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5910 | GVariant *value; |
| 5911 | g_mutex_lock (&skeleton->priv->lock); |
| 5912 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
| 5913 | g_mutex_unlock (&skeleton->priv->lock); |
| 5914 | return value; |
| 5915 | } |
| 5916 | |
| 5917 | static GVariant * |
| 5918 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
| 5919 | { |
| 5920 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5921 | GVariant *value; |
| 5922 | g_mutex_lock (&skeleton->priv->lock); |
| 5923 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
| 5924 | g_mutex_unlock (&skeleton->priv->lock); |
| 5925 | return value; |
| 5926 | } |
| 5927 | |
| 5928 | static GVariant * |
| 5929 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
| 5930 | { |
| 5931 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5932 | GVariant *value; |
| 5933 | g_mutex_lock (&skeleton->priv->lock); |
| 5934 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
| 5935 | g_mutex_unlock (&skeleton->priv->lock); |
| 5936 | return value; |
| 5937 | } |
| 5938 | |
| 5939 | static guchar |
| 5940 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
| 5941 | { |
| 5942 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 5943 | guchar value; |
| 5944 | g_mutex_lock (&skeleton->priv->lock); |
| 5945 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
| 5946 | g_mutex_unlock (&skeleton->priv->lock); |
| 5947 | return value; |
| 5948 | } |
| 5949 | |
| 5950 | static void |
| 5951 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
| 5952 | { |
| 5953 | GObjectClass *gobject_class; |
| 5954 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 5955 | |
| 5956 | gobject_class = G_OBJECT_CLASS (klass); |
| 5957 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 5958 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 5959 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 5960 | gobject_class->notify = sensor_threshold_skeleton_notify; |
| 5961 | |
| 5962 | |
| 5963 | sensor_threshold_override_properties (gobject_class, 1); |
| 5964 | |
| 5965 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 5966 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 5967 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 5968 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 5969 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
| 5970 | |
| 5971 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5972 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
| 5973 | #endif |
| 5974 | } |
| 5975 | |
| 5976 | static void |
| 5977 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
| 5978 | { |
| 5979 | iface->warning = _sensor_threshold_on_signal_warning; |
| 5980 | iface->critical = _sensor_threshold_on_signal_critical; |
| 5981 | iface->normal = _sensor_threshold_on_signal_normal; |
| 5982 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 5983 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 5984 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 5985 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 5986 | iface->get_state = sensor_threshold_skeleton_get_state; |
| 5987 | } |
| 5988 | |
| 5989 | /** |
| 5990 | * sensor_threshold_skeleton_new: |
| 5991 | * |
| 5992 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 5993 | * |
| 5994 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
| 5995 | */ |
| 5996 | SensorThreshold * |
| 5997 | sensor_threshold_skeleton_new (void) |
| 5998 | { |
| 5999 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
| 6000 | } |
| 6001 | |
| 6002 | /* ------------------------------------------------------------------------ |
| 6003 | * Code for interface org.openbmc.SensorI2c |
| 6004 | * ------------------------------------------------------------------------ |
| 6005 | */ |
| 6006 | |
| 6007 | /** |
| 6008 | * SECTION:SensorI2c |
| 6009 | * @title: SensorI2c |
| 6010 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 6011 | * |
| 6012 | * 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. |
| 6013 | */ |
| 6014 | |
| 6015 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 6016 | |
| 6017 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 6018 | { |
| 6019 | { |
| 6020 | -1, |
| 6021 | (gchar *) "dev_path", |
| 6022 | (gchar *) "s", |
| 6023 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6024 | NULL |
| 6025 | }, |
| 6026 | "dev-path", |
| 6027 | FALSE |
| 6028 | }; |
| 6029 | |
| 6030 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 6031 | { |
| 6032 | { |
| 6033 | -1, |
| 6034 | (gchar *) "address", |
| 6035 | (gchar *) "s", |
| 6036 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6037 | NULL |
| 6038 | }, |
| 6039 | "address", |
| 6040 | FALSE |
| 6041 | }; |
| 6042 | |
| 6043 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 6044 | { |
| 6045 | &_sensor_i2c_property_info_dev_path, |
| 6046 | &_sensor_i2c_property_info_address, |
| 6047 | NULL |
| 6048 | }; |
| 6049 | |
| 6050 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 6051 | { |
| 6052 | { |
| 6053 | -1, |
| 6054 | (gchar *) "org.openbmc.SensorI2c", |
| 6055 | NULL, |
| 6056 | NULL, |
| 6057 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 6058 | NULL |
| 6059 | }, |
| 6060 | "sensor-i2c", |
| 6061 | }; |
| 6062 | |
| 6063 | |
| 6064 | /** |
| 6065 | * sensor_i2c_interface_info: |
| 6066 | * |
| 6067 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 6068 | * |
| 6069 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 6070 | */ |
| 6071 | GDBusInterfaceInfo * |
| 6072 | sensor_i2c_interface_info (void) |
| 6073 | { |
| 6074 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 6075 | } |
| 6076 | |
| 6077 | /** |
| 6078 | * sensor_i2c_override_properties: |
| 6079 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 6080 | * @property_id_begin: The property id to assign to the first overridden property. |
| 6081 | * |
| 6082 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 6083 | * The properties are overridden in the order they are defined. |
| 6084 | * |
| 6085 | * Returns: The last property id. |
| 6086 | */ |
| 6087 | guint |
| 6088 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 6089 | { |
| 6090 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 6091 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 6092 | return property_id_begin - 1; |
| 6093 | } |
| 6094 | |
| 6095 | |
| 6096 | |
| 6097 | /** |
| 6098 | * SensorI2c: |
| 6099 | * |
| 6100 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 6101 | */ |
| 6102 | |
| 6103 | /** |
| 6104 | * SensorI2cIface: |
| 6105 | * @parent_iface: The parent interface. |
| 6106 | * @get_address: Getter for the #SensorI2c:address property. |
| 6107 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 6108 | * |
| 6109 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 6110 | */ |
| 6111 | |
| 6112 | typedef SensorI2cIface SensorI2cInterface; |
| 6113 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 6114 | |
| 6115 | static void |
| 6116 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 6117 | { |
| 6118 | /* GObject properties for D-Bus properties: */ |
| 6119 | /** |
| 6120 | * SensorI2c:dev-path: |
| 6121 | * |
| 6122 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 6123 | * |
| 6124 | * 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. |
| 6125 | */ |
| 6126 | g_object_interface_install_property (iface, |
| 6127 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6128 | /** |
| 6129 | * SensorI2c:address: |
| 6130 | * |
| 6131 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 6132 | * |
| 6133 | * 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. |
| 6134 | */ |
| 6135 | g_object_interface_install_property (iface, |
| 6136 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6137 | } |
| 6138 | |
| 6139 | /** |
| 6140 | * sensor_i2c_get_dev_path: (skip) |
| 6141 | * @object: A #SensorI2c. |
| 6142 | * |
| 6143 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 6144 | * |
| 6145 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6146 | * |
| 6147 | * <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> |
| 6148 | * |
| 6149 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6150 | */ |
| 6151 | const gchar * |
| 6152 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 6153 | { |
| 6154 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 6155 | } |
| 6156 | |
| 6157 | /** |
| 6158 | * sensor_i2c_dup_dev_path: (skip) |
| 6159 | * @object: A #SensorI2c. |
| 6160 | * |
| 6161 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 6162 | * |
| 6163 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6164 | * |
| 6165 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 6166 | */ |
| 6167 | gchar * |
| 6168 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 6169 | { |
| 6170 | gchar *value; |
| 6171 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 6172 | return value; |
| 6173 | } |
| 6174 | |
| 6175 | /** |
| 6176 | * sensor_i2c_set_dev_path: (skip) |
| 6177 | * @object: A #SensorI2c. |
| 6178 | * @value: The value to set. |
| 6179 | * |
| 6180 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 6181 | * |
| 6182 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6183 | */ |
| 6184 | void |
| 6185 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 6186 | { |
| 6187 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 6188 | } |
| 6189 | |
| 6190 | /** |
| 6191 | * sensor_i2c_get_address: (skip) |
| 6192 | * @object: A #SensorI2c. |
| 6193 | * |
| 6194 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 6195 | * |
| 6196 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6197 | * |
| 6198 | * <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> |
| 6199 | * |
| 6200 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6201 | */ |
| 6202 | const gchar * |
| 6203 | sensor_i2c_get_address (SensorI2c *object) |
| 6204 | { |
| 6205 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 6206 | } |
| 6207 | |
| 6208 | /** |
| 6209 | * sensor_i2c_dup_address: (skip) |
| 6210 | * @object: A #SensorI2c. |
| 6211 | * |
| 6212 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 6213 | * |
| 6214 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6215 | * |
| 6216 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 6217 | */ |
| 6218 | gchar * |
| 6219 | sensor_i2c_dup_address (SensorI2c *object) |
| 6220 | { |
| 6221 | gchar *value; |
| 6222 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 6223 | return value; |
| 6224 | } |
| 6225 | |
| 6226 | /** |
| 6227 | * sensor_i2c_set_address: (skip) |
| 6228 | * @object: A #SensorI2c. |
| 6229 | * @value: The value to set. |
| 6230 | * |
| 6231 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 6232 | * |
| 6233 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6234 | */ |
| 6235 | void |
| 6236 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 6237 | { |
| 6238 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 6239 | } |
| 6240 | |
| 6241 | /* ------------------------------------------------------------------------ */ |
| 6242 | |
| 6243 | /** |
| 6244 | * SensorI2cProxy: |
| 6245 | * |
| 6246 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 6247 | */ |
| 6248 | |
| 6249 | /** |
| 6250 | * SensorI2cProxyClass: |
| 6251 | * @parent_class: The parent class. |
| 6252 | * |
| 6253 | * Class structure for #SensorI2cProxy. |
| 6254 | */ |
| 6255 | |
| 6256 | struct _SensorI2cProxyPrivate |
| 6257 | { |
| 6258 | GData *qdata; |
| 6259 | }; |
| 6260 | |
| 6261 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 6262 | |
| 6263 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6264 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 6265 | G_ADD_PRIVATE (SensorI2cProxy) |
| 6266 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 6267 | |
| 6268 | #else |
| 6269 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 6270 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 6271 | |
| 6272 | #endif |
| 6273 | static void |
| 6274 | sensor_i2c_proxy_finalize (GObject *object) |
| 6275 | { |
| 6276 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 6277 | g_datalist_clear (&proxy->priv->qdata); |
| 6278 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 6279 | } |
| 6280 | |
| 6281 | static void |
| 6282 | sensor_i2c_proxy_get_property (GObject *object, |
| 6283 | guint prop_id, |
| 6284 | GValue *value, |
| 6285 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6286 | { |
| 6287 | const _ExtendedGDBusPropertyInfo *info; |
| 6288 | GVariant *variant; |
| 6289 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6290 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 6291 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 6292 | if (info->use_gvariant) |
| 6293 | { |
| 6294 | g_value_set_variant (value, variant); |
| 6295 | } |
| 6296 | else |
| 6297 | { |
| 6298 | if (variant != NULL) |
| 6299 | g_dbus_gvariant_to_gvalue (variant, value); |
| 6300 | } |
| 6301 | if (variant != NULL) |
| 6302 | g_variant_unref (variant); |
| 6303 | } |
| 6304 | |
| 6305 | static void |
| 6306 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 6307 | GAsyncResult *res, |
| 6308 | gpointer user_data) |
| 6309 | { |
| 6310 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 6311 | GError *error; |
| 6312 | GVariant *_ret; |
| 6313 | error = NULL; |
| 6314 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 6315 | if (!_ret) |
| 6316 | { |
| 6317 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 6318 | info->parent_struct.name, |
| 6319 | error->message, g_quark_to_string (error->domain), error->code); |
| 6320 | g_error_free (error); |
| 6321 | } |
| 6322 | else |
| 6323 | { |
| 6324 | g_variant_unref (_ret); |
| 6325 | } |
| 6326 | } |
| 6327 | |
| 6328 | static void |
| 6329 | sensor_i2c_proxy_set_property (GObject *object, |
| 6330 | guint prop_id, |
| 6331 | const GValue *value, |
| 6332 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6333 | { |
| 6334 | const _ExtendedGDBusPropertyInfo *info; |
| 6335 | GVariant *variant; |
| 6336 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6337 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 6338 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6339 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 6340 | "org.freedesktop.DBus.Properties.Set", |
| 6341 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 6342 | G_DBUS_CALL_FLAGS_NONE, |
| 6343 | -1, |
| 6344 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 6345 | g_variant_unref (variant); |
| 6346 | } |
| 6347 | |
| 6348 | static void |
| 6349 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 6350 | const gchar *sender_name G_GNUC_UNUSED, |
| 6351 | const gchar *signal_name, |
| 6352 | GVariant *parameters) |
| 6353 | { |
| 6354 | _ExtendedGDBusSignalInfo *info; |
| 6355 | GVariantIter iter; |
| 6356 | GVariant *child; |
| 6357 | GValue *paramv; |
| 6358 | guint num_params; |
| 6359 | guint n; |
| 6360 | guint signal_id; |
| 6361 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 6362 | if (info == NULL) |
| 6363 | return; |
| 6364 | num_params = g_variant_n_children (parameters); |
| 6365 | paramv = g_new0 (GValue, num_params + 1); |
| 6366 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 6367 | g_value_set_object (¶mv[0], proxy); |
| 6368 | g_variant_iter_init (&iter, parameters); |
| 6369 | n = 1; |
| 6370 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 6371 | { |
| 6372 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 6373 | if (arg_info->use_gvariant) |
| 6374 | { |
| 6375 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 6376 | g_value_set_variant (¶mv[n], child); |
| 6377 | n++; |
| 6378 | } |
| 6379 | else |
| 6380 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 6381 | g_variant_unref (child); |
| 6382 | } |
| 6383 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 6384 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 6385 | for (n = 0; n < num_params + 1; n++) |
| 6386 | g_value_unset (¶mv[n]); |
| 6387 | g_free (paramv); |
| 6388 | } |
| 6389 | |
| 6390 | static void |
| 6391 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 6392 | GVariant *changed_properties, |
| 6393 | const gchar *const *invalidated_properties) |
| 6394 | { |
| 6395 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 6396 | guint n; |
| 6397 | const gchar *key; |
| 6398 | GVariantIter *iter; |
| 6399 | _ExtendedGDBusPropertyInfo *info; |
| 6400 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 6401 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 6402 | { |
| 6403 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 6404 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 6405 | if (info != NULL) |
| 6406 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 6407 | } |
| 6408 | g_variant_iter_free (iter); |
| 6409 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 6410 | { |
| 6411 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 6412 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 6413 | if (info != NULL) |
| 6414 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 6415 | } |
| 6416 | } |
| 6417 | |
| 6418 | static const gchar * |
| 6419 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 6420 | { |
| 6421 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 6422 | GVariant *variant; |
| 6423 | const gchar *value = NULL; |
| 6424 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 6425 | if (variant != NULL) |
| 6426 | { |
| 6427 | value = g_variant_get_string (variant, NULL); |
| 6428 | g_variant_unref (variant); |
| 6429 | } |
| 6430 | return value; |
| 6431 | } |
| 6432 | |
| 6433 | static const gchar * |
| 6434 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 6435 | { |
| 6436 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 6437 | GVariant *variant; |
| 6438 | const gchar *value = NULL; |
| 6439 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 6440 | if (variant != NULL) |
| 6441 | { |
| 6442 | value = g_variant_get_string (variant, NULL); |
| 6443 | g_variant_unref (variant); |
| 6444 | } |
| 6445 | return value; |
| 6446 | } |
| 6447 | |
| 6448 | static void |
| 6449 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 6450 | { |
| 6451 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6452 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 6453 | #else |
| 6454 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 6455 | #endif |
| 6456 | |
| 6457 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 6458 | } |
| 6459 | |
| 6460 | static void |
| 6461 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 6462 | { |
| 6463 | GObjectClass *gobject_class; |
| 6464 | GDBusProxyClass *proxy_class; |
| 6465 | |
| 6466 | gobject_class = G_OBJECT_CLASS (klass); |
| 6467 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 6468 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 6469 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 6470 | |
| 6471 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 6472 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 6473 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 6474 | |
| 6475 | sensor_i2c_override_properties (gobject_class, 1); |
| 6476 | |
| 6477 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6478 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 6479 | #endif |
| 6480 | } |
| 6481 | |
| 6482 | static void |
| 6483 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 6484 | { |
| 6485 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 6486 | iface->get_address = sensor_i2c_proxy_get_address; |
| 6487 | } |
| 6488 | |
| 6489 | /** |
| 6490 | * sensor_i2c_proxy_new: |
| 6491 | * @connection: A #GDBusConnection. |
| 6492 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6493 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6494 | * @object_path: An object path. |
| 6495 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6496 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6497 | * @user_data: User data to pass to @callback. |
| 6498 | * |
| 6499 | * 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. |
| 6500 | * |
| 6501 | * 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. |
| 6502 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 6503 | * |
| 6504 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 6505 | */ |
| 6506 | void |
| 6507 | sensor_i2c_proxy_new ( |
| 6508 | GDBusConnection *connection, |
| 6509 | GDBusProxyFlags flags, |
| 6510 | const gchar *name, |
| 6511 | const gchar *object_path, |
| 6512 | GCancellable *cancellable, |
| 6513 | GAsyncReadyCallback callback, |
| 6514 | gpointer user_data) |
| 6515 | { |
| 6516 | 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); |
| 6517 | } |
| 6518 | |
| 6519 | /** |
| 6520 | * sensor_i2c_proxy_new_finish: |
| 6521 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 6522 | * @error: Return location for error or %NULL |
| 6523 | * |
| 6524 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 6525 | * |
| 6526 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 6527 | */ |
| 6528 | SensorI2c * |
| 6529 | sensor_i2c_proxy_new_finish ( |
| 6530 | GAsyncResult *res, |
| 6531 | GError **error) |
| 6532 | { |
| 6533 | GObject *ret; |
| 6534 | GObject *source_object; |
| 6535 | source_object = g_async_result_get_source_object (res); |
| 6536 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6537 | g_object_unref (source_object); |
| 6538 | if (ret != NULL) |
| 6539 | return SENSOR_I2C (ret); |
| 6540 | else |
| 6541 | return NULL; |
| 6542 | } |
| 6543 | |
| 6544 | /** |
| 6545 | * sensor_i2c_proxy_new_sync: |
| 6546 | * @connection: A #GDBusConnection. |
| 6547 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6548 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6549 | * @object_path: An object path. |
| 6550 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6551 | * @error: Return location for error or %NULL |
| 6552 | * |
| 6553 | * 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. |
| 6554 | * |
| 6555 | * The calling thread is blocked until a reply is received. |
| 6556 | * |
| 6557 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 6558 | * |
| 6559 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 6560 | */ |
| 6561 | SensorI2c * |
| 6562 | sensor_i2c_proxy_new_sync ( |
| 6563 | GDBusConnection *connection, |
| 6564 | GDBusProxyFlags flags, |
| 6565 | const gchar *name, |
| 6566 | const gchar *object_path, |
| 6567 | GCancellable *cancellable, |
| 6568 | GError **error) |
| 6569 | { |
| 6570 | GInitable *ret; |
| 6571 | 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); |
| 6572 | if (ret != NULL) |
| 6573 | return SENSOR_I2C (ret); |
| 6574 | else |
| 6575 | return NULL; |
| 6576 | } |
| 6577 | |
| 6578 | |
| 6579 | /** |
| 6580 | * sensor_i2c_proxy_new_for_bus: |
| 6581 | * @bus_type: A #GBusType. |
| 6582 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6583 | * @name: A bus name (well-known or unique). |
| 6584 | * @object_path: An object path. |
| 6585 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6586 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6587 | * @user_data: User data to pass to @callback. |
| 6588 | * |
| 6589 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 6590 | * |
| 6591 | * 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. |
| 6592 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 6593 | * |
| 6594 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 6595 | */ |
| 6596 | void |
| 6597 | sensor_i2c_proxy_new_for_bus ( |
| 6598 | GBusType bus_type, |
| 6599 | GDBusProxyFlags flags, |
| 6600 | const gchar *name, |
| 6601 | const gchar *object_path, |
| 6602 | GCancellable *cancellable, |
| 6603 | GAsyncReadyCallback callback, |
| 6604 | gpointer user_data) |
| 6605 | { |
| 6606 | 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); |
| 6607 | } |
| 6608 | |
| 6609 | /** |
| 6610 | * sensor_i2c_proxy_new_for_bus_finish: |
| 6611 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 6612 | * @error: Return location for error or %NULL |
| 6613 | * |
| 6614 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 6615 | * |
| 6616 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 6617 | */ |
| 6618 | SensorI2c * |
| 6619 | sensor_i2c_proxy_new_for_bus_finish ( |
| 6620 | GAsyncResult *res, |
| 6621 | GError **error) |
| 6622 | { |
| 6623 | GObject *ret; |
| 6624 | GObject *source_object; |
| 6625 | source_object = g_async_result_get_source_object (res); |
| 6626 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6627 | g_object_unref (source_object); |
| 6628 | if (ret != NULL) |
| 6629 | return SENSOR_I2C (ret); |
| 6630 | else |
| 6631 | return NULL; |
| 6632 | } |
| 6633 | |
| 6634 | /** |
| 6635 | * sensor_i2c_proxy_new_for_bus_sync: |
| 6636 | * @bus_type: A #GBusType. |
| 6637 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6638 | * @name: A bus name (well-known or unique). |
| 6639 | * @object_path: An object path. |
| 6640 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6641 | * @error: Return location for error or %NULL |
| 6642 | * |
| 6643 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 6644 | * |
| 6645 | * The calling thread is blocked until a reply is received. |
| 6646 | * |
| 6647 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 6648 | * |
| 6649 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 6650 | */ |
| 6651 | SensorI2c * |
| 6652 | sensor_i2c_proxy_new_for_bus_sync ( |
| 6653 | GBusType bus_type, |
| 6654 | GDBusProxyFlags flags, |
| 6655 | const gchar *name, |
| 6656 | const gchar *object_path, |
| 6657 | GCancellable *cancellable, |
| 6658 | GError **error) |
| 6659 | { |
| 6660 | GInitable *ret; |
| 6661 | 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); |
| 6662 | if (ret != NULL) |
| 6663 | return SENSOR_I2C (ret); |
| 6664 | else |
| 6665 | return NULL; |
| 6666 | } |
| 6667 | |
| 6668 | |
| 6669 | /* ------------------------------------------------------------------------ */ |
| 6670 | |
| 6671 | /** |
| 6672 | * SensorI2cSkeleton: |
| 6673 | * |
| 6674 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 6675 | */ |
| 6676 | |
| 6677 | /** |
| 6678 | * SensorI2cSkeletonClass: |
| 6679 | * @parent_class: The parent class. |
| 6680 | * |
| 6681 | * Class structure for #SensorI2cSkeleton. |
| 6682 | */ |
| 6683 | |
| 6684 | struct _SensorI2cSkeletonPrivate |
| 6685 | { |
| 6686 | GValue *properties; |
| 6687 | GList *changed_properties; |
| 6688 | GSource *changed_properties_idle_source; |
| 6689 | GMainContext *context; |
| 6690 | GMutex lock; |
| 6691 | }; |
| 6692 | |
| 6693 | static void |
| 6694 | _sensor_i2c_skeleton_handle_method_call ( |
| 6695 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6696 | const gchar *sender G_GNUC_UNUSED, |
| 6697 | const gchar *object_path G_GNUC_UNUSED, |
| 6698 | const gchar *interface_name, |
| 6699 | const gchar *method_name, |
| 6700 | GVariant *parameters, |
| 6701 | GDBusMethodInvocation *invocation, |
| 6702 | gpointer user_data) |
| 6703 | { |
| 6704 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 6705 | _ExtendedGDBusMethodInfo *info; |
| 6706 | GVariantIter iter; |
| 6707 | GVariant *child; |
| 6708 | GValue *paramv; |
| 6709 | guint num_params; |
| 6710 | guint num_extra; |
| 6711 | guint n; |
| 6712 | guint signal_id; |
| 6713 | GValue return_value = G_VALUE_INIT; |
| 6714 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 6715 | g_assert (info != NULL); |
| 6716 | num_params = g_variant_n_children (parameters); |
| 6717 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 6718 | n = 0; |
| 6719 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 6720 | g_value_set_object (¶mv[n++], skeleton); |
| 6721 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 6722 | g_value_set_object (¶mv[n++], invocation); |
| 6723 | if (info->pass_fdlist) |
| 6724 | { |
| 6725 | #ifdef G_OS_UNIX |
| 6726 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 6727 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 6728 | #else |
| 6729 | g_assert_not_reached (); |
| 6730 | #endif |
| 6731 | } |
| 6732 | g_variant_iter_init (&iter, parameters); |
| 6733 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 6734 | { |
| 6735 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 6736 | if (arg_info->use_gvariant) |
| 6737 | { |
| 6738 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 6739 | g_value_set_variant (¶mv[n], child); |
| 6740 | n++; |
| 6741 | } |
| 6742 | else |
| 6743 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 6744 | g_variant_unref (child); |
| 6745 | } |
| 6746 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 6747 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 6748 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 6749 | if (!g_value_get_boolean (&return_value)) |
| 6750 | 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); |
| 6751 | g_value_unset (&return_value); |
| 6752 | for (n = 0; n < num_params + num_extra; n++) |
| 6753 | g_value_unset (¶mv[n]); |
| 6754 | g_free (paramv); |
| 6755 | } |
| 6756 | |
| 6757 | static GVariant * |
| 6758 | _sensor_i2c_skeleton_handle_get_property ( |
| 6759 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6760 | const gchar *sender G_GNUC_UNUSED, |
| 6761 | const gchar *object_path G_GNUC_UNUSED, |
| 6762 | const gchar *interface_name G_GNUC_UNUSED, |
| 6763 | const gchar *property_name, |
| 6764 | GError **error, |
| 6765 | gpointer user_data) |
| 6766 | { |
| 6767 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 6768 | GValue value = G_VALUE_INIT; |
| 6769 | GParamSpec *pspec; |
| 6770 | _ExtendedGDBusPropertyInfo *info; |
| 6771 | GVariant *ret; |
| 6772 | ret = NULL; |
| 6773 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 6774 | g_assert (info != NULL); |
| 6775 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6776 | if (pspec == NULL) |
| 6777 | { |
| 6778 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6779 | } |
| 6780 | else |
| 6781 | { |
| 6782 | g_value_init (&value, pspec->value_type); |
| 6783 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6784 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6785 | g_value_unset (&value); |
| 6786 | } |
| 6787 | return ret; |
| 6788 | } |
| 6789 | |
| 6790 | static gboolean |
| 6791 | _sensor_i2c_skeleton_handle_set_property ( |
| 6792 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6793 | const gchar *sender G_GNUC_UNUSED, |
| 6794 | const gchar *object_path G_GNUC_UNUSED, |
| 6795 | const gchar *interface_name G_GNUC_UNUSED, |
| 6796 | const gchar *property_name, |
| 6797 | GVariant *variant, |
| 6798 | GError **error, |
| 6799 | gpointer user_data) |
| 6800 | { |
| 6801 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 6802 | GValue value = G_VALUE_INIT; |
| 6803 | GParamSpec *pspec; |
| 6804 | _ExtendedGDBusPropertyInfo *info; |
| 6805 | gboolean ret; |
| 6806 | ret = FALSE; |
| 6807 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 6808 | g_assert (info != NULL); |
| 6809 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6810 | if (pspec == NULL) |
| 6811 | { |
| 6812 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6813 | } |
| 6814 | else |
| 6815 | { |
| 6816 | if (info->use_gvariant) |
| 6817 | g_value_set_variant (&value, variant); |
| 6818 | else |
| 6819 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 6820 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6821 | g_value_unset (&value); |
| 6822 | ret = TRUE; |
| 6823 | } |
| 6824 | return ret; |
| 6825 | } |
| 6826 | |
| 6827 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 6828 | { |
| 6829 | _sensor_i2c_skeleton_handle_method_call, |
| 6830 | _sensor_i2c_skeleton_handle_get_property, |
| 6831 | _sensor_i2c_skeleton_handle_set_property, |
| 6832 | {NULL} |
| 6833 | }; |
| 6834 | |
| 6835 | static GDBusInterfaceInfo * |
| 6836 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6837 | { |
| 6838 | return sensor_i2c_interface_info (); |
| 6839 | } |
| 6840 | |
| 6841 | static GDBusInterfaceVTable * |
| 6842 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6843 | { |
| 6844 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 6845 | } |
| 6846 | |
| 6847 | static GVariant * |
| 6848 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 6849 | { |
| 6850 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 6851 | |
| 6852 | GVariantBuilder builder; |
| 6853 | guint n; |
| 6854 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6855 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 6856 | goto out; |
| 6857 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 6858 | { |
| 6859 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 6860 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 6861 | { |
| 6862 | GVariant *value; |
| 6863 | 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); |
| 6864 | if (value != NULL) |
| 6865 | { |
| 6866 | g_variant_take_ref (value); |
| 6867 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 6868 | g_variant_unref (value); |
| 6869 | } |
| 6870 | } |
| 6871 | } |
| 6872 | out: |
| 6873 | return g_variant_builder_end (&builder); |
| 6874 | } |
| 6875 | |
| 6876 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 6877 | |
| 6878 | static void |
| 6879 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 6880 | { |
| 6881 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 6882 | gboolean emit_changed = FALSE; |
| 6883 | |
| 6884 | g_mutex_lock (&skeleton->priv->lock); |
| 6885 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6886 | { |
| 6887 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6888 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6889 | emit_changed = TRUE; |
| 6890 | } |
| 6891 | g_mutex_unlock (&skeleton->priv->lock); |
| 6892 | |
| 6893 | if (emit_changed) |
| 6894 | _sensor_i2c_emit_changed (skeleton); |
| 6895 | } |
| 6896 | |
| 6897 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 6898 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6899 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6900 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 6901 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 6902 | |
| 6903 | #else |
| 6904 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6905 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 6906 | |
| 6907 | #endif |
| 6908 | static void |
| 6909 | sensor_i2c_skeleton_finalize (GObject *object) |
| 6910 | { |
| 6911 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 6912 | guint n; |
| 6913 | for (n = 0; n < 2; n++) |
| 6914 | g_value_unset (&skeleton->priv->properties[n]); |
| 6915 | g_free (skeleton->priv->properties); |
| 6916 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6917 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6918 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6919 | g_main_context_unref (skeleton->priv->context); |
| 6920 | g_mutex_clear (&skeleton->priv->lock); |
| 6921 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 6922 | } |
| 6923 | |
| 6924 | static void |
| 6925 | sensor_i2c_skeleton_get_property (GObject *object, |
| 6926 | guint prop_id, |
| 6927 | GValue *value, |
| 6928 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6929 | { |
| 6930 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 6931 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6932 | g_mutex_lock (&skeleton->priv->lock); |
| 6933 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 6934 | g_mutex_unlock (&skeleton->priv->lock); |
| 6935 | } |
| 6936 | |
| 6937 | static gboolean |
| 6938 | _sensor_i2c_emit_changed (gpointer user_data) |
| 6939 | { |
| 6940 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 6941 | GList *l; |
| 6942 | GVariantBuilder builder; |
| 6943 | GVariantBuilder invalidated_builder; |
| 6944 | guint num_changes; |
| 6945 | |
| 6946 | g_mutex_lock (&skeleton->priv->lock); |
| 6947 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6948 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6949 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 6950 | { |
| 6951 | ChangedProperty *cp = l->data; |
| 6952 | GVariant *variant; |
| 6953 | const GValue *cur_value; |
| 6954 | |
| 6955 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 6956 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 6957 | { |
| 6958 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 6959 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 6960 | g_variant_unref (variant); |
| 6961 | num_changes++; |
| 6962 | } |
| 6963 | } |
| 6964 | if (num_changes > 0) |
| 6965 | { |
| 6966 | GList *connections, *ll; |
| 6967 | GVariant *signal_variant; |
| 6968 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 6969 | &builder, &invalidated_builder)); |
| 6970 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6971 | for (ll = connections; ll != NULL; ll = ll->next) |
| 6972 | { |
| 6973 | GDBusConnection *connection = ll->data; |
| 6974 | |
| 6975 | g_dbus_connection_emit_signal (connection, |
| 6976 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6977 | "org.freedesktop.DBus.Properties", |
| 6978 | "PropertiesChanged", |
| 6979 | signal_variant, |
| 6980 | NULL); |
| 6981 | } |
| 6982 | g_variant_unref (signal_variant); |
| 6983 | g_list_free_full (connections, g_object_unref); |
| 6984 | } |
| 6985 | else |
| 6986 | { |
| 6987 | g_variant_builder_clear (&builder); |
| 6988 | g_variant_builder_clear (&invalidated_builder); |
| 6989 | } |
| 6990 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6991 | skeleton->priv->changed_properties = NULL; |
| 6992 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6993 | g_mutex_unlock (&skeleton->priv->lock); |
| 6994 | return FALSE; |
| 6995 | } |
| 6996 | |
| 6997 | static void |
| 6998 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6999 | { |
| 7000 | ChangedProperty *cp; |
| 7001 | GList *l; |
| 7002 | cp = NULL; |
| 7003 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 7004 | { |
| 7005 | ChangedProperty *i_cp = l->data; |
| 7006 | if (i_cp->info == info) |
| 7007 | { |
| 7008 | cp = i_cp; |
| 7009 | break; |
| 7010 | } |
| 7011 | } |
| 7012 | if (cp == NULL) |
| 7013 | { |
| 7014 | cp = g_new0 (ChangedProperty, 1); |
| 7015 | cp->prop_id = prop_id; |
| 7016 | cp->info = info; |
| 7017 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 7018 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 7019 | g_value_copy (orig_value, &cp->orig_value); |
| 7020 | } |
| 7021 | } |
| 7022 | |
| 7023 | static void |
| 7024 | sensor_i2c_skeleton_notify (GObject *object, |
| 7025 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7026 | { |
| 7027 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7028 | g_mutex_lock (&skeleton->priv->lock); |
| 7029 | if (skeleton->priv->changed_properties != NULL && |
| 7030 | skeleton->priv->changed_properties_idle_source == NULL) |
| 7031 | { |
| 7032 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 7033 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 7034 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 7035 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 7036 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 7037 | } |
| 7038 | g_mutex_unlock (&skeleton->priv->lock); |
| 7039 | } |
| 7040 | |
| 7041 | static void |
| 7042 | sensor_i2c_skeleton_set_property (GObject *object, |
| 7043 | guint prop_id, |
| 7044 | const GValue *value, |
| 7045 | GParamSpec *pspec) |
| 7046 | { |
| 7047 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7048 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7049 | g_mutex_lock (&skeleton->priv->lock); |
| 7050 | g_object_freeze_notify (object); |
| 7051 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 7052 | { |
| 7053 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 7054 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 7055 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 7056 | g_object_notify_by_pspec (object, pspec); |
| 7057 | } |
| 7058 | g_mutex_unlock (&skeleton->priv->lock); |
| 7059 | g_object_thaw_notify (object); |
| 7060 | } |
| 7061 | |
| 7062 | static void |
| 7063 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 7064 | { |
| 7065 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7066 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 7067 | #else |
| 7068 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 7069 | #endif |
| 7070 | |
| 7071 | g_mutex_init (&skeleton->priv->lock); |
| 7072 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 7073 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 7074 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 7075 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 7076 | } |
| 7077 | |
| 7078 | static const gchar * |
| 7079 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 7080 | { |
| 7081 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7082 | const gchar *value; |
| 7083 | g_mutex_lock (&skeleton->priv->lock); |
| 7084 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 7085 | g_mutex_unlock (&skeleton->priv->lock); |
| 7086 | return value; |
| 7087 | } |
| 7088 | |
| 7089 | static const gchar * |
| 7090 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 7091 | { |
| 7092 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7093 | const gchar *value; |
| 7094 | g_mutex_lock (&skeleton->priv->lock); |
| 7095 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 7096 | g_mutex_unlock (&skeleton->priv->lock); |
| 7097 | return value; |
| 7098 | } |
| 7099 | |
| 7100 | static void |
| 7101 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 7102 | { |
| 7103 | GObjectClass *gobject_class; |
| 7104 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 7105 | |
| 7106 | gobject_class = G_OBJECT_CLASS (klass); |
| 7107 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 7108 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 7109 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 7110 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 7111 | |
| 7112 | |
| 7113 | sensor_i2c_override_properties (gobject_class, 1); |
| 7114 | |
| 7115 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 7116 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 7117 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 7118 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 7119 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 7120 | |
| 7121 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7122 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 7123 | #endif |
| 7124 | } |
| 7125 | |
| 7126 | static void |
| 7127 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 7128 | { |
| 7129 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 7130 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 7131 | } |
| 7132 | |
| 7133 | /** |
| 7134 | * sensor_i2c_skeleton_new: |
| 7135 | * |
| 7136 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 7137 | * |
| 7138 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 7139 | */ |
| 7140 | SensorI2c * |
| 7141 | sensor_i2c_skeleton_new (void) |
| 7142 | { |
| 7143 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 7144 | } |
| 7145 | |
| 7146 | /* ------------------------------------------------------------------------ |
| 7147 | * Code for interface org.openbmc.SensorMatch |
| 7148 | * ------------------------------------------------------------------------ |
| 7149 | */ |
| 7150 | |
| 7151 | /** |
| 7152 | * SECTION:SensorMatch |
| 7153 | * @title: SensorMatch |
| 7154 | * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface |
| 7155 | * |
| 7156 | * 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. |
| 7157 | */ |
| 7158 | |
| 7159 | /* ---- Introspection data for org.openbmc.SensorMatch ---- */ |
| 7160 | |
| 7161 | static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = |
| 7162 | { |
| 7163 | { |
| 7164 | -1, |
| 7165 | (gchar *) "state", |
| 7166 | (gchar *) "y", |
| 7167 | NULL |
| 7168 | }, |
| 7169 | FALSE |
| 7170 | }; |
| 7171 | |
| 7172 | static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = |
| 7173 | { |
| 7174 | &_sensor_match_signal_info_sensor_match_ARG_state, |
| 7175 | NULL |
| 7176 | }; |
| 7177 | |
| 7178 | static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = |
| 7179 | { |
| 7180 | { |
| 7181 | -1, |
| 7182 | (gchar *) "SensorMatch", |
| 7183 | (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, |
| 7184 | NULL |
| 7185 | }, |
| 7186 | "sensor-match" |
| 7187 | }; |
| 7188 | |
| 7189 | static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = |
| 7190 | { |
| 7191 | &_sensor_match_signal_info_sensor_match, |
| 7192 | NULL |
| 7193 | }; |
| 7194 | |
| 7195 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = |
| 7196 | { |
| 7197 | { |
| 7198 | -1, |
| 7199 | (gchar *) "match_value", |
| 7200 | (gchar *) "v", |
| 7201 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 7202 | NULL |
| 7203 | }, |
| 7204 | "match-value", |
| 7205 | FALSE |
| 7206 | }; |
| 7207 | |
| 7208 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = |
| 7209 | { |
| 7210 | { |
| 7211 | -1, |
| 7212 | (gchar *) "state", |
| 7213 | (gchar *) "y", |
| 7214 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 7215 | NULL |
| 7216 | }, |
| 7217 | "state", |
| 7218 | FALSE |
| 7219 | }; |
| 7220 | |
| 7221 | static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = |
| 7222 | { |
| 7223 | &_sensor_match_property_info_match_value, |
| 7224 | &_sensor_match_property_info_state, |
| 7225 | NULL |
| 7226 | }; |
| 7227 | |
| 7228 | static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = |
| 7229 | { |
| 7230 | { |
| 7231 | -1, |
| 7232 | (gchar *) "org.openbmc.SensorMatch", |
| 7233 | NULL, |
| 7234 | (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, |
| 7235 | (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, |
| 7236 | NULL |
| 7237 | }, |
| 7238 | "sensor-match", |
| 7239 | }; |
| 7240 | |
| 7241 | |
| 7242 | /** |
| 7243 | * sensor_match_interface_info: |
| 7244 | * |
| 7245 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. |
| 7246 | * |
| 7247 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 7248 | */ |
| 7249 | GDBusInterfaceInfo * |
| 7250 | sensor_match_interface_info (void) |
| 7251 | { |
| 7252 | return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; |
| 7253 | } |
| 7254 | |
| 7255 | /** |
| 7256 | * sensor_match_override_properties: |
| 7257 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 7258 | * @property_id_begin: The property id to assign to the first overridden property. |
| 7259 | * |
| 7260 | * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. |
| 7261 | * The properties are overridden in the order they are defined. |
| 7262 | * |
| 7263 | * Returns: The last property id. |
| 7264 | */ |
| 7265 | guint |
| 7266 | sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) |
| 7267 | { |
| 7268 | g_object_class_override_property (klass, property_id_begin++, "match-value"); |
| 7269 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 7270 | return property_id_begin - 1; |
| 7271 | } |
| 7272 | |
| 7273 | |
| 7274 | |
| 7275 | /** |
| 7276 | * SensorMatch: |
| 7277 | * |
| 7278 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 7279 | */ |
| 7280 | |
| 7281 | /** |
| 7282 | * SensorMatchIface: |
| 7283 | * @parent_iface: The parent interface. |
| 7284 | * @get_match_value: Getter for the #SensorMatch:match-value property. |
| 7285 | * @get_state: Getter for the #SensorMatch:state property. |
| 7286 | * @sensor_match: Handler for the #SensorMatch::sensor-match signal. |
| 7287 | * |
| 7288 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 7289 | */ |
| 7290 | |
| 7291 | typedef SensorMatchIface SensorMatchInterface; |
| 7292 | G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); |
| 7293 | |
| 7294 | static void |
| 7295 | sensor_match_default_init (SensorMatchIface *iface) |
| 7296 | { |
| 7297 | /* GObject signals for received D-Bus signals: */ |
| 7298 | /** |
| 7299 | * SensorMatch::sensor-match: |
| 7300 | * @object: A #SensorMatch. |
| 7301 | * @arg_state: Argument. |
| 7302 | * |
| 7303 | * 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. |
| 7304 | * |
| 7305 | * 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. |
| 7306 | */ |
| 7307 | g_signal_new ("sensor-match", |
| 7308 | G_TYPE_FROM_INTERFACE (iface), |
| 7309 | G_SIGNAL_RUN_LAST, |
| 7310 | G_STRUCT_OFFSET (SensorMatchIface, sensor_match), |
| 7311 | NULL, |
| 7312 | NULL, |
| 7313 | g_cclosure_marshal_generic, |
| 7314 | G_TYPE_NONE, |
| 7315 | 1, G_TYPE_UCHAR); |
| 7316 | |
| 7317 | /* GObject properties for D-Bus properties: */ |
| 7318 | /** |
| 7319 | * SensorMatch:match-value: |
| 7320 | * |
| 7321 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. |
| 7322 | * |
| 7323 | * 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. |
| 7324 | */ |
| 7325 | g_object_interface_install_property (iface, |
| 7326 | g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7327 | /** |
| 7328 | * SensorMatch:state: |
| 7329 | * |
| 7330 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. |
| 7331 | * |
| 7332 | * 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. |
| 7333 | */ |
| 7334 | g_object_interface_install_property (iface, |
| 7335 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7336 | } |
| 7337 | |
| 7338 | /** |
| 7339 | * sensor_match_get_match_value: (skip) |
| 7340 | * @object: A #SensorMatch. |
| 7341 | * |
| 7342 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 7343 | * |
| 7344 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7345 | * |
| 7346 | * <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> |
| 7347 | * |
| 7348 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 7349 | */ |
| 7350 | GVariant * |
| 7351 | sensor_match_get_match_value (SensorMatch *object) |
| 7352 | { |
| 7353 | return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); |
| 7354 | } |
| 7355 | |
| 7356 | /** |
| 7357 | * sensor_match_dup_match_value: (skip) |
| 7358 | * @object: A #SensorMatch. |
| 7359 | * |
| 7360 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 7361 | * |
| 7362 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7363 | * |
| 7364 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 7365 | */ |
| 7366 | GVariant * |
| 7367 | sensor_match_dup_match_value (SensorMatch *object) |
| 7368 | { |
| 7369 | GVariant *value; |
| 7370 | g_object_get (G_OBJECT (object), "match-value", &value, NULL); |
| 7371 | return value; |
| 7372 | } |
| 7373 | |
| 7374 | /** |
| 7375 | * sensor_match_set_match_value: (skip) |
| 7376 | * @object: A #SensorMatch. |
| 7377 | * @value: The value to set. |
| 7378 | * |
| 7379 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. |
| 7380 | * |
| 7381 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7382 | */ |
| 7383 | void |
| 7384 | sensor_match_set_match_value (SensorMatch *object, GVariant *value) |
| 7385 | { |
| 7386 | g_object_set (G_OBJECT (object), "match-value", value, NULL); |
| 7387 | } |
| 7388 | |
| 7389 | /** |
| 7390 | * sensor_match_get_state: (skip) |
| 7391 | * @object: A #SensorMatch. |
| 7392 | * |
| 7393 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. |
| 7394 | * |
| 7395 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7396 | * |
| 7397 | * Returns: The property value. |
| 7398 | */ |
| 7399 | guchar |
| 7400 | sensor_match_get_state (SensorMatch *object) |
| 7401 | { |
| 7402 | return SENSOR_MATCH_GET_IFACE (object)->get_state (object); |
| 7403 | } |
| 7404 | |
| 7405 | /** |
| 7406 | * sensor_match_set_state: (skip) |
| 7407 | * @object: A #SensorMatch. |
| 7408 | * @value: The value to set. |
| 7409 | * |
| 7410 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. |
| 7411 | * |
| 7412 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7413 | */ |
| 7414 | void |
| 7415 | sensor_match_set_state (SensorMatch *object, guchar value) |
| 7416 | { |
| 7417 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 7418 | } |
| 7419 | |
| 7420 | /** |
| 7421 | * sensor_match_emit_sensor_match: |
| 7422 | * @object: A #SensorMatch. |
| 7423 | * @arg_state: Argument to pass with the signal. |
| 7424 | * |
| 7425 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. |
| 7426 | */ |
| 7427 | void |
| 7428 | sensor_match_emit_sensor_match ( |
| 7429 | SensorMatch *object, |
| 7430 | guchar arg_state) |
| 7431 | { |
| 7432 | g_signal_emit_by_name (object, "sensor-match", arg_state); |
| 7433 | } |
| 7434 | |
| 7435 | /* ------------------------------------------------------------------------ */ |
| 7436 | |
| 7437 | /** |
| 7438 | * SensorMatchProxy: |
| 7439 | * |
| 7440 | * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. |
| 7441 | */ |
| 7442 | |
| 7443 | /** |
| 7444 | * SensorMatchProxyClass: |
| 7445 | * @parent_class: The parent class. |
| 7446 | * |
| 7447 | * Class structure for #SensorMatchProxy. |
| 7448 | */ |
| 7449 | |
| 7450 | struct _SensorMatchProxyPrivate |
| 7451 | { |
| 7452 | GData *qdata; |
| 7453 | }; |
| 7454 | |
| 7455 | static void sensor_match_proxy_iface_init (SensorMatchIface *iface); |
| 7456 | |
| 7457 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7458 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 7459 | G_ADD_PRIVATE (SensorMatchProxy) |
| 7460 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 7461 | |
| 7462 | #else |
| 7463 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 7464 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 7465 | |
| 7466 | #endif |
| 7467 | static void |
| 7468 | sensor_match_proxy_finalize (GObject *object) |
| 7469 | { |
| 7470 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 7471 | g_datalist_clear (&proxy->priv->qdata); |
| 7472 | G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); |
| 7473 | } |
| 7474 | |
| 7475 | static void |
| 7476 | sensor_match_proxy_get_property (GObject *object, |
| 7477 | guint prop_id, |
| 7478 | GValue *value, |
| 7479 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7480 | { |
| 7481 | const _ExtendedGDBusPropertyInfo *info; |
| 7482 | GVariant *variant; |
| 7483 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7484 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 7485 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 7486 | if (info->use_gvariant) |
| 7487 | { |
| 7488 | g_value_set_variant (value, variant); |
| 7489 | } |
| 7490 | else |
| 7491 | { |
| 7492 | if (variant != NULL) |
| 7493 | g_dbus_gvariant_to_gvalue (variant, value); |
| 7494 | } |
| 7495 | if (variant != NULL) |
| 7496 | g_variant_unref (variant); |
| 7497 | } |
| 7498 | |
| 7499 | static void |
| 7500 | sensor_match_proxy_set_property_cb (GDBusProxy *proxy, |
| 7501 | GAsyncResult *res, |
| 7502 | gpointer user_data) |
| 7503 | { |
| 7504 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 7505 | GError *error; |
| 7506 | GVariant *_ret; |
| 7507 | error = NULL; |
| 7508 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 7509 | if (!_ret) |
| 7510 | { |
| 7511 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", |
| 7512 | info->parent_struct.name, |
| 7513 | error->message, g_quark_to_string (error->domain), error->code); |
| 7514 | g_error_free (error); |
| 7515 | } |
| 7516 | else |
| 7517 | { |
| 7518 | g_variant_unref (_ret); |
| 7519 | } |
| 7520 | } |
| 7521 | |
| 7522 | static void |
| 7523 | sensor_match_proxy_set_property (GObject *object, |
| 7524 | guint prop_id, |
| 7525 | const GValue *value, |
| 7526 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7527 | { |
| 7528 | const _ExtendedGDBusPropertyInfo *info; |
| 7529 | GVariant *variant; |
| 7530 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7531 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 7532 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7533 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 7534 | "org.freedesktop.DBus.Properties.Set", |
| 7535 | g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), |
| 7536 | G_DBUS_CALL_FLAGS_NONE, |
| 7537 | -1, |
| 7538 | NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 7539 | g_variant_unref (variant); |
| 7540 | } |
| 7541 | |
| 7542 | static void |
| 7543 | sensor_match_proxy_g_signal (GDBusProxy *proxy, |
| 7544 | const gchar *sender_name G_GNUC_UNUSED, |
| 7545 | const gchar *signal_name, |
| 7546 | GVariant *parameters) |
| 7547 | { |
| 7548 | _ExtendedGDBusSignalInfo *info; |
| 7549 | GVariantIter iter; |
| 7550 | GVariant *child; |
| 7551 | GValue *paramv; |
| 7552 | guint num_params; |
| 7553 | guint n; |
| 7554 | guint signal_id; |
| 7555 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); |
| 7556 | if (info == NULL) |
| 7557 | return; |
| 7558 | num_params = g_variant_n_children (parameters); |
| 7559 | paramv = g_new0 (GValue, num_params + 1); |
| 7560 | g_value_init (¶mv[0], TYPE_SENSOR_MATCH); |
| 7561 | g_value_set_object (¶mv[0], proxy); |
| 7562 | g_variant_iter_init (&iter, parameters); |
| 7563 | n = 1; |
| 7564 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7565 | { |
| 7566 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 7567 | if (arg_info->use_gvariant) |
| 7568 | { |
| 7569 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7570 | g_value_set_variant (¶mv[n], child); |
| 7571 | n++; |
| 7572 | } |
| 7573 | else |
| 7574 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7575 | g_variant_unref (child); |
| 7576 | } |
| 7577 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 7578 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 7579 | for (n = 0; n < num_params + 1; n++) |
| 7580 | g_value_unset (¶mv[n]); |
| 7581 | g_free (paramv); |
| 7582 | } |
| 7583 | |
| 7584 | static void |
| 7585 | sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 7586 | GVariant *changed_properties, |
| 7587 | const gchar *const *invalidated_properties) |
| 7588 | { |
| 7589 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); |
| 7590 | guint n; |
| 7591 | const gchar *key; |
| 7592 | GVariantIter *iter; |
| 7593 | _ExtendedGDBusPropertyInfo *info; |
| 7594 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 7595 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 7596 | { |
| 7597 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); |
| 7598 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 7599 | if (info != NULL) |
| 7600 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7601 | } |
| 7602 | g_variant_iter_free (iter); |
| 7603 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 7604 | { |
| 7605 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); |
| 7606 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 7607 | if (info != NULL) |
| 7608 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7609 | } |
| 7610 | } |
| 7611 | |
| 7612 | static GVariant * |
| 7613 | sensor_match_proxy_get_match_value (SensorMatch *object) |
| 7614 | { |
| 7615 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 7616 | GVariant *variant; |
| 7617 | GVariant *value = NULL; |
| 7618 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); |
| 7619 | value = variant; |
| 7620 | if (variant != NULL) |
| 7621 | g_variant_unref (variant); |
| 7622 | return value; |
| 7623 | } |
| 7624 | |
| 7625 | static guchar |
| 7626 | sensor_match_proxy_get_state (SensorMatch *object) |
| 7627 | { |
| 7628 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 7629 | GVariant *variant; |
| 7630 | guchar value = 0; |
| 7631 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 7632 | if (variant != NULL) |
| 7633 | { |
| 7634 | value = g_variant_get_byte (variant); |
| 7635 | g_variant_unref (variant); |
| 7636 | } |
| 7637 | return value; |
| 7638 | } |
| 7639 | |
| 7640 | static void |
| 7641 | sensor_match_proxy_init (SensorMatchProxy *proxy) |
| 7642 | { |
| 7643 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7644 | proxy->priv = sensor_match_proxy_get_instance_private (proxy); |
| 7645 | #else |
| 7646 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); |
| 7647 | #endif |
| 7648 | |
| 7649 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); |
| 7650 | } |
| 7651 | |
| 7652 | static void |
| 7653 | sensor_match_proxy_class_init (SensorMatchProxyClass *klass) |
| 7654 | { |
| 7655 | GObjectClass *gobject_class; |
| 7656 | GDBusProxyClass *proxy_class; |
| 7657 | |
| 7658 | gobject_class = G_OBJECT_CLASS (klass); |
| 7659 | gobject_class->finalize = sensor_match_proxy_finalize; |
| 7660 | gobject_class->get_property = sensor_match_proxy_get_property; |
| 7661 | gobject_class->set_property = sensor_match_proxy_set_property; |
| 7662 | |
| 7663 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 7664 | proxy_class->g_signal = sensor_match_proxy_g_signal; |
| 7665 | proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; |
| 7666 | |
| 7667 | sensor_match_override_properties (gobject_class, 1); |
| 7668 | |
| 7669 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7670 | g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); |
| 7671 | #endif |
| 7672 | } |
| 7673 | |
| 7674 | static void |
| 7675 | sensor_match_proxy_iface_init (SensorMatchIface *iface) |
| 7676 | { |
| 7677 | iface->get_match_value = sensor_match_proxy_get_match_value; |
| 7678 | iface->get_state = sensor_match_proxy_get_state; |
| 7679 | } |
| 7680 | |
| 7681 | /** |
| 7682 | * sensor_match_proxy_new: |
| 7683 | * @connection: A #GDBusConnection. |
| 7684 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7685 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7686 | * @object_path: An object path. |
| 7687 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7688 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7689 | * @user_data: User data to pass to @callback. |
| 7690 | * |
| 7691 | * 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. |
| 7692 | * |
| 7693 | * 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. |
| 7694 | * You can then call sensor_match_proxy_new_finish() to get the result of the operation. |
| 7695 | * |
| 7696 | * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 7697 | */ |
| 7698 | void |
| 7699 | sensor_match_proxy_new ( |
| 7700 | GDBusConnection *connection, |
| 7701 | GDBusProxyFlags flags, |
| 7702 | const gchar *name, |
| 7703 | const gchar *object_path, |
| 7704 | GCancellable *cancellable, |
| 7705 | GAsyncReadyCallback callback, |
| 7706 | gpointer user_data) |
| 7707 | { |
| 7708 | 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); |
| 7709 | } |
| 7710 | |
| 7711 | /** |
| 7712 | * sensor_match_proxy_new_finish: |
| 7713 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). |
| 7714 | * @error: Return location for error or %NULL |
| 7715 | * |
| 7716 | * Finishes an operation started with sensor_match_proxy_new(). |
| 7717 | * |
| 7718 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 7719 | */ |
| 7720 | SensorMatch * |
| 7721 | sensor_match_proxy_new_finish ( |
| 7722 | GAsyncResult *res, |
| 7723 | GError **error) |
| 7724 | { |
| 7725 | GObject *ret; |
| 7726 | GObject *source_object; |
| 7727 | source_object = g_async_result_get_source_object (res); |
| 7728 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7729 | g_object_unref (source_object); |
| 7730 | if (ret != NULL) |
| 7731 | return SENSOR_MATCH (ret); |
| 7732 | else |
| 7733 | return NULL; |
| 7734 | } |
| 7735 | |
| 7736 | /** |
| 7737 | * sensor_match_proxy_new_sync: |
| 7738 | * @connection: A #GDBusConnection. |
| 7739 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7740 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7741 | * @object_path: An object path. |
| 7742 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7743 | * @error: Return location for error or %NULL |
| 7744 | * |
| 7745 | * 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. |
| 7746 | * |
| 7747 | * The calling thread is blocked until a reply is received. |
| 7748 | * |
| 7749 | * See sensor_match_proxy_new() for the asynchronous version of this constructor. |
| 7750 | * |
| 7751 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 7752 | */ |
| 7753 | SensorMatch * |
| 7754 | sensor_match_proxy_new_sync ( |
| 7755 | GDBusConnection *connection, |
| 7756 | GDBusProxyFlags flags, |
| 7757 | const gchar *name, |
| 7758 | const gchar *object_path, |
| 7759 | GCancellable *cancellable, |
| 7760 | GError **error) |
| 7761 | { |
| 7762 | GInitable *ret; |
| 7763 | 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); |
| 7764 | if (ret != NULL) |
| 7765 | return SENSOR_MATCH (ret); |
| 7766 | else |
| 7767 | return NULL; |
| 7768 | } |
| 7769 | |
| 7770 | |
| 7771 | /** |
| 7772 | * sensor_match_proxy_new_for_bus: |
| 7773 | * @bus_type: A #GBusType. |
| 7774 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7775 | * @name: A bus name (well-known or unique). |
| 7776 | * @object_path: An object path. |
| 7777 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7778 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7779 | * @user_data: User data to pass to @callback. |
| 7780 | * |
| 7781 | * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 7782 | * |
| 7783 | * 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. |
| 7784 | * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. |
| 7785 | * |
| 7786 | * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 7787 | */ |
| 7788 | void |
| 7789 | sensor_match_proxy_new_for_bus ( |
| 7790 | GBusType bus_type, |
| 7791 | GDBusProxyFlags flags, |
| 7792 | const gchar *name, |
| 7793 | const gchar *object_path, |
| 7794 | GCancellable *cancellable, |
| 7795 | GAsyncReadyCallback callback, |
| 7796 | gpointer user_data) |
| 7797 | { |
| 7798 | 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); |
| 7799 | } |
| 7800 | |
| 7801 | /** |
| 7802 | * sensor_match_proxy_new_for_bus_finish: |
| 7803 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). |
| 7804 | * @error: Return location for error or %NULL |
| 7805 | * |
| 7806 | * Finishes an operation started with sensor_match_proxy_new_for_bus(). |
| 7807 | * |
| 7808 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 7809 | */ |
| 7810 | SensorMatch * |
| 7811 | sensor_match_proxy_new_for_bus_finish ( |
| 7812 | GAsyncResult *res, |
| 7813 | GError **error) |
| 7814 | { |
| 7815 | GObject *ret; |
| 7816 | GObject *source_object; |
| 7817 | source_object = g_async_result_get_source_object (res); |
| 7818 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7819 | g_object_unref (source_object); |
| 7820 | if (ret != NULL) |
| 7821 | return SENSOR_MATCH (ret); |
| 7822 | else |
| 7823 | return NULL; |
| 7824 | } |
| 7825 | |
| 7826 | /** |
| 7827 | * sensor_match_proxy_new_for_bus_sync: |
| 7828 | * @bus_type: A #GBusType. |
| 7829 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7830 | * @name: A bus name (well-known or unique). |
| 7831 | * @object_path: An object path. |
| 7832 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7833 | * @error: Return location for error or %NULL |
| 7834 | * |
| 7835 | * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 7836 | * |
| 7837 | * The calling thread is blocked until a reply is received. |
| 7838 | * |
| 7839 | * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 7840 | * |
| 7841 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 7842 | */ |
| 7843 | SensorMatch * |
| 7844 | sensor_match_proxy_new_for_bus_sync ( |
| 7845 | GBusType bus_type, |
| 7846 | GDBusProxyFlags flags, |
| 7847 | const gchar *name, |
| 7848 | const gchar *object_path, |
| 7849 | GCancellable *cancellable, |
| 7850 | GError **error) |
| 7851 | { |
| 7852 | GInitable *ret; |
| 7853 | 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); |
| 7854 | if (ret != NULL) |
| 7855 | return SENSOR_MATCH (ret); |
| 7856 | else |
| 7857 | return NULL; |
| 7858 | } |
| 7859 | |
| 7860 | |
| 7861 | /* ------------------------------------------------------------------------ */ |
| 7862 | |
| 7863 | /** |
| 7864 | * SensorMatchSkeleton: |
| 7865 | * |
| 7866 | * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. |
| 7867 | */ |
| 7868 | |
| 7869 | /** |
| 7870 | * SensorMatchSkeletonClass: |
| 7871 | * @parent_class: The parent class. |
| 7872 | * |
| 7873 | * Class structure for #SensorMatchSkeleton. |
| 7874 | */ |
| 7875 | |
| 7876 | struct _SensorMatchSkeletonPrivate |
| 7877 | { |
| 7878 | GValue *properties; |
| 7879 | GList *changed_properties; |
| 7880 | GSource *changed_properties_idle_source; |
| 7881 | GMainContext *context; |
| 7882 | GMutex lock; |
| 7883 | }; |
| 7884 | |
| 7885 | static void |
| 7886 | _sensor_match_skeleton_handle_method_call ( |
| 7887 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7888 | const gchar *sender G_GNUC_UNUSED, |
| 7889 | const gchar *object_path G_GNUC_UNUSED, |
| 7890 | const gchar *interface_name, |
| 7891 | const gchar *method_name, |
| 7892 | GVariant *parameters, |
| 7893 | GDBusMethodInvocation *invocation, |
| 7894 | gpointer user_data) |
| 7895 | { |
| 7896 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 7897 | _ExtendedGDBusMethodInfo *info; |
| 7898 | GVariantIter iter; |
| 7899 | GVariant *child; |
| 7900 | GValue *paramv; |
| 7901 | guint num_params; |
| 7902 | guint num_extra; |
| 7903 | guint n; |
| 7904 | guint signal_id; |
| 7905 | GValue return_value = G_VALUE_INIT; |
| 7906 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 7907 | g_assert (info != NULL); |
| 7908 | num_params = g_variant_n_children (parameters); |
| 7909 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 7910 | n = 0; |
| 7911 | g_value_init (¶mv[n], TYPE_SENSOR_MATCH); |
| 7912 | g_value_set_object (¶mv[n++], skeleton); |
| 7913 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 7914 | g_value_set_object (¶mv[n++], invocation); |
| 7915 | if (info->pass_fdlist) |
| 7916 | { |
| 7917 | #ifdef G_OS_UNIX |
| 7918 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 7919 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 7920 | #else |
| 7921 | g_assert_not_reached (); |
| 7922 | #endif |
| 7923 | } |
| 7924 | g_variant_iter_init (&iter, parameters); |
| 7925 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7926 | { |
| 7927 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 7928 | if (arg_info->use_gvariant) |
| 7929 | { |
| 7930 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7931 | g_value_set_variant (¶mv[n], child); |
| 7932 | n++; |
| 7933 | } |
| 7934 | else |
| 7935 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7936 | g_variant_unref (child); |
| 7937 | } |
| 7938 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 7939 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 7940 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 7941 | if (!g_value_get_boolean (&return_value)) |
| 7942 | 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); |
| 7943 | g_value_unset (&return_value); |
| 7944 | for (n = 0; n < num_params + num_extra; n++) |
| 7945 | g_value_unset (¶mv[n]); |
| 7946 | g_free (paramv); |
| 7947 | } |
| 7948 | |
| 7949 | static GVariant * |
| 7950 | _sensor_match_skeleton_handle_get_property ( |
| 7951 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7952 | const gchar *sender G_GNUC_UNUSED, |
| 7953 | const gchar *object_path G_GNUC_UNUSED, |
| 7954 | const gchar *interface_name G_GNUC_UNUSED, |
| 7955 | const gchar *property_name, |
| 7956 | GError **error, |
| 7957 | gpointer user_data) |
| 7958 | { |
| 7959 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 7960 | GValue value = G_VALUE_INIT; |
| 7961 | GParamSpec *pspec; |
| 7962 | _ExtendedGDBusPropertyInfo *info; |
| 7963 | GVariant *ret; |
| 7964 | ret = NULL; |
| 7965 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 7966 | g_assert (info != NULL); |
| 7967 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7968 | if (pspec == NULL) |
| 7969 | { |
| 7970 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7971 | } |
| 7972 | else |
| 7973 | { |
| 7974 | g_value_init (&value, pspec->value_type); |
| 7975 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7976 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7977 | g_value_unset (&value); |
| 7978 | } |
| 7979 | return ret; |
| 7980 | } |
| 7981 | |
| 7982 | static gboolean |
| 7983 | _sensor_match_skeleton_handle_set_property ( |
| 7984 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7985 | const gchar *sender G_GNUC_UNUSED, |
| 7986 | const gchar *object_path G_GNUC_UNUSED, |
| 7987 | const gchar *interface_name G_GNUC_UNUSED, |
| 7988 | const gchar *property_name, |
| 7989 | GVariant *variant, |
| 7990 | GError **error, |
| 7991 | gpointer user_data) |
| 7992 | { |
| 7993 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 7994 | GValue value = G_VALUE_INIT; |
| 7995 | GParamSpec *pspec; |
| 7996 | _ExtendedGDBusPropertyInfo *info; |
| 7997 | gboolean ret; |
| 7998 | ret = FALSE; |
| 7999 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 8000 | g_assert (info != NULL); |
| 8001 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8002 | if (pspec == NULL) |
| 8003 | { |
| 8004 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8005 | } |
| 8006 | else |
| 8007 | { |
| 8008 | if (info->use_gvariant) |
| 8009 | g_value_set_variant (&value, variant); |
| 8010 | else |
| 8011 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 8012 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8013 | g_value_unset (&value); |
| 8014 | ret = TRUE; |
| 8015 | } |
| 8016 | return ret; |
| 8017 | } |
| 8018 | |
| 8019 | static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = |
| 8020 | { |
| 8021 | _sensor_match_skeleton_handle_method_call, |
| 8022 | _sensor_match_skeleton_handle_get_property, |
| 8023 | _sensor_match_skeleton_handle_set_property, |
| 8024 | {NULL} |
| 8025 | }; |
| 8026 | |
| 8027 | static GDBusInterfaceInfo * |
| 8028 | sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8029 | { |
| 8030 | return sensor_match_interface_info (); |
| 8031 | } |
| 8032 | |
| 8033 | static GDBusInterfaceVTable * |
| 8034 | sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8035 | { |
| 8036 | return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; |
| 8037 | } |
| 8038 | |
| 8039 | static GVariant * |
| 8040 | sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 8041 | { |
| 8042 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 8043 | |
| 8044 | GVariantBuilder builder; |
| 8045 | guint n; |
| 8046 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8047 | if (_sensor_match_interface_info.parent_struct.properties == NULL) |
| 8048 | goto out; |
| 8049 | for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) |
| 8050 | { |
| 8051 | GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; |
| 8052 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 8053 | { |
| 8054 | GVariant *value; |
| 8055 | 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); |
| 8056 | if (value != NULL) |
| 8057 | { |
| 8058 | g_variant_take_ref (value); |
| 8059 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 8060 | g_variant_unref (value); |
| 8061 | } |
| 8062 | } |
| 8063 | } |
| 8064 | out: |
| 8065 | return g_variant_builder_end (&builder); |
| 8066 | } |
| 8067 | |
| 8068 | static gboolean _sensor_match_emit_changed (gpointer user_data); |
| 8069 | |
| 8070 | static void |
| 8071 | sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 8072 | { |
| 8073 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 8074 | gboolean emit_changed = FALSE; |
| 8075 | |
| 8076 | g_mutex_lock (&skeleton->priv->lock); |
| 8077 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8078 | { |
| 8079 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8080 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8081 | emit_changed = TRUE; |
| 8082 | } |
| 8083 | g_mutex_unlock (&skeleton->priv->lock); |
| 8084 | |
| 8085 | if (emit_changed) |
| 8086 | _sensor_match_emit_changed (skeleton); |
| 8087 | } |
| 8088 | |
| 8089 | static void |
| 8090 | _sensor_match_on_signal_sensor_match ( |
| 8091 | SensorMatch *object, |
| 8092 | guchar arg_state) |
| 8093 | { |
| 8094 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8095 | |
| 8096 | GList *connections, *l; |
| 8097 | GVariant *signal_variant; |
| 8098 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8099 | |
| 8100 | signal_variant = g_variant_ref_sink (g_variant_new ("(y)", |
| 8101 | arg_state)); |
| 8102 | for (l = connections; l != NULL; l = l->next) |
| 8103 | { |
| 8104 | GDBusConnection *connection = l->data; |
| 8105 | g_dbus_connection_emit_signal (connection, |
| 8106 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", |
| 8107 | signal_variant, NULL); |
| 8108 | } |
| 8109 | g_variant_unref (signal_variant); |
| 8110 | g_list_free_full (connections, g_object_unref); |
| 8111 | } |
| 8112 | |
| 8113 | static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); |
| 8114 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8115 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8116 | G_ADD_PRIVATE (SensorMatchSkeleton) |
| 8117 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 8118 | |
| 8119 | #else |
| 8120 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8121 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 8122 | |
| 8123 | #endif |
| 8124 | static void |
| 8125 | sensor_match_skeleton_finalize (GObject *object) |
| 8126 | { |
| 8127 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8128 | guint n; |
| 8129 | for (n = 0; n < 2; n++) |
| 8130 | g_value_unset (&skeleton->priv->properties[n]); |
| 8131 | g_free (skeleton->priv->properties); |
| 8132 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8133 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8134 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8135 | g_main_context_unref (skeleton->priv->context); |
| 8136 | g_mutex_clear (&skeleton->priv->lock); |
| 8137 | G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); |
| 8138 | } |
| 8139 | |
| 8140 | static void |
| 8141 | sensor_match_skeleton_get_property (GObject *object, |
| 8142 | guint prop_id, |
| 8143 | GValue *value, |
| 8144 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8145 | { |
| 8146 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8147 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8148 | g_mutex_lock (&skeleton->priv->lock); |
| 8149 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 8150 | g_mutex_unlock (&skeleton->priv->lock); |
| 8151 | } |
| 8152 | |
| 8153 | static gboolean |
| 8154 | _sensor_match_emit_changed (gpointer user_data) |
| 8155 | { |
| 8156 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 8157 | GList *l; |
| 8158 | GVariantBuilder builder; |
| 8159 | GVariantBuilder invalidated_builder; |
| 8160 | guint num_changes; |
| 8161 | |
| 8162 | g_mutex_lock (&skeleton->priv->lock); |
| 8163 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8164 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 8165 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 8166 | { |
| 8167 | ChangedProperty *cp = l->data; |
| 8168 | GVariant *variant; |
| 8169 | const GValue *cur_value; |
| 8170 | |
| 8171 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 8172 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 8173 | { |
| 8174 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 8175 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 8176 | g_variant_unref (variant); |
| 8177 | num_changes++; |
| 8178 | } |
| 8179 | } |
| 8180 | if (num_changes > 0) |
| 8181 | { |
| 8182 | GList *connections, *ll; |
| 8183 | GVariant *signal_variant; |
| 8184 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", |
| 8185 | &builder, &invalidated_builder)); |
| 8186 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8187 | for (ll = connections; ll != NULL; ll = ll->next) |
| 8188 | { |
| 8189 | GDBusConnection *connection = ll->data; |
| 8190 | |
| 8191 | g_dbus_connection_emit_signal (connection, |
| 8192 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 8193 | "org.freedesktop.DBus.Properties", |
| 8194 | "PropertiesChanged", |
| 8195 | signal_variant, |
| 8196 | NULL); |
| 8197 | } |
| 8198 | g_variant_unref (signal_variant); |
| 8199 | g_list_free_full (connections, g_object_unref); |
| 8200 | } |
| 8201 | else |
| 8202 | { |
| 8203 | g_variant_builder_clear (&builder); |
| 8204 | g_variant_builder_clear (&invalidated_builder); |
| 8205 | } |
| 8206 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8207 | skeleton->priv->changed_properties = NULL; |
| 8208 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8209 | g_mutex_unlock (&skeleton->priv->lock); |
| 8210 | return FALSE; |
| 8211 | } |
| 8212 | |
| 8213 | static void |
| 8214 | _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 8215 | { |
| 8216 | ChangedProperty *cp; |
| 8217 | GList *l; |
| 8218 | cp = NULL; |
| 8219 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 8220 | { |
| 8221 | ChangedProperty *i_cp = l->data; |
| 8222 | if (i_cp->info == info) |
| 8223 | { |
| 8224 | cp = i_cp; |
| 8225 | break; |
| 8226 | } |
| 8227 | } |
| 8228 | if (cp == NULL) |
| 8229 | { |
| 8230 | cp = g_new0 (ChangedProperty, 1); |
| 8231 | cp->prop_id = prop_id; |
| 8232 | cp->info = info; |
| 8233 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 8234 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 8235 | g_value_copy (orig_value, &cp->orig_value); |
| 8236 | } |
| 8237 | } |
| 8238 | |
| 8239 | static void |
| 8240 | sensor_match_skeleton_notify (GObject *object, |
| 8241 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8242 | { |
| 8243 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8244 | g_mutex_lock (&skeleton->priv->lock); |
| 8245 | if (skeleton->priv->changed_properties != NULL && |
| 8246 | skeleton->priv->changed_properties_idle_source == NULL) |
| 8247 | { |
| 8248 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 8249 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 8250 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 8251 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 8252 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 8253 | } |
| 8254 | g_mutex_unlock (&skeleton->priv->lock); |
| 8255 | } |
| 8256 | |
| 8257 | static void |
| 8258 | sensor_match_skeleton_set_property (GObject *object, |
| 8259 | guint prop_id, |
| 8260 | const GValue *value, |
| 8261 | GParamSpec *pspec) |
| 8262 | { |
| 8263 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8264 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8265 | g_mutex_lock (&skeleton->priv->lock); |
| 8266 | g_object_freeze_notify (object); |
| 8267 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 8268 | { |
| 8269 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 8270 | _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 8271 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 8272 | g_object_notify_by_pspec (object, pspec); |
| 8273 | } |
| 8274 | g_mutex_unlock (&skeleton->priv->lock); |
| 8275 | g_object_thaw_notify (object); |
| 8276 | } |
| 8277 | |
| 8278 | static void |
| 8279 | sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) |
| 8280 | { |
| 8281 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8282 | skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); |
| 8283 | #else |
| 8284 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); |
| 8285 | #endif |
| 8286 | |
| 8287 | g_mutex_init (&skeleton->priv->lock); |
| 8288 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 8289 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 8290 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 8291 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); |
| 8292 | } |
| 8293 | |
| 8294 | static GVariant * |
| 8295 | sensor_match_skeleton_get_match_value (SensorMatch *object) |
| 8296 | { |
| 8297 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8298 | GVariant *value; |
| 8299 | g_mutex_lock (&skeleton->priv->lock); |
| 8300 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 8301 | g_mutex_unlock (&skeleton->priv->lock); |
| 8302 | return value; |
| 8303 | } |
| 8304 | |
| 8305 | static guchar |
| 8306 | sensor_match_skeleton_get_state (SensorMatch *object) |
| 8307 | { |
| 8308 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8309 | guchar value; |
| 8310 | g_mutex_lock (&skeleton->priv->lock); |
| 8311 | value = g_value_get_uchar (&(skeleton->priv->properties[1])); |
| 8312 | g_mutex_unlock (&skeleton->priv->lock); |
| 8313 | return value; |
| 8314 | } |
| 8315 | |
| 8316 | static void |
| 8317 | sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) |
| 8318 | { |
| 8319 | GObjectClass *gobject_class; |
| 8320 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 8321 | |
| 8322 | gobject_class = G_OBJECT_CLASS (klass); |
| 8323 | gobject_class->finalize = sensor_match_skeleton_finalize; |
| 8324 | gobject_class->get_property = sensor_match_skeleton_get_property; |
| 8325 | gobject_class->set_property = sensor_match_skeleton_set_property; |
| 8326 | gobject_class->notify = sensor_match_skeleton_notify; |
| 8327 | |
| 8328 | |
| 8329 | sensor_match_override_properties (gobject_class, 1); |
| 8330 | |
| 8331 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 8332 | skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; |
| 8333 | skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; |
| 8334 | skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; |
| 8335 | skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; |
| 8336 | |
| 8337 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8338 | g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); |
| 8339 | #endif |
| 8340 | } |
| 8341 | |
| 8342 | static void |
| 8343 | sensor_match_skeleton_iface_init (SensorMatchIface *iface) |
| 8344 | { |
| 8345 | iface->sensor_match = _sensor_match_on_signal_sensor_match; |
| 8346 | iface->get_match_value = sensor_match_skeleton_get_match_value; |
| 8347 | iface->get_state = sensor_match_skeleton_get_state; |
| 8348 | } |
| 8349 | |
| 8350 | /** |
| 8351 | * sensor_match_skeleton_new: |
| 8352 | * |
| 8353 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 8354 | * |
| 8355 | * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. |
| 8356 | */ |
| 8357 | SensorMatch * |
| 8358 | sensor_match_skeleton_new (void) |
| 8359 | { |
| 8360 | return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); |
| 8361 | } |
| 8362 | |
| 8363 | /* ------------------------------------------------------------------------ |
| 8364 | * Code for interface org.openbmc.Process |
| 8365 | * ------------------------------------------------------------------------ |
| 8366 | */ |
| 8367 | |
| 8368 | /** |
| 8369 | * SECTION:Process |
| 8370 | * @title: Process |
| 8371 | * @short_description: Generated C code for the org.openbmc.Process D-Bus interface |
| 8372 | * |
| 8373 | * 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. |
| 8374 | */ |
| 8375 | |
| 8376 | /* ---- Introspection data for org.openbmc.Process ---- */ |
| 8377 | |
| 8378 | static const _ExtendedGDBusMethodInfo _process_method_info_stop = |
| 8379 | { |
| 8380 | { |
| 8381 | -1, |
| 8382 | (gchar *) "stop", |
| 8383 | NULL, |
| 8384 | NULL, |
| 8385 | NULL |
| 8386 | }, |
| 8387 | "handle-stop", |
| 8388 | FALSE |
| 8389 | }; |
| 8390 | |
| 8391 | static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] = |
| 8392 | { |
| 8393 | &_process_method_info_stop, |
| 8394 | NULL |
| 8395 | }; |
| 8396 | |
| 8397 | static const _ExtendedGDBusInterfaceInfo _process_interface_info = |
| 8398 | { |
| 8399 | { |
| 8400 | -1, |
| 8401 | (gchar *) "org.openbmc.Process", |
| 8402 | (GDBusMethodInfo **) &_process_method_info_pointers, |
| 8403 | NULL, |
| 8404 | NULL, |
| 8405 | NULL |
| 8406 | }, |
| 8407 | "process", |
| 8408 | }; |
| 8409 | |
| 8410 | |
| 8411 | /** |
| 8412 | * process_interface_info: |
| 8413 | * |
| 8414 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface. |
| 8415 | * |
| 8416 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 8417 | */ |
| 8418 | GDBusInterfaceInfo * |
| 8419 | process_interface_info (void) |
| 8420 | { |
| 8421 | return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct; |
| 8422 | } |
| 8423 | |
| 8424 | /** |
| 8425 | * process_override_properties: |
| 8426 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 8427 | * @property_id_begin: The property id to assign to the first overridden property. |
| 8428 | * |
| 8429 | * Overrides all #GObject properties in the #Process interface for a concrete class. |
| 8430 | * The properties are overridden in the order they are defined. |
| 8431 | * |
| 8432 | * Returns: The last property id. |
| 8433 | */ |
| 8434 | guint |
| 8435 | process_override_properties (GObjectClass *klass, guint property_id_begin) |
| 8436 | { |
| 8437 | return property_id_begin - 1; |
| 8438 | } |
| 8439 | |
| 8440 | |
| 8441 | |
| 8442 | /** |
| 8443 | * Process: |
| 8444 | * |
| 8445 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 8446 | */ |
| 8447 | |
| 8448 | /** |
| 8449 | * ProcessIface: |
| 8450 | * @parent_iface: The parent interface. |
| 8451 | * @handle_stop: Handler for the #Process::handle-stop signal. |
| 8452 | * |
| 8453 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 8454 | */ |
| 8455 | |
| 8456 | typedef ProcessIface ProcessInterface; |
| 8457 | G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT); |
| 8458 | |
| 8459 | static void |
| 8460 | process_default_init (ProcessIface *iface) |
| 8461 | { |
| 8462 | /* GObject signals for incoming D-Bus method calls: */ |
| 8463 | /** |
| 8464 | * Process::handle-stop: |
| 8465 | * @object: A #Process. |
| 8466 | * @invocation: A #GDBusMethodInvocation. |
| 8467 | * |
| 8468 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. |
| 8469 | * |
| 8470 | * 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. |
| 8471 | * |
| 8472 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 8473 | */ |
| 8474 | g_signal_new ("handle-stop", |
| 8475 | G_TYPE_FROM_INTERFACE (iface), |
| 8476 | G_SIGNAL_RUN_LAST, |
| 8477 | G_STRUCT_OFFSET (ProcessIface, handle_stop), |
| 8478 | g_signal_accumulator_true_handled, |
| 8479 | NULL, |
| 8480 | g_cclosure_marshal_generic, |
| 8481 | G_TYPE_BOOLEAN, |
| 8482 | 1, |
| 8483 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 8484 | |
| 8485 | } |
| 8486 | |
| 8487 | /** |
| 8488 | * process_call_stop: |
| 8489 | * @proxy: A #ProcessProxy. |
| 8490 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8491 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 8492 | * @user_data: User data to pass to @callback. |
| 8493 | * |
| 8494 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. |
| 8495 | * 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. |
| 8496 | * You can then call process_call_stop_finish() to get the result of the operation. |
| 8497 | * |
| 8498 | * See process_call_stop_sync() for the synchronous, blocking version of this method. |
| 8499 | */ |
| 8500 | void |
| 8501 | process_call_stop ( |
| 8502 | Process *proxy, |
| 8503 | GCancellable *cancellable, |
| 8504 | GAsyncReadyCallback callback, |
| 8505 | gpointer user_data) |
| 8506 | { |
| 8507 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 8508 | "stop", |
| 8509 | g_variant_new ("()"), |
| 8510 | G_DBUS_CALL_FLAGS_NONE, |
| 8511 | -1, |
| 8512 | cancellable, |
| 8513 | callback, |
| 8514 | user_data); |
| 8515 | } |
| 8516 | |
| 8517 | /** |
| 8518 | * process_call_stop_finish: |
| 8519 | * @proxy: A #ProcessProxy. |
| 8520 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop(). |
| 8521 | * @error: Return location for error or %NULL. |
| 8522 | * |
| 8523 | * Finishes an operation started with process_call_stop(). |
| 8524 | * |
| 8525 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 8526 | */ |
| 8527 | gboolean |
| 8528 | process_call_stop_finish ( |
| 8529 | Process *proxy, |
| 8530 | GAsyncResult *res, |
| 8531 | GError **error) |
| 8532 | { |
| 8533 | GVariant *_ret; |
| 8534 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 8535 | if (_ret == NULL) |
| 8536 | goto _out; |
| 8537 | g_variant_get (_ret, |
| 8538 | "()"); |
| 8539 | g_variant_unref (_ret); |
| 8540 | _out: |
| 8541 | return _ret != NULL; |
| 8542 | } |
| 8543 | |
| 8544 | /** |
| 8545 | * process_call_stop_sync: |
| 8546 | * @proxy: A #ProcessProxy. |
| 8547 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8548 | * @error: Return location for error or %NULL. |
| 8549 | * |
| 8550 | * 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. |
| 8551 | * |
| 8552 | * See process_call_stop() for the asynchronous version of this method. |
| 8553 | * |
| 8554 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 8555 | */ |
| 8556 | gboolean |
| 8557 | process_call_stop_sync ( |
| 8558 | Process *proxy, |
| 8559 | GCancellable *cancellable, |
| 8560 | GError **error) |
| 8561 | { |
| 8562 | GVariant *_ret; |
| 8563 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 8564 | "stop", |
| 8565 | g_variant_new ("()"), |
| 8566 | G_DBUS_CALL_FLAGS_NONE, |
| 8567 | -1, |
| 8568 | cancellable, |
| 8569 | error); |
| 8570 | if (_ret == NULL) |
| 8571 | goto _out; |
| 8572 | g_variant_get (_ret, |
| 8573 | "()"); |
| 8574 | g_variant_unref (_ret); |
| 8575 | _out: |
| 8576 | return _ret != NULL; |
| 8577 | } |
| 8578 | |
| 8579 | /** |
| 8580 | * process_complete_stop: |
| 8581 | * @object: A #Process. |
| 8582 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 8583 | * |
| 8584 | * 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. |
| 8585 | * |
| 8586 | * This method will free @invocation, you cannot use it afterwards. |
| 8587 | */ |
| 8588 | void |
| 8589 | process_complete_stop ( |
| 8590 | Process *object, |
| 8591 | GDBusMethodInvocation *invocation) |
| 8592 | { |
| 8593 | g_dbus_method_invocation_return_value (invocation, |
| 8594 | g_variant_new ("()")); |
| 8595 | } |
| 8596 | |
| 8597 | /* ------------------------------------------------------------------------ */ |
| 8598 | |
| 8599 | /** |
| 8600 | * ProcessProxy: |
| 8601 | * |
| 8602 | * The #ProcessProxy structure contains only private data and should only be accessed using the provided API. |
| 8603 | */ |
| 8604 | |
| 8605 | /** |
| 8606 | * ProcessProxyClass: |
| 8607 | * @parent_class: The parent class. |
| 8608 | * |
| 8609 | * Class structure for #ProcessProxy. |
| 8610 | */ |
| 8611 | |
| 8612 | struct _ProcessProxyPrivate |
| 8613 | { |
| 8614 | GData *qdata; |
| 8615 | }; |
| 8616 | |
| 8617 | static void process_proxy_iface_init (ProcessIface *iface); |
| 8618 | |
| 8619 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8620 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 8621 | G_ADD_PRIVATE (ProcessProxy) |
| 8622 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 8623 | |
| 8624 | #else |
| 8625 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 8626 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 8627 | |
| 8628 | #endif |
| 8629 | static void |
| 8630 | process_proxy_finalize (GObject *object) |
| 8631 | { |
| 8632 | ProcessProxy *proxy = PROCESS_PROXY (object); |
| 8633 | g_datalist_clear (&proxy->priv->qdata); |
| 8634 | G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object); |
| 8635 | } |
| 8636 | |
| 8637 | static void |
| 8638 | process_proxy_get_property (GObject *object, |
| 8639 | guint prop_id, |
| 8640 | GValue *value, |
| 8641 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8642 | { |
| 8643 | } |
| 8644 | |
| 8645 | static void |
| 8646 | process_proxy_set_property (GObject *object, |
| 8647 | guint prop_id, |
| 8648 | const GValue *value, |
| 8649 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8650 | { |
| 8651 | } |
| 8652 | |
| 8653 | static void |
| 8654 | process_proxy_g_signal (GDBusProxy *proxy, |
| 8655 | const gchar *sender_name G_GNUC_UNUSED, |
| 8656 | const gchar *signal_name, |
| 8657 | GVariant *parameters) |
| 8658 | { |
| 8659 | _ExtendedGDBusSignalInfo *info; |
| 8660 | GVariantIter iter; |
| 8661 | GVariant *child; |
| 8662 | GValue *paramv; |
| 8663 | guint num_params; |
| 8664 | guint n; |
| 8665 | guint signal_id; |
| 8666 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name); |
| 8667 | if (info == NULL) |
| 8668 | return; |
| 8669 | num_params = g_variant_n_children (parameters); |
| 8670 | paramv = g_new0 (GValue, num_params + 1); |
| 8671 | g_value_init (¶mv[0], TYPE_PROCESS); |
| 8672 | g_value_set_object (¶mv[0], proxy); |
| 8673 | g_variant_iter_init (&iter, parameters); |
| 8674 | n = 1; |
| 8675 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8676 | { |
| 8677 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 8678 | if (arg_info->use_gvariant) |
| 8679 | { |
| 8680 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8681 | g_value_set_variant (¶mv[n], child); |
| 8682 | n++; |
| 8683 | } |
| 8684 | else |
| 8685 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8686 | g_variant_unref (child); |
| 8687 | } |
| 8688 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 8689 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 8690 | for (n = 0; n < num_params + 1; n++) |
| 8691 | g_value_unset (¶mv[n]); |
| 8692 | g_free (paramv); |
| 8693 | } |
| 8694 | |
| 8695 | static void |
| 8696 | process_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 8697 | GVariant *changed_properties, |
| 8698 | const gchar *const *invalidated_properties) |
| 8699 | { |
| 8700 | ProcessProxy *proxy = PROCESS_PROXY (_proxy); |
| 8701 | guint n; |
| 8702 | const gchar *key; |
| 8703 | GVariantIter *iter; |
| 8704 | _ExtendedGDBusPropertyInfo *info; |
| 8705 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 8706 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 8707 | { |
| 8708 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key); |
| 8709 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 8710 | if (info != NULL) |
| 8711 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8712 | } |
| 8713 | g_variant_iter_free (iter); |
| 8714 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 8715 | { |
| 8716 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]); |
| 8717 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 8718 | if (info != NULL) |
| 8719 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8720 | } |
| 8721 | } |
| 8722 | |
| 8723 | static void |
| 8724 | process_proxy_init (ProcessProxy *proxy) |
| 8725 | { |
| 8726 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8727 | proxy->priv = process_proxy_get_instance_private (proxy); |
| 8728 | #else |
| 8729 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate); |
| 8730 | #endif |
| 8731 | |
| 8732 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ()); |
| 8733 | } |
| 8734 | |
| 8735 | static void |
| 8736 | process_proxy_class_init (ProcessProxyClass *klass) |
| 8737 | { |
| 8738 | GObjectClass *gobject_class; |
| 8739 | GDBusProxyClass *proxy_class; |
| 8740 | |
| 8741 | gobject_class = G_OBJECT_CLASS (klass); |
| 8742 | gobject_class->finalize = process_proxy_finalize; |
| 8743 | gobject_class->get_property = process_proxy_get_property; |
| 8744 | gobject_class->set_property = process_proxy_set_property; |
| 8745 | |
| 8746 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 8747 | proxy_class->g_signal = process_proxy_g_signal; |
| 8748 | proxy_class->g_properties_changed = process_proxy_g_properties_changed; |
| 8749 | |
| 8750 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8751 | g_type_class_add_private (klass, sizeof (ProcessProxyPrivate)); |
| 8752 | #endif |
| 8753 | } |
| 8754 | |
| 8755 | static void |
| 8756 | process_proxy_iface_init (ProcessIface *iface) |
| 8757 | { |
| 8758 | } |
| 8759 | |
| 8760 | /** |
| 8761 | * process_proxy_new: |
| 8762 | * @connection: A #GDBusConnection. |
| 8763 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8764 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8765 | * @object_path: An object path. |
| 8766 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8767 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8768 | * @user_data: User data to pass to @callback. |
| 8769 | * |
| 8770 | * 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. |
| 8771 | * |
| 8772 | * 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. |
| 8773 | * You can then call process_proxy_new_finish() to get the result of the operation. |
| 8774 | * |
| 8775 | * See process_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 8776 | */ |
| 8777 | void |
| 8778 | process_proxy_new ( |
| 8779 | GDBusConnection *connection, |
| 8780 | GDBusProxyFlags flags, |
| 8781 | const gchar *name, |
| 8782 | const gchar *object_path, |
| 8783 | GCancellable *cancellable, |
| 8784 | GAsyncReadyCallback callback, |
| 8785 | gpointer user_data) |
| 8786 | { |
| 8787 | 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); |
| 8788 | } |
| 8789 | |
| 8790 | /** |
| 8791 | * process_proxy_new_finish: |
| 8792 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new(). |
| 8793 | * @error: Return location for error or %NULL |
| 8794 | * |
| 8795 | * Finishes an operation started with process_proxy_new(). |
| 8796 | * |
| 8797 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 8798 | */ |
| 8799 | Process * |
| 8800 | process_proxy_new_finish ( |
| 8801 | GAsyncResult *res, |
| 8802 | GError **error) |
| 8803 | { |
| 8804 | GObject *ret; |
| 8805 | GObject *source_object; |
| 8806 | source_object = g_async_result_get_source_object (res); |
| 8807 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8808 | g_object_unref (source_object); |
| 8809 | if (ret != NULL) |
| 8810 | return PROCESS (ret); |
| 8811 | else |
| 8812 | return NULL; |
| 8813 | } |
| 8814 | |
| 8815 | /** |
| 8816 | * process_proxy_new_sync: |
| 8817 | * @connection: A #GDBusConnection. |
| 8818 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8819 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8820 | * @object_path: An object path. |
| 8821 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8822 | * @error: Return location for error or %NULL |
| 8823 | * |
| 8824 | * 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. |
| 8825 | * |
| 8826 | * The calling thread is blocked until a reply is received. |
| 8827 | * |
| 8828 | * See process_proxy_new() for the asynchronous version of this constructor. |
| 8829 | * |
| 8830 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 8831 | */ |
| 8832 | Process * |
| 8833 | process_proxy_new_sync ( |
| 8834 | GDBusConnection *connection, |
| 8835 | GDBusProxyFlags flags, |
| 8836 | const gchar *name, |
| 8837 | const gchar *object_path, |
| 8838 | GCancellable *cancellable, |
| 8839 | GError **error) |
| 8840 | { |
| 8841 | GInitable *ret; |
| 8842 | 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); |
| 8843 | if (ret != NULL) |
| 8844 | return PROCESS (ret); |
| 8845 | else |
| 8846 | return NULL; |
| 8847 | } |
| 8848 | |
| 8849 | |
| 8850 | /** |
| 8851 | * process_proxy_new_for_bus: |
| 8852 | * @bus_type: A #GBusType. |
| 8853 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8854 | * @name: A bus name (well-known or unique). |
| 8855 | * @object_path: An object path. |
| 8856 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8857 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8858 | * @user_data: User data to pass to @callback. |
| 8859 | * |
| 8860 | * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 8861 | * |
| 8862 | * 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. |
| 8863 | * You can then call process_proxy_new_for_bus_finish() to get the result of the operation. |
| 8864 | * |
| 8865 | * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 8866 | */ |
| 8867 | void |
| 8868 | process_proxy_new_for_bus ( |
| 8869 | GBusType bus_type, |
| 8870 | GDBusProxyFlags flags, |
| 8871 | const gchar *name, |
| 8872 | const gchar *object_path, |
| 8873 | GCancellable *cancellable, |
| 8874 | GAsyncReadyCallback callback, |
| 8875 | gpointer user_data) |
| 8876 | { |
| 8877 | 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); |
| 8878 | } |
| 8879 | |
| 8880 | /** |
| 8881 | * process_proxy_new_for_bus_finish: |
| 8882 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus(). |
| 8883 | * @error: Return location for error or %NULL |
| 8884 | * |
| 8885 | * Finishes an operation started with process_proxy_new_for_bus(). |
| 8886 | * |
| 8887 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 8888 | */ |
| 8889 | Process * |
| 8890 | process_proxy_new_for_bus_finish ( |
| 8891 | GAsyncResult *res, |
| 8892 | GError **error) |
| 8893 | { |
| 8894 | GObject *ret; |
| 8895 | GObject *source_object; |
| 8896 | source_object = g_async_result_get_source_object (res); |
| 8897 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8898 | g_object_unref (source_object); |
| 8899 | if (ret != NULL) |
| 8900 | return PROCESS (ret); |
| 8901 | else |
| 8902 | return NULL; |
| 8903 | } |
| 8904 | |
| 8905 | /** |
| 8906 | * process_proxy_new_for_bus_sync: |
| 8907 | * @bus_type: A #GBusType. |
| 8908 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8909 | * @name: A bus name (well-known or unique). |
| 8910 | * @object_path: An object path. |
| 8911 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8912 | * @error: Return location for error or %NULL |
| 8913 | * |
| 8914 | * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 8915 | * |
| 8916 | * The calling thread is blocked until a reply is received. |
| 8917 | * |
| 8918 | * See process_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 8919 | * |
| 8920 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 8921 | */ |
| 8922 | Process * |
| 8923 | process_proxy_new_for_bus_sync ( |
| 8924 | GBusType bus_type, |
| 8925 | GDBusProxyFlags flags, |
| 8926 | const gchar *name, |
| 8927 | const gchar *object_path, |
| 8928 | GCancellable *cancellable, |
| 8929 | GError **error) |
| 8930 | { |
| 8931 | GInitable *ret; |
| 8932 | 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); |
| 8933 | if (ret != NULL) |
| 8934 | return PROCESS (ret); |
| 8935 | else |
| 8936 | return NULL; |
| 8937 | } |
| 8938 | |
| 8939 | |
| 8940 | /* ------------------------------------------------------------------------ */ |
| 8941 | |
| 8942 | /** |
| 8943 | * ProcessSkeleton: |
| 8944 | * |
| 8945 | * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API. |
| 8946 | */ |
| 8947 | |
| 8948 | /** |
| 8949 | * ProcessSkeletonClass: |
| 8950 | * @parent_class: The parent class. |
| 8951 | * |
| 8952 | * Class structure for #ProcessSkeleton. |
| 8953 | */ |
| 8954 | |
| 8955 | struct _ProcessSkeletonPrivate |
| 8956 | { |
| 8957 | GValue *properties; |
| 8958 | GList *changed_properties; |
| 8959 | GSource *changed_properties_idle_source; |
| 8960 | GMainContext *context; |
| 8961 | GMutex lock; |
| 8962 | }; |
| 8963 | |
| 8964 | static void |
| 8965 | _process_skeleton_handle_method_call ( |
| 8966 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8967 | const gchar *sender G_GNUC_UNUSED, |
| 8968 | const gchar *object_path G_GNUC_UNUSED, |
| 8969 | const gchar *interface_name, |
| 8970 | const gchar *method_name, |
| 8971 | GVariant *parameters, |
| 8972 | GDBusMethodInvocation *invocation, |
| 8973 | gpointer user_data) |
| 8974 | { |
| 8975 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 8976 | _ExtendedGDBusMethodInfo *info; |
| 8977 | GVariantIter iter; |
| 8978 | GVariant *child; |
| 8979 | GValue *paramv; |
| 8980 | guint num_params; |
| 8981 | guint num_extra; |
| 8982 | guint n; |
| 8983 | guint signal_id; |
| 8984 | GValue return_value = G_VALUE_INIT; |
| 8985 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 8986 | g_assert (info != NULL); |
| 8987 | num_params = g_variant_n_children (parameters); |
| 8988 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 8989 | n = 0; |
| 8990 | g_value_init (¶mv[n], TYPE_PROCESS); |
| 8991 | g_value_set_object (¶mv[n++], skeleton); |
| 8992 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 8993 | g_value_set_object (¶mv[n++], invocation); |
| 8994 | if (info->pass_fdlist) |
| 8995 | { |
| 8996 | #ifdef G_OS_UNIX |
| 8997 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 8998 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 8999 | #else |
| 9000 | g_assert_not_reached (); |
| 9001 | #endif |
| 9002 | } |
| 9003 | g_variant_iter_init (&iter, parameters); |
| 9004 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9005 | { |
| 9006 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 9007 | if (arg_info->use_gvariant) |
| 9008 | { |
| 9009 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9010 | g_value_set_variant (¶mv[n], child); |
| 9011 | n++; |
| 9012 | } |
| 9013 | else |
| 9014 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9015 | g_variant_unref (child); |
| 9016 | } |
| 9017 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 9018 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 9019 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 9020 | if (!g_value_get_boolean (&return_value)) |
| 9021 | 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); |
| 9022 | g_value_unset (&return_value); |
| 9023 | for (n = 0; n < num_params + num_extra; n++) |
| 9024 | g_value_unset (¶mv[n]); |
| 9025 | g_free (paramv); |
| 9026 | } |
| 9027 | |
| 9028 | static GVariant * |
| 9029 | _process_skeleton_handle_get_property ( |
| 9030 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9031 | const gchar *sender G_GNUC_UNUSED, |
| 9032 | const gchar *object_path G_GNUC_UNUSED, |
| 9033 | const gchar *interface_name G_GNUC_UNUSED, |
| 9034 | const gchar *property_name, |
| 9035 | GError **error, |
| 9036 | gpointer user_data) |
| 9037 | { |
| 9038 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 9039 | GValue value = G_VALUE_INIT; |
| 9040 | GParamSpec *pspec; |
| 9041 | _ExtendedGDBusPropertyInfo *info; |
| 9042 | GVariant *ret; |
| 9043 | ret = NULL; |
| 9044 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 9045 | g_assert (info != NULL); |
| 9046 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9047 | if (pspec == NULL) |
| 9048 | { |
| 9049 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9050 | } |
| 9051 | else |
| 9052 | { |
| 9053 | g_value_init (&value, pspec->value_type); |
| 9054 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9055 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 9056 | g_value_unset (&value); |
| 9057 | } |
| 9058 | return ret; |
| 9059 | } |
| 9060 | |
| 9061 | static gboolean |
| 9062 | _process_skeleton_handle_set_property ( |
| 9063 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9064 | const gchar *sender G_GNUC_UNUSED, |
| 9065 | const gchar *object_path G_GNUC_UNUSED, |
| 9066 | const gchar *interface_name G_GNUC_UNUSED, |
| 9067 | const gchar *property_name, |
| 9068 | GVariant *variant, |
| 9069 | GError **error, |
| 9070 | gpointer user_data) |
| 9071 | { |
| 9072 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 9073 | GValue value = G_VALUE_INIT; |
| 9074 | GParamSpec *pspec; |
| 9075 | _ExtendedGDBusPropertyInfo *info; |
| 9076 | gboolean ret; |
| 9077 | ret = FALSE; |
| 9078 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 9079 | g_assert (info != NULL); |
| 9080 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9081 | if (pspec == NULL) |
| 9082 | { |
| 9083 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9084 | } |
| 9085 | else |
| 9086 | { |
| 9087 | if (info->use_gvariant) |
| 9088 | g_value_set_variant (&value, variant); |
| 9089 | else |
| 9090 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 9091 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9092 | g_value_unset (&value); |
| 9093 | ret = TRUE; |
| 9094 | } |
| 9095 | return ret; |
| 9096 | } |
| 9097 | |
| 9098 | static const GDBusInterfaceVTable _process_skeleton_vtable = |
| 9099 | { |
| 9100 | _process_skeleton_handle_method_call, |
| 9101 | _process_skeleton_handle_get_property, |
| 9102 | _process_skeleton_handle_set_property, |
| 9103 | {NULL} |
| 9104 | }; |
| 9105 | |
| 9106 | static GDBusInterfaceInfo * |
| 9107 | process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9108 | { |
| 9109 | return process_interface_info (); |
| 9110 | } |
| 9111 | |
| 9112 | static GDBusInterfaceVTable * |
| 9113 | process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9114 | { |
| 9115 | return (GDBusInterfaceVTable *) &_process_skeleton_vtable; |
| 9116 | } |
| 9117 | |
| 9118 | static GVariant * |
| 9119 | process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 9120 | { |
| 9121 | ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton); |
| 9122 | |
| 9123 | GVariantBuilder builder; |
| 9124 | guint n; |
| 9125 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 9126 | if (_process_interface_info.parent_struct.properties == NULL) |
| 9127 | goto out; |
| 9128 | for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++) |
| 9129 | { |
| 9130 | GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n]; |
| 9131 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 9132 | { |
| 9133 | GVariant *value; |
| 9134 | 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); |
| 9135 | if (value != NULL) |
| 9136 | { |
| 9137 | g_variant_take_ref (value); |
| 9138 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 9139 | g_variant_unref (value); |
| 9140 | } |
| 9141 | } |
| 9142 | } |
| 9143 | out: |
| 9144 | return g_variant_builder_end (&builder); |
| 9145 | } |
| 9146 | |
| 9147 | static void |
| 9148 | process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 9149 | { |
| 9150 | } |
| 9151 | |
| 9152 | static void process_skeleton_iface_init (ProcessIface *iface); |
| 9153 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9154 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9155 | G_ADD_PRIVATE (ProcessSkeleton) |
| 9156 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 9157 | |
| 9158 | #else |
| 9159 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9160 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 9161 | |
| 9162 | #endif |
| 9163 | static void |
| 9164 | process_skeleton_finalize (GObject *object) |
| 9165 | { |
| 9166 | ProcessSkeleton *skeleton = PROCESS_SKELETON (object); |
| 9167 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9168 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 9169 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 9170 | g_main_context_unref (skeleton->priv->context); |
| 9171 | g_mutex_clear (&skeleton->priv->lock); |
| 9172 | G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object); |
| 9173 | } |
| 9174 | |
| 9175 | static void |
| 9176 | process_skeleton_init (ProcessSkeleton *skeleton) |
| 9177 | { |
| 9178 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9179 | skeleton->priv = process_skeleton_get_instance_private (skeleton); |
| 9180 | #else |
| 9181 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate); |
| 9182 | #endif |
| 9183 | |
| 9184 | g_mutex_init (&skeleton->priv->lock); |
| 9185 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 9186 | } |
| 9187 | |
| 9188 | static void |
| 9189 | process_skeleton_class_init (ProcessSkeletonClass *klass) |
| 9190 | { |
| 9191 | GObjectClass *gobject_class; |
| 9192 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 9193 | |
| 9194 | gobject_class = G_OBJECT_CLASS (klass); |
| 9195 | gobject_class->finalize = process_skeleton_finalize; |
| 9196 | |
| 9197 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 9198 | skeleton_class->get_info = process_skeleton_dbus_interface_get_info; |
| 9199 | skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties; |
| 9200 | skeleton_class->flush = process_skeleton_dbus_interface_flush; |
| 9201 | skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable; |
| 9202 | |
| 9203 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9204 | g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate)); |
| 9205 | #endif |
| 9206 | } |
| 9207 | |
| 9208 | static void |
| 9209 | process_skeleton_iface_init (ProcessIface *iface) |
| 9210 | { |
| 9211 | } |
| 9212 | |
| 9213 | /** |
| 9214 | * process_skeleton_new: |
| 9215 | * |
| 9216 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 9217 | * |
| 9218 | * Returns: (transfer full) (type ProcessSkeleton): The skeleton object. |
| 9219 | */ |
| 9220 | Process * |
| 9221 | process_skeleton_new (void) |
| 9222 | { |
| 9223 | return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL)); |
| 9224 | } |
| 9225 | |
| 9226 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 9227 | * Code for interface org.openbmc.SharedResource |
| 9228 | * ------------------------------------------------------------------------ |
| 9229 | */ |
| 9230 | |
| 9231 | /** |
| 9232 | * SECTION:SharedResource |
| 9233 | * @title: SharedResource |
| 9234 | * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface |
| 9235 | * |
| 9236 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C. |
| 9237 | */ |
| 9238 | |
| 9239 | /* ---- Introspection data for org.openbmc.SharedResource ---- */ |
| 9240 | |
| 9241 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name = |
| 9242 | { |
| 9243 | { |
| 9244 | -1, |
| 9245 | (gchar *) "name", |
| 9246 | (gchar *) "s", |
| 9247 | NULL |
| 9248 | }, |
| 9249 | FALSE |
| 9250 | }; |
| 9251 | |
| 9252 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] = |
| 9253 | { |
| 9254 | &_shared_resource_method_info_lock_IN_ARG_name, |
| 9255 | NULL |
| 9256 | }; |
| 9257 | |
| 9258 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock = |
| 9259 | { |
| 9260 | { |
| 9261 | -1, |
| 9262 | (gchar *) "lock", |
| 9263 | (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers, |
| 9264 | NULL, |
| 9265 | NULL |
| 9266 | }, |
| 9267 | "handle-lock", |
| 9268 | FALSE |
| 9269 | }; |
| 9270 | |
| 9271 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock = |
| 9272 | { |
| 9273 | { |
| 9274 | -1, |
| 9275 | (gchar *) "unlock", |
| 9276 | NULL, |
| 9277 | NULL, |
| 9278 | NULL |
| 9279 | }, |
| 9280 | "handle-unlock", |
| 9281 | FALSE |
| 9282 | }; |
| 9283 | |
| 9284 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock = |
| 9285 | { |
| 9286 | { |
| 9287 | -1, |
| 9288 | (gchar *) "lock", |
| 9289 | (gchar *) "b", |
| 9290 | NULL |
| 9291 | }, |
| 9292 | FALSE |
| 9293 | }; |
| 9294 | |
| 9295 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name = |
| 9296 | { |
| 9297 | { |
| 9298 | -1, |
| 9299 | (gchar *) "name", |
| 9300 | (gchar *) "s", |
| 9301 | NULL |
| 9302 | }, |
| 9303 | FALSE |
| 9304 | }; |
| 9305 | |
| 9306 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] = |
| 9307 | { |
| 9308 | &_shared_resource_method_info_is_locked_OUT_ARG_lock, |
| 9309 | &_shared_resource_method_info_is_locked_OUT_ARG_name, |
| 9310 | NULL |
| 9311 | }; |
| 9312 | |
| 9313 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked = |
| 9314 | { |
| 9315 | { |
| 9316 | -1, |
| 9317 | (gchar *) "isLocked", |
| 9318 | NULL, |
| 9319 | (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers, |
| 9320 | NULL |
| 9321 | }, |
| 9322 | "handle-is-locked", |
| 9323 | FALSE |
| 9324 | }; |
| 9325 | |
| 9326 | static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] = |
| 9327 | { |
| 9328 | &_shared_resource_method_info_lock, |
| 9329 | &_shared_resource_method_info_unlock, |
| 9330 | &_shared_resource_method_info_is_locked, |
| 9331 | NULL |
| 9332 | }; |
| 9333 | |
| 9334 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock = |
| 9335 | { |
| 9336 | { |
| 9337 | -1, |
| 9338 | (gchar *) "lock", |
| 9339 | (gchar *) "b", |
| 9340 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 9341 | NULL |
| 9342 | }, |
| 9343 | "lock", |
| 9344 | FALSE |
| 9345 | }; |
| 9346 | |
| 9347 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name = |
| 9348 | { |
| 9349 | { |
| 9350 | -1, |
| 9351 | (gchar *) "name", |
| 9352 | (gchar *) "s", |
| 9353 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 9354 | NULL |
| 9355 | }, |
| 9356 | "name", |
| 9357 | FALSE |
| 9358 | }; |
| 9359 | |
| 9360 | static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] = |
| 9361 | { |
| 9362 | &_shared_resource_property_info_lock, |
| 9363 | &_shared_resource_property_info_name, |
| 9364 | NULL |
| 9365 | }; |
| 9366 | |
| 9367 | static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info = |
| 9368 | { |
| 9369 | { |
| 9370 | -1, |
| 9371 | (gchar *) "org.openbmc.SharedResource", |
| 9372 | (GDBusMethodInfo **) &_shared_resource_method_info_pointers, |
| 9373 | NULL, |
| 9374 | (GDBusPropertyInfo **) &_shared_resource_property_info_pointers, |
| 9375 | NULL |
| 9376 | }, |
| 9377 | "shared-resource", |
| 9378 | }; |
| 9379 | |
| 9380 | |
| 9381 | /** |
| 9382 | * shared_resource_interface_info: |
| 9383 | * |
| 9384 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface. |
| 9385 | * |
| 9386 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 9387 | */ |
| 9388 | GDBusInterfaceInfo * |
| 9389 | shared_resource_interface_info (void) |
| 9390 | { |
| 9391 | return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct; |
| 9392 | } |
| 9393 | |
| 9394 | /** |
| 9395 | * shared_resource_override_properties: |
| 9396 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 9397 | * @property_id_begin: The property id to assign to the first overridden property. |
| 9398 | * |
| 9399 | * Overrides all #GObject properties in the #SharedResource interface for a concrete class. |
| 9400 | * The properties are overridden in the order they are defined. |
| 9401 | * |
| 9402 | * Returns: The last property id. |
| 9403 | */ |
| 9404 | guint |
| 9405 | shared_resource_override_properties (GObjectClass *klass, guint property_id_begin) |
| 9406 | { |
| 9407 | g_object_class_override_property (klass, property_id_begin++, "lock"); |
| 9408 | g_object_class_override_property (klass, property_id_begin++, "name"); |
| 9409 | return property_id_begin - 1; |
| 9410 | } |
| 9411 | |
| 9412 | |
| 9413 | |
| 9414 | /** |
| 9415 | * SharedResource: |
| 9416 | * |
| 9417 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 9418 | */ |
| 9419 | |
| 9420 | /** |
| 9421 | * SharedResourceIface: |
| 9422 | * @parent_iface: The parent interface. |
| 9423 | * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal. |
| 9424 | * @handle_lock: Handler for the #SharedResource::handle-lock signal. |
| 9425 | * @handle_unlock: Handler for the #SharedResource::handle-unlock signal. |
| 9426 | * @get_lock: Getter for the #SharedResource:lock property. |
| 9427 | * @get_name: Getter for the #SharedResource:name property. |
| 9428 | * |
| 9429 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 9430 | */ |
| 9431 | |
| 9432 | typedef SharedResourceIface SharedResourceInterface; |
| 9433 | G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT); |
| 9434 | |
| 9435 | static void |
| 9436 | shared_resource_default_init (SharedResourceIface *iface) |
| 9437 | { |
| 9438 | /* GObject signals for incoming D-Bus method calls: */ |
| 9439 | /** |
| 9440 | * SharedResource::handle-lock: |
| 9441 | * @object: A #SharedResource. |
| 9442 | * @invocation: A #GDBusMethodInvocation. |
| 9443 | * @arg_name: Argument passed by remote caller. |
| 9444 | * |
| 9445 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. |
| 9446 | * |
| 9447 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 9448 | * |
| 9449 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 9450 | */ |
| 9451 | g_signal_new ("handle-lock", |
| 9452 | G_TYPE_FROM_INTERFACE (iface), |
| 9453 | G_SIGNAL_RUN_LAST, |
| 9454 | G_STRUCT_OFFSET (SharedResourceIface, handle_lock), |
| 9455 | g_signal_accumulator_true_handled, |
| 9456 | NULL, |
| 9457 | g_cclosure_marshal_generic, |
| 9458 | G_TYPE_BOOLEAN, |
| 9459 | 2, |
| 9460 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 9461 | |
| 9462 | /** |
| 9463 | * SharedResource::handle-unlock: |
| 9464 | * @object: A #SharedResource. |
| 9465 | * @invocation: A #GDBusMethodInvocation. |
| 9466 | * |
| 9467 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. |
| 9468 | * |
| 9469 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 9470 | * |
| 9471 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 9472 | */ |
| 9473 | g_signal_new ("handle-unlock", |
| 9474 | G_TYPE_FROM_INTERFACE (iface), |
| 9475 | G_SIGNAL_RUN_LAST, |
| 9476 | G_STRUCT_OFFSET (SharedResourceIface, handle_unlock), |
| 9477 | g_signal_accumulator_true_handled, |
| 9478 | NULL, |
| 9479 | g_cclosure_marshal_generic, |
| 9480 | G_TYPE_BOOLEAN, |
| 9481 | 1, |
| 9482 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 9483 | |
| 9484 | /** |
| 9485 | * SharedResource::handle-is-locked: |
| 9486 | * @object: A #SharedResource. |
| 9487 | * @invocation: A #GDBusMethodInvocation. |
| 9488 | * |
| 9489 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. |
| 9490 | * |
| 9491 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_is_locked() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 9492 | * |
| 9493 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 9494 | */ |
| 9495 | g_signal_new ("handle-is-locked", |
| 9496 | G_TYPE_FROM_INTERFACE (iface), |
| 9497 | G_SIGNAL_RUN_LAST, |
| 9498 | G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked), |
| 9499 | g_signal_accumulator_true_handled, |
| 9500 | NULL, |
| 9501 | g_cclosure_marshal_generic, |
| 9502 | G_TYPE_BOOLEAN, |
| 9503 | 1, |
| 9504 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 9505 | |
| 9506 | /* GObject properties for D-Bus properties: */ |
| 9507 | /** |
| 9508 | * SharedResource:lock: |
| 9509 | * |
| 9510 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>. |
| 9511 | * |
| 9512 | * 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. |
| 9513 | */ |
| 9514 | g_object_interface_install_property (iface, |
| 9515 | g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 9516 | /** |
| 9517 | * SharedResource:name: |
| 9518 | * |
| 9519 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>. |
| 9520 | * |
| 9521 | * 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. |
| 9522 | */ |
| 9523 | g_object_interface_install_property (iface, |
| 9524 | g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 9525 | } |
| 9526 | |
| 9527 | /** |
| 9528 | * shared_resource_get_lock: (skip) |
| 9529 | * @object: A #SharedResource. |
| 9530 | * |
| 9531 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property. |
| 9532 | * |
| 9533 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9534 | * |
| 9535 | * Returns: The property value. |
| 9536 | */ |
| 9537 | gboolean |
| 9538 | shared_resource_get_lock (SharedResource *object) |
| 9539 | { |
| 9540 | return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object); |
| 9541 | } |
| 9542 | |
| 9543 | /** |
| 9544 | * shared_resource_set_lock: (skip) |
| 9545 | * @object: A #SharedResource. |
| 9546 | * @value: The value to set. |
| 9547 | * |
| 9548 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value. |
| 9549 | * |
| 9550 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 9551 | */ |
| 9552 | void |
| 9553 | shared_resource_set_lock (SharedResource *object, gboolean value) |
| 9554 | { |
| 9555 | g_object_set (G_OBJECT (object), "lock", value, NULL); |
| 9556 | } |
| 9557 | |
| 9558 | /** |
| 9559 | * shared_resource_get_name: (skip) |
| 9560 | * @object: A #SharedResource. |
| 9561 | * |
| 9562 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 9563 | * |
| 9564 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9565 | * |
| 9566 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use shared_resource_dup_name() if on another thread.</warning> |
| 9567 | * |
| 9568 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 9569 | */ |
| 9570 | const gchar * |
| 9571 | shared_resource_get_name (SharedResource *object) |
| 9572 | { |
| 9573 | return SHARED_RESOURCE_GET_IFACE (object)->get_name (object); |
| 9574 | } |
| 9575 | |
| 9576 | /** |
| 9577 | * shared_resource_dup_name: (skip) |
| 9578 | * @object: A #SharedResource. |
| 9579 | * |
| 9580 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 9581 | * |
| 9582 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9583 | * |
| 9584 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 9585 | */ |
| 9586 | gchar * |
| 9587 | shared_resource_dup_name (SharedResource *object) |
| 9588 | { |
| 9589 | gchar *value; |
| 9590 | g_object_get (G_OBJECT (object), "name", &value, NULL); |
| 9591 | return value; |
| 9592 | } |
| 9593 | |
| 9594 | /** |
| 9595 | * shared_resource_set_name: (skip) |
| 9596 | * @object: A #SharedResource. |
| 9597 | * @value: The value to set. |
| 9598 | * |
| 9599 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value. |
| 9600 | * |
| 9601 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 9602 | */ |
| 9603 | void |
| 9604 | shared_resource_set_name (SharedResource *object, const gchar *value) |
| 9605 | { |
| 9606 | g_object_set (G_OBJECT (object), "name", value, NULL); |
| 9607 | } |
| 9608 | |
| 9609 | /** |
| 9610 | * shared_resource_call_lock: |
| 9611 | * @proxy: A #SharedResourceProxy. |
| 9612 | * @arg_name: Argument to pass with the method invocation. |
| 9613 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9614 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 9615 | * @user_data: User data to pass to @callback. |
| 9616 | * |
| 9617 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. |
| 9618 | * 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. |
| 9619 | * You can then call shared_resource_call_lock_finish() to get the result of the operation. |
| 9620 | * |
| 9621 | * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method. |
| 9622 | */ |
| 9623 | void |
| 9624 | shared_resource_call_lock ( |
| 9625 | SharedResource *proxy, |
| 9626 | const gchar *arg_name, |
| 9627 | GCancellable *cancellable, |
| 9628 | GAsyncReadyCallback callback, |
| 9629 | gpointer user_data) |
| 9630 | { |
| 9631 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 9632 | "lock", |
| 9633 | g_variant_new ("(s)", |
| 9634 | arg_name), |
| 9635 | G_DBUS_CALL_FLAGS_NONE, |
| 9636 | -1, |
| 9637 | cancellable, |
| 9638 | callback, |
| 9639 | user_data); |
| 9640 | } |
| 9641 | |
| 9642 | /** |
| 9643 | * shared_resource_call_lock_finish: |
| 9644 | * @proxy: A #SharedResourceProxy. |
| 9645 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock(). |
| 9646 | * @error: Return location for error or %NULL. |
| 9647 | * |
| 9648 | * Finishes an operation started with shared_resource_call_lock(). |
| 9649 | * |
| 9650 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9651 | */ |
| 9652 | gboolean |
| 9653 | shared_resource_call_lock_finish ( |
| 9654 | SharedResource *proxy, |
| 9655 | GAsyncResult *res, |
| 9656 | GError **error) |
| 9657 | { |
| 9658 | GVariant *_ret; |
| 9659 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 9660 | if (_ret == NULL) |
| 9661 | goto _out; |
| 9662 | g_variant_get (_ret, |
| 9663 | "()"); |
| 9664 | g_variant_unref (_ret); |
| 9665 | _out: |
| 9666 | return _ret != NULL; |
| 9667 | } |
| 9668 | |
| 9669 | /** |
| 9670 | * shared_resource_call_lock_sync: |
| 9671 | * @proxy: A #SharedResourceProxy. |
| 9672 | * @arg_name: Argument to pass with the method invocation. |
| 9673 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9674 | * @error: Return location for error or %NULL. |
| 9675 | * |
| 9676 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 9677 | * |
| 9678 | * See shared_resource_call_lock() for the asynchronous version of this method. |
| 9679 | * |
| 9680 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9681 | */ |
| 9682 | gboolean |
| 9683 | shared_resource_call_lock_sync ( |
| 9684 | SharedResource *proxy, |
| 9685 | const gchar *arg_name, |
| 9686 | GCancellable *cancellable, |
| 9687 | GError **error) |
| 9688 | { |
| 9689 | GVariant *_ret; |
| 9690 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 9691 | "lock", |
| 9692 | g_variant_new ("(s)", |
| 9693 | arg_name), |
| 9694 | G_DBUS_CALL_FLAGS_NONE, |
| 9695 | -1, |
| 9696 | cancellable, |
| 9697 | error); |
| 9698 | if (_ret == NULL) |
| 9699 | goto _out; |
| 9700 | g_variant_get (_ret, |
| 9701 | "()"); |
| 9702 | g_variant_unref (_ret); |
| 9703 | _out: |
| 9704 | return _ret != NULL; |
| 9705 | } |
| 9706 | |
| 9707 | /** |
| 9708 | * shared_resource_call_unlock: |
| 9709 | * @proxy: A #SharedResourceProxy. |
| 9710 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9711 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 9712 | * @user_data: User data to pass to @callback. |
| 9713 | * |
| 9714 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. |
| 9715 | * 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. |
| 9716 | * You can then call shared_resource_call_unlock_finish() to get the result of the operation. |
| 9717 | * |
| 9718 | * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method. |
| 9719 | */ |
| 9720 | void |
| 9721 | shared_resource_call_unlock ( |
| 9722 | SharedResource *proxy, |
| 9723 | GCancellable *cancellable, |
| 9724 | GAsyncReadyCallback callback, |
| 9725 | gpointer user_data) |
| 9726 | { |
| 9727 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 9728 | "unlock", |
| 9729 | g_variant_new ("()"), |
| 9730 | G_DBUS_CALL_FLAGS_NONE, |
| 9731 | -1, |
| 9732 | cancellable, |
| 9733 | callback, |
| 9734 | user_data); |
| 9735 | } |
| 9736 | |
| 9737 | /** |
| 9738 | * shared_resource_call_unlock_finish: |
| 9739 | * @proxy: A #SharedResourceProxy. |
| 9740 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock(). |
| 9741 | * @error: Return location for error or %NULL. |
| 9742 | * |
| 9743 | * Finishes an operation started with shared_resource_call_unlock(). |
| 9744 | * |
| 9745 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9746 | */ |
| 9747 | gboolean |
| 9748 | shared_resource_call_unlock_finish ( |
| 9749 | SharedResource *proxy, |
| 9750 | GAsyncResult *res, |
| 9751 | GError **error) |
| 9752 | { |
| 9753 | GVariant *_ret; |
| 9754 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 9755 | if (_ret == NULL) |
| 9756 | goto _out; |
| 9757 | g_variant_get (_ret, |
| 9758 | "()"); |
| 9759 | g_variant_unref (_ret); |
| 9760 | _out: |
| 9761 | return _ret != NULL; |
| 9762 | } |
| 9763 | |
| 9764 | /** |
| 9765 | * shared_resource_call_unlock_sync: |
| 9766 | * @proxy: A #SharedResourceProxy. |
| 9767 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9768 | * @error: Return location for error or %NULL. |
| 9769 | * |
| 9770 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 9771 | * |
| 9772 | * See shared_resource_call_unlock() for the asynchronous version of this method. |
| 9773 | * |
| 9774 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9775 | */ |
| 9776 | gboolean |
| 9777 | shared_resource_call_unlock_sync ( |
| 9778 | SharedResource *proxy, |
| 9779 | GCancellable *cancellable, |
| 9780 | GError **error) |
| 9781 | { |
| 9782 | GVariant *_ret; |
| 9783 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 9784 | "unlock", |
| 9785 | g_variant_new ("()"), |
| 9786 | G_DBUS_CALL_FLAGS_NONE, |
| 9787 | -1, |
| 9788 | cancellable, |
| 9789 | error); |
| 9790 | if (_ret == NULL) |
| 9791 | goto _out; |
| 9792 | g_variant_get (_ret, |
| 9793 | "()"); |
| 9794 | g_variant_unref (_ret); |
| 9795 | _out: |
| 9796 | return _ret != NULL; |
| 9797 | } |
| 9798 | |
| 9799 | /** |
| 9800 | * shared_resource_call_is_locked: |
| 9801 | * @proxy: A #SharedResourceProxy. |
| 9802 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9803 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 9804 | * @user_data: User data to pass to @callback. |
| 9805 | * |
| 9806 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. |
| 9807 | * 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. |
| 9808 | * You can then call shared_resource_call_is_locked_finish() to get the result of the operation. |
| 9809 | * |
| 9810 | * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method. |
| 9811 | */ |
| 9812 | void |
| 9813 | shared_resource_call_is_locked ( |
| 9814 | SharedResource *proxy, |
| 9815 | GCancellable *cancellable, |
| 9816 | GAsyncReadyCallback callback, |
| 9817 | gpointer user_data) |
| 9818 | { |
| 9819 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 9820 | "isLocked", |
| 9821 | g_variant_new ("()"), |
| 9822 | G_DBUS_CALL_FLAGS_NONE, |
| 9823 | -1, |
| 9824 | cancellable, |
| 9825 | callback, |
| 9826 | user_data); |
| 9827 | } |
| 9828 | |
| 9829 | /** |
| 9830 | * shared_resource_call_is_locked_finish: |
| 9831 | * @proxy: A #SharedResourceProxy. |
| 9832 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 9833 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 9834 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked(). |
| 9835 | * @error: Return location for error or %NULL. |
| 9836 | * |
| 9837 | * Finishes an operation started with shared_resource_call_is_locked(). |
| 9838 | * |
| 9839 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9840 | */ |
| 9841 | gboolean |
| 9842 | shared_resource_call_is_locked_finish ( |
| 9843 | SharedResource *proxy, |
| 9844 | gboolean *out_lock, |
| 9845 | gchar **out_name, |
| 9846 | GAsyncResult *res, |
| 9847 | GError **error) |
| 9848 | { |
| 9849 | GVariant *_ret; |
| 9850 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 9851 | if (_ret == NULL) |
| 9852 | goto _out; |
| 9853 | g_variant_get (_ret, |
| 9854 | "(bs)", |
| 9855 | out_lock, |
| 9856 | out_name); |
| 9857 | g_variant_unref (_ret); |
| 9858 | _out: |
| 9859 | return _ret != NULL; |
| 9860 | } |
| 9861 | |
| 9862 | /** |
| 9863 | * shared_resource_call_is_locked_sync: |
| 9864 | * @proxy: A #SharedResourceProxy. |
| 9865 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 9866 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 9867 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9868 | * @error: Return location for error or %NULL. |
| 9869 | * |
| 9870 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 9871 | * |
| 9872 | * See shared_resource_call_is_locked() for the asynchronous version of this method. |
| 9873 | * |
| 9874 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9875 | */ |
| 9876 | gboolean |
| 9877 | shared_resource_call_is_locked_sync ( |
| 9878 | SharedResource *proxy, |
| 9879 | gboolean *out_lock, |
| 9880 | gchar **out_name, |
| 9881 | GCancellable *cancellable, |
| 9882 | GError **error) |
| 9883 | { |
| 9884 | GVariant *_ret; |
| 9885 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 9886 | "isLocked", |
| 9887 | g_variant_new ("()"), |
| 9888 | G_DBUS_CALL_FLAGS_NONE, |
| 9889 | -1, |
| 9890 | cancellable, |
| 9891 | error); |
| 9892 | if (_ret == NULL) |
| 9893 | goto _out; |
| 9894 | g_variant_get (_ret, |
| 9895 | "(bs)", |
| 9896 | out_lock, |
| 9897 | out_name); |
| 9898 | g_variant_unref (_ret); |
| 9899 | _out: |
| 9900 | return _ret != NULL; |
| 9901 | } |
| 9902 | |
| 9903 | /** |
| 9904 | * shared_resource_complete_lock: |
| 9905 | * @object: A #SharedResource. |
| 9906 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 9907 | * |
| 9908 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 9909 | * |
| 9910 | * This method will free @invocation, you cannot use it afterwards. |
| 9911 | */ |
| 9912 | void |
| 9913 | shared_resource_complete_lock ( |
| 9914 | SharedResource *object, |
| 9915 | GDBusMethodInvocation *invocation) |
| 9916 | { |
| 9917 | g_dbus_method_invocation_return_value (invocation, |
| 9918 | g_variant_new ("()")); |
| 9919 | } |
| 9920 | |
| 9921 | /** |
| 9922 | * shared_resource_complete_unlock: |
| 9923 | * @object: A #SharedResource. |
| 9924 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 9925 | * |
| 9926 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 9927 | * |
| 9928 | * This method will free @invocation, you cannot use it afterwards. |
| 9929 | */ |
| 9930 | void |
| 9931 | shared_resource_complete_unlock ( |
| 9932 | SharedResource *object, |
| 9933 | GDBusMethodInvocation *invocation) |
| 9934 | { |
| 9935 | g_dbus_method_invocation_return_value (invocation, |
| 9936 | g_variant_new ("()")); |
| 9937 | } |
| 9938 | |
| 9939 | /** |
| 9940 | * shared_resource_complete_is_locked: |
| 9941 | * @object: A #SharedResource. |
| 9942 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 9943 | * @lock: Parameter to return. |
| 9944 | * @name: Parameter to return. |
| 9945 | * |
| 9946 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 9947 | * |
| 9948 | * This method will free @invocation, you cannot use it afterwards. |
| 9949 | */ |
| 9950 | void |
| 9951 | shared_resource_complete_is_locked ( |
| 9952 | SharedResource *object, |
| 9953 | GDBusMethodInvocation *invocation, |
| 9954 | gboolean lock, |
| 9955 | const gchar *name) |
| 9956 | { |
| 9957 | g_dbus_method_invocation_return_value (invocation, |
| 9958 | g_variant_new ("(bs)", |
| 9959 | lock, |
| 9960 | name)); |
| 9961 | } |
| 9962 | |
| 9963 | /* ------------------------------------------------------------------------ */ |
| 9964 | |
| 9965 | /** |
| 9966 | * SharedResourceProxy: |
| 9967 | * |
| 9968 | * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API. |
| 9969 | */ |
| 9970 | |
| 9971 | /** |
| 9972 | * SharedResourceProxyClass: |
| 9973 | * @parent_class: The parent class. |
| 9974 | * |
| 9975 | * Class structure for #SharedResourceProxy. |
| 9976 | */ |
| 9977 | |
| 9978 | struct _SharedResourceProxyPrivate |
| 9979 | { |
| 9980 | GData *qdata; |
| 9981 | }; |
| 9982 | |
| 9983 | static void shared_resource_proxy_iface_init (SharedResourceIface *iface); |
| 9984 | |
| 9985 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9986 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 9987 | G_ADD_PRIVATE (SharedResourceProxy) |
| 9988 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 9989 | |
| 9990 | #else |
| 9991 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 9992 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 9993 | |
| 9994 | #endif |
| 9995 | static void |
| 9996 | shared_resource_proxy_finalize (GObject *object) |
| 9997 | { |
| 9998 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 9999 | g_datalist_clear (&proxy->priv->qdata); |
| 10000 | G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object); |
| 10001 | } |
| 10002 | |
| 10003 | static void |
| 10004 | shared_resource_proxy_get_property (GObject *object, |
| 10005 | guint prop_id, |
| 10006 | GValue *value, |
| 10007 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10008 | { |
| 10009 | const _ExtendedGDBusPropertyInfo *info; |
| 10010 | GVariant *variant; |
| 10011 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10012 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 10013 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 10014 | if (info->use_gvariant) |
| 10015 | { |
| 10016 | g_value_set_variant (value, variant); |
| 10017 | } |
| 10018 | else |
| 10019 | { |
| 10020 | if (variant != NULL) |
| 10021 | g_dbus_gvariant_to_gvalue (variant, value); |
| 10022 | } |
| 10023 | if (variant != NULL) |
| 10024 | g_variant_unref (variant); |
| 10025 | } |
| 10026 | |
| 10027 | static void |
| 10028 | shared_resource_proxy_set_property_cb (GDBusProxy *proxy, |
| 10029 | GAsyncResult *res, |
| 10030 | gpointer user_data) |
| 10031 | { |
| 10032 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 10033 | GError *error; |
| 10034 | GVariant *_ret; |
| 10035 | error = NULL; |
| 10036 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 10037 | if (!_ret) |
| 10038 | { |
| 10039 | g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)", |
| 10040 | info->parent_struct.name, |
| 10041 | error->message, g_quark_to_string (error->domain), error->code); |
| 10042 | g_error_free (error); |
| 10043 | } |
| 10044 | else |
| 10045 | { |
| 10046 | g_variant_unref (_ret); |
| 10047 | } |
| 10048 | } |
| 10049 | |
| 10050 | static void |
| 10051 | shared_resource_proxy_set_property (GObject *object, |
| 10052 | guint prop_id, |
| 10053 | const GValue *value, |
| 10054 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10055 | { |
| 10056 | const _ExtendedGDBusPropertyInfo *info; |
| 10057 | GVariant *variant; |
| 10058 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10059 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 10060 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 10061 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 10062 | "org.freedesktop.DBus.Properties.Set", |
| 10063 | g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant), |
| 10064 | G_DBUS_CALL_FLAGS_NONE, |
| 10065 | -1, |
| 10066 | NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 10067 | g_variant_unref (variant); |
| 10068 | } |
| 10069 | |
| 10070 | static void |
| 10071 | shared_resource_proxy_g_signal (GDBusProxy *proxy, |
| 10072 | const gchar *sender_name G_GNUC_UNUSED, |
| 10073 | const gchar *signal_name, |
| 10074 | GVariant *parameters) |
| 10075 | { |
| 10076 | _ExtendedGDBusSignalInfo *info; |
| 10077 | GVariantIter iter; |
| 10078 | GVariant *child; |
| 10079 | GValue *paramv; |
| 10080 | guint num_params; |
| 10081 | guint n; |
| 10082 | guint signal_id; |
| 10083 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name); |
| 10084 | if (info == NULL) |
| 10085 | return; |
| 10086 | num_params = g_variant_n_children (parameters); |
| 10087 | paramv = g_new0 (GValue, num_params + 1); |
| 10088 | g_value_init (¶mv[0], TYPE_SHARED_RESOURCE); |
| 10089 | g_value_set_object (¶mv[0], proxy); |
| 10090 | g_variant_iter_init (&iter, parameters); |
| 10091 | n = 1; |
| 10092 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10093 | { |
| 10094 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 10095 | if (arg_info->use_gvariant) |
| 10096 | { |
| 10097 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10098 | g_value_set_variant (¶mv[n], child); |
| 10099 | n++; |
| 10100 | } |
| 10101 | else |
| 10102 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10103 | g_variant_unref (child); |
| 10104 | } |
| 10105 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 10106 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 10107 | for (n = 0; n < num_params + 1; n++) |
| 10108 | g_value_unset (¶mv[n]); |
| 10109 | g_free (paramv); |
| 10110 | } |
| 10111 | |
| 10112 | static void |
| 10113 | shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 10114 | GVariant *changed_properties, |
| 10115 | const gchar *const *invalidated_properties) |
| 10116 | { |
| 10117 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy); |
| 10118 | guint n; |
| 10119 | const gchar *key; |
| 10120 | GVariantIter *iter; |
| 10121 | _ExtendedGDBusPropertyInfo *info; |
| 10122 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 10123 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 10124 | { |
| 10125 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key); |
| 10126 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 10127 | if (info != NULL) |
| 10128 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10129 | } |
| 10130 | g_variant_iter_free (iter); |
| 10131 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 10132 | { |
| 10133 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]); |
| 10134 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 10135 | if (info != NULL) |
| 10136 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10137 | } |
| 10138 | } |
| 10139 | |
| 10140 | static gboolean |
| 10141 | shared_resource_proxy_get_lock (SharedResource *object) |
| 10142 | { |
| 10143 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 10144 | GVariant *variant; |
| 10145 | gboolean value = 0; |
| 10146 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock"); |
| 10147 | if (variant != NULL) |
| 10148 | { |
| 10149 | value = g_variant_get_boolean (variant); |
| 10150 | g_variant_unref (variant); |
| 10151 | } |
| 10152 | return value; |
| 10153 | } |
| 10154 | |
| 10155 | static const gchar * |
| 10156 | shared_resource_proxy_get_name (SharedResource *object) |
| 10157 | { |
| 10158 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 10159 | GVariant *variant; |
| 10160 | const gchar *value = NULL; |
| 10161 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name"); |
| 10162 | if (variant != NULL) |
| 10163 | { |
| 10164 | value = g_variant_get_string (variant, NULL); |
| 10165 | g_variant_unref (variant); |
| 10166 | } |
| 10167 | return value; |
| 10168 | } |
| 10169 | |
| 10170 | static void |
| 10171 | shared_resource_proxy_init (SharedResourceProxy *proxy) |
| 10172 | { |
| 10173 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10174 | proxy->priv = shared_resource_proxy_get_instance_private (proxy); |
| 10175 | #else |
| 10176 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate); |
| 10177 | #endif |
| 10178 | |
| 10179 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ()); |
| 10180 | } |
| 10181 | |
| 10182 | static void |
| 10183 | shared_resource_proxy_class_init (SharedResourceProxyClass *klass) |
| 10184 | { |
| 10185 | GObjectClass *gobject_class; |
| 10186 | GDBusProxyClass *proxy_class; |
| 10187 | |
| 10188 | gobject_class = G_OBJECT_CLASS (klass); |
| 10189 | gobject_class->finalize = shared_resource_proxy_finalize; |
| 10190 | gobject_class->get_property = shared_resource_proxy_get_property; |
| 10191 | gobject_class->set_property = shared_resource_proxy_set_property; |
| 10192 | |
| 10193 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 10194 | proxy_class->g_signal = shared_resource_proxy_g_signal; |
| 10195 | proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed; |
| 10196 | |
| 10197 | shared_resource_override_properties (gobject_class, 1); |
| 10198 | |
| 10199 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10200 | g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate)); |
| 10201 | #endif |
| 10202 | } |
| 10203 | |
| 10204 | static void |
| 10205 | shared_resource_proxy_iface_init (SharedResourceIface *iface) |
| 10206 | { |
| 10207 | iface->get_lock = shared_resource_proxy_get_lock; |
| 10208 | iface->get_name = shared_resource_proxy_get_name; |
| 10209 | } |
| 10210 | |
| 10211 | /** |
| 10212 | * shared_resource_proxy_new: |
| 10213 | * @connection: A #GDBusConnection. |
| 10214 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10215 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10216 | * @object_path: An object path. |
| 10217 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10218 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10219 | * @user_data: User data to pass to @callback. |
| 10220 | * |
| 10221 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details. |
| 10222 | * |
| 10223 | * 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. |
| 10224 | * You can then call shared_resource_proxy_new_finish() to get the result of the operation. |
| 10225 | * |
| 10226 | * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 10227 | */ |
| 10228 | void |
| 10229 | shared_resource_proxy_new ( |
| 10230 | GDBusConnection *connection, |
| 10231 | GDBusProxyFlags flags, |
| 10232 | const gchar *name, |
| 10233 | const gchar *object_path, |
| 10234 | GCancellable *cancellable, |
| 10235 | GAsyncReadyCallback callback, |
| 10236 | gpointer user_data) |
| 10237 | { |
| 10238 | g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); |
| 10239 | } |
| 10240 | |
| 10241 | /** |
| 10242 | * shared_resource_proxy_new_finish: |
| 10243 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new(). |
| 10244 | * @error: Return location for error or %NULL |
| 10245 | * |
| 10246 | * Finishes an operation started with shared_resource_proxy_new(). |
| 10247 | * |
| 10248 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 10249 | */ |
| 10250 | SharedResource * |
| 10251 | shared_resource_proxy_new_finish ( |
| 10252 | GAsyncResult *res, |
| 10253 | GError **error) |
| 10254 | { |
| 10255 | GObject *ret; |
| 10256 | GObject *source_object; |
| 10257 | source_object = g_async_result_get_source_object (res); |
| 10258 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10259 | g_object_unref (source_object); |
| 10260 | if (ret != NULL) |
| 10261 | return SHARED_RESOURCE (ret); |
| 10262 | else |
| 10263 | return NULL; |
| 10264 | } |
| 10265 | |
| 10266 | /** |
| 10267 | * shared_resource_proxy_new_sync: |
| 10268 | * @connection: A #GDBusConnection. |
| 10269 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10270 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10271 | * @object_path: An object path. |
| 10272 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10273 | * @error: Return location for error or %NULL |
| 10274 | * |
| 10275 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details. |
| 10276 | * |
| 10277 | * The calling thread is blocked until a reply is received. |
| 10278 | * |
| 10279 | * See shared_resource_proxy_new() for the asynchronous version of this constructor. |
| 10280 | * |
| 10281 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 10282 | */ |
| 10283 | SharedResource * |
| 10284 | shared_resource_proxy_new_sync ( |
| 10285 | GDBusConnection *connection, |
| 10286 | GDBusProxyFlags flags, |
| 10287 | const gchar *name, |
| 10288 | const gchar *object_path, |
| 10289 | GCancellable *cancellable, |
| 10290 | GError **error) |
| 10291 | { |
| 10292 | GInitable *ret; |
| 10293 | ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); |
| 10294 | if (ret != NULL) |
| 10295 | return SHARED_RESOURCE (ret); |
| 10296 | else |
| 10297 | return NULL; |
| 10298 | } |
| 10299 | |
| 10300 | |
| 10301 | /** |
| 10302 | * shared_resource_proxy_new_for_bus: |
| 10303 | * @bus_type: A #GBusType. |
| 10304 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10305 | * @name: A bus name (well-known or unique). |
| 10306 | * @object_path: An object path. |
| 10307 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10308 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10309 | * @user_data: User data to pass to @callback. |
| 10310 | * |
| 10311 | * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 10312 | * |
| 10313 | * 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. |
| 10314 | * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation. |
| 10315 | * |
| 10316 | * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 10317 | */ |
| 10318 | void |
| 10319 | shared_resource_proxy_new_for_bus ( |
| 10320 | GBusType bus_type, |
| 10321 | GDBusProxyFlags flags, |
| 10322 | const gchar *name, |
| 10323 | const gchar *object_path, |
| 10324 | GCancellable *cancellable, |
| 10325 | GAsyncReadyCallback callback, |
| 10326 | gpointer user_data) |
| 10327 | { |
| 10328 | g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); |
| 10329 | } |
| 10330 | |
| 10331 | /** |
| 10332 | * shared_resource_proxy_new_for_bus_finish: |
| 10333 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus(). |
| 10334 | * @error: Return location for error or %NULL |
| 10335 | * |
| 10336 | * Finishes an operation started with shared_resource_proxy_new_for_bus(). |
| 10337 | * |
| 10338 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 10339 | */ |
| 10340 | SharedResource * |
| 10341 | shared_resource_proxy_new_for_bus_finish ( |
| 10342 | GAsyncResult *res, |
| 10343 | GError **error) |
| 10344 | { |
| 10345 | GObject *ret; |
| 10346 | GObject *source_object; |
| 10347 | source_object = g_async_result_get_source_object (res); |
| 10348 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10349 | g_object_unref (source_object); |
| 10350 | if (ret != NULL) |
| 10351 | return SHARED_RESOURCE (ret); |
| 10352 | else |
| 10353 | return NULL; |
| 10354 | } |
| 10355 | |
| 10356 | /** |
| 10357 | * shared_resource_proxy_new_for_bus_sync: |
| 10358 | * @bus_type: A #GBusType. |
| 10359 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10360 | * @name: A bus name (well-known or unique). |
| 10361 | * @object_path: An object path. |
| 10362 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10363 | * @error: Return location for error or %NULL |
| 10364 | * |
| 10365 | * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 10366 | * |
| 10367 | * The calling thread is blocked until a reply is received. |
| 10368 | * |
| 10369 | * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 10370 | * |
| 10371 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 10372 | */ |
| 10373 | SharedResource * |
| 10374 | shared_resource_proxy_new_for_bus_sync ( |
| 10375 | GBusType bus_type, |
| 10376 | GDBusProxyFlags flags, |
| 10377 | const gchar *name, |
| 10378 | const gchar *object_path, |
| 10379 | GCancellable *cancellable, |
| 10380 | GError **error) |
| 10381 | { |
| 10382 | GInitable *ret; |
| 10383 | ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); |
| 10384 | if (ret != NULL) |
| 10385 | return SHARED_RESOURCE (ret); |
| 10386 | else |
| 10387 | return NULL; |
| 10388 | } |
| 10389 | |
| 10390 | |
| 10391 | /* ------------------------------------------------------------------------ */ |
| 10392 | |
| 10393 | /** |
| 10394 | * SharedResourceSkeleton: |
| 10395 | * |
| 10396 | * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API. |
| 10397 | */ |
| 10398 | |
| 10399 | /** |
| 10400 | * SharedResourceSkeletonClass: |
| 10401 | * @parent_class: The parent class. |
| 10402 | * |
| 10403 | * Class structure for #SharedResourceSkeleton. |
| 10404 | */ |
| 10405 | |
| 10406 | struct _SharedResourceSkeletonPrivate |
| 10407 | { |
| 10408 | GValue *properties; |
| 10409 | GList *changed_properties; |
| 10410 | GSource *changed_properties_idle_source; |
| 10411 | GMainContext *context; |
| 10412 | GMutex lock; |
| 10413 | }; |
| 10414 | |
| 10415 | static void |
| 10416 | _shared_resource_skeleton_handle_method_call ( |
| 10417 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10418 | const gchar *sender G_GNUC_UNUSED, |
| 10419 | const gchar *object_path G_GNUC_UNUSED, |
| 10420 | const gchar *interface_name, |
| 10421 | const gchar *method_name, |
| 10422 | GVariant *parameters, |
| 10423 | GDBusMethodInvocation *invocation, |
| 10424 | gpointer user_data) |
| 10425 | { |
| 10426 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 10427 | _ExtendedGDBusMethodInfo *info; |
| 10428 | GVariantIter iter; |
| 10429 | GVariant *child; |
| 10430 | GValue *paramv; |
| 10431 | guint num_params; |
| 10432 | guint num_extra; |
| 10433 | guint n; |
| 10434 | guint signal_id; |
| 10435 | GValue return_value = G_VALUE_INIT; |
| 10436 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 10437 | g_assert (info != NULL); |
| 10438 | num_params = g_variant_n_children (parameters); |
| 10439 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 10440 | n = 0; |
| 10441 | g_value_init (¶mv[n], TYPE_SHARED_RESOURCE); |
| 10442 | g_value_set_object (¶mv[n++], skeleton); |
| 10443 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 10444 | g_value_set_object (¶mv[n++], invocation); |
| 10445 | if (info->pass_fdlist) |
| 10446 | { |
| 10447 | #ifdef G_OS_UNIX |
| 10448 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 10449 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 10450 | #else |
| 10451 | g_assert_not_reached (); |
| 10452 | #endif |
| 10453 | } |
| 10454 | g_variant_iter_init (&iter, parameters); |
| 10455 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10456 | { |
| 10457 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 10458 | if (arg_info->use_gvariant) |
| 10459 | { |
| 10460 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10461 | g_value_set_variant (¶mv[n], child); |
| 10462 | n++; |
| 10463 | } |
| 10464 | else |
| 10465 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10466 | g_variant_unref (child); |
| 10467 | } |
| 10468 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 10469 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 10470 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 10471 | if (!g_value_get_boolean (&return_value)) |
| 10472 | 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); |
| 10473 | g_value_unset (&return_value); |
| 10474 | for (n = 0; n < num_params + num_extra; n++) |
| 10475 | g_value_unset (¶mv[n]); |
| 10476 | g_free (paramv); |
| 10477 | } |
| 10478 | |
| 10479 | static GVariant * |
| 10480 | _shared_resource_skeleton_handle_get_property ( |
| 10481 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10482 | const gchar *sender G_GNUC_UNUSED, |
| 10483 | const gchar *object_path G_GNUC_UNUSED, |
| 10484 | const gchar *interface_name G_GNUC_UNUSED, |
| 10485 | const gchar *property_name, |
| 10486 | GError **error, |
| 10487 | gpointer user_data) |
| 10488 | { |
| 10489 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 10490 | GValue value = G_VALUE_INIT; |
| 10491 | GParamSpec *pspec; |
| 10492 | _ExtendedGDBusPropertyInfo *info; |
| 10493 | GVariant *ret; |
| 10494 | ret = NULL; |
| 10495 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 10496 | g_assert (info != NULL); |
| 10497 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 10498 | if (pspec == NULL) |
| 10499 | { |
| 10500 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10501 | } |
| 10502 | else |
| 10503 | { |
| 10504 | g_value_init (&value, pspec->value_type); |
| 10505 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10506 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 10507 | g_value_unset (&value); |
| 10508 | } |
| 10509 | return ret; |
| 10510 | } |
| 10511 | |
| 10512 | static gboolean |
| 10513 | _shared_resource_skeleton_handle_set_property ( |
| 10514 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10515 | const gchar *sender G_GNUC_UNUSED, |
| 10516 | const gchar *object_path G_GNUC_UNUSED, |
| 10517 | const gchar *interface_name G_GNUC_UNUSED, |
| 10518 | const gchar *property_name, |
| 10519 | GVariant *variant, |
| 10520 | GError **error, |
| 10521 | gpointer user_data) |
| 10522 | { |
| 10523 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 10524 | GValue value = G_VALUE_INIT; |
| 10525 | GParamSpec *pspec; |
| 10526 | _ExtendedGDBusPropertyInfo *info; |
| 10527 | gboolean ret; |
| 10528 | ret = FALSE; |
| 10529 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 10530 | g_assert (info != NULL); |
| 10531 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 10532 | if (pspec == NULL) |
| 10533 | { |
| 10534 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10535 | } |
| 10536 | else |
| 10537 | { |
| 10538 | if (info->use_gvariant) |
| 10539 | g_value_set_variant (&value, variant); |
| 10540 | else |
| 10541 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 10542 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10543 | g_value_unset (&value); |
| 10544 | ret = TRUE; |
| 10545 | } |
| 10546 | return ret; |
| 10547 | } |
| 10548 | |
| 10549 | static const GDBusInterfaceVTable _shared_resource_skeleton_vtable = |
| 10550 | { |
| 10551 | _shared_resource_skeleton_handle_method_call, |
| 10552 | _shared_resource_skeleton_handle_get_property, |
| 10553 | _shared_resource_skeleton_handle_set_property, |
| 10554 | {NULL} |
| 10555 | }; |
| 10556 | |
| 10557 | static GDBusInterfaceInfo * |
| 10558 | shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10559 | { |
| 10560 | return shared_resource_interface_info (); |
| 10561 | } |
| 10562 | |
| 10563 | static GDBusInterfaceVTable * |
| 10564 | shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10565 | { |
| 10566 | return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable; |
| 10567 | } |
| 10568 | |
| 10569 | static GVariant * |
| 10570 | shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 10571 | { |
| 10572 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 10573 | |
| 10574 | GVariantBuilder builder; |
| 10575 | guint n; |
| 10576 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 10577 | if (_shared_resource_interface_info.parent_struct.properties == NULL) |
| 10578 | goto out; |
| 10579 | for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++) |
| 10580 | { |
| 10581 | GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n]; |
| 10582 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 10583 | { |
| 10584 | GVariant *value; |
| 10585 | value = _shared_resource_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SharedResource", info->name, NULL, skeleton); |
| 10586 | if (value != NULL) |
| 10587 | { |
| 10588 | g_variant_take_ref (value); |
| 10589 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 10590 | g_variant_unref (value); |
| 10591 | } |
| 10592 | } |
| 10593 | } |
| 10594 | out: |
| 10595 | return g_variant_builder_end (&builder); |
| 10596 | } |
| 10597 | |
| 10598 | static gboolean _shared_resource_emit_changed (gpointer user_data); |
| 10599 | |
| 10600 | static void |
| 10601 | shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 10602 | { |
| 10603 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 10604 | gboolean emit_changed = FALSE; |
| 10605 | |
| 10606 | g_mutex_lock (&skeleton->priv->lock); |
| 10607 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 10608 | { |
| 10609 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 10610 | skeleton->priv->changed_properties_idle_source = NULL; |
| 10611 | emit_changed = TRUE; |
| 10612 | } |
| 10613 | g_mutex_unlock (&skeleton->priv->lock); |
| 10614 | |
| 10615 | if (emit_changed) |
| 10616 | _shared_resource_emit_changed (skeleton); |
| 10617 | } |
| 10618 | |
| 10619 | static void shared_resource_skeleton_iface_init (SharedResourceIface *iface); |
| 10620 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10621 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10622 | G_ADD_PRIVATE (SharedResourceSkeleton) |
| 10623 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 10624 | |
| 10625 | #else |
| 10626 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10627 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 10628 | |
| 10629 | #endif |
| 10630 | static void |
| 10631 | shared_resource_skeleton_finalize (GObject *object) |
| 10632 | { |
| 10633 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10634 | guint n; |
| 10635 | for (n = 0; n < 2; n++) |
| 10636 | g_value_unset (&skeleton->priv->properties[n]); |
| 10637 | g_free (skeleton->priv->properties); |
| 10638 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 10639 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 10640 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 10641 | g_main_context_unref (skeleton->priv->context); |
| 10642 | g_mutex_clear (&skeleton->priv->lock); |
| 10643 | G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object); |
| 10644 | } |
| 10645 | |
| 10646 | static void |
| 10647 | shared_resource_skeleton_get_property (GObject *object, |
| 10648 | guint prop_id, |
| 10649 | GValue *value, |
| 10650 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10651 | { |
| 10652 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10653 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10654 | g_mutex_lock (&skeleton->priv->lock); |
| 10655 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 10656 | g_mutex_unlock (&skeleton->priv->lock); |
| 10657 | } |
| 10658 | |
| 10659 | static gboolean |
| 10660 | _shared_resource_emit_changed (gpointer user_data) |
| 10661 | { |
| 10662 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 10663 | GList *l; |
| 10664 | GVariantBuilder builder; |
| 10665 | GVariantBuilder invalidated_builder; |
| 10666 | guint num_changes; |
| 10667 | |
| 10668 | g_mutex_lock (&skeleton->priv->lock); |
| 10669 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 10670 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 10671 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 10672 | { |
| 10673 | ChangedProperty *cp = l->data; |
| 10674 | GVariant *variant; |
| 10675 | const GValue *cur_value; |
| 10676 | |
| 10677 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 10678 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 10679 | { |
| 10680 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 10681 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 10682 | g_variant_unref (variant); |
| 10683 | num_changes++; |
| 10684 | } |
| 10685 | } |
| 10686 | if (num_changes > 0) |
| 10687 | { |
| 10688 | GList *connections, *ll; |
| 10689 | GVariant *signal_variant; |
| 10690 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource", |
| 10691 | &builder, &invalidated_builder)); |
| 10692 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 10693 | for (ll = connections; ll != NULL; ll = ll->next) |
| 10694 | { |
| 10695 | GDBusConnection *connection = ll->data; |
| 10696 | |
| 10697 | g_dbus_connection_emit_signal (connection, |
| 10698 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 10699 | "org.freedesktop.DBus.Properties", |
| 10700 | "PropertiesChanged", |
| 10701 | signal_variant, |
| 10702 | NULL); |
| 10703 | } |
| 10704 | g_variant_unref (signal_variant); |
| 10705 | g_list_free_full (connections, g_object_unref); |
| 10706 | } |
| 10707 | else |
| 10708 | { |
| 10709 | g_variant_builder_clear (&builder); |
| 10710 | g_variant_builder_clear (&invalidated_builder); |
| 10711 | } |
| 10712 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 10713 | skeleton->priv->changed_properties = NULL; |
| 10714 | skeleton->priv->changed_properties_idle_source = NULL; |
| 10715 | g_mutex_unlock (&skeleton->priv->lock); |
| 10716 | return FALSE; |
| 10717 | } |
| 10718 | |
| 10719 | static void |
| 10720 | _shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 10721 | { |
| 10722 | ChangedProperty *cp; |
| 10723 | GList *l; |
| 10724 | cp = NULL; |
| 10725 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 10726 | { |
| 10727 | ChangedProperty *i_cp = l->data; |
| 10728 | if (i_cp->info == info) |
| 10729 | { |
| 10730 | cp = i_cp; |
| 10731 | break; |
| 10732 | } |
| 10733 | } |
| 10734 | if (cp == NULL) |
| 10735 | { |
| 10736 | cp = g_new0 (ChangedProperty, 1); |
| 10737 | cp->prop_id = prop_id; |
| 10738 | cp->info = info; |
| 10739 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 10740 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 10741 | g_value_copy (orig_value, &cp->orig_value); |
| 10742 | } |
| 10743 | } |
| 10744 | |
| 10745 | static void |
| 10746 | shared_resource_skeleton_notify (GObject *object, |
| 10747 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10748 | { |
| 10749 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10750 | g_mutex_lock (&skeleton->priv->lock); |
| 10751 | if (skeleton->priv->changed_properties != NULL && |
| 10752 | skeleton->priv->changed_properties_idle_source == NULL) |
| 10753 | { |
| 10754 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 10755 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 10756 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 10757 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 10758 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 10759 | } |
| 10760 | g_mutex_unlock (&skeleton->priv->lock); |
| 10761 | } |
| 10762 | |
| 10763 | static void |
| 10764 | shared_resource_skeleton_set_property (GObject *object, |
| 10765 | guint prop_id, |
| 10766 | const GValue *value, |
| 10767 | GParamSpec *pspec) |
| 10768 | { |
| 10769 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10770 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10771 | g_mutex_lock (&skeleton->priv->lock); |
| 10772 | g_object_freeze_notify (object); |
| 10773 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 10774 | { |
| 10775 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 10776 | _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 10777 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 10778 | g_object_notify_by_pspec (object, pspec); |
| 10779 | } |
| 10780 | g_mutex_unlock (&skeleton->priv->lock); |
| 10781 | g_object_thaw_notify (object); |
| 10782 | } |
| 10783 | |
| 10784 | static void |
| 10785 | shared_resource_skeleton_init (SharedResourceSkeleton *skeleton) |
| 10786 | { |
| 10787 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10788 | skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton); |
| 10789 | #else |
| 10790 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate); |
| 10791 | #endif |
| 10792 | |
| 10793 | g_mutex_init (&skeleton->priv->lock); |
| 10794 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 10795 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 10796 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
| 10797 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 10798 | } |
| 10799 | |
| 10800 | static gboolean |
| 10801 | shared_resource_skeleton_get_lock (SharedResource *object) |
| 10802 | { |
| 10803 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10804 | gboolean value; |
| 10805 | g_mutex_lock (&skeleton->priv->lock); |
| 10806 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 10807 | g_mutex_unlock (&skeleton->priv->lock); |
| 10808 | return value; |
| 10809 | } |
| 10810 | |
| 10811 | static const gchar * |
| 10812 | shared_resource_skeleton_get_name (SharedResource *object) |
| 10813 | { |
| 10814 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 10815 | const gchar *value; |
| 10816 | g_mutex_lock (&skeleton->priv->lock); |
| 10817 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 10818 | g_mutex_unlock (&skeleton->priv->lock); |
| 10819 | return value; |
| 10820 | } |
| 10821 | |
| 10822 | static void |
| 10823 | shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass) |
| 10824 | { |
| 10825 | GObjectClass *gobject_class; |
| 10826 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 10827 | |
| 10828 | gobject_class = G_OBJECT_CLASS (klass); |
| 10829 | gobject_class->finalize = shared_resource_skeleton_finalize; |
| 10830 | gobject_class->get_property = shared_resource_skeleton_get_property; |
| 10831 | gobject_class->set_property = shared_resource_skeleton_set_property; |
| 10832 | gobject_class->notify = shared_resource_skeleton_notify; |
| 10833 | |
| 10834 | |
| 10835 | shared_resource_override_properties (gobject_class, 1); |
| 10836 | |
| 10837 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 10838 | skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info; |
| 10839 | skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties; |
| 10840 | skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush; |
| 10841 | skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable; |
| 10842 | |
| 10843 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10844 | g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate)); |
| 10845 | #endif |
| 10846 | } |
| 10847 | |
| 10848 | static void |
| 10849 | shared_resource_skeleton_iface_init (SharedResourceIface *iface) |
| 10850 | { |
| 10851 | iface->get_lock = shared_resource_skeleton_get_lock; |
| 10852 | iface->get_name = shared_resource_skeleton_get_name; |
| 10853 | } |
| 10854 | |
| 10855 | /** |
| 10856 | * shared_resource_skeleton_new: |
| 10857 | * |
| 10858 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 10859 | * |
| 10860 | * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object. |
| 10861 | */ |
| 10862 | SharedResource * |
| 10863 | shared_resource_skeleton_new (void) |
| 10864 | { |
| 10865 | return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL)); |
| 10866 | } |
| 10867 | |
| 10868 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 10869 | * Code for interface org.openbmc.Control |
| 10870 | * ------------------------------------------------------------------------ |
| 10871 | */ |
| 10872 | |
| 10873 | /** |
| 10874 | * SECTION:Control |
| 10875 | * @title: Control |
| 10876 | * @short_description: Generated C code for the org.openbmc.Control D-Bus interface |
| 10877 | * |
| 10878 | * 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. |
| 10879 | */ |
| 10880 | |
| 10881 | /* ---- Introspection data for org.openbmc.Control ---- */ |
| 10882 | |
| 10883 | static const _ExtendedGDBusMethodInfo _control_method_info_init = |
| 10884 | { |
| 10885 | { |
| 10886 | -1, |
| 10887 | (gchar *) "init", |
| 10888 | NULL, |
| 10889 | NULL, |
| 10890 | NULL |
| 10891 | }, |
| 10892 | "handle-init", |
| 10893 | FALSE |
| 10894 | }; |
| 10895 | |
| 10896 | static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = |
| 10897 | { |
| 10898 | &_control_method_info_init, |
| 10899 | NULL |
| 10900 | }; |
| 10901 | |
| 10902 | static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name = |
| 10903 | { |
| 10904 | { |
| 10905 | -1, |
| 10906 | (gchar *) "bus_name", |
| 10907 | (gchar *) "s", |
| 10908 | NULL |
| 10909 | }, |
| 10910 | FALSE |
| 10911 | }; |
| 10912 | |
| 10913 | static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] = |
| 10914 | { |
| 10915 | &_control_signal_info_heartbeat_ARG_bus_name, |
| 10916 | NULL |
| 10917 | }; |
| 10918 | |
| 10919 | static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat = |
| 10920 | { |
| 10921 | { |
| 10922 | -1, |
| 10923 | (gchar *) "Heartbeat", |
| 10924 | (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers, |
| 10925 | NULL |
| 10926 | }, |
| 10927 | "heartbeat" |
| 10928 | }; |
| 10929 | |
| 10930 | static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name = |
| 10931 | { |
| 10932 | { |
| 10933 | -1, |
| 10934 | (gchar *) "state_name", |
| 10935 | (gchar *) "s", |
| 10936 | NULL |
| 10937 | }, |
| 10938 | FALSE |
| 10939 | }; |
| 10940 | |
| 10941 | static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] = |
| 10942 | { |
| 10943 | &_control_signal_info_goto_system_state_ARG_state_name, |
| 10944 | NULL |
| 10945 | }; |
| 10946 | |
| 10947 | static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state = |
| 10948 | { |
| 10949 | { |
| 10950 | -1, |
| 10951 | (gchar *) "GotoSystemState", |
| 10952 | (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers, |
| 10953 | NULL |
| 10954 | }, |
| 10955 | "goto-system-state" |
| 10956 | }; |
| 10957 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 10958 | static const _ExtendedGDBusSignalInfo _control_signal_info_started = |
| 10959 | { |
| 10960 | { |
| 10961 | -1, |
| 10962 | (gchar *) "Started", |
| 10963 | NULL, |
| 10964 | NULL |
| 10965 | }, |
| 10966 | "started" |
| 10967 | }; |
| 10968 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 10969 | static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] = |
| 10970 | { |
| 10971 | &_control_signal_info_heartbeat, |
| 10972 | &_control_signal_info_goto_system_state, |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 10973 | &_control_signal_info_started, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 10974 | NULL |
| 10975 | }; |
| 10976 | |
| 10977 | static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = |
| 10978 | { |
| 10979 | { |
| 10980 | -1, |
| 10981 | (gchar *) "poll_interval", |
| 10982 | (gchar *) "i", |
| 10983 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 10984 | NULL |
| 10985 | }, |
| 10986 | "poll-interval", |
| 10987 | FALSE |
| 10988 | }; |
| 10989 | |
| 10990 | static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat = |
| 10991 | { |
| 10992 | { |
| 10993 | -1, |
| 10994 | (gchar *) "heatbeat", |
| 10995 | (gchar *) "i", |
| 10996 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 10997 | NULL |
| 10998 | }, |
| 10999 | "heatbeat", |
| 11000 | FALSE |
| 11001 | }; |
| 11002 | |
| 11003 | static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] = |
| 11004 | { |
| 11005 | &_control_property_info_poll_interval, |
| 11006 | &_control_property_info_heatbeat, |
| 11007 | NULL |
| 11008 | }; |
| 11009 | |
| 11010 | static const _ExtendedGDBusInterfaceInfo _control_interface_info = |
| 11011 | { |
| 11012 | { |
| 11013 | -1, |
| 11014 | (gchar *) "org.openbmc.Control", |
| 11015 | (GDBusMethodInfo **) &_control_method_info_pointers, |
| 11016 | (GDBusSignalInfo **) &_control_signal_info_pointers, |
| 11017 | (GDBusPropertyInfo **) &_control_property_info_pointers, |
| 11018 | NULL |
| 11019 | }, |
| 11020 | "control", |
| 11021 | }; |
| 11022 | |
| 11023 | |
| 11024 | /** |
| 11025 | * control_interface_info: |
| 11026 | * |
| 11027 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface. |
| 11028 | * |
| 11029 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 11030 | */ |
| 11031 | GDBusInterfaceInfo * |
| 11032 | control_interface_info (void) |
| 11033 | { |
| 11034 | return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct; |
| 11035 | } |
| 11036 | |
| 11037 | /** |
| 11038 | * control_override_properties: |
| 11039 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 11040 | * @property_id_begin: The property id to assign to the first overridden property. |
| 11041 | * |
| 11042 | * Overrides all #GObject properties in the #Control interface for a concrete class. |
| 11043 | * The properties are overridden in the order they are defined. |
| 11044 | * |
| 11045 | * Returns: The last property id. |
| 11046 | */ |
| 11047 | guint |
| 11048 | control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 11049 | { |
| 11050 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 11051 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 11052 | return property_id_begin - 1; |
| 11053 | } |
| 11054 | |
| 11055 | |
| 11056 | |
| 11057 | /** |
| 11058 | * Control: |
| 11059 | * |
| 11060 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11061 | */ |
| 11062 | |
| 11063 | /** |
| 11064 | * ControlIface: |
| 11065 | * @parent_iface: The parent interface. |
| 11066 | * @handle_init: Handler for the #Control::handle-init signal. |
| 11067 | * @get_heatbeat: Getter for the #Control:heatbeat property. |
| 11068 | * @get_poll_interval: Getter for the #Control:poll-interval property. |
| 11069 | * @goto_system_state: Handler for the #Control::goto-system-state signal. |
| 11070 | * @heartbeat: Handler for the #Control::heartbeat signal. |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11071 | * @started: Handler for the #Control::started signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11072 | * |
| 11073 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11074 | */ |
| 11075 | |
| 11076 | typedef ControlIface ControlInterface; |
| 11077 | G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT); |
| 11078 | |
| 11079 | static void |
| 11080 | control_default_init (ControlIface *iface) |
| 11081 | { |
| 11082 | /* GObject signals for incoming D-Bus method calls: */ |
| 11083 | /** |
| 11084 | * Control::handle-init: |
| 11085 | * @object: A #Control. |
| 11086 | * @invocation: A #GDBusMethodInvocation. |
| 11087 | * |
| 11088 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. |
| 11089 | * |
| 11090 | * 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. |
| 11091 | * |
| 11092 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11093 | */ |
| 11094 | g_signal_new ("handle-init", |
| 11095 | G_TYPE_FROM_INTERFACE (iface), |
| 11096 | G_SIGNAL_RUN_LAST, |
| 11097 | G_STRUCT_OFFSET (ControlIface, handle_init), |
| 11098 | g_signal_accumulator_true_handled, |
| 11099 | NULL, |
| 11100 | g_cclosure_marshal_generic, |
| 11101 | G_TYPE_BOOLEAN, |
| 11102 | 1, |
| 11103 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 11104 | |
| 11105 | /* GObject signals for received D-Bus signals: */ |
| 11106 | /** |
| 11107 | * Control::heartbeat: |
| 11108 | * @object: A #Control. |
| 11109 | * @arg_bus_name: Argument. |
| 11110 | * |
| 11111 | * 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. |
| 11112 | * |
| 11113 | * 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. |
| 11114 | */ |
| 11115 | g_signal_new ("heartbeat", |
| 11116 | G_TYPE_FROM_INTERFACE (iface), |
| 11117 | G_SIGNAL_RUN_LAST, |
| 11118 | G_STRUCT_OFFSET (ControlIface, heartbeat), |
| 11119 | NULL, |
| 11120 | NULL, |
| 11121 | g_cclosure_marshal_generic, |
| 11122 | G_TYPE_NONE, |
| 11123 | 1, G_TYPE_STRING); |
| 11124 | |
| 11125 | /** |
| 11126 | * Control::goto-system-state: |
| 11127 | * @object: A #Control. |
| 11128 | * @arg_state_name: Argument. |
| 11129 | * |
| 11130 | * 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. |
| 11131 | * |
| 11132 | * 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. |
| 11133 | */ |
| 11134 | g_signal_new ("goto-system-state", |
| 11135 | G_TYPE_FROM_INTERFACE (iface), |
| 11136 | G_SIGNAL_RUN_LAST, |
| 11137 | G_STRUCT_OFFSET (ControlIface, goto_system_state), |
| 11138 | NULL, |
| 11139 | NULL, |
| 11140 | g_cclosure_marshal_generic, |
| 11141 | G_TYPE_NONE, |
| 11142 | 1, G_TYPE_STRING); |
| 11143 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11144 | /** |
| 11145 | * Control::started: |
| 11146 | * @object: A #Control. |
| 11147 | * |
| 11148 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received. |
| 11149 | * |
| 11150 | * 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. |
| 11151 | */ |
| 11152 | g_signal_new ("started", |
| 11153 | G_TYPE_FROM_INTERFACE (iface), |
| 11154 | G_SIGNAL_RUN_LAST, |
| 11155 | G_STRUCT_OFFSET (ControlIface, started), |
| 11156 | NULL, |
| 11157 | NULL, |
| 11158 | g_cclosure_marshal_generic, |
| 11159 | G_TYPE_NONE, |
| 11160 | 0); |
| 11161 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11162 | /* GObject properties for D-Bus properties: */ |
| 11163 | /** |
| 11164 | * Control:poll-interval: |
| 11165 | * |
| 11166 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. |
| 11167 | * |
| 11168 | * 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. |
| 11169 | */ |
| 11170 | g_object_interface_install_property (iface, |
| 11171 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11172 | /** |
| 11173 | * Control:heatbeat: |
| 11174 | * |
| 11175 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>. |
| 11176 | * |
| 11177 | * 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. |
| 11178 | */ |
| 11179 | g_object_interface_install_property (iface, |
| 11180 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11181 | } |
| 11182 | |
| 11183 | /** |
| 11184 | * control_get_poll_interval: (skip) |
| 11185 | * @object: A #Control. |
| 11186 | * |
| 11187 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. |
| 11188 | * |
| 11189 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 11190 | * |
| 11191 | * Returns: The property value. |
| 11192 | */ |
| 11193 | gint |
| 11194 | control_get_poll_interval (Control *object) |
| 11195 | { |
| 11196 | return CONTROL_GET_IFACE (object)->get_poll_interval (object); |
| 11197 | } |
| 11198 | |
| 11199 | /** |
| 11200 | * control_set_poll_interval: (skip) |
| 11201 | * @object: A #Control. |
| 11202 | * @value: The value to set. |
| 11203 | * |
| 11204 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 11205 | * |
| 11206 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 11207 | */ |
| 11208 | void |
| 11209 | control_set_poll_interval (Control *object, gint value) |
| 11210 | { |
| 11211 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 11212 | } |
| 11213 | |
| 11214 | /** |
| 11215 | * control_get_heatbeat: (skip) |
| 11216 | * @object: A #Control. |
| 11217 | * |
| 11218 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property. |
| 11219 | * |
| 11220 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 11221 | * |
| 11222 | * Returns: The property value. |
| 11223 | */ |
| 11224 | gint |
| 11225 | control_get_heatbeat (Control *object) |
| 11226 | { |
| 11227 | return CONTROL_GET_IFACE (object)->get_heatbeat (object); |
| 11228 | } |
| 11229 | |
| 11230 | /** |
| 11231 | * control_set_heatbeat: (skip) |
| 11232 | * @object: A #Control. |
| 11233 | * @value: The value to set. |
| 11234 | * |
| 11235 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 11236 | * |
| 11237 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 11238 | */ |
| 11239 | void |
| 11240 | control_set_heatbeat (Control *object, gint value) |
| 11241 | { |
| 11242 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 11243 | } |
| 11244 | |
| 11245 | /** |
| 11246 | * control_emit_heartbeat: |
| 11247 | * @object: A #Control. |
| 11248 | * @arg_bus_name: Argument to pass with the signal. |
| 11249 | * |
| 11250 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 11251 | */ |
| 11252 | void |
| 11253 | control_emit_heartbeat ( |
| 11254 | Control *object, |
| 11255 | const gchar *arg_bus_name) |
| 11256 | { |
| 11257 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 11258 | } |
| 11259 | |
| 11260 | /** |
| 11261 | * control_emit_goto_system_state: |
| 11262 | * @object: A #Control. |
| 11263 | * @arg_state_name: Argument to pass with the signal. |
| 11264 | * |
| 11265 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal. |
| 11266 | */ |
| 11267 | void |
| 11268 | control_emit_goto_system_state ( |
| 11269 | Control *object, |
| 11270 | const gchar *arg_state_name) |
| 11271 | { |
| 11272 | g_signal_emit_by_name (object, "goto-system-state", arg_state_name); |
| 11273 | } |
| 11274 | |
| 11275 | /** |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11276 | * control_emit_started: |
| 11277 | * @object: A #Control. |
| 11278 | * |
| 11279 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal. |
| 11280 | */ |
| 11281 | void |
| 11282 | control_emit_started ( |
| 11283 | Control *object) |
| 11284 | { |
| 11285 | g_signal_emit_by_name (object, "started"); |
| 11286 | } |
| 11287 | |
| 11288 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11289 | * control_call_init: |
| 11290 | * @proxy: A #ControlProxy. |
| 11291 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11292 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 11293 | * @user_data: User data to pass to @callback. |
| 11294 | * |
| 11295 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. |
| 11296 | * 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. |
| 11297 | * You can then call control_call_init_finish() to get the result of the operation. |
| 11298 | * |
| 11299 | * See control_call_init_sync() for the synchronous, blocking version of this method. |
| 11300 | */ |
| 11301 | void |
| 11302 | control_call_init ( |
| 11303 | Control *proxy, |
| 11304 | GCancellable *cancellable, |
| 11305 | GAsyncReadyCallback callback, |
| 11306 | gpointer user_data) |
| 11307 | { |
| 11308 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 11309 | "init", |
| 11310 | g_variant_new ("()"), |
| 11311 | G_DBUS_CALL_FLAGS_NONE, |
| 11312 | -1, |
| 11313 | cancellable, |
| 11314 | callback, |
| 11315 | user_data); |
| 11316 | } |
| 11317 | |
| 11318 | /** |
| 11319 | * control_call_init_finish: |
| 11320 | * @proxy: A #ControlProxy. |
| 11321 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). |
| 11322 | * @error: Return location for error or %NULL. |
| 11323 | * |
| 11324 | * Finishes an operation started with control_call_init(). |
| 11325 | * |
| 11326 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11327 | */ |
| 11328 | gboolean |
| 11329 | control_call_init_finish ( |
| 11330 | Control *proxy, |
| 11331 | GAsyncResult *res, |
| 11332 | GError **error) |
| 11333 | { |
| 11334 | GVariant *_ret; |
| 11335 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 11336 | if (_ret == NULL) |
| 11337 | goto _out; |
| 11338 | g_variant_get (_ret, |
| 11339 | "()"); |
| 11340 | g_variant_unref (_ret); |
| 11341 | _out: |
| 11342 | return _ret != NULL; |
| 11343 | } |
| 11344 | |
| 11345 | /** |
| 11346 | * control_call_init_sync: |
| 11347 | * @proxy: A #ControlProxy. |
| 11348 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11349 | * @error: Return location for error or %NULL. |
| 11350 | * |
| 11351 | * 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. |
| 11352 | * |
| 11353 | * See control_call_init() for the asynchronous version of this method. |
| 11354 | * |
| 11355 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11356 | */ |
| 11357 | gboolean |
| 11358 | control_call_init_sync ( |
| 11359 | Control *proxy, |
| 11360 | GCancellable *cancellable, |
| 11361 | GError **error) |
| 11362 | { |
| 11363 | GVariant *_ret; |
| 11364 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 11365 | "init", |
| 11366 | g_variant_new ("()"), |
| 11367 | G_DBUS_CALL_FLAGS_NONE, |
| 11368 | -1, |
| 11369 | cancellable, |
| 11370 | error); |
| 11371 | if (_ret == NULL) |
| 11372 | goto _out; |
| 11373 | g_variant_get (_ret, |
| 11374 | "()"); |
| 11375 | g_variant_unref (_ret); |
| 11376 | _out: |
| 11377 | return _ret != NULL; |
| 11378 | } |
| 11379 | |
| 11380 | /** |
| 11381 | * control_complete_init: |
| 11382 | * @object: A #Control. |
| 11383 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 11384 | * |
| 11385 | * 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. |
| 11386 | * |
| 11387 | * This method will free @invocation, you cannot use it afterwards. |
| 11388 | */ |
| 11389 | void |
| 11390 | control_complete_init ( |
| 11391 | Control *object, |
| 11392 | GDBusMethodInvocation *invocation) |
| 11393 | { |
| 11394 | g_dbus_method_invocation_return_value (invocation, |
| 11395 | g_variant_new ("()")); |
| 11396 | } |
| 11397 | |
| 11398 | /* ------------------------------------------------------------------------ */ |
| 11399 | |
| 11400 | /** |
| 11401 | * ControlProxy: |
| 11402 | * |
| 11403 | * The #ControlProxy structure contains only private data and should only be accessed using the provided API. |
| 11404 | */ |
| 11405 | |
| 11406 | /** |
| 11407 | * ControlProxyClass: |
| 11408 | * @parent_class: The parent class. |
| 11409 | * |
| 11410 | * Class structure for #ControlProxy. |
| 11411 | */ |
| 11412 | |
| 11413 | struct _ControlProxyPrivate |
| 11414 | { |
| 11415 | GData *qdata; |
| 11416 | }; |
| 11417 | |
| 11418 | static void control_proxy_iface_init (ControlIface *iface); |
| 11419 | |
| 11420 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11421 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 11422 | G_ADD_PRIVATE (ControlProxy) |
| 11423 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 11424 | |
| 11425 | #else |
| 11426 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 11427 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 11428 | |
| 11429 | #endif |
| 11430 | static void |
| 11431 | control_proxy_finalize (GObject *object) |
| 11432 | { |
| 11433 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11434 | g_datalist_clear (&proxy->priv->qdata); |
| 11435 | G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object); |
| 11436 | } |
| 11437 | |
| 11438 | static void |
| 11439 | control_proxy_get_property (GObject *object, |
| 11440 | guint prop_id, |
| 11441 | GValue *value, |
| 11442 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11443 | { |
| 11444 | const _ExtendedGDBusPropertyInfo *info; |
| 11445 | GVariant *variant; |
| 11446 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11447 | info = _control_property_info_pointers[prop_id - 1]; |
| 11448 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 11449 | if (info->use_gvariant) |
| 11450 | { |
| 11451 | g_value_set_variant (value, variant); |
| 11452 | } |
| 11453 | else |
| 11454 | { |
| 11455 | if (variant != NULL) |
| 11456 | g_dbus_gvariant_to_gvalue (variant, value); |
| 11457 | } |
| 11458 | if (variant != NULL) |
| 11459 | g_variant_unref (variant); |
| 11460 | } |
| 11461 | |
| 11462 | static void |
| 11463 | control_proxy_set_property_cb (GDBusProxy *proxy, |
| 11464 | GAsyncResult *res, |
| 11465 | gpointer user_data) |
| 11466 | { |
| 11467 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 11468 | GError *error; |
| 11469 | GVariant *_ret; |
| 11470 | error = NULL; |
| 11471 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 11472 | if (!_ret) |
| 11473 | { |
| 11474 | g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)", |
| 11475 | info->parent_struct.name, |
| 11476 | error->message, g_quark_to_string (error->domain), error->code); |
| 11477 | g_error_free (error); |
| 11478 | } |
| 11479 | else |
| 11480 | { |
| 11481 | g_variant_unref (_ret); |
| 11482 | } |
| 11483 | } |
| 11484 | |
| 11485 | static void |
| 11486 | control_proxy_set_property (GObject *object, |
| 11487 | guint prop_id, |
| 11488 | const GValue *value, |
| 11489 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11490 | { |
| 11491 | const _ExtendedGDBusPropertyInfo *info; |
| 11492 | GVariant *variant; |
| 11493 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11494 | info = _control_property_info_pointers[prop_id - 1]; |
| 11495 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11496 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 11497 | "org.freedesktop.DBus.Properties.Set", |
| 11498 | g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant), |
| 11499 | G_DBUS_CALL_FLAGS_NONE, |
| 11500 | -1, |
| 11501 | NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 11502 | g_variant_unref (variant); |
| 11503 | } |
| 11504 | |
| 11505 | static void |
| 11506 | control_proxy_g_signal (GDBusProxy *proxy, |
| 11507 | const gchar *sender_name G_GNUC_UNUSED, |
| 11508 | const gchar *signal_name, |
| 11509 | GVariant *parameters) |
| 11510 | { |
| 11511 | _ExtendedGDBusSignalInfo *info; |
| 11512 | GVariantIter iter; |
| 11513 | GVariant *child; |
| 11514 | GValue *paramv; |
| 11515 | guint num_params; |
| 11516 | guint n; |
| 11517 | guint signal_id; |
| 11518 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name); |
| 11519 | if (info == NULL) |
| 11520 | return; |
| 11521 | num_params = g_variant_n_children (parameters); |
| 11522 | paramv = g_new0 (GValue, num_params + 1); |
| 11523 | g_value_init (¶mv[0], TYPE_CONTROL); |
| 11524 | g_value_set_object (¶mv[0], proxy); |
| 11525 | g_variant_iter_init (&iter, parameters); |
| 11526 | n = 1; |
| 11527 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11528 | { |
| 11529 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 11530 | if (arg_info->use_gvariant) |
| 11531 | { |
| 11532 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11533 | g_value_set_variant (¶mv[n], child); |
| 11534 | n++; |
| 11535 | } |
| 11536 | else |
| 11537 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11538 | g_variant_unref (child); |
| 11539 | } |
| 11540 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 11541 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 11542 | for (n = 0; n < num_params + 1; n++) |
| 11543 | g_value_unset (¶mv[n]); |
| 11544 | g_free (paramv); |
| 11545 | } |
| 11546 | |
| 11547 | static void |
| 11548 | control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 11549 | GVariant *changed_properties, |
| 11550 | const gchar *const *invalidated_properties) |
| 11551 | { |
| 11552 | ControlProxy *proxy = CONTROL_PROXY (_proxy); |
| 11553 | guint n; |
| 11554 | const gchar *key; |
| 11555 | GVariantIter *iter; |
| 11556 | _ExtendedGDBusPropertyInfo *info; |
| 11557 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 11558 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 11559 | { |
| 11560 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key); |
| 11561 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 11562 | if (info != NULL) |
| 11563 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 11564 | } |
| 11565 | g_variant_iter_free (iter); |
| 11566 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 11567 | { |
| 11568 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]); |
| 11569 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 11570 | if (info != NULL) |
| 11571 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 11572 | } |
| 11573 | } |
| 11574 | |
| 11575 | static gint |
| 11576 | control_proxy_get_poll_interval (Control *object) |
| 11577 | { |
| 11578 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11579 | GVariant *variant; |
| 11580 | gint value = 0; |
| 11581 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 11582 | if (variant != NULL) |
| 11583 | { |
| 11584 | value = g_variant_get_int32 (variant); |
| 11585 | g_variant_unref (variant); |
| 11586 | } |
| 11587 | return value; |
| 11588 | } |
| 11589 | |
| 11590 | static gint |
| 11591 | control_proxy_get_heatbeat (Control *object) |
| 11592 | { |
| 11593 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 11594 | GVariant *variant; |
| 11595 | gint value = 0; |
| 11596 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 11597 | if (variant != NULL) |
| 11598 | { |
| 11599 | value = g_variant_get_int32 (variant); |
| 11600 | g_variant_unref (variant); |
| 11601 | } |
| 11602 | return value; |
| 11603 | } |
| 11604 | |
| 11605 | static void |
| 11606 | control_proxy_init (ControlProxy *proxy) |
| 11607 | { |
| 11608 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11609 | proxy->priv = control_proxy_get_instance_private (proxy); |
| 11610 | #else |
| 11611 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate); |
| 11612 | #endif |
| 11613 | |
| 11614 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ()); |
| 11615 | } |
| 11616 | |
| 11617 | static void |
| 11618 | control_proxy_class_init (ControlProxyClass *klass) |
| 11619 | { |
| 11620 | GObjectClass *gobject_class; |
| 11621 | GDBusProxyClass *proxy_class; |
| 11622 | |
| 11623 | gobject_class = G_OBJECT_CLASS (klass); |
| 11624 | gobject_class->finalize = control_proxy_finalize; |
| 11625 | gobject_class->get_property = control_proxy_get_property; |
| 11626 | gobject_class->set_property = control_proxy_set_property; |
| 11627 | |
| 11628 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 11629 | proxy_class->g_signal = control_proxy_g_signal; |
| 11630 | proxy_class->g_properties_changed = control_proxy_g_properties_changed; |
| 11631 | |
| 11632 | control_override_properties (gobject_class, 1); |
| 11633 | |
| 11634 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 11635 | g_type_class_add_private (klass, sizeof (ControlProxyPrivate)); |
| 11636 | #endif |
| 11637 | } |
| 11638 | |
| 11639 | static void |
| 11640 | control_proxy_iface_init (ControlIface *iface) |
| 11641 | { |
| 11642 | iface->get_poll_interval = control_proxy_get_poll_interval; |
| 11643 | iface->get_heatbeat = control_proxy_get_heatbeat; |
| 11644 | } |
| 11645 | |
| 11646 | /** |
| 11647 | * control_proxy_new: |
| 11648 | * @connection: A #GDBusConnection. |
| 11649 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11650 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11651 | * @object_path: An object path. |
| 11652 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11653 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11654 | * @user_data: User data to pass to @callback. |
| 11655 | * |
| 11656 | * 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. |
| 11657 | * |
| 11658 | * 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. |
| 11659 | * You can then call control_proxy_new_finish() to get the result of the operation. |
| 11660 | * |
| 11661 | * See control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 11662 | */ |
| 11663 | void |
| 11664 | control_proxy_new ( |
| 11665 | GDBusConnection *connection, |
| 11666 | GDBusProxyFlags flags, |
| 11667 | const gchar *name, |
| 11668 | const gchar *object_path, |
| 11669 | GCancellable *cancellable, |
| 11670 | GAsyncReadyCallback callback, |
| 11671 | gpointer user_data) |
| 11672 | { |
| 11673 | 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); |
| 11674 | } |
| 11675 | |
| 11676 | /** |
| 11677 | * control_proxy_new_finish: |
| 11678 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new(). |
| 11679 | * @error: Return location for error or %NULL |
| 11680 | * |
| 11681 | * Finishes an operation started with control_proxy_new(). |
| 11682 | * |
| 11683 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11684 | */ |
| 11685 | Control * |
| 11686 | control_proxy_new_finish ( |
| 11687 | GAsyncResult *res, |
| 11688 | GError **error) |
| 11689 | { |
| 11690 | GObject *ret; |
| 11691 | GObject *source_object; |
| 11692 | source_object = g_async_result_get_source_object (res); |
| 11693 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11694 | g_object_unref (source_object); |
| 11695 | if (ret != NULL) |
| 11696 | return CONTROL (ret); |
| 11697 | else |
| 11698 | return NULL; |
| 11699 | } |
| 11700 | |
| 11701 | /** |
| 11702 | * control_proxy_new_sync: |
| 11703 | * @connection: A #GDBusConnection. |
| 11704 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11705 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11706 | * @object_path: An object path. |
| 11707 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11708 | * @error: Return location for error or %NULL |
| 11709 | * |
| 11710 | * 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. |
| 11711 | * |
| 11712 | * The calling thread is blocked until a reply is received. |
| 11713 | * |
| 11714 | * See control_proxy_new() for the asynchronous version of this constructor. |
| 11715 | * |
| 11716 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11717 | */ |
| 11718 | Control * |
| 11719 | control_proxy_new_sync ( |
| 11720 | GDBusConnection *connection, |
| 11721 | GDBusProxyFlags flags, |
| 11722 | const gchar *name, |
| 11723 | const gchar *object_path, |
| 11724 | GCancellable *cancellable, |
| 11725 | GError **error) |
| 11726 | { |
| 11727 | GInitable *ret; |
| 11728 | 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); |
| 11729 | if (ret != NULL) |
| 11730 | return CONTROL (ret); |
| 11731 | else |
| 11732 | return NULL; |
| 11733 | } |
| 11734 | |
| 11735 | |
| 11736 | /** |
| 11737 | * control_proxy_new_for_bus: |
| 11738 | * @bus_type: A #GBusType. |
| 11739 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11740 | * @name: A bus name (well-known or unique). |
| 11741 | * @object_path: An object path. |
| 11742 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11743 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11744 | * @user_data: User data to pass to @callback. |
| 11745 | * |
| 11746 | * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 11747 | * |
| 11748 | * 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. |
| 11749 | * You can then call control_proxy_new_for_bus_finish() to get the result of the operation. |
| 11750 | * |
| 11751 | * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 11752 | */ |
| 11753 | void |
| 11754 | control_proxy_new_for_bus ( |
| 11755 | GBusType bus_type, |
| 11756 | GDBusProxyFlags flags, |
| 11757 | const gchar *name, |
| 11758 | const gchar *object_path, |
| 11759 | GCancellable *cancellable, |
| 11760 | GAsyncReadyCallback callback, |
| 11761 | gpointer user_data) |
| 11762 | { |
| 11763 | 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); |
| 11764 | } |
| 11765 | |
| 11766 | /** |
| 11767 | * control_proxy_new_for_bus_finish: |
| 11768 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus(). |
| 11769 | * @error: Return location for error or %NULL |
| 11770 | * |
| 11771 | * Finishes an operation started with control_proxy_new_for_bus(). |
| 11772 | * |
| 11773 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11774 | */ |
| 11775 | Control * |
| 11776 | control_proxy_new_for_bus_finish ( |
| 11777 | GAsyncResult *res, |
| 11778 | GError **error) |
| 11779 | { |
| 11780 | GObject *ret; |
| 11781 | GObject *source_object; |
| 11782 | source_object = g_async_result_get_source_object (res); |
| 11783 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11784 | g_object_unref (source_object); |
| 11785 | if (ret != NULL) |
| 11786 | return CONTROL (ret); |
| 11787 | else |
| 11788 | return NULL; |
| 11789 | } |
| 11790 | |
| 11791 | /** |
| 11792 | * control_proxy_new_for_bus_sync: |
| 11793 | * @bus_type: A #GBusType. |
| 11794 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11795 | * @name: A bus name (well-known or unique). |
| 11796 | * @object_path: An object path. |
| 11797 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11798 | * @error: Return location for error or %NULL |
| 11799 | * |
| 11800 | * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 11801 | * |
| 11802 | * The calling thread is blocked until a reply is received. |
| 11803 | * |
| 11804 | * See control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 11805 | * |
| 11806 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 11807 | */ |
| 11808 | Control * |
| 11809 | control_proxy_new_for_bus_sync ( |
| 11810 | GBusType bus_type, |
| 11811 | GDBusProxyFlags flags, |
| 11812 | const gchar *name, |
| 11813 | const gchar *object_path, |
| 11814 | GCancellable *cancellable, |
| 11815 | GError **error) |
| 11816 | { |
| 11817 | GInitable *ret; |
| 11818 | 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); |
| 11819 | if (ret != NULL) |
| 11820 | return CONTROL (ret); |
| 11821 | else |
| 11822 | return NULL; |
| 11823 | } |
| 11824 | |
| 11825 | |
| 11826 | /* ------------------------------------------------------------------------ */ |
| 11827 | |
| 11828 | /** |
| 11829 | * ControlSkeleton: |
| 11830 | * |
| 11831 | * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 11832 | */ |
| 11833 | |
| 11834 | /** |
| 11835 | * ControlSkeletonClass: |
| 11836 | * @parent_class: The parent class. |
| 11837 | * |
| 11838 | * Class structure for #ControlSkeleton. |
| 11839 | */ |
| 11840 | |
| 11841 | struct _ControlSkeletonPrivate |
| 11842 | { |
| 11843 | GValue *properties; |
| 11844 | GList *changed_properties; |
| 11845 | GSource *changed_properties_idle_source; |
| 11846 | GMainContext *context; |
| 11847 | GMutex lock; |
| 11848 | }; |
| 11849 | |
| 11850 | static void |
| 11851 | _control_skeleton_handle_method_call ( |
| 11852 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11853 | const gchar *sender G_GNUC_UNUSED, |
| 11854 | const gchar *object_path G_GNUC_UNUSED, |
| 11855 | const gchar *interface_name, |
| 11856 | const gchar *method_name, |
| 11857 | GVariant *parameters, |
| 11858 | GDBusMethodInvocation *invocation, |
| 11859 | gpointer user_data) |
| 11860 | { |
| 11861 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11862 | _ExtendedGDBusMethodInfo *info; |
| 11863 | GVariantIter iter; |
| 11864 | GVariant *child; |
| 11865 | GValue *paramv; |
| 11866 | guint num_params; |
| 11867 | guint num_extra; |
| 11868 | guint n; |
| 11869 | guint signal_id; |
| 11870 | GValue return_value = G_VALUE_INIT; |
| 11871 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 11872 | g_assert (info != NULL); |
| 11873 | num_params = g_variant_n_children (parameters); |
| 11874 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 11875 | n = 0; |
| 11876 | g_value_init (¶mv[n], TYPE_CONTROL); |
| 11877 | g_value_set_object (¶mv[n++], skeleton); |
| 11878 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 11879 | g_value_set_object (¶mv[n++], invocation); |
| 11880 | if (info->pass_fdlist) |
| 11881 | { |
| 11882 | #ifdef G_OS_UNIX |
| 11883 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 11884 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 11885 | #else |
| 11886 | g_assert_not_reached (); |
| 11887 | #endif |
| 11888 | } |
| 11889 | g_variant_iter_init (&iter, parameters); |
| 11890 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11891 | { |
| 11892 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 11893 | if (arg_info->use_gvariant) |
| 11894 | { |
| 11895 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11896 | g_value_set_variant (¶mv[n], child); |
| 11897 | n++; |
| 11898 | } |
| 11899 | else |
| 11900 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11901 | g_variant_unref (child); |
| 11902 | } |
| 11903 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 11904 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 11905 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 11906 | if (!g_value_get_boolean (&return_value)) |
| 11907 | 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); |
| 11908 | g_value_unset (&return_value); |
| 11909 | for (n = 0; n < num_params + num_extra; n++) |
| 11910 | g_value_unset (¶mv[n]); |
| 11911 | g_free (paramv); |
| 11912 | } |
| 11913 | |
| 11914 | static GVariant * |
| 11915 | _control_skeleton_handle_get_property ( |
| 11916 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11917 | const gchar *sender G_GNUC_UNUSED, |
| 11918 | const gchar *object_path G_GNUC_UNUSED, |
| 11919 | const gchar *interface_name G_GNUC_UNUSED, |
| 11920 | const gchar *property_name, |
| 11921 | GError **error, |
| 11922 | gpointer user_data) |
| 11923 | { |
| 11924 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11925 | GValue value = G_VALUE_INIT; |
| 11926 | GParamSpec *pspec; |
| 11927 | _ExtendedGDBusPropertyInfo *info; |
| 11928 | GVariant *ret; |
| 11929 | ret = NULL; |
| 11930 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 11931 | g_assert (info != NULL); |
| 11932 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11933 | if (pspec == NULL) |
| 11934 | { |
| 11935 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11936 | } |
| 11937 | else |
| 11938 | { |
| 11939 | g_value_init (&value, pspec->value_type); |
| 11940 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11941 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11942 | g_value_unset (&value); |
| 11943 | } |
| 11944 | return ret; |
| 11945 | } |
| 11946 | |
| 11947 | static gboolean |
| 11948 | _control_skeleton_handle_set_property ( |
| 11949 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11950 | const gchar *sender G_GNUC_UNUSED, |
| 11951 | const gchar *object_path G_GNUC_UNUSED, |
| 11952 | const gchar *interface_name G_GNUC_UNUSED, |
| 11953 | const gchar *property_name, |
| 11954 | GVariant *variant, |
| 11955 | GError **error, |
| 11956 | gpointer user_data) |
| 11957 | { |
| 11958 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 11959 | GValue value = G_VALUE_INIT; |
| 11960 | GParamSpec *pspec; |
| 11961 | _ExtendedGDBusPropertyInfo *info; |
| 11962 | gboolean ret; |
| 11963 | ret = FALSE; |
| 11964 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 11965 | g_assert (info != NULL); |
| 11966 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11967 | if (pspec == NULL) |
| 11968 | { |
| 11969 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11970 | } |
| 11971 | else |
| 11972 | { |
| 11973 | if (info->use_gvariant) |
| 11974 | g_value_set_variant (&value, variant); |
| 11975 | else |
| 11976 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 11977 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11978 | g_value_unset (&value); |
| 11979 | ret = TRUE; |
| 11980 | } |
| 11981 | return ret; |
| 11982 | } |
| 11983 | |
| 11984 | static const GDBusInterfaceVTable _control_skeleton_vtable = |
| 11985 | { |
| 11986 | _control_skeleton_handle_method_call, |
| 11987 | _control_skeleton_handle_get_property, |
| 11988 | _control_skeleton_handle_set_property, |
| 11989 | {NULL} |
| 11990 | }; |
| 11991 | |
| 11992 | static GDBusInterfaceInfo * |
| 11993 | control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11994 | { |
| 11995 | return control_interface_info (); |
| 11996 | } |
| 11997 | |
| 11998 | static GDBusInterfaceVTable * |
| 11999 | control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 12000 | { |
| 12001 | return (GDBusInterfaceVTable *) &_control_skeleton_vtable; |
| 12002 | } |
| 12003 | |
| 12004 | static GVariant * |
| 12005 | control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 12006 | { |
| 12007 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 12008 | |
| 12009 | GVariantBuilder builder; |
| 12010 | guint n; |
| 12011 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12012 | if (_control_interface_info.parent_struct.properties == NULL) |
| 12013 | goto out; |
| 12014 | for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 12015 | { |
| 12016 | GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n]; |
| 12017 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 12018 | { |
| 12019 | GVariant *value; |
| 12020 | 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); |
| 12021 | if (value != NULL) |
| 12022 | { |
| 12023 | g_variant_take_ref (value); |
| 12024 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 12025 | g_variant_unref (value); |
| 12026 | } |
| 12027 | } |
| 12028 | } |
| 12029 | out: |
| 12030 | return g_variant_builder_end (&builder); |
| 12031 | } |
| 12032 | |
| 12033 | static gboolean _control_emit_changed (gpointer user_data); |
| 12034 | |
| 12035 | static void |
| 12036 | control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 12037 | { |
| 12038 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 12039 | gboolean emit_changed = FALSE; |
| 12040 | |
| 12041 | g_mutex_lock (&skeleton->priv->lock); |
| 12042 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12043 | { |
| 12044 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12045 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12046 | emit_changed = TRUE; |
| 12047 | } |
| 12048 | g_mutex_unlock (&skeleton->priv->lock); |
| 12049 | |
| 12050 | if (emit_changed) |
| 12051 | _control_emit_changed (skeleton); |
| 12052 | } |
| 12053 | |
| 12054 | static void |
| 12055 | _control_on_signal_heartbeat ( |
| 12056 | Control *object, |
| 12057 | const gchar *arg_bus_name) |
| 12058 | { |
| 12059 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12060 | |
| 12061 | GList *connections, *l; |
| 12062 | GVariant *signal_variant; |
| 12063 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12064 | |
| 12065 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 12066 | arg_bus_name)); |
| 12067 | for (l = connections; l != NULL; l = l->next) |
| 12068 | { |
| 12069 | GDBusConnection *connection = l->data; |
| 12070 | g_dbus_connection_emit_signal (connection, |
| 12071 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat", |
| 12072 | signal_variant, NULL); |
| 12073 | } |
| 12074 | g_variant_unref (signal_variant); |
| 12075 | g_list_free_full (connections, g_object_unref); |
| 12076 | } |
| 12077 | |
| 12078 | static void |
| 12079 | _control_on_signal_goto_system_state ( |
| 12080 | Control *object, |
| 12081 | const gchar *arg_state_name) |
| 12082 | { |
| 12083 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12084 | |
| 12085 | GList *connections, *l; |
| 12086 | GVariant *signal_variant; |
| 12087 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12088 | |
| 12089 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 12090 | arg_state_name)); |
| 12091 | for (l = connections; l != NULL; l = l->next) |
| 12092 | { |
| 12093 | GDBusConnection *connection = l->data; |
| 12094 | g_dbus_connection_emit_signal (connection, |
| 12095 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState", |
| 12096 | signal_variant, NULL); |
| 12097 | } |
| 12098 | g_variant_unref (signal_variant); |
| 12099 | g_list_free_full (connections, g_object_unref); |
| 12100 | } |
| 12101 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 12102 | static void |
| 12103 | _control_on_signal_started ( |
| 12104 | Control *object) |
| 12105 | { |
| 12106 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12107 | |
| 12108 | GList *connections, *l; |
| 12109 | GVariant *signal_variant; |
| 12110 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12111 | |
| 12112 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 12113 | for (l = connections; l != NULL; l = l->next) |
| 12114 | { |
| 12115 | GDBusConnection *connection = l->data; |
| 12116 | g_dbus_connection_emit_signal (connection, |
| 12117 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started", |
| 12118 | signal_variant, NULL); |
| 12119 | } |
| 12120 | g_variant_unref (signal_variant); |
| 12121 | g_list_free_full (connections, g_object_unref); |
| 12122 | } |
| 12123 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 12124 | static void control_skeleton_iface_init (ControlIface *iface); |
| 12125 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12126 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12127 | G_ADD_PRIVATE (ControlSkeleton) |
| 12128 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12129 | |
| 12130 | #else |
| 12131 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12132 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12133 | |
| 12134 | #endif |
| 12135 | static void |
| 12136 | control_skeleton_finalize (GObject *object) |
| 12137 | { |
| 12138 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12139 | guint n; |
| 12140 | for (n = 0; n < 2; n++) |
| 12141 | g_value_unset (&skeleton->priv->properties[n]); |
| 12142 | g_free (skeleton->priv->properties); |
| 12143 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12144 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12145 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12146 | g_main_context_unref (skeleton->priv->context); |
| 12147 | g_mutex_clear (&skeleton->priv->lock); |
| 12148 | G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object); |
| 12149 | } |
| 12150 | |
| 12151 | static void |
| 12152 | control_skeleton_get_property (GObject *object, |
| 12153 | guint prop_id, |
| 12154 | GValue *value, |
| 12155 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12156 | { |
| 12157 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12158 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12159 | g_mutex_lock (&skeleton->priv->lock); |
| 12160 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 12161 | g_mutex_unlock (&skeleton->priv->lock); |
| 12162 | } |
| 12163 | |
| 12164 | static gboolean |
| 12165 | _control_emit_changed (gpointer user_data) |
| 12166 | { |
| 12167 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12168 | GList *l; |
| 12169 | GVariantBuilder builder; |
| 12170 | GVariantBuilder invalidated_builder; |
| 12171 | guint num_changes; |
| 12172 | |
| 12173 | g_mutex_lock (&skeleton->priv->lock); |
| 12174 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12175 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 12176 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 12177 | { |
| 12178 | ChangedProperty *cp = l->data; |
| 12179 | GVariant *variant; |
| 12180 | const GValue *cur_value; |
| 12181 | |
| 12182 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 12183 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 12184 | { |
| 12185 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 12186 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 12187 | g_variant_unref (variant); |
| 12188 | num_changes++; |
| 12189 | } |
| 12190 | } |
| 12191 | if (num_changes > 0) |
| 12192 | { |
| 12193 | GList *connections, *ll; |
| 12194 | GVariant *signal_variant; |
| 12195 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control", |
| 12196 | &builder, &invalidated_builder)); |
| 12197 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12198 | for (ll = connections; ll != NULL; ll = ll->next) |
| 12199 | { |
| 12200 | GDBusConnection *connection = ll->data; |
| 12201 | |
| 12202 | g_dbus_connection_emit_signal (connection, |
| 12203 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 12204 | "org.freedesktop.DBus.Properties", |
| 12205 | "PropertiesChanged", |
| 12206 | signal_variant, |
| 12207 | NULL); |
| 12208 | } |
| 12209 | g_variant_unref (signal_variant); |
| 12210 | g_list_free_full (connections, g_object_unref); |
| 12211 | } |
| 12212 | else |
| 12213 | { |
| 12214 | g_variant_builder_clear (&builder); |
| 12215 | g_variant_builder_clear (&invalidated_builder); |
| 12216 | } |
| 12217 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12218 | skeleton->priv->changed_properties = NULL; |
| 12219 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12220 | g_mutex_unlock (&skeleton->priv->lock); |
| 12221 | return FALSE; |
| 12222 | } |
| 12223 | |
| 12224 | static void |
| 12225 | _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 12226 | { |
| 12227 | ChangedProperty *cp; |
| 12228 | GList *l; |
| 12229 | cp = NULL; |
| 12230 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 12231 | { |
| 12232 | ChangedProperty *i_cp = l->data; |
| 12233 | if (i_cp->info == info) |
| 12234 | { |
| 12235 | cp = i_cp; |
| 12236 | break; |
| 12237 | } |
| 12238 | } |
| 12239 | if (cp == NULL) |
| 12240 | { |
| 12241 | cp = g_new0 (ChangedProperty, 1); |
| 12242 | cp->prop_id = prop_id; |
| 12243 | cp->info = info; |
| 12244 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 12245 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 12246 | g_value_copy (orig_value, &cp->orig_value); |
| 12247 | } |
| 12248 | } |
| 12249 | |
| 12250 | static void |
| 12251 | control_skeleton_notify (GObject *object, |
| 12252 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12253 | { |
| 12254 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12255 | g_mutex_lock (&skeleton->priv->lock); |
| 12256 | if (skeleton->priv->changed_properties != NULL && |
| 12257 | skeleton->priv->changed_properties_idle_source == NULL) |
| 12258 | { |
| 12259 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 12260 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 12261 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 12262 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 12263 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 12264 | } |
| 12265 | g_mutex_unlock (&skeleton->priv->lock); |
| 12266 | } |
| 12267 | |
| 12268 | static void |
| 12269 | control_skeleton_set_property (GObject *object, |
| 12270 | guint prop_id, |
| 12271 | const GValue *value, |
| 12272 | GParamSpec *pspec) |
| 12273 | { |
| 12274 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12275 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12276 | g_mutex_lock (&skeleton->priv->lock); |
| 12277 | g_object_freeze_notify (object); |
| 12278 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 12279 | { |
| 12280 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 12281 | _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 12282 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 12283 | g_object_notify_by_pspec (object, pspec); |
| 12284 | } |
| 12285 | g_mutex_unlock (&skeleton->priv->lock); |
| 12286 | g_object_thaw_notify (object); |
| 12287 | } |
| 12288 | |
| 12289 | static void |
| 12290 | control_skeleton_init (ControlSkeleton *skeleton) |
| 12291 | { |
| 12292 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12293 | skeleton->priv = control_skeleton_get_instance_private (skeleton); |
| 12294 | #else |
| 12295 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate); |
| 12296 | #endif |
| 12297 | |
| 12298 | g_mutex_init (&skeleton->priv->lock); |
| 12299 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 12300 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 12301 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 12302 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 12303 | } |
| 12304 | |
| 12305 | static gint |
| 12306 | control_skeleton_get_poll_interval (Control *object) |
| 12307 | { |
| 12308 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12309 | gint value; |
| 12310 | g_mutex_lock (&skeleton->priv->lock); |
| 12311 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 12312 | g_mutex_unlock (&skeleton->priv->lock); |
| 12313 | return value; |
| 12314 | } |
| 12315 | |
| 12316 | static gint |
| 12317 | control_skeleton_get_heatbeat (Control *object) |
| 12318 | { |
| 12319 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12320 | gint value; |
| 12321 | g_mutex_lock (&skeleton->priv->lock); |
| 12322 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 12323 | g_mutex_unlock (&skeleton->priv->lock); |
| 12324 | return value; |
| 12325 | } |
| 12326 | |
| 12327 | static void |
| 12328 | control_skeleton_class_init (ControlSkeletonClass *klass) |
| 12329 | { |
| 12330 | GObjectClass *gobject_class; |
| 12331 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 12332 | |
| 12333 | gobject_class = G_OBJECT_CLASS (klass); |
| 12334 | gobject_class->finalize = control_skeleton_finalize; |
| 12335 | gobject_class->get_property = control_skeleton_get_property; |
| 12336 | gobject_class->set_property = control_skeleton_set_property; |
| 12337 | gobject_class->notify = control_skeleton_notify; |
| 12338 | |
| 12339 | |
| 12340 | control_override_properties (gobject_class, 1); |
| 12341 | |
| 12342 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 12343 | skeleton_class->get_info = control_skeleton_dbus_interface_get_info; |
| 12344 | skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties; |
| 12345 | skeleton_class->flush = control_skeleton_dbus_interface_flush; |
| 12346 | skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable; |
| 12347 | |
| 12348 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12349 | g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate)); |
| 12350 | #endif |
| 12351 | } |
| 12352 | |
| 12353 | static void |
| 12354 | control_skeleton_iface_init (ControlIface *iface) |
| 12355 | { |
| 12356 | iface->heartbeat = _control_on_signal_heartbeat; |
| 12357 | iface->goto_system_state = _control_on_signal_goto_system_state; |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 12358 | iface->started = _control_on_signal_started; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 12359 | iface->get_poll_interval = control_skeleton_get_poll_interval; |
| 12360 | iface->get_heatbeat = control_skeleton_get_heatbeat; |
| 12361 | } |
| 12362 | |
| 12363 | /** |
| 12364 | * control_skeleton_new: |
| 12365 | * |
| 12366 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 12367 | * |
| 12368 | * Returns: (transfer full) (type ControlSkeleton): The skeleton object. |
| 12369 | */ |
| 12370 | Control * |
| 12371 | control_skeleton_new (void) |
| 12372 | { |
| 12373 | return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL)); |
| 12374 | } |
| 12375 | |
| 12376 | /* ------------------------------------------------------------------------ |
| 12377 | * Code for interface org.openbmc.control.Bmc |
| 12378 | * ------------------------------------------------------------------------ |
| 12379 | */ |
| 12380 | |
| 12381 | /** |
| 12382 | * SECTION:ControlBmc |
| 12383 | * @title: ControlBmc |
| 12384 | * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface |
| 12385 | * |
| 12386 | * 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. |
| 12387 | */ |
| 12388 | |
| 12389 | /* ---- Introspection data for org.openbmc.control.Bmc ---- */ |
| 12390 | |
| 12391 | static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder = |
| 12392 | { |
| 12393 | { |
| 12394 | -1, |
| 12395 | (gchar *) "place_holder", |
| 12396 | NULL, |
| 12397 | NULL, |
| 12398 | NULL |
| 12399 | }, |
| 12400 | "handle-place-holder", |
| 12401 | FALSE |
| 12402 | }; |
| 12403 | |
| 12404 | static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] = |
| 12405 | { |
| 12406 | &_control_bmc_method_info_place_holder, |
| 12407 | NULL |
| 12408 | }; |
| 12409 | |
| 12410 | static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info = |
| 12411 | { |
| 12412 | { |
| 12413 | -1, |
| 12414 | (gchar *) "org.openbmc.control.Bmc", |
| 12415 | (GDBusMethodInfo **) &_control_bmc_method_info_pointers, |
| 12416 | NULL, |
| 12417 | NULL, |
| 12418 | NULL |
| 12419 | }, |
| 12420 | "control-bmc", |
| 12421 | }; |
| 12422 | |
| 12423 | |
| 12424 | /** |
| 12425 | * control_bmc_interface_info: |
| 12426 | * |
| 12427 | * 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. |
| 12428 | * |
| 12429 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 12430 | */ |
| 12431 | GDBusInterfaceInfo * |
| 12432 | control_bmc_interface_info (void) |
| 12433 | { |
| 12434 | return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct; |
| 12435 | } |
| 12436 | |
| 12437 | /** |
| 12438 | * control_bmc_override_properties: |
| 12439 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 12440 | * @property_id_begin: The property id to assign to the first overridden property. |
| 12441 | * |
| 12442 | * Overrides all #GObject properties in the #ControlBmc interface for a concrete class. |
| 12443 | * The properties are overridden in the order they are defined. |
| 12444 | * |
| 12445 | * Returns: The last property id. |
| 12446 | */ |
| 12447 | guint |
| 12448 | control_bmc_override_properties (GObjectClass *klass, guint property_id_begin) |
| 12449 | { |
| 12450 | return property_id_begin - 1; |
| 12451 | } |
| 12452 | |
| 12453 | |
| 12454 | |
| 12455 | /** |
| 12456 | * ControlBmc: |
| 12457 | * |
| 12458 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 12459 | */ |
| 12460 | |
| 12461 | /** |
| 12462 | * ControlBmcIface: |
| 12463 | * @parent_iface: The parent interface. |
| 12464 | * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal. |
| 12465 | * |
| 12466 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 12467 | */ |
| 12468 | |
| 12469 | typedef ControlBmcIface ControlBmcInterface; |
| 12470 | G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT); |
| 12471 | |
| 12472 | static void |
| 12473 | control_bmc_default_init (ControlBmcIface *iface) |
| 12474 | { |
| 12475 | /* GObject signals for incoming D-Bus method calls: */ |
| 12476 | /** |
| 12477 | * ControlBmc::handle-place-holder: |
| 12478 | * @object: A #ControlBmc. |
| 12479 | * @invocation: A #GDBusMethodInvocation. |
| 12480 | * |
| 12481 | * 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. |
| 12482 | * |
| 12483 | * 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. |
| 12484 | * |
| 12485 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 12486 | */ |
| 12487 | g_signal_new ("handle-place-holder", |
| 12488 | G_TYPE_FROM_INTERFACE (iface), |
| 12489 | G_SIGNAL_RUN_LAST, |
| 12490 | G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder), |
| 12491 | g_signal_accumulator_true_handled, |
| 12492 | NULL, |
| 12493 | g_cclosure_marshal_generic, |
| 12494 | G_TYPE_BOOLEAN, |
| 12495 | 1, |
| 12496 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 12497 | |
| 12498 | } |
| 12499 | |
| 12500 | /** |
| 12501 | * control_bmc_call_place_holder: |
| 12502 | * @proxy: A #ControlBmcProxy. |
| 12503 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12504 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 12505 | * @user_data: User data to pass to @callback. |
| 12506 | * |
| 12507 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. |
| 12508 | * 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. |
| 12509 | * You can then call control_bmc_call_place_holder_finish() to get the result of the operation. |
| 12510 | * |
| 12511 | * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method. |
| 12512 | */ |
| 12513 | void |
| 12514 | control_bmc_call_place_holder ( |
| 12515 | ControlBmc *proxy, |
| 12516 | GCancellable *cancellable, |
| 12517 | GAsyncReadyCallback callback, |
| 12518 | gpointer user_data) |
| 12519 | { |
| 12520 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 12521 | "place_holder", |
| 12522 | g_variant_new ("()"), |
| 12523 | G_DBUS_CALL_FLAGS_NONE, |
| 12524 | -1, |
| 12525 | cancellable, |
| 12526 | callback, |
| 12527 | user_data); |
| 12528 | } |
| 12529 | |
| 12530 | /** |
| 12531 | * control_bmc_call_place_holder_finish: |
| 12532 | * @proxy: A #ControlBmcProxy. |
| 12533 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder(). |
| 12534 | * @error: Return location for error or %NULL. |
| 12535 | * |
| 12536 | * Finishes an operation started with control_bmc_call_place_holder(). |
| 12537 | * |
| 12538 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12539 | */ |
| 12540 | gboolean |
| 12541 | control_bmc_call_place_holder_finish ( |
| 12542 | ControlBmc *proxy, |
| 12543 | GAsyncResult *res, |
| 12544 | GError **error) |
| 12545 | { |
| 12546 | GVariant *_ret; |
| 12547 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 12548 | if (_ret == NULL) |
| 12549 | goto _out; |
| 12550 | g_variant_get (_ret, |
| 12551 | "()"); |
| 12552 | g_variant_unref (_ret); |
| 12553 | _out: |
| 12554 | return _ret != NULL; |
| 12555 | } |
| 12556 | |
| 12557 | /** |
| 12558 | * control_bmc_call_place_holder_sync: |
| 12559 | * @proxy: A #ControlBmcProxy. |
| 12560 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12561 | * @error: Return location for error or %NULL. |
| 12562 | * |
| 12563 | * 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. |
| 12564 | * |
| 12565 | * See control_bmc_call_place_holder() for the asynchronous version of this method. |
| 12566 | * |
| 12567 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12568 | */ |
| 12569 | gboolean |
| 12570 | control_bmc_call_place_holder_sync ( |
| 12571 | ControlBmc *proxy, |
| 12572 | GCancellable *cancellable, |
| 12573 | GError **error) |
| 12574 | { |
| 12575 | GVariant *_ret; |
| 12576 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 12577 | "place_holder", |
| 12578 | g_variant_new ("()"), |
| 12579 | G_DBUS_CALL_FLAGS_NONE, |
| 12580 | -1, |
| 12581 | cancellable, |
| 12582 | error); |
| 12583 | if (_ret == NULL) |
| 12584 | goto _out; |
| 12585 | g_variant_get (_ret, |
| 12586 | "()"); |
| 12587 | g_variant_unref (_ret); |
| 12588 | _out: |
| 12589 | return _ret != NULL; |
| 12590 | } |
| 12591 | |
| 12592 | /** |
| 12593 | * control_bmc_complete_place_holder: |
| 12594 | * @object: A #ControlBmc. |
| 12595 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 12596 | * |
| 12597 | * 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. |
| 12598 | * |
| 12599 | * This method will free @invocation, you cannot use it afterwards. |
| 12600 | */ |
| 12601 | void |
| 12602 | control_bmc_complete_place_holder ( |
| 12603 | ControlBmc *object, |
| 12604 | GDBusMethodInvocation *invocation) |
| 12605 | { |
| 12606 | g_dbus_method_invocation_return_value (invocation, |
| 12607 | g_variant_new ("()")); |
| 12608 | } |
| 12609 | |
| 12610 | /* ------------------------------------------------------------------------ */ |
| 12611 | |
| 12612 | /** |
| 12613 | * ControlBmcProxy: |
| 12614 | * |
| 12615 | * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API. |
| 12616 | */ |
| 12617 | |
| 12618 | /** |
| 12619 | * ControlBmcProxyClass: |
| 12620 | * @parent_class: The parent class. |
| 12621 | * |
| 12622 | * Class structure for #ControlBmcProxy. |
| 12623 | */ |
| 12624 | |
| 12625 | struct _ControlBmcProxyPrivate |
| 12626 | { |
| 12627 | GData *qdata; |
| 12628 | }; |
| 12629 | |
| 12630 | static void control_bmc_proxy_iface_init (ControlBmcIface *iface); |
| 12631 | |
| 12632 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12633 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 12634 | G_ADD_PRIVATE (ControlBmcProxy) |
| 12635 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 12636 | |
| 12637 | #else |
| 12638 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 12639 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 12640 | |
| 12641 | #endif |
| 12642 | static void |
| 12643 | control_bmc_proxy_finalize (GObject *object) |
| 12644 | { |
| 12645 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object); |
| 12646 | g_datalist_clear (&proxy->priv->qdata); |
| 12647 | G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object); |
| 12648 | } |
| 12649 | |
| 12650 | static void |
| 12651 | control_bmc_proxy_get_property (GObject *object, |
| 12652 | guint prop_id, |
| 12653 | GValue *value, |
| 12654 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12655 | { |
| 12656 | } |
| 12657 | |
| 12658 | static void |
| 12659 | control_bmc_proxy_set_property (GObject *object, |
| 12660 | guint prop_id, |
| 12661 | const GValue *value, |
| 12662 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12663 | { |
| 12664 | } |
| 12665 | |
| 12666 | static void |
| 12667 | control_bmc_proxy_g_signal (GDBusProxy *proxy, |
| 12668 | const gchar *sender_name G_GNUC_UNUSED, |
| 12669 | const gchar *signal_name, |
| 12670 | GVariant *parameters) |
| 12671 | { |
| 12672 | _ExtendedGDBusSignalInfo *info; |
| 12673 | GVariantIter iter; |
| 12674 | GVariant *child; |
| 12675 | GValue *paramv; |
| 12676 | guint num_params; |
| 12677 | guint n; |
| 12678 | guint signal_id; |
| 12679 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name); |
| 12680 | if (info == NULL) |
| 12681 | return; |
| 12682 | num_params = g_variant_n_children (parameters); |
| 12683 | paramv = g_new0 (GValue, num_params + 1); |
| 12684 | g_value_init (¶mv[0], TYPE_CONTROL_BMC); |
| 12685 | g_value_set_object (¶mv[0], proxy); |
| 12686 | g_variant_iter_init (&iter, parameters); |
| 12687 | n = 1; |
| 12688 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12689 | { |
| 12690 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 12691 | if (arg_info->use_gvariant) |
| 12692 | { |
| 12693 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12694 | g_value_set_variant (¶mv[n], child); |
| 12695 | n++; |
| 12696 | } |
| 12697 | else |
| 12698 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12699 | g_variant_unref (child); |
| 12700 | } |
| 12701 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 12702 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 12703 | for (n = 0; n < num_params + 1; n++) |
| 12704 | g_value_unset (¶mv[n]); |
| 12705 | g_free (paramv); |
| 12706 | } |
| 12707 | |
| 12708 | static void |
| 12709 | control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 12710 | GVariant *changed_properties, |
| 12711 | const gchar *const *invalidated_properties) |
| 12712 | { |
| 12713 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy); |
| 12714 | guint n; |
| 12715 | const gchar *key; |
| 12716 | GVariantIter *iter; |
| 12717 | _ExtendedGDBusPropertyInfo *info; |
| 12718 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 12719 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 12720 | { |
| 12721 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key); |
| 12722 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 12723 | if (info != NULL) |
| 12724 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12725 | } |
| 12726 | g_variant_iter_free (iter); |
| 12727 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 12728 | { |
| 12729 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]); |
| 12730 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 12731 | if (info != NULL) |
| 12732 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12733 | } |
| 12734 | } |
| 12735 | |
| 12736 | static void |
| 12737 | control_bmc_proxy_init (ControlBmcProxy *proxy) |
| 12738 | { |
| 12739 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12740 | proxy->priv = control_bmc_proxy_get_instance_private (proxy); |
| 12741 | #else |
| 12742 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate); |
| 12743 | #endif |
| 12744 | |
| 12745 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ()); |
| 12746 | } |
| 12747 | |
| 12748 | static void |
| 12749 | control_bmc_proxy_class_init (ControlBmcProxyClass *klass) |
| 12750 | { |
| 12751 | GObjectClass *gobject_class; |
| 12752 | GDBusProxyClass *proxy_class; |
| 12753 | |
| 12754 | gobject_class = G_OBJECT_CLASS (klass); |
| 12755 | gobject_class->finalize = control_bmc_proxy_finalize; |
| 12756 | gobject_class->get_property = control_bmc_proxy_get_property; |
| 12757 | gobject_class->set_property = control_bmc_proxy_set_property; |
| 12758 | |
| 12759 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 12760 | proxy_class->g_signal = control_bmc_proxy_g_signal; |
| 12761 | proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed; |
| 12762 | |
| 12763 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12764 | g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate)); |
| 12765 | #endif |
| 12766 | } |
| 12767 | |
| 12768 | static void |
| 12769 | control_bmc_proxy_iface_init (ControlBmcIface *iface) |
| 12770 | { |
| 12771 | } |
| 12772 | |
| 12773 | /** |
| 12774 | * control_bmc_proxy_new: |
| 12775 | * @connection: A #GDBusConnection. |
| 12776 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12777 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12778 | * @object_path: An object path. |
| 12779 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12780 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12781 | * @user_data: User data to pass to @callback. |
| 12782 | * |
| 12783 | * 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. |
| 12784 | * |
| 12785 | * 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. |
| 12786 | * You can then call control_bmc_proxy_new_finish() to get the result of the operation. |
| 12787 | * |
| 12788 | * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 12789 | */ |
| 12790 | void |
| 12791 | control_bmc_proxy_new ( |
| 12792 | GDBusConnection *connection, |
| 12793 | GDBusProxyFlags flags, |
| 12794 | const gchar *name, |
| 12795 | const gchar *object_path, |
| 12796 | GCancellable *cancellable, |
| 12797 | GAsyncReadyCallback callback, |
| 12798 | gpointer user_data) |
| 12799 | { |
| 12800 | 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); |
| 12801 | } |
| 12802 | |
| 12803 | /** |
| 12804 | * control_bmc_proxy_new_finish: |
| 12805 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new(). |
| 12806 | * @error: Return location for error or %NULL |
| 12807 | * |
| 12808 | * Finishes an operation started with control_bmc_proxy_new(). |
| 12809 | * |
| 12810 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12811 | */ |
| 12812 | ControlBmc * |
| 12813 | control_bmc_proxy_new_finish ( |
| 12814 | GAsyncResult *res, |
| 12815 | GError **error) |
| 12816 | { |
| 12817 | GObject *ret; |
| 12818 | GObject *source_object; |
| 12819 | source_object = g_async_result_get_source_object (res); |
| 12820 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12821 | g_object_unref (source_object); |
| 12822 | if (ret != NULL) |
| 12823 | return CONTROL_BMC (ret); |
| 12824 | else |
| 12825 | return NULL; |
| 12826 | } |
| 12827 | |
| 12828 | /** |
| 12829 | * control_bmc_proxy_new_sync: |
| 12830 | * @connection: A #GDBusConnection. |
| 12831 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12832 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12833 | * @object_path: An object path. |
| 12834 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12835 | * @error: Return location for error or %NULL |
| 12836 | * |
| 12837 | * 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. |
| 12838 | * |
| 12839 | * The calling thread is blocked until a reply is received. |
| 12840 | * |
| 12841 | * See control_bmc_proxy_new() for the asynchronous version of this constructor. |
| 12842 | * |
| 12843 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12844 | */ |
| 12845 | ControlBmc * |
| 12846 | control_bmc_proxy_new_sync ( |
| 12847 | GDBusConnection *connection, |
| 12848 | GDBusProxyFlags flags, |
| 12849 | const gchar *name, |
| 12850 | const gchar *object_path, |
| 12851 | GCancellable *cancellable, |
| 12852 | GError **error) |
| 12853 | { |
| 12854 | GInitable *ret; |
| 12855 | 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); |
| 12856 | if (ret != NULL) |
| 12857 | return CONTROL_BMC (ret); |
| 12858 | else |
| 12859 | return NULL; |
| 12860 | } |
| 12861 | |
| 12862 | |
| 12863 | /** |
| 12864 | * control_bmc_proxy_new_for_bus: |
| 12865 | * @bus_type: A #GBusType. |
| 12866 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12867 | * @name: A bus name (well-known or unique). |
| 12868 | * @object_path: An object path. |
| 12869 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12870 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12871 | * @user_data: User data to pass to @callback. |
| 12872 | * |
| 12873 | * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 12874 | * |
| 12875 | * 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. |
| 12876 | * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation. |
| 12877 | * |
| 12878 | * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 12879 | */ |
| 12880 | void |
| 12881 | control_bmc_proxy_new_for_bus ( |
| 12882 | GBusType bus_type, |
| 12883 | GDBusProxyFlags flags, |
| 12884 | const gchar *name, |
| 12885 | const gchar *object_path, |
| 12886 | GCancellable *cancellable, |
| 12887 | GAsyncReadyCallback callback, |
| 12888 | gpointer user_data) |
| 12889 | { |
| 12890 | 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); |
| 12891 | } |
| 12892 | |
| 12893 | /** |
| 12894 | * control_bmc_proxy_new_for_bus_finish: |
| 12895 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus(). |
| 12896 | * @error: Return location for error or %NULL |
| 12897 | * |
| 12898 | * Finishes an operation started with control_bmc_proxy_new_for_bus(). |
| 12899 | * |
| 12900 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12901 | */ |
| 12902 | ControlBmc * |
| 12903 | control_bmc_proxy_new_for_bus_finish ( |
| 12904 | GAsyncResult *res, |
| 12905 | GError **error) |
| 12906 | { |
| 12907 | GObject *ret; |
| 12908 | GObject *source_object; |
| 12909 | source_object = g_async_result_get_source_object (res); |
| 12910 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12911 | g_object_unref (source_object); |
| 12912 | if (ret != NULL) |
| 12913 | return CONTROL_BMC (ret); |
| 12914 | else |
| 12915 | return NULL; |
| 12916 | } |
| 12917 | |
| 12918 | /** |
| 12919 | * control_bmc_proxy_new_for_bus_sync: |
| 12920 | * @bus_type: A #GBusType. |
| 12921 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12922 | * @name: A bus name (well-known or unique). |
| 12923 | * @object_path: An object path. |
| 12924 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12925 | * @error: Return location for error or %NULL |
| 12926 | * |
| 12927 | * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 12928 | * |
| 12929 | * The calling thread is blocked until a reply is received. |
| 12930 | * |
| 12931 | * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 12932 | * |
| 12933 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 12934 | */ |
| 12935 | ControlBmc * |
| 12936 | control_bmc_proxy_new_for_bus_sync ( |
| 12937 | GBusType bus_type, |
| 12938 | GDBusProxyFlags flags, |
| 12939 | const gchar *name, |
| 12940 | const gchar *object_path, |
| 12941 | GCancellable *cancellable, |
| 12942 | GError **error) |
| 12943 | { |
| 12944 | GInitable *ret; |
| 12945 | 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); |
| 12946 | if (ret != NULL) |
| 12947 | return CONTROL_BMC (ret); |
| 12948 | else |
| 12949 | return NULL; |
| 12950 | } |
| 12951 | |
| 12952 | |
| 12953 | /* ------------------------------------------------------------------------ */ |
| 12954 | |
| 12955 | /** |
| 12956 | * ControlBmcSkeleton: |
| 12957 | * |
| 12958 | * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API. |
| 12959 | */ |
| 12960 | |
| 12961 | /** |
| 12962 | * ControlBmcSkeletonClass: |
| 12963 | * @parent_class: The parent class. |
| 12964 | * |
| 12965 | * Class structure for #ControlBmcSkeleton. |
| 12966 | */ |
| 12967 | |
| 12968 | struct _ControlBmcSkeletonPrivate |
| 12969 | { |
| 12970 | GValue *properties; |
| 12971 | GList *changed_properties; |
| 12972 | GSource *changed_properties_idle_source; |
| 12973 | GMainContext *context; |
| 12974 | GMutex lock; |
| 12975 | }; |
| 12976 | |
| 12977 | static void |
| 12978 | _control_bmc_skeleton_handle_method_call ( |
| 12979 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12980 | const gchar *sender G_GNUC_UNUSED, |
| 12981 | const gchar *object_path G_GNUC_UNUSED, |
| 12982 | const gchar *interface_name, |
| 12983 | const gchar *method_name, |
| 12984 | GVariant *parameters, |
| 12985 | GDBusMethodInvocation *invocation, |
| 12986 | gpointer user_data) |
| 12987 | { |
| 12988 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 12989 | _ExtendedGDBusMethodInfo *info; |
| 12990 | GVariantIter iter; |
| 12991 | GVariant *child; |
| 12992 | GValue *paramv; |
| 12993 | guint num_params; |
| 12994 | guint num_extra; |
| 12995 | guint n; |
| 12996 | guint signal_id; |
| 12997 | GValue return_value = G_VALUE_INIT; |
| 12998 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 12999 | g_assert (info != NULL); |
| 13000 | num_params = g_variant_n_children (parameters); |
| 13001 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 13002 | n = 0; |
| 13003 | g_value_init (¶mv[n], TYPE_CONTROL_BMC); |
| 13004 | g_value_set_object (¶mv[n++], skeleton); |
| 13005 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 13006 | g_value_set_object (¶mv[n++], invocation); |
| 13007 | if (info->pass_fdlist) |
| 13008 | { |
| 13009 | #ifdef G_OS_UNIX |
| 13010 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 13011 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 13012 | #else |
| 13013 | g_assert_not_reached (); |
| 13014 | #endif |
| 13015 | } |
| 13016 | g_variant_iter_init (&iter, parameters); |
| 13017 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13018 | { |
| 13019 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 13020 | if (arg_info->use_gvariant) |
| 13021 | { |
| 13022 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13023 | g_value_set_variant (¶mv[n], child); |
| 13024 | n++; |
| 13025 | } |
| 13026 | else |
| 13027 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13028 | g_variant_unref (child); |
| 13029 | } |
| 13030 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 13031 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 13032 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 13033 | if (!g_value_get_boolean (&return_value)) |
| 13034 | 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); |
| 13035 | g_value_unset (&return_value); |
| 13036 | for (n = 0; n < num_params + num_extra; n++) |
| 13037 | g_value_unset (¶mv[n]); |
| 13038 | g_free (paramv); |
| 13039 | } |
| 13040 | |
| 13041 | static GVariant * |
| 13042 | _control_bmc_skeleton_handle_get_property ( |
| 13043 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13044 | const gchar *sender G_GNUC_UNUSED, |
| 13045 | const gchar *object_path G_GNUC_UNUSED, |
| 13046 | const gchar *interface_name G_GNUC_UNUSED, |
| 13047 | const gchar *property_name, |
| 13048 | GError **error, |
| 13049 | gpointer user_data) |
| 13050 | { |
| 13051 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 13052 | GValue value = G_VALUE_INIT; |
| 13053 | GParamSpec *pspec; |
| 13054 | _ExtendedGDBusPropertyInfo *info; |
| 13055 | GVariant *ret; |
| 13056 | ret = NULL; |
| 13057 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 13058 | g_assert (info != NULL); |
| 13059 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13060 | if (pspec == NULL) |
| 13061 | { |
| 13062 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 13063 | } |
| 13064 | else |
| 13065 | { |
| 13066 | g_value_init (&value, pspec->value_type); |
| 13067 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 13068 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 13069 | g_value_unset (&value); |
| 13070 | } |
| 13071 | return ret; |
| 13072 | } |
| 13073 | |
| 13074 | static gboolean |
| 13075 | _control_bmc_skeleton_handle_set_property ( |
| 13076 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13077 | const gchar *sender G_GNUC_UNUSED, |
| 13078 | const gchar *object_path G_GNUC_UNUSED, |
| 13079 | const gchar *interface_name G_GNUC_UNUSED, |
| 13080 | const gchar *property_name, |
| 13081 | GVariant *variant, |
| 13082 | GError **error, |
| 13083 | gpointer user_data) |
| 13084 | { |
| 13085 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 13086 | GValue value = G_VALUE_INIT; |
| 13087 | GParamSpec *pspec; |
| 13088 | _ExtendedGDBusPropertyInfo *info; |
| 13089 | gboolean ret; |
| 13090 | ret = FALSE; |
| 13091 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 13092 | g_assert (info != NULL); |
| 13093 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13094 | if (pspec == NULL) |
| 13095 | { |
| 13096 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 13097 | } |
| 13098 | else |
| 13099 | { |
| 13100 | if (info->use_gvariant) |
| 13101 | g_value_set_variant (&value, variant); |
| 13102 | else |
| 13103 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 13104 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 13105 | g_value_unset (&value); |
| 13106 | ret = TRUE; |
| 13107 | } |
| 13108 | return ret; |
| 13109 | } |
| 13110 | |
| 13111 | static const GDBusInterfaceVTable _control_bmc_skeleton_vtable = |
| 13112 | { |
| 13113 | _control_bmc_skeleton_handle_method_call, |
| 13114 | _control_bmc_skeleton_handle_get_property, |
| 13115 | _control_bmc_skeleton_handle_set_property, |
| 13116 | {NULL} |
| 13117 | }; |
| 13118 | |
| 13119 | static GDBusInterfaceInfo * |
| 13120 | control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13121 | { |
| 13122 | return control_bmc_interface_info (); |
| 13123 | } |
| 13124 | |
| 13125 | static GDBusInterfaceVTable * |
| 13126 | control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13127 | { |
| 13128 | return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable; |
| 13129 | } |
| 13130 | |
| 13131 | static GVariant * |
| 13132 | control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 13133 | { |
| 13134 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton); |
| 13135 | |
| 13136 | GVariantBuilder builder; |
| 13137 | guint n; |
| 13138 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 13139 | if (_control_bmc_interface_info.parent_struct.properties == NULL) |
| 13140 | goto out; |
| 13141 | for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++) |
| 13142 | { |
| 13143 | GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n]; |
| 13144 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 13145 | { |
| 13146 | GVariant *value; |
| 13147 | 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); |
| 13148 | if (value != NULL) |
| 13149 | { |
| 13150 | g_variant_take_ref (value); |
| 13151 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 13152 | g_variant_unref (value); |
| 13153 | } |
| 13154 | } |
| 13155 | } |
| 13156 | out: |
| 13157 | return g_variant_builder_end (&builder); |
| 13158 | } |
| 13159 | |
| 13160 | static void |
| 13161 | control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 13162 | { |
| 13163 | } |
| 13164 | |
| 13165 | static void control_bmc_skeleton_iface_init (ControlBmcIface *iface); |
| 13166 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13167 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13168 | G_ADD_PRIVATE (ControlBmcSkeleton) |
| 13169 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13170 | |
| 13171 | #else |
| 13172 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13173 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13174 | |
| 13175 | #endif |
| 13176 | static void |
| 13177 | control_bmc_skeleton_finalize (GObject *object) |
| 13178 | { |
| 13179 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object); |
| 13180 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 13181 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 13182 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 13183 | g_main_context_unref (skeleton->priv->context); |
| 13184 | g_mutex_clear (&skeleton->priv->lock); |
| 13185 | G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object); |
| 13186 | } |
| 13187 | |
| 13188 | static void |
| 13189 | control_bmc_skeleton_init (ControlBmcSkeleton *skeleton) |
| 13190 | { |
| 13191 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13192 | skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton); |
| 13193 | #else |
| 13194 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate); |
| 13195 | #endif |
| 13196 | |
| 13197 | g_mutex_init (&skeleton->priv->lock); |
| 13198 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 13199 | } |
| 13200 | |
| 13201 | static void |
| 13202 | control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass) |
| 13203 | { |
| 13204 | GObjectClass *gobject_class; |
| 13205 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 13206 | |
| 13207 | gobject_class = G_OBJECT_CLASS (klass); |
| 13208 | gobject_class->finalize = control_bmc_skeleton_finalize; |
| 13209 | |
| 13210 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 13211 | skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info; |
| 13212 | skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties; |
| 13213 | skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush; |
| 13214 | skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable; |
| 13215 | |
| 13216 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13217 | g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate)); |
| 13218 | #endif |
| 13219 | } |
| 13220 | |
| 13221 | static void |
| 13222 | control_bmc_skeleton_iface_init (ControlBmcIface *iface) |
| 13223 | { |
| 13224 | } |
| 13225 | |
| 13226 | /** |
| 13227 | * control_bmc_skeleton_new: |
| 13228 | * |
| 13229 | * 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>. |
| 13230 | * |
| 13231 | * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object. |
| 13232 | */ |
| 13233 | ControlBmc * |
| 13234 | control_bmc_skeleton_new (void) |
| 13235 | { |
| 13236 | return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL)); |
| 13237 | } |
| 13238 | |
| 13239 | /* ------------------------------------------------------------------------ |
| 13240 | * Code for interface org.openbmc.control.Host |
| 13241 | * ------------------------------------------------------------------------ |
| 13242 | */ |
| 13243 | |
| 13244 | /** |
| 13245 | * SECTION:ControlHost |
| 13246 | * @title: ControlHost |
| 13247 | * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface |
| 13248 | * |
| 13249 | * 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. |
| 13250 | */ |
| 13251 | |
| 13252 | /* ---- Introspection data for org.openbmc.control.Host ---- */ |
| 13253 | |
| 13254 | static const _ExtendedGDBusMethodInfo _control_host_method_info_boot = |
| 13255 | { |
| 13256 | { |
| 13257 | -1, |
| 13258 | (gchar *) "boot", |
| 13259 | NULL, |
| 13260 | NULL, |
| 13261 | NULL |
| 13262 | }, |
| 13263 | "handle-boot", |
| 13264 | FALSE |
| 13265 | }; |
| 13266 | |
| 13267 | static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown = |
| 13268 | { |
| 13269 | { |
| 13270 | -1, |
| 13271 | (gchar *) "shutdown", |
| 13272 | NULL, |
| 13273 | NULL, |
| 13274 | NULL |
| 13275 | }, |
| 13276 | "handle-shutdown", |
| 13277 | FALSE |
| 13278 | }; |
| 13279 | |
| 13280 | static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot = |
| 13281 | { |
| 13282 | { |
| 13283 | -1, |
| 13284 | (gchar *) "reboot", |
| 13285 | NULL, |
| 13286 | NULL, |
| 13287 | NULL |
| 13288 | }, |
| 13289 | "handle-reboot", |
| 13290 | FALSE |
| 13291 | }; |
| 13292 | |
| 13293 | static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] = |
| 13294 | { |
| 13295 | &_control_host_method_info_boot, |
| 13296 | &_control_host_method_info_shutdown, |
| 13297 | &_control_host_method_info_reboot, |
| 13298 | NULL |
| 13299 | }; |
| 13300 | |
| 13301 | static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted = |
| 13302 | { |
| 13303 | { |
| 13304 | -1, |
| 13305 | (gchar *) "Booted", |
| 13306 | NULL, |
| 13307 | NULL |
| 13308 | }, |
| 13309 | "booted" |
| 13310 | }; |
| 13311 | |
| 13312 | static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] = |
| 13313 | { |
| 13314 | &_control_host_signal_info_booted, |
| 13315 | NULL |
| 13316 | }; |
| 13317 | |
| 13318 | static const _ExtendedGDBusInterfaceInfo _control_host_interface_info = |
| 13319 | { |
| 13320 | { |
| 13321 | -1, |
| 13322 | (gchar *) "org.openbmc.control.Host", |
| 13323 | (GDBusMethodInfo **) &_control_host_method_info_pointers, |
| 13324 | (GDBusSignalInfo **) &_control_host_signal_info_pointers, |
| 13325 | NULL, |
| 13326 | NULL |
| 13327 | }, |
| 13328 | "control-host", |
| 13329 | }; |
| 13330 | |
| 13331 | |
| 13332 | /** |
| 13333 | * control_host_interface_info: |
| 13334 | * |
| 13335 | * 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. |
| 13336 | * |
| 13337 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 13338 | */ |
| 13339 | GDBusInterfaceInfo * |
| 13340 | control_host_interface_info (void) |
| 13341 | { |
| 13342 | return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct; |
| 13343 | } |
| 13344 | |
| 13345 | /** |
| 13346 | * control_host_override_properties: |
| 13347 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 13348 | * @property_id_begin: The property id to assign to the first overridden property. |
| 13349 | * |
| 13350 | * Overrides all #GObject properties in the #ControlHost interface for a concrete class. |
| 13351 | * The properties are overridden in the order they are defined. |
| 13352 | * |
| 13353 | * Returns: The last property id. |
| 13354 | */ |
| 13355 | guint |
| 13356 | control_host_override_properties (GObjectClass *klass, guint property_id_begin) |
| 13357 | { |
| 13358 | return property_id_begin - 1; |
| 13359 | } |
| 13360 | |
| 13361 | |
| 13362 | |
| 13363 | /** |
| 13364 | * ControlHost: |
| 13365 | * |
| 13366 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 13367 | */ |
| 13368 | |
| 13369 | /** |
| 13370 | * ControlHostIface: |
| 13371 | * @parent_iface: The parent interface. |
| 13372 | * @handle_boot: Handler for the #ControlHost::handle-boot signal. |
| 13373 | * @handle_reboot: Handler for the #ControlHost::handle-reboot signal. |
| 13374 | * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal. |
| 13375 | * @booted: Handler for the #ControlHost::booted signal. |
| 13376 | * |
| 13377 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 13378 | */ |
| 13379 | |
| 13380 | typedef ControlHostIface ControlHostInterface; |
| 13381 | G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT); |
| 13382 | |
| 13383 | static void |
| 13384 | control_host_default_init (ControlHostIface *iface) |
| 13385 | { |
| 13386 | /* GObject signals for incoming D-Bus method calls: */ |
| 13387 | /** |
| 13388 | * ControlHost::handle-boot: |
| 13389 | * @object: A #ControlHost. |
| 13390 | * @invocation: A #GDBusMethodInvocation. |
| 13391 | * |
| 13392 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. |
| 13393 | * |
| 13394 | * 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. |
| 13395 | * |
| 13396 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13397 | */ |
| 13398 | g_signal_new ("handle-boot", |
| 13399 | G_TYPE_FROM_INTERFACE (iface), |
| 13400 | G_SIGNAL_RUN_LAST, |
| 13401 | G_STRUCT_OFFSET (ControlHostIface, handle_boot), |
| 13402 | g_signal_accumulator_true_handled, |
| 13403 | NULL, |
| 13404 | g_cclosure_marshal_generic, |
| 13405 | G_TYPE_BOOLEAN, |
| 13406 | 1, |
| 13407 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13408 | |
| 13409 | /** |
| 13410 | * ControlHost::handle-shutdown: |
| 13411 | * @object: A #ControlHost. |
| 13412 | * @invocation: A #GDBusMethodInvocation. |
| 13413 | * |
| 13414 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. |
| 13415 | * |
| 13416 | * 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. |
| 13417 | * |
| 13418 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13419 | */ |
| 13420 | g_signal_new ("handle-shutdown", |
| 13421 | G_TYPE_FROM_INTERFACE (iface), |
| 13422 | G_SIGNAL_RUN_LAST, |
| 13423 | G_STRUCT_OFFSET (ControlHostIface, handle_shutdown), |
| 13424 | g_signal_accumulator_true_handled, |
| 13425 | NULL, |
| 13426 | g_cclosure_marshal_generic, |
| 13427 | G_TYPE_BOOLEAN, |
| 13428 | 1, |
| 13429 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13430 | |
| 13431 | /** |
| 13432 | * ControlHost::handle-reboot: |
| 13433 | * @object: A #ControlHost. |
| 13434 | * @invocation: A #GDBusMethodInvocation. |
| 13435 | * |
| 13436 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. |
| 13437 | * |
| 13438 | * 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. |
| 13439 | * |
| 13440 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13441 | */ |
| 13442 | g_signal_new ("handle-reboot", |
| 13443 | G_TYPE_FROM_INTERFACE (iface), |
| 13444 | G_SIGNAL_RUN_LAST, |
| 13445 | G_STRUCT_OFFSET (ControlHostIface, handle_reboot), |
| 13446 | g_signal_accumulator_true_handled, |
| 13447 | NULL, |
| 13448 | g_cclosure_marshal_generic, |
| 13449 | G_TYPE_BOOLEAN, |
| 13450 | 1, |
| 13451 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13452 | |
| 13453 | /* GObject signals for received D-Bus signals: */ |
| 13454 | /** |
| 13455 | * ControlHost::booted: |
| 13456 | * @object: A #ControlHost. |
| 13457 | * |
| 13458 | * 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. |
| 13459 | * |
| 13460 | * 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. |
| 13461 | */ |
| 13462 | g_signal_new ("booted", |
| 13463 | G_TYPE_FROM_INTERFACE (iface), |
| 13464 | G_SIGNAL_RUN_LAST, |
| 13465 | G_STRUCT_OFFSET (ControlHostIface, booted), |
| 13466 | NULL, |
| 13467 | NULL, |
| 13468 | g_cclosure_marshal_generic, |
| 13469 | G_TYPE_NONE, |
| 13470 | 0); |
| 13471 | |
| 13472 | } |
| 13473 | |
| 13474 | /** |
| 13475 | * control_host_emit_booted: |
| 13476 | * @object: A #ControlHost. |
| 13477 | * |
| 13478 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal. |
| 13479 | */ |
| 13480 | void |
| 13481 | control_host_emit_booted ( |
| 13482 | ControlHost *object) |
| 13483 | { |
| 13484 | g_signal_emit_by_name (object, "booted"); |
| 13485 | } |
| 13486 | |
| 13487 | /** |
| 13488 | * control_host_call_boot: |
| 13489 | * @proxy: A #ControlHostProxy. |
| 13490 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13491 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13492 | * @user_data: User data to pass to @callback. |
| 13493 | * |
| 13494 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. |
| 13495 | * 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. |
| 13496 | * You can then call control_host_call_boot_finish() to get the result of the operation. |
| 13497 | * |
| 13498 | * See control_host_call_boot_sync() for the synchronous, blocking version of this method. |
| 13499 | */ |
| 13500 | void |
| 13501 | control_host_call_boot ( |
| 13502 | ControlHost *proxy, |
| 13503 | GCancellable *cancellable, |
| 13504 | GAsyncReadyCallback callback, |
| 13505 | gpointer user_data) |
| 13506 | { |
| 13507 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13508 | "boot", |
| 13509 | g_variant_new ("()"), |
| 13510 | G_DBUS_CALL_FLAGS_NONE, |
| 13511 | -1, |
| 13512 | cancellable, |
| 13513 | callback, |
| 13514 | user_data); |
| 13515 | } |
| 13516 | |
| 13517 | /** |
| 13518 | * control_host_call_boot_finish: |
| 13519 | * @proxy: A #ControlHostProxy. |
| 13520 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot(). |
| 13521 | * @error: Return location for error or %NULL. |
| 13522 | * |
| 13523 | * Finishes an operation started with control_host_call_boot(). |
| 13524 | * |
| 13525 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13526 | */ |
| 13527 | gboolean |
| 13528 | control_host_call_boot_finish ( |
| 13529 | ControlHost *proxy, |
| 13530 | GAsyncResult *res, |
| 13531 | GError **error) |
| 13532 | { |
| 13533 | GVariant *_ret; |
| 13534 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13535 | if (_ret == NULL) |
| 13536 | goto _out; |
| 13537 | g_variant_get (_ret, |
| 13538 | "()"); |
| 13539 | g_variant_unref (_ret); |
| 13540 | _out: |
| 13541 | return _ret != NULL; |
| 13542 | } |
| 13543 | |
| 13544 | /** |
| 13545 | * control_host_call_boot_sync: |
| 13546 | * @proxy: A #ControlHostProxy. |
| 13547 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13548 | * @error: Return location for error or %NULL. |
| 13549 | * |
| 13550 | * 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. |
| 13551 | * |
| 13552 | * See control_host_call_boot() for the asynchronous version of this method. |
| 13553 | * |
| 13554 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13555 | */ |
| 13556 | gboolean |
| 13557 | control_host_call_boot_sync ( |
| 13558 | ControlHost *proxy, |
| 13559 | GCancellable *cancellable, |
| 13560 | GError **error) |
| 13561 | { |
| 13562 | GVariant *_ret; |
| 13563 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13564 | "boot", |
| 13565 | g_variant_new ("()"), |
| 13566 | G_DBUS_CALL_FLAGS_NONE, |
| 13567 | -1, |
| 13568 | cancellable, |
| 13569 | error); |
| 13570 | if (_ret == NULL) |
| 13571 | goto _out; |
| 13572 | g_variant_get (_ret, |
| 13573 | "()"); |
| 13574 | g_variant_unref (_ret); |
| 13575 | _out: |
| 13576 | return _ret != NULL; |
| 13577 | } |
| 13578 | |
| 13579 | /** |
| 13580 | * control_host_call_shutdown: |
| 13581 | * @proxy: A #ControlHostProxy. |
| 13582 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13583 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13584 | * @user_data: User data to pass to @callback. |
| 13585 | * |
| 13586 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. |
| 13587 | * 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. |
| 13588 | * You can then call control_host_call_shutdown_finish() to get the result of the operation. |
| 13589 | * |
| 13590 | * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method. |
| 13591 | */ |
| 13592 | void |
| 13593 | control_host_call_shutdown ( |
| 13594 | ControlHost *proxy, |
| 13595 | GCancellable *cancellable, |
| 13596 | GAsyncReadyCallback callback, |
| 13597 | gpointer user_data) |
| 13598 | { |
| 13599 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13600 | "shutdown", |
| 13601 | g_variant_new ("()"), |
| 13602 | G_DBUS_CALL_FLAGS_NONE, |
| 13603 | -1, |
| 13604 | cancellable, |
| 13605 | callback, |
| 13606 | user_data); |
| 13607 | } |
| 13608 | |
| 13609 | /** |
| 13610 | * control_host_call_shutdown_finish: |
| 13611 | * @proxy: A #ControlHostProxy. |
| 13612 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown(). |
| 13613 | * @error: Return location for error or %NULL. |
| 13614 | * |
| 13615 | * Finishes an operation started with control_host_call_shutdown(). |
| 13616 | * |
| 13617 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13618 | */ |
| 13619 | gboolean |
| 13620 | control_host_call_shutdown_finish ( |
| 13621 | ControlHost *proxy, |
| 13622 | GAsyncResult *res, |
| 13623 | GError **error) |
| 13624 | { |
| 13625 | GVariant *_ret; |
| 13626 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13627 | if (_ret == NULL) |
| 13628 | goto _out; |
| 13629 | g_variant_get (_ret, |
| 13630 | "()"); |
| 13631 | g_variant_unref (_ret); |
| 13632 | _out: |
| 13633 | return _ret != NULL; |
| 13634 | } |
| 13635 | |
| 13636 | /** |
| 13637 | * control_host_call_shutdown_sync: |
| 13638 | * @proxy: A #ControlHostProxy. |
| 13639 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13640 | * @error: Return location for error or %NULL. |
| 13641 | * |
| 13642 | * 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. |
| 13643 | * |
| 13644 | * See control_host_call_shutdown() for the asynchronous version of this method. |
| 13645 | * |
| 13646 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13647 | */ |
| 13648 | gboolean |
| 13649 | control_host_call_shutdown_sync ( |
| 13650 | ControlHost *proxy, |
| 13651 | GCancellable *cancellable, |
| 13652 | GError **error) |
| 13653 | { |
| 13654 | GVariant *_ret; |
| 13655 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13656 | "shutdown", |
| 13657 | g_variant_new ("()"), |
| 13658 | G_DBUS_CALL_FLAGS_NONE, |
| 13659 | -1, |
| 13660 | cancellable, |
| 13661 | error); |
| 13662 | if (_ret == NULL) |
| 13663 | goto _out; |
| 13664 | g_variant_get (_ret, |
| 13665 | "()"); |
| 13666 | g_variant_unref (_ret); |
| 13667 | _out: |
| 13668 | return _ret != NULL; |
| 13669 | } |
| 13670 | |
| 13671 | /** |
| 13672 | * control_host_call_reboot: |
| 13673 | * @proxy: A #ControlHostProxy. |
| 13674 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13675 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13676 | * @user_data: User data to pass to @callback. |
| 13677 | * |
| 13678 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. |
| 13679 | * 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. |
| 13680 | * You can then call control_host_call_reboot_finish() to get the result of the operation. |
| 13681 | * |
| 13682 | * See control_host_call_reboot_sync() for the synchronous, blocking version of this method. |
| 13683 | */ |
| 13684 | void |
| 13685 | control_host_call_reboot ( |
| 13686 | ControlHost *proxy, |
| 13687 | GCancellable *cancellable, |
| 13688 | GAsyncReadyCallback callback, |
| 13689 | gpointer user_data) |
| 13690 | { |
| 13691 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13692 | "reboot", |
| 13693 | g_variant_new ("()"), |
| 13694 | G_DBUS_CALL_FLAGS_NONE, |
| 13695 | -1, |
| 13696 | cancellable, |
| 13697 | callback, |
| 13698 | user_data); |
| 13699 | } |
| 13700 | |
| 13701 | /** |
| 13702 | * control_host_call_reboot_finish: |
| 13703 | * @proxy: A #ControlHostProxy. |
| 13704 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot(). |
| 13705 | * @error: Return location for error or %NULL. |
| 13706 | * |
| 13707 | * Finishes an operation started with control_host_call_reboot(). |
| 13708 | * |
| 13709 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13710 | */ |
| 13711 | gboolean |
| 13712 | control_host_call_reboot_finish ( |
| 13713 | ControlHost *proxy, |
| 13714 | GAsyncResult *res, |
| 13715 | GError **error) |
| 13716 | { |
| 13717 | GVariant *_ret; |
| 13718 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13719 | if (_ret == NULL) |
| 13720 | goto _out; |
| 13721 | g_variant_get (_ret, |
| 13722 | "()"); |
| 13723 | g_variant_unref (_ret); |
| 13724 | _out: |
| 13725 | return _ret != NULL; |
| 13726 | } |
| 13727 | |
| 13728 | /** |
| 13729 | * control_host_call_reboot_sync: |
| 13730 | * @proxy: A #ControlHostProxy. |
| 13731 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13732 | * @error: Return location for error or %NULL. |
| 13733 | * |
| 13734 | * 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. |
| 13735 | * |
| 13736 | * See control_host_call_reboot() for the asynchronous version of this method. |
| 13737 | * |
| 13738 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13739 | */ |
| 13740 | gboolean |
| 13741 | control_host_call_reboot_sync ( |
| 13742 | ControlHost *proxy, |
| 13743 | GCancellable *cancellable, |
| 13744 | GError **error) |
| 13745 | { |
| 13746 | GVariant *_ret; |
| 13747 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13748 | "reboot", |
| 13749 | g_variant_new ("()"), |
| 13750 | G_DBUS_CALL_FLAGS_NONE, |
| 13751 | -1, |
| 13752 | cancellable, |
| 13753 | error); |
| 13754 | if (_ret == NULL) |
| 13755 | goto _out; |
| 13756 | g_variant_get (_ret, |
| 13757 | "()"); |
| 13758 | g_variant_unref (_ret); |
| 13759 | _out: |
| 13760 | return _ret != NULL; |
| 13761 | } |
| 13762 | |
| 13763 | /** |
| 13764 | * control_host_complete_boot: |
| 13765 | * @object: A #ControlHost. |
| 13766 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13767 | * |
| 13768 | * 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. |
| 13769 | * |
| 13770 | * This method will free @invocation, you cannot use it afterwards. |
| 13771 | */ |
| 13772 | void |
| 13773 | control_host_complete_boot ( |
| 13774 | ControlHost *object, |
| 13775 | GDBusMethodInvocation *invocation) |
| 13776 | { |
| 13777 | g_dbus_method_invocation_return_value (invocation, |
| 13778 | g_variant_new ("()")); |
| 13779 | } |
| 13780 | |
| 13781 | /** |
| 13782 | * control_host_complete_shutdown: |
| 13783 | * @object: A #ControlHost. |
| 13784 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13785 | * |
| 13786 | * 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. |
| 13787 | * |
| 13788 | * This method will free @invocation, you cannot use it afterwards. |
| 13789 | */ |
| 13790 | void |
| 13791 | control_host_complete_shutdown ( |
| 13792 | ControlHost *object, |
| 13793 | GDBusMethodInvocation *invocation) |
| 13794 | { |
| 13795 | g_dbus_method_invocation_return_value (invocation, |
| 13796 | g_variant_new ("()")); |
| 13797 | } |
| 13798 | |
| 13799 | /** |
| 13800 | * control_host_complete_reboot: |
| 13801 | * @object: A #ControlHost. |
| 13802 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13803 | * |
| 13804 | * 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. |
| 13805 | * |
| 13806 | * This method will free @invocation, you cannot use it afterwards. |
| 13807 | */ |
| 13808 | void |
| 13809 | control_host_complete_reboot ( |
| 13810 | ControlHost *object, |
| 13811 | GDBusMethodInvocation *invocation) |
| 13812 | { |
| 13813 | g_dbus_method_invocation_return_value (invocation, |
| 13814 | g_variant_new ("()")); |
| 13815 | } |
| 13816 | |
| 13817 | /* ------------------------------------------------------------------------ */ |
| 13818 | |
| 13819 | /** |
| 13820 | * ControlHostProxy: |
| 13821 | * |
| 13822 | * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API. |
| 13823 | */ |
| 13824 | |
| 13825 | /** |
| 13826 | * ControlHostProxyClass: |
| 13827 | * @parent_class: The parent class. |
| 13828 | * |
| 13829 | * Class structure for #ControlHostProxy. |
| 13830 | */ |
| 13831 | |
| 13832 | struct _ControlHostProxyPrivate |
| 13833 | { |
| 13834 | GData *qdata; |
| 13835 | }; |
| 13836 | |
| 13837 | static void control_host_proxy_iface_init (ControlHostIface *iface); |
| 13838 | |
| 13839 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13840 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 13841 | G_ADD_PRIVATE (ControlHostProxy) |
| 13842 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 13843 | |
| 13844 | #else |
| 13845 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 13846 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 13847 | |
| 13848 | #endif |
| 13849 | static void |
| 13850 | control_host_proxy_finalize (GObject *object) |
| 13851 | { |
| 13852 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 13853 | g_datalist_clear (&proxy->priv->qdata); |
| 13854 | G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object); |
| 13855 | } |
| 13856 | |
| 13857 | static void |
| 13858 | control_host_proxy_get_property (GObject *object, |
| 13859 | guint prop_id, |
| 13860 | GValue *value, |
| 13861 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13862 | { |
| 13863 | } |
| 13864 | |
| 13865 | static void |
| 13866 | control_host_proxy_set_property (GObject *object, |
| 13867 | guint prop_id, |
| 13868 | const GValue *value, |
| 13869 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13870 | { |
| 13871 | } |
| 13872 | |
| 13873 | static void |
| 13874 | control_host_proxy_g_signal (GDBusProxy *proxy, |
| 13875 | const gchar *sender_name G_GNUC_UNUSED, |
| 13876 | const gchar *signal_name, |
| 13877 | GVariant *parameters) |
| 13878 | { |
| 13879 | _ExtendedGDBusSignalInfo *info; |
| 13880 | GVariantIter iter; |
| 13881 | GVariant *child; |
| 13882 | GValue *paramv; |
| 13883 | guint num_params; |
| 13884 | guint n; |
| 13885 | guint signal_id; |
| 13886 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name); |
| 13887 | if (info == NULL) |
| 13888 | return; |
| 13889 | num_params = g_variant_n_children (parameters); |
| 13890 | paramv = g_new0 (GValue, num_params + 1); |
| 13891 | g_value_init (¶mv[0], TYPE_CONTROL_HOST); |
| 13892 | g_value_set_object (¶mv[0], proxy); |
| 13893 | g_variant_iter_init (&iter, parameters); |
| 13894 | n = 1; |
| 13895 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13896 | { |
| 13897 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 13898 | if (arg_info->use_gvariant) |
| 13899 | { |
| 13900 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13901 | g_value_set_variant (¶mv[n], child); |
| 13902 | n++; |
| 13903 | } |
| 13904 | else |
| 13905 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13906 | g_variant_unref (child); |
| 13907 | } |
| 13908 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 13909 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 13910 | for (n = 0; n < num_params + 1; n++) |
| 13911 | g_value_unset (¶mv[n]); |
| 13912 | g_free (paramv); |
| 13913 | } |
| 13914 | |
| 13915 | static void |
| 13916 | control_host_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 13917 | GVariant *changed_properties, |
| 13918 | const gchar *const *invalidated_properties) |
| 13919 | { |
| 13920 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy); |
| 13921 | guint n; |
| 13922 | const gchar *key; |
| 13923 | GVariantIter *iter; |
| 13924 | _ExtendedGDBusPropertyInfo *info; |
| 13925 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 13926 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 13927 | { |
| 13928 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key); |
| 13929 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 13930 | if (info != NULL) |
| 13931 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13932 | } |
| 13933 | g_variant_iter_free (iter); |
| 13934 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 13935 | { |
| 13936 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]); |
| 13937 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 13938 | if (info != NULL) |
| 13939 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13940 | } |
| 13941 | } |
| 13942 | |
| 13943 | static void |
| 13944 | control_host_proxy_init (ControlHostProxy *proxy) |
| 13945 | { |
| 13946 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13947 | proxy->priv = control_host_proxy_get_instance_private (proxy); |
| 13948 | #else |
| 13949 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate); |
| 13950 | #endif |
| 13951 | |
| 13952 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ()); |
| 13953 | } |
| 13954 | |
| 13955 | static void |
| 13956 | control_host_proxy_class_init (ControlHostProxyClass *klass) |
| 13957 | { |
| 13958 | GObjectClass *gobject_class; |
| 13959 | GDBusProxyClass *proxy_class; |
| 13960 | |
| 13961 | gobject_class = G_OBJECT_CLASS (klass); |
| 13962 | gobject_class->finalize = control_host_proxy_finalize; |
| 13963 | gobject_class->get_property = control_host_proxy_get_property; |
| 13964 | gobject_class->set_property = control_host_proxy_set_property; |
| 13965 | |
| 13966 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 13967 | proxy_class->g_signal = control_host_proxy_g_signal; |
| 13968 | proxy_class->g_properties_changed = control_host_proxy_g_properties_changed; |
| 13969 | |
| 13970 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13971 | g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate)); |
| 13972 | #endif |
| 13973 | } |
| 13974 | |
| 13975 | static void |
| 13976 | control_host_proxy_iface_init (ControlHostIface *iface) |
| 13977 | { |
| 13978 | } |
| 13979 | |
| 13980 | /** |
| 13981 | * control_host_proxy_new: |
| 13982 | * @connection: A #GDBusConnection. |
| 13983 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13984 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13985 | * @object_path: An object path. |
| 13986 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13987 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13988 | * @user_data: User data to pass to @callback. |
| 13989 | * |
| 13990 | * 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. |
| 13991 | * |
| 13992 | * 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. |
| 13993 | * You can then call control_host_proxy_new_finish() to get the result of the operation. |
| 13994 | * |
| 13995 | * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 13996 | */ |
| 13997 | void |
| 13998 | control_host_proxy_new ( |
| 13999 | GDBusConnection *connection, |
| 14000 | GDBusProxyFlags flags, |
| 14001 | const gchar *name, |
| 14002 | const gchar *object_path, |
| 14003 | GCancellable *cancellable, |
| 14004 | GAsyncReadyCallback callback, |
| 14005 | gpointer user_data) |
| 14006 | { |
| 14007 | 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); |
| 14008 | } |
| 14009 | |
| 14010 | /** |
| 14011 | * control_host_proxy_new_finish: |
| 14012 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new(). |
| 14013 | * @error: Return location for error or %NULL |
| 14014 | * |
| 14015 | * Finishes an operation started with control_host_proxy_new(). |
| 14016 | * |
| 14017 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 14018 | */ |
| 14019 | ControlHost * |
| 14020 | control_host_proxy_new_finish ( |
| 14021 | GAsyncResult *res, |
| 14022 | GError **error) |
| 14023 | { |
| 14024 | GObject *ret; |
| 14025 | GObject *source_object; |
| 14026 | source_object = g_async_result_get_source_object (res); |
| 14027 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 14028 | g_object_unref (source_object); |
| 14029 | if (ret != NULL) |
| 14030 | return CONTROL_HOST (ret); |
| 14031 | else |
| 14032 | return NULL; |
| 14033 | } |
| 14034 | |
| 14035 | /** |
| 14036 | * control_host_proxy_new_sync: |
| 14037 | * @connection: A #GDBusConnection. |
| 14038 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14039 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 14040 | * @object_path: An object path. |
| 14041 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14042 | * @error: Return location for error or %NULL |
| 14043 | * |
| 14044 | * 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. |
| 14045 | * |
| 14046 | * The calling thread is blocked until a reply is received. |
| 14047 | * |
| 14048 | * See control_host_proxy_new() for the asynchronous version of this constructor. |
| 14049 | * |
| 14050 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 14051 | */ |
| 14052 | ControlHost * |
| 14053 | control_host_proxy_new_sync ( |
| 14054 | GDBusConnection *connection, |
| 14055 | GDBusProxyFlags flags, |
| 14056 | const gchar *name, |
| 14057 | const gchar *object_path, |
| 14058 | GCancellable *cancellable, |
| 14059 | GError **error) |
| 14060 | { |
| 14061 | GInitable *ret; |
| 14062 | 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); |
| 14063 | if (ret != NULL) |
| 14064 | return CONTROL_HOST (ret); |
| 14065 | else |
| 14066 | return NULL; |
| 14067 | } |
| 14068 | |
| 14069 | |
| 14070 | /** |
| 14071 | * control_host_proxy_new_for_bus: |
| 14072 | * @bus_type: A #GBusType. |
| 14073 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14074 | * @name: A bus name (well-known or unique). |
| 14075 | * @object_path: An object path. |
| 14076 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14077 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 14078 | * @user_data: User data to pass to @callback. |
| 14079 | * |
| 14080 | * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 14081 | * |
| 14082 | * 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. |
| 14083 | * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation. |
| 14084 | * |
| 14085 | * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 14086 | */ |
| 14087 | void |
| 14088 | control_host_proxy_new_for_bus ( |
| 14089 | GBusType bus_type, |
| 14090 | GDBusProxyFlags flags, |
| 14091 | const gchar *name, |
| 14092 | const gchar *object_path, |
| 14093 | GCancellable *cancellable, |
| 14094 | GAsyncReadyCallback callback, |
| 14095 | gpointer user_data) |
| 14096 | { |
| 14097 | 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); |
| 14098 | } |
| 14099 | |
| 14100 | /** |
| 14101 | * control_host_proxy_new_for_bus_finish: |
| 14102 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus(). |
| 14103 | * @error: Return location for error or %NULL |
| 14104 | * |
| 14105 | * Finishes an operation started with control_host_proxy_new_for_bus(). |
| 14106 | * |
| 14107 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 14108 | */ |
| 14109 | ControlHost * |
| 14110 | control_host_proxy_new_for_bus_finish ( |
| 14111 | GAsyncResult *res, |
| 14112 | GError **error) |
| 14113 | { |
| 14114 | GObject *ret; |
| 14115 | GObject *source_object; |
| 14116 | source_object = g_async_result_get_source_object (res); |
| 14117 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 14118 | g_object_unref (source_object); |
| 14119 | if (ret != NULL) |
| 14120 | return CONTROL_HOST (ret); |
| 14121 | else |
| 14122 | return NULL; |
| 14123 | } |
| 14124 | |
| 14125 | /** |
| 14126 | * control_host_proxy_new_for_bus_sync: |
| 14127 | * @bus_type: A #GBusType. |
| 14128 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14129 | * @name: A bus name (well-known or unique). |
| 14130 | * @object_path: An object path. |
| 14131 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14132 | * @error: Return location for error or %NULL |
| 14133 | * |
| 14134 | * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 14135 | * |
| 14136 | * The calling thread is blocked until a reply is received. |
| 14137 | * |
| 14138 | * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 14139 | * |
| 14140 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 14141 | */ |
| 14142 | ControlHost * |
| 14143 | control_host_proxy_new_for_bus_sync ( |
| 14144 | GBusType bus_type, |
| 14145 | GDBusProxyFlags flags, |
| 14146 | const gchar *name, |
| 14147 | const gchar *object_path, |
| 14148 | GCancellable *cancellable, |
| 14149 | GError **error) |
| 14150 | { |
| 14151 | GInitable *ret; |
| 14152 | 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); |
| 14153 | if (ret != NULL) |
| 14154 | return CONTROL_HOST (ret); |
| 14155 | else |
| 14156 | return NULL; |
| 14157 | } |
| 14158 | |
| 14159 | |
| 14160 | /* ------------------------------------------------------------------------ */ |
| 14161 | |
| 14162 | /** |
| 14163 | * ControlHostSkeleton: |
| 14164 | * |
| 14165 | * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API. |
| 14166 | */ |
| 14167 | |
| 14168 | /** |
| 14169 | * ControlHostSkeletonClass: |
| 14170 | * @parent_class: The parent class. |
| 14171 | * |
| 14172 | * Class structure for #ControlHostSkeleton. |
| 14173 | */ |
| 14174 | |
| 14175 | struct _ControlHostSkeletonPrivate |
| 14176 | { |
| 14177 | GValue *properties; |
| 14178 | GList *changed_properties; |
| 14179 | GSource *changed_properties_idle_source; |
| 14180 | GMainContext *context; |
| 14181 | GMutex lock; |
| 14182 | }; |
| 14183 | |
| 14184 | static void |
| 14185 | _control_host_skeleton_handle_method_call ( |
| 14186 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14187 | const gchar *sender G_GNUC_UNUSED, |
| 14188 | const gchar *object_path G_GNUC_UNUSED, |
| 14189 | const gchar *interface_name, |
| 14190 | const gchar *method_name, |
| 14191 | GVariant *parameters, |
| 14192 | GDBusMethodInvocation *invocation, |
| 14193 | gpointer user_data) |
| 14194 | { |
| 14195 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14196 | _ExtendedGDBusMethodInfo *info; |
| 14197 | GVariantIter iter; |
| 14198 | GVariant *child; |
| 14199 | GValue *paramv; |
| 14200 | guint num_params; |
| 14201 | guint num_extra; |
| 14202 | guint n; |
| 14203 | guint signal_id; |
| 14204 | GValue return_value = G_VALUE_INIT; |
| 14205 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 14206 | g_assert (info != NULL); |
| 14207 | num_params = g_variant_n_children (parameters); |
| 14208 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 14209 | n = 0; |
| 14210 | g_value_init (¶mv[n], TYPE_CONTROL_HOST); |
| 14211 | g_value_set_object (¶mv[n++], skeleton); |
| 14212 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 14213 | g_value_set_object (¶mv[n++], invocation); |
| 14214 | if (info->pass_fdlist) |
| 14215 | { |
| 14216 | #ifdef G_OS_UNIX |
| 14217 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 14218 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 14219 | #else |
| 14220 | g_assert_not_reached (); |
| 14221 | #endif |
| 14222 | } |
| 14223 | g_variant_iter_init (&iter, parameters); |
| 14224 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 14225 | { |
| 14226 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 14227 | if (arg_info->use_gvariant) |
| 14228 | { |
| 14229 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 14230 | g_value_set_variant (¶mv[n], child); |
| 14231 | n++; |
| 14232 | } |
| 14233 | else |
| 14234 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 14235 | g_variant_unref (child); |
| 14236 | } |
| 14237 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 14238 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 14239 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 14240 | if (!g_value_get_boolean (&return_value)) |
| 14241 | 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); |
| 14242 | g_value_unset (&return_value); |
| 14243 | for (n = 0; n < num_params + num_extra; n++) |
| 14244 | g_value_unset (¶mv[n]); |
| 14245 | g_free (paramv); |
| 14246 | } |
| 14247 | |
| 14248 | static GVariant * |
| 14249 | _control_host_skeleton_handle_get_property ( |
| 14250 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14251 | const gchar *sender G_GNUC_UNUSED, |
| 14252 | const gchar *object_path G_GNUC_UNUSED, |
| 14253 | const gchar *interface_name G_GNUC_UNUSED, |
| 14254 | const gchar *property_name, |
| 14255 | GError **error, |
| 14256 | gpointer user_data) |
| 14257 | { |
| 14258 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14259 | GValue value = G_VALUE_INIT; |
| 14260 | GParamSpec *pspec; |
| 14261 | _ExtendedGDBusPropertyInfo *info; |
| 14262 | GVariant *ret; |
| 14263 | ret = NULL; |
| 14264 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 14265 | g_assert (info != NULL); |
| 14266 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 14267 | if (pspec == NULL) |
| 14268 | { |
| 14269 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 14270 | } |
| 14271 | else |
| 14272 | { |
| 14273 | g_value_init (&value, pspec->value_type); |
| 14274 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 14275 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 14276 | g_value_unset (&value); |
| 14277 | } |
| 14278 | return ret; |
| 14279 | } |
| 14280 | |
| 14281 | static gboolean |
| 14282 | _control_host_skeleton_handle_set_property ( |
| 14283 | GDBusConnection *connection G_GNUC_UNUSED, |
| 14284 | const gchar *sender G_GNUC_UNUSED, |
| 14285 | const gchar *object_path G_GNUC_UNUSED, |
| 14286 | const gchar *interface_name G_GNUC_UNUSED, |
| 14287 | const gchar *property_name, |
| 14288 | GVariant *variant, |
| 14289 | GError **error, |
| 14290 | gpointer user_data) |
| 14291 | { |
| 14292 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 14293 | GValue value = G_VALUE_INIT; |
| 14294 | GParamSpec *pspec; |
| 14295 | _ExtendedGDBusPropertyInfo *info; |
| 14296 | gboolean ret; |
| 14297 | ret = FALSE; |
| 14298 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 14299 | g_assert (info != NULL); |
| 14300 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 14301 | if (pspec == NULL) |
| 14302 | { |
| 14303 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 14304 | } |
| 14305 | else |
| 14306 | { |
| 14307 | if (info->use_gvariant) |
| 14308 | g_value_set_variant (&value, variant); |
| 14309 | else |
| 14310 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 14311 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 14312 | g_value_unset (&value); |
| 14313 | ret = TRUE; |
| 14314 | } |
| 14315 | return ret; |
| 14316 | } |
| 14317 | |
| 14318 | static const GDBusInterfaceVTable _control_host_skeleton_vtable = |
| 14319 | { |
| 14320 | _control_host_skeleton_handle_method_call, |
| 14321 | _control_host_skeleton_handle_get_property, |
| 14322 | _control_host_skeleton_handle_set_property, |
| 14323 | {NULL} |
| 14324 | }; |
| 14325 | |
| 14326 | static GDBusInterfaceInfo * |
| 14327 | control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14328 | { |
| 14329 | return control_host_interface_info (); |
| 14330 | } |
| 14331 | |
| 14332 | static GDBusInterfaceVTable * |
| 14333 | control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14334 | { |
| 14335 | return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable; |
| 14336 | } |
| 14337 | |
| 14338 | static GVariant * |
| 14339 | control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 14340 | { |
| 14341 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 14342 | |
| 14343 | GVariantBuilder builder; |
| 14344 | guint n; |
| 14345 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 14346 | if (_control_host_interface_info.parent_struct.properties == NULL) |
| 14347 | goto out; |
| 14348 | for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++) |
| 14349 | { |
| 14350 | GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n]; |
| 14351 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 14352 | { |
| 14353 | GVariant *value; |
| 14354 | 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); |
| 14355 | if (value != NULL) |
| 14356 | { |
| 14357 | g_variant_take_ref (value); |
| 14358 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 14359 | g_variant_unref (value); |
| 14360 | } |
| 14361 | } |
| 14362 | } |
| 14363 | out: |
| 14364 | return g_variant_builder_end (&builder); |
| 14365 | } |
| 14366 | |
| 14367 | static void |
| 14368 | control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 14369 | { |
| 14370 | } |
| 14371 | |
| 14372 | static void |
| 14373 | _control_host_on_signal_booted ( |
| 14374 | ControlHost *object) |
| 14375 | { |
| 14376 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 14377 | |
| 14378 | GList *connections, *l; |
| 14379 | GVariant *signal_variant; |
| 14380 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14381 | |
| 14382 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 14383 | for (l = connections; l != NULL; l = l->next) |
| 14384 | { |
| 14385 | GDBusConnection *connection = l->data; |
| 14386 | g_dbus_connection_emit_signal (connection, |
| 14387 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted", |
| 14388 | signal_variant, NULL); |
| 14389 | } |
| 14390 | g_variant_unref (signal_variant); |
| 14391 | g_list_free_full (connections, g_object_unref); |
| 14392 | } |
| 14393 | |
| 14394 | static void control_host_skeleton_iface_init (ControlHostIface *iface); |
| 14395 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14396 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14397 | G_ADD_PRIVATE (ControlHostSkeleton) |
| 14398 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 14399 | |
| 14400 | #else |
| 14401 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14402 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 14403 | |
| 14404 | #endif |
| 14405 | static void |
| 14406 | control_host_skeleton_finalize (GObject *object) |
| 14407 | { |
| 14408 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 14409 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 14410 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 14411 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 14412 | g_main_context_unref (skeleton->priv->context); |
| 14413 | g_mutex_clear (&skeleton->priv->lock); |
| 14414 | G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object); |
| 14415 | } |
| 14416 | |
| 14417 | static void |
| 14418 | control_host_skeleton_init (ControlHostSkeleton *skeleton) |
| 14419 | { |
| 14420 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14421 | skeleton->priv = control_host_skeleton_get_instance_private (skeleton); |
| 14422 | #else |
| 14423 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate); |
| 14424 | #endif |
| 14425 | |
| 14426 | g_mutex_init (&skeleton->priv->lock); |
| 14427 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 14428 | } |
| 14429 | |
| 14430 | static void |
| 14431 | control_host_skeleton_class_init (ControlHostSkeletonClass *klass) |
| 14432 | { |
| 14433 | GObjectClass *gobject_class; |
| 14434 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 14435 | |
| 14436 | gobject_class = G_OBJECT_CLASS (klass); |
| 14437 | gobject_class->finalize = control_host_skeleton_finalize; |
| 14438 | |
| 14439 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 14440 | skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info; |
| 14441 | skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties; |
| 14442 | skeleton_class->flush = control_host_skeleton_dbus_interface_flush; |
| 14443 | skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable; |
| 14444 | |
| 14445 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 14446 | g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate)); |
| 14447 | #endif |
| 14448 | } |
| 14449 | |
| 14450 | static void |
| 14451 | control_host_skeleton_iface_init (ControlHostIface *iface) |
| 14452 | { |
| 14453 | iface->booted = _control_host_on_signal_booted; |
| 14454 | } |
| 14455 | |
| 14456 | /** |
| 14457 | * control_host_skeleton_new: |
| 14458 | * |
| 14459 | * 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>. |
| 14460 | * |
| 14461 | * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object. |
| 14462 | */ |
| 14463 | ControlHost * |
| 14464 | control_host_skeleton_new (void) |
| 14465 | { |
| 14466 | return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL)); |
| 14467 | } |
| 14468 | |
| 14469 | /* ------------------------------------------------------------------------ |
| 14470 | * Code for interface org.openbmc.control.Power |
| 14471 | * ------------------------------------------------------------------------ |
| 14472 | */ |
| 14473 | |
| 14474 | /** |
| 14475 | * SECTION:ControlPower |
| 14476 | * @title: ControlPower |
| 14477 | * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface |
| 14478 | * |
| 14479 | * 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. |
| 14480 | */ |
| 14481 | |
| 14482 | /* ---- Introspection data for org.openbmc.control.Power ---- */ |
| 14483 | |
| 14484 | static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state = |
| 14485 | { |
| 14486 | { |
| 14487 | -1, |
| 14488 | (gchar *) "state", |
| 14489 | (gchar *) "i", |
| 14490 | NULL |
| 14491 | }, |
| 14492 | FALSE |
| 14493 | }; |
| 14494 | |
| 14495 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] = |
| 14496 | { |
| 14497 | &_control_power_method_info_set_power_state_IN_ARG_state, |
| 14498 | NULL |
| 14499 | }; |
| 14500 | |
| 14501 | static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state = |
| 14502 | { |
| 14503 | { |
| 14504 | -1, |
| 14505 | (gchar *) "setPowerState", |
| 14506 | (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers, |
| 14507 | NULL, |
| 14508 | NULL |
| 14509 | }, |
| 14510 | "handle-set-power-state", |
| 14511 | FALSE |
| 14512 | }; |
| 14513 | |
| 14514 | static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state = |
| 14515 | { |
| 14516 | { |
| 14517 | -1, |
| 14518 | (gchar *) "state", |
| 14519 | (gchar *) "i", |
| 14520 | NULL |
| 14521 | }, |
| 14522 | FALSE |
| 14523 | }; |
| 14524 | |
| 14525 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] = |
| 14526 | { |
| 14527 | &_control_power_method_info_get_power_state_OUT_ARG_state, |
| 14528 | NULL |
| 14529 | }; |
| 14530 | |
| 14531 | static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state = |
| 14532 | { |
| 14533 | { |
| 14534 | -1, |
| 14535 | (gchar *) "getPowerState", |
| 14536 | NULL, |
| 14537 | (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers, |
| 14538 | NULL |
| 14539 | }, |
| 14540 | "handle-get-power-state", |
| 14541 | FALSE |
| 14542 | }; |
| 14543 | |
| 14544 | static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] = |
| 14545 | { |
| 14546 | &_control_power_method_info_set_power_state, |
| 14547 | &_control_power_method_info_get_power_state, |
| 14548 | NULL |
| 14549 | }; |
| 14550 | |
| 14551 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good = |
| 14552 | { |
| 14553 | { |
| 14554 | -1, |
| 14555 | (gchar *) "PowerGood", |
| 14556 | NULL, |
| 14557 | NULL |
| 14558 | }, |
| 14559 | "power-good" |
| 14560 | }; |
| 14561 | |
| 14562 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost = |
| 14563 | { |
| 14564 | { |
| 14565 | -1, |
| 14566 | (gchar *) "PowerLost", |
| 14567 | NULL, |
| 14568 | NULL |
| 14569 | }, |
| 14570 | "power-lost" |
| 14571 | }; |
| 14572 | |
| 14573 | static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] = |
| 14574 | { |
| 14575 | &_control_power_signal_info_power_good, |
| 14576 | &_control_power_signal_info_power_lost, |
| 14577 | NULL |
| 14578 | }; |
| 14579 | |
| 14580 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood = |
| 14581 | { |
| 14582 | { |
| 14583 | -1, |
| 14584 | (gchar *) "pgood", |
| 14585 | (gchar *) "i", |
| 14586 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 14587 | NULL |
| 14588 | }, |
| 14589 | "pgood", |
| 14590 | FALSE |
| 14591 | }; |
| 14592 | |
| 14593 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_state = |
| 14594 | { |
| 14595 | { |
| 14596 | -1, |
| 14597 | (gchar *) "state", |
| 14598 | (gchar *) "i", |
| 14599 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 14600 | NULL |
| 14601 | }, |
| 14602 | "state", |
| 14603 | FALSE |
| 14604 | }; |
| 14605 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14606 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout = |
| 14607 | { |
| 14608 | { |
| 14609 | -1, |
| 14610 | (gchar *) "pgood_timeout", |
| 14611 | (gchar *) "i", |
| 14612 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 14613 | NULL |
| 14614 | }, |
| 14615 | "pgood-timeout", |
| 14616 | FALSE |
| 14617 | }; |
| 14618 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14619 | static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] = |
| 14620 | { |
| 14621 | &_control_power_property_info_pgood, |
| 14622 | &_control_power_property_info_state, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14623 | &_control_power_property_info_pgood_timeout, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14624 | NULL |
| 14625 | }; |
| 14626 | |
| 14627 | static const _ExtendedGDBusInterfaceInfo _control_power_interface_info = |
| 14628 | { |
| 14629 | { |
| 14630 | -1, |
| 14631 | (gchar *) "org.openbmc.control.Power", |
| 14632 | (GDBusMethodInfo **) &_control_power_method_info_pointers, |
| 14633 | (GDBusSignalInfo **) &_control_power_signal_info_pointers, |
| 14634 | (GDBusPropertyInfo **) &_control_power_property_info_pointers, |
| 14635 | NULL |
| 14636 | }, |
| 14637 | "control-power", |
| 14638 | }; |
| 14639 | |
| 14640 | |
| 14641 | /** |
| 14642 | * control_power_interface_info: |
| 14643 | * |
| 14644 | * 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. |
| 14645 | * |
| 14646 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 14647 | */ |
| 14648 | GDBusInterfaceInfo * |
| 14649 | control_power_interface_info (void) |
| 14650 | { |
| 14651 | return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct; |
| 14652 | } |
| 14653 | |
| 14654 | /** |
| 14655 | * control_power_override_properties: |
| 14656 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 14657 | * @property_id_begin: The property id to assign to the first overridden property. |
| 14658 | * |
| 14659 | * Overrides all #GObject properties in the #ControlPower interface for a concrete class. |
| 14660 | * The properties are overridden in the order they are defined. |
| 14661 | * |
| 14662 | * Returns: The last property id. |
| 14663 | */ |
| 14664 | guint |
| 14665 | control_power_override_properties (GObjectClass *klass, guint property_id_begin) |
| 14666 | { |
| 14667 | g_object_class_override_property (klass, property_id_begin++, "pgood"); |
| 14668 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14669 | g_object_class_override_property (klass, property_id_begin++, "pgood-timeout"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14670 | return property_id_begin - 1; |
| 14671 | } |
| 14672 | |
| 14673 | |
| 14674 | |
| 14675 | /** |
| 14676 | * ControlPower: |
| 14677 | * |
| 14678 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 14679 | */ |
| 14680 | |
| 14681 | /** |
| 14682 | * ControlPowerIface: |
| 14683 | * @parent_iface: The parent interface. |
| 14684 | * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal. |
| 14685 | * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal. |
| 14686 | * @get_pgood: Getter for the #ControlPower:pgood property. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14687 | * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14688 | * @get_state: Getter for the #ControlPower:state property. |
| 14689 | * @power_good: Handler for the #ControlPower::power-good signal. |
| 14690 | * @power_lost: Handler for the #ControlPower::power-lost signal. |
| 14691 | * |
| 14692 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 14693 | */ |
| 14694 | |
| 14695 | typedef ControlPowerIface ControlPowerInterface; |
| 14696 | G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT); |
| 14697 | |
| 14698 | static void |
| 14699 | control_power_default_init (ControlPowerIface *iface) |
| 14700 | { |
| 14701 | /* GObject signals for incoming D-Bus method calls: */ |
| 14702 | /** |
| 14703 | * ControlPower::handle-set-power-state: |
| 14704 | * @object: A #ControlPower. |
| 14705 | * @invocation: A #GDBusMethodInvocation. |
| 14706 | * @arg_state: Argument passed by remote caller. |
| 14707 | * |
| 14708 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. |
| 14709 | * |
| 14710 | * 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. |
| 14711 | * |
| 14712 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14713 | */ |
| 14714 | g_signal_new ("handle-set-power-state", |
| 14715 | G_TYPE_FROM_INTERFACE (iface), |
| 14716 | G_SIGNAL_RUN_LAST, |
| 14717 | G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state), |
| 14718 | g_signal_accumulator_true_handled, |
| 14719 | NULL, |
| 14720 | g_cclosure_marshal_generic, |
| 14721 | G_TYPE_BOOLEAN, |
| 14722 | 2, |
| 14723 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 14724 | |
| 14725 | /** |
| 14726 | * ControlPower::handle-get-power-state: |
| 14727 | * @object: A #ControlPower. |
| 14728 | * @invocation: A #GDBusMethodInvocation. |
| 14729 | * |
| 14730 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. |
| 14731 | * |
| 14732 | * 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. |
| 14733 | * |
| 14734 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14735 | */ |
| 14736 | g_signal_new ("handle-get-power-state", |
| 14737 | G_TYPE_FROM_INTERFACE (iface), |
| 14738 | G_SIGNAL_RUN_LAST, |
| 14739 | G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state), |
| 14740 | g_signal_accumulator_true_handled, |
| 14741 | NULL, |
| 14742 | g_cclosure_marshal_generic, |
| 14743 | G_TYPE_BOOLEAN, |
| 14744 | 1, |
| 14745 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14746 | |
| 14747 | /* GObject signals for received D-Bus signals: */ |
| 14748 | /** |
| 14749 | * ControlPower::power-good: |
| 14750 | * @object: A #ControlPower. |
| 14751 | * |
| 14752 | * 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. |
| 14753 | * |
| 14754 | * 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. |
| 14755 | */ |
| 14756 | g_signal_new ("power-good", |
| 14757 | G_TYPE_FROM_INTERFACE (iface), |
| 14758 | G_SIGNAL_RUN_LAST, |
| 14759 | G_STRUCT_OFFSET (ControlPowerIface, power_good), |
| 14760 | NULL, |
| 14761 | NULL, |
| 14762 | g_cclosure_marshal_generic, |
| 14763 | G_TYPE_NONE, |
| 14764 | 0); |
| 14765 | |
| 14766 | /** |
| 14767 | * ControlPower::power-lost: |
| 14768 | * @object: A #ControlPower. |
| 14769 | * |
| 14770 | * 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. |
| 14771 | * |
| 14772 | * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. |
| 14773 | */ |
| 14774 | g_signal_new ("power-lost", |
| 14775 | G_TYPE_FROM_INTERFACE (iface), |
| 14776 | G_SIGNAL_RUN_LAST, |
| 14777 | G_STRUCT_OFFSET (ControlPowerIface, power_lost), |
| 14778 | NULL, |
| 14779 | NULL, |
| 14780 | g_cclosure_marshal_generic, |
| 14781 | G_TYPE_NONE, |
| 14782 | 0); |
| 14783 | |
| 14784 | /* GObject properties for D-Bus properties: */ |
| 14785 | /** |
| 14786 | * ControlPower:pgood: |
| 14787 | * |
| 14788 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>. |
| 14789 | * |
| 14790 | * 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. |
| 14791 | */ |
| 14792 | g_object_interface_install_property (iface, |
| 14793 | g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 14794 | /** |
| 14795 | * ControlPower:state: |
| 14796 | * |
| 14797 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>. |
| 14798 | * |
| 14799 | * 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. |
| 14800 | */ |
| 14801 | g_object_interface_install_property (iface, |
| 14802 | 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] | 14803 | /** |
| 14804 | * ControlPower:pgood-timeout: |
| 14805 | * |
| 14806 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>. |
| 14807 | * |
| 14808 | * 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. |
| 14809 | */ |
| 14810 | g_object_interface_install_property (iface, |
| 14811 | 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] | 14812 | } |
| 14813 | |
| 14814 | /** |
| 14815 | * control_power_get_pgood: (skip) |
| 14816 | * @object: A #ControlPower. |
| 14817 | * |
| 14818 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property. |
| 14819 | * |
| 14820 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 14821 | * |
| 14822 | * Returns: The property value. |
| 14823 | */ |
| 14824 | gint |
| 14825 | control_power_get_pgood (ControlPower *object) |
| 14826 | { |
| 14827 | return CONTROL_POWER_GET_IFACE (object)->get_pgood (object); |
| 14828 | } |
| 14829 | |
| 14830 | /** |
| 14831 | * control_power_set_pgood: (skip) |
| 14832 | * @object: A #ControlPower. |
| 14833 | * @value: The value to set. |
| 14834 | * |
| 14835 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value. |
| 14836 | * |
| 14837 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 14838 | */ |
| 14839 | void |
| 14840 | control_power_set_pgood (ControlPower *object, gint value) |
| 14841 | { |
| 14842 | g_object_set (G_OBJECT (object), "pgood", value, NULL); |
| 14843 | } |
| 14844 | |
| 14845 | /** |
| 14846 | * control_power_get_state: (skip) |
| 14847 | * @object: A #ControlPower. |
| 14848 | * |
| 14849 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property. |
| 14850 | * |
| 14851 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 14852 | * |
| 14853 | * Returns: The property value. |
| 14854 | */ |
| 14855 | gint |
| 14856 | control_power_get_state (ControlPower *object) |
| 14857 | { |
| 14858 | return CONTROL_POWER_GET_IFACE (object)->get_state (object); |
| 14859 | } |
| 14860 | |
| 14861 | /** |
| 14862 | * control_power_set_state: (skip) |
| 14863 | * @object: A #ControlPower. |
| 14864 | * @value: The value to set. |
| 14865 | * |
| 14866 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value. |
| 14867 | * |
| 14868 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 14869 | */ |
| 14870 | void |
| 14871 | control_power_set_state (ControlPower *object, gint value) |
| 14872 | { |
| 14873 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 14874 | } |
| 14875 | |
| 14876 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 14877 | * control_power_get_pgood_timeout: (skip) |
| 14878 | * @object: A #ControlPower. |
| 14879 | * |
| 14880 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property. |
| 14881 | * |
| 14882 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14883 | * |
| 14884 | * Returns: The property value. |
| 14885 | */ |
| 14886 | gint |
| 14887 | control_power_get_pgood_timeout (ControlPower *object) |
| 14888 | { |
| 14889 | return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object); |
| 14890 | } |
| 14891 | |
| 14892 | /** |
| 14893 | * control_power_set_pgood_timeout: (skip) |
| 14894 | * @object: A #ControlPower. |
| 14895 | * @value: The value to set. |
| 14896 | * |
| 14897 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value. |
| 14898 | * |
| 14899 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14900 | */ |
| 14901 | void |
| 14902 | control_power_set_pgood_timeout (ControlPower *object, gint value) |
| 14903 | { |
| 14904 | g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL); |
| 14905 | } |
| 14906 | |
| 14907 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14908 | * control_power_emit_power_good: |
| 14909 | * @object: A #ControlPower. |
| 14910 | * |
| 14911 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal. |
| 14912 | */ |
| 14913 | void |
| 14914 | control_power_emit_power_good ( |
| 14915 | ControlPower *object) |
| 14916 | { |
| 14917 | g_signal_emit_by_name (object, "power-good"); |
| 14918 | } |
| 14919 | |
| 14920 | /** |
| 14921 | * control_power_emit_power_lost: |
| 14922 | * @object: A #ControlPower. |
| 14923 | * |
| 14924 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal. |
| 14925 | */ |
| 14926 | void |
| 14927 | control_power_emit_power_lost ( |
| 14928 | ControlPower *object) |
| 14929 | { |
| 14930 | g_signal_emit_by_name (object, "power-lost"); |
| 14931 | } |
| 14932 | |
| 14933 | /** |
| 14934 | * control_power_call_set_power_state: |
| 14935 | * @proxy: A #ControlPowerProxy. |
| 14936 | * @arg_state: Argument to pass with the method invocation. |
| 14937 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14938 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14939 | * @user_data: User data to pass to @callback. |
| 14940 | * |
| 14941 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. |
| 14942 | * 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. |
| 14943 | * You can then call control_power_call_set_power_state_finish() to get the result of the operation. |
| 14944 | * |
| 14945 | * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method. |
| 14946 | */ |
| 14947 | void |
| 14948 | control_power_call_set_power_state ( |
| 14949 | ControlPower *proxy, |
| 14950 | gint arg_state, |
| 14951 | GCancellable *cancellable, |
| 14952 | GAsyncReadyCallback callback, |
| 14953 | gpointer user_data) |
| 14954 | { |
| 14955 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14956 | "setPowerState", |
| 14957 | g_variant_new ("(i)", |
| 14958 | arg_state), |
| 14959 | G_DBUS_CALL_FLAGS_NONE, |
| 14960 | -1, |
| 14961 | cancellable, |
| 14962 | callback, |
| 14963 | user_data); |
| 14964 | } |
| 14965 | |
| 14966 | /** |
| 14967 | * control_power_call_set_power_state_finish: |
| 14968 | * @proxy: A #ControlPowerProxy. |
| 14969 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state(). |
| 14970 | * @error: Return location for error or %NULL. |
| 14971 | * |
| 14972 | * Finishes an operation started with control_power_call_set_power_state(). |
| 14973 | * |
| 14974 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14975 | */ |
| 14976 | gboolean |
| 14977 | control_power_call_set_power_state_finish ( |
| 14978 | ControlPower *proxy, |
| 14979 | GAsyncResult *res, |
| 14980 | GError **error) |
| 14981 | { |
| 14982 | GVariant *_ret; |
| 14983 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14984 | if (_ret == NULL) |
| 14985 | goto _out; |
| 14986 | g_variant_get (_ret, |
| 14987 | "()"); |
| 14988 | g_variant_unref (_ret); |
| 14989 | _out: |
| 14990 | return _ret != NULL; |
| 14991 | } |
| 14992 | |
| 14993 | /** |
| 14994 | * control_power_call_set_power_state_sync: |
| 14995 | * @proxy: A #ControlPowerProxy. |
| 14996 | * @arg_state: Argument to pass with the method invocation. |
| 14997 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14998 | * @error: Return location for error or %NULL. |
| 14999 | * |
| 15000 | * 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. |
| 15001 | * |
| 15002 | * See control_power_call_set_power_state() for the asynchronous version of this method. |
| 15003 | * |
| 15004 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15005 | */ |
| 15006 | gboolean |
| 15007 | control_power_call_set_power_state_sync ( |
| 15008 | ControlPower *proxy, |
| 15009 | gint arg_state, |
| 15010 | GCancellable *cancellable, |
| 15011 | GError **error) |
| 15012 | { |
| 15013 | GVariant *_ret; |
| 15014 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 15015 | "setPowerState", |
| 15016 | g_variant_new ("(i)", |
| 15017 | arg_state), |
| 15018 | G_DBUS_CALL_FLAGS_NONE, |
| 15019 | -1, |
| 15020 | cancellable, |
| 15021 | error); |
| 15022 | if (_ret == NULL) |
| 15023 | goto _out; |
| 15024 | g_variant_get (_ret, |
| 15025 | "()"); |
| 15026 | g_variant_unref (_ret); |
| 15027 | _out: |
| 15028 | return _ret != NULL; |
| 15029 | } |
| 15030 | |
| 15031 | /** |
| 15032 | * control_power_call_get_power_state: |
| 15033 | * @proxy: A #ControlPowerProxy. |
| 15034 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15035 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 15036 | * @user_data: User data to pass to @callback. |
| 15037 | * |
| 15038 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. |
| 15039 | * 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. |
| 15040 | * You can then call control_power_call_get_power_state_finish() to get the result of the operation. |
| 15041 | * |
| 15042 | * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method. |
| 15043 | */ |
| 15044 | void |
| 15045 | control_power_call_get_power_state ( |
| 15046 | ControlPower *proxy, |
| 15047 | GCancellable *cancellable, |
| 15048 | GAsyncReadyCallback callback, |
| 15049 | gpointer user_data) |
| 15050 | { |
| 15051 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 15052 | "getPowerState", |
| 15053 | g_variant_new ("()"), |
| 15054 | G_DBUS_CALL_FLAGS_NONE, |
| 15055 | -1, |
| 15056 | cancellable, |
| 15057 | callback, |
| 15058 | user_data); |
| 15059 | } |
| 15060 | |
| 15061 | /** |
| 15062 | * control_power_call_get_power_state_finish: |
| 15063 | * @proxy: A #ControlPowerProxy. |
| 15064 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 15065 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state(). |
| 15066 | * @error: Return location for error or %NULL. |
| 15067 | * |
| 15068 | * Finishes an operation started with control_power_call_get_power_state(). |
| 15069 | * |
| 15070 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15071 | */ |
| 15072 | gboolean |
| 15073 | control_power_call_get_power_state_finish ( |
| 15074 | ControlPower *proxy, |
| 15075 | gint *out_state, |
| 15076 | GAsyncResult *res, |
| 15077 | GError **error) |
| 15078 | { |
| 15079 | GVariant *_ret; |
| 15080 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 15081 | if (_ret == NULL) |
| 15082 | goto _out; |
| 15083 | g_variant_get (_ret, |
| 15084 | "(i)", |
| 15085 | out_state); |
| 15086 | g_variant_unref (_ret); |
| 15087 | _out: |
| 15088 | return _ret != NULL; |
| 15089 | } |
| 15090 | |
| 15091 | /** |
| 15092 | * control_power_call_get_power_state_sync: |
| 15093 | * @proxy: A #ControlPowerProxy. |
| 15094 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 15095 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15096 | * @error: Return location for error or %NULL. |
| 15097 | * |
| 15098 | * 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. |
| 15099 | * |
| 15100 | * See control_power_call_get_power_state() for the asynchronous version of this method. |
| 15101 | * |
| 15102 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15103 | */ |
| 15104 | gboolean |
| 15105 | control_power_call_get_power_state_sync ( |
| 15106 | ControlPower *proxy, |
| 15107 | gint *out_state, |
| 15108 | GCancellable *cancellable, |
| 15109 | GError **error) |
| 15110 | { |
| 15111 | GVariant *_ret; |
| 15112 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 15113 | "getPowerState", |
| 15114 | g_variant_new ("()"), |
| 15115 | G_DBUS_CALL_FLAGS_NONE, |
| 15116 | -1, |
| 15117 | cancellable, |
| 15118 | error); |
| 15119 | if (_ret == NULL) |
| 15120 | goto _out; |
| 15121 | g_variant_get (_ret, |
| 15122 | "(i)", |
| 15123 | out_state); |
| 15124 | g_variant_unref (_ret); |
| 15125 | _out: |
| 15126 | return _ret != NULL; |
| 15127 | } |
| 15128 | |
| 15129 | /** |
| 15130 | * control_power_complete_set_power_state: |
| 15131 | * @object: A #ControlPower. |
| 15132 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15133 | * |
| 15134 | * 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. |
| 15135 | * |
| 15136 | * This method will free @invocation, you cannot use it afterwards. |
| 15137 | */ |
| 15138 | void |
| 15139 | control_power_complete_set_power_state ( |
| 15140 | ControlPower *object, |
| 15141 | GDBusMethodInvocation *invocation) |
| 15142 | { |
| 15143 | g_dbus_method_invocation_return_value (invocation, |
| 15144 | g_variant_new ("()")); |
| 15145 | } |
| 15146 | |
| 15147 | /** |
| 15148 | * control_power_complete_get_power_state: |
| 15149 | * @object: A #ControlPower. |
| 15150 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15151 | * @state: Parameter to return. |
| 15152 | * |
| 15153 | * 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. |
| 15154 | * |
| 15155 | * This method will free @invocation, you cannot use it afterwards. |
| 15156 | */ |
| 15157 | void |
| 15158 | control_power_complete_get_power_state ( |
| 15159 | ControlPower *object, |
| 15160 | GDBusMethodInvocation *invocation, |
| 15161 | gint state) |
| 15162 | { |
| 15163 | g_dbus_method_invocation_return_value (invocation, |
| 15164 | g_variant_new ("(i)", |
| 15165 | state)); |
| 15166 | } |
| 15167 | |
| 15168 | /* ------------------------------------------------------------------------ */ |
| 15169 | |
| 15170 | /** |
| 15171 | * ControlPowerProxy: |
| 15172 | * |
| 15173 | * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API. |
| 15174 | */ |
| 15175 | |
| 15176 | /** |
| 15177 | * ControlPowerProxyClass: |
| 15178 | * @parent_class: The parent class. |
| 15179 | * |
| 15180 | * Class structure for #ControlPowerProxy. |
| 15181 | */ |
| 15182 | |
| 15183 | struct _ControlPowerProxyPrivate |
| 15184 | { |
| 15185 | GData *qdata; |
| 15186 | }; |
| 15187 | |
| 15188 | static void control_power_proxy_iface_init (ControlPowerIface *iface); |
| 15189 | |
| 15190 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15191 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 15192 | G_ADD_PRIVATE (ControlPowerProxy) |
| 15193 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 15194 | |
| 15195 | #else |
| 15196 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 15197 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 15198 | |
| 15199 | #endif |
| 15200 | static void |
| 15201 | control_power_proxy_finalize (GObject *object) |
| 15202 | { |
| 15203 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15204 | g_datalist_clear (&proxy->priv->qdata); |
| 15205 | G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object); |
| 15206 | } |
| 15207 | |
| 15208 | static void |
| 15209 | control_power_proxy_get_property (GObject *object, |
| 15210 | guint prop_id, |
| 15211 | GValue *value, |
| 15212 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15213 | { |
| 15214 | const _ExtendedGDBusPropertyInfo *info; |
| 15215 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15216 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15217 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 15218 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 15219 | if (info->use_gvariant) |
| 15220 | { |
| 15221 | g_value_set_variant (value, variant); |
| 15222 | } |
| 15223 | else |
| 15224 | { |
| 15225 | if (variant != NULL) |
| 15226 | g_dbus_gvariant_to_gvalue (variant, value); |
| 15227 | } |
| 15228 | if (variant != NULL) |
| 15229 | g_variant_unref (variant); |
| 15230 | } |
| 15231 | |
| 15232 | static void |
| 15233 | control_power_proxy_set_property_cb (GDBusProxy *proxy, |
| 15234 | GAsyncResult *res, |
| 15235 | gpointer user_data) |
| 15236 | { |
| 15237 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 15238 | GError *error; |
| 15239 | GVariant *_ret; |
| 15240 | error = NULL; |
| 15241 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 15242 | if (!_ret) |
| 15243 | { |
| 15244 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)", |
| 15245 | info->parent_struct.name, |
| 15246 | error->message, g_quark_to_string (error->domain), error->code); |
| 15247 | g_error_free (error); |
| 15248 | } |
| 15249 | else |
| 15250 | { |
| 15251 | g_variant_unref (_ret); |
| 15252 | } |
| 15253 | } |
| 15254 | |
| 15255 | static void |
| 15256 | control_power_proxy_set_property (GObject *object, |
| 15257 | guint prop_id, |
| 15258 | const GValue *value, |
| 15259 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15260 | { |
| 15261 | const _ExtendedGDBusPropertyInfo *info; |
| 15262 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15263 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15264 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 15265 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15266 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 15267 | "org.freedesktop.DBus.Properties.Set", |
| 15268 | g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant), |
| 15269 | G_DBUS_CALL_FLAGS_NONE, |
| 15270 | -1, |
| 15271 | NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 15272 | g_variant_unref (variant); |
| 15273 | } |
| 15274 | |
| 15275 | static void |
| 15276 | control_power_proxy_g_signal (GDBusProxy *proxy, |
| 15277 | const gchar *sender_name G_GNUC_UNUSED, |
| 15278 | const gchar *signal_name, |
| 15279 | GVariant *parameters) |
| 15280 | { |
| 15281 | _ExtendedGDBusSignalInfo *info; |
| 15282 | GVariantIter iter; |
| 15283 | GVariant *child; |
| 15284 | GValue *paramv; |
| 15285 | guint num_params; |
| 15286 | guint n; |
| 15287 | guint signal_id; |
| 15288 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name); |
| 15289 | if (info == NULL) |
| 15290 | return; |
| 15291 | num_params = g_variant_n_children (parameters); |
| 15292 | paramv = g_new0 (GValue, num_params + 1); |
| 15293 | g_value_init (¶mv[0], TYPE_CONTROL_POWER); |
| 15294 | g_value_set_object (¶mv[0], proxy); |
| 15295 | g_variant_iter_init (&iter, parameters); |
| 15296 | n = 1; |
| 15297 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15298 | { |
| 15299 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 15300 | if (arg_info->use_gvariant) |
| 15301 | { |
| 15302 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15303 | g_value_set_variant (¶mv[n], child); |
| 15304 | n++; |
| 15305 | } |
| 15306 | else |
| 15307 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15308 | g_variant_unref (child); |
| 15309 | } |
| 15310 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 15311 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 15312 | for (n = 0; n < num_params + 1; n++) |
| 15313 | g_value_unset (¶mv[n]); |
| 15314 | g_free (paramv); |
| 15315 | } |
| 15316 | |
| 15317 | static void |
| 15318 | control_power_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 15319 | GVariant *changed_properties, |
| 15320 | const gchar *const *invalidated_properties) |
| 15321 | { |
| 15322 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy); |
| 15323 | guint n; |
| 15324 | const gchar *key; |
| 15325 | GVariantIter *iter; |
| 15326 | _ExtendedGDBusPropertyInfo *info; |
| 15327 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 15328 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 15329 | { |
| 15330 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key); |
| 15331 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 15332 | if (info != NULL) |
| 15333 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 15334 | } |
| 15335 | g_variant_iter_free (iter); |
| 15336 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 15337 | { |
| 15338 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]); |
| 15339 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 15340 | if (info != NULL) |
| 15341 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 15342 | } |
| 15343 | } |
| 15344 | |
| 15345 | static gint |
| 15346 | control_power_proxy_get_pgood (ControlPower *object) |
| 15347 | { |
| 15348 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15349 | GVariant *variant; |
| 15350 | gint value = 0; |
| 15351 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood"); |
| 15352 | if (variant != NULL) |
| 15353 | { |
| 15354 | value = g_variant_get_int32 (variant); |
| 15355 | g_variant_unref (variant); |
| 15356 | } |
| 15357 | return value; |
| 15358 | } |
| 15359 | |
| 15360 | static gint |
| 15361 | control_power_proxy_get_state (ControlPower *object) |
| 15362 | { |
| 15363 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15364 | GVariant *variant; |
| 15365 | gint value = 0; |
| 15366 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 15367 | if (variant != NULL) |
| 15368 | { |
| 15369 | value = g_variant_get_int32 (variant); |
| 15370 | g_variant_unref (variant); |
| 15371 | } |
| 15372 | return value; |
| 15373 | } |
| 15374 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15375 | static gint |
| 15376 | control_power_proxy_get_pgood_timeout (ControlPower *object) |
| 15377 | { |
| 15378 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 15379 | GVariant *variant; |
| 15380 | gint value = 0; |
| 15381 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout"); |
| 15382 | if (variant != NULL) |
| 15383 | { |
| 15384 | value = g_variant_get_int32 (variant); |
| 15385 | g_variant_unref (variant); |
| 15386 | } |
| 15387 | return value; |
| 15388 | } |
| 15389 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15390 | static void |
| 15391 | control_power_proxy_init (ControlPowerProxy *proxy) |
| 15392 | { |
| 15393 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15394 | proxy->priv = control_power_proxy_get_instance_private (proxy); |
| 15395 | #else |
| 15396 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate); |
| 15397 | #endif |
| 15398 | |
| 15399 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ()); |
| 15400 | } |
| 15401 | |
| 15402 | static void |
| 15403 | control_power_proxy_class_init (ControlPowerProxyClass *klass) |
| 15404 | { |
| 15405 | GObjectClass *gobject_class; |
| 15406 | GDBusProxyClass *proxy_class; |
| 15407 | |
| 15408 | gobject_class = G_OBJECT_CLASS (klass); |
| 15409 | gobject_class->finalize = control_power_proxy_finalize; |
| 15410 | gobject_class->get_property = control_power_proxy_get_property; |
| 15411 | gobject_class->set_property = control_power_proxy_set_property; |
| 15412 | |
| 15413 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 15414 | proxy_class->g_signal = control_power_proxy_g_signal; |
| 15415 | proxy_class->g_properties_changed = control_power_proxy_g_properties_changed; |
| 15416 | |
| 15417 | control_power_override_properties (gobject_class, 1); |
| 15418 | |
| 15419 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 15420 | g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate)); |
| 15421 | #endif |
| 15422 | } |
| 15423 | |
| 15424 | static void |
| 15425 | control_power_proxy_iface_init (ControlPowerIface *iface) |
| 15426 | { |
| 15427 | iface->get_pgood = control_power_proxy_get_pgood; |
| 15428 | iface->get_state = control_power_proxy_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15429 | iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15430 | } |
| 15431 | |
| 15432 | /** |
| 15433 | * control_power_proxy_new: |
| 15434 | * @connection: A #GDBusConnection. |
| 15435 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15436 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15437 | * @object_path: An object path. |
| 15438 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15439 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15440 | * @user_data: User data to pass to @callback. |
| 15441 | * |
| 15442 | * 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. |
| 15443 | * |
| 15444 | * 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. |
| 15445 | * You can then call control_power_proxy_new_finish() to get the result of the operation. |
| 15446 | * |
| 15447 | * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 15448 | */ |
| 15449 | void |
| 15450 | control_power_proxy_new ( |
| 15451 | GDBusConnection *connection, |
| 15452 | GDBusProxyFlags flags, |
| 15453 | const gchar *name, |
| 15454 | const gchar *object_path, |
| 15455 | GCancellable *cancellable, |
| 15456 | GAsyncReadyCallback callback, |
| 15457 | gpointer user_data) |
| 15458 | { |
| 15459 | 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); |
| 15460 | } |
| 15461 | |
| 15462 | /** |
| 15463 | * control_power_proxy_new_finish: |
| 15464 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new(). |
| 15465 | * @error: Return location for error or %NULL |
| 15466 | * |
| 15467 | * Finishes an operation started with control_power_proxy_new(). |
| 15468 | * |
| 15469 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15470 | */ |
| 15471 | ControlPower * |
| 15472 | control_power_proxy_new_finish ( |
| 15473 | GAsyncResult *res, |
| 15474 | GError **error) |
| 15475 | { |
| 15476 | GObject *ret; |
| 15477 | GObject *source_object; |
| 15478 | source_object = g_async_result_get_source_object (res); |
| 15479 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15480 | g_object_unref (source_object); |
| 15481 | if (ret != NULL) |
| 15482 | return CONTROL_POWER (ret); |
| 15483 | else |
| 15484 | return NULL; |
| 15485 | } |
| 15486 | |
| 15487 | /** |
| 15488 | * control_power_proxy_new_sync: |
| 15489 | * @connection: A #GDBusConnection. |
| 15490 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15491 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15492 | * @object_path: An object path. |
| 15493 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15494 | * @error: Return location for error or %NULL |
| 15495 | * |
| 15496 | * 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. |
| 15497 | * |
| 15498 | * The calling thread is blocked until a reply is received. |
| 15499 | * |
| 15500 | * See control_power_proxy_new() for the asynchronous version of this constructor. |
| 15501 | * |
| 15502 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15503 | */ |
| 15504 | ControlPower * |
| 15505 | control_power_proxy_new_sync ( |
| 15506 | GDBusConnection *connection, |
| 15507 | GDBusProxyFlags flags, |
| 15508 | const gchar *name, |
| 15509 | const gchar *object_path, |
| 15510 | GCancellable *cancellable, |
| 15511 | GError **error) |
| 15512 | { |
| 15513 | GInitable *ret; |
| 15514 | 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); |
| 15515 | if (ret != NULL) |
| 15516 | return CONTROL_POWER (ret); |
| 15517 | else |
| 15518 | return NULL; |
| 15519 | } |
| 15520 | |
| 15521 | |
| 15522 | /** |
| 15523 | * control_power_proxy_new_for_bus: |
| 15524 | * @bus_type: A #GBusType. |
| 15525 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15526 | * @name: A bus name (well-known or unique). |
| 15527 | * @object_path: An object path. |
| 15528 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15529 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15530 | * @user_data: User data to pass to @callback. |
| 15531 | * |
| 15532 | * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 15533 | * |
| 15534 | * 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. |
| 15535 | * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation. |
| 15536 | * |
| 15537 | * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 15538 | */ |
| 15539 | void |
| 15540 | control_power_proxy_new_for_bus ( |
| 15541 | GBusType bus_type, |
| 15542 | GDBusProxyFlags flags, |
| 15543 | const gchar *name, |
| 15544 | const gchar *object_path, |
| 15545 | GCancellable *cancellable, |
| 15546 | GAsyncReadyCallback callback, |
| 15547 | gpointer user_data) |
| 15548 | { |
| 15549 | 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); |
| 15550 | } |
| 15551 | |
| 15552 | /** |
| 15553 | * control_power_proxy_new_for_bus_finish: |
| 15554 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus(). |
| 15555 | * @error: Return location for error or %NULL |
| 15556 | * |
| 15557 | * Finishes an operation started with control_power_proxy_new_for_bus(). |
| 15558 | * |
| 15559 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15560 | */ |
| 15561 | ControlPower * |
| 15562 | control_power_proxy_new_for_bus_finish ( |
| 15563 | GAsyncResult *res, |
| 15564 | GError **error) |
| 15565 | { |
| 15566 | GObject *ret; |
| 15567 | GObject *source_object; |
| 15568 | source_object = g_async_result_get_source_object (res); |
| 15569 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15570 | g_object_unref (source_object); |
| 15571 | if (ret != NULL) |
| 15572 | return CONTROL_POWER (ret); |
| 15573 | else |
| 15574 | return NULL; |
| 15575 | } |
| 15576 | |
| 15577 | /** |
| 15578 | * control_power_proxy_new_for_bus_sync: |
| 15579 | * @bus_type: A #GBusType. |
| 15580 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15581 | * @name: A bus name (well-known or unique). |
| 15582 | * @object_path: An object path. |
| 15583 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15584 | * @error: Return location for error or %NULL |
| 15585 | * |
| 15586 | * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 15587 | * |
| 15588 | * The calling thread is blocked until a reply is received. |
| 15589 | * |
| 15590 | * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 15591 | * |
| 15592 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 15593 | */ |
| 15594 | ControlPower * |
| 15595 | control_power_proxy_new_for_bus_sync ( |
| 15596 | GBusType bus_type, |
| 15597 | GDBusProxyFlags flags, |
| 15598 | const gchar *name, |
| 15599 | const gchar *object_path, |
| 15600 | GCancellable *cancellable, |
| 15601 | GError **error) |
| 15602 | { |
| 15603 | GInitable *ret; |
| 15604 | 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); |
| 15605 | if (ret != NULL) |
| 15606 | return CONTROL_POWER (ret); |
| 15607 | else |
| 15608 | return NULL; |
| 15609 | } |
| 15610 | |
| 15611 | |
| 15612 | /* ------------------------------------------------------------------------ */ |
| 15613 | |
| 15614 | /** |
| 15615 | * ControlPowerSkeleton: |
| 15616 | * |
| 15617 | * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API. |
| 15618 | */ |
| 15619 | |
| 15620 | /** |
| 15621 | * ControlPowerSkeletonClass: |
| 15622 | * @parent_class: The parent class. |
| 15623 | * |
| 15624 | * Class structure for #ControlPowerSkeleton. |
| 15625 | */ |
| 15626 | |
| 15627 | struct _ControlPowerSkeletonPrivate |
| 15628 | { |
| 15629 | GValue *properties; |
| 15630 | GList *changed_properties; |
| 15631 | GSource *changed_properties_idle_source; |
| 15632 | GMainContext *context; |
| 15633 | GMutex lock; |
| 15634 | }; |
| 15635 | |
| 15636 | static void |
| 15637 | _control_power_skeleton_handle_method_call ( |
| 15638 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15639 | const gchar *sender G_GNUC_UNUSED, |
| 15640 | const gchar *object_path G_GNUC_UNUSED, |
| 15641 | const gchar *interface_name, |
| 15642 | const gchar *method_name, |
| 15643 | GVariant *parameters, |
| 15644 | GDBusMethodInvocation *invocation, |
| 15645 | gpointer user_data) |
| 15646 | { |
| 15647 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15648 | _ExtendedGDBusMethodInfo *info; |
| 15649 | GVariantIter iter; |
| 15650 | GVariant *child; |
| 15651 | GValue *paramv; |
| 15652 | guint num_params; |
| 15653 | guint num_extra; |
| 15654 | guint n; |
| 15655 | guint signal_id; |
| 15656 | GValue return_value = G_VALUE_INIT; |
| 15657 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 15658 | g_assert (info != NULL); |
| 15659 | num_params = g_variant_n_children (parameters); |
| 15660 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 15661 | n = 0; |
| 15662 | g_value_init (¶mv[n], TYPE_CONTROL_POWER); |
| 15663 | g_value_set_object (¶mv[n++], skeleton); |
| 15664 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 15665 | g_value_set_object (¶mv[n++], invocation); |
| 15666 | if (info->pass_fdlist) |
| 15667 | { |
| 15668 | #ifdef G_OS_UNIX |
| 15669 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 15670 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 15671 | #else |
| 15672 | g_assert_not_reached (); |
| 15673 | #endif |
| 15674 | } |
| 15675 | g_variant_iter_init (&iter, parameters); |
| 15676 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15677 | { |
| 15678 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 15679 | if (arg_info->use_gvariant) |
| 15680 | { |
| 15681 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15682 | g_value_set_variant (¶mv[n], child); |
| 15683 | n++; |
| 15684 | } |
| 15685 | else |
| 15686 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15687 | g_variant_unref (child); |
| 15688 | } |
| 15689 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 15690 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 15691 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 15692 | if (!g_value_get_boolean (&return_value)) |
| 15693 | 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); |
| 15694 | g_value_unset (&return_value); |
| 15695 | for (n = 0; n < num_params + num_extra; n++) |
| 15696 | g_value_unset (¶mv[n]); |
| 15697 | g_free (paramv); |
| 15698 | } |
| 15699 | |
| 15700 | static GVariant * |
| 15701 | _control_power_skeleton_handle_get_property ( |
| 15702 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15703 | const gchar *sender G_GNUC_UNUSED, |
| 15704 | const gchar *object_path G_GNUC_UNUSED, |
| 15705 | const gchar *interface_name G_GNUC_UNUSED, |
| 15706 | const gchar *property_name, |
| 15707 | GError **error, |
| 15708 | gpointer user_data) |
| 15709 | { |
| 15710 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15711 | GValue value = G_VALUE_INIT; |
| 15712 | GParamSpec *pspec; |
| 15713 | _ExtendedGDBusPropertyInfo *info; |
| 15714 | GVariant *ret; |
| 15715 | ret = NULL; |
| 15716 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 15717 | g_assert (info != NULL); |
| 15718 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15719 | if (pspec == NULL) |
| 15720 | { |
| 15721 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15722 | } |
| 15723 | else |
| 15724 | { |
| 15725 | g_value_init (&value, pspec->value_type); |
| 15726 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15727 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15728 | g_value_unset (&value); |
| 15729 | } |
| 15730 | return ret; |
| 15731 | } |
| 15732 | |
| 15733 | static gboolean |
| 15734 | _control_power_skeleton_handle_set_property ( |
| 15735 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15736 | const gchar *sender G_GNUC_UNUSED, |
| 15737 | const gchar *object_path G_GNUC_UNUSED, |
| 15738 | const gchar *interface_name G_GNUC_UNUSED, |
| 15739 | const gchar *property_name, |
| 15740 | GVariant *variant, |
| 15741 | GError **error, |
| 15742 | gpointer user_data) |
| 15743 | { |
| 15744 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15745 | GValue value = G_VALUE_INIT; |
| 15746 | GParamSpec *pspec; |
| 15747 | _ExtendedGDBusPropertyInfo *info; |
| 15748 | gboolean ret; |
| 15749 | ret = FALSE; |
| 15750 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 15751 | g_assert (info != NULL); |
| 15752 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15753 | if (pspec == NULL) |
| 15754 | { |
| 15755 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15756 | } |
| 15757 | else |
| 15758 | { |
| 15759 | if (info->use_gvariant) |
| 15760 | g_value_set_variant (&value, variant); |
| 15761 | else |
| 15762 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 15763 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15764 | g_value_unset (&value); |
| 15765 | ret = TRUE; |
| 15766 | } |
| 15767 | return ret; |
| 15768 | } |
| 15769 | |
| 15770 | static const GDBusInterfaceVTable _control_power_skeleton_vtable = |
| 15771 | { |
| 15772 | _control_power_skeleton_handle_method_call, |
| 15773 | _control_power_skeleton_handle_get_property, |
| 15774 | _control_power_skeleton_handle_set_property, |
| 15775 | {NULL} |
| 15776 | }; |
| 15777 | |
| 15778 | static GDBusInterfaceInfo * |
| 15779 | control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15780 | { |
| 15781 | return control_power_interface_info (); |
| 15782 | } |
| 15783 | |
| 15784 | static GDBusInterfaceVTable * |
| 15785 | control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15786 | { |
| 15787 | return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable; |
| 15788 | } |
| 15789 | |
| 15790 | static GVariant * |
| 15791 | control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 15792 | { |
| 15793 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 15794 | |
| 15795 | GVariantBuilder builder; |
| 15796 | guint n; |
| 15797 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15798 | if (_control_power_interface_info.parent_struct.properties == NULL) |
| 15799 | goto out; |
| 15800 | for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++) |
| 15801 | { |
| 15802 | GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n]; |
| 15803 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 15804 | { |
| 15805 | GVariant *value; |
| 15806 | 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); |
| 15807 | if (value != NULL) |
| 15808 | { |
| 15809 | g_variant_take_ref (value); |
| 15810 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 15811 | g_variant_unref (value); |
| 15812 | } |
| 15813 | } |
| 15814 | } |
| 15815 | out: |
| 15816 | return g_variant_builder_end (&builder); |
| 15817 | } |
| 15818 | |
| 15819 | static gboolean _control_power_emit_changed (gpointer user_data); |
| 15820 | |
| 15821 | static void |
| 15822 | control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 15823 | { |
| 15824 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 15825 | gboolean emit_changed = FALSE; |
| 15826 | |
| 15827 | g_mutex_lock (&skeleton->priv->lock); |
| 15828 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15829 | { |
| 15830 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15831 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15832 | emit_changed = TRUE; |
| 15833 | } |
| 15834 | g_mutex_unlock (&skeleton->priv->lock); |
| 15835 | |
| 15836 | if (emit_changed) |
| 15837 | _control_power_emit_changed (skeleton); |
| 15838 | } |
| 15839 | |
| 15840 | static void |
| 15841 | _control_power_on_signal_power_good ( |
| 15842 | ControlPower *object) |
| 15843 | { |
| 15844 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15845 | |
| 15846 | GList *connections, *l; |
| 15847 | GVariant *signal_variant; |
| 15848 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15849 | |
| 15850 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 15851 | for (l = connections; l != NULL; l = l->next) |
| 15852 | { |
| 15853 | GDBusConnection *connection = l->data; |
| 15854 | g_dbus_connection_emit_signal (connection, |
| 15855 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood", |
| 15856 | signal_variant, NULL); |
| 15857 | } |
| 15858 | g_variant_unref (signal_variant); |
| 15859 | g_list_free_full (connections, g_object_unref); |
| 15860 | } |
| 15861 | |
| 15862 | static void |
| 15863 | _control_power_on_signal_power_lost ( |
| 15864 | ControlPower *object) |
| 15865 | { |
| 15866 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15867 | |
| 15868 | GList *connections, *l; |
| 15869 | GVariant *signal_variant; |
| 15870 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15871 | |
| 15872 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 15873 | for (l = connections; l != NULL; l = l->next) |
| 15874 | { |
| 15875 | GDBusConnection *connection = l->data; |
| 15876 | g_dbus_connection_emit_signal (connection, |
| 15877 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost", |
| 15878 | signal_variant, NULL); |
| 15879 | } |
| 15880 | g_variant_unref (signal_variant); |
| 15881 | g_list_free_full (connections, g_object_unref); |
| 15882 | } |
| 15883 | |
| 15884 | static void control_power_skeleton_iface_init (ControlPowerIface *iface); |
| 15885 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15886 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15887 | G_ADD_PRIVATE (ControlPowerSkeleton) |
| 15888 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 15889 | |
| 15890 | #else |
| 15891 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15892 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 15893 | |
| 15894 | #endif |
| 15895 | static void |
| 15896 | control_power_skeleton_finalize (GObject *object) |
| 15897 | { |
| 15898 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 15899 | guint n; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15900 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15901 | g_value_unset (&skeleton->priv->properties[n]); |
| 15902 | g_free (skeleton->priv->properties); |
| 15903 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15904 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15905 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15906 | g_main_context_unref (skeleton->priv->context); |
| 15907 | g_mutex_clear (&skeleton->priv->lock); |
| 15908 | G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object); |
| 15909 | } |
| 15910 | |
| 15911 | static void |
| 15912 | control_power_skeleton_get_property (GObject *object, |
| 15913 | guint prop_id, |
| 15914 | GValue *value, |
| 15915 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15916 | { |
| 15917 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15918 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15919 | g_mutex_lock (&skeleton->priv->lock); |
| 15920 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 15921 | g_mutex_unlock (&skeleton->priv->lock); |
| 15922 | } |
| 15923 | |
| 15924 | static gboolean |
| 15925 | _control_power_emit_changed (gpointer user_data) |
| 15926 | { |
| 15927 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 15928 | GList *l; |
| 15929 | GVariantBuilder builder; |
| 15930 | GVariantBuilder invalidated_builder; |
| 15931 | guint num_changes; |
| 15932 | |
| 15933 | g_mutex_lock (&skeleton->priv->lock); |
| 15934 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15935 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 15936 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 15937 | { |
| 15938 | ChangedProperty *cp = l->data; |
| 15939 | GVariant *variant; |
| 15940 | const GValue *cur_value; |
| 15941 | |
| 15942 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 15943 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 15944 | { |
| 15945 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 15946 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 15947 | g_variant_unref (variant); |
| 15948 | num_changes++; |
| 15949 | } |
| 15950 | } |
| 15951 | if (num_changes > 0) |
| 15952 | { |
| 15953 | GList *connections, *ll; |
| 15954 | GVariant *signal_variant; |
| 15955 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power", |
| 15956 | &builder, &invalidated_builder)); |
| 15957 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15958 | for (ll = connections; ll != NULL; ll = ll->next) |
| 15959 | { |
| 15960 | GDBusConnection *connection = ll->data; |
| 15961 | |
| 15962 | g_dbus_connection_emit_signal (connection, |
| 15963 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 15964 | "org.freedesktop.DBus.Properties", |
| 15965 | "PropertiesChanged", |
| 15966 | signal_variant, |
| 15967 | NULL); |
| 15968 | } |
| 15969 | g_variant_unref (signal_variant); |
| 15970 | g_list_free_full (connections, g_object_unref); |
| 15971 | } |
| 15972 | else |
| 15973 | { |
| 15974 | g_variant_builder_clear (&builder); |
| 15975 | g_variant_builder_clear (&invalidated_builder); |
| 15976 | } |
| 15977 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15978 | skeleton->priv->changed_properties = NULL; |
| 15979 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15980 | g_mutex_unlock (&skeleton->priv->lock); |
| 15981 | return FALSE; |
| 15982 | } |
| 15983 | |
| 15984 | static void |
| 15985 | _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 15986 | { |
| 15987 | ChangedProperty *cp; |
| 15988 | GList *l; |
| 15989 | cp = NULL; |
| 15990 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 15991 | { |
| 15992 | ChangedProperty *i_cp = l->data; |
| 15993 | if (i_cp->info == info) |
| 15994 | { |
| 15995 | cp = i_cp; |
| 15996 | break; |
| 15997 | } |
| 15998 | } |
| 15999 | if (cp == NULL) |
| 16000 | { |
| 16001 | cp = g_new0 (ChangedProperty, 1); |
| 16002 | cp->prop_id = prop_id; |
| 16003 | cp->info = info; |
| 16004 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 16005 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 16006 | g_value_copy (orig_value, &cp->orig_value); |
| 16007 | } |
| 16008 | } |
| 16009 | |
| 16010 | static void |
| 16011 | control_power_skeleton_notify (GObject *object, |
| 16012 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16013 | { |
| 16014 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 16015 | g_mutex_lock (&skeleton->priv->lock); |
| 16016 | if (skeleton->priv->changed_properties != NULL && |
| 16017 | skeleton->priv->changed_properties_idle_source == NULL) |
| 16018 | { |
| 16019 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 16020 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 16021 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 16022 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 16023 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 16024 | } |
| 16025 | g_mutex_unlock (&skeleton->priv->lock); |
| 16026 | } |
| 16027 | |
| 16028 | static void |
| 16029 | control_power_skeleton_set_property (GObject *object, |
| 16030 | guint prop_id, |
| 16031 | const GValue *value, |
| 16032 | GParamSpec *pspec) |
| 16033 | { |
| 16034 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16035 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16036 | g_mutex_lock (&skeleton->priv->lock); |
| 16037 | g_object_freeze_notify (object); |
| 16038 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 16039 | { |
| 16040 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 16041 | _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 16042 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 16043 | g_object_notify_by_pspec (object, pspec); |
| 16044 | } |
| 16045 | g_mutex_unlock (&skeleton->priv->lock); |
| 16046 | g_object_thaw_notify (object); |
| 16047 | } |
| 16048 | |
| 16049 | static void |
| 16050 | control_power_skeleton_init (ControlPowerSkeleton *skeleton) |
| 16051 | { |
| 16052 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16053 | skeleton->priv = control_power_skeleton_get_instance_private (skeleton); |
| 16054 | #else |
| 16055 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate); |
| 16056 | #endif |
| 16057 | |
| 16058 | g_mutex_init (&skeleton->priv->lock); |
| 16059 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16060 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16061 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 16062 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16063 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16064 | } |
| 16065 | |
| 16066 | static gint |
| 16067 | control_power_skeleton_get_pgood (ControlPower *object) |
| 16068 | { |
| 16069 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 16070 | gint value; |
| 16071 | g_mutex_lock (&skeleton->priv->lock); |
| 16072 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 16073 | g_mutex_unlock (&skeleton->priv->lock); |
| 16074 | return value; |
| 16075 | } |
| 16076 | |
| 16077 | static gint |
| 16078 | control_power_skeleton_get_state (ControlPower *object) |
| 16079 | { |
| 16080 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 16081 | gint value; |
| 16082 | g_mutex_lock (&skeleton->priv->lock); |
| 16083 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 16084 | g_mutex_unlock (&skeleton->priv->lock); |
| 16085 | return value; |
| 16086 | } |
| 16087 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16088 | static gint |
| 16089 | control_power_skeleton_get_pgood_timeout (ControlPower *object) |
| 16090 | { |
| 16091 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 16092 | gint value; |
| 16093 | g_mutex_lock (&skeleton->priv->lock); |
| 16094 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 16095 | g_mutex_unlock (&skeleton->priv->lock); |
| 16096 | return value; |
| 16097 | } |
| 16098 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16099 | static void |
| 16100 | control_power_skeleton_class_init (ControlPowerSkeletonClass *klass) |
| 16101 | { |
| 16102 | GObjectClass *gobject_class; |
| 16103 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 16104 | |
| 16105 | gobject_class = G_OBJECT_CLASS (klass); |
| 16106 | gobject_class->finalize = control_power_skeleton_finalize; |
| 16107 | gobject_class->get_property = control_power_skeleton_get_property; |
| 16108 | gobject_class->set_property = control_power_skeleton_set_property; |
| 16109 | gobject_class->notify = control_power_skeleton_notify; |
| 16110 | |
| 16111 | |
| 16112 | control_power_override_properties (gobject_class, 1); |
| 16113 | |
| 16114 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 16115 | skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info; |
| 16116 | skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties; |
| 16117 | skeleton_class->flush = control_power_skeleton_dbus_interface_flush; |
| 16118 | skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable; |
| 16119 | |
| 16120 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16121 | g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate)); |
| 16122 | #endif |
| 16123 | } |
| 16124 | |
| 16125 | static void |
| 16126 | control_power_skeleton_iface_init (ControlPowerIface *iface) |
| 16127 | { |
| 16128 | iface->power_good = _control_power_on_signal_power_good; |
| 16129 | iface->power_lost = _control_power_on_signal_power_lost; |
| 16130 | iface->get_pgood = control_power_skeleton_get_pgood; |
| 16131 | iface->get_state = control_power_skeleton_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16132 | iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16133 | } |
| 16134 | |
| 16135 | /** |
| 16136 | * control_power_skeleton_new: |
| 16137 | * |
| 16138 | * 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>. |
| 16139 | * |
| 16140 | * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object. |
| 16141 | */ |
| 16142 | ControlPower * |
| 16143 | control_power_skeleton_new (void) |
| 16144 | { |
| 16145 | return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL)); |
| 16146 | } |
| 16147 | |
| 16148 | /* ------------------------------------------------------------------------ |
| 16149 | * Code for interface org.openbmc.Watchdog |
| 16150 | * ------------------------------------------------------------------------ |
| 16151 | */ |
| 16152 | |
| 16153 | /** |
| 16154 | * SECTION:Watchdog |
| 16155 | * @title: Watchdog |
| 16156 | * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface |
| 16157 | * |
| 16158 | * 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. |
| 16159 | */ |
| 16160 | |
| 16161 | /* ---- Introspection data for org.openbmc.Watchdog ---- */ |
| 16162 | |
| 16163 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = |
| 16164 | { |
| 16165 | { |
| 16166 | -1, |
| 16167 | (gchar *) "start", |
| 16168 | NULL, |
| 16169 | NULL, |
| 16170 | NULL |
| 16171 | }, |
| 16172 | "handle-start", |
| 16173 | FALSE |
| 16174 | }; |
| 16175 | |
| 16176 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = |
| 16177 | { |
| 16178 | { |
| 16179 | -1, |
| 16180 | (gchar *) "poke", |
| 16181 | NULL, |
| 16182 | NULL, |
| 16183 | NULL |
| 16184 | }, |
| 16185 | "handle-poke", |
| 16186 | FALSE |
| 16187 | }; |
| 16188 | |
| 16189 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = |
| 16190 | { |
| 16191 | { |
| 16192 | -1, |
| 16193 | (gchar *) "stop", |
| 16194 | NULL, |
| 16195 | NULL, |
| 16196 | NULL |
| 16197 | }, |
| 16198 | "handle-stop", |
| 16199 | FALSE |
| 16200 | }; |
| 16201 | |
| 16202 | static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = |
| 16203 | { |
| 16204 | &_watchdog_method_info_start, |
| 16205 | &_watchdog_method_info_poke, |
| 16206 | &_watchdog_method_info_stop, |
| 16207 | NULL |
| 16208 | }; |
| 16209 | |
| 16210 | static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = |
| 16211 | { |
| 16212 | { |
| 16213 | -1, |
| 16214 | (gchar *) "WatchdogError", |
| 16215 | NULL, |
| 16216 | NULL |
| 16217 | }, |
| 16218 | "watchdog-error" |
| 16219 | }; |
| 16220 | |
| 16221 | static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = |
| 16222 | { |
| 16223 | &_watchdog_signal_info_watchdog_error, |
| 16224 | NULL |
| 16225 | }; |
| 16226 | |
| 16227 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = |
| 16228 | { |
| 16229 | { |
| 16230 | -1, |
| 16231 | (gchar *) "watchdog", |
| 16232 | (gchar *) "i", |
| 16233 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 16234 | NULL |
| 16235 | }, |
| 16236 | "watchdog", |
| 16237 | FALSE |
| 16238 | }; |
| 16239 | |
| 16240 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = |
| 16241 | { |
| 16242 | { |
| 16243 | -1, |
| 16244 | (gchar *) "poll_interval", |
| 16245 | (gchar *) "i", |
| 16246 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 16247 | NULL |
| 16248 | }, |
| 16249 | "poll-interval", |
| 16250 | FALSE |
| 16251 | }; |
| 16252 | |
| 16253 | static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = |
| 16254 | { |
| 16255 | &_watchdog_property_info_watchdog, |
| 16256 | &_watchdog_property_info_poll_interval, |
| 16257 | NULL |
| 16258 | }; |
| 16259 | |
| 16260 | static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = |
| 16261 | { |
| 16262 | { |
| 16263 | -1, |
| 16264 | (gchar *) "org.openbmc.Watchdog", |
| 16265 | (GDBusMethodInfo **) &_watchdog_method_info_pointers, |
| 16266 | (GDBusSignalInfo **) &_watchdog_signal_info_pointers, |
| 16267 | (GDBusPropertyInfo **) &_watchdog_property_info_pointers, |
| 16268 | NULL |
| 16269 | }, |
| 16270 | "watchdog", |
| 16271 | }; |
| 16272 | |
| 16273 | |
| 16274 | /** |
| 16275 | * watchdog_interface_info: |
| 16276 | * |
| 16277 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. |
| 16278 | * |
| 16279 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 16280 | */ |
| 16281 | GDBusInterfaceInfo * |
| 16282 | watchdog_interface_info (void) |
| 16283 | { |
| 16284 | return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; |
| 16285 | } |
| 16286 | |
| 16287 | /** |
| 16288 | * watchdog_override_properties: |
| 16289 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 16290 | * @property_id_begin: The property id to assign to the first overridden property. |
| 16291 | * |
| 16292 | * Overrides all #GObject properties in the #Watchdog interface for a concrete class. |
| 16293 | * The properties are overridden in the order they are defined. |
| 16294 | * |
| 16295 | * Returns: The last property id. |
| 16296 | */ |
| 16297 | guint |
| 16298 | watchdog_override_properties (GObjectClass *klass, guint property_id_begin) |
| 16299 | { |
| 16300 | g_object_class_override_property (klass, property_id_begin++, "watchdog"); |
| 16301 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 16302 | return property_id_begin - 1; |
| 16303 | } |
| 16304 | |
| 16305 | |
| 16306 | |
| 16307 | /** |
| 16308 | * Watchdog: |
| 16309 | * |
| 16310 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 16311 | */ |
| 16312 | |
| 16313 | /** |
| 16314 | * WatchdogIface: |
| 16315 | * @parent_iface: The parent interface. |
| 16316 | * @handle_poke: Handler for the #Watchdog::handle-poke signal. |
| 16317 | * @handle_start: Handler for the #Watchdog::handle-start signal. |
| 16318 | * @handle_stop: Handler for the #Watchdog::handle-stop signal. |
| 16319 | * @get_poll_interval: Getter for the #Watchdog:poll-interval property. |
| 16320 | * @get_watchdog: Getter for the #Watchdog:watchdog property. |
| 16321 | * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. |
| 16322 | * |
| 16323 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 16324 | */ |
| 16325 | |
| 16326 | typedef WatchdogIface WatchdogInterface; |
| 16327 | G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); |
| 16328 | |
| 16329 | static void |
| 16330 | watchdog_default_init (WatchdogIface *iface) |
| 16331 | { |
| 16332 | /* GObject signals for incoming D-Bus method calls: */ |
| 16333 | /** |
| 16334 | * Watchdog::handle-start: |
| 16335 | * @object: A #Watchdog. |
| 16336 | * @invocation: A #GDBusMethodInvocation. |
| 16337 | * |
| 16338 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. |
| 16339 | * |
| 16340 | * 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. |
| 16341 | * |
| 16342 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16343 | */ |
| 16344 | g_signal_new ("handle-start", |
| 16345 | G_TYPE_FROM_INTERFACE (iface), |
| 16346 | G_SIGNAL_RUN_LAST, |
| 16347 | G_STRUCT_OFFSET (WatchdogIface, handle_start), |
| 16348 | g_signal_accumulator_true_handled, |
| 16349 | NULL, |
| 16350 | g_cclosure_marshal_generic, |
| 16351 | G_TYPE_BOOLEAN, |
| 16352 | 1, |
| 16353 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16354 | |
| 16355 | /** |
| 16356 | * Watchdog::handle-poke: |
| 16357 | * @object: A #Watchdog. |
| 16358 | * @invocation: A #GDBusMethodInvocation. |
| 16359 | * |
| 16360 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. |
| 16361 | * |
| 16362 | * 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. |
| 16363 | * |
| 16364 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16365 | */ |
| 16366 | g_signal_new ("handle-poke", |
| 16367 | G_TYPE_FROM_INTERFACE (iface), |
| 16368 | G_SIGNAL_RUN_LAST, |
| 16369 | G_STRUCT_OFFSET (WatchdogIface, handle_poke), |
| 16370 | g_signal_accumulator_true_handled, |
| 16371 | NULL, |
| 16372 | g_cclosure_marshal_generic, |
| 16373 | G_TYPE_BOOLEAN, |
| 16374 | 1, |
| 16375 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16376 | |
| 16377 | /** |
| 16378 | * Watchdog::handle-stop: |
| 16379 | * @object: A #Watchdog. |
| 16380 | * @invocation: A #GDBusMethodInvocation. |
| 16381 | * |
| 16382 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. |
| 16383 | * |
| 16384 | * 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. |
| 16385 | * |
| 16386 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 16387 | */ |
| 16388 | g_signal_new ("handle-stop", |
| 16389 | G_TYPE_FROM_INTERFACE (iface), |
| 16390 | G_SIGNAL_RUN_LAST, |
| 16391 | G_STRUCT_OFFSET (WatchdogIface, handle_stop), |
| 16392 | g_signal_accumulator_true_handled, |
| 16393 | NULL, |
| 16394 | g_cclosure_marshal_generic, |
| 16395 | G_TYPE_BOOLEAN, |
| 16396 | 1, |
| 16397 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 16398 | |
| 16399 | /* GObject signals for received D-Bus signals: */ |
| 16400 | /** |
| 16401 | * Watchdog::watchdog-error: |
| 16402 | * @object: A #Watchdog. |
| 16403 | * |
| 16404 | * 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. |
| 16405 | * |
| 16406 | * 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. |
| 16407 | */ |
| 16408 | g_signal_new ("watchdog-error", |
| 16409 | G_TYPE_FROM_INTERFACE (iface), |
| 16410 | G_SIGNAL_RUN_LAST, |
| 16411 | G_STRUCT_OFFSET (WatchdogIface, watchdog_error), |
| 16412 | NULL, |
| 16413 | NULL, |
| 16414 | g_cclosure_marshal_generic, |
| 16415 | G_TYPE_NONE, |
| 16416 | 0); |
| 16417 | |
| 16418 | /* GObject properties for D-Bus properties: */ |
| 16419 | /** |
| 16420 | * Watchdog:watchdog: |
| 16421 | * |
| 16422 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. |
| 16423 | * |
| 16424 | * 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. |
| 16425 | */ |
| 16426 | g_object_interface_install_property (iface, |
| 16427 | g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 16428 | /** |
| 16429 | * Watchdog:poll-interval: |
| 16430 | * |
| 16431 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. |
| 16432 | * |
| 16433 | * 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. |
| 16434 | */ |
| 16435 | g_object_interface_install_property (iface, |
| 16436 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 16437 | } |
| 16438 | |
| 16439 | /** |
| 16440 | * watchdog_get_watchdog: (skip) |
| 16441 | * @object: A #Watchdog. |
| 16442 | * |
| 16443 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. |
| 16444 | * |
| 16445 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16446 | * |
| 16447 | * Returns: The property value. |
| 16448 | */ |
| 16449 | gint |
| 16450 | watchdog_get_watchdog (Watchdog *object) |
| 16451 | { |
| 16452 | return WATCHDOG_GET_IFACE (object)->get_watchdog (object); |
| 16453 | } |
| 16454 | |
| 16455 | /** |
| 16456 | * watchdog_set_watchdog: (skip) |
| 16457 | * @object: A #Watchdog. |
| 16458 | * @value: The value to set. |
| 16459 | * |
| 16460 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. |
| 16461 | * |
| 16462 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16463 | */ |
| 16464 | void |
| 16465 | watchdog_set_watchdog (Watchdog *object, gint value) |
| 16466 | { |
| 16467 | g_object_set (G_OBJECT (object), "watchdog", value, NULL); |
| 16468 | } |
| 16469 | |
| 16470 | /** |
| 16471 | * watchdog_get_poll_interval: (skip) |
| 16472 | * @object: A #Watchdog. |
| 16473 | * |
| 16474 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. |
| 16475 | * |
| 16476 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16477 | * |
| 16478 | * Returns: The property value. |
| 16479 | */ |
| 16480 | gint |
| 16481 | watchdog_get_poll_interval (Watchdog *object) |
| 16482 | { |
| 16483 | return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); |
| 16484 | } |
| 16485 | |
| 16486 | /** |
| 16487 | * watchdog_set_poll_interval: (skip) |
| 16488 | * @object: A #Watchdog. |
| 16489 | * @value: The value to set. |
| 16490 | * |
| 16491 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 16492 | * |
| 16493 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16494 | */ |
| 16495 | void |
| 16496 | watchdog_set_poll_interval (Watchdog *object, gint value) |
| 16497 | { |
| 16498 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 16499 | } |
| 16500 | |
| 16501 | /** |
| 16502 | * watchdog_emit_watchdog_error: |
| 16503 | * @object: A #Watchdog. |
| 16504 | * |
| 16505 | * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. |
| 16506 | */ |
| 16507 | void |
| 16508 | watchdog_emit_watchdog_error ( |
| 16509 | Watchdog *object) |
| 16510 | { |
| 16511 | g_signal_emit_by_name (object, "watchdog-error"); |
| 16512 | } |
| 16513 | |
| 16514 | /** |
| 16515 | * watchdog_call_start: |
| 16516 | * @proxy: A #WatchdogProxy. |
| 16517 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16518 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16519 | * @user_data: User data to pass to @callback. |
| 16520 | * |
| 16521 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. |
| 16522 | * 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. |
| 16523 | * You can then call watchdog_call_start_finish() to get the result of the operation. |
| 16524 | * |
| 16525 | * See watchdog_call_start_sync() for the synchronous, blocking version of this method. |
| 16526 | */ |
| 16527 | void |
| 16528 | watchdog_call_start ( |
| 16529 | Watchdog *proxy, |
| 16530 | GCancellable *cancellable, |
| 16531 | GAsyncReadyCallback callback, |
| 16532 | gpointer user_data) |
| 16533 | { |
| 16534 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16535 | "start", |
| 16536 | g_variant_new ("()"), |
| 16537 | G_DBUS_CALL_FLAGS_NONE, |
| 16538 | -1, |
| 16539 | cancellable, |
| 16540 | callback, |
| 16541 | user_data); |
| 16542 | } |
| 16543 | |
| 16544 | /** |
| 16545 | * watchdog_call_start_finish: |
| 16546 | * @proxy: A #WatchdogProxy. |
| 16547 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). |
| 16548 | * @error: Return location for error or %NULL. |
| 16549 | * |
| 16550 | * Finishes an operation started with watchdog_call_start(). |
| 16551 | * |
| 16552 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16553 | */ |
| 16554 | gboolean |
| 16555 | watchdog_call_start_finish ( |
| 16556 | Watchdog *proxy, |
| 16557 | GAsyncResult *res, |
| 16558 | GError **error) |
| 16559 | { |
| 16560 | GVariant *_ret; |
| 16561 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16562 | if (_ret == NULL) |
| 16563 | goto _out; |
| 16564 | g_variant_get (_ret, |
| 16565 | "()"); |
| 16566 | g_variant_unref (_ret); |
| 16567 | _out: |
| 16568 | return _ret != NULL; |
| 16569 | } |
| 16570 | |
| 16571 | /** |
| 16572 | * watchdog_call_start_sync: |
| 16573 | * @proxy: A #WatchdogProxy. |
| 16574 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16575 | * @error: Return location for error or %NULL. |
| 16576 | * |
| 16577 | * 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. |
| 16578 | * |
| 16579 | * See watchdog_call_start() for the asynchronous version of this method. |
| 16580 | * |
| 16581 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16582 | */ |
| 16583 | gboolean |
| 16584 | watchdog_call_start_sync ( |
| 16585 | Watchdog *proxy, |
| 16586 | GCancellable *cancellable, |
| 16587 | GError **error) |
| 16588 | { |
| 16589 | GVariant *_ret; |
| 16590 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16591 | "start", |
| 16592 | g_variant_new ("()"), |
| 16593 | G_DBUS_CALL_FLAGS_NONE, |
| 16594 | -1, |
| 16595 | cancellable, |
| 16596 | error); |
| 16597 | if (_ret == NULL) |
| 16598 | goto _out; |
| 16599 | g_variant_get (_ret, |
| 16600 | "()"); |
| 16601 | g_variant_unref (_ret); |
| 16602 | _out: |
| 16603 | return _ret != NULL; |
| 16604 | } |
| 16605 | |
| 16606 | /** |
| 16607 | * watchdog_call_poke: |
| 16608 | * @proxy: A #WatchdogProxy. |
| 16609 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16610 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16611 | * @user_data: User data to pass to @callback. |
| 16612 | * |
| 16613 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. |
| 16614 | * 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. |
| 16615 | * You can then call watchdog_call_poke_finish() to get the result of the operation. |
| 16616 | * |
| 16617 | * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. |
| 16618 | */ |
| 16619 | void |
| 16620 | watchdog_call_poke ( |
| 16621 | Watchdog *proxy, |
| 16622 | GCancellable *cancellable, |
| 16623 | GAsyncReadyCallback callback, |
| 16624 | gpointer user_data) |
| 16625 | { |
| 16626 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16627 | "poke", |
| 16628 | g_variant_new ("()"), |
| 16629 | G_DBUS_CALL_FLAGS_NONE, |
| 16630 | -1, |
| 16631 | cancellable, |
| 16632 | callback, |
| 16633 | user_data); |
| 16634 | } |
| 16635 | |
| 16636 | /** |
| 16637 | * watchdog_call_poke_finish: |
| 16638 | * @proxy: A #WatchdogProxy. |
| 16639 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). |
| 16640 | * @error: Return location for error or %NULL. |
| 16641 | * |
| 16642 | * Finishes an operation started with watchdog_call_poke(). |
| 16643 | * |
| 16644 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16645 | */ |
| 16646 | gboolean |
| 16647 | watchdog_call_poke_finish ( |
| 16648 | Watchdog *proxy, |
| 16649 | GAsyncResult *res, |
| 16650 | GError **error) |
| 16651 | { |
| 16652 | GVariant *_ret; |
| 16653 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16654 | if (_ret == NULL) |
| 16655 | goto _out; |
| 16656 | g_variant_get (_ret, |
| 16657 | "()"); |
| 16658 | g_variant_unref (_ret); |
| 16659 | _out: |
| 16660 | return _ret != NULL; |
| 16661 | } |
| 16662 | |
| 16663 | /** |
| 16664 | * watchdog_call_poke_sync: |
| 16665 | * @proxy: A #WatchdogProxy. |
| 16666 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16667 | * @error: Return location for error or %NULL. |
| 16668 | * |
| 16669 | * 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. |
| 16670 | * |
| 16671 | * See watchdog_call_poke() for the asynchronous version of this method. |
| 16672 | * |
| 16673 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16674 | */ |
| 16675 | gboolean |
| 16676 | watchdog_call_poke_sync ( |
| 16677 | Watchdog *proxy, |
| 16678 | GCancellable *cancellable, |
| 16679 | GError **error) |
| 16680 | { |
| 16681 | GVariant *_ret; |
| 16682 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16683 | "poke", |
| 16684 | g_variant_new ("()"), |
| 16685 | G_DBUS_CALL_FLAGS_NONE, |
| 16686 | -1, |
| 16687 | cancellable, |
| 16688 | error); |
| 16689 | if (_ret == NULL) |
| 16690 | goto _out; |
| 16691 | g_variant_get (_ret, |
| 16692 | "()"); |
| 16693 | g_variant_unref (_ret); |
| 16694 | _out: |
| 16695 | return _ret != NULL; |
| 16696 | } |
| 16697 | |
| 16698 | /** |
| 16699 | * watchdog_call_stop: |
| 16700 | * @proxy: A #WatchdogProxy. |
| 16701 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16702 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16703 | * @user_data: User data to pass to @callback. |
| 16704 | * |
| 16705 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. |
| 16706 | * 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. |
| 16707 | * You can then call watchdog_call_stop_finish() to get the result of the operation. |
| 16708 | * |
| 16709 | * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. |
| 16710 | */ |
| 16711 | void |
| 16712 | watchdog_call_stop ( |
| 16713 | Watchdog *proxy, |
| 16714 | GCancellable *cancellable, |
| 16715 | GAsyncReadyCallback callback, |
| 16716 | gpointer user_data) |
| 16717 | { |
| 16718 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16719 | "stop", |
| 16720 | g_variant_new ("()"), |
| 16721 | G_DBUS_CALL_FLAGS_NONE, |
| 16722 | -1, |
| 16723 | cancellable, |
| 16724 | callback, |
| 16725 | user_data); |
| 16726 | } |
| 16727 | |
| 16728 | /** |
| 16729 | * watchdog_call_stop_finish: |
| 16730 | * @proxy: A #WatchdogProxy. |
| 16731 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). |
| 16732 | * @error: Return location for error or %NULL. |
| 16733 | * |
| 16734 | * Finishes an operation started with watchdog_call_stop(). |
| 16735 | * |
| 16736 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16737 | */ |
| 16738 | gboolean |
| 16739 | watchdog_call_stop_finish ( |
| 16740 | Watchdog *proxy, |
| 16741 | GAsyncResult *res, |
| 16742 | GError **error) |
| 16743 | { |
| 16744 | GVariant *_ret; |
| 16745 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16746 | if (_ret == NULL) |
| 16747 | goto _out; |
| 16748 | g_variant_get (_ret, |
| 16749 | "()"); |
| 16750 | g_variant_unref (_ret); |
| 16751 | _out: |
| 16752 | return _ret != NULL; |
| 16753 | } |
| 16754 | |
| 16755 | /** |
| 16756 | * watchdog_call_stop_sync: |
| 16757 | * @proxy: A #WatchdogProxy. |
| 16758 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16759 | * @error: Return location for error or %NULL. |
| 16760 | * |
| 16761 | * 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. |
| 16762 | * |
| 16763 | * See watchdog_call_stop() for the asynchronous version of this method. |
| 16764 | * |
| 16765 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16766 | */ |
| 16767 | gboolean |
| 16768 | watchdog_call_stop_sync ( |
| 16769 | Watchdog *proxy, |
| 16770 | GCancellable *cancellable, |
| 16771 | GError **error) |
| 16772 | { |
| 16773 | GVariant *_ret; |
| 16774 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16775 | "stop", |
| 16776 | g_variant_new ("()"), |
| 16777 | G_DBUS_CALL_FLAGS_NONE, |
| 16778 | -1, |
| 16779 | cancellable, |
| 16780 | error); |
| 16781 | if (_ret == NULL) |
| 16782 | goto _out; |
| 16783 | g_variant_get (_ret, |
| 16784 | "()"); |
| 16785 | g_variant_unref (_ret); |
| 16786 | _out: |
| 16787 | return _ret != NULL; |
| 16788 | } |
| 16789 | |
| 16790 | /** |
| 16791 | * watchdog_complete_start: |
| 16792 | * @object: A #Watchdog. |
| 16793 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16794 | * |
| 16795 | * 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. |
| 16796 | * |
| 16797 | * This method will free @invocation, you cannot use it afterwards. |
| 16798 | */ |
| 16799 | void |
| 16800 | watchdog_complete_start ( |
| 16801 | Watchdog *object, |
| 16802 | GDBusMethodInvocation *invocation) |
| 16803 | { |
| 16804 | g_dbus_method_invocation_return_value (invocation, |
| 16805 | g_variant_new ("()")); |
| 16806 | } |
| 16807 | |
| 16808 | /** |
| 16809 | * watchdog_complete_poke: |
| 16810 | * @object: A #Watchdog. |
| 16811 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16812 | * |
| 16813 | * 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. |
| 16814 | * |
| 16815 | * This method will free @invocation, you cannot use it afterwards. |
| 16816 | */ |
| 16817 | void |
| 16818 | watchdog_complete_poke ( |
| 16819 | Watchdog *object, |
| 16820 | GDBusMethodInvocation *invocation) |
| 16821 | { |
| 16822 | g_dbus_method_invocation_return_value (invocation, |
| 16823 | g_variant_new ("()")); |
| 16824 | } |
| 16825 | |
| 16826 | /** |
| 16827 | * watchdog_complete_stop: |
| 16828 | * @object: A #Watchdog. |
| 16829 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16830 | * |
| 16831 | * 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. |
| 16832 | * |
| 16833 | * This method will free @invocation, you cannot use it afterwards. |
| 16834 | */ |
| 16835 | void |
| 16836 | watchdog_complete_stop ( |
| 16837 | Watchdog *object, |
| 16838 | GDBusMethodInvocation *invocation) |
| 16839 | { |
| 16840 | g_dbus_method_invocation_return_value (invocation, |
| 16841 | g_variant_new ("()")); |
| 16842 | } |
| 16843 | |
| 16844 | /* ------------------------------------------------------------------------ */ |
| 16845 | |
| 16846 | /** |
| 16847 | * WatchdogProxy: |
| 16848 | * |
| 16849 | * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. |
| 16850 | */ |
| 16851 | |
| 16852 | /** |
| 16853 | * WatchdogProxyClass: |
| 16854 | * @parent_class: The parent class. |
| 16855 | * |
| 16856 | * Class structure for #WatchdogProxy. |
| 16857 | */ |
| 16858 | |
| 16859 | struct _WatchdogProxyPrivate |
| 16860 | { |
| 16861 | GData *qdata; |
| 16862 | }; |
| 16863 | |
| 16864 | static void watchdog_proxy_iface_init (WatchdogIface *iface); |
| 16865 | |
| 16866 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16867 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 16868 | G_ADD_PRIVATE (WatchdogProxy) |
| 16869 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 16870 | |
| 16871 | #else |
| 16872 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 16873 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 16874 | |
| 16875 | #endif |
| 16876 | static void |
| 16877 | watchdog_proxy_finalize (GObject *object) |
| 16878 | { |
| 16879 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 16880 | g_datalist_clear (&proxy->priv->qdata); |
| 16881 | G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); |
| 16882 | } |
| 16883 | |
| 16884 | static void |
| 16885 | watchdog_proxy_get_property (GObject *object, |
| 16886 | guint prop_id, |
| 16887 | GValue *value, |
| 16888 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16889 | { |
| 16890 | const _ExtendedGDBusPropertyInfo *info; |
| 16891 | GVariant *variant; |
| 16892 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16893 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 16894 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 16895 | if (info->use_gvariant) |
| 16896 | { |
| 16897 | g_value_set_variant (value, variant); |
| 16898 | } |
| 16899 | else |
| 16900 | { |
| 16901 | if (variant != NULL) |
| 16902 | g_dbus_gvariant_to_gvalue (variant, value); |
| 16903 | } |
| 16904 | if (variant != NULL) |
| 16905 | g_variant_unref (variant); |
| 16906 | } |
| 16907 | |
| 16908 | static void |
| 16909 | watchdog_proxy_set_property_cb (GDBusProxy *proxy, |
| 16910 | GAsyncResult *res, |
| 16911 | gpointer user_data) |
| 16912 | { |
| 16913 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 16914 | GError *error; |
| 16915 | GVariant *_ret; |
| 16916 | error = NULL; |
| 16917 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 16918 | if (!_ret) |
| 16919 | { |
| 16920 | g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", |
| 16921 | info->parent_struct.name, |
| 16922 | error->message, g_quark_to_string (error->domain), error->code); |
| 16923 | g_error_free (error); |
| 16924 | } |
| 16925 | else |
| 16926 | { |
| 16927 | g_variant_unref (_ret); |
| 16928 | } |
| 16929 | } |
| 16930 | |
| 16931 | static void |
| 16932 | watchdog_proxy_set_property (GObject *object, |
| 16933 | guint prop_id, |
| 16934 | const GValue *value, |
| 16935 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16936 | { |
| 16937 | const _ExtendedGDBusPropertyInfo *info; |
| 16938 | GVariant *variant; |
| 16939 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16940 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 16941 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16942 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 16943 | "org.freedesktop.DBus.Properties.Set", |
| 16944 | g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), |
| 16945 | G_DBUS_CALL_FLAGS_NONE, |
| 16946 | -1, |
| 16947 | NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 16948 | g_variant_unref (variant); |
| 16949 | } |
| 16950 | |
| 16951 | static void |
| 16952 | watchdog_proxy_g_signal (GDBusProxy *proxy, |
| 16953 | const gchar *sender_name G_GNUC_UNUSED, |
| 16954 | const gchar *signal_name, |
| 16955 | GVariant *parameters) |
| 16956 | { |
| 16957 | _ExtendedGDBusSignalInfo *info; |
| 16958 | GVariantIter iter; |
| 16959 | GVariant *child; |
| 16960 | GValue *paramv; |
| 16961 | guint num_params; |
| 16962 | guint n; |
| 16963 | guint signal_id; |
| 16964 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); |
| 16965 | if (info == NULL) |
| 16966 | return; |
| 16967 | num_params = g_variant_n_children (parameters); |
| 16968 | paramv = g_new0 (GValue, num_params + 1); |
| 16969 | g_value_init (¶mv[0], TYPE_WATCHDOG); |
| 16970 | g_value_set_object (¶mv[0], proxy); |
| 16971 | g_variant_iter_init (&iter, parameters); |
| 16972 | n = 1; |
| 16973 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16974 | { |
| 16975 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 16976 | if (arg_info->use_gvariant) |
| 16977 | { |
| 16978 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16979 | g_value_set_variant (¶mv[n], child); |
| 16980 | n++; |
| 16981 | } |
| 16982 | else |
| 16983 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16984 | g_variant_unref (child); |
| 16985 | } |
| 16986 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 16987 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 16988 | for (n = 0; n < num_params + 1; n++) |
| 16989 | g_value_unset (¶mv[n]); |
| 16990 | g_free (paramv); |
| 16991 | } |
| 16992 | |
| 16993 | static void |
| 16994 | watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 16995 | GVariant *changed_properties, |
| 16996 | const gchar *const *invalidated_properties) |
| 16997 | { |
| 16998 | WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); |
| 16999 | guint n; |
| 17000 | const gchar *key; |
| 17001 | GVariantIter *iter; |
| 17002 | _ExtendedGDBusPropertyInfo *info; |
| 17003 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 17004 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 17005 | { |
| 17006 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); |
| 17007 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 17008 | if (info != NULL) |
| 17009 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17010 | } |
| 17011 | g_variant_iter_free (iter); |
| 17012 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 17013 | { |
| 17014 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); |
| 17015 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 17016 | if (info != NULL) |
| 17017 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17018 | } |
| 17019 | } |
| 17020 | |
| 17021 | static gint |
| 17022 | watchdog_proxy_get_watchdog (Watchdog *object) |
| 17023 | { |
| 17024 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 17025 | GVariant *variant; |
| 17026 | gint value = 0; |
| 17027 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); |
| 17028 | if (variant != NULL) |
| 17029 | { |
| 17030 | value = g_variant_get_int32 (variant); |
| 17031 | g_variant_unref (variant); |
| 17032 | } |
| 17033 | return value; |
| 17034 | } |
| 17035 | |
| 17036 | static gint |
| 17037 | watchdog_proxy_get_poll_interval (Watchdog *object) |
| 17038 | { |
| 17039 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 17040 | GVariant *variant; |
| 17041 | gint value = 0; |
| 17042 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 17043 | if (variant != NULL) |
| 17044 | { |
| 17045 | value = g_variant_get_int32 (variant); |
| 17046 | g_variant_unref (variant); |
| 17047 | } |
| 17048 | return value; |
| 17049 | } |
| 17050 | |
| 17051 | static void |
| 17052 | watchdog_proxy_init (WatchdogProxy *proxy) |
| 17053 | { |
| 17054 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17055 | proxy->priv = watchdog_proxy_get_instance_private (proxy); |
| 17056 | #else |
| 17057 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); |
| 17058 | #endif |
| 17059 | |
| 17060 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); |
| 17061 | } |
| 17062 | |
| 17063 | static void |
| 17064 | watchdog_proxy_class_init (WatchdogProxyClass *klass) |
| 17065 | { |
| 17066 | GObjectClass *gobject_class; |
| 17067 | GDBusProxyClass *proxy_class; |
| 17068 | |
| 17069 | gobject_class = G_OBJECT_CLASS (klass); |
| 17070 | gobject_class->finalize = watchdog_proxy_finalize; |
| 17071 | gobject_class->get_property = watchdog_proxy_get_property; |
| 17072 | gobject_class->set_property = watchdog_proxy_set_property; |
| 17073 | |
| 17074 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 17075 | proxy_class->g_signal = watchdog_proxy_g_signal; |
| 17076 | proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; |
| 17077 | |
| 17078 | watchdog_override_properties (gobject_class, 1); |
| 17079 | |
| 17080 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17081 | g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); |
| 17082 | #endif |
| 17083 | } |
| 17084 | |
| 17085 | static void |
| 17086 | watchdog_proxy_iface_init (WatchdogIface *iface) |
| 17087 | { |
| 17088 | iface->get_watchdog = watchdog_proxy_get_watchdog; |
| 17089 | iface->get_poll_interval = watchdog_proxy_get_poll_interval; |
| 17090 | } |
| 17091 | |
| 17092 | /** |
| 17093 | * watchdog_proxy_new: |
| 17094 | * @connection: A #GDBusConnection. |
| 17095 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17096 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17097 | * @object_path: An object path. |
| 17098 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17099 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17100 | * @user_data: User data to pass to @callback. |
| 17101 | * |
| 17102 | * 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. |
| 17103 | * |
| 17104 | * 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. |
| 17105 | * You can then call watchdog_proxy_new_finish() to get the result of the operation. |
| 17106 | * |
| 17107 | * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 17108 | */ |
| 17109 | void |
| 17110 | watchdog_proxy_new ( |
| 17111 | GDBusConnection *connection, |
| 17112 | GDBusProxyFlags flags, |
| 17113 | const gchar *name, |
| 17114 | const gchar *object_path, |
| 17115 | GCancellable *cancellable, |
| 17116 | GAsyncReadyCallback callback, |
| 17117 | gpointer user_data) |
| 17118 | { |
| 17119 | 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); |
| 17120 | } |
| 17121 | |
| 17122 | /** |
| 17123 | * watchdog_proxy_new_finish: |
| 17124 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). |
| 17125 | * @error: Return location for error or %NULL |
| 17126 | * |
| 17127 | * Finishes an operation started with watchdog_proxy_new(). |
| 17128 | * |
| 17129 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17130 | */ |
| 17131 | Watchdog * |
| 17132 | watchdog_proxy_new_finish ( |
| 17133 | GAsyncResult *res, |
| 17134 | GError **error) |
| 17135 | { |
| 17136 | GObject *ret; |
| 17137 | GObject *source_object; |
| 17138 | source_object = g_async_result_get_source_object (res); |
| 17139 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 17140 | g_object_unref (source_object); |
| 17141 | if (ret != NULL) |
| 17142 | return WATCHDOG (ret); |
| 17143 | else |
| 17144 | return NULL; |
| 17145 | } |
| 17146 | |
| 17147 | /** |
| 17148 | * watchdog_proxy_new_sync: |
| 17149 | * @connection: A #GDBusConnection. |
| 17150 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17151 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17152 | * @object_path: An object path. |
| 17153 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17154 | * @error: Return location for error or %NULL |
| 17155 | * |
| 17156 | * 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. |
| 17157 | * |
| 17158 | * The calling thread is blocked until a reply is received. |
| 17159 | * |
| 17160 | * See watchdog_proxy_new() for the asynchronous version of this constructor. |
| 17161 | * |
| 17162 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17163 | */ |
| 17164 | Watchdog * |
| 17165 | watchdog_proxy_new_sync ( |
| 17166 | GDBusConnection *connection, |
| 17167 | GDBusProxyFlags flags, |
| 17168 | const gchar *name, |
| 17169 | const gchar *object_path, |
| 17170 | GCancellable *cancellable, |
| 17171 | GError **error) |
| 17172 | { |
| 17173 | GInitable *ret; |
| 17174 | 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); |
| 17175 | if (ret != NULL) |
| 17176 | return WATCHDOG (ret); |
| 17177 | else |
| 17178 | return NULL; |
| 17179 | } |
| 17180 | |
| 17181 | |
| 17182 | /** |
| 17183 | * watchdog_proxy_new_for_bus: |
| 17184 | * @bus_type: A #GBusType. |
| 17185 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17186 | * @name: A bus name (well-known or unique). |
| 17187 | * @object_path: An object path. |
| 17188 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17189 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17190 | * @user_data: User data to pass to @callback. |
| 17191 | * |
| 17192 | * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 17193 | * |
| 17194 | * 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. |
| 17195 | * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. |
| 17196 | * |
| 17197 | * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 17198 | */ |
| 17199 | void |
| 17200 | watchdog_proxy_new_for_bus ( |
| 17201 | GBusType bus_type, |
| 17202 | GDBusProxyFlags flags, |
| 17203 | const gchar *name, |
| 17204 | const gchar *object_path, |
| 17205 | GCancellable *cancellable, |
| 17206 | GAsyncReadyCallback callback, |
| 17207 | gpointer user_data) |
| 17208 | { |
| 17209 | 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); |
| 17210 | } |
| 17211 | |
| 17212 | /** |
| 17213 | * watchdog_proxy_new_for_bus_finish: |
| 17214 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). |
| 17215 | * @error: Return location for error or %NULL |
| 17216 | * |
| 17217 | * Finishes an operation started with watchdog_proxy_new_for_bus(). |
| 17218 | * |
| 17219 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17220 | */ |
| 17221 | Watchdog * |
| 17222 | watchdog_proxy_new_for_bus_finish ( |
| 17223 | GAsyncResult *res, |
| 17224 | GError **error) |
| 17225 | { |
| 17226 | GObject *ret; |
| 17227 | GObject *source_object; |
| 17228 | source_object = g_async_result_get_source_object (res); |
| 17229 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 17230 | g_object_unref (source_object); |
| 17231 | if (ret != NULL) |
| 17232 | return WATCHDOG (ret); |
| 17233 | else |
| 17234 | return NULL; |
| 17235 | } |
| 17236 | |
| 17237 | /** |
| 17238 | * watchdog_proxy_new_for_bus_sync: |
| 17239 | * @bus_type: A #GBusType. |
| 17240 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17241 | * @name: A bus name (well-known or unique). |
| 17242 | * @object_path: An object path. |
| 17243 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17244 | * @error: Return location for error or %NULL |
| 17245 | * |
| 17246 | * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 17247 | * |
| 17248 | * The calling thread is blocked until a reply is received. |
| 17249 | * |
| 17250 | * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 17251 | * |
| 17252 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 17253 | */ |
| 17254 | Watchdog * |
| 17255 | watchdog_proxy_new_for_bus_sync ( |
| 17256 | GBusType bus_type, |
| 17257 | GDBusProxyFlags flags, |
| 17258 | const gchar *name, |
| 17259 | const gchar *object_path, |
| 17260 | GCancellable *cancellable, |
| 17261 | GError **error) |
| 17262 | { |
| 17263 | GInitable *ret; |
| 17264 | 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); |
| 17265 | if (ret != NULL) |
| 17266 | return WATCHDOG (ret); |
| 17267 | else |
| 17268 | return NULL; |
| 17269 | } |
| 17270 | |
| 17271 | |
| 17272 | /* ------------------------------------------------------------------------ */ |
| 17273 | |
| 17274 | /** |
| 17275 | * WatchdogSkeleton: |
| 17276 | * |
| 17277 | * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 17278 | */ |
| 17279 | |
| 17280 | /** |
| 17281 | * WatchdogSkeletonClass: |
| 17282 | * @parent_class: The parent class. |
| 17283 | * |
| 17284 | * Class structure for #WatchdogSkeleton. |
| 17285 | */ |
| 17286 | |
| 17287 | struct _WatchdogSkeletonPrivate |
| 17288 | { |
| 17289 | GValue *properties; |
| 17290 | GList *changed_properties; |
| 17291 | GSource *changed_properties_idle_source; |
| 17292 | GMainContext *context; |
| 17293 | GMutex lock; |
| 17294 | }; |
| 17295 | |
| 17296 | static void |
| 17297 | _watchdog_skeleton_handle_method_call ( |
| 17298 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17299 | const gchar *sender G_GNUC_UNUSED, |
| 17300 | const gchar *object_path G_GNUC_UNUSED, |
| 17301 | const gchar *interface_name, |
| 17302 | const gchar *method_name, |
| 17303 | GVariant *parameters, |
| 17304 | GDBusMethodInvocation *invocation, |
| 17305 | gpointer user_data) |
| 17306 | { |
| 17307 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17308 | _ExtendedGDBusMethodInfo *info; |
| 17309 | GVariantIter iter; |
| 17310 | GVariant *child; |
| 17311 | GValue *paramv; |
| 17312 | guint num_params; |
| 17313 | guint num_extra; |
| 17314 | guint n; |
| 17315 | guint signal_id; |
| 17316 | GValue return_value = G_VALUE_INIT; |
| 17317 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 17318 | g_assert (info != NULL); |
| 17319 | num_params = g_variant_n_children (parameters); |
| 17320 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 17321 | n = 0; |
| 17322 | g_value_init (¶mv[n], TYPE_WATCHDOG); |
| 17323 | g_value_set_object (¶mv[n++], skeleton); |
| 17324 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 17325 | g_value_set_object (¶mv[n++], invocation); |
| 17326 | if (info->pass_fdlist) |
| 17327 | { |
| 17328 | #ifdef G_OS_UNIX |
| 17329 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 17330 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 17331 | #else |
| 17332 | g_assert_not_reached (); |
| 17333 | #endif |
| 17334 | } |
| 17335 | g_variant_iter_init (&iter, parameters); |
| 17336 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 17337 | { |
| 17338 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 17339 | if (arg_info->use_gvariant) |
| 17340 | { |
| 17341 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 17342 | g_value_set_variant (¶mv[n], child); |
| 17343 | n++; |
| 17344 | } |
| 17345 | else |
| 17346 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 17347 | g_variant_unref (child); |
| 17348 | } |
| 17349 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 17350 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 17351 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 17352 | if (!g_value_get_boolean (&return_value)) |
| 17353 | 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); |
| 17354 | g_value_unset (&return_value); |
| 17355 | for (n = 0; n < num_params + num_extra; n++) |
| 17356 | g_value_unset (¶mv[n]); |
| 17357 | g_free (paramv); |
| 17358 | } |
| 17359 | |
| 17360 | static GVariant * |
| 17361 | _watchdog_skeleton_handle_get_property ( |
| 17362 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17363 | const gchar *sender G_GNUC_UNUSED, |
| 17364 | const gchar *object_path G_GNUC_UNUSED, |
| 17365 | const gchar *interface_name G_GNUC_UNUSED, |
| 17366 | const gchar *property_name, |
| 17367 | GError **error, |
| 17368 | gpointer user_data) |
| 17369 | { |
| 17370 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17371 | GValue value = G_VALUE_INIT; |
| 17372 | GParamSpec *pspec; |
| 17373 | _ExtendedGDBusPropertyInfo *info; |
| 17374 | GVariant *ret; |
| 17375 | ret = NULL; |
| 17376 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 17377 | g_assert (info != NULL); |
| 17378 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 17379 | if (pspec == NULL) |
| 17380 | { |
| 17381 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 17382 | } |
| 17383 | else |
| 17384 | { |
| 17385 | g_value_init (&value, pspec->value_type); |
| 17386 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 17387 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 17388 | g_value_unset (&value); |
| 17389 | } |
| 17390 | return ret; |
| 17391 | } |
| 17392 | |
| 17393 | static gboolean |
| 17394 | _watchdog_skeleton_handle_set_property ( |
| 17395 | GDBusConnection *connection G_GNUC_UNUSED, |
| 17396 | const gchar *sender G_GNUC_UNUSED, |
| 17397 | const gchar *object_path G_GNUC_UNUSED, |
| 17398 | const gchar *interface_name G_GNUC_UNUSED, |
| 17399 | const gchar *property_name, |
| 17400 | GVariant *variant, |
| 17401 | GError **error, |
| 17402 | gpointer user_data) |
| 17403 | { |
| 17404 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17405 | GValue value = G_VALUE_INIT; |
| 17406 | GParamSpec *pspec; |
| 17407 | _ExtendedGDBusPropertyInfo *info; |
| 17408 | gboolean ret; |
| 17409 | ret = FALSE; |
| 17410 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 17411 | g_assert (info != NULL); |
| 17412 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 17413 | if (pspec == NULL) |
| 17414 | { |
| 17415 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 17416 | } |
| 17417 | else |
| 17418 | { |
| 17419 | if (info->use_gvariant) |
| 17420 | g_value_set_variant (&value, variant); |
| 17421 | else |
| 17422 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 17423 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 17424 | g_value_unset (&value); |
| 17425 | ret = TRUE; |
| 17426 | } |
| 17427 | return ret; |
| 17428 | } |
| 17429 | |
| 17430 | static const GDBusInterfaceVTable _watchdog_skeleton_vtable = |
| 17431 | { |
| 17432 | _watchdog_skeleton_handle_method_call, |
| 17433 | _watchdog_skeleton_handle_get_property, |
| 17434 | _watchdog_skeleton_handle_set_property, |
| 17435 | {NULL} |
| 17436 | }; |
| 17437 | |
| 17438 | static GDBusInterfaceInfo * |
| 17439 | watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17440 | { |
| 17441 | return watchdog_interface_info (); |
| 17442 | } |
| 17443 | |
| 17444 | static GDBusInterfaceVTable * |
| 17445 | watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17446 | { |
| 17447 | return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; |
| 17448 | } |
| 17449 | |
| 17450 | static GVariant * |
| 17451 | watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 17452 | { |
| 17453 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 17454 | |
| 17455 | GVariantBuilder builder; |
| 17456 | guint n; |
| 17457 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17458 | if (_watchdog_interface_info.parent_struct.properties == NULL) |
| 17459 | goto out; |
| 17460 | for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) |
| 17461 | { |
| 17462 | GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; |
| 17463 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 17464 | { |
| 17465 | GVariant *value; |
| 17466 | 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); |
| 17467 | if (value != NULL) |
| 17468 | { |
| 17469 | g_variant_take_ref (value); |
| 17470 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 17471 | g_variant_unref (value); |
| 17472 | } |
| 17473 | } |
| 17474 | } |
| 17475 | out: |
| 17476 | return g_variant_builder_end (&builder); |
| 17477 | } |
| 17478 | |
| 17479 | static gboolean _watchdog_emit_changed (gpointer user_data); |
| 17480 | |
| 17481 | static void |
| 17482 | watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 17483 | { |
| 17484 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 17485 | gboolean emit_changed = FALSE; |
| 17486 | |
| 17487 | g_mutex_lock (&skeleton->priv->lock); |
| 17488 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17489 | { |
| 17490 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17491 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17492 | emit_changed = TRUE; |
| 17493 | } |
| 17494 | g_mutex_unlock (&skeleton->priv->lock); |
| 17495 | |
| 17496 | if (emit_changed) |
| 17497 | _watchdog_emit_changed (skeleton); |
| 17498 | } |
| 17499 | |
| 17500 | static void |
| 17501 | _watchdog_on_signal_watchdog_error ( |
| 17502 | Watchdog *object) |
| 17503 | { |
| 17504 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17505 | |
| 17506 | GList *connections, *l; |
| 17507 | GVariant *signal_variant; |
| 17508 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17509 | |
| 17510 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 17511 | for (l = connections; l != NULL; l = l->next) |
| 17512 | { |
| 17513 | GDBusConnection *connection = l->data; |
| 17514 | g_dbus_connection_emit_signal (connection, |
| 17515 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", |
| 17516 | signal_variant, NULL); |
| 17517 | } |
| 17518 | g_variant_unref (signal_variant); |
| 17519 | g_list_free_full (connections, g_object_unref); |
| 17520 | } |
| 17521 | |
| 17522 | static void watchdog_skeleton_iface_init (WatchdogIface *iface); |
| 17523 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17524 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17525 | G_ADD_PRIVATE (WatchdogSkeleton) |
| 17526 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 17527 | |
| 17528 | #else |
| 17529 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17530 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 17531 | |
| 17532 | #endif |
| 17533 | static void |
| 17534 | watchdog_skeleton_finalize (GObject *object) |
| 17535 | { |
| 17536 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17537 | guint n; |
| 17538 | for (n = 0; n < 2; n++) |
| 17539 | g_value_unset (&skeleton->priv->properties[n]); |
| 17540 | g_free (skeleton->priv->properties); |
| 17541 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17542 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17543 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17544 | g_main_context_unref (skeleton->priv->context); |
| 17545 | g_mutex_clear (&skeleton->priv->lock); |
| 17546 | G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); |
| 17547 | } |
| 17548 | |
| 17549 | static void |
| 17550 | watchdog_skeleton_get_property (GObject *object, |
| 17551 | guint prop_id, |
| 17552 | GValue *value, |
| 17553 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17554 | { |
| 17555 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17556 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 17557 | g_mutex_lock (&skeleton->priv->lock); |
| 17558 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 17559 | g_mutex_unlock (&skeleton->priv->lock); |
| 17560 | } |
| 17561 | |
| 17562 | static gboolean |
| 17563 | _watchdog_emit_changed (gpointer user_data) |
| 17564 | { |
| 17565 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 17566 | GList *l; |
| 17567 | GVariantBuilder builder; |
| 17568 | GVariantBuilder invalidated_builder; |
| 17569 | guint num_changes; |
| 17570 | |
| 17571 | g_mutex_lock (&skeleton->priv->lock); |
| 17572 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17573 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 17574 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 17575 | { |
| 17576 | ChangedProperty *cp = l->data; |
| 17577 | GVariant *variant; |
| 17578 | const GValue *cur_value; |
| 17579 | |
| 17580 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 17581 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 17582 | { |
| 17583 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 17584 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 17585 | g_variant_unref (variant); |
| 17586 | num_changes++; |
| 17587 | } |
| 17588 | } |
| 17589 | if (num_changes > 0) |
| 17590 | { |
| 17591 | GList *connections, *ll; |
| 17592 | GVariant *signal_variant; |
| 17593 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", |
| 17594 | &builder, &invalidated_builder)); |
| 17595 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17596 | for (ll = connections; ll != NULL; ll = ll->next) |
| 17597 | { |
| 17598 | GDBusConnection *connection = ll->data; |
| 17599 | |
| 17600 | g_dbus_connection_emit_signal (connection, |
| 17601 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 17602 | "org.freedesktop.DBus.Properties", |
| 17603 | "PropertiesChanged", |
| 17604 | signal_variant, |
| 17605 | NULL); |
| 17606 | } |
| 17607 | g_variant_unref (signal_variant); |
| 17608 | g_list_free_full (connections, g_object_unref); |
| 17609 | } |
| 17610 | else |
| 17611 | { |
| 17612 | g_variant_builder_clear (&builder); |
| 17613 | g_variant_builder_clear (&invalidated_builder); |
| 17614 | } |
| 17615 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17616 | skeleton->priv->changed_properties = NULL; |
| 17617 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17618 | g_mutex_unlock (&skeleton->priv->lock); |
| 17619 | return FALSE; |
| 17620 | } |
| 17621 | |
| 17622 | static void |
| 17623 | _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 17624 | { |
| 17625 | ChangedProperty *cp; |
| 17626 | GList *l; |
| 17627 | cp = NULL; |
| 17628 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 17629 | { |
| 17630 | ChangedProperty *i_cp = l->data; |
| 17631 | if (i_cp->info == info) |
| 17632 | { |
| 17633 | cp = i_cp; |
| 17634 | break; |
| 17635 | } |
| 17636 | } |
| 17637 | if (cp == NULL) |
| 17638 | { |
| 17639 | cp = g_new0 (ChangedProperty, 1); |
| 17640 | cp->prop_id = prop_id; |
| 17641 | cp->info = info; |
| 17642 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 17643 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 17644 | g_value_copy (orig_value, &cp->orig_value); |
| 17645 | } |
| 17646 | } |
| 17647 | |
| 17648 | static void |
| 17649 | watchdog_skeleton_notify (GObject *object, |
| 17650 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17651 | { |
| 17652 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17653 | g_mutex_lock (&skeleton->priv->lock); |
| 17654 | if (skeleton->priv->changed_properties != NULL && |
| 17655 | skeleton->priv->changed_properties_idle_source == NULL) |
| 17656 | { |
| 17657 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 17658 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 17659 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 17660 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 17661 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 17662 | } |
| 17663 | g_mutex_unlock (&skeleton->priv->lock); |
| 17664 | } |
| 17665 | |
| 17666 | static void |
| 17667 | watchdog_skeleton_set_property (GObject *object, |
| 17668 | guint prop_id, |
| 17669 | const GValue *value, |
| 17670 | GParamSpec *pspec) |
| 17671 | { |
| 17672 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17673 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 17674 | g_mutex_lock (&skeleton->priv->lock); |
| 17675 | g_object_freeze_notify (object); |
| 17676 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 17677 | { |
| 17678 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 17679 | _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 17680 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 17681 | g_object_notify_by_pspec (object, pspec); |
| 17682 | } |
| 17683 | g_mutex_unlock (&skeleton->priv->lock); |
| 17684 | g_object_thaw_notify (object); |
| 17685 | } |
| 17686 | |
| 17687 | static void |
| 17688 | watchdog_skeleton_init (WatchdogSkeleton *skeleton) |
| 17689 | { |
| 17690 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17691 | skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); |
| 17692 | #else |
| 17693 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); |
| 17694 | #endif |
| 17695 | |
| 17696 | g_mutex_init (&skeleton->priv->lock); |
| 17697 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 17698 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 17699 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 17700 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 17701 | } |
| 17702 | |
| 17703 | static gint |
| 17704 | watchdog_skeleton_get_watchdog (Watchdog *object) |
| 17705 | { |
| 17706 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17707 | gint value; |
| 17708 | g_mutex_lock (&skeleton->priv->lock); |
| 17709 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 17710 | g_mutex_unlock (&skeleton->priv->lock); |
| 17711 | return value; |
| 17712 | } |
| 17713 | |
| 17714 | static gint |
| 17715 | watchdog_skeleton_get_poll_interval (Watchdog *object) |
| 17716 | { |
| 17717 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 17718 | gint value; |
| 17719 | g_mutex_lock (&skeleton->priv->lock); |
| 17720 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 17721 | g_mutex_unlock (&skeleton->priv->lock); |
| 17722 | return value; |
| 17723 | } |
| 17724 | |
| 17725 | static void |
| 17726 | watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) |
| 17727 | { |
| 17728 | GObjectClass *gobject_class; |
| 17729 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 17730 | |
| 17731 | gobject_class = G_OBJECT_CLASS (klass); |
| 17732 | gobject_class->finalize = watchdog_skeleton_finalize; |
| 17733 | gobject_class->get_property = watchdog_skeleton_get_property; |
| 17734 | gobject_class->set_property = watchdog_skeleton_set_property; |
| 17735 | gobject_class->notify = watchdog_skeleton_notify; |
| 17736 | |
| 17737 | |
| 17738 | watchdog_override_properties (gobject_class, 1); |
| 17739 | |
| 17740 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 17741 | skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; |
| 17742 | skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; |
| 17743 | skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; |
| 17744 | skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; |
| 17745 | |
| 17746 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17747 | g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); |
| 17748 | #endif |
| 17749 | } |
| 17750 | |
| 17751 | static void |
| 17752 | watchdog_skeleton_iface_init (WatchdogIface *iface) |
| 17753 | { |
| 17754 | iface->watchdog_error = _watchdog_on_signal_watchdog_error; |
| 17755 | iface->get_watchdog = watchdog_skeleton_get_watchdog; |
| 17756 | iface->get_poll_interval = watchdog_skeleton_get_poll_interval; |
| 17757 | } |
| 17758 | |
| 17759 | /** |
| 17760 | * watchdog_skeleton_new: |
| 17761 | * |
| 17762 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 17763 | * |
| 17764 | * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. |
| 17765 | */ |
| 17766 | Watchdog * |
| 17767 | watchdog_skeleton_new (void) |
| 17768 | { |
| 17769 | return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); |
| 17770 | } |
| 17771 | |
| 17772 | /* ------------------------------------------------------------------------ |
| 17773 | * Code for interface org.openbmc.EventLog |
| 17774 | * ------------------------------------------------------------------------ |
| 17775 | */ |
| 17776 | |
| 17777 | /** |
| 17778 | * SECTION:EventLog |
| 17779 | * @title: EventLog |
| 17780 | * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface |
| 17781 | * |
| 17782 | * 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. |
| 17783 | */ |
| 17784 | |
| 17785 | /* ---- Introspection data for org.openbmc.EventLog ---- */ |
| 17786 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 17787 | static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log = |
| 17788 | { |
| 17789 | { |
| 17790 | -1, |
| 17791 | (gchar *) "log", |
| 17792 | (gchar *) "a(s)", |
| 17793 | NULL |
| 17794 | }, |
| 17795 | FALSE |
| 17796 | }; |
| 17797 | |
| 17798 | static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] = |
| 17799 | { |
| 17800 | &_event_log_method_info_get_event_log_OUT_ARG_log, |
| 17801 | NULL |
| 17802 | }; |
| 17803 | |
| 17804 | static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log = |
| 17805 | { |
| 17806 | { |
| 17807 | -1, |
| 17808 | (gchar *) "getEventLog", |
| 17809 | NULL, |
| 17810 | (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers, |
| 17811 | NULL |
| 17812 | }, |
| 17813 | "handle-get-event-log", |
| 17814 | FALSE |
| 17815 | }; |
| 17816 | |
| 17817 | static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] = |
| 17818 | { |
| 17819 | &_event_log_method_info_get_event_log, |
| 17820 | NULL |
| 17821 | }; |
| 17822 | |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17823 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17824 | { |
| 17825 | { |
| 17826 | -1, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17827 | (gchar *) "priority", |
| 17828 | (gchar *) "i", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17829 | NULL |
| 17830 | }, |
| 17831 | FALSE |
| 17832 | }; |
| 17833 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17834 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message = |
| 17835 | { |
| 17836 | { |
| 17837 | -1, |
| 17838 | (gchar *) "message", |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17839 | (gchar *) "s", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17840 | NULL |
| 17841 | }, |
| 17842 | FALSE |
| 17843 | }; |
| 17844 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 17845 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc = |
| 17846 | { |
| 17847 | { |
| 17848 | -1, |
| 17849 | (gchar *) "rc", |
| 17850 | (gchar *) "i", |
| 17851 | NULL |
| 17852 | }, |
| 17853 | FALSE |
| 17854 | }; |
| 17855 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17856 | static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] = |
| 17857 | { |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17858 | &_event_log_signal_info_event_log_ARG_priority, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17859 | &_event_log_signal_info_event_log_ARG_message, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 17860 | &_event_log_signal_info_event_log_ARG_rc, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17861 | NULL |
| 17862 | }; |
| 17863 | |
| 17864 | static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log = |
| 17865 | { |
| 17866 | { |
| 17867 | -1, |
| 17868 | (gchar *) "EventLog", |
| 17869 | (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers, |
| 17870 | NULL |
| 17871 | }, |
| 17872 | "event-log" |
| 17873 | }; |
| 17874 | |
| 17875 | static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] = |
| 17876 | { |
| 17877 | &_event_log_signal_info_event_log, |
| 17878 | NULL |
| 17879 | }; |
| 17880 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17881 | static const _ExtendedGDBusInterfaceInfo _event_log_interface_info = |
| 17882 | { |
| 17883 | { |
| 17884 | -1, |
| 17885 | (gchar *) "org.openbmc.EventLog", |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 17886 | (GDBusMethodInfo **) &_event_log_method_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17887 | (GDBusSignalInfo **) &_event_log_signal_info_pointers, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17888 | NULL, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17889 | NULL |
| 17890 | }, |
| 17891 | "event-log", |
| 17892 | }; |
| 17893 | |
| 17894 | |
| 17895 | /** |
| 17896 | * event_log_interface_info: |
| 17897 | * |
| 17898 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface. |
| 17899 | * |
| 17900 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 17901 | */ |
| 17902 | GDBusInterfaceInfo * |
| 17903 | event_log_interface_info (void) |
| 17904 | { |
| 17905 | return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct; |
| 17906 | } |
| 17907 | |
| 17908 | /** |
| 17909 | * event_log_override_properties: |
| 17910 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 17911 | * @property_id_begin: The property id to assign to the first overridden property. |
| 17912 | * |
| 17913 | * Overrides all #GObject properties in the #EventLog interface for a concrete class. |
| 17914 | * The properties are overridden in the order they are defined. |
| 17915 | * |
| 17916 | * Returns: The last property id. |
| 17917 | */ |
| 17918 | guint |
| 17919 | event_log_override_properties (GObjectClass *klass, guint property_id_begin) |
| 17920 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17921 | return property_id_begin - 1; |
| 17922 | } |
| 17923 | |
| 17924 | |
| 17925 | |
| 17926 | /** |
| 17927 | * EventLog: |
| 17928 | * |
| 17929 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 17930 | */ |
| 17931 | |
| 17932 | /** |
| 17933 | * EventLogIface: |
| 17934 | * @parent_iface: The parent interface. |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 17935 | * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17936 | * @event_log: Handler for the #EventLog::event-log signal. |
| 17937 | * |
| 17938 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 17939 | */ |
| 17940 | |
| 17941 | typedef EventLogIface EventLogInterface; |
| 17942 | G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT); |
| 17943 | |
| 17944 | static void |
| 17945 | event_log_default_init (EventLogIface *iface) |
| 17946 | { |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 17947 | /* GObject signals for incoming D-Bus method calls: */ |
| 17948 | /** |
| 17949 | * EventLog::handle-get-event-log: |
| 17950 | * @object: A #EventLog. |
| 17951 | * @invocation: A #GDBusMethodInvocation. |
| 17952 | * |
| 17953 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. |
| 17954 | * |
| 17955 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call event_log_complete_get_event_log() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 17956 | * |
| 17957 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17958 | */ |
| 17959 | g_signal_new ("handle-get-event-log", |
| 17960 | G_TYPE_FROM_INTERFACE (iface), |
| 17961 | G_SIGNAL_RUN_LAST, |
| 17962 | G_STRUCT_OFFSET (EventLogIface, handle_get_event_log), |
| 17963 | g_signal_accumulator_true_handled, |
| 17964 | NULL, |
| 17965 | g_cclosure_marshal_generic, |
| 17966 | G_TYPE_BOOLEAN, |
| 17967 | 1, |
| 17968 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 17969 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17970 | /* GObject signals for received D-Bus signals: */ |
| 17971 | /** |
| 17972 | * EventLog::event-log: |
| 17973 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17974 | * @arg_priority: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17975 | * @arg_message: Argument. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 17976 | * @arg_rc: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17977 | * |
| 17978 | * 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. |
| 17979 | * |
| 17980 | * 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. |
| 17981 | */ |
| 17982 | g_signal_new ("event-log", |
| 17983 | G_TYPE_FROM_INTERFACE (iface), |
| 17984 | G_SIGNAL_RUN_LAST, |
| 17985 | G_STRUCT_OFFSET (EventLogIface, event_log), |
| 17986 | NULL, |
| 17987 | NULL, |
| 17988 | g_cclosure_marshal_generic, |
| 17989 | G_TYPE_NONE, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 17990 | 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17991 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17992 | } |
| 17993 | |
| 17994 | /** |
| 17995 | * event_log_emit_event_log: |
| 17996 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 17997 | * @arg_priority: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17998 | * @arg_message: Argument to pass with the signal. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 17999 | * @arg_rc: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18000 | * |
| 18001 | * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal. |
| 18002 | */ |
| 18003 | void |
| 18004 | event_log_emit_event_log ( |
| 18005 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 18006 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 18007 | const gchar *arg_message, |
| 18008 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18009 | { |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 18010 | g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18011 | } |
| 18012 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 18013 | /** |
| 18014 | * event_log_call_get_event_log: |
| 18015 | * @proxy: A #EventLogProxy. |
| 18016 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18017 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 18018 | * @user_data: User data to pass to @callback. |
| 18019 | * |
| 18020 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. |
| 18021 | * 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. |
| 18022 | * You can then call event_log_call_get_event_log_finish() to get the result of the operation. |
| 18023 | * |
| 18024 | * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method. |
| 18025 | */ |
| 18026 | void |
| 18027 | event_log_call_get_event_log ( |
| 18028 | EventLog *proxy, |
| 18029 | GCancellable *cancellable, |
| 18030 | GAsyncReadyCallback callback, |
| 18031 | gpointer user_data) |
| 18032 | { |
| 18033 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 18034 | "getEventLog", |
| 18035 | g_variant_new ("()"), |
| 18036 | G_DBUS_CALL_FLAGS_NONE, |
| 18037 | -1, |
| 18038 | cancellable, |
| 18039 | callback, |
| 18040 | user_data); |
| 18041 | } |
| 18042 | |
| 18043 | /** |
| 18044 | * event_log_call_get_event_log_finish: |
| 18045 | * @proxy: A #EventLogProxy. |
| 18046 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 18047 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log(). |
| 18048 | * @error: Return location for error or %NULL. |
| 18049 | * |
| 18050 | * Finishes an operation started with event_log_call_get_event_log(). |
| 18051 | * |
| 18052 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18053 | */ |
| 18054 | gboolean |
| 18055 | event_log_call_get_event_log_finish ( |
| 18056 | EventLog *proxy, |
| 18057 | GVariant **out_log, |
| 18058 | GAsyncResult *res, |
| 18059 | GError **error) |
| 18060 | { |
| 18061 | GVariant *_ret; |
| 18062 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 18063 | if (_ret == NULL) |
| 18064 | goto _out; |
| 18065 | g_variant_get (_ret, |
| 18066 | "(@a(s))", |
| 18067 | out_log); |
| 18068 | g_variant_unref (_ret); |
| 18069 | _out: |
| 18070 | return _ret != NULL; |
| 18071 | } |
| 18072 | |
| 18073 | /** |
| 18074 | * event_log_call_get_event_log_sync: |
| 18075 | * @proxy: A #EventLogProxy. |
| 18076 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 18077 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18078 | * @error: Return location for error or %NULL. |
| 18079 | * |
| 18080 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 18081 | * |
| 18082 | * See event_log_call_get_event_log() for the asynchronous version of this method. |
| 18083 | * |
| 18084 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18085 | */ |
| 18086 | gboolean |
| 18087 | event_log_call_get_event_log_sync ( |
| 18088 | EventLog *proxy, |
| 18089 | GVariant **out_log, |
| 18090 | GCancellable *cancellable, |
| 18091 | GError **error) |
| 18092 | { |
| 18093 | GVariant *_ret; |
| 18094 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 18095 | "getEventLog", |
| 18096 | g_variant_new ("()"), |
| 18097 | G_DBUS_CALL_FLAGS_NONE, |
| 18098 | -1, |
| 18099 | cancellable, |
| 18100 | error); |
| 18101 | if (_ret == NULL) |
| 18102 | goto _out; |
| 18103 | g_variant_get (_ret, |
| 18104 | "(@a(s))", |
| 18105 | out_log); |
| 18106 | g_variant_unref (_ret); |
| 18107 | _out: |
| 18108 | return _ret != NULL; |
| 18109 | } |
| 18110 | |
| 18111 | /** |
| 18112 | * event_log_complete_get_event_log: |
| 18113 | * @object: A #EventLog. |
| 18114 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 18115 | * @log: Parameter to return. |
| 18116 | * |
| 18117 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 18118 | * |
| 18119 | * This method will free @invocation, you cannot use it afterwards. |
| 18120 | */ |
| 18121 | void |
| 18122 | event_log_complete_get_event_log ( |
| 18123 | EventLog *object, |
| 18124 | GDBusMethodInvocation *invocation, |
| 18125 | GVariant *log) |
| 18126 | { |
| 18127 | g_dbus_method_invocation_return_value (invocation, |
| 18128 | g_variant_new ("(@a(s))", |
| 18129 | log)); |
| 18130 | } |
| 18131 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18132 | /* ------------------------------------------------------------------------ */ |
| 18133 | |
| 18134 | /** |
| 18135 | * EventLogProxy: |
| 18136 | * |
| 18137 | * The #EventLogProxy structure contains only private data and should only be accessed using the provided API. |
| 18138 | */ |
| 18139 | |
| 18140 | /** |
| 18141 | * EventLogProxyClass: |
| 18142 | * @parent_class: The parent class. |
| 18143 | * |
| 18144 | * Class structure for #EventLogProxy. |
| 18145 | */ |
| 18146 | |
| 18147 | struct _EventLogProxyPrivate |
| 18148 | { |
| 18149 | GData *qdata; |
| 18150 | }; |
| 18151 | |
| 18152 | static void event_log_proxy_iface_init (EventLogIface *iface); |
| 18153 | |
| 18154 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18155 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 18156 | G_ADD_PRIVATE (EventLogProxy) |
| 18157 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 18158 | |
| 18159 | #else |
| 18160 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 18161 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 18162 | |
| 18163 | #endif |
| 18164 | static void |
| 18165 | event_log_proxy_finalize (GObject *object) |
| 18166 | { |
| 18167 | EventLogProxy *proxy = EVENT_LOG_PROXY (object); |
| 18168 | g_datalist_clear (&proxy->priv->qdata); |
| 18169 | G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object); |
| 18170 | } |
| 18171 | |
| 18172 | static void |
| 18173 | event_log_proxy_get_property (GObject *object, |
| 18174 | guint prop_id, |
| 18175 | GValue *value, |
| 18176 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18177 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18178 | } |
| 18179 | |
| 18180 | static void |
| 18181 | event_log_proxy_set_property (GObject *object, |
| 18182 | guint prop_id, |
| 18183 | const GValue *value, |
| 18184 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18185 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18186 | } |
| 18187 | |
| 18188 | static void |
| 18189 | event_log_proxy_g_signal (GDBusProxy *proxy, |
| 18190 | const gchar *sender_name G_GNUC_UNUSED, |
| 18191 | const gchar *signal_name, |
| 18192 | GVariant *parameters) |
| 18193 | { |
| 18194 | _ExtendedGDBusSignalInfo *info; |
| 18195 | GVariantIter iter; |
| 18196 | GVariant *child; |
| 18197 | GValue *paramv; |
| 18198 | guint num_params; |
| 18199 | guint n; |
| 18200 | guint signal_id; |
| 18201 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name); |
| 18202 | if (info == NULL) |
| 18203 | return; |
| 18204 | num_params = g_variant_n_children (parameters); |
| 18205 | paramv = g_new0 (GValue, num_params + 1); |
| 18206 | g_value_init (¶mv[0], TYPE_EVENT_LOG); |
| 18207 | g_value_set_object (¶mv[0], proxy); |
| 18208 | g_variant_iter_init (&iter, parameters); |
| 18209 | n = 1; |
| 18210 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18211 | { |
| 18212 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 18213 | if (arg_info->use_gvariant) |
| 18214 | { |
| 18215 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18216 | g_value_set_variant (¶mv[n], child); |
| 18217 | n++; |
| 18218 | } |
| 18219 | else |
| 18220 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18221 | g_variant_unref (child); |
| 18222 | } |
| 18223 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 18224 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 18225 | for (n = 0; n < num_params + 1; n++) |
| 18226 | g_value_unset (¶mv[n]); |
| 18227 | g_free (paramv); |
| 18228 | } |
| 18229 | |
| 18230 | static void |
| 18231 | event_log_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 18232 | GVariant *changed_properties, |
| 18233 | const gchar *const *invalidated_properties) |
| 18234 | { |
| 18235 | EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy); |
| 18236 | guint n; |
| 18237 | const gchar *key; |
| 18238 | GVariantIter *iter; |
| 18239 | _ExtendedGDBusPropertyInfo *info; |
| 18240 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 18241 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 18242 | { |
| 18243 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key); |
| 18244 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 18245 | if (info != NULL) |
| 18246 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 18247 | } |
| 18248 | g_variant_iter_free (iter); |
| 18249 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 18250 | { |
| 18251 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]); |
| 18252 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 18253 | if (info != NULL) |
| 18254 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 18255 | } |
| 18256 | } |
| 18257 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18258 | static void |
| 18259 | event_log_proxy_init (EventLogProxy *proxy) |
| 18260 | { |
| 18261 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18262 | proxy->priv = event_log_proxy_get_instance_private (proxy); |
| 18263 | #else |
| 18264 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate); |
| 18265 | #endif |
| 18266 | |
| 18267 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ()); |
| 18268 | } |
| 18269 | |
| 18270 | static void |
| 18271 | event_log_proxy_class_init (EventLogProxyClass *klass) |
| 18272 | { |
| 18273 | GObjectClass *gobject_class; |
| 18274 | GDBusProxyClass *proxy_class; |
| 18275 | |
| 18276 | gobject_class = G_OBJECT_CLASS (klass); |
| 18277 | gobject_class->finalize = event_log_proxy_finalize; |
| 18278 | gobject_class->get_property = event_log_proxy_get_property; |
| 18279 | gobject_class->set_property = event_log_proxy_set_property; |
| 18280 | |
| 18281 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 18282 | proxy_class->g_signal = event_log_proxy_g_signal; |
| 18283 | proxy_class->g_properties_changed = event_log_proxy_g_properties_changed; |
| 18284 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18285 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 18286 | g_type_class_add_private (klass, sizeof (EventLogProxyPrivate)); |
| 18287 | #endif |
| 18288 | } |
| 18289 | |
| 18290 | static void |
| 18291 | event_log_proxy_iface_init (EventLogIface *iface) |
| 18292 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18293 | } |
| 18294 | |
| 18295 | /** |
| 18296 | * event_log_proxy_new: |
| 18297 | * @connection: A #GDBusConnection. |
| 18298 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18299 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 18300 | * @object_path: An object path. |
| 18301 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18302 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 18303 | * @user_data: User data to pass to @callback. |
| 18304 | * |
| 18305 | * 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. |
| 18306 | * |
| 18307 | * 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. |
| 18308 | * You can then call event_log_proxy_new_finish() to get the result of the operation. |
| 18309 | * |
| 18310 | * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 18311 | */ |
| 18312 | void |
| 18313 | event_log_proxy_new ( |
| 18314 | GDBusConnection *connection, |
| 18315 | GDBusProxyFlags flags, |
| 18316 | const gchar *name, |
| 18317 | const gchar *object_path, |
| 18318 | GCancellable *cancellable, |
| 18319 | GAsyncReadyCallback callback, |
| 18320 | gpointer user_data) |
| 18321 | { |
| 18322 | 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); |
| 18323 | } |
| 18324 | |
| 18325 | /** |
| 18326 | * event_log_proxy_new_finish: |
| 18327 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new(). |
| 18328 | * @error: Return location for error or %NULL |
| 18329 | * |
| 18330 | * Finishes an operation started with event_log_proxy_new(). |
| 18331 | * |
| 18332 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18333 | */ |
| 18334 | EventLog * |
| 18335 | event_log_proxy_new_finish ( |
| 18336 | GAsyncResult *res, |
| 18337 | GError **error) |
| 18338 | { |
| 18339 | GObject *ret; |
| 18340 | GObject *source_object; |
| 18341 | source_object = g_async_result_get_source_object (res); |
| 18342 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18343 | g_object_unref (source_object); |
| 18344 | if (ret != NULL) |
| 18345 | return EVENT_LOG (ret); |
| 18346 | else |
| 18347 | return NULL; |
| 18348 | } |
| 18349 | |
| 18350 | /** |
| 18351 | * event_log_proxy_new_sync: |
| 18352 | * @connection: A #GDBusConnection. |
| 18353 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18354 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 18355 | * @object_path: An object path. |
| 18356 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18357 | * @error: Return location for error or %NULL |
| 18358 | * |
| 18359 | * 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. |
| 18360 | * |
| 18361 | * The calling thread is blocked until a reply is received. |
| 18362 | * |
| 18363 | * See event_log_proxy_new() for the asynchronous version of this constructor. |
| 18364 | * |
| 18365 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18366 | */ |
| 18367 | EventLog * |
| 18368 | event_log_proxy_new_sync ( |
| 18369 | GDBusConnection *connection, |
| 18370 | GDBusProxyFlags flags, |
| 18371 | const gchar *name, |
| 18372 | const gchar *object_path, |
| 18373 | GCancellable *cancellable, |
| 18374 | GError **error) |
| 18375 | { |
| 18376 | GInitable *ret; |
| 18377 | 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); |
| 18378 | if (ret != NULL) |
| 18379 | return EVENT_LOG (ret); |
| 18380 | else |
| 18381 | return NULL; |
| 18382 | } |
| 18383 | |
| 18384 | |
| 18385 | /** |
| 18386 | * event_log_proxy_new_for_bus: |
| 18387 | * @bus_type: A #GBusType. |
| 18388 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18389 | * @name: A bus name (well-known or unique). |
| 18390 | * @object_path: An object path. |
| 18391 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18392 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 18393 | * @user_data: User data to pass to @callback. |
| 18394 | * |
| 18395 | * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 18396 | * |
| 18397 | * 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. |
| 18398 | * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation. |
| 18399 | * |
| 18400 | * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 18401 | */ |
| 18402 | void |
| 18403 | event_log_proxy_new_for_bus ( |
| 18404 | GBusType bus_type, |
| 18405 | GDBusProxyFlags flags, |
| 18406 | const gchar *name, |
| 18407 | const gchar *object_path, |
| 18408 | GCancellable *cancellable, |
| 18409 | GAsyncReadyCallback callback, |
| 18410 | gpointer user_data) |
| 18411 | { |
| 18412 | 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); |
| 18413 | } |
| 18414 | |
| 18415 | /** |
| 18416 | * event_log_proxy_new_for_bus_finish: |
| 18417 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus(). |
| 18418 | * @error: Return location for error or %NULL |
| 18419 | * |
| 18420 | * Finishes an operation started with event_log_proxy_new_for_bus(). |
| 18421 | * |
| 18422 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18423 | */ |
| 18424 | EventLog * |
| 18425 | event_log_proxy_new_for_bus_finish ( |
| 18426 | GAsyncResult *res, |
| 18427 | GError **error) |
| 18428 | { |
| 18429 | GObject *ret; |
| 18430 | GObject *source_object; |
| 18431 | source_object = g_async_result_get_source_object (res); |
| 18432 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18433 | g_object_unref (source_object); |
| 18434 | if (ret != NULL) |
| 18435 | return EVENT_LOG (ret); |
| 18436 | else |
| 18437 | return NULL; |
| 18438 | } |
| 18439 | |
| 18440 | /** |
| 18441 | * event_log_proxy_new_for_bus_sync: |
| 18442 | * @bus_type: A #GBusType. |
| 18443 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18444 | * @name: A bus name (well-known or unique). |
| 18445 | * @object_path: An object path. |
| 18446 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18447 | * @error: Return location for error or %NULL |
| 18448 | * |
| 18449 | * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 18450 | * |
| 18451 | * The calling thread is blocked until a reply is received. |
| 18452 | * |
| 18453 | * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 18454 | * |
| 18455 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 18456 | */ |
| 18457 | EventLog * |
| 18458 | event_log_proxy_new_for_bus_sync ( |
| 18459 | GBusType bus_type, |
| 18460 | GDBusProxyFlags flags, |
| 18461 | const gchar *name, |
| 18462 | const gchar *object_path, |
| 18463 | GCancellable *cancellable, |
| 18464 | GError **error) |
| 18465 | { |
| 18466 | GInitable *ret; |
| 18467 | 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); |
| 18468 | if (ret != NULL) |
| 18469 | return EVENT_LOG (ret); |
| 18470 | else |
| 18471 | return NULL; |
| 18472 | } |
| 18473 | |
| 18474 | |
| 18475 | /* ------------------------------------------------------------------------ */ |
| 18476 | |
| 18477 | /** |
| 18478 | * EventLogSkeleton: |
| 18479 | * |
| 18480 | * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 18481 | */ |
| 18482 | |
| 18483 | /** |
| 18484 | * EventLogSkeletonClass: |
| 18485 | * @parent_class: The parent class. |
| 18486 | * |
| 18487 | * Class structure for #EventLogSkeleton. |
| 18488 | */ |
| 18489 | |
| 18490 | struct _EventLogSkeletonPrivate |
| 18491 | { |
| 18492 | GValue *properties; |
| 18493 | GList *changed_properties; |
| 18494 | GSource *changed_properties_idle_source; |
| 18495 | GMainContext *context; |
| 18496 | GMutex lock; |
| 18497 | }; |
| 18498 | |
| 18499 | static void |
| 18500 | _event_log_skeleton_handle_method_call ( |
| 18501 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18502 | const gchar *sender G_GNUC_UNUSED, |
| 18503 | const gchar *object_path G_GNUC_UNUSED, |
| 18504 | const gchar *interface_name, |
| 18505 | const gchar *method_name, |
| 18506 | GVariant *parameters, |
| 18507 | GDBusMethodInvocation *invocation, |
| 18508 | gpointer user_data) |
| 18509 | { |
| 18510 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18511 | _ExtendedGDBusMethodInfo *info; |
| 18512 | GVariantIter iter; |
| 18513 | GVariant *child; |
| 18514 | GValue *paramv; |
| 18515 | guint num_params; |
| 18516 | guint num_extra; |
| 18517 | guint n; |
| 18518 | guint signal_id; |
| 18519 | GValue return_value = G_VALUE_INIT; |
| 18520 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 18521 | g_assert (info != NULL); |
| 18522 | num_params = g_variant_n_children (parameters); |
| 18523 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 18524 | n = 0; |
| 18525 | g_value_init (¶mv[n], TYPE_EVENT_LOG); |
| 18526 | g_value_set_object (¶mv[n++], skeleton); |
| 18527 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 18528 | g_value_set_object (¶mv[n++], invocation); |
| 18529 | if (info->pass_fdlist) |
| 18530 | { |
| 18531 | #ifdef G_OS_UNIX |
| 18532 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 18533 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 18534 | #else |
| 18535 | g_assert_not_reached (); |
| 18536 | #endif |
| 18537 | } |
| 18538 | g_variant_iter_init (&iter, parameters); |
| 18539 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18540 | { |
| 18541 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 18542 | if (arg_info->use_gvariant) |
| 18543 | { |
| 18544 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18545 | g_value_set_variant (¶mv[n], child); |
| 18546 | n++; |
| 18547 | } |
| 18548 | else |
| 18549 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18550 | g_variant_unref (child); |
| 18551 | } |
| 18552 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 18553 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 18554 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 18555 | if (!g_value_get_boolean (&return_value)) |
| 18556 | 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); |
| 18557 | g_value_unset (&return_value); |
| 18558 | for (n = 0; n < num_params + num_extra; n++) |
| 18559 | g_value_unset (¶mv[n]); |
| 18560 | g_free (paramv); |
| 18561 | } |
| 18562 | |
| 18563 | static GVariant * |
| 18564 | _event_log_skeleton_handle_get_property ( |
| 18565 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18566 | const gchar *sender G_GNUC_UNUSED, |
| 18567 | const gchar *object_path G_GNUC_UNUSED, |
| 18568 | const gchar *interface_name G_GNUC_UNUSED, |
| 18569 | const gchar *property_name, |
| 18570 | GError **error, |
| 18571 | gpointer user_data) |
| 18572 | { |
| 18573 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18574 | GValue value = G_VALUE_INIT; |
| 18575 | GParamSpec *pspec; |
| 18576 | _ExtendedGDBusPropertyInfo *info; |
| 18577 | GVariant *ret; |
| 18578 | ret = NULL; |
| 18579 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 18580 | g_assert (info != NULL); |
| 18581 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18582 | if (pspec == NULL) |
| 18583 | { |
| 18584 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18585 | } |
| 18586 | else |
| 18587 | { |
| 18588 | g_value_init (&value, pspec->value_type); |
| 18589 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18590 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 18591 | g_value_unset (&value); |
| 18592 | } |
| 18593 | return ret; |
| 18594 | } |
| 18595 | |
| 18596 | static gboolean |
| 18597 | _event_log_skeleton_handle_set_property ( |
| 18598 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18599 | const gchar *sender G_GNUC_UNUSED, |
| 18600 | const gchar *object_path G_GNUC_UNUSED, |
| 18601 | const gchar *interface_name G_GNUC_UNUSED, |
| 18602 | const gchar *property_name, |
| 18603 | GVariant *variant, |
| 18604 | GError **error, |
| 18605 | gpointer user_data) |
| 18606 | { |
| 18607 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 18608 | GValue value = G_VALUE_INIT; |
| 18609 | GParamSpec *pspec; |
| 18610 | _ExtendedGDBusPropertyInfo *info; |
| 18611 | gboolean ret; |
| 18612 | ret = FALSE; |
| 18613 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 18614 | g_assert (info != NULL); |
| 18615 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18616 | if (pspec == NULL) |
| 18617 | { |
| 18618 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18619 | } |
| 18620 | else |
| 18621 | { |
| 18622 | if (info->use_gvariant) |
| 18623 | g_value_set_variant (&value, variant); |
| 18624 | else |
| 18625 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 18626 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18627 | g_value_unset (&value); |
| 18628 | ret = TRUE; |
| 18629 | } |
| 18630 | return ret; |
| 18631 | } |
| 18632 | |
| 18633 | static const GDBusInterfaceVTable _event_log_skeleton_vtable = |
| 18634 | { |
| 18635 | _event_log_skeleton_handle_method_call, |
| 18636 | _event_log_skeleton_handle_get_property, |
| 18637 | _event_log_skeleton_handle_set_property, |
| 18638 | {NULL} |
| 18639 | }; |
| 18640 | |
| 18641 | static GDBusInterfaceInfo * |
| 18642 | event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18643 | { |
| 18644 | return event_log_interface_info (); |
| 18645 | } |
| 18646 | |
| 18647 | static GDBusInterfaceVTable * |
| 18648 | event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18649 | { |
| 18650 | return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable; |
| 18651 | } |
| 18652 | |
| 18653 | static GVariant * |
| 18654 | event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 18655 | { |
| 18656 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton); |
| 18657 | |
| 18658 | GVariantBuilder builder; |
| 18659 | guint n; |
| 18660 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18661 | if (_event_log_interface_info.parent_struct.properties == NULL) |
| 18662 | goto out; |
| 18663 | for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++) |
| 18664 | { |
| 18665 | GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n]; |
| 18666 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 18667 | { |
| 18668 | GVariant *value; |
| 18669 | 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); |
| 18670 | if (value != NULL) |
| 18671 | { |
| 18672 | g_variant_take_ref (value); |
| 18673 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 18674 | g_variant_unref (value); |
| 18675 | } |
| 18676 | } |
| 18677 | } |
| 18678 | out: |
| 18679 | return g_variant_builder_end (&builder); |
| 18680 | } |
| 18681 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18682 | static void |
| 18683 | event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 18684 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18685 | } |
| 18686 | |
| 18687 | static void |
| 18688 | _event_log_on_signal_event_log ( |
| 18689 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 18690 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 18691 | const gchar *arg_message, |
| 18692 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18693 | { |
| 18694 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
| 18695 | |
| 18696 | GList *connections, *l; |
| 18697 | GVariant *signal_variant; |
| 18698 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18699 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 18700 | signal_variant = g_variant_ref_sink (g_variant_new ("(isi)", |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 18701 | arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 18702 | arg_message, |
| 18703 | arg_rc)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18704 | for (l = connections; l != NULL; l = l->next) |
| 18705 | { |
| 18706 | GDBusConnection *connection = l->data; |
| 18707 | g_dbus_connection_emit_signal (connection, |
| 18708 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog", |
| 18709 | signal_variant, NULL); |
| 18710 | } |
| 18711 | g_variant_unref (signal_variant); |
| 18712 | g_list_free_full (connections, g_object_unref); |
| 18713 | } |
| 18714 | |
| 18715 | static void event_log_skeleton_iface_init (EventLogIface *iface); |
| 18716 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18717 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18718 | G_ADD_PRIVATE (EventLogSkeleton) |
| 18719 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 18720 | |
| 18721 | #else |
| 18722 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18723 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 18724 | |
| 18725 | #endif |
| 18726 | static void |
| 18727 | event_log_skeleton_finalize (GObject *object) |
| 18728 | { |
| 18729 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18730 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 18731 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18732 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18733 | g_main_context_unref (skeleton->priv->context); |
| 18734 | g_mutex_clear (&skeleton->priv->lock); |
| 18735 | G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object); |
| 18736 | } |
| 18737 | |
| 18738 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18739 | event_log_skeleton_init (EventLogSkeleton *skeleton) |
| 18740 | { |
| 18741 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18742 | skeleton->priv = event_log_skeleton_get_instance_private (skeleton); |
| 18743 | #else |
| 18744 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate); |
| 18745 | #endif |
| 18746 | |
| 18747 | g_mutex_init (&skeleton->priv->lock); |
| 18748 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18749 | } |
| 18750 | |
| 18751 | static void |
| 18752 | event_log_skeleton_class_init (EventLogSkeletonClass *klass) |
| 18753 | { |
| 18754 | GObjectClass *gobject_class; |
| 18755 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 18756 | |
| 18757 | gobject_class = G_OBJECT_CLASS (klass); |
| 18758 | gobject_class->finalize = event_log_skeleton_finalize; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18759 | |
| 18760 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 18761 | skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info; |
| 18762 | skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties; |
| 18763 | skeleton_class->flush = event_log_skeleton_dbus_interface_flush; |
| 18764 | skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable; |
| 18765 | |
| 18766 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 18767 | g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate)); |
| 18768 | #endif |
| 18769 | } |
| 18770 | |
| 18771 | static void |
| 18772 | event_log_skeleton_iface_init (EventLogIface *iface) |
| 18773 | { |
| 18774 | iface->event_log = _event_log_on_signal_event_log; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18775 | } |
| 18776 | |
| 18777 | /** |
| 18778 | * event_log_skeleton_new: |
| 18779 | * |
| 18780 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 18781 | * |
| 18782 | * Returns: (transfer full) (type EventLogSkeleton): The skeleton object. |
| 18783 | */ |
| 18784 | EventLog * |
| 18785 | event_log_skeleton_new (void) |
| 18786 | { |
| 18787 | return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL)); |
| 18788 | } |
| 18789 | |
| 18790 | /* ------------------------------------------------------------------------ |
| 18791 | * Code for interface org.openbmc.Flash |
| 18792 | * ------------------------------------------------------------------------ |
| 18793 | */ |
| 18794 | |
| 18795 | /** |
| 18796 | * SECTION:Flash |
| 18797 | * @title: Flash |
| 18798 | * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface |
| 18799 | * |
| 18800 | * 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. |
| 18801 | */ |
| 18802 | |
| 18803 | /* ---- Introspection data for org.openbmc.Flash ---- */ |
| 18804 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18805 | static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18806 | { |
| 18807 | { |
| 18808 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18809 | (gchar *) "filename", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18810 | (gchar *) "s", |
| 18811 | NULL |
| 18812 | }, |
| 18813 | FALSE |
| 18814 | }; |
| 18815 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18816 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18817 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18818 | &_flash_method_info_update_IN_ARG_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18819 | NULL |
| 18820 | }; |
| 18821 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18822 | static const _ExtendedGDBusMethodInfo _flash_method_info_update = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18823 | { |
| 18824 | { |
| 18825 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18826 | (gchar *) "update", |
| 18827 | (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18828 | NULL, |
| 18829 | NULL |
| 18830 | }, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18831 | "handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18832 | FALSE |
| 18833 | }; |
| 18834 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 18835 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url = |
| 18836 | { |
| 18837 | { |
| 18838 | -1, |
| 18839 | (gchar *) "url", |
| 18840 | (gchar *) "s", |
| 18841 | NULL |
| 18842 | }, |
| 18843 | FALSE |
| 18844 | }; |
| 18845 | |
| 18846 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename = |
| 18847 | { |
| 18848 | { |
| 18849 | -1, |
| 18850 | (gchar *) "filename", |
| 18851 | (gchar *) "s", |
| 18852 | NULL |
| 18853 | }, |
| 18854 | FALSE |
| 18855 | }; |
| 18856 | |
| 18857 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] = |
| 18858 | { |
| 18859 | &_flash_method_info_update_via_tftp_IN_ARG_url, |
| 18860 | &_flash_method_info_update_via_tftp_IN_ARG_filename, |
| 18861 | NULL |
| 18862 | }; |
| 18863 | |
| 18864 | static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp = |
| 18865 | { |
| 18866 | { |
| 18867 | -1, |
| 18868 | (gchar *) "updateViaTftp", |
| 18869 | (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers, |
| 18870 | NULL, |
| 18871 | NULL |
| 18872 | }, |
| 18873 | "handle-update-via-tftp", |
| 18874 | FALSE |
| 18875 | }; |
| 18876 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18877 | static const _ExtendedGDBusMethodInfo _flash_method_info_init = |
| 18878 | { |
| 18879 | { |
| 18880 | -1, |
| 18881 | (gchar *) "init", |
| 18882 | NULL, |
| 18883 | NULL, |
| 18884 | NULL |
| 18885 | }, |
| 18886 | "handle-init", |
| 18887 | FALSE |
| 18888 | }; |
| 18889 | |
| 18890 | static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] = |
| 18891 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 18892 | &_flash_method_info_update, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 18893 | &_flash_method_info_update_via_tftp, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18894 | &_flash_method_info_init, |
| 18895 | NULL |
| 18896 | }; |
| 18897 | |
| 18898 | static const _ExtendedGDBusSignalInfo _flash_signal_info_updated = |
| 18899 | { |
| 18900 | { |
| 18901 | -1, |
| 18902 | (gchar *) "Updated", |
| 18903 | NULL, |
| 18904 | NULL |
| 18905 | }, |
| 18906 | "updated" |
| 18907 | }; |
| 18908 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 18909 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url = |
| 18910 | { |
| 18911 | { |
| 18912 | -1, |
| 18913 | (gchar *) "url", |
| 18914 | (gchar *) "s", |
| 18915 | NULL |
| 18916 | }, |
| 18917 | FALSE |
| 18918 | }; |
| 18919 | |
| 18920 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename = |
| 18921 | { |
| 18922 | { |
| 18923 | -1, |
| 18924 | (gchar *) "filename", |
| 18925 | (gchar *) "s", |
| 18926 | NULL |
| 18927 | }, |
| 18928 | FALSE |
| 18929 | }; |
| 18930 | |
| 18931 | static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] = |
| 18932 | { |
| 18933 | &_flash_signal_info_download_ARG_url, |
| 18934 | &_flash_signal_info_download_ARG_filename, |
| 18935 | NULL |
| 18936 | }; |
| 18937 | |
| 18938 | static const _ExtendedGDBusSignalInfo _flash_signal_info_download = |
| 18939 | { |
| 18940 | { |
| 18941 | -1, |
| 18942 | (gchar *) "Download", |
| 18943 | (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers, |
| 18944 | NULL |
| 18945 | }, |
| 18946 | "download" |
| 18947 | }; |
| 18948 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18949 | static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] = |
| 18950 | { |
| 18951 | &_flash_signal_info_updated, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 18952 | &_flash_signal_info_download, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18953 | NULL |
| 18954 | }; |
| 18955 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 18956 | static const _ExtendedGDBusPropertyInfo _flash_property_info_filename = |
| 18957 | { |
| 18958 | { |
| 18959 | -1, |
| 18960 | (gchar *) "filename", |
| 18961 | (gchar *) "s", |
| 18962 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 18963 | NULL |
| 18964 | }, |
| 18965 | "filename", |
| 18966 | FALSE |
| 18967 | }; |
| 18968 | |
| 18969 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path = |
| 18970 | { |
| 18971 | { |
| 18972 | -1, |
| 18973 | (gchar *) "flasher_path", |
| 18974 | (gchar *) "s", |
| 18975 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 18976 | NULL |
| 18977 | }, |
| 18978 | "flasher-path", |
| 18979 | FALSE |
| 18980 | }; |
| 18981 | |
| 18982 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name = |
| 18983 | { |
| 18984 | { |
| 18985 | -1, |
| 18986 | (gchar *) "flasher_name", |
| 18987 | (gchar *) "s", |
| 18988 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 18989 | NULL |
| 18990 | }, |
| 18991 | "flasher-name", |
| 18992 | FALSE |
| 18993 | }; |
| 18994 | |
| 18995 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance = |
| 18996 | { |
| 18997 | { |
| 18998 | -1, |
| 18999 | (gchar *) "flasher_instance", |
| 19000 | (gchar *) "s", |
| 19001 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 19002 | NULL |
| 19003 | }, |
| 19004 | "flasher-instance", |
| 19005 | FALSE |
| 19006 | }; |
| 19007 | |
| 19008 | static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] = |
| 19009 | { |
| 19010 | &_flash_property_info_filename, |
| 19011 | &_flash_property_info_flasher_path, |
| 19012 | &_flash_property_info_flasher_name, |
| 19013 | &_flash_property_info_flasher_instance, |
| 19014 | NULL |
| 19015 | }; |
| 19016 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19017 | static const _ExtendedGDBusInterfaceInfo _flash_interface_info = |
| 19018 | { |
| 19019 | { |
| 19020 | -1, |
| 19021 | (gchar *) "org.openbmc.Flash", |
| 19022 | (GDBusMethodInfo **) &_flash_method_info_pointers, |
| 19023 | (GDBusSignalInfo **) &_flash_signal_info_pointers, |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19024 | (GDBusPropertyInfo **) &_flash_property_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19025 | NULL |
| 19026 | }, |
| 19027 | "flash", |
| 19028 | }; |
| 19029 | |
| 19030 | |
| 19031 | /** |
| 19032 | * flash_interface_info: |
| 19033 | * |
| 19034 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface. |
| 19035 | * |
| 19036 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 19037 | */ |
| 19038 | GDBusInterfaceInfo * |
| 19039 | flash_interface_info (void) |
| 19040 | { |
| 19041 | return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct; |
| 19042 | } |
| 19043 | |
| 19044 | /** |
| 19045 | * flash_override_properties: |
| 19046 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 19047 | * @property_id_begin: The property id to assign to the first overridden property. |
| 19048 | * |
| 19049 | * Overrides all #GObject properties in the #Flash interface for a concrete class. |
| 19050 | * The properties are overridden in the order they are defined. |
| 19051 | * |
| 19052 | * Returns: The last property id. |
| 19053 | */ |
| 19054 | guint |
| 19055 | flash_override_properties (GObjectClass *klass, guint property_id_begin) |
| 19056 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19057 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 19058 | g_object_class_override_property (klass, property_id_begin++, "flasher-path"); |
| 19059 | g_object_class_override_property (klass, property_id_begin++, "flasher-name"); |
| 19060 | g_object_class_override_property (klass, property_id_begin++, "flasher-instance"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19061 | return property_id_begin - 1; |
| 19062 | } |
| 19063 | |
| 19064 | |
| 19065 | |
| 19066 | /** |
| 19067 | * Flash: |
| 19068 | * |
| 19069 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 19070 | */ |
| 19071 | |
| 19072 | /** |
| 19073 | * FlashIface: |
| 19074 | * @parent_iface: The parent interface. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19075 | * @handle_init: Handler for the #Flash::handle-init signal. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19076 | * @handle_update: Handler for the #Flash::handle-update signal. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19077 | * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal. |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19078 | * @get_filename: Getter for the #Flash:filename property. |
| 19079 | * @get_flasher_instance: Getter for the #Flash:flasher-instance property. |
| 19080 | * @get_flasher_name: Getter for the #Flash:flasher-name property. |
| 19081 | * @get_flasher_path: Getter for the #Flash:flasher-path property. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19082 | * @download: Handler for the #Flash::download signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19083 | * @updated: Handler for the #Flash::updated signal. |
| 19084 | * |
| 19085 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 19086 | */ |
| 19087 | |
| 19088 | typedef FlashIface FlashInterface; |
| 19089 | G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT); |
| 19090 | |
| 19091 | static void |
| 19092 | flash_default_init (FlashIface *iface) |
| 19093 | { |
| 19094 | /* GObject signals for incoming D-Bus method calls: */ |
| 19095 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19096 | * Flash::handle-update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19097 | * @object: A #Flash. |
| 19098 | * @invocation: A #GDBusMethodInvocation. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19099 | * @arg_filename: Argument passed by remote caller. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19100 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19101 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19102 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19103 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19104 | * |
| 19105 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 19106 | */ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19107 | g_signal_new ("handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19108 | G_TYPE_FROM_INTERFACE (iface), |
| 19109 | G_SIGNAL_RUN_LAST, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19110 | G_STRUCT_OFFSET (FlashIface, handle_update), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19111 | g_signal_accumulator_true_handled, |
| 19112 | NULL, |
| 19113 | g_cclosure_marshal_generic, |
| 19114 | G_TYPE_BOOLEAN, |
| 19115 | 2, |
| 19116 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 19117 | |
| 19118 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19119 | * Flash::handle-update-via-tftp: |
| 19120 | * @object: A #Flash. |
| 19121 | * @invocation: A #GDBusMethodInvocation. |
| 19122 | * @arg_url: Argument passed by remote caller. |
| 19123 | * @arg_filename: Argument passed by remote caller. |
| 19124 | * |
| 19125 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. |
| 19126 | * |
| 19127 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 19128 | * |
| 19129 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 19130 | */ |
| 19131 | g_signal_new ("handle-update-via-tftp", |
| 19132 | G_TYPE_FROM_INTERFACE (iface), |
| 19133 | G_SIGNAL_RUN_LAST, |
| 19134 | G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp), |
| 19135 | g_signal_accumulator_true_handled, |
| 19136 | NULL, |
| 19137 | g_cclosure_marshal_generic, |
| 19138 | G_TYPE_BOOLEAN, |
| 19139 | 3, |
| 19140 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 19141 | |
| 19142 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19143 | * Flash::handle-init: |
| 19144 | * @object: A #Flash. |
| 19145 | * @invocation: A #GDBusMethodInvocation. |
| 19146 | * |
| 19147 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. |
| 19148 | * |
| 19149 | * 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. |
| 19150 | * |
| 19151 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 19152 | */ |
| 19153 | g_signal_new ("handle-init", |
| 19154 | G_TYPE_FROM_INTERFACE (iface), |
| 19155 | G_SIGNAL_RUN_LAST, |
| 19156 | G_STRUCT_OFFSET (FlashIface, handle_init), |
| 19157 | g_signal_accumulator_true_handled, |
| 19158 | NULL, |
| 19159 | g_cclosure_marshal_generic, |
| 19160 | G_TYPE_BOOLEAN, |
| 19161 | 1, |
| 19162 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 19163 | |
| 19164 | /* GObject signals for received D-Bus signals: */ |
| 19165 | /** |
| 19166 | * Flash::updated: |
| 19167 | * @object: A #Flash. |
| 19168 | * |
| 19169 | * 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. |
| 19170 | * |
| 19171 | * 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. |
| 19172 | */ |
| 19173 | g_signal_new ("updated", |
| 19174 | G_TYPE_FROM_INTERFACE (iface), |
| 19175 | G_SIGNAL_RUN_LAST, |
| 19176 | G_STRUCT_OFFSET (FlashIface, updated), |
| 19177 | NULL, |
| 19178 | NULL, |
| 19179 | g_cclosure_marshal_generic, |
| 19180 | G_TYPE_NONE, |
| 19181 | 0); |
| 19182 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19183 | /** |
| 19184 | * Flash::download: |
| 19185 | * @object: A #Flash. |
| 19186 | * @arg_url: Argument. |
| 19187 | * @arg_filename: Argument. |
| 19188 | * |
| 19189 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received. |
| 19190 | * |
| 19191 | * 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. |
| 19192 | */ |
| 19193 | g_signal_new ("download", |
| 19194 | G_TYPE_FROM_INTERFACE (iface), |
| 19195 | G_SIGNAL_RUN_LAST, |
| 19196 | G_STRUCT_OFFSET (FlashIface, download), |
| 19197 | NULL, |
| 19198 | NULL, |
| 19199 | g_cclosure_marshal_generic, |
| 19200 | G_TYPE_NONE, |
| 19201 | 2, G_TYPE_STRING, G_TYPE_STRING); |
| 19202 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19203 | /* GObject properties for D-Bus properties: */ |
| 19204 | /** |
| 19205 | * Flash:filename: |
| 19206 | * |
| 19207 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>. |
| 19208 | * |
| 19209 | * 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. |
| 19210 | */ |
| 19211 | g_object_interface_install_property (iface, |
| 19212 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 19213 | /** |
| 19214 | * Flash:flasher-path: |
| 19215 | * |
| 19216 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>. |
| 19217 | * |
| 19218 | * 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. |
| 19219 | */ |
| 19220 | g_object_interface_install_property (iface, |
| 19221 | g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 19222 | /** |
| 19223 | * Flash:flasher-name: |
| 19224 | * |
| 19225 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>. |
| 19226 | * |
| 19227 | * 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. |
| 19228 | */ |
| 19229 | g_object_interface_install_property (iface, |
| 19230 | g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 19231 | /** |
| 19232 | * Flash:flasher-instance: |
| 19233 | * |
| 19234 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>. |
| 19235 | * |
| 19236 | * 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. |
| 19237 | */ |
| 19238 | g_object_interface_install_property (iface, |
| 19239 | g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 19240 | } |
| 19241 | |
| 19242 | /** |
| 19243 | * flash_get_filename: (skip) |
| 19244 | * @object: A #Flash. |
| 19245 | * |
| 19246 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 19247 | * |
| 19248 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19249 | * |
| 19250 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_filename() if on another thread.</warning> |
| 19251 | * |
| 19252 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 19253 | */ |
| 19254 | const gchar * |
| 19255 | flash_get_filename (Flash *object) |
| 19256 | { |
| 19257 | return FLASH_GET_IFACE (object)->get_filename (object); |
| 19258 | } |
| 19259 | |
| 19260 | /** |
| 19261 | * flash_dup_filename: (skip) |
| 19262 | * @object: A #Flash. |
| 19263 | * |
| 19264 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 19265 | * |
| 19266 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19267 | * |
| 19268 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 19269 | */ |
| 19270 | gchar * |
| 19271 | flash_dup_filename (Flash *object) |
| 19272 | { |
| 19273 | gchar *value; |
| 19274 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 19275 | return value; |
| 19276 | } |
| 19277 | |
| 19278 | /** |
| 19279 | * flash_set_filename: (skip) |
| 19280 | * @object: A #Flash. |
| 19281 | * @value: The value to set. |
| 19282 | * |
| 19283 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value. |
| 19284 | * |
| 19285 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 19286 | */ |
| 19287 | void |
| 19288 | flash_set_filename (Flash *object, const gchar *value) |
| 19289 | { |
| 19290 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 19291 | } |
| 19292 | |
| 19293 | /** |
| 19294 | * flash_get_flasher_path: (skip) |
| 19295 | * @object: A #Flash. |
| 19296 | * |
| 19297 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 19298 | * |
| 19299 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19300 | * |
| 19301 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_path() if on another thread.</warning> |
| 19302 | * |
| 19303 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 19304 | */ |
| 19305 | const gchar * |
| 19306 | flash_get_flasher_path (Flash *object) |
| 19307 | { |
| 19308 | return FLASH_GET_IFACE (object)->get_flasher_path (object); |
| 19309 | } |
| 19310 | |
| 19311 | /** |
| 19312 | * flash_dup_flasher_path: (skip) |
| 19313 | * @object: A #Flash. |
| 19314 | * |
| 19315 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 19316 | * |
| 19317 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19318 | * |
| 19319 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 19320 | */ |
| 19321 | gchar * |
| 19322 | flash_dup_flasher_path (Flash *object) |
| 19323 | { |
| 19324 | gchar *value; |
| 19325 | g_object_get (G_OBJECT (object), "flasher-path", &value, NULL); |
| 19326 | return value; |
| 19327 | } |
| 19328 | |
| 19329 | /** |
| 19330 | * flash_set_flasher_path: (skip) |
| 19331 | * @object: A #Flash. |
| 19332 | * @value: The value to set. |
| 19333 | * |
| 19334 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value. |
| 19335 | * |
| 19336 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 19337 | */ |
| 19338 | void |
| 19339 | flash_set_flasher_path (Flash *object, const gchar *value) |
| 19340 | { |
| 19341 | g_object_set (G_OBJECT (object), "flasher-path", value, NULL); |
| 19342 | } |
| 19343 | |
| 19344 | /** |
| 19345 | * flash_get_flasher_name: (skip) |
| 19346 | * @object: A #Flash. |
| 19347 | * |
| 19348 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 19349 | * |
| 19350 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19351 | * |
| 19352 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_name() if on another thread.</warning> |
| 19353 | * |
| 19354 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 19355 | */ |
| 19356 | const gchar * |
| 19357 | flash_get_flasher_name (Flash *object) |
| 19358 | { |
| 19359 | return FLASH_GET_IFACE (object)->get_flasher_name (object); |
| 19360 | } |
| 19361 | |
| 19362 | /** |
| 19363 | * flash_dup_flasher_name: (skip) |
| 19364 | * @object: A #Flash. |
| 19365 | * |
| 19366 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 19367 | * |
| 19368 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19369 | * |
| 19370 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 19371 | */ |
| 19372 | gchar * |
| 19373 | flash_dup_flasher_name (Flash *object) |
| 19374 | { |
| 19375 | gchar *value; |
| 19376 | g_object_get (G_OBJECT (object), "flasher-name", &value, NULL); |
| 19377 | return value; |
| 19378 | } |
| 19379 | |
| 19380 | /** |
| 19381 | * flash_set_flasher_name: (skip) |
| 19382 | * @object: A #Flash. |
| 19383 | * @value: The value to set. |
| 19384 | * |
| 19385 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value. |
| 19386 | * |
| 19387 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 19388 | */ |
| 19389 | void |
| 19390 | flash_set_flasher_name (Flash *object, const gchar *value) |
| 19391 | { |
| 19392 | g_object_set (G_OBJECT (object), "flasher-name", value, NULL); |
| 19393 | } |
| 19394 | |
| 19395 | /** |
| 19396 | * flash_get_flasher_instance: (skip) |
| 19397 | * @object: A #Flash. |
| 19398 | * |
| 19399 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 19400 | * |
| 19401 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19402 | * |
| 19403 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_instance() if on another thread.</warning> |
| 19404 | * |
| 19405 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 19406 | */ |
| 19407 | const gchar * |
| 19408 | flash_get_flasher_instance (Flash *object) |
| 19409 | { |
| 19410 | return FLASH_GET_IFACE (object)->get_flasher_instance (object); |
| 19411 | } |
| 19412 | |
| 19413 | /** |
| 19414 | * flash_dup_flasher_instance: (skip) |
| 19415 | * @object: A #Flash. |
| 19416 | * |
| 19417 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 19418 | * |
| 19419 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 19420 | * |
| 19421 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 19422 | */ |
| 19423 | gchar * |
| 19424 | flash_dup_flasher_instance (Flash *object) |
| 19425 | { |
| 19426 | gchar *value; |
| 19427 | g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL); |
| 19428 | return value; |
| 19429 | } |
| 19430 | |
| 19431 | /** |
| 19432 | * flash_set_flasher_instance: (skip) |
| 19433 | * @object: A #Flash. |
| 19434 | * @value: The value to set. |
| 19435 | * |
| 19436 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value. |
| 19437 | * |
| 19438 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 19439 | */ |
| 19440 | void |
| 19441 | flash_set_flasher_instance (Flash *object, const gchar *value) |
| 19442 | { |
| 19443 | g_object_set (G_OBJECT (object), "flasher-instance", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19444 | } |
| 19445 | |
| 19446 | /** |
| 19447 | * flash_emit_updated: |
| 19448 | * @object: A #Flash. |
| 19449 | * |
| 19450 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal. |
| 19451 | */ |
| 19452 | void |
| 19453 | flash_emit_updated ( |
| 19454 | Flash *object) |
| 19455 | { |
| 19456 | g_signal_emit_by_name (object, "updated"); |
| 19457 | } |
| 19458 | |
| 19459 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19460 | * flash_emit_download: |
| 19461 | * @object: A #Flash. |
| 19462 | * @arg_url: Argument to pass with the signal. |
| 19463 | * @arg_filename: Argument to pass with the signal. |
| 19464 | * |
| 19465 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal. |
| 19466 | */ |
| 19467 | void |
| 19468 | flash_emit_download ( |
| 19469 | Flash *object, |
| 19470 | const gchar *arg_url, |
| 19471 | const gchar *arg_filename) |
| 19472 | { |
| 19473 | g_signal_emit_by_name (object, "download", arg_url, arg_filename); |
| 19474 | } |
| 19475 | |
| 19476 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19477 | * flash_call_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19478 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19479 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19480 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19481 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19482 | * @user_data: User data to pass to @callback. |
| 19483 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19484 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19485 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19486 | * You can then call flash_call_update_finish() to get the result of the operation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19487 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19488 | * See flash_call_update_sync() for the synchronous, blocking version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19489 | */ |
| 19490 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19491 | flash_call_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19492 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19493 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19494 | GCancellable *cancellable, |
| 19495 | GAsyncReadyCallback callback, |
| 19496 | gpointer user_data) |
| 19497 | { |
| 19498 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19499 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19500 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19501 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19502 | G_DBUS_CALL_FLAGS_NONE, |
| 19503 | -1, |
| 19504 | cancellable, |
| 19505 | callback, |
| 19506 | user_data); |
| 19507 | } |
| 19508 | |
| 19509 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19510 | * flash_call_update_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19511 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19512 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19513 | * @error: Return location for error or %NULL. |
| 19514 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19515 | * Finishes an operation started with flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19516 | * |
| 19517 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19518 | */ |
| 19519 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19520 | flash_call_update_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19521 | Flash *proxy, |
| 19522 | GAsyncResult *res, |
| 19523 | GError **error) |
| 19524 | { |
| 19525 | GVariant *_ret; |
| 19526 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19527 | if (_ret == NULL) |
| 19528 | goto _out; |
| 19529 | g_variant_get (_ret, |
| 19530 | "()"); |
| 19531 | g_variant_unref (_ret); |
| 19532 | _out: |
| 19533 | return _ret != NULL; |
| 19534 | } |
| 19535 | |
| 19536 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19537 | * flash_call_update_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19538 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19539 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19540 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19541 | * @error: Return location for error or %NULL. |
| 19542 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19543 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19544 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19545 | * See flash_call_update() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19546 | * |
| 19547 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19548 | */ |
| 19549 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19550 | flash_call_update_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19551 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19552 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19553 | GCancellable *cancellable, |
| 19554 | GError **error) |
| 19555 | { |
| 19556 | GVariant *_ret; |
| 19557 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19558 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19559 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19560 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19561 | G_DBUS_CALL_FLAGS_NONE, |
| 19562 | -1, |
| 19563 | cancellable, |
| 19564 | error); |
| 19565 | if (_ret == NULL) |
| 19566 | goto _out; |
| 19567 | g_variant_get (_ret, |
| 19568 | "()"); |
| 19569 | g_variant_unref (_ret); |
| 19570 | _out: |
| 19571 | return _ret != NULL; |
| 19572 | } |
| 19573 | |
| 19574 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19575 | * flash_call_update_via_tftp: |
| 19576 | * @proxy: A #FlashProxy. |
| 19577 | * @arg_url: Argument to pass with the method invocation. |
| 19578 | * @arg_filename: Argument to pass with the method invocation. |
| 19579 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19580 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19581 | * @user_data: User data to pass to @callback. |
| 19582 | * |
| 19583 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. |
| 19584 | * 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. |
| 19585 | * You can then call flash_call_update_via_tftp_finish() to get the result of the operation. |
| 19586 | * |
| 19587 | * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method. |
| 19588 | */ |
| 19589 | void |
| 19590 | flash_call_update_via_tftp ( |
| 19591 | Flash *proxy, |
| 19592 | const gchar *arg_url, |
| 19593 | const gchar *arg_filename, |
| 19594 | GCancellable *cancellable, |
| 19595 | GAsyncReadyCallback callback, |
| 19596 | gpointer user_data) |
| 19597 | { |
| 19598 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19599 | "updateViaTftp", |
| 19600 | g_variant_new ("(ss)", |
| 19601 | arg_url, |
| 19602 | arg_filename), |
| 19603 | G_DBUS_CALL_FLAGS_NONE, |
| 19604 | -1, |
| 19605 | cancellable, |
| 19606 | callback, |
| 19607 | user_data); |
| 19608 | } |
| 19609 | |
| 19610 | /** |
| 19611 | * flash_call_update_via_tftp_finish: |
| 19612 | * @proxy: A #FlashProxy. |
| 19613 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp(). |
| 19614 | * @error: Return location for error or %NULL. |
| 19615 | * |
| 19616 | * Finishes an operation started with flash_call_update_via_tftp(). |
| 19617 | * |
| 19618 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19619 | */ |
| 19620 | gboolean |
| 19621 | flash_call_update_via_tftp_finish ( |
| 19622 | Flash *proxy, |
| 19623 | GAsyncResult *res, |
| 19624 | GError **error) |
| 19625 | { |
| 19626 | GVariant *_ret; |
| 19627 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19628 | if (_ret == NULL) |
| 19629 | goto _out; |
| 19630 | g_variant_get (_ret, |
| 19631 | "()"); |
| 19632 | g_variant_unref (_ret); |
| 19633 | _out: |
| 19634 | return _ret != NULL; |
| 19635 | } |
| 19636 | |
| 19637 | /** |
| 19638 | * flash_call_update_via_tftp_sync: |
| 19639 | * @proxy: A #FlashProxy. |
| 19640 | * @arg_url: Argument to pass with the method invocation. |
| 19641 | * @arg_filename: Argument to pass with the method invocation. |
| 19642 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19643 | * @error: Return location for error or %NULL. |
| 19644 | * |
| 19645 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 19646 | * |
| 19647 | * See flash_call_update_via_tftp() for the asynchronous version of this method. |
| 19648 | * |
| 19649 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19650 | */ |
| 19651 | gboolean |
| 19652 | flash_call_update_via_tftp_sync ( |
| 19653 | Flash *proxy, |
| 19654 | const gchar *arg_url, |
| 19655 | const gchar *arg_filename, |
| 19656 | GCancellable *cancellable, |
| 19657 | GError **error) |
| 19658 | { |
| 19659 | GVariant *_ret; |
| 19660 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19661 | "updateViaTftp", |
| 19662 | g_variant_new ("(ss)", |
| 19663 | arg_url, |
| 19664 | arg_filename), |
| 19665 | G_DBUS_CALL_FLAGS_NONE, |
| 19666 | -1, |
| 19667 | cancellable, |
| 19668 | error); |
| 19669 | if (_ret == NULL) |
| 19670 | goto _out; |
| 19671 | g_variant_get (_ret, |
| 19672 | "()"); |
| 19673 | g_variant_unref (_ret); |
| 19674 | _out: |
| 19675 | return _ret != NULL; |
| 19676 | } |
| 19677 | |
| 19678 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19679 | * flash_call_init: |
| 19680 | * @proxy: A #FlashProxy. |
| 19681 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19682 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19683 | * @user_data: User data to pass to @callback. |
| 19684 | * |
| 19685 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. |
| 19686 | * 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. |
| 19687 | * You can then call flash_call_init_finish() to get the result of the operation. |
| 19688 | * |
| 19689 | * See flash_call_init_sync() for the synchronous, blocking version of this method. |
| 19690 | */ |
| 19691 | void |
| 19692 | flash_call_init ( |
| 19693 | Flash *proxy, |
| 19694 | GCancellable *cancellable, |
| 19695 | GAsyncReadyCallback callback, |
| 19696 | gpointer user_data) |
| 19697 | { |
| 19698 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19699 | "init", |
| 19700 | g_variant_new ("()"), |
| 19701 | G_DBUS_CALL_FLAGS_NONE, |
| 19702 | -1, |
| 19703 | cancellable, |
| 19704 | callback, |
| 19705 | user_data); |
| 19706 | } |
| 19707 | |
| 19708 | /** |
| 19709 | * flash_call_init_finish: |
| 19710 | * @proxy: A #FlashProxy. |
| 19711 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init(). |
| 19712 | * @error: Return location for error or %NULL. |
| 19713 | * |
| 19714 | * Finishes an operation started with flash_call_init(). |
| 19715 | * |
| 19716 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19717 | */ |
| 19718 | gboolean |
| 19719 | flash_call_init_finish ( |
| 19720 | Flash *proxy, |
| 19721 | GAsyncResult *res, |
| 19722 | GError **error) |
| 19723 | { |
| 19724 | GVariant *_ret; |
| 19725 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19726 | if (_ret == NULL) |
| 19727 | goto _out; |
| 19728 | g_variant_get (_ret, |
| 19729 | "()"); |
| 19730 | g_variant_unref (_ret); |
| 19731 | _out: |
| 19732 | return _ret != NULL; |
| 19733 | } |
| 19734 | |
| 19735 | /** |
| 19736 | * flash_call_init_sync: |
| 19737 | * @proxy: A #FlashProxy. |
| 19738 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19739 | * @error: Return location for error or %NULL. |
| 19740 | * |
| 19741 | * 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. |
| 19742 | * |
| 19743 | * See flash_call_init() for the asynchronous version of this method. |
| 19744 | * |
| 19745 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19746 | */ |
| 19747 | gboolean |
| 19748 | flash_call_init_sync ( |
| 19749 | Flash *proxy, |
| 19750 | GCancellable *cancellable, |
| 19751 | GError **error) |
| 19752 | { |
| 19753 | GVariant *_ret; |
| 19754 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19755 | "init", |
| 19756 | g_variant_new ("()"), |
| 19757 | G_DBUS_CALL_FLAGS_NONE, |
| 19758 | -1, |
| 19759 | cancellable, |
| 19760 | error); |
| 19761 | if (_ret == NULL) |
| 19762 | goto _out; |
| 19763 | g_variant_get (_ret, |
| 19764 | "()"); |
| 19765 | g_variant_unref (_ret); |
| 19766 | _out: |
| 19767 | return _ret != NULL; |
| 19768 | } |
| 19769 | |
| 19770 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19771 | * flash_complete_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19772 | * @object: A #Flash. |
| 19773 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19774 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19775 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19776 | * |
| 19777 | * This method will free @invocation, you cannot use it afterwards. |
| 19778 | */ |
| 19779 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 19780 | flash_complete_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19781 | Flash *object, |
| 19782 | GDBusMethodInvocation *invocation) |
| 19783 | { |
| 19784 | g_dbus_method_invocation_return_value (invocation, |
| 19785 | g_variant_new ("()")); |
| 19786 | } |
| 19787 | |
| 19788 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 19789 | * flash_complete_update_via_tftp: |
| 19790 | * @object: A #Flash. |
| 19791 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19792 | * |
| 19793 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 19794 | * |
| 19795 | * This method will free @invocation, you cannot use it afterwards. |
| 19796 | */ |
| 19797 | void |
| 19798 | flash_complete_update_via_tftp ( |
| 19799 | Flash *object, |
| 19800 | GDBusMethodInvocation *invocation) |
| 19801 | { |
| 19802 | g_dbus_method_invocation_return_value (invocation, |
| 19803 | g_variant_new ("()")); |
| 19804 | } |
| 19805 | |
| 19806 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19807 | * flash_complete_init: |
| 19808 | * @object: A #Flash. |
| 19809 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19810 | * |
| 19811 | * 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. |
| 19812 | * |
| 19813 | * This method will free @invocation, you cannot use it afterwards. |
| 19814 | */ |
| 19815 | void |
| 19816 | flash_complete_init ( |
| 19817 | Flash *object, |
| 19818 | GDBusMethodInvocation *invocation) |
| 19819 | { |
| 19820 | g_dbus_method_invocation_return_value (invocation, |
| 19821 | g_variant_new ("()")); |
| 19822 | } |
| 19823 | |
| 19824 | /* ------------------------------------------------------------------------ */ |
| 19825 | |
| 19826 | /** |
| 19827 | * FlashProxy: |
| 19828 | * |
| 19829 | * The #FlashProxy structure contains only private data and should only be accessed using the provided API. |
| 19830 | */ |
| 19831 | |
| 19832 | /** |
| 19833 | * FlashProxyClass: |
| 19834 | * @parent_class: The parent class. |
| 19835 | * |
| 19836 | * Class structure for #FlashProxy. |
| 19837 | */ |
| 19838 | |
| 19839 | struct _FlashProxyPrivate |
| 19840 | { |
| 19841 | GData *qdata; |
| 19842 | }; |
| 19843 | |
| 19844 | static void flash_proxy_iface_init (FlashIface *iface); |
| 19845 | |
| 19846 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19847 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 19848 | G_ADD_PRIVATE (FlashProxy) |
| 19849 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 19850 | |
| 19851 | #else |
| 19852 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 19853 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 19854 | |
| 19855 | #endif |
| 19856 | static void |
| 19857 | flash_proxy_finalize (GObject *object) |
| 19858 | { |
| 19859 | FlashProxy *proxy = FLASH_PROXY (object); |
| 19860 | g_datalist_clear (&proxy->priv->qdata); |
| 19861 | G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object); |
| 19862 | } |
| 19863 | |
| 19864 | static void |
| 19865 | flash_proxy_get_property (GObject *object, |
| 19866 | guint prop_id, |
| 19867 | GValue *value, |
| 19868 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19869 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19870 | const _ExtendedGDBusPropertyInfo *info; |
| 19871 | GVariant *variant; |
| 19872 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 19873 | info = _flash_property_info_pointers[prop_id - 1]; |
| 19874 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 19875 | if (info->use_gvariant) |
| 19876 | { |
| 19877 | g_value_set_variant (value, variant); |
| 19878 | } |
| 19879 | else |
| 19880 | { |
| 19881 | if (variant != NULL) |
| 19882 | g_dbus_gvariant_to_gvalue (variant, value); |
| 19883 | } |
| 19884 | if (variant != NULL) |
| 19885 | g_variant_unref (variant); |
| 19886 | } |
| 19887 | |
| 19888 | static void |
| 19889 | flash_proxy_set_property_cb (GDBusProxy *proxy, |
| 19890 | GAsyncResult *res, |
| 19891 | gpointer user_data) |
| 19892 | { |
| 19893 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 19894 | GError *error; |
| 19895 | GVariant *_ret; |
| 19896 | error = NULL; |
| 19897 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 19898 | if (!_ret) |
| 19899 | { |
| 19900 | g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)", |
| 19901 | info->parent_struct.name, |
| 19902 | error->message, g_quark_to_string (error->domain), error->code); |
| 19903 | g_error_free (error); |
| 19904 | } |
| 19905 | else |
| 19906 | { |
| 19907 | g_variant_unref (_ret); |
| 19908 | } |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19909 | } |
| 19910 | |
| 19911 | static void |
| 19912 | flash_proxy_set_property (GObject *object, |
| 19913 | guint prop_id, |
| 19914 | const GValue *value, |
| 19915 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19916 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 19917 | const _ExtendedGDBusPropertyInfo *info; |
| 19918 | GVariant *variant; |
| 19919 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 19920 | info = _flash_property_info_pointers[prop_id - 1]; |
| 19921 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 19922 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 19923 | "org.freedesktop.DBus.Properties.Set", |
| 19924 | g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant), |
| 19925 | G_DBUS_CALL_FLAGS_NONE, |
| 19926 | -1, |
| 19927 | NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 19928 | g_variant_unref (variant); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19929 | } |
| 19930 | |
| 19931 | static void |
| 19932 | flash_proxy_g_signal (GDBusProxy *proxy, |
| 19933 | const gchar *sender_name G_GNUC_UNUSED, |
| 19934 | const gchar *signal_name, |
| 19935 | GVariant *parameters) |
| 19936 | { |
| 19937 | _ExtendedGDBusSignalInfo *info; |
| 19938 | GVariantIter iter; |
| 19939 | GVariant *child; |
| 19940 | GValue *paramv; |
| 19941 | guint num_params; |
| 19942 | guint n; |
| 19943 | guint signal_id; |
| 19944 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name); |
| 19945 | if (info == NULL) |
| 19946 | return; |
| 19947 | num_params = g_variant_n_children (parameters); |
| 19948 | paramv = g_new0 (GValue, num_params + 1); |
| 19949 | g_value_init (¶mv[0], TYPE_FLASH); |
| 19950 | g_value_set_object (¶mv[0], proxy); |
| 19951 | g_variant_iter_init (&iter, parameters); |
| 19952 | n = 1; |
| 19953 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19954 | { |
| 19955 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 19956 | if (arg_info->use_gvariant) |
| 19957 | { |
| 19958 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19959 | g_value_set_variant (¶mv[n], child); |
| 19960 | n++; |
| 19961 | } |
| 19962 | else |
| 19963 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19964 | g_variant_unref (child); |
| 19965 | } |
| 19966 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 19967 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 19968 | for (n = 0; n < num_params + 1; n++) |
| 19969 | g_value_unset (¶mv[n]); |
| 19970 | g_free (paramv); |
| 19971 | } |
| 19972 | |
| 19973 | static void |
| 19974 | flash_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 19975 | GVariant *changed_properties, |
| 19976 | const gchar *const *invalidated_properties) |
| 19977 | { |
| 19978 | FlashProxy *proxy = FLASH_PROXY (_proxy); |
| 19979 | guint n; |
| 19980 | const gchar *key; |
| 19981 | GVariantIter *iter; |
| 19982 | _ExtendedGDBusPropertyInfo *info; |
| 19983 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 19984 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 19985 | { |
| 19986 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key); |
| 19987 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 19988 | if (info != NULL) |
| 19989 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19990 | } |
| 19991 | g_variant_iter_free (iter); |
| 19992 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 19993 | { |
| 19994 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]); |
| 19995 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 19996 | if (info != NULL) |
| 19997 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19998 | } |
| 19999 | } |
| 20000 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20001 | static const gchar * |
| 20002 | flash_proxy_get_filename (Flash *object) |
| 20003 | { |
| 20004 | FlashProxy *proxy = FLASH_PROXY (object); |
| 20005 | GVariant *variant; |
| 20006 | const gchar *value = NULL; |
| 20007 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 20008 | if (variant != NULL) |
| 20009 | { |
| 20010 | value = g_variant_get_string (variant, NULL); |
| 20011 | g_variant_unref (variant); |
| 20012 | } |
| 20013 | return value; |
| 20014 | } |
| 20015 | |
| 20016 | static const gchar * |
| 20017 | flash_proxy_get_flasher_path (Flash *object) |
| 20018 | { |
| 20019 | FlashProxy *proxy = FLASH_PROXY (object); |
| 20020 | GVariant *variant; |
| 20021 | const gchar *value = NULL; |
| 20022 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path"); |
| 20023 | if (variant != NULL) |
| 20024 | { |
| 20025 | value = g_variant_get_string (variant, NULL); |
| 20026 | g_variant_unref (variant); |
| 20027 | } |
| 20028 | return value; |
| 20029 | } |
| 20030 | |
| 20031 | static const gchar * |
| 20032 | flash_proxy_get_flasher_name (Flash *object) |
| 20033 | { |
| 20034 | FlashProxy *proxy = FLASH_PROXY (object); |
| 20035 | GVariant *variant; |
| 20036 | const gchar *value = NULL; |
| 20037 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name"); |
| 20038 | if (variant != NULL) |
| 20039 | { |
| 20040 | value = g_variant_get_string (variant, NULL); |
| 20041 | g_variant_unref (variant); |
| 20042 | } |
| 20043 | return value; |
| 20044 | } |
| 20045 | |
| 20046 | static const gchar * |
| 20047 | flash_proxy_get_flasher_instance (Flash *object) |
| 20048 | { |
| 20049 | FlashProxy *proxy = FLASH_PROXY (object); |
| 20050 | GVariant *variant; |
| 20051 | const gchar *value = NULL; |
| 20052 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance"); |
| 20053 | if (variant != NULL) |
| 20054 | { |
| 20055 | value = g_variant_get_string (variant, NULL); |
| 20056 | g_variant_unref (variant); |
| 20057 | } |
| 20058 | return value; |
| 20059 | } |
| 20060 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20061 | static void |
| 20062 | flash_proxy_init (FlashProxy *proxy) |
| 20063 | { |
| 20064 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20065 | proxy->priv = flash_proxy_get_instance_private (proxy); |
| 20066 | #else |
| 20067 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate); |
| 20068 | #endif |
| 20069 | |
| 20070 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ()); |
| 20071 | } |
| 20072 | |
| 20073 | static void |
| 20074 | flash_proxy_class_init (FlashProxyClass *klass) |
| 20075 | { |
| 20076 | GObjectClass *gobject_class; |
| 20077 | GDBusProxyClass *proxy_class; |
| 20078 | |
| 20079 | gobject_class = G_OBJECT_CLASS (klass); |
| 20080 | gobject_class->finalize = flash_proxy_finalize; |
| 20081 | gobject_class->get_property = flash_proxy_get_property; |
| 20082 | gobject_class->set_property = flash_proxy_set_property; |
| 20083 | |
| 20084 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 20085 | proxy_class->g_signal = flash_proxy_g_signal; |
| 20086 | proxy_class->g_properties_changed = flash_proxy_g_properties_changed; |
| 20087 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20088 | flash_override_properties (gobject_class, 1); |
| 20089 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20090 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20091 | g_type_class_add_private (klass, sizeof (FlashProxyPrivate)); |
| 20092 | #endif |
| 20093 | } |
| 20094 | |
| 20095 | static void |
| 20096 | flash_proxy_iface_init (FlashIface *iface) |
| 20097 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20098 | iface->get_filename = flash_proxy_get_filename; |
| 20099 | iface->get_flasher_path = flash_proxy_get_flasher_path; |
| 20100 | iface->get_flasher_name = flash_proxy_get_flasher_name; |
| 20101 | iface->get_flasher_instance = flash_proxy_get_flasher_instance; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20102 | } |
| 20103 | |
| 20104 | /** |
| 20105 | * flash_proxy_new: |
| 20106 | * @connection: A #GDBusConnection. |
| 20107 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20108 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20109 | * @object_path: An object path. |
| 20110 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20111 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 20112 | * @user_data: User data to pass to @callback. |
| 20113 | * |
| 20114 | * 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. |
| 20115 | * |
| 20116 | * 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. |
| 20117 | * You can then call flash_proxy_new_finish() to get the result of the operation. |
| 20118 | * |
| 20119 | * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 20120 | */ |
| 20121 | void |
| 20122 | flash_proxy_new ( |
| 20123 | GDBusConnection *connection, |
| 20124 | GDBusProxyFlags flags, |
| 20125 | const gchar *name, |
| 20126 | const gchar *object_path, |
| 20127 | GCancellable *cancellable, |
| 20128 | GAsyncReadyCallback callback, |
| 20129 | gpointer user_data) |
| 20130 | { |
| 20131 | 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); |
| 20132 | } |
| 20133 | |
| 20134 | /** |
| 20135 | * flash_proxy_new_finish: |
| 20136 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new(). |
| 20137 | * @error: Return location for error or %NULL |
| 20138 | * |
| 20139 | * Finishes an operation started with flash_proxy_new(). |
| 20140 | * |
| 20141 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 20142 | */ |
| 20143 | Flash * |
| 20144 | flash_proxy_new_finish ( |
| 20145 | GAsyncResult *res, |
| 20146 | GError **error) |
| 20147 | { |
| 20148 | GObject *ret; |
| 20149 | GObject *source_object; |
| 20150 | source_object = g_async_result_get_source_object (res); |
| 20151 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 20152 | g_object_unref (source_object); |
| 20153 | if (ret != NULL) |
| 20154 | return FLASH (ret); |
| 20155 | else |
| 20156 | return NULL; |
| 20157 | } |
| 20158 | |
| 20159 | /** |
| 20160 | * flash_proxy_new_sync: |
| 20161 | * @connection: A #GDBusConnection. |
| 20162 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20163 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20164 | * @object_path: An object path. |
| 20165 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20166 | * @error: Return location for error or %NULL |
| 20167 | * |
| 20168 | * 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. |
| 20169 | * |
| 20170 | * The calling thread is blocked until a reply is received. |
| 20171 | * |
| 20172 | * See flash_proxy_new() for the asynchronous version of this constructor. |
| 20173 | * |
| 20174 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 20175 | */ |
| 20176 | Flash * |
| 20177 | flash_proxy_new_sync ( |
| 20178 | GDBusConnection *connection, |
| 20179 | GDBusProxyFlags flags, |
| 20180 | const gchar *name, |
| 20181 | const gchar *object_path, |
| 20182 | GCancellable *cancellable, |
| 20183 | GError **error) |
| 20184 | { |
| 20185 | GInitable *ret; |
| 20186 | 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); |
| 20187 | if (ret != NULL) |
| 20188 | return FLASH (ret); |
| 20189 | else |
| 20190 | return NULL; |
| 20191 | } |
| 20192 | |
| 20193 | |
| 20194 | /** |
| 20195 | * flash_proxy_new_for_bus: |
| 20196 | * @bus_type: A #GBusType. |
| 20197 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20198 | * @name: A bus name (well-known or unique). |
| 20199 | * @object_path: An object path. |
| 20200 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20201 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 20202 | * @user_data: User data to pass to @callback. |
| 20203 | * |
| 20204 | * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 20205 | * |
| 20206 | * 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. |
| 20207 | * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation. |
| 20208 | * |
| 20209 | * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 20210 | */ |
| 20211 | void |
| 20212 | flash_proxy_new_for_bus ( |
| 20213 | GBusType bus_type, |
| 20214 | GDBusProxyFlags flags, |
| 20215 | const gchar *name, |
| 20216 | const gchar *object_path, |
| 20217 | GCancellable *cancellable, |
| 20218 | GAsyncReadyCallback callback, |
| 20219 | gpointer user_data) |
| 20220 | { |
| 20221 | 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); |
| 20222 | } |
| 20223 | |
| 20224 | /** |
| 20225 | * flash_proxy_new_for_bus_finish: |
| 20226 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus(). |
| 20227 | * @error: Return location for error or %NULL |
| 20228 | * |
| 20229 | * Finishes an operation started with flash_proxy_new_for_bus(). |
| 20230 | * |
| 20231 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 20232 | */ |
| 20233 | Flash * |
| 20234 | flash_proxy_new_for_bus_finish ( |
| 20235 | GAsyncResult *res, |
| 20236 | GError **error) |
| 20237 | { |
| 20238 | GObject *ret; |
| 20239 | GObject *source_object; |
| 20240 | source_object = g_async_result_get_source_object (res); |
| 20241 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 20242 | g_object_unref (source_object); |
| 20243 | if (ret != NULL) |
| 20244 | return FLASH (ret); |
| 20245 | else |
| 20246 | return NULL; |
| 20247 | } |
| 20248 | |
| 20249 | /** |
| 20250 | * flash_proxy_new_for_bus_sync: |
| 20251 | * @bus_type: A #GBusType. |
| 20252 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20253 | * @name: A bus name (well-known or unique). |
| 20254 | * @object_path: An object path. |
| 20255 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20256 | * @error: Return location for error or %NULL |
| 20257 | * |
| 20258 | * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 20259 | * |
| 20260 | * The calling thread is blocked until a reply is received. |
| 20261 | * |
| 20262 | * See flash_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 20263 | * |
| 20264 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 20265 | */ |
| 20266 | Flash * |
| 20267 | flash_proxy_new_for_bus_sync ( |
| 20268 | GBusType bus_type, |
| 20269 | GDBusProxyFlags flags, |
| 20270 | const gchar *name, |
| 20271 | const gchar *object_path, |
| 20272 | GCancellable *cancellable, |
| 20273 | GError **error) |
| 20274 | { |
| 20275 | GInitable *ret; |
| 20276 | 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); |
| 20277 | if (ret != NULL) |
| 20278 | return FLASH (ret); |
| 20279 | else |
| 20280 | return NULL; |
| 20281 | } |
| 20282 | |
| 20283 | |
| 20284 | /* ------------------------------------------------------------------------ */ |
| 20285 | |
| 20286 | /** |
| 20287 | * FlashSkeleton: |
| 20288 | * |
| 20289 | * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API. |
| 20290 | */ |
| 20291 | |
| 20292 | /** |
| 20293 | * FlashSkeletonClass: |
| 20294 | * @parent_class: The parent class. |
| 20295 | * |
| 20296 | * Class structure for #FlashSkeleton. |
| 20297 | */ |
| 20298 | |
| 20299 | struct _FlashSkeletonPrivate |
| 20300 | { |
| 20301 | GValue *properties; |
| 20302 | GList *changed_properties; |
| 20303 | GSource *changed_properties_idle_source; |
| 20304 | GMainContext *context; |
| 20305 | GMutex lock; |
| 20306 | }; |
| 20307 | |
| 20308 | static void |
| 20309 | _flash_skeleton_handle_method_call ( |
| 20310 | GDBusConnection *connection G_GNUC_UNUSED, |
| 20311 | const gchar *sender G_GNUC_UNUSED, |
| 20312 | const gchar *object_path G_GNUC_UNUSED, |
| 20313 | const gchar *interface_name, |
| 20314 | const gchar *method_name, |
| 20315 | GVariant *parameters, |
| 20316 | GDBusMethodInvocation *invocation, |
| 20317 | gpointer user_data) |
| 20318 | { |
| 20319 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 20320 | _ExtendedGDBusMethodInfo *info; |
| 20321 | GVariantIter iter; |
| 20322 | GVariant *child; |
| 20323 | GValue *paramv; |
| 20324 | guint num_params; |
| 20325 | guint num_extra; |
| 20326 | guint n; |
| 20327 | guint signal_id; |
| 20328 | GValue return_value = G_VALUE_INIT; |
| 20329 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 20330 | g_assert (info != NULL); |
| 20331 | num_params = g_variant_n_children (parameters); |
| 20332 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 20333 | n = 0; |
| 20334 | g_value_init (¶mv[n], TYPE_FLASH); |
| 20335 | g_value_set_object (¶mv[n++], skeleton); |
| 20336 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 20337 | g_value_set_object (¶mv[n++], invocation); |
| 20338 | if (info->pass_fdlist) |
| 20339 | { |
| 20340 | #ifdef G_OS_UNIX |
| 20341 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 20342 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 20343 | #else |
| 20344 | g_assert_not_reached (); |
| 20345 | #endif |
| 20346 | } |
| 20347 | g_variant_iter_init (&iter, parameters); |
| 20348 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 20349 | { |
| 20350 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 20351 | if (arg_info->use_gvariant) |
| 20352 | { |
| 20353 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 20354 | g_value_set_variant (¶mv[n], child); |
| 20355 | n++; |
| 20356 | } |
| 20357 | else |
| 20358 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 20359 | g_variant_unref (child); |
| 20360 | } |
| 20361 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 20362 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 20363 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 20364 | if (!g_value_get_boolean (&return_value)) |
| 20365 | 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); |
| 20366 | g_value_unset (&return_value); |
| 20367 | for (n = 0; n < num_params + num_extra; n++) |
| 20368 | g_value_unset (¶mv[n]); |
| 20369 | g_free (paramv); |
| 20370 | } |
| 20371 | |
| 20372 | static GVariant * |
| 20373 | _flash_skeleton_handle_get_property ( |
| 20374 | GDBusConnection *connection G_GNUC_UNUSED, |
| 20375 | const gchar *sender G_GNUC_UNUSED, |
| 20376 | const gchar *object_path G_GNUC_UNUSED, |
| 20377 | const gchar *interface_name G_GNUC_UNUSED, |
| 20378 | const gchar *property_name, |
| 20379 | GError **error, |
| 20380 | gpointer user_data) |
| 20381 | { |
| 20382 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 20383 | GValue value = G_VALUE_INIT; |
| 20384 | GParamSpec *pspec; |
| 20385 | _ExtendedGDBusPropertyInfo *info; |
| 20386 | GVariant *ret; |
| 20387 | ret = NULL; |
| 20388 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 20389 | g_assert (info != NULL); |
| 20390 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 20391 | if (pspec == NULL) |
| 20392 | { |
| 20393 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 20394 | } |
| 20395 | else |
| 20396 | { |
| 20397 | g_value_init (&value, pspec->value_type); |
| 20398 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 20399 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 20400 | g_value_unset (&value); |
| 20401 | } |
| 20402 | return ret; |
| 20403 | } |
| 20404 | |
| 20405 | static gboolean |
| 20406 | _flash_skeleton_handle_set_property ( |
| 20407 | GDBusConnection *connection G_GNUC_UNUSED, |
| 20408 | const gchar *sender G_GNUC_UNUSED, |
| 20409 | const gchar *object_path G_GNUC_UNUSED, |
| 20410 | const gchar *interface_name G_GNUC_UNUSED, |
| 20411 | const gchar *property_name, |
| 20412 | GVariant *variant, |
| 20413 | GError **error, |
| 20414 | gpointer user_data) |
| 20415 | { |
| 20416 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 20417 | GValue value = G_VALUE_INIT; |
| 20418 | GParamSpec *pspec; |
| 20419 | _ExtendedGDBusPropertyInfo *info; |
| 20420 | gboolean ret; |
| 20421 | ret = FALSE; |
| 20422 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 20423 | g_assert (info != NULL); |
| 20424 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 20425 | if (pspec == NULL) |
| 20426 | { |
| 20427 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 20428 | } |
| 20429 | else |
| 20430 | { |
| 20431 | if (info->use_gvariant) |
| 20432 | g_value_set_variant (&value, variant); |
| 20433 | else |
| 20434 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 20435 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 20436 | g_value_unset (&value); |
| 20437 | ret = TRUE; |
| 20438 | } |
| 20439 | return ret; |
| 20440 | } |
| 20441 | |
| 20442 | static const GDBusInterfaceVTable _flash_skeleton_vtable = |
| 20443 | { |
| 20444 | _flash_skeleton_handle_method_call, |
| 20445 | _flash_skeleton_handle_get_property, |
| 20446 | _flash_skeleton_handle_set_property, |
| 20447 | {NULL} |
| 20448 | }; |
| 20449 | |
| 20450 | static GDBusInterfaceInfo * |
| 20451 | flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20452 | { |
| 20453 | return flash_interface_info (); |
| 20454 | } |
| 20455 | |
| 20456 | static GDBusInterfaceVTable * |
| 20457 | flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20458 | { |
| 20459 | return (GDBusInterfaceVTable *) &_flash_skeleton_vtable; |
| 20460 | } |
| 20461 | |
| 20462 | static GVariant * |
| 20463 | flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 20464 | { |
| 20465 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 20466 | |
| 20467 | GVariantBuilder builder; |
| 20468 | guint n; |
| 20469 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 20470 | if (_flash_interface_info.parent_struct.properties == NULL) |
| 20471 | goto out; |
| 20472 | for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++) |
| 20473 | { |
| 20474 | GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n]; |
| 20475 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 20476 | { |
| 20477 | GVariant *value; |
| 20478 | 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); |
| 20479 | if (value != NULL) |
| 20480 | { |
| 20481 | g_variant_take_ref (value); |
| 20482 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 20483 | g_variant_unref (value); |
| 20484 | } |
| 20485 | } |
| 20486 | } |
| 20487 | out: |
| 20488 | return g_variant_builder_end (&builder); |
| 20489 | } |
| 20490 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20491 | static gboolean _flash_emit_changed (gpointer user_data); |
| 20492 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20493 | static void |
| 20494 | flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 20495 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20496 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 20497 | gboolean emit_changed = FALSE; |
| 20498 | |
| 20499 | g_mutex_lock (&skeleton->priv->lock); |
| 20500 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 20501 | { |
| 20502 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 20503 | skeleton->priv->changed_properties_idle_source = NULL; |
| 20504 | emit_changed = TRUE; |
| 20505 | } |
| 20506 | g_mutex_unlock (&skeleton->priv->lock); |
| 20507 | |
| 20508 | if (emit_changed) |
| 20509 | _flash_emit_changed (skeleton); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20510 | } |
| 20511 | |
| 20512 | static void |
| 20513 | _flash_on_signal_updated ( |
| 20514 | Flash *object) |
| 20515 | { |
| 20516 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20517 | |
| 20518 | GList *connections, *l; |
| 20519 | GVariant *signal_variant; |
| 20520 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20521 | |
| 20522 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 20523 | for (l = connections; l != NULL; l = l->next) |
| 20524 | { |
| 20525 | GDBusConnection *connection = l->data; |
| 20526 | g_dbus_connection_emit_signal (connection, |
| 20527 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated", |
| 20528 | signal_variant, NULL); |
| 20529 | } |
| 20530 | g_variant_unref (signal_variant); |
| 20531 | g_list_free_full (connections, g_object_unref); |
| 20532 | } |
| 20533 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20534 | static void |
| 20535 | _flash_on_signal_download ( |
| 20536 | Flash *object, |
| 20537 | const gchar *arg_url, |
| 20538 | const gchar *arg_filename) |
| 20539 | { |
| 20540 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20541 | |
| 20542 | GList *connections, *l; |
| 20543 | GVariant *signal_variant; |
| 20544 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20545 | |
| 20546 | signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", |
| 20547 | arg_url, |
| 20548 | arg_filename)); |
| 20549 | for (l = connections; l != NULL; l = l->next) |
| 20550 | { |
| 20551 | GDBusConnection *connection = l->data; |
| 20552 | g_dbus_connection_emit_signal (connection, |
| 20553 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download", |
| 20554 | signal_variant, NULL); |
| 20555 | } |
| 20556 | g_variant_unref (signal_variant); |
| 20557 | g_list_free_full (connections, g_object_unref); |
| 20558 | } |
| 20559 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20560 | static void flash_skeleton_iface_init (FlashIface *iface); |
| 20561 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20562 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20563 | G_ADD_PRIVATE (FlashSkeleton) |
| 20564 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 20565 | |
| 20566 | #else |
| 20567 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20568 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 20569 | |
| 20570 | #endif |
| 20571 | static void |
| 20572 | flash_skeleton_finalize (GObject *object) |
| 20573 | { |
| 20574 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20575 | guint n; |
| 20576 | for (n = 0; n < 4; n++) |
| 20577 | g_value_unset (&skeleton->priv->properties[n]); |
| 20578 | g_free (skeleton->priv->properties); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20579 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 20580 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 20581 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 20582 | g_main_context_unref (skeleton->priv->context); |
| 20583 | g_mutex_clear (&skeleton->priv->lock); |
| 20584 | G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object); |
| 20585 | } |
| 20586 | |
| 20587 | static void |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20588 | flash_skeleton_get_property (GObject *object, |
| 20589 | guint prop_id, |
| 20590 | GValue *value, |
| 20591 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20592 | { |
| 20593 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20594 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 20595 | g_mutex_lock (&skeleton->priv->lock); |
| 20596 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 20597 | g_mutex_unlock (&skeleton->priv->lock); |
| 20598 | } |
| 20599 | |
| 20600 | static gboolean |
| 20601 | _flash_emit_changed (gpointer user_data) |
| 20602 | { |
| 20603 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 20604 | GList *l; |
| 20605 | GVariantBuilder builder; |
| 20606 | GVariantBuilder invalidated_builder; |
| 20607 | guint num_changes; |
| 20608 | |
| 20609 | g_mutex_lock (&skeleton->priv->lock); |
| 20610 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 20611 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 20612 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 20613 | { |
| 20614 | ChangedProperty *cp = l->data; |
| 20615 | GVariant *variant; |
| 20616 | const GValue *cur_value; |
| 20617 | |
| 20618 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 20619 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 20620 | { |
| 20621 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 20622 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 20623 | g_variant_unref (variant); |
| 20624 | num_changes++; |
| 20625 | } |
| 20626 | } |
| 20627 | if (num_changes > 0) |
| 20628 | { |
| 20629 | GList *connections, *ll; |
| 20630 | GVariant *signal_variant; |
| 20631 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash", |
| 20632 | &builder, &invalidated_builder)); |
| 20633 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20634 | for (ll = connections; ll != NULL; ll = ll->next) |
| 20635 | { |
| 20636 | GDBusConnection *connection = ll->data; |
| 20637 | |
| 20638 | g_dbus_connection_emit_signal (connection, |
| 20639 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 20640 | "org.freedesktop.DBus.Properties", |
| 20641 | "PropertiesChanged", |
| 20642 | signal_variant, |
| 20643 | NULL); |
| 20644 | } |
| 20645 | g_variant_unref (signal_variant); |
| 20646 | g_list_free_full (connections, g_object_unref); |
| 20647 | } |
| 20648 | else |
| 20649 | { |
| 20650 | g_variant_builder_clear (&builder); |
| 20651 | g_variant_builder_clear (&invalidated_builder); |
| 20652 | } |
| 20653 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 20654 | skeleton->priv->changed_properties = NULL; |
| 20655 | skeleton->priv->changed_properties_idle_source = NULL; |
| 20656 | g_mutex_unlock (&skeleton->priv->lock); |
| 20657 | return FALSE; |
| 20658 | } |
| 20659 | |
| 20660 | static void |
| 20661 | _flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 20662 | { |
| 20663 | ChangedProperty *cp; |
| 20664 | GList *l; |
| 20665 | cp = NULL; |
| 20666 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 20667 | { |
| 20668 | ChangedProperty *i_cp = l->data; |
| 20669 | if (i_cp->info == info) |
| 20670 | { |
| 20671 | cp = i_cp; |
| 20672 | break; |
| 20673 | } |
| 20674 | } |
| 20675 | if (cp == NULL) |
| 20676 | { |
| 20677 | cp = g_new0 (ChangedProperty, 1); |
| 20678 | cp->prop_id = prop_id; |
| 20679 | cp->info = info; |
| 20680 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 20681 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 20682 | g_value_copy (orig_value, &cp->orig_value); |
| 20683 | } |
| 20684 | } |
| 20685 | |
| 20686 | static void |
| 20687 | flash_skeleton_notify (GObject *object, |
| 20688 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20689 | { |
| 20690 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20691 | g_mutex_lock (&skeleton->priv->lock); |
| 20692 | if (skeleton->priv->changed_properties != NULL && |
| 20693 | skeleton->priv->changed_properties_idle_source == NULL) |
| 20694 | { |
| 20695 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 20696 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 20697 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 20698 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 20699 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 20700 | } |
| 20701 | g_mutex_unlock (&skeleton->priv->lock); |
| 20702 | } |
| 20703 | |
| 20704 | static void |
| 20705 | flash_skeleton_set_property (GObject *object, |
| 20706 | guint prop_id, |
| 20707 | const GValue *value, |
| 20708 | GParamSpec *pspec) |
| 20709 | { |
| 20710 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20711 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 20712 | g_mutex_lock (&skeleton->priv->lock); |
| 20713 | g_object_freeze_notify (object); |
| 20714 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 20715 | { |
| 20716 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 20717 | _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 20718 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 20719 | g_object_notify_by_pspec (object, pspec); |
| 20720 | } |
| 20721 | g_mutex_unlock (&skeleton->priv->lock); |
| 20722 | g_object_thaw_notify (object); |
| 20723 | } |
| 20724 | |
| 20725 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20726 | flash_skeleton_init (FlashSkeleton *skeleton) |
| 20727 | { |
| 20728 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20729 | skeleton->priv = flash_skeleton_get_instance_private (skeleton); |
| 20730 | #else |
| 20731 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate); |
| 20732 | #endif |
| 20733 | |
| 20734 | g_mutex_init (&skeleton->priv->lock); |
| 20735 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20736 | skeleton->priv->properties = g_new0 (GValue, 4); |
| 20737 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 20738 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 20739 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
| 20740 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
| 20741 | } |
| 20742 | |
| 20743 | static const gchar * |
| 20744 | flash_skeleton_get_filename (Flash *object) |
| 20745 | { |
| 20746 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20747 | const gchar *value; |
| 20748 | g_mutex_lock (&skeleton->priv->lock); |
| 20749 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 20750 | g_mutex_unlock (&skeleton->priv->lock); |
| 20751 | return value; |
| 20752 | } |
| 20753 | |
| 20754 | static const gchar * |
| 20755 | flash_skeleton_get_flasher_path (Flash *object) |
| 20756 | { |
| 20757 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20758 | const gchar *value; |
| 20759 | g_mutex_lock (&skeleton->priv->lock); |
| 20760 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 20761 | g_mutex_unlock (&skeleton->priv->lock); |
| 20762 | return value; |
| 20763 | } |
| 20764 | |
| 20765 | static const gchar * |
| 20766 | flash_skeleton_get_flasher_name (Flash *object) |
| 20767 | { |
| 20768 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20769 | const gchar *value; |
| 20770 | g_mutex_lock (&skeleton->priv->lock); |
| 20771 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
| 20772 | g_mutex_unlock (&skeleton->priv->lock); |
| 20773 | return value; |
| 20774 | } |
| 20775 | |
| 20776 | static const gchar * |
| 20777 | flash_skeleton_get_flasher_instance (Flash *object) |
| 20778 | { |
| 20779 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 20780 | const gchar *value; |
| 20781 | g_mutex_lock (&skeleton->priv->lock); |
| 20782 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
| 20783 | g_mutex_unlock (&skeleton->priv->lock); |
| 20784 | return value; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20785 | } |
| 20786 | |
| 20787 | static void |
| 20788 | flash_skeleton_class_init (FlashSkeletonClass *klass) |
| 20789 | { |
| 20790 | GObjectClass *gobject_class; |
| 20791 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 20792 | |
| 20793 | gobject_class = G_OBJECT_CLASS (klass); |
| 20794 | gobject_class->finalize = flash_skeleton_finalize; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20795 | gobject_class->get_property = flash_skeleton_get_property; |
| 20796 | gobject_class->set_property = flash_skeleton_set_property; |
| 20797 | gobject_class->notify = flash_skeleton_notify; |
| 20798 | |
| 20799 | |
| 20800 | flash_override_properties (gobject_class, 1); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20801 | |
| 20802 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 20803 | skeleton_class->get_info = flash_skeleton_dbus_interface_get_info; |
| 20804 | skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties; |
| 20805 | skeleton_class->flush = flash_skeleton_dbus_interface_flush; |
| 20806 | skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable; |
| 20807 | |
| 20808 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20809 | g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate)); |
| 20810 | #endif |
| 20811 | } |
| 20812 | |
| 20813 | static void |
| 20814 | flash_skeleton_iface_init (FlashIface *iface) |
| 20815 | { |
| 20816 | iface->updated = _flash_on_signal_updated; |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20817 | iface->download = _flash_on_signal_download; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20818 | iface->get_filename = flash_skeleton_get_filename; |
| 20819 | iface->get_flasher_path = flash_skeleton_get_flasher_path; |
| 20820 | iface->get_flasher_name = flash_skeleton_get_flasher_name; |
| 20821 | iface->get_flasher_instance = flash_skeleton_get_flasher_instance; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20822 | } |
| 20823 | |
| 20824 | /** |
| 20825 | * flash_skeleton_new: |
| 20826 | * |
| 20827 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 20828 | * |
| 20829 | * Returns: (transfer full) (type FlashSkeleton): The skeleton object. |
| 20830 | */ |
| 20831 | Flash * |
| 20832 | flash_skeleton_new (void) |
| 20833 | { |
| 20834 | return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL)); |
| 20835 | } |
| 20836 | |
| 20837 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20838 | * Code for interface org.openbmc.FlashControl |
| 20839 | * ------------------------------------------------------------------------ |
| 20840 | */ |
| 20841 | |
| 20842 | /** |
| 20843 | * SECTION:FlashControl |
| 20844 | * @title: FlashControl |
| 20845 | * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface |
| 20846 | * |
| 20847 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C. |
| 20848 | */ |
| 20849 | |
| 20850 | /* ---- Introspection data for org.openbmc.FlashControl ---- */ |
| 20851 | |
| 20852 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type = |
| 20853 | { |
| 20854 | { |
| 20855 | -1, |
| 20856 | (gchar *) "type", |
| 20857 | (gchar *) "s", |
| 20858 | NULL |
| 20859 | }, |
| 20860 | FALSE |
| 20861 | }; |
| 20862 | |
| 20863 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename = |
| 20864 | { |
| 20865 | { |
| 20866 | -1, |
| 20867 | (gchar *) "filename", |
| 20868 | (gchar *) "s", |
| 20869 | NULL |
| 20870 | }, |
| 20871 | FALSE |
| 20872 | }; |
| 20873 | |
| 20874 | static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] = |
| 20875 | { |
| 20876 | &_flash_control_method_info_flash_IN_ARG_type, |
| 20877 | &_flash_control_method_info_flash_IN_ARG_filename, |
| 20878 | NULL |
| 20879 | }; |
| 20880 | |
| 20881 | static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash = |
| 20882 | { |
| 20883 | { |
| 20884 | -1, |
| 20885 | (gchar *) "flash", |
| 20886 | (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers, |
| 20887 | NULL, |
| 20888 | NULL |
| 20889 | }, |
| 20890 | "handle-flash", |
| 20891 | FALSE |
| 20892 | }; |
| 20893 | |
| 20894 | static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] = |
| 20895 | { |
| 20896 | &_flash_control_method_info_flash, |
| 20897 | NULL |
| 20898 | }; |
| 20899 | |
| 20900 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename = |
| 20901 | { |
| 20902 | { |
| 20903 | -1, |
| 20904 | (gchar *) "filename", |
| 20905 | (gchar *) "s", |
| 20906 | NULL |
| 20907 | }, |
| 20908 | FALSE |
| 20909 | }; |
| 20910 | |
| 20911 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] = |
| 20912 | { |
| 20913 | &_flash_control_signal_info_done_ARG_filename, |
| 20914 | NULL |
| 20915 | }; |
| 20916 | |
| 20917 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done = |
| 20918 | { |
| 20919 | { |
| 20920 | -1, |
| 20921 | (gchar *) "Done", |
| 20922 | (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers, |
| 20923 | NULL |
| 20924 | }, |
| 20925 | "done" |
| 20926 | }; |
| 20927 | |
| 20928 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename = |
| 20929 | { |
| 20930 | { |
| 20931 | -1, |
| 20932 | (gchar *) "filename", |
| 20933 | (gchar *) "s", |
| 20934 | NULL |
| 20935 | }, |
| 20936 | FALSE |
| 20937 | }; |
| 20938 | |
| 20939 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] = |
| 20940 | { |
| 20941 | &_flash_control_signal_info_error_ARG_filename, |
| 20942 | NULL |
| 20943 | }; |
| 20944 | |
| 20945 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error = |
| 20946 | { |
| 20947 | { |
| 20948 | -1, |
| 20949 | (gchar *) "Error", |
| 20950 | (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers, |
| 20951 | NULL |
| 20952 | }, |
| 20953 | "error" |
| 20954 | }; |
| 20955 | |
| 20956 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename = |
| 20957 | { |
| 20958 | { |
| 20959 | -1, |
| 20960 | (gchar *) "filename", |
| 20961 | (gchar *) "s", |
| 20962 | NULL |
| 20963 | }, |
| 20964 | FALSE |
| 20965 | }; |
| 20966 | |
| 20967 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress = |
| 20968 | { |
| 20969 | { |
| 20970 | -1, |
| 20971 | (gchar *) "progress", |
| 20972 | (gchar *) "y", |
| 20973 | NULL |
| 20974 | }, |
| 20975 | FALSE |
| 20976 | }; |
| 20977 | |
| 20978 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] = |
| 20979 | { |
| 20980 | &_flash_control_signal_info_progress_ARG_filename, |
| 20981 | &_flash_control_signal_info_progress_ARG_progress, |
| 20982 | NULL |
| 20983 | }; |
| 20984 | |
| 20985 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress = |
| 20986 | { |
| 20987 | { |
| 20988 | -1, |
| 20989 | (gchar *) "Progress", |
| 20990 | (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers, |
| 20991 | NULL |
| 20992 | }, |
| 20993 | "progress" |
| 20994 | }; |
| 20995 | |
| 20996 | static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] = |
| 20997 | { |
| 20998 | &_flash_control_signal_info_done, |
| 20999 | &_flash_control_signal_info_error, |
| 21000 | &_flash_control_signal_info_progress, |
| 21001 | NULL |
| 21002 | }; |
| 21003 | |
| 21004 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename = |
| 21005 | { |
| 21006 | { |
| 21007 | -1, |
| 21008 | (gchar *) "filename", |
| 21009 | (gchar *) "s", |
| 21010 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21011 | NULL |
| 21012 | }, |
| 21013 | "filename", |
| 21014 | FALSE |
| 21015 | }; |
| 21016 | |
| 21017 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ = |
| 21018 | { |
| 21019 | { |
| 21020 | -1, |
| 21021 | (gchar *) "type", |
| 21022 | (gchar *) "s", |
| 21023 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21024 | NULL |
| 21025 | }, |
| 21026 | "type", |
| 21027 | FALSE |
| 21028 | }; |
| 21029 | |
| 21030 | static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] = |
| 21031 | { |
| 21032 | &_flash_control_property_info_filename, |
| 21033 | &_flash_control_property_info_type_, |
| 21034 | NULL |
| 21035 | }; |
| 21036 | |
| 21037 | static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info = |
| 21038 | { |
| 21039 | { |
| 21040 | -1, |
| 21041 | (gchar *) "org.openbmc.FlashControl", |
| 21042 | (GDBusMethodInfo **) &_flash_control_method_info_pointers, |
| 21043 | (GDBusSignalInfo **) &_flash_control_signal_info_pointers, |
| 21044 | (GDBusPropertyInfo **) &_flash_control_property_info_pointers, |
| 21045 | NULL |
| 21046 | }, |
| 21047 | "flash-control", |
| 21048 | }; |
| 21049 | |
| 21050 | |
| 21051 | /** |
| 21052 | * flash_control_interface_info: |
| 21053 | * |
| 21054 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface. |
| 21055 | * |
| 21056 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 21057 | */ |
| 21058 | GDBusInterfaceInfo * |
| 21059 | flash_control_interface_info (void) |
| 21060 | { |
| 21061 | return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct; |
| 21062 | } |
| 21063 | |
| 21064 | /** |
| 21065 | * flash_control_override_properties: |
| 21066 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 21067 | * @property_id_begin: The property id to assign to the first overridden property. |
| 21068 | * |
| 21069 | * Overrides all #GObject properties in the #FlashControl interface for a concrete class. |
| 21070 | * The properties are overridden in the order they are defined. |
| 21071 | * |
| 21072 | * Returns: The last property id. |
| 21073 | */ |
| 21074 | guint |
| 21075 | flash_control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 21076 | { |
| 21077 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 21078 | g_object_class_override_property (klass, property_id_begin++, "type"); |
| 21079 | return property_id_begin - 1; |
| 21080 | } |
| 21081 | |
| 21082 | |
| 21083 | |
| 21084 | /** |
| 21085 | * FlashControl: |
| 21086 | * |
| 21087 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 21088 | */ |
| 21089 | |
| 21090 | /** |
| 21091 | * FlashControlIface: |
| 21092 | * @parent_iface: The parent interface. |
| 21093 | * @handle_flash: Handler for the #FlashControl::handle-flash signal. |
| 21094 | * @get_filename: Getter for the #FlashControl:filename property. |
| 21095 | * @get_type_: Getter for the #FlashControl:type property. |
| 21096 | * @done: Handler for the #FlashControl::done signal. |
| 21097 | * @error: Handler for the #FlashControl::error signal. |
| 21098 | * @progress: Handler for the #FlashControl::progress signal. |
| 21099 | * |
| 21100 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 21101 | */ |
| 21102 | |
| 21103 | typedef FlashControlIface FlashControlInterface; |
| 21104 | G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT); |
| 21105 | |
| 21106 | static void |
| 21107 | flash_control_default_init (FlashControlIface *iface) |
| 21108 | { |
| 21109 | /* GObject signals for incoming D-Bus method calls: */ |
| 21110 | /** |
| 21111 | * FlashControl::handle-flash: |
| 21112 | * @object: A #FlashControl. |
| 21113 | * @invocation: A #GDBusMethodInvocation. |
| 21114 | * @arg_type: Argument passed by remote caller. |
| 21115 | * @arg_filename: Argument passed by remote caller. |
| 21116 | * |
| 21117 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. |
| 21118 | * |
| 21119 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_control_complete_flash() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 21120 | * |
| 21121 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21122 | */ |
| 21123 | g_signal_new ("handle-flash", |
| 21124 | G_TYPE_FROM_INTERFACE (iface), |
| 21125 | G_SIGNAL_RUN_LAST, |
| 21126 | G_STRUCT_OFFSET (FlashControlIface, handle_flash), |
| 21127 | g_signal_accumulator_true_handled, |
| 21128 | NULL, |
| 21129 | g_cclosure_marshal_generic, |
| 21130 | G_TYPE_BOOLEAN, |
| 21131 | 3, |
| 21132 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 21133 | |
| 21134 | /* GObject signals for received D-Bus signals: */ |
| 21135 | /** |
| 21136 | * FlashControl::done: |
| 21137 | * @object: A #FlashControl. |
| 21138 | * @arg_filename: Argument. |
| 21139 | * |
| 21140 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received. |
| 21141 | * |
| 21142 | * 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. |
| 21143 | */ |
| 21144 | g_signal_new ("done", |
| 21145 | G_TYPE_FROM_INTERFACE (iface), |
| 21146 | G_SIGNAL_RUN_LAST, |
| 21147 | G_STRUCT_OFFSET (FlashControlIface, done), |
| 21148 | NULL, |
| 21149 | NULL, |
| 21150 | g_cclosure_marshal_generic, |
| 21151 | G_TYPE_NONE, |
| 21152 | 1, G_TYPE_STRING); |
| 21153 | |
| 21154 | /** |
| 21155 | * FlashControl::error: |
| 21156 | * @object: A #FlashControl. |
| 21157 | * @arg_filename: Argument. |
| 21158 | * |
| 21159 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received. |
| 21160 | * |
| 21161 | * 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. |
| 21162 | */ |
| 21163 | g_signal_new ("error", |
| 21164 | G_TYPE_FROM_INTERFACE (iface), |
| 21165 | G_SIGNAL_RUN_LAST, |
| 21166 | G_STRUCT_OFFSET (FlashControlIface, error), |
| 21167 | NULL, |
| 21168 | NULL, |
| 21169 | g_cclosure_marshal_generic, |
| 21170 | G_TYPE_NONE, |
| 21171 | 1, G_TYPE_STRING); |
| 21172 | |
| 21173 | /** |
| 21174 | * FlashControl::progress: |
| 21175 | * @object: A #FlashControl. |
| 21176 | * @arg_filename: Argument. |
| 21177 | * @arg_progress: Argument. |
| 21178 | * |
| 21179 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received. |
| 21180 | * |
| 21181 | * 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. |
| 21182 | */ |
| 21183 | g_signal_new ("progress", |
| 21184 | G_TYPE_FROM_INTERFACE (iface), |
| 21185 | G_SIGNAL_RUN_LAST, |
| 21186 | G_STRUCT_OFFSET (FlashControlIface, progress), |
| 21187 | NULL, |
| 21188 | NULL, |
| 21189 | g_cclosure_marshal_generic, |
| 21190 | G_TYPE_NONE, |
| 21191 | 2, G_TYPE_STRING, G_TYPE_UCHAR); |
| 21192 | |
| 21193 | /* GObject properties for D-Bus properties: */ |
| 21194 | /** |
| 21195 | * FlashControl:filename: |
| 21196 | * |
| 21197 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>. |
| 21198 | * |
| 21199 | * 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. |
| 21200 | */ |
| 21201 | g_object_interface_install_property (iface, |
| 21202 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21203 | /** |
| 21204 | * FlashControl:type: |
| 21205 | * |
| 21206 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>. |
| 21207 | * |
| 21208 | * 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. |
| 21209 | */ |
| 21210 | g_object_interface_install_property (iface, |
| 21211 | g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21212 | } |
| 21213 | |
| 21214 | /** |
| 21215 | * flash_control_get_filename: (skip) |
| 21216 | * @object: A #FlashControl. |
| 21217 | * |
| 21218 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 21219 | * |
| 21220 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21221 | * |
| 21222 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_filename() if on another thread.</warning> |
| 21223 | * |
| 21224 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 21225 | */ |
| 21226 | const gchar * |
| 21227 | flash_control_get_filename (FlashControl *object) |
| 21228 | { |
| 21229 | return FLASH_CONTROL_GET_IFACE (object)->get_filename (object); |
| 21230 | } |
| 21231 | |
| 21232 | /** |
| 21233 | * flash_control_dup_filename: (skip) |
| 21234 | * @object: A #FlashControl. |
| 21235 | * |
| 21236 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 21237 | * |
| 21238 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21239 | * |
| 21240 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 21241 | */ |
| 21242 | gchar * |
| 21243 | flash_control_dup_filename (FlashControl *object) |
| 21244 | { |
| 21245 | gchar *value; |
| 21246 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 21247 | return value; |
| 21248 | } |
| 21249 | |
| 21250 | /** |
| 21251 | * flash_control_set_filename: (skip) |
| 21252 | * @object: A #FlashControl. |
| 21253 | * @value: The value to set. |
| 21254 | * |
| 21255 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value. |
| 21256 | * |
| 21257 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 21258 | */ |
| 21259 | void |
| 21260 | flash_control_set_filename (FlashControl *object, const gchar *value) |
| 21261 | { |
| 21262 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 21263 | } |
| 21264 | |
| 21265 | /** |
| 21266 | * flash_control_get_type_: (skip) |
| 21267 | * @object: A #FlashControl. |
| 21268 | * |
| 21269 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 21270 | * |
| 21271 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21272 | * |
| 21273 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_type_() if on another thread.</warning> |
| 21274 | * |
| 21275 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 21276 | */ |
| 21277 | const gchar * |
| 21278 | flash_control_get_type_ (FlashControl *object) |
| 21279 | { |
| 21280 | return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object); |
| 21281 | } |
| 21282 | |
| 21283 | /** |
| 21284 | * flash_control_dup_type_: (skip) |
| 21285 | * @object: A #FlashControl. |
| 21286 | * |
| 21287 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 21288 | * |
| 21289 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21290 | * |
| 21291 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 21292 | */ |
| 21293 | gchar * |
| 21294 | flash_control_dup_type_ (FlashControl *object) |
| 21295 | { |
| 21296 | gchar *value; |
| 21297 | g_object_get (G_OBJECT (object), "type", &value, NULL); |
| 21298 | return value; |
| 21299 | } |
| 21300 | |
| 21301 | /** |
| 21302 | * flash_control_set_type_: (skip) |
| 21303 | * @object: A #FlashControl. |
| 21304 | * @value: The value to set. |
| 21305 | * |
| 21306 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value. |
| 21307 | * |
| 21308 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 21309 | */ |
| 21310 | void |
| 21311 | flash_control_set_type_ (FlashControl *object, const gchar *value) |
| 21312 | { |
| 21313 | g_object_set (G_OBJECT (object), "type", value, NULL); |
| 21314 | } |
| 21315 | |
| 21316 | /** |
| 21317 | * flash_control_emit_done: |
| 21318 | * @object: A #FlashControl. |
| 21319 | * @arg_filename: Argument to pass with the signal. |
| 21320 | * |
| 21321 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal. |
| 21322 | */ |
| 21323 | void |
| 21324 | flash_control_emit_done ( |
| 21325 | FlashControl *object, |
| 21326 | const gchar *arg_filename) |
| 21327 | { |
| 21328 | g_signal_emit_by_name (object, "done", arg_filename); |
| 21329 | } |
| 21330 | |
| 21331 | /** |
| 21332 | * flash_control_emit_error: |
| 21333 | * @object: A #FlashControl. |
| 21334 | * @arg_filename: Argument to pass with the signal. |
| 21335 | * |
| 21336 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal. |
| 21337 | */ |
| 21338 | void |
| 21339 | flash_control_emit_error ( |
| 21340 | FlashControl *object, |
| 21341 | const gchar *arg_filename) |
| 21342 | { |
| 21343 | g_signal_emit_by_name (object, "error", arg_filename); |
| 21344 | } |
| 21345 | |
| 21346 | /** |
| 21347 | * flash_control_emit_progress: |
| 21348 | * @object: A #FlashControl. |
| 21349 | * @arg_filename: Argument to pass with the signal. |
| 21350 | * @arg_progress: Argument to pass with the signal. |
| 21351 | * |
| 21352 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal. |
| 21353 | */ |
| 21354 | void |
| 21355 | flash_control_emit_progress ( |
| 21356 | FlashControl *object, |
| 21357 | const gchar *arg_filename, |
| 21358 | guchar arg_progress) |
| 21359 | { |
| 21360 | g_signal_emit_by_name (object, "progress", arg_filename, arg_progress); |
| 21361 | } |
| 21362 | |
| 21363 | /** |
| 21364 | * flash_control_call_flash: |
| 21365 | * @proxy: A #FlashControlProxy. |
| 21366 | * @arg_type: Argument to pass with the method invocation. |
| 21367 | * @arg_filename: Argument to pass with the method invocation. |
| 21368 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21369 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21370 | * @user_data: User data to pass to @callback. |
| 21371 | * |
| 21372 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. |
| 21373 | * 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. |
| 21374 | * You can then call flash_control_call_flash_finish() to get the result of the operation. |
| 21375 | * |
| 21376 | * See flash_control_call_flash_sync() for the synchronous, blocking version of this method. |
| 21377 | */ |
| 21378 | void |
| 21379 | flash_control_call_flash ( |
| 21380 | FlashControl *proxy, |
| 21381 | const gchar *arg_type, |
| 21382 | const gchar *arg_filename, |
| 21383 | GCancellable *cancellable, |
| 21384 | GAsyncReadyCallback callback, |
| 21385 | gpointer user_data) |
| 21386 | { |
| 21387 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21388 | "flash", |
| 21389 | g_variant_new ("(ss)", |
| 21390 | arg_type, |
| 21391 | arg_filename), |
| 21392 | G_DBUS_CALL_FLAGS_NONE, |
| 21393 | -1, |
| 21394 | cancellable, |
| 21395 | callback, |
| 21396 | user_data); |
| 21397 | } |
| 21398 | |
| 21399 | /** |
| 21400 | * flash_control_call_flash_finish: |
| 21401 | * @proxy: A #FlashControlProxy. |
| 21402 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash(). |
| 21403 | * @error: Return location for error or %NULL. |
| 21404 | * |
| 21405 | * Finishes an operation started with flash_control_call_flash(). |
| 21406 | * |
| 21407 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21408 | */ |
| 21409 | gboolean |
| 21410 | flash_control_call_flash_finish ( |
| 21411 | FlashControl *proxy, |
| 21412 | GAsyncResult *res, |
| 21413 | GError **error) |
| 21414 | { |
| 21415 | GVariant *_ret; |
| 21416 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21417 | if (_ret == NULL) |
| 21418 | goto _out; |
| 21419 | g_variant_get (_ret, |
| 21420 | "()"); |
| 21421 | g_variant_unref (_ret); |
| 21422 | _out: |
| 21423 | return _ret != NULL; |
| 21424 | } |
| 21425 | |
| 21426 | /** |
| 21427 | * flash_control_call_flash_sync: |
| 21428 | * @proxy: A #FlashControlProxy. |
| 21429 | * @arg_type: Argument to pass with the method invocation. |
| 21430 | * @arg_filename: Argument to pass with the method invocation. |
| 21431 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21432 | * @error: Return location for error or %NULL. |
| 21433 | * |
| 21434 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 21435 | * |
| 21436 | * See flash_control_call_flash() for the asynchronous version of this method. |
| 21437 | * |
| 21438 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21439 | */ |
| 21440 | gboolean |
| 21441 | flash_control_call_flash_sync ( |
| 21442 | FlashControl *proxy, |
| 21443 | const gchar *arg_type, |
| 21444 | const gchar *arg_filename, |
| 21445 | GCancellable *cancellable, |
| 21446 | GError **error) |
| 21447 | { |
| 21448 | GVariant *_ret; |
| 21449 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 21450 | "flash", |
| 21451 | g_variant_new ("(ss)", |
| 21452 | arg_type, |
| 21453 | arg_filename), |
| 21454 | G_DBUS_CALL_FLAGS_NONE, |
| 21455 | -1, |
| 21456 | cancellable, |
| 21457 | error); |
| 21458 | if (_ret == NULL) |
| 21459 | goto _out; |
| 21460 | g_variant_get (_ret, |
| 21461 | "()"); |
| 21462 | g_variant_unref (_ret); |
| 21463 | _out: |
| 21464 | return _ret != NULL; |
| 21465 | } |
| 21466 | |
| 21467 | /** |
| 21468 | * flash_control_complete_flash: |
| 21469 | * @object: A #FlashControl. |
| 21470 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21471 | * |
| 21472 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 21473 | * |
| 21474 | * This method will free @invocation, you cannot use it afterwards. |
| 21475 | */ |
| 21476 | void |
| 21477 | flash_control_complete_flash ( |
| 21478 | FlashControl *object, |
| 21479 | GDBusMethodInvocation *invocation) |
| 21480 | { |
| 21481 | g_dbus_method_invocation_return_value (invocation, |
| 21482 | g_variant_new ("()")); |
| 21483 | } |
| 21484 | |
| 21485 | /* ------------------------------------------------------------------------ */ |
| 21486 | |
| 21487 | /** |
| 21488 | * FlashControlProxy: |
| 21489 | * |
| 21490 | * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API. |
| 21491 | */ |
| 21492 | |
| 21493 | /** |
| 21494 | * FlashControlProxyClass: |
| 21495 | * @parent_class: The parent class. |
| 21496 | * |
| 21497 | * Class structure for #FlashControlProxy. |
| 21498 | */ |
| 21499 | |
| 21500 | struct _FlashControlProxyPrivate |
| 21501 | { |
| 21502 | GData *qdata; |
| 21503 | }; |
| 21504 | |
| 21505 | static void flash_control_proxy_iface_init (FlashControlIface *iface); |
| 21506 | |
| 21507 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21508 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 21509 | G_ADD_PRIVATE (FlashControlProxy) |
| 21510 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 21511 | |
| 21512 | #else |
| 21513 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 21514 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 21515 | |
| 21516 | #endif |
| 21517 | static void |
| 21518 | flash_control_proxy_finalize (GObject *object) |
| 21519 | { |
| 21520 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 21521 | g_datalist_clear (&proxy->priv->qdata); |
| 21522 | G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object); |
| 21523 | } |
| 21524 | |
| 21525 | static void |
| 21526 | flash_control_proxy_get_property (GObject *object, |
| 21527 | guint prop_id, |
| 21528 | GValue *value, |
| 21529 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21530 | { |
| 21531 | const _ExtendedGDBusPropertyInfo *info; |
| 21532 | GVariant *variant; |
| 21533 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 21534 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 21535 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 21536 | if (info->use_gvariant) |
| 21537 | { |
| 21538 | g_value_set_variant (value, variant); |
| 21539 | } |
| 21540 | else |
| 21541 | { |
| 21542 | if (variant != NULL) |
| 21543 | g_dbus_gvariant_to_gvalue (variant, value); |
| 21544 | } |
| 21545 | if (variant != NULL) |
| 21546 | g_variant_unref (variant); |
| 21547 | } |
| 21548 | |
| 21549 | static void |
| 21550 | flash_control_proxy_set_property_cb (GDBusProxy *proxy, |
| 21551 | GAsyncResult *res, |
| 21552 | gpointer user_data) |
| 21553 | { |
| 21554 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 21555 | GError *error; |
| 21556 | GVariant *_ret; |
| 21557 | error = NULL; |
| 21558 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 21559 | if (!_ret) |
| 21560 | { |
| 21561 | g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)", |
| 21562 | info->parent_struct.name, |
| 21563 | error->message, g_quark_to_string (error->domain), error->code); |
| 21564 | g_error_free (error); |
| 21565 | } |
| 21566 | else |
| 21567 | { |
| 21568 | g_variant_unref (_ret); |
| 21569 | } |
| 21570 | } |
| 21571 | |
| 21572 | static void |
| 21573 | flash_control_proxy_set_property (GObject *object, |
| 21574 | guint prop_id, |
| 21575 | const GValue *value, |
| 21576 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21577 | { |
| 21578 | const _ExtendedGDBusPropertyInfo *info; |
| 21579 | GVariant *variant; |
| 21580 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 21581 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 21582 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 21583 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 21584 | "org.freedesktop.DBus.Properties.Set", |
| 21585 | g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant), |
| 21586 | G_DBUS_CALL_FLAGS_NONE, |
| 21587 | -1, |
| 21588 | NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 21589 | g_variant_unref (variant); |
| 21590 | } |
| 21591 | |
| 21592 | static void |
| 21593 | flash_control_proxy_g_signal (GDBusProxy *proxy, |
| 21594 | const gchar *sender_name G_GNUC_UNUSED, |
| 21595 | const gchar *signal_name, |
| 21596 | GVariant *parameters) |
| 21597 | { |
| 21598 | _ExtendedGDBusSignalInfo *info; |
| 21599 | GVariantIter iter; |
| 21600 | GVariant *child; |
| 21601 | GValue *paramv; |
| 21602 | guint num_params; |
| 21603 | guint n; |
| 21604 | guint signal_id; |
| 21605 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name); |
| 21606 | if (info == NULL) |
| 21607 | return; |
| 21608 | num_params = g_variant_n_children (parameters); |
| 21609 | paramv = g_new0 (GValue, num_params + 1); |
| 21610 | g_value_init (¶mv[0], TYPE_FLASH_CONTROL); |
| 21611 | g_value_set_object (¶mv[0], proxy); |
| 21612 | g_variant_iter_init (&iter, parameters); |
| 21613 | n = 1; |
| 21614 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 21615 | { |
| 21616 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 21617 | if (arg_info->use_gvariant) |
| 21618 | { |
| 21619 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 21620 | g_value_set_variant (¶mv[n], child); |
| 21621 | n++; |
| 21622 | } |
| 21623 | else |
| 21624 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 21625 | g_variant_unref (child); |
| 21626 | } |
| 21627 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 21628 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 21629 | for (n = 0; n < num_params + 1; n++) |
| 21630 | g_value_unset (¶mv[n]); |
| 21631 | g_free (paramv); |
| 21632 | } |
| 21633 | |
| 21634 | static void |
| 21635 | flash_control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 21636 | GVariant *changed_properties, |
| 21637 | const gchar *const *invalidated_properties) |
| 21638 | { |
| 21639 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy); |
| 21640 | guint n; |
| 21641 | const gchar *key; |
| 21642 | GVariantIter *iter; |
| 21643 | _ExtendedGDBusPropertyInfo *info; |
| 21644 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 21645 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 21646 | { |
| 21647 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key); |
| 21648 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 21649 | if (info != NULL) |
| 21650 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 21651 | } |
| 21652 | g_variant_iter_free (iter); |
| 21653 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 21654 | { |
| 21655 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]); |
| 21656 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 21657 | if (info != NULL) |
| 21658 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 21659 | } |
| 21660 | } |
| 21661 | |
| 21662 | static const gchar * |
| 21663 | flash_control_proxy_get_filename (FlashControl *object) |
| 21664 | { |
| 21665 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 21666 | GVariant *variant; |
| 21667 | const gchar *value = NULL; |
| 21668 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 21669 | if (variant != NULL) |
| 21670 | { |
| 21671 | value = g_variant_get_string (variant, NULL); |
| 21672 | g_variant_unref (variant); |
| 21673 | } |
| 21674 | return value; |
| 21675 | } |
| 21676 | |
| 21677 | static const gchar * |
| 21678 | flash_control_proxy_get_type_ (FlashControl *object) |
| 21679 | { |
| 21680 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 21681 | GVariant *variant; |
| 21682 | const gchar *value = NULL; |
| 21683 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type"); |
| 21684 | if (variant != NULL) |
| 21685 | { |
| 21686 | value = g_variant_get_string (variant, NULL); |
| 21687 | g_variant_unref (variant); |
| 21688 | } |
| 21689 | return value; |
| 21690 | } |
| 21691 | |
| 21692 | static void |
| 21693 | flash_control_proxy_init (FlashControlProxy *proxy) |
| 21694 | { |
| 21695 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21696 | proxy->priv = flash_control_proxy_get_instance_private (proxy); |
| 21697 | #else |
| 21698 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate); |
| 21699 | #endif |
| 21700 | |
| 21701 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ()); |
| 21702 | } |
| 21703 | |
| 21704 | static void |
| 21705 | flash_control_proxy_class_init (FlashControlProxyClass *klass) |
| 21706 | { |
| 21707 | GObjectClass *gobject_class; |
| 21708 | GDBusProxyClass *proxy_class; |
| 21709 | |
| 21710 | gobject_class = G_OBJECT_CLASS (klass); |
| 21711 | gobject_class->finalize = flash_control_proxy_finalize; |
| 21712 | gobject_class->get_property = flash_control_proxy_get_property; |
| 21713 | gobject_class->set_property = flash_control_proxy_set_property; |
| 21714 | |
| 21715 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 21716 | proxy_class->g_signal = flash_control_proxy_g_signal; |
| 21717 | proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed; |
| 21718 | |
| 21719 | flash_control_override_properties (gobject_class, 1); |
| 21720 | |
| 21721 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 21722 | g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate)); |
| 21723 | #endif |
| 21724 | } |
| 21725 | |
| 21726 | static void |
| 21727 | flash_control_proxy_iface_init (FlashControlIface *iface) |
| 21728 | { |
| 21729 | iface->get_filename = flash_control_proxy_get_filename; |
| 21730 | iface->get_type_ = flash_control_proxy_get_type_; |
| 21731 | } |
| 21732 | |
| 21733 | /** |
| 21734 | * flash_control_proxy_new: |
| 21735 | * @connection: A #GDBusConnection. |
| 21736 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21737 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 21738 | * @object_path: An object path. |
| 21739 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21740 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 21741 | * @user_data: User data to pass to @callback. |
| 21742 | * |
| 21743 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details. |
| 21744 | * |
| 21745 | * 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. |
| 21746 | * You can then call flash_control_proxy_new_finish() to get the result of the operation. |
| 21747 | * |
| 21748 | * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 21749 | */ |
| 21750 | void |
| 21751 | flash_control_proxy_new ( |
| 21752 | GDBusConnection *connection, |
| 21753 | GDBusProxyFlags flags, |
| 21754 | const gchar *name, |
| 21755 | const gchar *object_path, |
| 21756 | GCancellable *cancellable, |
| 21757 | GAsyncReadyCallback callback, |
| 21758 | gpointer user_data) |
| 21759 | { |
| 21760 | g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); |
| 21761 | } |
| 21762 | |
| 21763 | /** |
| 21764 | * flash_control_proxy_new_finish: |
| 21765 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new(). |
| 21766 | * @error: Return location for error or %NULL |
| 21767 | * |
| 21768 | * Finishes an operation started with flash_control_proxy_new(). |
| 21769 | * |
| 21770 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 21771 | */ |
| 21772 | FlashControl * |
| 21773 | flash_control_proxy_new_finish ( |
| 21774 | GAsyncResult *res, |
| 21775 | GError **error) |
| 21776 | { |
| 21777 | GObject *ret; |
| 21778 | GObject *source_object; |
| 21779 | source_object = g_async_result_get_source_object (res); |
| 21780 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 21781 | g_object_unref (source_object); |
| 21782 | if (ret != NULL) |
| 21783 | return FLASH_CONTROL (ret); |
| 21784 | else |
| 21785 | return NULL; |
| 21786 | } |
| 21787 | |
| 21788 | /** |
| 21789 | * flash_control_proxy_new_sync: |
| 21790 | * @connection: A #GDBusConnection. |
| 21791 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21792 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 21793 | * @object_path: An object path. |
| 21794 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21795 | * @error: Return location for error or %NULL |
| 21796 | * |
| 21797 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details. |
| 21798 | * |
| 21799 | * The calling thread is blocked until a reply is received. |
| 21800 | * |
| 21801 | * See flash_control_proxy_new() for the asynchronous version of this constructor. |
| 21802 | * |
| 21803 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 21804 | */ |
| 21805 | FlashControl * |
| 21806 | flash_control_proxy_new_sync ( |
| 21807 | GDBusConnection *connection, |
| 21808 | GDBusProxyFlags flags, |
| 21809 | const gchar *name, |
| 21810 | const gchar *object_path, |
| 21811 | GCancellable *cancellable, |
| 21812 | GError **error) |
| 21813 | { |
| 21814 | GInitable *ret; |
| 21815 | ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); |
| 21816 | if (ret != NULL) |
| 21817 | return FLASH_CONTROL (ret); |
| 21818 | else |
| 21819 | return NULL; |
| 21820 | } |
| 21821 | |
| 21822 | |
| 21823 | /** |
| 21824 | * flash_control_proxy_new_for_bus: |
| 21825 | * @bus_type: A #GBusType. |
| 21826 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21827 | * @name: A bus name (well-known or unique). |
| 21828 | * @object_path: An object path. |
| 21829 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21830 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 21831 | * @user_data: User data to pass to @callback. |
| 21832 | * |
| 21833 | * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 21834 | * |
| 21835 | * 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. |
| 21836 | * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation. |
| 21837 | * |
| 21838 | * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 21839 | */ |
| 21840 | void |
| 21841 | flash_control_proxy_new_for_bus ( |
| 21842 | GBusType bus_type, |
| 21843 | GDBusProxyFlags flags, |
| 21844 | const gchar *name, |
| 21845 | const gchar *object_path, |
| 21846 | GCancellable *cancellable, |
| 21847 | GAsyncReadyCallback callback, |
| 21848 | gpointer user_data) |
| 21849 | { |
| 21850 | g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); |
| 21851 | } |
| 21852 | |
| 21853 | /** |
| 21854 | * flash_control_proxy_new_for_bus_finish: |
| 21855 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus(). |
| 21856 | * @error: Return location for error or %NULL |
| 21857 | * |
| 21858 | * Finishes an operation started with flash_control_proxy_new_for_bus(). |
| 21859 | * |
| 21860 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 21861 | */ |
| 21862 | FlashControl * |
| 21863 | flash_control_proxy_new_for_bus_finish ( |
| 21864 | GAsyncResult *res, |
| 21865 | GError **error) |
| 21866 | { |
| 21867 | GObject *ret; |
| 21868 | GObject *source_object; |
| 21869 | source_object = g_async_result_get_source_object (res); |
| 21870 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 21871 | g_object_unref (source_object); |
| 21872 | if (ret != NULL) |
| 21873 | return FLASH_CONTROL (ret); |
| 21874 | else |
| 21875 | return NULL; |
| 21876 | } |
| 21877 | |
| 21878 | /** |
| 21879 | * flash_control_proxy_new_for_bus_sync: |
| 21880 | * @bus_type: A #GBusType. |
| 21881 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21882 | * @name: A bus name (well-known or unique). |
| 21883 | * @object_path: An object path. |
| 21884 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21885 | * @error: Return location for error or %NULL |
| 21886 | * |
| 21887 | * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 21888 | * |
| 21889 | * The calling thread is blocked until a reply is received. |
| 21890 | * |
| 21891 | * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 21892 | * |
| 21893 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 21894 | */ |
| 21895 | FlashControl * |
| 21896 | flash_control_proxy_new_for_bus_sync ( |
| 21897 | GBusType bus_type, |
| 21898 | GDBusProxyFlags flags, |
| 21899 | const gchar *name, |
| 21900 | const gchar *object_path, |
| 21901 | GCancellable *cancellable, |
| 21902 | GError **error) |
| 21903 | { |
| 21904 | GInitable *ret; |
| 21905 | ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); |
| 21906 | if (ret != NULL) |
| 21907 | return FLASH_CONTROL (ret); |
| 21908 | else |
| 21909 | return NULL; |
| 21910 | } |
| 21911 | |
| 21912 | |
| 21913 | /* ------------------------------------------------------------------------ */ |
| 21914 | |
| 21915 | /** |
| 21916 | * FlashControlSkeleton: |
| 21917 | * |
| 21918 | * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 21919 | */ |
| 21920 | |
| 21921 | /** |
| 21922 | * FlashControlSkeletonClass: |
| 21923 | * @parent_class: The parent class. |
| 21924 | * |
| 21925 | * Class structure for #FlashControlSkeleton. |
| 21926 | */ |
| 21927 | |
| 21928 | struct _FlashControlSkeletonPrivate |
| 21929 | { |
| 21930 | GValue *properties; |
| 21931 | GList *changed_properties; |
| 21932 | GSource *changed_properties_idle_source; |
| 21933 | GMainContext *context; |
| 21934 | GMutex lock; |
| 21935 | }; |
| 21936 | |
| 21937 | static void |
| 21938 | _flash_control_skeleton_handle_method_call ( |
| 21939 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21940 | const gchar *sender G_GNUC_UNUSED, |
| 21941 | const gchar *object_path G_GNUC_UNUSED, |
| 21942 | const gchar *interface_name, |
| 21943 | const gchar *method_name, |
| 21944 | GVariant *parameters, |
| 21945 | GDBusMethodInvocation *invocation, |
| 21946 | gpointer user_data) |
| 21947 | { |
| 21948 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 21949 | _ExtendedGDBusMethodInfo *info; |
| 21950 | GVariantIter iter; |
| 21951 | GVariant *child; |
| 21952 | GValue *paramv; |
| 21953 | guint num_params; |
| 21954 | guint num_extra; |
| 21955 | guint n; |
| 21956 | guint signal_id; |
| 21957 | GValue return_value = G_VALUE_INIT; |
| 21958 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 21959 | g_assert (info != NULL); |
| 21960 | num_params = g_variant_n_children (parameters); |
| 21961 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 21962 | n = 0; |
| 21963 | g_value_init (¶mv[n], TYPE_FLASH_CONTROL); |
| 21964 | g_value_set_object (¶mv[n++], skeleton); |
| 21965 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 21966 | g_value_set_object (¶mv[n++], invocation); |
| 21967 | if (info->pass_fdlist) |
| 21968 | { |
| 21969 | #ifdef G_OS_UNIX |
| 21970 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 21971 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 21972 | #else |
| 21973 | g_assert_not_reached (); |
| 21974 | #endif |
| 21975 | } |
| 21976 | g_variant_iter_init (&iter, parameters); |
| 21977 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 21978 | { |
| 21979 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 21980 | if (arg_info->use_gvariant) |
| 21981 | { |
| 21982 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 21983 | g_value_set_variant (¶mv[n], child); |
| 21984 | n++; |
| 21985 | } |
| 21986 | else |
| 21987 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 21988 | g_variant_unref (child); |
| 21989 | } |
| 21990 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 21991 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 21992 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 21993 | if (!g_value_get_boolean (&return_value)) |
| 21994 | 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); |
| 21995 | g_value_unset (&return_value); |
| 21996 | for (n = 0; n < num_params + num_extra; n++) |
| 21997 | g_value_unset (¶mv[n]); |
| 21998 | g_free (paramv); |
| 21999 | } |
| 22000 | |
| 22001 | static GVariant * |
| 22002 | _flash_control_skeleton_handle_get_property ( |
| 22003 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22004 | const gchar *sender G_GNUC_UNUSED, |
| 22005 | const gchar *object_path G_GNUC_UNUSED, |
| 22006 | const gchar *interface_name G_GNUC_UNUSED, |
| 22007 | const gchar *property_name, |
| 22008 | GError **error, |
| 22009 | gpointer user_data) |
| 22010 | { |
| 22011 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 22012 | GValue value = G_VALUE_INIT; |
| 22013 | GParamSpec *pspec; |
| 22014 | _ExtendedGDBusPropertyInfo *info; |
| 22015 | GVariant *ret; |
| 22016 | ret = NULL; |
| 22017 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 22018 | g_assert (info != NULL); |
| 22019 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22020 | if (pspec == NULL) |
| 22021 | { |
| 22022 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22023 | } |
| 22024 | else |
| 22025 | { |
| 22026 | g_value_init (&value, pspec->value_type); |
| 22027 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22028 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 22029 | g_value_unset (&value); |
| 22030 | } |
| 22031 | return ret; |
| 22032 | } |
| 22033 | |
| 22034 | static gboolean |
| 22035 | _flash_control_skeleton_handle_set_property ( |
| 22036 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22037 | const gchar *sender G_GNUC_UNUSED, |
| 22038 | const gchar *object_path G_GNUC_UNUSED, |
| 22039 | const gchar *interface_name G_GNUC_UNUSED, |
| 22040 | const gchar *property_name, |
| 22041 | GVariant *variant, |
| 22042 | GError **error, |
| 22043 | gpointer user_data) |
| 22044 | { |
| 22045 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 22046 | GValue value = G_VALUE_INIT; |
| 22047 | GParamSpec *pspec; |
| 22048 | _ExtendedGDBusPropertyInfo *info; |
| 22049 | gboolean ret; |
| 22050 | ret = FALSE; |
| 22051 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 22052 | g_assert (info != NULL); |
| 22053 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22054 | if (pspec == NULL) |
| 22055 | { |
| 22056 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22057 | } |
| 22058 | else |
| 22059 | { |
| 22060 | if (info->use_gvariant) |
| 22061 | g_value_set_variant (&value, variant); |
| 22062 | else |
| 22063 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 22064 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22065 | g_value_unset (&value); |
| 22066 | ret = TRUE; |
| 22067 | } |
| 22068 | return ret; |
| 22069 | } |
| 22070 | |
| 22071 | static const GDBusInterfaceVTable _flash_control_skeleton_vtable = |
| 22072 | { |
| 22073 | _flash_control_skeleton_handle_method_call, |
| 22074 | _flash_control_skeleton_handle_get_property, |
| 22075 | _flash_control_skeleton_handle_set_property, |
| 22076 | {NULL} |
| 22077 | }; |
| 22078 | |
| 22079 | static GDBusInterfaceInfo * |
| 22080 | flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 22081 | { |
| 22082 | return flash_control_interface_info (); |
| 22083 | } |
| 22084 | |
| 22085 | static GDBusInterfaceVTable * |
| 22086 | flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 22087 | { |
| 22088 | return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable; |
| 22089 | } |
| 22090 | |
| 22091 | static GVariant * |
| 22092 | flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 22093 | { |
| 22094 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 22095 | |
| 22096 | GVariantBuilder builder; |
| 22097 | guint n; |
| 22098 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 22099 | if (_flash_control_interface_info.parent_struct.properties == NULL) |
| 22100 | goto out; |
| 22101 | for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 22102 | { |
| 22103 | GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n]; |
| 22104 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 22105 | { |
| 22106 | GVariant *value; |
| 22107 | value = _flash_control_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", info->name, NULL, skeleton); |
| 22108 | if (value != NULL) |
| 22109 | { |
| 22110 | g_variant_take_ref (value); |
| 22111 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 22112 | g_variant_unref (value); |
| 22113 | } |
| 22114 | } |
| 22115 | } |
| 22116 | out: |
| 22117 | return g_variant_builder_end (&builder); |
| 22118 | } |
| 22119 | |
| 22120 | static gboolean _flash_control_emit_changed (gpointer user_data); |
| 22121 | |
| 22122 | static void |
| 22123 | flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 22124 | { |
| 22125 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 22126 | gboolean emit_changed = FALSE; |
| 22127 | |
| 22128 | g_mutex_lock (&skeleton->priv->lock); |
| 22129 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 22130 | { |
| 22131 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 22132 | skeleton->priv->changed_properties_idle_source = NULL; |
| 22133 | emit_changed = TRUE; |
| 22134 | } |
| 22135 | g_mutex_unlock (&skeleton->priv->lock); |
| 22136 | |
| 22137 | if (emit_changed) |
| 22138 | _flash_control_emit_changed (skeleton); |
| 22139 | } |
| 22140 | |
| 22141 | static void |
| 22142 | _flash_control_on_signal_done ( |
| 22143 | FlashControl *object, |
| 22144 | const gchar *arg_filename) |
| 22145 | { |
| 22146 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22147 | |
| 22148 | GList *connections, *l; |
| 22149 | GVariant *signal_variant; |
| 22150 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22151 | |
| 22152 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 22153 | arg_filename)); |
| 22154 | for (l = connections; l != NULL; l = l->next) |
| 22155 | { |
| 22156 | GDBusConnection *connection = l->data; |
| 22157 | g_dbus_connection_emit_signal (connection, |
| 22158 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done", |
| 22159 | signal_variant, NULL); |
| 22160 | } |
| 22161 | g_variant_unref (signal_variant); |
| 22162 | g_list_free_full (connections, g_object_unref); |
| 22163 | } |
| 22164 | |
| 22165 | static void |
| 22166 | _flash_control_on_signal_error ( |
| 22167 | FlashControl *object, |
| 22168 | const gchar *arg_filename) |
| 22169 | { |
| 22170 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22171 | |
| 22172 | GList *connections, *l; |
| 22173 | GVariant *signal_variant; |
| 22174 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22175 | |
| 22176 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 22177 | arg_filename)); |
| 22178 | for (l = connections; l != NULL; l = l->next) |
| 22179 | { |
| 22180 | GDBusConnection *connection = l->data; |
| 22181 | g_dbus_connection_emit_signal (connection, |
| 22182 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error", |
| 22183 | signal_variant, NULL); |
| 22184 | } |
| 22185 | g_variant_unref (signal_variant); |
| 22186 | g_list_free_full (connections, g_object_unref); |
| 22187 | } |
| 22188 | |
| 22189 | static void |
| 22190 | _flash_control_on_signal_progress ( |
| 22191 | FlashControl *object, |
| 22192 | const gchar *arg_filename, |
| 22193 | guchar arg_progress) |
| 22194 | { |
| 22195 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22196 | |
| 22197 | GList *connections, *l; |
| 22198 | GVariant *signal_variant; |
| 22199 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22200 | |
| 22201 | signal_variant = g_variant_ref_sink (g_variant_new ("(sy)", |
| 22202 | arg_filename, |
| 22203 | arg_progress)); |
| 22204 | for (l = connections; l != NULL; l = l->next) |
| 22205 | { |
| 22206 | GDBusConnection *connection = l->data; |
| 22207 | g_dbus_connection_emit_signal (connection, |
| 22208 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress", |
| 22209 | signal_variant, NULL); |
| 22210 | } |
| 22211 | g_variant_unref (signal_variant); |
| 22212 | g_list_free_full (connections, g_object_unref); |
| 22213 | } |
| 22214 | |
| 22215 | static void flash_control_skeleton_iface_init (FlashControlIface *iface); |
| 22216 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22217 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 22218 | G_ADD_PRIVATE (FlashControlSkeleton) |
| 22219 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 22220 | |
| 22221 | #else |
| 22222 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 22223 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 22224 | |
| 22225 | #endif |
| 22226 | static void |
| 22227 | flash_control_skeleton_finalize (GObject *object) |
| 22228 | { |
| 22229 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22230 | guint n; |
| 22231 | for (n = 0; n < 2; n++) |
| 22232 | g_value_unset (&skeleton->priv->properties[n]); |
| 22233 | g_free (skeleton->priv->properties); |
| 22234 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 22235 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 22236 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 22237 | g_main_context_unref (skeleton->priv->context); |
| 22238 | g_mutex_clear (&skeleton->priv->lock); |
| 22239 | G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object); |
| 22240 | } |
| 22241 | |
| 22242 | static void |
| 22243 | flash_control_skeleton_get_property (GObject *object, |
| 22244 | guint prop_id, |
| 22245 | GValue *value, |
| 22246 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22247 | { |
| 22248 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22249 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 22250 | g_mutex_lock (&skeleton->priv->lock); |
| 22251 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 22252 | g_mutex_unlock (&skeleton->priv->lock); |
| 22253 | } |
| 22254 | |
| 22255 | static gboolean |
| 22256 | _flash_control_emit_changed (gpointer user_data) |
| 22257 | { |
| 22258 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 22259 | GList *l; |
| 22260 | GVariantBuilder builder; |
| 22261 | GVariantBuilder invalidated_builder; |
| 22262 | guint num_changes; |
| 22263 | |
| 22264 | g_mutex_lock (&skeleton->priv->lock); |
| 22265 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 22266 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 22267 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 22268 | { |
| 22269 | ChangedProperty *cp = l->data; |
| 22270 | GVariant *variant; |
| 22271 | const GValue *cur_value; |
| 22272 | |
| 22273 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 22274 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 22275 | { |
| 22276 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 22277 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 22278 | g_variant_unref (variant); |
| 22279 | num_changes++; |
| 22280 | } |
| 22281 | } |
| 22282 | if (num_changes > 0) |
| 22283 | { |
| 22284 | GList *connections, *ll; |
| 22285 | GVariant *signal_variant; |
| 22286 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl", |
| 22287 | &builder, &invalidated_builder)); |
| 22288 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22289 | for (ll = connections; ll != NULL; ll = ll->next) |
| 22290 | { |
| 22291 | GDBusConnection *connection = ll->data; |
| 22292 | |
| 22293 | g_dbus_connection_emit_signal (connection, |
| 22294 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 22295 | "org.freedesktop.DBus.Properties", |
| 22296 | "PropertiesChanged", |
| 22297 | signal_variant, |
| 22298 | NULL); |
| 22299 | } |
| 22300 | g_variant_unref (signal_variant); |
| 22301 | g_list_free_full (connections, g_object_unref); |
| 22302 | } |
| 22303 | else |
| 22304 | { |
| 22305 | g_variant_builder_clear (&builder); |
| 22306 | g_variant_builder_clear (&invalidated_builder); |
| 22307 | } |
| 22308 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 22309 | skeleton->priv->changed_properties = NULL; |
| 22310 | skeleton->priv->changed_properties_idle_source = NULL; |
| 22311 | g_mutex_unlock (&skeleton->priv->lock); |
| 22312 | return FALSE; |
| 22313 | } |
| 22314 | |
| 22315 | static void |
| 22316 | _flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 22317 | { |
| 22318 | ChangedProperty *cp; |
| 22319 | GList *l; |
| 22320 | cp = NULL; |
| 22321 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 22322 | { |
| 22323 | ChangedProperty *i_cp = l->data; |
| 22324 | if (i_cp->info == info) |
| 22325 | { |
| 22326 | cp = i_cp; |
| 22327 | break; |
| 22328 | } |
| 22329 | } |
| 22330 | if (cp == NULL) |
| 22331 | { |
| 22332 | cp = g_new0 (ChangedProperty, 1); |
| 22333 | cp->prop_id = prop_id; |
| 22334 | cp->info = info; |
| 22335 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 22336 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 22337 | g_value_copy (orig_value, &cp->orig_value); |
| 22338 | } |
| 22339 | } |
| 22340 | |
| 22341 | static void |
| 22342 | flash_control_skeleton_notify (GObject *object, |
| 22343 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22344 | { |
| 22345 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22346 | g_mutex_lock (&skeleton->priv->lock); |
| 22347 | if (skeleton->priv->changed_properties != NULL && |
| 22348 | skeleton->priv->changed_properties_idle_source == NULL) |
| 22349 | { |
| 22350 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 22351 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 22352 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 22353 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 22354 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 22355 | } |
| 22356 | g_mutex_unlock (&skeleton->priv->lock); |
| 22357 | } |
| 22358 | |
| 22359 | static void |
| 22360 | flash_control_skeleton_set_property (GObject *object, |
| 22361 | guint prop_id, |
| 22362 | const GValue *value, |
| 22363 | GParamSpec *pspec) |
| 22364 | { |
| 22365 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22366 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 22367 | g_mutex_lock (&skeleton->priv->lock); |
| 22368 | g_object_freeze_notify (object); |
| 22369 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 22370 | { |
| 22371 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 22372 | _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 22373 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 22374 | g_object_notify_by_pspec (object, pspec); |
| 22375 | } |
| 22376 | g_mutex_unlock (&skeleton->priv->lock); |
| 22377 | g_object_thaw_notify (object); |
| 22378 | } |
| 22379 | |
| 22380 | static void |
| 22381 | flash_control_skeleton_init (FlashControlSkeleton *skeleton) |
| 22382 | { |
| 22383 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22384 | skeleton->priv = flash_control_skeleton_get_instance_private (skeleton); |
| 22385 | #else |
| 22386 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate); |
| 22387 | #endif |
| 22388 | |
| 22389 | g_mutex_init (&skeleton->priv->lock); |
| 22390 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 22391 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 22392 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 22393 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 22394 | } |
| 22395 | |
| 22396 | static const gchar * |
| 22397 | flash_control_skeleton_get_filename (FlashControl *object) |
| 22398 | { |
| 22399 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22400 | const gchar *value; |
| 22401 | g_mutex_lock (&skeleton->priv->lock); |
| 22402 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 22403 | g_mutex_unlock (&skeleton->priv->lock); |
| 22404 | return value; |
| 22405 | } |
| 22406 | |
| 22407 | static const gchar * |
| 22408 | flash_control_skeleton_get_type_ (FlashControl *object) |
| 22409 | { |
| 22410 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 22411 | const gchar *value; |
| 22412 | g_mutex_lock (&skeleton->priv->lock); |
| 22413 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 22414 | g_mutex_unlock (&skeleton->priv->lock); |
| 22415 | return value; |
| 22416 | } |
| 22417 | |
| 22418 | static void |
| 22419 | flash_control_skeleton_class_init (FlashControlSkeletonClass *klass) |
| 22420 | { |
| 22421 | GObjectClass *gobject_class; |
| 22422 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 22423 | |
| 22424 | gobject_class = G_OBJECT_CLASS (klass); |
| 22425 | gobject_class->finalize = flash_control_skeleton_finalize; |
| 22426 | gobject_class->get_property = flash_control_skeleton_get_property; |
| 22427 | gobject_class->set_property = flash_control_skeleton_set_property; |
| 22428 | gobject_class->notify = flash_control_skeleton_notify; |
| 22429 | |
| 22430 | |
| 22431 | flash_control_override_properties (gobject_class, 1); |
| 22432 | |
| 22433 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 22434 | skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info; |
| 22435 | skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties; |
| 22436 | skeleton_class->flush = flash_control_skeleton_dbus_interface_flush; |
| 22437 | skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable; |
| 22438 | |
| 22439 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 22440 | g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate)); |
| 22441 | #endif |
| 22442 | } |
| 22443 | |
| 22444 | static void |
| 22445 | flash_control_skeleton_iface_init (FlashControlIface *iface) |
| 22446 | { |
| 22447 | iface->done = _flash_control_on_signal_done; |
| 22448 | iface->error = _flash_control_on_signal_error; |
| 22449 | iface->progress = _flash_control_on_signal_progress; |
| 22450 | iface->get_filename = flash_control_skeleton_get_filename; |
| 22451 | iface->get_type_ = flash_control_skeleton_get_type_; |
| 22452 | } |
| 22453 | |
| 22454 | /** |
| 22455 | * flash_control_skeleton_new: |
| 22456 | * |
| 22457 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 22458 | * |
| 22459 | * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object. |
| 22460 | */ |
| 22461 | FlashControl * |
| 22462 | flash_control_skeleton_new (void) |
| 22463 | { |
| 22464 | return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL)); |
| 22465 | } |
| 22466 | |
| 22467 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22468 | * Code for interface org.openbmc.Button |
| 22469 | * ------------------------------------------------------------------------ |
| 22470 | */ |
| 22471 | |
| 22472 | /** |
| 22473 | * SECTION:Button |
| 22474 | * @title: Button |
| 22475 | * @short_description: Generated C code for the org.openbmc.Button D-Bus interface |
| 22476 | * |
| 22477 | * 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. |
| 22478 | */ |
| 22479 | |
| 22480 | /* ---- Introspection data for org.openbmc.Button ---- */ |
| 22481 | |
| 22482 | static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state = |
| 22483 | { |
| 22484 | { |
| 22485 | -1, |
| 22486 | (gchar *) "state", |
| 22487 | (gchar *) "b", |
| 22488 | NULL |
| 22489 | }, |
| 22490 | FALSE |
| 22491 | }; |
| 22492 | |
| 22493 | static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] = |
| 22494 | { |
| 22495 | &_button_method_info_is_on_OUT_ARG_state, |
| 22496 | NULL |
| 22497 | }; |
| 22498 | |
| 22499 | static const _ExtendedGDBusMethodInfo _button_method_info_is_on = |
| 22500 | { |
| 22501 | { |
| 22502 | -1, |
| 22503 | (gchar *) "isOn", |
| 22504 | NULL, |
| 22505 | (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers, |
| 22506 | NULL |
| 22507 | }, |
| 22508 | "handle-is-on", |
| 22509 | FALSE |
| 22510 | }; |
| 22511 | |
| 22512 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press = |
| 22513 | { |
| 22514 | { |
| 22515 | -1, |
| 22516 | (gchar *) "simButtonPress", |
| 22517 | NULL, |
| 22518 | NULL, |
| 22519 | NULL |
| 22520 | }, |
| 22521 | "handle-sim-button-press", |
| 22522 | FALSE |
| 22523 | }; |
| 22524 | |
| 22525 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press = |
| 22526 | { |
| 22527 | { |
| 22528 | -1, |
| 22529 | (gchar *) "simButtonLongPress", |
| 22530 | NULL, |
| 22531 | NULL, |
| 22532 | NULL |
| 22533 | }, |
| 22534 | "handle-sim-button-long-press", |
| 22535 | FALSE |
| 22536 | }; |
| 22537 | |
| 22538 | static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] = |
| 22539 | { |
| 22540 | &_button_method_info_is_on, |
| 22541 | &_button_method_info_sim_button_press, |
| 22542 | &_button_method_info_sim_button_long_press, |
| 22543 | NULL |
| 22544 | }; |
| 22545 | |
| 22546 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_release = |
| 22547 | { |
| 22548 | { |
| 22549 | -1, |
| 22550 | (gchar *) "ButtonRelease", |
| 22551 | NULL, |
| 22552 | NULL |
| 22553 | }, |
| 22554 | "button-release" |
| 22555 | }; |
| 22556 | |
| 22557 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed = |
| 22558 | { |
| 22559 | { |
| 22560 | -1, |
| 22561 | (gchar *) "ButtonPressed", |
| 22562 | NULL, |
| 22563 | NULL |
| 22564 | }, |
| 22565 | "button-pressed" |
| 22566 | }; |
| 22567 | |
| 22568 | static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long = |
| 22569 | { |
| 22570 | { |
| 22571 | -1, |
| 22572 | (gchar *) "ButtonPressedLong", |
| 22573 | NULL, |
| 22574 | NULL |
| 22575 | }, |
| 22576 | "button-pressed-long" |
| 22577 | }; |
| 22578 | |
| 22579 | static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] = |
| 22580 | { |
| 22581 | &_button_signal_info_button_release, |
| 22582 | &_button_signal_info_button_pressed, |
| 22583 | &_button_signal_info_button_pressed_long, |
| 22584 | NULL |
| 22585 | }; |
| 22586 | |
| 22587 | static const _ExtendedGDBusPropertyInfo _button_property_info_state = |
| 22588 | { |
| 22589 | { |
| 22590 | -1, |
| 22591 | (gchar *) "state", |
| 22592 | (gchar *) "b", |
| 22593 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 22594 | NULL |
| 22595 | }, |
| 22596 | "state", |
| 22597 | FALSE |
| 22598 | }; |
| 22599 | |
| 22600 | static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] = |
| 22601 | { |
| 22602 | &_button_property_info_state, |
| 22603 | NULL |
| 22604 | }; |
| 22605 | |
| 22606 | static const _ExtendedGDBusInterfaceInfo _button_interface_info = |
| 22607 | { |
| 22608 | { |
| 22609 | -1, |
| 22610 | (gchar *) "org.openbmc.Button", |
| 22611 | (GDBusMethodInfo **) &_button_method_info_pointers, |
| 22612 | (GDBusSignalInfo **) &_button_signal_info_pointers, |
| 22613 | (GDBusPropertyInfo **) &_button_property_info_pointers, |
| 22614 | NULL |
| 22615 | }, |
| 22616 | "button", |
| 22617 | }; |
| 22618 | |
| 22619 | |
| 22620 | /** |
| 22621 | * button_interface_info: |
| 22622 | * |
| 22623 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface. |
| 22624 | * |
| 22625 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 22626 | */ |
| 22627 | GDBusInterfaceInfo * |
| 22628 | button_interface_info (void) |
| 22629 | { |
| 22630 | return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct; |
| 22631 | } |
| 22632 | |
| 22633 | /** |
| 22634 | * button_override_properties: |
| 22635 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 22636 | * @property_id_begin: The property id to assign to the first overridden property. |
| 22637 | * |
| 22638 | * Overrides all #GObject properties in the #Button interface for a concrete class. |
| 22639 | * The properties are overridden in the order they are defined. |
| 22640 | * |
| 22641 | * Returns: The last property id. |
| 22642 | */ |
| 22643 | guint |
| 22644 | button_override_properties (GObjectClass *klass, guint property_id_begin) |
| 22645 | { |
| 22646 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 22647 | return property_id_begin - 1; |
| 22648 | } |
| 22649 | |
| 22650 | |
| 22651 | |
| 22652 | /** |
| 22653 | * Button: |
| 22654 | * |
| 22655 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 22656 | */ |
| 22657 | |
| 22658 | /** |
| 22659 | * ButtonIface: |
| 22660 | * @parent_iface: The parent interface. |
| 22661 | * @handle_is_on: Handler for the #Button::handle-is-on signal. |
| 22662 | * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal. |
| 22663 | * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal. |
| 22664 | * @get_state: Getter for the #Button:state property. |
| 22665 | * @button_pressed: Handler for the #Button::button-pressed signal. |
| 22666 | * @button_pressed_long: Handler for the #Button::button-pressed-long signal. |
| 22667 | * @button_release: Handler for the #Button::button-release signal. |
| 22668 | * |
| 22669 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 22670 | */ |
| 22671 | |
| 22672 | typedef ButtonIface ButtonInterface; |
| 22673 | G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT); |
| 22674 | |
| 22675 | static void |
| 22676 | button_default_init (ButtonIface *iface) |
| 22677 | { |
| 22678 | /* GObject signals for incoming D-Bus method calls: */ |
| 22679 | /** |
| 22680 | * Button::handle-is-on: |
| 22681 | * @object: A #Button. |
| 22682 | * @invocation: A #GDBusMethodInvocation. |
| 22683 | * |
| 22684 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. |
| 22685 | * |
| 22686 | * 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. |
| 22687 | * |
| 22688 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 22689 | */ |
| 22690 | g_signal_new ("handle-is-on", |
| 22691 | G_TYPE_FROM_INTERFACE (iface), |
| 22692 | G_SIGNAL_RUN_LAST, |
| 22693 | G_STRUCT_OFFSET (ButtonIface, handle_is_on), |
| 22694 | g_signal_accumulator_true_handled, |
| 22695 | NULL, |
| 22696 | g_cclosure_marshal_generic, |
| 22697 | G_TYPE_BOOLEAN, |
| 22698 | 1, |
| 22699 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 22700 | |
| 22701 | /** |
| 22702 | * Button::handle-sim-button-press: |
| 22703 | * @object: A #Button. |
| 22704 | * @invocation: A #GDBusMethodInvocation. |
| 22705 | * |
| 22706 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method. |
| 22707 | * |
| 22708 | * 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. |
| 22709 | * |
| 22710 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 22711 | */ |
| 22712 | g_signal_new ("handle-sim-button-press", |
| 22713 | G_TYPE_FROM_INTERFACE (iface), |
| 22714 | G_SIGNAL_RUN_LAST, |
| 22715 | G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press), |
| 22716 | g_signal_accumulator_true_handled, |
| 22717 | NULL, |
| 22718 | g_cclosure_marshal_generic, |
| 22719 | G_TYPE_BOOLEAN, |
| 22720 | 1, |
| 22721 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 22722 | |
| 22723 | /** |
| 22724 | * Button::handle-sim-button-long-press: |
| 22725 | * @object: A #Button. |
| 22726 | * @invocation: A #GDBusMethodInvocation. |
| 22727 | * |
| 22728 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method. |
| 22729 | * |
| 22730 | * 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. |
| 22731 | * |
| 22732 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 22733 | */ |
| 22734 | g_signal_new ("handle-sim-button-long-press", |
| 22735 | G_TYPE_FROM_INTERFACE (iface), |
| 22736 | G_SIGNAL_RUN_LAST, |
| 22737 | G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press), |
| 22738 | g_signal_accumulator_true_handled, |
| 22739 | NULL, |
| 22740 | g_cclosure_marshal_generic, |
| 22741 | G_TYPE_BOOLEAN, |
| 22742 | 1, |
| 22743 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 22744 | |
| 22745 | /* GObject signals for received D-Bus signals: */ |
| 22746 | /** |
| 22747 | * Button::button-release: |
| 22748 | * @object: A #Button. |
| 22749 | * |
| 22750 | * 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. |
| 22751 | * |
| 22752 | * 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. |
| 22753 | */ |
| 22754 | g_signal_new ("button-release", |
| 22755 | G_TYPE_FROM_INTERFACE (iface), |
| 22756 | G_SIGNAL_RUN_LAST, |
| 22757 | G_STRUCT_OFFSET (ButtonIface, button_release), |
| 22758 | NULL, |
| 22759 | NULL, |
| 22760 | g_cclosure_marshal_generic, |
| 22761 | G_TYPE_NONE, |
| 22762 | 0); |
| 22763 | |
| 22764 | /** |
| 22765 | * Button::button-pressed: |
| 22766 | * @object: A #Button. |
| 22767 | * |
| 22768 | * 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. |
| 22769 | * |
| 22770 | * 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. |
| 22771 | */ |
| 22772 | g_signal_new ("button-pressed", |
| 22773 | G_TYPE_FROM_INTERFACE (iface), |
| 22774 | G_SIGNAL_RUN_LAST, |
| 22775 | G_STRUCT_OFFSET (ButtonIface, button_pressed), |
| 22776 | NULL, |
| 22777 | NULL, |
| 22778 | g_cclosure_marshal_generic, |
| 22779 | G_TYPE_NONE, |
| 22780 | 0); |
| 22781 | |
| 22782 | /** |
| 22783 | * Button::button-pressed-long: |
| 22784 | * @object: A #Button. |
| 22785 | * |
| 22786 | * 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. |
| 22787 | * |
| 22788 | * 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. |
| 22789 | */ |
| 22790 | g_signal_new ("button-pressed-long", |
| 22791 | G_TYPE_FROM_INTERFACE (iface), |
| 22792 | G_SIGNAL_RUN_LAST, |
| 22793 | G_STRUCT_OFFSET (ButtonIface, button_pressed_long), |
| 22794 | NULL, |
| 22795 | NULL, |
| 22796 | g_cclosure_marshal_generic, |
| 22797 | G_TYPE_NONE, |
| 22798 | 0); |
| 22799 | |
| 22800 | /* GObject properties for D-Bus properties: */ |
| 22801 | /** |
| 22802 | * Button:state: |
| 22803 | * |
| 22804 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>. |
| 22805 | * |
| 22806 | * 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. |
| 22807 | */ |
| 22808 | g_object_interface_install_property (iface, |
| 22809 | g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 22810 | } |
| 22811 | |
| 22812 | /** |
| 22813 | * button_get_state: (skip) |
| 22814 | * @object: A #Button. |
| 22815 | * |
| 22816 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property. |
| 22817 | * |
| 22818 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22819 | * |
| 22820 | * Returns: The property value. |
| 22821 | */ |
| 22822 | gboolean |
| 22823 | button_get_state (Button *object) |
| 22824 | { |
| 22825 | return BUTTON_GET_IFACE (object)->get_state (object); |
| 22826 | } |
| 22827 | |
| 22828 | /** |
| 22829 | * button_set_state: (skip) |
| 22830 | * @object: A #Button. |
| 22831 | * @value: The value to set. |
| 22832 | * |
| 22833 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value. |
| 22834 | * |
| 22835 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22836 | */ |
| 22837 | void |
| 22838 | button_set_state (Button *object, gboolean value) |
| 22839 | { |
| 22840 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 22841 | } |
| 22842 | |
| 22843 | /** |
| 22844 | * button_emit_button_release: |
| 22845 | * @object: A #Button. |
| 22846 | * |
| 22847 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal. |
| 22848 | */ |
| 22849 | void |
| 22850 | button_emit_button_release ( |
| 22851 | Button *object) |
| 22852 | { |
| 22853 | g_signal_emit_by_name (object, "button-release"); |
| 22854 | } |
| 22855 | |
| 22856 | /** |
| 22857 | * button_emit_button_pressed: |
| 22858 | * @object: A #Button. |
| 22859 | * |
| 22860 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal. |
| 22861 | */ |
| 22862 | void |
| 22863 | button_emit_button_pressed ( |
| 22864 | Button *object) |
| 22865 | { |
| 22866 | g_signal_emit_by_name (object, "button-pressed"); |
| 22867 | } |
| 22868 | |
| 22869 | /** |
| 22870 | * button_emit_button_pressed_long: |
| 22871 | * @object: A #Button. |
| 22872 | * |
| 22873 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal. |
| 22874 | */ |
| 22875 | void |
| 22876 | button_emit_button_pressed_long ( |
| 22877 | Button *object) |
| 22878 | { |
| 22879 | g_signal_emit_by_name (object, "button-pressed-long"); |
| 22880 | } |
| 22881 | |
| 22882 | /** |
| 22883 | * button_call_is_on: |
| 22884 | * @proxy: A #ButtonProxy. |
| 22885 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22886 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22887 | * @user_data: User data to pass to @callback. |
| 22888 | * |
| 22889 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. |
| 22890 | * 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. |
| 22891 | * You can then call button_call_is_on_finish() to get the result of the operation. |
| 22892 | * |
| 22893 | * See button_call_is_on_sync() for the synchronous, blocking version of this method. |
| 22894 | */ |
| 22895 | void |
| 22896 | button_call_is_on ( |
| 22897 | Button *proxy, |
| 22898 | GCancellable *cancellable, |
| 22899 | GAsyncReadyCallback callback, |
| 22900 | gpointer user_data) |
| 22901 | { |
| 22902 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22903 | "isOn", |
| 22904 | g_variant_new ("()"), |
| 22905 | G_DBUS_CALL_FLAGS_NONE, |
| 22906 | -1, |
| 22907 | cancellable, |
| 22908 | callback, |
| 22909 | user_data); |
| 22910 | } |
| 22911 | |
| 22912 | /** |
| 22913 | * button_call_is_on_finish: |
| 22914 | * @proxy: A #ButtonProxy. |
| 22915 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 22916 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on(). |
| 22917 | * @error: Return location for error or %NULL. |
| 22918 | * |
| 22919 | * Finishes an operation started with button_call_is_on(). |
| 22920 | * |
| 22921 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22922 | */ |
| 22923 | gboolean |
| 22924 | button_call_is_on_finish ( |
| 22925 | Button *proxy, |
| 22926 | gboolean *out_state, |
| 22927 | GAsyncResult *res, |
| 22928 | GError **error) |
| 22929 | { |
| 22930 | GVariant *_ret; |
| 22931 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22932 | if (_ret == NULL) |
| 22933 | goto _out; |
| 22934 | g_variant_get (_ret, |
| 22935 | "(b)", |
| 22936 | out_state); |
| 22937 | g_variant_unref (_ret); |
| 22938 | _out: |
| 22939 | return _ret != NULL; |
| 22940 | } |
| 22941 | |
| 22942 | /** |
| 22943 | * button_call_is_on_sync: |
| 22944 | * @proxy: A #ButtonProxy. |
| 22945 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 22946 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22947 | * @error: Return location for error or %NULL. |
| 22948 | * |
| 22949 | * 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. |
| 22950 | * |
| 22951 | * See button_call_is_on() for the asynchronous version of this method. |
| 22952 | * |
| 22953 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22954 | */ |
| 22955 | gboolean |
| 22956 | button_call_is_on_sync ( |
| 22957 | Button *proxy, |
| 22958 | gboolean *out_state, |
| 22959 | GCancellable *cancellable, |
| 22960 | GError **error) |
| 22961 | { |
| 22962 | GVariant *_ret; |
| 22963 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22964 | "isOn", |
| 22965 | g_variant_new ("()"), |
| 22966 | G_DBUS_CALL_FLAGS_NONE, |
| 22967 | -1, |
| 22968 | cancellable, |
| 22969 | error); |
| 22970 | if (_ret == NULL) |
| 22971 | goto _out; |
| 22972 | g_variant_get (_ret, |
| 22973 | "(b)", |
| 22974 | out_state); |
| 22975 | g_variant_unref (_ret); |
| 22976 | _out: |
| 22977 | return _ret != NULL; |
| 22978 | } |
| 22979 | |
| 22980 | /** |
| 22981 | * button_call_sim_button_press: |
| 22982 | * @proxy: A #ButtonProxy. |
| 22983 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22984 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22985 | * @user_data: User data to pass to @callback. |
| 22986 | * |
| 22987 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. |
| 22988 | * 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. |
| 22989 | * You can then call button_call_sim_button_press_finish() to get the result of the operation. |
| 22990 | * |
| 22991 | * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method. |
| 22992 | */ |
| 22993 | void |
| 22994 | button_call_sim_button_press ( |
| 22995 | Button *proxy, |
| 22996 | GCancellable *cancellable, |
| 22997 | GAsyncReadyCallback callback, |
| 22998 | gpointer user_data) |
| 22999 | { |
| 23000 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 23001 | "simButtonPress", |
| 23002 | g_variant_new ("()"), |
| 23003 | G_DBUS_CALL_FLAGS_NONE, |
| 23004 | -1, |
| 23005 | cancellable, |
| 23006 | callback, |
| 23007 | user_data); |
| 23008 | } |
| 23009 | |
| 23010 | /** |
| 23011 | * button_call_sim_button_press_finish: |
| 23012 | * @proxy: A #ButtonProxy. |
| 23013 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press(). |
| 23014 | * @error: Return location for error or %NULL. |
| 23015 | * |
| 23016 | * Finishes an operation started with button_call_sim_button_press(). |
| 23017 | * |
| 23018 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23019 | */ |
| 23020 | gboolean |
| 23021 | button_call_sim_button_press_finish ( |
| 23022 | Button *proxy, |
| 23023 | GAsyncResult *res, |
| 23024 | GError **error) |
| 23025 | { |
| 23026 | GVariant *_ret; |
| 23027 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 23028 | if (_ret == NULL) |
| 23029 | goto _out; |
| 23030 | g_variant_get (_ret, |
| 23031 | "()"); |
| 23032 | g_variant_unref (_ret); |
| 23033 | _out: |
| 23034 | return _ret != NULL; |
| 23035 | } |
| 23036 | |
| 23037 | /** |
| 23038 | * button_call_sim_button_press_sync: |
| 23039 | * @proxy: A #ButtonProxy. |
| 23040 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23041 | * @error: Return location for error or %NULL. |
| 23042 | * |
| 23043 | * 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. |
| 23044 | * |
| 23045 | * See button_call_sim_button_press() for the asynchronous version of this method. |
| 23046 | * |
| 23047 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23048 | */ |
| 23049 | gboolean |
| 23050 | button_call_sim_button_press_sync ( |
| 23051 | Button *proxy, |
| 23052 | GCancellable *cancellable, |
| 23053 | GError **error) |
| 23054 | { |
| 23055 | GVariant *_ret; |
| 23056 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 23057 | "simButtonPress", |
| 23058 | g_variant_new ("()"), |
| 23059 | G_DBUS_CALL_FLAGS_NONE, |
| 23060 | -1, |
| 23061 | cancellable, |
| 23062 | error); |
| 23063 | if (_ret == NULL) |
| 23064 | goto _out; |
| 23065 | g_variant_get (_ret, |
| 23066 | "()"); |
| 23067 | g_variant_unref (_ret); |
| 23068 | _out: |
| 23069 | return _ret != NULL; |
| 23070 | } |
| 23071 | |
| 23072 | /** |
| 23073 | * button_call_sim_button_long_press: |
| 23074 | * @proxy: A #ButtonProxy. |
| 23075 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23076 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 23077 | * @user_data: User data to pass to @callback. |
| 23078 | * |
| 23079 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. |
| 23080 | * 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. |
| 23081 | * You can then call button_call_sim_button_long_press_finish() to get the result of the operation. |
| 23082 | * |
| 23083 | * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method. |
| 23084 | */ |
| 23085 | void |
| 23086 | button_call_sim_button_long_press ( |
| 23087 | Button *proxy, |
| 23088 | GCancellable *cancellable, |
| 23089 | GAsyncReadyCallback callback, |
| 23090 | gpointer user_data) |
| 23091 | { |
| 23092 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 23093 | "simButtonLongPress", |
| 23094 | g_variant_new ("()"), |
| 23095 | G_DBUS_CALL_FLAGS_NONE, |
| 23096 | -1, |
| 23097 | cancellable, |
| 23098 | callback, |
| 23099 | user_data); |
| 23100 | } |
| 23101 | |
| 23102 | /** |
| 23103 | * button_call_sim_button_long_press_finish: |
| 23104 | * @proxy: A #ButtonProxy. |
| 23105 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press(). |
| 23106 | * @error: Return location for error or %NULL. |
| 23107 | * |
| 23108 | * Finishes an operation started with button_call_sim_button_long_press(). |
| 23109 | * |
| 23110 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23111 | */ |
| 23112 | gboolean |
| 23113 | button_call_sim_button_long_press_finish ( |
| 23114 | Button *proxy, |
| 23115 | GAsyncResult *res, |
| 23116 | GError **error) |
| 23117 | { |
| 23118 | GVariant *_ret; |
| 23119 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 23120 | if (_ret == NULL) |
| 23121 | goto _out; |
| 23122 | g_variant_get (_ret, |
| 23123 | "()"); |
| 23124 | g_variant_unref (_ret); |
| 23125 | _out: |
| 23126 | return _ret != NULL; |
| 23127 | } |
| 23128 | |
| 23129 | /** |
| 23130 | * button_call_sim_button_long_press_sync: |
| 23131 | * @proxy: A #ButtonProxy. |
| 23132 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23133 | * @error: Return location for error or %NULL. |
| 23134 | * |
| 23135 | * 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. |
| 23136 | * |
| 23137 | * See button_call_sim_button_long_press() for the asynchronous version of this method. |
| 23138 | * |
| 23139 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23140 | */ |
| 23141 | gboolean |
| 23142 | button_call_sim_button_long_press_sync ( |
| 23143 | Button *proxy, |
| 23144 | GCancellable *cancellable, |
| 23145 | GError **error) |
| 23146 | { |
| 23147 | GVariant *_ret; |
| 23148 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 23149 | "simButtonLongPress", |
| 23150 | g_variant_new ("()"), |
| 23151 | G_DBUS_CALL_FLAGS_NONE, |
| 23152 | -1, |
| 23153 | cancellable, |
| 23154 | error); |
| 23155 | if (_ret == NULL) |
| 23156 | goto _out; |
| 23157 | g_variant_get (_ret, |
| 23158 | "()"); |
| 23159 | g_variant_unref (_ret); |
| 23160 | _out: |
| 23161 | return _ret != NULL; |
| 23162 | } |
| 23163 | |
| 23164 | /** |
| 23165 | * button_complete_is_on: |
| 23166 | * @object: A #Button. |
| 23167 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 23168 | * @state: Parameter to return. |
| 23169 | * |
| 23170 | * 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. |
| 23171 | * |
| 23172 | * This method will free @invocation, you cannot use it afterwards. |
| 23173 | */ |
| 23174 | void |
| 23175 | button_complete_is_on ( |
| 23176 | Button *object, |
| 23177 | GDBusMethodInvocation *invocation, |
| 23178 | gboolean state) |
| 23179 | { |
| 23180 | g_dbus_method_invocation_return_value (invocation, |
| 23181 | g_variant_new ("(b)", |
| 23182 | state)); |
| 23183 | } |
| 23184 | |
| 23185 | /** |
| 23186 | * button_complete_sim_button_press: |
| 23187 | * @object: A #Button. |
| 23188 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 23189 | * |
| 23190 | * 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. |
| 23191 | * |
| 23192 | * This method will free @invocation, you cannot use it afterwards. |
| 23193 | */ |
| 23194 | void |
| 23195 | button_complete_sim_button_press ( |
| 23196 | Button *object, |
| 23197 | GDBusMethodInvocation *invocation) |
| 23198 | { |
| 23199 | g_dbus_method_invocation_return_value (invocation, |
| 23200 | g_variant_new ("()")); |
| 23201 | } |
| 23202 | |
| 23203 | /** |
| 23204 | * button_complete_sim_button_long_press: |
| 23205 | * @object: A #Button. |
| 23206 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 23207 | * |
| 23208 | * 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. |
| 23209 | * |
| 23210 | * This method will free @invocation, you cannot use it afterwards. |
| 23211 | */ |
| 23212 | void |
| 23213 | button_complete_sim_button_long_press ( |
| 23214 | Button *object, |
| 23215 | GDBusMethodInvocation *invocation) |
| 23216 | { |
| 23217 | g_dbus_method_invocation_return_value (invocation, |
| 23218 | g_variant_new ("()")); |
| 23219 | } |
| 23220 | |
| 23221 | /* ------------------------------------------------------------------------ */ |
| 23222 | |
| 23223 | /** |
| 23224 | * ButtonProxy: |
| 23225 | * |
| 23226 | * The #ButtonProxy structure contains only private data and should only be accessed using the provided API. |
| 23227 | */ |
| 23228 | |
| 23229 | /** |
| 23230 | * ButtonProxyClass: |
| 23231 | * @parent_class: The parent class. |
| 23232 | * |
| 23233 | * Class structure for #ButtonProxy. |
| 23234 | */ |
| 23235 | |
| 23236 | struct _ButtonProxyPrivate |
| 23237 | { |
| 23238 | GData *qdata; |
| 23239 | }; |
| 23240 | |
| 23241 | static void button_proxy_iface_init (ButtonIface *iface); |
| 23242 | |
| 23243 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23244 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 23245 | G_ADD_PRIVATE (ButtonProxy) |
| 23246 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 23247 | |
| 23248 | #else |
| 23249 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 23250 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 23251 | |
| 23252 | #endif |
| 23253 | static void |
| 23254 | button_proxy_finalize (GObject *object) |
| 23255 | { |
| 23256 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 23257 | g_datalist_clear (&proxy->priv->qdata); |
| 23258 | G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object); |
| 23259 | } |
| 23260 | |
| 23261 | static void |
| 23262 | button_proxy_get_property (GObject *object, |
| 23263 | guint prop_id, |
| 23264 | GValue *value, |
| 23265 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23266 | { |
| 23267 | const _ExtendedGDBusPropertyInfo *info; |
| 23268 | GVariant *variant; |
| 23269 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 23270 | info = _button_property_info_pointers[prop_id - 1]; |
| 23271 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 23272 | if (info->use_gvariant) |
| 23273 | { |
| 23274 | g_value_set_variant (value, variant); |
| 23275 | } |
| 23276 | else |
| 23277 | { |
| 23278 | if (variant != NULL) |
| 23279 | g_dbus_gvariant_to_gvalue (variant, value); |
| 23280 | } |
| 23281 | if (variant != NULL) |
| 23282 | g_variant_unref (variant); |
| 23283 | } |
| 23284 | |
| 23285 | static void |
| 23286 | button_proxy_set_property_cb (GDBusProxy *proxy, |
| 23287 | GAsyncResult *res, |
| 23288 | gpointer user_data) |
| 23289 | { |
| 23290 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 23291 | GError *error; |
| 23292 | GVariant *_ret; |
| 23293 | error = NULL; |
| 23294 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 23295 | if (!_ret) |
| 23296 | { |
| 23297 | g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)", |
| 23298 | info->parent_struct.name, |
| 23299 | error->message, g_quark_to_string (error->domain), error->code); |
| 23300 | g_error_free (error); |
| 23301 | } |
| 23302 | else |
| 23303 | { |
| 23304 | g_variant_unref (_ret); |
| 23305 | } |
| 23306 | } |
| 23307 | |
| 23308 | static void |
| 23309 | button_proxy_set_property (GObject *object, |
| 23310 | guint prop_id, |
| 23311 | const GValue *value, |
| 23312 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23313 | { |
| 23314 | const _ExtendedGDBusPropertyInfo *info; |
| 23315 | GVariant *variant; |
| 23316 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 23317 | info = _button_property_info_pointers[prop_id - 1]; |
| 23318 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 23319 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 23320 | "org.freedesktop.DBus.Properties.Set", |
| 23321 | g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant), |
| 23322 | G_DBUS_CALL_FLAGS_NONE, |
| 23323 | -1, |
| 23324 | NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 23325 | g_variant_unref (variant); |
| 23326 | } |
| 23327 | |
| 23328 | static void |
| 23329 | button_proxy_g_signal (GDBusProxy *proxy, |
| 23330 | const gchar *sender_name G_GNUC_UNUSED, |
| 23331 | const gchar *signal_name, |
| 23332 | GVariant *parameters) |
| 23333 | { |
| 23334 | _ExtendedGDBusSignalInfo *info; |
| 23335 | GVariantIter iter; |
| 23336 | GVariant *child; |
| 23337 | GValue *paramv; |
| 23338 | guint num_params; |
| 23339 | guint n; |
| 23340 | guint signal_id; |
| 23341 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name); |
| 23342 | if (info == NULL) |
| 23343 | return; |
| 23344 | num_params = g_variant_n_children (parameters); |
| 23345 | paramv = g_new0 (GValue, num_params + 1); |
| 23346 | g_value_init (¶mv[0], TYPE_BUTTON); |
| 23347 | g_value_set_object (¶mv[0], proxy); |
| 23348 | g_variant_iter_init (&iter, parameters); |
| 23349 | n = 1; |
| 23350 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 23351 | { |
| 23352 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 23353 | if (arg_info->use_gvariant) |
| 23354 | { |
| 23355 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 23356 | g_value_set_variant (¶mv[n], child); |
| 23357 | n++; |
| 23358 | } |
| 23359 | else |
| 23360 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 23361 | g_variant_unref (child); |
| 23362 | } |
| 23363 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 23364 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 23365 | for (n = 0; n < num_params + 1; n++) |
| 23366 | g_value_unset (¶mv[n]); |
| 23367 | g_free (paramv); |
| 23368 | } |
| 23369 | |
| 23370 | static void |
| 23371 | button_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 23372 | GVariant *changed_properties, |
| 23373 | const gchar *const *invalidated_properties) |
| 23374 | { |
| 23375 | ButtonProxy *proxy = BUTTON_PROXY (_proxy); |
| 23376 | guint n; |
| 23377 | const gchar *key; |
| 23378 | GVariantIter *iter; |
| 23379 | _ExtendedGDBusPropertyInfo *info; |
| 23380 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 23381 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 23382 | { |
| 23383 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key); |
| 23384 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 23385 | if (info != NULL) |
| 23386 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23387 | } |
| 23388 | g_variant_iter_free (iter); |
| 23389 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 23390 | { |
| 23391 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]); |
| 23392 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 23393 | if (info != NULL) |
| 23394 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23395 | } |
| 23396 | } |
| 23397 | |
| 23398 | static gboolean |
| 23399 | button_proxy_get_state (Button *object) |
| 23400 | { |
| 23401 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 23402 | GVariant *variant; |
| 23403 | gboolean value = 0; |
| 23404 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 23405 | if (variant != NULL) |
| 23406 | { |
| 23407 | value = g_variant_get_boolean (variant); |
| 23408 | g_variant_unref (variant); |
| 23409 | } |
| 23410 | return value; |
| 23411 | } |
| 23412 | |
| 23413 | static void |
| 23414 | button_proxy_init (ButtonProxy *proxy) |
| 23415 | { |
| 23416 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23417 | proxy->priv = button_proxy_get_instance_private (proxy); |
| 23418 | #else |
| 23419 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate); |
| 23420 | #endif |
| 23421 | |
| 23422 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ()); |
| 23423 | } |
| 23424 | |
| 23425 | static void |
| 23426 | button_proxy_class_init (ButtonProxyClass *klass) |
| 23427 | { |
| 23428 | GObjectClass *gobject_class; |
| 23429 | GDBusProxyClass *proxy_class; |
| 23430 | |
| 23431 | gobject_class = G_OBJECT_CLASS (klass); |
| 23432 | gobject_class->finalize = button_proxy_finalize; |
| 23433 | gobject_class->get_property = button_proxy_get_property; |
| 23434 | gobject_class->set_property = button_proxy_set_property; |
| 23435 | |
| 23436 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 23437 | proxy_class->g_signal = button_proxy_g_signal; |
| 23438 | proxy_class->g_properties_changed = button_proxy_g_properties_changed; |
| 23439 | |
| 23440 | button_override_properties (gobject_class, 1); |
| 23441 | |
| 23442 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 23443 | g_type_class_add_private (klass, sizeof (ButtonProxyPrivate)); |
| 23444 | #endif |
| 23445 | } |
| 23446 | |
| 23447 | static void |
| 23448 | button_proxy_iface_init (ButtonIface *iface) |
| 23449 | { |
| 23450 | iface->get_state = button_proxy_get_state; |
| 23451 | } |
| 23452 | |
| 23453 | /** |
| 23454 | * button_proxy_new: |
| 23455 | * @connection: A #GDBusConnection. |
| 23456 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23457 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23458 | * @object_path: An object path. |
| 23459 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23460 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23461 | * @user_data: User data to pass to @callback. |
| 23462 | * |
| 23463 | * 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. |
| 23464 | * |
| 23465 | * 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. |
| 23466 | * You can then call button_proxy_new_finish() to get the result of the operation. |
| 23467 | * |
| 23468 | * See button_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 23469 | */ |
| 23470 | void |
| 23471 | button_proxy_new ( |
| 23472 | GDBusConnection *connection, |
| 23473 | GDBusProxyFlags flags, |
| 23474 | const gchar *name, |
| 23475 | const gchar *object_path, |
| 23476 | GCancellable *cancellable, |
| 23477 | GAsyncReadyCallback callback, |
| 23478 | gpointer user_data) |
| 23479 | { |
| 23480 | 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); |
| 23481 | } |
| 23482 | |
| 23483 | /** |
| 23484 | * button_proxy_new_finish: |
| 23485 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new(). |
| 23486 | * @error: Return location for error or %NULL |
| 23487 | * |
| 23488 | * Finishes an operation started with button_proxy_new(). |
| 23489 | * |
| 23490 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 23491 | */ |
| 23492 | Button * |
| 23493 | button_proxy_new_finish ( |
| 23494 | GAsyncResult *res, |
| 23495 | GError **error) |
| 23496 | { |
| 23497 | GObject *ret; |
| 23498 | GObject *source_object; |
| 23499 | source_object = g_async_result_get_source_object (res); |
| 23500 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23501 | g_object_unref (source_object); |
| 23502 | if (ret != NULL) |
| 23503 | return BUTTON (ret); |
| 23504 | else |
| 23505 | return NULL; |
| 23506 | } |
| 23507 | |
| 23508 | /** |
| 23509 | * button_proxy_new_sync: |
| 23510 | * @connection: A #GDBusConnection. |
| 23511 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23512 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23513 | * @object_path: An object path. |
| 23514 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23515 | * @error: Return location for error or %NULL |
| 23516 | * |
| 23517 | * 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. |
| 23518 | * |
| 23519 | * The calling thread is blocked until a reply is received. |
| 23520 | * |
| 23521 | * See button_proxy_new() for the asynchronous version of this constructor. |
| 23522 | * |
| 23523 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 23524 | */ |
| 23525 | Button * |
| 23526 | button_proxy_new_sync ( |
| 23527 | GDBusConnection *connection, |
| 23528 | GDBusProxyFlags flags, |
| 23529 | const gchar *name, |
| 23530 | const gchar *object_path, |
| 23531 | GCancellable *cancellable, |
| 23532 | GError **error) |
| 23533 | { |
| 23534 | GInitable *ret; |
| 23535 | 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); |
| 23536 | if (ret != NULL) |
| 23537 | return BUTTON (ret); |
| 23538 | else |
| 23539 | return NULL; |
| 23540 | } |
| 23541 | |
| 23542 | |
| 23543 | /** |
| 23544 | * button_proxy_new_for_bus: |
| 23545 | * @bus_type: A #GBusType. |
| 23546 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23547 | * @name: A bus name (well-known or unique). |
| 23548 | * @object_path: An object path. |
| 23549 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23550 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23551 | * @user_data: User data to pass to @callback. |
| 23552 | * |
| 23553 | * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 23554 | * |
| 23555 | * 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. |
| 23556 | * You can then call button_proxy_new_for_bus_finish() to get the result of the operation. |
| 23557 | * |
| 23558 | * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 23559 | */ |
| 23560 | void |
| 23561 | button_proxy_new_for_bus ( |
| 23562 | GBusType bus_type, |
| 23563 | GDBusProxyFlags flags, |
| 23564 | const gchar *name, |
| 23565 | const gchar *object_path, |
| 23566 | GCancellable *cancellable, |
| 23567 | GAsyncReadyCallback callback, |
| 23568 | gpointer user_data) |
| 23569 | { |
| 23570 | 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); |
| 23571 | } |
| 23572 | |
| 23573 | /** |
| 23574 | * button_proxy_new_for_bus_finish: |
| 23575 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus(). |
| 23576 | * @error: Return location for error or %NULL |
| 23577 | * |
| 23578 | * Finishes an operation started with button_proxy_new_for_bus(). |
| 23579 | * |
| 23580 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 23581 | */ |
| 23582 | Button * |
| 23583 | button_proxy_new_for_bus_finish ( |
| 23584 | GAsyncResult *res, |
| 23585 | GError **error) |
| 23586 | { |
| 23587 | GObject *ret; |
| 23588 | GObject *source_object; |
| 23589 | source_object = g_async_result_get_source_object (res); |
| 23590 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23591 | g_object_unref (source_object); |
| 23592 | if (ret != NULL) |
| 23593 | return BUTTON (ret); |
| 23594 | else |
| 23595 | return NULL; |
| 23596 | } |
| 23597 | |
| 23598 | /** |
| 23599 | * button_proxy_new_for_bus_sync: |
| 23600 | * @bus_type: A #GBusType. |
| 23601 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23602 | * @name: A bus name (well-known or unique). |
| 23603 | * @object_path: An object path. |
| 23604 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23605 | * @error: Return location for error or %NULL |
| 23606 | * |
| 23607 | * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 23608 | * |
| 23609 | * The calling thread is blocked until a reply is received. |
| 23610 | * |
| 23611 | * See button_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 23612 | * |
| 23613 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 23614 | */ |
| 23615 | Button * |
| 23616 | button_proxy_new_for_bus_sync ( |
| 23617 | GBusType bus_type, |
| 23618 | GDBusProxyFlags flags, |
| 23619 | const gchar *name, |
| 23620 | const gchar *object_path, |
| 23621 | GCancellable *cancellable, |
| 23622 | GError **error) |
| 23623 | { |
| 23624 | GInitable *ret; |
| 23625 | 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); |
| 23626 | if (ret != NULL) |
| 23627 | return BUTTON (ret); |
| 23628 | else |
| 23629 | return NULL; |
| 23630 | } |
| 23631 | |
| 23632 | |
| 23633 | /* ------------------------------------------------------------------------ */ |
| 23634 | |
| 23635 | /** |
| 23636 | * ButtonSkeleton: |
| 23637 | * |
| 23638 | * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API. |
| 23639 | */ |
| 23640 | |
| 23641 | /** |
| 23642 | * ButtonSkeletonClass: |
| 23643 | * @parent_class: The parent class. |
| 23644 | * |
| 23645 | * Class structure for #ButtonSkeleton. |
| 23646 | */ |
| 23647 | |
| 23648 | struct _ButtonSkeletonPrivate |
| 23649 | { |
| 23650 | GValue *properties; |
| 23651 | GList *changed_properties; |
| 23652 | GSource *changed_properties_idle_source; |
| 23653 | GMainContext *context; |
| 23654 | GMutex lock; |
| 23655 | }; |
| 23656 | |
| 23657 | static void |
| 23658 | _button_skeleton_handle_method_call ( |
| 23659 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23660 | const gchar *sender G_GNUC_UNUSED, |
| 23661 | const gchar *object_path G_GNUC_UNUSED, |
| 23662 | const gchar *interface_name, |
| 23663 | const gchar *method_name, |
| 23664 | GVariant *parameters, |
| 23665 | GDBusMethodInvocation *invocation, |
| 23666 | gpointer user_data) |
| 23667 | { |
| 23668 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 23669 | _ExtendedGDBusMethodInfo *info; |
| 23670 | GVariantIter iter; |
| 23671 | GVariant *child; |
| 23672 | GValue *paramv; |
| 23673 | guint num_params; |
| 23674 | guint num_extra; |
| 23675 | guint n; |
| 23676 | guint signal_id; |
| 23677 | GValue return_value = G_VALUE_INIT; |
| 23678 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 23679 | g_assert (info != NULL); |
| 23680 | num_params = g_variant_n_children (parameters); |
| 23681 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 23682 | n = 0; |
| 23683 | g_value_init (¶mv[n], TYPE_BUTTON); |
| 23684 | g_value_set_object (¶mv[n++], skeleton); |
| 23685 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 23686 | g_value_set_object (¶mv[n++], invocation); |
| 23687 | if (info->pass_fdlist) |
| 23688 | { |
| 23689 | #ifdef G_OS_UNIX |
| 23690 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 23691 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 23692 | #else |
| 23693 | g_assert_not_reached (); |
| 23694 | #endif |
| 23695 | } |
| 23696 | g_variant_iter_init (&iter, parameters); |
| 23697 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 23698 | { |
| 23699 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 23700 | if (arg_info->use_gvariant) |
| 23701 | { |
| 23702 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 23703 | g_value_set_variant (¶mv[n], child); |
| 23704 | n++; |
| 23705 | } |
| 23706 | else |
| 23707 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 23708 | g_variant_unref (child); |
| 23709 | } |
| 23710 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 23711 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 23712 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 23713 | if (!g_value_get_boolean (&return_value)) |
| 23714 | 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); |
| 23715 | g_value_unset (&return_value); |
| 23716 | for (n = 0; n < num_params + num_extra; n++) |
| 23717 | g_value_unset (¶mv[n]); |
| 23718 | g_free (paramv); |
| 23719 | } |
| 23720 | |
| 23721 | static GVariant * |
| 23722 | _button_skeleton_handle_get_property ( |
| 23723 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23724 | const gchar *sender G_GNUC_UNUSED, |
| 23725 | const gchar *object_path G_GNUC_UNUSED, |
| 23726 | const gchar *interface_name G_GNUC_UNUSED, |
| 23727 | const gchar *property_name, |
| 23728 | GError **error, |
| 23729 | gpointer user_data) |
| 23730 | { |
| 23731 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 23732 | GValue value = G_VALUE_INIT; |
| 23733 | GParamSpec *pspec; |
| 23734 | _ExtendedGDBusPropertyInfo *info; |
| 23735 | GVariant *ret; |
| 23736 | ret = NULL; |
| 23737 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 23738 | g_assert (info != NULL); |
| 23739 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23740 | if (pspec == NULL) |
| 23741 | { |
| 23742 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23743 | } |
| 23744 | else |
| 23745 | { |
| 23746 | g_value_init (&value, pspec->value_type); |
| 23747 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23748 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 23749 | g_value_unset (&value); |
| 23750 | } |
| 23751 | return ret; |
| 23752 | } |
| 23753 | |
| 23754 | static gboolean |
| 23755 | _button_skeleton_handle_set_property ( |
| 23756 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23757 | const gchar *sender G_GNUC_UNUSED, |
| 23758 | const gchar *object_path G_GNUC_UNUSED, |
| 23759 | const gchar *interface_name G_GNUC_UNUSED, |
| 23760 | const gchar *property_name, |
| 23761 | GVariant *variant, |
| 23762 | GError **error, |
| 23763 | gpointer user_data) |
| 23764 | { |
| 23765 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 23766 | GValue value = G_VALUE_INIT; |
| 23767 | GParamSpec *pspec; |
| 23768 | _ExtendedGDBusPropertyInfo *info; |
| 23769 | gboolean ret; |
| 23770 | ret = FALSE; |
| 23771 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 23772 | g_assert (info != NULL); |
| 23773 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23774 | if (pspec == NULL) |
| 23775 | { |
| 23776 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23777 | } |
| 23778 | else |
| 23779 | { |
| 23780 | if (info->use_gvariant) |
| 23781 | g_value_set_variant (&value, variant); |
| 23782 | else |
| 23783 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 23784 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23785 | g_value_unset (&value); |
| 23786 | ret = TRUE; |
| 23787 | } |
| 23788 | return ret; |
| 23789 | } |
| 23790 | |
| 23791 | static const GDBusInterfaceVTable _button_skeleton_vtable = |
| 23792 | { |
| 23793 | _button_skeleton_handle_method_call, |
| 23794 | _button_skeleton_handle_get_property, |
| 23795 | _button_skeleton_handle_set_property, |
| 23796 | {NULL} |
| 23797 | }; |
| 23798 | |
| 23799 | static GDBusInterfaceInfo * |
| 23800 | button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23801 | { |
| 23802 | return button_interface_info (); |
| 23803 | } |
| 23804 | |
| 23805 | static GDBusInterfaceVTable * |
| 23806 | button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23807 | { |
| 23808 | return (GDBusInterfaceVTable *) &_button_skeleton_vtable; |
| 23809 | } |
| 23810 | |
| 23811 | static GVariant * |
| 23812 | button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 23813 | { |
| 23814 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 23815 | |
| 23816 | GVariantBuilder builder; |
| 23817 | guint n; |
| 23818 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23819 | if (_button_interface_info.parent_struct.properties == NULL) |
| 23820 | goto out; |
| 23821 | for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++) |
| 23822 | { |
| 23823 | GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n]; |
| 23824 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 23825 | { |
| 23826 | GVariant *value; |
| 23827 | 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); |
| 23828 | if (value != NULL) |
| 23829 | { |
| 23830 | g_variant_take_ref (value); |
| 23831 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 23832 | g_variant_unref (value); |
| 23833 | } |
| 23834 | } |
| 23835 | } |
| 23836 | out: |
| 23837 | return g_variant_builder_end (&builder); |
| 23838 | } |
| 23839 | |
| 23840 | static gboolean _button_emit_changed (gpointer user_data); |
| 23841 | |
| 23842 | static void |
| 23843 | button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 23844 | { |
| 23845 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 23846 | gboolean emit_changed = FALSE; |
| 23847 | |
| 23848 | g_mutex_lock (&skeleton->priv->lock); |
| 23849 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23850 | { |
| 23851 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23852 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23853 | emit_changed = TRUE; |
| 23854 | } |
| 23855 | g_mutex_unlock (&skeleton->priv->lock); |
| 23856 | |
| 23857 | if (emit_changed) |
| 23858 | _button_emit_changed (skeleton); |
| 23859 | } |
| 23860 | |
| 23861 | static void |
| 23862 | _button_on_signal_button_release ( |
| 23863 | Button *object) |
| 23864 | { |
| 23865 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 23866 | |
| 23867 | GList *connections, *l; |
| 23868 | GVariant *signal_variant; |
| 23869 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23870 | |
| 23871 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 23872 | for (l = connections; l != NULL; l = l->next) |
| 23873 | { |
| 23874 | GDBusConnection *connection = l->data; |
| 23875 | g_dbus_connection_emit_signal (connection, |
| 23876 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease", |
| 23877 | signal_variant, NULL); |
| 23878 | } |
| 23879 | g_variant_unref (signal_variant); |
| 23880 | g_list_free_full (connections, g_object_unref); |
| 23881 | } |
| 23882 | |
| 23883 | static void |
| 23884 | _button_on_signal_button_pressed ( |
| 23885 | Button *object) |
| 23886 | { |
| 23887 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 23888 | |
| 23889 | GList *connections, *l; |
| 23890 | GVariant *signal_variant; |
| 23891 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23892 | |
| 23893 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 23894 | for (l = connections; l != NULL; l = l->next) |
| 23895 | { |
| 23896 | GDBusConnection *connection = l->data; |
| 23897 | g_dbus_connection_emit_signal (connection, |
| 23898 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed", |
| 23899 | signal_variant, NULL); |
| 23900 | } |
| 23901 | g_variant_unref (signal_variant); |
| 23902 | g_list_free_full (connections, g_object_unref); |
| 23903 | } |
| 23904 | |
| 23905 | static void |
| 23906 | _button_on_signal_button_pressed_long ( |
| 23907 | Button *object) |
| 23908 | { |
| 23909 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 23910 | |
| 23911 | GList *connections, *l; |
| 23912 | GVariant *signal_variant; |
| 23913 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23914 | |
| 23915 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 23916 | for (l = connections; l != NULL; l = l->next) |
| 23917 | { |
| 23918 | GDBusConnection *connection = l->data; |
| 23919 | g_dbus_connection_emit_signal (connection, |
| 23920 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong", |
| 23921 | signal_variant, NULL); |
| 23922 | } |
| 23923 | g_variant_unref (signal_variant); |
| 23924 | g_list_free_full (connections, g_object_unref); |
| 23925 | } |
| 23926 | |
| 23927 | static void button_skeleton_iface_init (ButtonIface *iface); |
| 23928 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23929 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23930 | G_ADD_PRIVATE (ButtonSkeleton) |
| 23931 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 23932 | |
| 23933 | #else |
| 23934 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23935 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 23936 | |
| 23937 | #endif |
| 23938 | static void |
| 23939 | button_skeleton_finalize (GObject *object) |
| 23940 | { |
| 23941 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 23942 | guint n; |
| 23943 | for (n = 0; n < 1; n++) |
| 23944 | g_value_unset (&skeleton->priv->properties[n]); |
| 23945 | g_free (skeleton->priv->properties); |
| 23946 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 23947 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23948 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23949 | g_main_context_unref (skeleton->priv->context); |
| 23950 | g_mutex_clear (&skeleton->priv->lock); |
| 23951 | G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object); |
| 23952 | } |
| 23953 | |
| 23954 | static void |
| 23955 | button_skeleton_get_property (GObject *object, |
| 23956 | guint prop_id, |
| 23957 | GValue *value, |
| 23958 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23959 | { |
| 23960 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 23961 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 23962 | g_mutex_lock (&skeleton->priv->lock); |
| 23963 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 23964 | g_mutex_unlock (&skeleton->priv->lock); |
| 23965 | } |
| 23966 | |
| 23967 | static gboolean |
| 23968 | _button_emit_changed (gpointer user_data) |
| 23969 | { |
| 23970 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 23971 | GList *l; |
| 23972 | GVariantBuilder builder; |
| 23973 | GVariantBuilder invalidated_builder; |
| 23974 | guint num_changes; |
| 23975 | |
| 23976 | g_mutex_lock (&skeleton->priv->lock); |
| 23977 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23978 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 23979 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 23980 | { |
| 23981 | ChangedProperty *cp = l->data; |
| 23982 | GVariant *variant; |
| 23983 | const GValue *cur_value; |
| 23984 | |
| 23985 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 23986 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 23987 | { |
| 23988 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 23989 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 23990 | g_variant_unref (variant); |
| 23991 | num_changes++; |
| 23992 | } |
| 23993 | } |
| 23994 | if (num_changes > 0) |
| 23995 | { |
| 23996 | GList *connections, *ll; |
| 23997 | GVariant *signal_variant; |
| 23998 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button", |
| 23999 | &builder, &invalidated_builder)); |
| 24000 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 24001 | for (ll = connections; ll != NULL; ll = ll->next) |
| 24002 | { |
| 24003 | GDBusConnection *connection = ll->data; |
| 24004 | |
| 24005 | g_dbus_connection_emit_signal (connection, |
| 24006 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 24007 | "org.freedesktop.DBus.Properties", |
| 24008 | "PropertiesChanged", |
| 24009 | signal_variant, |
| 24010 | NULL); |
| 24011 | } |
| 24012 | g_variant_unref (signal_variant); |
| 24013 | g_list_free_full (connections, g_object_unref); |
| 24014 | } |
| 24015 | else |
| 24016 | { |
| 24017 | g_variant_builder_clear (&builder); |
| 24018 | g_variant_builder_clear (&invalidated_builder); |
| 24019 | } |
| 24020 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 24021 | skeleton->priv->changed_properties = NULL; |
| 24022 | skeleton->priv->changed_properties_idle_source = NULL; |
| 24023 | g_mutex_unlock (&skeleton->priv->lock); |
| 24024 | return FALSE; |
| 24025 | } |
| 24026 | |
| 24027 | static void |
| 24028 | _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 24029 | { |
| 24030 | ChangedProperty *cp; |
| 24031 | GList *l; |
| 24032 | cp = NULL; |
| 24033 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 24034 | { |
| 24035 | ChangedProperty *i_cp = l->data; |
| 24036 | if (i_cp->info == info) |
| 24037 | { |
| 24038 | cp = i_cp; |
| 24039 | break; |
| 24040 | } |
| 24041 | } |
| 24042 | if (cp == NULL) |
| 24043 | { |
| 24044 | cp = g_new0 (ChangedProperty, 1); |
| 24045 | cp->prop_id = prop_id; |
| 24046 | cp->info = info; |
| 24047 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 24048 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 24049 | g_value_copy (orig_value, &cp->orig_value); |
| 24050 | } |
| 24051 | } |
| 24052 | |
| 24053 | static void |
| 24054 | button_skeleton_notify (GObject *object, |
| 24055 | GParamSpec *pspec G_GNUC_UNUSED) |
| 24056 | { |
| 24057 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 24058 | g_mutex_lock (&skeleton->priv->lock); |
| 24059 | if (skeleton->priv->changed_properties != NULL && |
| 24060 | skeleton->priv->changed_properties_idle_source == NULL) |
| 24061 | { |
| 24062 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 24063 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 24064 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 24065 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 24066 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 24067 | } |
| 24068 | g_mutex_unlock (&skeleton->priv->lock); |
| 24069 | } |
| 24070 | |
| 24071 | static void |
| 24072 | button_skeleton_set_property (GObject *object, |
| 24073 | guint prop_id, |
| 24074 | const GValue *value, |
| 24075 | GParamSpec *pspec) |
| 24076 | { |
| 24077 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 24078 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
| 24079 | g_mutex_lock (&skeleton->priv->lock); |
| 24080 | g_object_freeze_notify (object); |
| 24081 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 24082 | { |
| 24083 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 24084 | _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 24085 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 24086 | g_object_notify_by_pspec (object, pspec); |
| 24087 | } |
| 24088 | g_mutex_unlock (&skeleton->priv->lock); |
| 24089 | g_object_thaw_notify (object); |
| 24090 | } |
| 24091 | |
| 24092 | static void |
| 24093 | button_skeleton_init (ButtonSkeleton *skeleton) |
| 24094 | { |
| 24095 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 24096 | skeleton->priv = button_skeleton_get_instance_private (skeleton); |
| 24097 | #else |
| 24098 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate); |
| 24099 | #endif |
| 24100 | |
| 24101 | g_mutex_init (&skeleton->priv->lock); |
| 24102 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 24103 | skeleton->priv->properties = g_new0 (GValue, 1); |
| 24104 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
| 24105 | } |
| 24106 | |
| 24107 | static gboolean |
| 24108 | button_skeleton_get_state (Button *object) |
| 24109 | { |
| 24110 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 24111 | gboolean value; |
| 24112 | g_mutex_lock (&skeleton->priv->lock); |
| 24113 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 24114 | g_mutex_unlock (&skeleton->priv->lock); |
| 24115 | return value; |
| 24116 | } |
| 24117 | |
| 24118 | static void |
| 24119 | button_skeleton_class_init (ButtonSkeletonClass *klass) |
| 24120 | { |
| 24121 | GObjectClass *gobject_class; |
| 24122 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 24123 | |
| 24124 | gobject_class = G_OBJECT_CLASS (klass); |
| 24125 | gobject_class->finalize = button_skeleton_finalize; |
| 24126 | gobject_class->get_property = button_skeleton_get_property; |
| 24127 | gobject_class->set_property = button_skeleton_set_property; |
| 24128 | gobject_class->notify = button_skeleton_notify; |
| 24129 | |
| 24130 | |
| 24131 | button_override_properties (gobject_class, 1); |
| 24132 | |
| 24133 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 24134 | skeleton_class->get_info = button_skeleton_dbus_interface_get_info; |
| 24135 | skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties; |
| 24136 | skeleton_class->flush = button_skeleton_dbus_interface_flush; |
| 24137 | skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable; |
| 24138 | |
| 24139 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 24140 | g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate)); |
| 24141 | #endif |
| 24142 | } |
| 24143 | |
| 24144 | static void |
| 24145 | button_skeleton_iface_init (ButtonIface *iface) |
| 24146 | { |
| 24147 | iface->button_release = _button_on_signal_button_release; |
| 24148 | iface->button_pressed = _button_on_signal_button_pressed; |
| 24149 | iface->button_pressed_long = _button_on_signal_button_pressed_long; |
| 24150 | iface->get_state = button_skeleton_get_state; |
| 24151 | } |
| 24152 | |
| 24153 | /** |
| 24154 | * button_skeleton_new: |
| 24155 | * |
| 24156 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 24157 | * |
| 24158 | * Returns: (transfer full) (type ButtonSkeleton): The skeleton object. |
| 24159 | */ |
| 24160 | Button * |
| 24161 | button_skeleton_new (void) |
| 24162 | { |
| 24163 | return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL)); |
| 24164 | } |
| 24165 | |
| 24166 | /* ------------------------------------------------------------------------ |
| 24167 | * Code for interface org.openbmc.Led |
| 24168 | * ------------------------------------------------------------------------ |
| 24169 | */ |
| 24170 | |
| 24171 | /** |
| 24172 | * SECTION:Led |
| 24173 | * @title: Led |
| 24174 | * @short_description: Generated C code for the org.openbmc.Led D-Bus interface |
| 24175 | * |
| 24176 | * 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. |
| 24177 | */ |
| 24178 | |
| 24179 | /* ---- Introspection data for org.openbmc.Led ---- */ |
| 24180 | |
| 24181 | static const _ExtendedGDBusMethodInfo _led_method_info_set_on = |
| 24182 | { |
| 24183 | { |
| 24184 | -1, |
| 24185 | (gchar *) "setOn", |
| 24186 | NULL, |
| 24187 | NULL, |
| 24188 | NULL |
| 24189 | }, |
| 24190 | "handle-set-on", |
| 24191 | FALSE |
| 24192 | }; |
| 24193 | |
| 24194 | static const _ExtendedGDBusMethodInfo _led_method_info_set_off = |
| 24195 | { |
| 24196 | { |
| 24197 | -1, |
| 24198 | (gchar *) "setOff", |
| 24199 | NULL, |
| 24200 | NULL, |
| 24201 | NULL |
| 24202 | }, |
| 24203 | "handle-set-off", |
| 24204 | FALSE |
| 24205 | }; |
| 24206 | |
| 24207 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow = |
| 24208 | { |
| 24209 | { |
| 24210 | -1, |
| 24211 | (gchar *) "setBlinkSlow", |
| 24212 | NULL, |
| 24213 | NULL, |
| 24214 | NULL |
| 24215 | }, |
| 24216 | "handle-set-blink-slow", |
| 24217 | FALSE |
| 24218 | }; |
| 24219 | |
| 24220 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast = |
| 24221 | { |
| 24222 | { |
| 24223 | -1, |
| 24224 | (gchar *) "setBlinkFast", |
| 24225 | NULL, |
| 24226 | NULL, |
| 24227 | NULL |
| 24228 | }, |
| 24229 | "handle-set-blink-fast", |
| 24230 | FALSE |
| 24231 | }; |
| 24232 | |
| 24233 | static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] = |
| 24234 | { |
| 24235 | &_led_method_info_set_on, |
| 24236 | &_led_method_info_set_off, |
| 24237 | &_led_method_info_set_blink_slow, |
| 24238 | &_led_method_info_set_blink_fast, |
| 24239 | NULL |
| 24240 | }; |
| 24241 | |
| 24242 | static const _ExtendedGDBusPropertyInfo _led_property_info_color = |
| 24243 | { |
| 24244 | { |
| 24245 | -1, |
| 24246 | (gchar *) "color", |
| 24247 | (gchar *) "i", |
| 24248 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24249 | NULL |
| 24250 | }, |
| 24251 | "color", |
| 24252 | FALSE |
| 24253 | }; |
| 24254 | |
| 24255 | static const _ExtendedGDBusPropertyInfo _led_property_info_function = |
| 24256 | { |
| 24257 | { |
| 24258 | -1, |
| 24259 | (gchar *) "function", |
| 24260 | (gchar *) "s", |
| 24261 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24262 | NULL |
| 24263 | }, |
| 24264 | "function", |
| 24265 | FALSE |
| 24266 | }; |
| 24267 | |
| 24268 | static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] = |
| 24269 | { |
| 24270 | &_led_property_info_color, |
| 24271 | &_led_property_info_function, |
| 24272 | NULL |
| 24273 | }; |
| 24274 | |
| 24275 | static const _ExtendedGDBusInterfaceInfo _led_interface_info = |
| 24276 | { |
| 24277 | { |
| 24278 | -1, |
| 24279 | (gchar *) "org.openbmc.Led", |
| 24280 | (GDBusMethodInfo **) &_led_method_info_pointers, |
| 24281 | NULL, |
| 24282 | (GDBusPropertyInfo **) &_led_property_info_pointers, |
| 24283 | NULL |
| 24284 | }, |
| 24285 | "led", |
| 24286 | }; |
| 24287 | |
| 24288 | |
| 24289 | /** |
| 24290 | * led_interface_info: |
| 24291 | * |
| 24292 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface. |
| 24293 | * |
| 24294 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 24295 | */ |
| 24296 | GDBusInterfaceInfo * |
| 24297 | led_interface_info (void) |
| 24298 | { |
| 24299 | return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct; |
| 24300 | } |
| 24301 | |
| 24302 | /** |
| 24303 | * led_override_properties: |
| 24304 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 24305 | * @property_id_begin: The property id to assign to the first overridden property. |
| 24306 | * |
| 24307 | * Overrides all #GObject properties in the #Led interface for a concrete class. |
| 24308 | * The properties are overridden in the order they are defined. |
| 24309 | * |
| 24310 | * Returns: The last property id. |
| 24311 | */ |
| 24312 | guint |
| 24313 | led_override_properties (GObjectClass *klass, guint property_id_begin) |
| 24314 | { |
| 24315 | g_object_class_override_property (klass, property_id_begin++, "color"); |
| 24316 | g_object_class_override_property (klass, property_id_begin++, "function"); |
| 24317 | return property_id_begin - 1; |
| 24318 | } |
| 24319 | |
| 24320 | |
| 24321 | |
| 24322 | /** |
| 24323 | * Led: |
| 24324 | * |
| 24325 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 24326 | */ |
| 24327 | |
| 24328 | /** |
| 24329 | * LedIface: |
| 24330 | * @parent_iface: The parent interface. |
| 24331 | * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal. |
| 24332 | * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal. |
| 24333 | * @handle_set_off: Handler for the #Led::handle-set-off signal. |
| 24334 | * @handle_set_on: Handler for the #Led::handle-set-on signal. |
| 24335 | * @get_color: Getter for the #Led:color property. |
| 24336 | * @get_function: Getter for the #Led:function property. |
| 24337 | * |
| 24338 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 24339 | */ |
| 24340 | |
| 24341 | typedef LedIface LedInterface; |
| 24342 | G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT); |
| 24343 | |
| 24344 | static void |
| 24345 | led_default_init (LedIface *iface) |
| 24346 | { |
| 24347 | /* GObject signals for incoming D-Bus method calls: */ |
| 24348 | /** |
| 24349 | * Led::handle-set-on: |
| 24350 | * @object: A #Led. |
| 24351 | * @invocation: A #GDBusMethodInvocation. |
| 24352 | * |
| 24353 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. |
| 24354 | * |
| 24355 | * 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. |
| 24356 | * |
| 24357 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24358 | */ |
| 24359 | g_signal_new ("handle-set-on", |
| 24360 | G_TYPE_FROM_INTERFACE (iface), |
| 24361 | G_SIGNAL_RUN_LAST, |
| 24362 | G_STRUCT_OFFSET (LedIface, handle_set_on), |
| 24363 | g_signal_accumulator_true_handled, |
| 24364 | NULL, |
| 24365 | g_cclosure_marshal_generic, |
| 24366 | G_TYPE_BOOLEAN, |
| 24367 | 1, |
| 24368 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24369 | |
| 24370 | /** |
| 24371 | * Led::handle-set-off: |
| 24372 | * @object: A #Led. |
| 24373 | * @invocation: A #GDBusMethodInvocation. |
| 24374 | * |
| 24375 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. |
| 24376 | * |
| 24377 | * 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. |
| 24378 | * |
| 24379 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24380 | */ |
| 24381 | g_signal_new ("handle-set-off", |
| 24382 | G_TYPE_FROM_INTERFACE (iface), |
| 24383 | G_SIGNAL_RUN_LAST, |
| 24384 | G_STRUCT_OFFSET (LedIface, handle_set_off), |
| 24385 | g_signal_accumulator_true_handled, |
| 24386 | NULL, |
| 24387 | g_cclosure_marshal_generic, |
| 24388 | G_TYPE_BOOLEAN, |
| 24389 | 1, |
| 24390 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24391 | |
| 24392 | /** |
| 24393 | * Led::handle-set-blink-slow: |
| 24394 | * @object: A #Led. |
| 24395 | * @invocation: A #GDBusMethodInvocation. |
| 24396 | * |
| 24397 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. |
| 24398 | * |
| 24399 | * 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. |
| 24400 | * |
| 24401 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24402 | */ |
| 24403 | g_signal_new ("handle-set-blink-slow", |
| 24404 | G_TYPE_FROM_INTERFACE (iface), |
| 24405 | G_SIGNAL_RUN_LAST, |
| 24406 | G_STRUCT_OFFSET (LedIface, handle_set_blink_slow), |
| 24407 | g_signal_accumulator_true_handled, |
| 24408 | NULL, |
| 24409 | g_cclosure_marshal_generic, |
| 24410 | G_TYPE_BOOLEAN, |
| 24411 | 1, |
| 24412 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24413 | |
| 24414 | /** |
| 24415 | * Led::handle-set-blink-fast: |
| 24416 | * @object: A #Led. |
| 24417 | * @invocation: A #GDBusMethodInvocation. |
| 24418 | * |
| 24419 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. |
| 24420 | * |
| 24421 | * 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. |
| 24422 | * |
| 24423 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24424 | */ |
| 24425 | g_signal_new ("handle-set-blink-fast", |
| 24426 | G_TYPE_FROM_INTERFACE (iface), |
| 24427 | G_SIGNAL_RUN_LAST, |
| 24428 | G_STRUCT_OFFSET (LedIface, handle_set_blink_fast), |
| 24429 | g_signal_accumulator_true_handled, |
| 24430 | NULL, |
| 24431 | g_cclosure_marshal_generic, |
| 24432 | G_TYPE_BOOLEAN, |
| 24433 | 1, |
| 24434 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24435 | |
| 24436 | /* GObject properties for D-Bus properties: */ |
| 24437 | /** |
| 24438 | * Led:color: |
| 24439 | * |
| 24440 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>. |
| 24441 | * |
| 24442 | * 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. |
| 24443 | */ |
| 24444 | g_object_interface_install_property (iface, |
| 24445 | g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 24446 | /** |
| 24447 | * Led:function: |
| 24448 | * |
| 24449 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>. |
| 24450 | * |
| 24451 | * 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. |
| 24452 | */ |
| 24453 | g_object_interface_install_property (iface, |
| 24454 | g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 24455 | } |
| 24456 | |
| 24457 | /** |
| 24458 | * led_get_color: (skip) |
| 24459 | * @object: A #Led. |
| 24460 | * |
| 24461 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property. |
| 24462 | * |
| 24463 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24464 | * |
| 24465 | * Returns: The property value. |
| 24466 | */ |
| 24467 | gint |
| 24468 | led_get_color (Led *object) |
| 24469 | { |
| 24470 | return LED_GET_IFACE (object)->get_color (object); |
| 24471 | } |
| 24472 | |
| 24473 | /** |
| 24474 | * led_set_color: (skip) |
| 24475 | * @object: A #Led. |
| 24476 | * @value: The value to set. |
| 24477 | * |
| 24478 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value. |
| 24479 | * |
| 24480 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 24481 | */ |
| 24482 | void |
| 24483 | led_set_color (Led *object, gint value) |
| 24484 | { |
| 24485 | g_object_set (G_OBJECT (object), "color", value, NULL); |
| 24486 | } |
| 24487 | |
| 24488 | /** |
| 24489 | * led_get_function: (skip) |
| 24490 | * @object: A #Led. |
| 24491 | * |
| 24492 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 24493 | * |
| 24494 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24495 | * |
| 24496 | * <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> |
| 24497 | * |
| 24498 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 24499 | */ |
| 24500 | const gchar * |
| 24501 | led_get_function (Led *object) |
| 24502 | { |
| 24503 | return LED_GET_IFACE (object)->get_function (object); |
| 24504 | } |
| 24505 | |
| 24506 | /** |
| 24507 | * led_dup_function: (skip) |
| 24508 | * @object: A #Led. |
| 24509 | * |
| 24510 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 24511 | * |
| 24512 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24513 | * |
| 24514 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 24515 | */ |
| 24516 | gchar * |
| 24517 | led_dup_function (Led *object) |
| 24518 | { |
| 24519 | gchar *value; |
| 24520 | g_object_get (G_OBJECT (object), "function", &value, NULL); |
| 24521 | return value; |
| 24522 | } |
| 24523 | |
| 24524 | /** |
| 24525 | * led_set_function: (skip) |
| 24526 | * @object: A #Led. |
| 24527 | * @value: The value to set. |
| 24528 | * |
| 24529 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value. |
| 24530 | * |
| 24531 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 24532 | */ |
| 24533 | void |
| 24534 | led_set_function (Led *object, const gchar *value) |
| 24535 | { |
| 24536 | g_object_set (G_OBJECT (object), "function", value, NULL); |
| 24537 | } |
| 24538 | |
| 24539 | /** |
| 24540 | * led_call_set_on: |
| 24541 | * @proxy: A #LedProxy. |
| 24542 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24543 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24544 | * @user_data: User data to pass to @callback. |
| 24545 | * |
| 24546 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. |
| 24547 | * 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. |
| 24548 | * You can then call led_call_set_on_finish() to get the result of the operation. |
| 24549 | * |
| 24550 | * See led_call_set_on_sync() for the synchronous, blocking version of this method. |
| 24551 | */ |
| 24552 | void |
| 24553 | led_call_set_on ( |
| 24554 | Led *proxy, |
| 24555 | GCancellable *cancellable, |
| 24556 | GAsyncReadyCallback callback, |
| 24557 | gpointer user_data) |
| 24558 | { |
| 24559 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24560 | "setOn", |
| 24561 | g_variant_new ("()"), |
| 24562 | G_DBUS_CALL_FLAGS_NONE, |
| 24563 | -1, |
| 24564 | cancellable, |
| 24565 | callback, |
| 24566 | user_data); |
| 24567 | } |
| 24568 | |
| 24569 | /** |
| 24570 | * led_call_set_on_finish: |
| 24571 | * @proxy: A #LedProxy. |
| 24572 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on(). |
| 24573 | * @error: Return location for error or %NULL. |
| 24574 | * |
| 24575 | * Finishes an operation started with led_call_set_on(). |
| 24576 | * |
| 24577 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24578 | */ |
| 24579 | gboolean |
| 24580 | led_call_set_on_finish ( |
| 24581 | Led *proxy, |
| 24582 | GAsyncResult *res, |
| 24583 | GError **error) |
| 24584 | { |
| 24585 | GVariant *_ret; |
| 24586 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24587 | if (_ret == NULL) |
| 24588 | goto _out; |
| 24589 | g_variant_get (_ret, |
| 24590 | "()"); |
| 24591 | g_variant_unref (_ret); |
| 24592 | _out: |
| 24593 | return _ret != NULL; |
| 24594 | } |
| 24595 | |
| 24596 | /** |
| 24597 | * led_call_set_on_sync: |
| 24598 | * @proxy: A #LedProxy. |
| 24599 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24600 | * @error: Return location for error or %NULL. |
| 24601 | * |
| 24602 | * 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. |
| 24603 | * |
| 24604 | * See led_call_set_on() for the asynchronous version of this method. |
| 24605 | * |
| 24606 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24607 | */ |
| 24608 | gboolean |
| 24609 | led_call_set_on_sync ( |
| 24610 | Led *proxy, |
| 24611 | GCancellable *cancellable, |
| 24612 | GError **error) |
| 24613 | { |
| 24614 | GVariant *_ret; |
| 24615 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24616 | "setOn", |
| 24617 | g_variant_new ("()"), |
| 24618 | G_DBUS_CALL_FLAGS_NONE, |
| 24619 | -1, |
| 24620 | cancellable, |
| 24621 | error); |
| 24622 | if (_ret == NULL) |
| 24623 | goto _out; |
| 24624 | g_variant_get (_ret, |
| 24625 | "()"); |
| 24626 | g_variant_unref (_ret); |
| 24627 | _out: |
| 24628 | return _ret != NULL; |
| 24629 | } |
| 24630 | |
| 24631 | /** |
| 24632 | * led_call_set_off: |
| 24633 | * @proxy: A #LedProxy. |
| 24634 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24635 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24636 | * @user_data: User data to pass to @callback. |
| 24637 | * |
| 24638 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. |
| 24639 | * 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. |
| 24640 | * You can then call led_call_set_off_finish() to get the result of the operation. |
| 24641 | * |
| 24642 | * See led_call_set_off_sync() for the synchronous, blocking version of this method. |
| 24643 | */ |
| 24644 | void |
| 24645 | led_call_set_off ( |
| 24646 | Led *proxy, |
| 24647 | GCancellable *cancellable, |
| 24648 | GAsyncReadyCallback callback, |
| 24649 | gpointer user_data) |
| 24650 | { |
| 24651 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24652 | "setOff", |
| 24653 | g_variant_new ("()"), |
| 24654 | G_DBUS_CALL_FLAGS_NONE, |
| 24655 | -1, |
| 24656 | cancellable, |
| 24657 | callback, |
| 24658 | user_data); |
| 24659 | } |
| 24660 | |
| 24661 | /** |
| 24662 | * led_call_set_off_finish: |
| 24663 | * @proxy: A #LedProxy. |
| 24664 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off(). |
| 24665 | * @error: Return location for error or %NULL. |
| 24666 | * |
| 24667 | * Finishes an operation started with led_call_set_off(). |
| 24668 | * |
| 24669 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24670 | */ |
| 24671 | gboolean |
| 24672 | led_call_set_off_finish ( |
| 24673 | Led *proxy, |
| 24674 | GAsyncResult *res, |
| 24675 | GError **error) |
| 24676 | { |
| 24677 | GVariant *_ret; |
| 24678 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24679 | if (_ret == NULL) |
| 24680 | goto _out; |
| 24681 | g_variant_get (_ret, |
| 24682 | "()"); |
| 24683 | g_variant_unref (_ret); |
| 24684 | _out: |
| 24685 | return _ret != NULL; |
| 24686 | } |
| 24687 | |
| 24688 | /** |
| 24689 | * led_call_set_off_sync: |
| 24690 | * @proxy: A #LedProxy. |
| 24691 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24692 | * @error: Return location for error or %NULL. |
| 24693 | * |
| 24694 | * 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. |
| 24695 | * |
| 24696 | * See led_call_set_off() for the asynchronous version of this method. |
| 24697 | * |
| 24698 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24699 | */ |
| 24700 | gboolean |
| 24701 | led_call_set_off_sync ( |
| 24702 | Led *proxy, |
| 24703 | GCancellable *cancellable, |
| 24704 | GError **error) |
| 24705 | { |
| 24706 | GVariant *_ret; |
| 24707 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24708 | "setOff", |
| 24709 | g_variant_new ("()"), |
| 24710 | G_DBUS_CALL_FLAGS_NONE, |
| 24711 | -1, |
| 24712 | cancellable, |
| 24713 | error); |
| 24714 | if (_ret == NULL) |
| 24715 | goto _out; |
| 24716 | g_variant_get (_ret, |
| 24717 | "()"); |
| 24718 | g_variant_unref (_ret); |
| 24719 | _out: |
| 24720 | return _ret != NULL; |
| 24721 | } |
| 24722 | |
| 24723 | /** |
| 24724 | * led_call_set_blink_slow: |
| 24725 | * @proxy: A #LedProxy. |
| 24726 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24727 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24728 | * @user_data: User data to pass to @callback. |
| 24729 | * |
| 24730 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. |
| 24731 | * 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. |
| 24732 | * You can then call led_call_set_blink_slow_finish() to get the result of the operation. |
| 24733 | * |
| 24734 | * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method. |
| 24735 | */ |
| 24736 | void |
| 24737 | led_call_set_blink_slow ( |
| 24738 | Led *proxy, |
| 24739 | GCancellable *cancellable, |
| 24740 | GAsyncReadyCallback callback, |
| 24741 | gpointer user_data) |
| 24742 | { |
| 24743 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24744 | "setBlinkSlow", |
| 24745 | g_variant_new ("()"), |
| 24746 | G_DBUS_CALL_FLAGS_NONE, |
| 24747 | -1, |
| 24748 | cancellable, |
| 24749 | callback, |
| 24750 | user_data); |
| 24751 | } |
| 24752 | |
| 24753 | /** |
| 24754 | * led_call_set_blink_slow_finish: |
| 24755 | * @proxy: A #LedProxy. |
| 24756 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow(). |
| 24757 | * @error: Return location for error or %NULL. |
| 24758 | * |
| 24759 | * Finishes an operation started with led_call_set_blink_slow(). |
| 24760 | * |
| 24761 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24762 | */ |
| 24763 | gboolean |
| 24764 | led_call_set_blink_slow_finish ( |
| 24765 | Led *proxy, |
| 24766 | GAsyncResult *res, |
| 24767 | GError **error) |
| 24768 | { |
| 24769 | GVariant *_ret; |
| 24770 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24771 | if (_ret == NULL) |
| 24772 | goto _out; |
| 24773 | g_variant_get (_ret, |
| 24774 | "()"); |
| 24775 | g_variant_unref (_ret); |
| 24776 | _out: |
| 24777 | return _ret != NULL; |
| 24778 | } |
| 24779 | |
| 24780 | /** |
| 24781 | * led_call_set_blink_slow_sync: |
| 24782 | * @proxy: A #LedProxy. |
| 24783 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24784 | * @error: Return location for error or %NULL. |
| 24785 | * |
| 24786 | * 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. |
| 24787 | * |
| 24788 | * See led_call_set_blink_slow() for the asynchronous version of this method. |
| 24789 | * |
| 24790 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24791 | */ |
| 24792 | gboolean |
| 24793 | led_call_set_blink_slow_sync ( |
| 24794 | Led *proxy, |
| 24795 | GCancellable *cancellable, |
| 24796 | GError **error) |
| 24797 | { |
| 24798 | GVariant *_ret; |
| 24799 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24800 | "setBlinkSlow", |
| 24801 | g_variant_new ("()"), |
| 24802 | G_DBUS_CALL_FLAGS_NONE, |
| 24803 | -1, |
| 24804 | cancellable, |
| 24805 | error); |
| 24806 | if (_ret == NULL) |
| 24807 | goto _out; |
| 24808 | g_variant_get (_ret, |
| 24809 | "()"); |
| 24810 | g_variant_unref (_ret); |
| 24811 | _out: |
| 24812 | return _ret != NULL; |
| 24813 | } |
| 24814 | |
| 24815 | /** |
| 24816 | * led_call_set_blink_fast: |
| 24817 | * @proxy: A #LedProxy. |
| 24818 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24819 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24820 | * @user_data: User data to pass to @callback. |
| 24821 | * |
| 24822 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. |
| 24823 | * 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. |
| 24824 | * You can then call led_call_set_blink_fast_finish() to get the result of the operation. |
| 24825 | * |
| 24826 | * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method. |
| 24827 | */ |
| 24828 | void |
| 24829 | led_call_set_blink_fast ( |
| 24830 | Led *proxy, |
| 24831 | GCancellable *cancellable, |
| 24832 | GAsyncReadyCallback callback, |
| 24833 | gpointer user_data) |
| 24834 | { |
| 24835 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24836 | "setBlinkFast", |
| 24837 | g_variant_new ("()"), |
| 24838 | G_DBUS_CALL_FLAGS_NONE, |
| 24839 | -1, |
| 24840 | cancellable, |
| 24841 | callback, |
| 24842 | user_data); |
| 24843 | } |
| 24844 | |
| 24845 | /** |
| 24846 | * led_call_set_blink_fast_finish: |
| 24847 | * @proxy: A #LedProxy. |
| 24848 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast(). |
| 24849 | * @error: Return location for error or %NULL. |
| 24850 | * |
| 24851 | * Finishes an operation started with led_call_set_blink_fast(). |
| 24852 | * |
| 24853 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24854 | */ |
| 24855 | gboolean |
| 24856 | led_call_set_blink_fast_finish ( |
| 24857 | Led *proxy, |
| 24858 | GAsyncResult *res, |
| 24859 | GError **error) |
| 24860 | { |
| 24861 | GVariant *_ret; |
| 24862 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24863 | if (_ret == NULL) |
| 24864 | goto _out; |
| 24865 | g_variant_get (_ret, |
| 24866 | "()"); |
| 24867 | g_variant_unref (_ret); |
| 24868 | _out: |
| 24869 | return _ret != NULL; |
| 24870 | } |
| 24871 | |
| 24872 | /** |
| 24873 | * led_call_set_blink_fast_sync: |
| 24874 | * @proxy: A #LedProxy. |
| 24875 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24876 | * @error: Return location for error or %NULL. |
| 24877 | * |
| 24878 | * 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. |
| 24879 | * |
| 24880 | * See led_call_set_blink_fast() for the asynchronous version of this method. |
| 24881 | * |
| 24882 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24883 | */ |
| 24884 | gboolean |
| 24885 | led_call_set_blink_fast_sync ( |
| 24886 | Led *proxy, |
| 24887 | GCancellable *cancellable, |
| 24888 | GError **error) |
| 24889 | { |
| 24890 | GVariant *_ret; |
| 24891 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24892 | "setBlinkFast", |
| 24893 | g_variant_new ("()"), |
| 24894 | G_DBUS_CALL_FLAGS_NONE, |
| 24895 | -1, |
| 24896 | cancellable, |
| 24897 | error); |
| 24898 | if (_ret == NULL) |
| 24899 | goto _out; |
| 24900 | g_variant_get (_ret, |
| 24901 | "()"); |
| 24902 | g_variant_unref (_ret); |
| 24903 | _out: |
| 24904 | return _ret != NULL; |
| 24905 | } |
| 24906 | |
| 24907 | /** |
| 24908 | * led_complete_set_on: |
| 24909 | * @object: A #Led. |
| 24910 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 24911 | * |
| 24912 | * 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. |
| 24913 | * |
| 24914 | * This method will free @invocation, you cannot use it afterwards. |
| 24915 | */ |
| 24916 | void |
| 24917 | led_complete_set_on ( |
| 24918 | Led *object, |
| 24919 | GDBusMethodInvocation *invocation) |
| 24920 | { |
| 24921 | g_dbus_method_invocation_return_value (invocation, |
| 24922 | g_variant_new ("()")); |
| 24923 | } |
| 24924 | |
| 24925 | /** |
| 24926 | * led_complete_set_off: |
| 24927 | * @object: A #Led. |
| 24928 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 24929 | * |
| 24930 | * 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. |
| 24931 | * |
| 24932 | * This method will free @invocation, you cannot use it afterwards. |
| 24933 | */ |
| 24934 | void |
| 24935 | led_complete_set_off ( |
| 24936 | Led *object, |
| 24937 | GDBusMethodInvocation *invocation) |
| 24938 | { |
| 24939 | g_dbus_method_invocation_return_value (invocation, |
| 24940 | g_variant_new ("()")); |
| 24941 | } |
| 24942 | |
| 24943 | /** |
| 24944 | * led_complete_set_blink_slow: |
| 24945 | * @object: A #Led. |
| 24946 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 24947 | * |
| 24948 | * 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. |
| 24949 | * |
| 24950 | * This method will free @invocation, you cannot use it afterwards. |
| 24951 | */ |
| 24952 | void |
| 24953 | led_complete_set_blink_slow ( |
| 24954 | Led *object, |
| 24955 | GDBusMethodInvocation *invocation) |
| 24956 | { |
| 24957 | g_dbus_method_invocation_return_value (invocation, |
| 24958 | g_variant_new ("()")); |
| 24959 | } |
| 24960 | |
| 24961 | /** |
| 24962 | * led_complete_set_blink_fast: |
| 24963 | * @object: A #Led. |
| 24964 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 24965 | * |
| 24966 | * 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. |
| 24967 | * |
| 24968 | * This method will free @invocation, you cannot use it afterwards. |
| 24969 | */ |
| 24970 | void |
| 24971 | led_complete_set_blink_fast ( |
| 24972 | Led *object, |
| 24973 | GDBusMethodInvocation *invocation) |
| 24974 | { |
| 24975 | g_dbus_method_invocation_return_value (invocation, |
| 24976 | g_variant_new ("()")); |
| 24977 | } |
| 24978 | |
| 24979 | /* ------------------------------------------------------------------------ */ |
| 24980 | |
| 24981 | /** |
| 24982 | * LedProxy: |
| 24983 | * |
| 24984 | * The #LedProxy structure contains only private data and should only be accessed using the provided API. |
| 24985 | */ |
| 24986 | |
| 24987 | /** |
| 24988 | * LedProxyClass: |
| 24989 | * @parent_class: The parent class. |
| 24990 | * |
| 24991 | * Class structure for #LedProxy. |
| 24992 | */ |
| 24993 | |
| 24994 | struct _LedProxyPrivate |
| 24995 | { |
| 24996 | GData *qdata; |
| 24997 | }; |
| 24998 | |
| 24999 | static void led_proxy_iface_init (LedIface *iface); |
| 25000 | |
| 25001 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25002 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 25003 | G_ADD_PRIVATE (LedProxy) |
| 25004 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 25005 | |
| 25006 | #else |
| 25007 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 25008 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 25009 | |
| 25010 | #endif |
| 25011 | static void |
| 25012 | led_proxy_finalize (GObject *object) |
| 25013 | { |
| 25014 | LedProxy *proxy = LED_PROXY (object); |
| 25015 | g_datalist_clear (&proxy->priv->qdata); |
| 25016 | G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object); |
| 25017 | } |
| 25018 | |
| 25019 | static void |
| 25020 | led_proxy_get_property (GObject *object, |
| 25021 | guint prop_id, |
| 25022 | GValue *value, |
| 25023 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25024 | { |
| 25025 | const _ExtendedGDBusPropertyInfo *info; |
| 25026 | GVariant *variant; |
| 25027 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25028 | info = _led_property_info_pointers[prop_id - 1]; |
| 25029 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 25030 | if (info->use_gvariant) |
| 25031 | { |
| 25032 | g_value_set_variant (value, variant); |
| 25033 | } |
| 25034 | else |
| 25035 | { |
| 25036 | if (variant != NULL) |
| 25037 | g_dbus_gvariant_to_gvalue (variant, value); |
| 25038 | } |
| 25039 | if (variant != NULL) |
| 25040 | g_variant_unref (variant); |
| 25041 | } |
| 25042 | |
| 25043 | static void |
| 25044 | led_proxy_set_property_cb (GDBusProxy *proxy, |
| 25045 | GAsyncResult *res, |
| 25046 | gpointer user_data) |
| 25047 | { |
| 25048 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 25049 | GError *error; |
| 25050 | GVariant *_ret; |
| 25051 | error = NULL; |
| 25052 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 25053 | if (!_ret) |
| 25054 | { |
| 25055 | g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)", |
| 25056 | info->parent_struct.name, |
| 25057 | error->message, g_quark_to_string (error->domain), error->code); |
| 25058 | g_error_free (error); |
| 25059 | } |
| 25060 | else |
| 25061 | { |
| 25062 | g_variant_unref (_ret); |
| 25063 | } |
| 25064 | } |
| 25065 | |
| 25066 | static void |
| 25067 | led_proxy_set_property (GObject *object, |
| 25068 | guint prop_id, |
| 25069 | const GValue *value, |
| 25070 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25071 | { |
| 25072 | const _ExtendedGDBusPropertyInfo *info; |
| 25073 | GVariant *variant; |
| 25074 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25075 | info = _led_property_info_pointers[prop_id - 1]; |
| 25076 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 25077 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 25078 | "org.freedesktop.DBus.Properties.Set", |
| 25079 | g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant), |
| 25080 | G_DBUS_CALL_FLAGS_NONE, |
| 25081 | -1, |
| 25082 | NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 25083 | g_variant_unref (variant); |
| 25084 | } |
| 25085 | |
| 25086 | static void |
| 25087 | led_proxy_g_signal (GDBusProxy *proxy, |
| 25088 | const gchar *sender_name G_GNUC_UNUSED, |
| 25089 | const gchar *signal_name, |
| 25090 | GVariant *parameters) |
| 25091 | { |
| 25092 | _ExtendedGDBusSignalInfo *info; |
| 25093 | GVariantIter iter; |
| 25094 | GVariant *child; |
| 25095 | GValue *paramv; |
| 25096 | guint num_params; |
| 25097 | guint n; |
| 25098 | guint signal_id; |
| 25099 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name); |
| 25100 | if (info == NULL) |
| 25101 | return; |
| 25102 | num_params = g_variant_n_children (parameters); |
| 25103 | paramv = g_new0 (GValue, num_params + 1); |
| 25104 | g_value_init (¶mv[0], TYPE_LED); |
| 25105 | g_value_set_object (¶mv[0], proxy); |
| 25106 | g_variant_iter_init (&iter, parameters); |
| 25107 | n = 1; |
| 25108 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 25109 | { |
| 25110 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 25111 | if (arg_info->use_gvariant) |
| 25112 | { |
| 25113 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 25114 | g_value_set_variant (¶mv[n], child); |
| 25115 | n++; |
| 25116 | } |
| 25117 | else |
| 25118 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 25119 | g_variant_unref (child); |
| 25120 | } |
| 25121 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 25122 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 25123 | for (n = 0; n < num_params + 1; n++) |
| 25124 | g_value_unset (¶mv[n]); |
| 25125 | g_free (paramv); |
| 25126 | } |
| 25127 | |
| 25128 | static void |
| 25129 | led_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 25130 | GVariant *changed_properties, |
| 25131 | const gchar *const *invalidated_properties) |
| 25132 | { |
| 25133 | LedProxy *proxy = LED_PROXY (_proxy); |
| 25134 | guint n; |
| 25135 | const gchar *key; |
| 25136 | GVariantIter *iter; |
| 25137 | _ExtendedGDBusPropertyInfo *info; |
| 25138 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 25139 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 25140 | { |
| 25141 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key); |
| 25142 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 25143 | if (info != NULL) |
| 25144 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 25145 | } |
| 25146 | g_variant_iter_free (iter); |
| 25147 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 25148 | { |
| 25149 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]); |
| 25150 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 25151 | if (info != NULL) |
| 25152 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 25153 | } |
| 25154 | } |
| 25155 | |
| 25156 | static gint |
| 25157 | led_proxy_get_color (Led *object) |
| 25158 | { |
| 25159 | LedProxy *proxy = LED_PROXY (object); |
| 25160 | GVariant *variant; |
| 25161 | gint value = 0; |
| 25162 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color"); |
| 25163 | if (variant != NULL) |
| 25164 | { |
| 25165 | value = g_variant_get_int32 (variant); |
| 25166 | g_variant_unref (variant); |
| 25167 | } |
| 25168 | return value; |
| 25169 | } |
| 25170 | |
| 25171 | static const gchar * |
| 25172 | led_proxy_get_function (Led *object) |
| 25173 | { |
| 25174 | LedProxy *proxy = LED_PROXY (object); |
| 25175 | GVariant *variant; |
| 25176 | const gchar *value = NULL; |
| 25177 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function"); |
| 25178 | if (variant != NULL) |
| 25179 | { |
| 25180 | value = g_variant_get_string (variant, NULL); |
| 25181 | g_variant_unref (variant); |
| 25182 | } |
| 25183 | return value; |
| 25184 | } |
| 25185 | |
| 25186 | static void |
| 25187 | led_proxy_init (LedProxy *proxy) |
| 25188 | { |
| 25189 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25190 | proxy->priv = led_proxy_get_instance_private (proxy); |
| 25191 | #else |
| 25192 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate); |
| 25193 | #endif |
| 25194 | |
| 25195 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ()); |
| 25196 | } |
| 25197 | |
| 25198 | static void |
| 25199 | led_proxy_class_init (LedProxyClass *klass) |
| 25200 | { |
| 25201 | GObjectClass *gobject_class; |
| 25202 | GDBusProxyClass *proxy_class; |
| 25203 | |
| 25204 | gobject_class = G_OBJECT_CLASS (klass); |
| 25205 | gobject_class->finalize = led_proxy_finalize; |
| 25206 | gobject_class->get_property = led_proxy_get_property; |
| 25207 | gobject_class->set_property = led_proxy_set_property; |
| 25208 | |
| 25209 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 25210 | proxy_class->g_signal = led_proxy_g_signal; |
| 25211 | proxy_class->g_properties_changed = led_proxy_g_properties_changed; |
| 25212 | |
| 25213 | led_override_properties (gobject_class, 1); |
| 25214 | |
| 25215 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 25216 | g_type_class_add_private (klass, sizeof (LedProxyPrivate)); |
| 25217 | #endif |
| 25218 | } |
| 25219 | |
| 25220 | static void |
| 25221 | led_proxy_iface_init (LedIface *iface) |
| 25222 | { |
| 25223 | iface->get_color = led_proxy_get_color; |
| 25224 | iface->get_function = led_proxy_get_function; |
| 25225 | } |
| 25226 | |
| 25227 | /** |
| 25228 | * led_proxy_new: |
| 25229 | * @connection: A #GDBusConnection. |
| 25230 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25231 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 25232 | * @object_path: An object path. |
| 25233 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25234 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 25235 | * @user_data: User data to pass to @callback. |
| 25236 | * |
| 25237 | * 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. |
| 25238 | * |
| 25239 | * 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. |
| 25240 | * You can then call led_proxy_new_finish() to get the result of the operation. |
| 25241 | * |
| 25242 | * See led_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 25243 | */ |
| 25244 | void |
| 25245 | led_proxy_new ( |
| 25246 | GDBusConnection *connection, |
| 25247 | GDBusProxyFlags flags, |
| 25248 | const gchar *name, |
| 25249 | const gchar *object_path, |
| 25250 | GCancellable *cancellable, |
| 25251 | GAsyncReadyCallback callback, |
| 25252 | gpointer user_data) |
| 25253 | { |
| 25254 | 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); |
| 25255 | } |
| 25256 | |
| 25257 | /** |
| 25258 | * led_proxy_new_finish: |
| 25259 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new(). |
| 25260 | * @error: Return location for error or %NULL |
| 25261 | * |
| 25262 | * Finishes an operation started with led_proxy_new(). |
| 25263 | * |
| 25264 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 25265 | */ |
| 25266 | Led * |
| 25267 | led_proxy_new_finish ( |
| 25268 | GAsyncResult *res, |
| 25269 | GError **error) |
| 25270 | { |
| 25271 | GObject *ret; |
| 25272 | GObject *source_object; |
| 25273 | source_object = g_async_result_get_source_object (res); |
| 25274 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25275 | g_object_unref (source_object); |
| 25276 | if (ret != NULL) |
| 25277 | return LED (ret); |
| 25278 | else |
| 25279 | return NULL; |
| 25280 | } |
| 25281 | |
| 25282 | /** |
| 25283 | * led_proxy_new_sync: |
| 25284 | * @connection: A #GDBusConnection. |
| 25285 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25286 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 25287 | * @object_path: An object path. |
| 25288 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25289 | * @error: Return location for error or %NULL |
| 25290 | * |
| 25291 | * 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. |
| 25292 | * |
| 25293 | * The calling thread is blocked until a reply is received. |
| 25294 | * |
| 25295 | * See led_proxy_new() for the asynchronous version of this constructor. |
| 25296 | * |
| 25297 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 25298 | */ |
| 25299 | Led * |
| 25300 | led_proxy_new_sync ( |
| 25301 | GDBusConnection *connection, |
| 25302 | GDBusProxyFlags flags, |
| 25303 | const gchar *name, |
| 25304 | const gchar *object_path, |
| 25305 | GCancellable *cancellable, |
| 25306 | GError **error) |
| 25307 | { |
| 25308 | GInitable *ret; |
| 25309 | 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); |
| 25310 | if (ret != NULL) |
| 25311 | return LED (ret); |
| 25312 | else |
| 25313 | return NULL; |
| 25314 | } |
| 25315 | |
| 25316 | |
| 25317 | /** |
| 25318 | * led_proxy_new_for_bus: |
| 25319 | * @bus_type: A #GBusType. |
| 25320 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25321 | * @name: A bus name (well-known or unique). |
| 25322 | * @object_path: An object path. |
| 25323 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25324 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 25325 | * @user_data: User data to pass to @callback. |
| 25326 | * |
| 25327 | * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 25328 | * |
| 25329 | * 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. |
| 25330 | * You can then call led_proxy_new_for_bus_finish() to get the result of the operation. |
| 25331 | * |
| 25332 | * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 25333 | */ |
| 25334 | void |
| 25335 | led_proxy_new_for_bus ( |
| 25336 | GBusType bus_type, |
| 25337 | GDBusProxyFlags flags, |
| 25338 | const gchar *name, |
| 25339 | const gchar *object_path, |
| 25340 | GCancellable *cancellable, |
| 25341 | GAsyncReadyCallback callback, |
| 25342 | gpointer user_data) |
| 25343 | { |
| 25344 | 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); |
| 25345 | } |
| 25346 | |
| 25347 | /** |
| 25348 | * led_proxy_new_for_bus_finish: |
| 25349 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus(). |
| 25350 | * @error: Return location for error or %NULL |
| 25351 | * |
| 25352 | * Finishes an operation started with led_proxy_new_for_bus(). |
| 25353 | * |
| 25354 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 25355 | */ |
| 25356 | Led * |
| 25357 | led_proxy_new_for_bus_finish ( |
| 25358 | GAsyncResult *res, |
| 25359 | GError **error) |
| 25360 | { |
| 25361 | GObject *ret; |
| 25362 | GObject *source_object; |
| 25363 | source_object = g_async_result_get_source_object (res); |
| 25364 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25365 | g_object_unref (source_object); |
| 25366 | if (ret != NULL) |
| 25367 | return LED (ret); |
| 25368 | else |
| 25369 | return NULL; |
| 25370 | } |
| 25371 | |
| 25372 | /** |
| 25373 | * led_proxy_new_for_bus_sync: |
| 25374 | * @bus_type: A #GBusType. |
| 25375 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25376 | * @name: A bus name (well-known or unique). |
| 25377 | * @object_path: An object path. |
| 25378 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25379 | * @error: Return location for error or %NULL |
| 25380 | * |
| 25381 | * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 25382 | * |
| 25383 | * The calling thread is blocked until a reply is received. |
| 25384 | * |
| 25385 | * See led_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 25386 | * |
| 25387 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 25388 | */ |
| 25389 | Led * |
| 25390 | led_proxy_new_for_bus_sync ( |
| 25391 | GBusType bus_type, |
| 25392 | GDBusProxyFlags flags, |
| 25393 | const gchar *name, |
| 25394 | const gchar *object_path, |
| 25395 | GCancellable *cancellable, |
| 25396 | GError **error) |
| 25397 | { |
| 25398 | GInitable *ret; |
| 25399 | 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); |
| 25400 | if (ret != NULL) |
| 25401 | return LED (ret); |
| 25402 | else |
| 25403 | return NULL; |
| 25404 | } |
| 25405 | |
| 25406 | |
| 25407 | /* ------------------------------------------------------------------------ */ |
| 25408 | |
| 25409 | /** |
| 25410 | * LedSkeleton: |
| 25411 | * |
| 25412 | * The #LedSkeleton structure contains only private data and should only be accessed using the provided API. |
| 25413 | */ |
| 25414 | |
| 25415 | /** |
| 25416 | * LedSkeletonClass: |
| 25417 | * @parent_class: The parent class. |
| 25418 | * |
| 25419 | * Class structure for #LedSkeleton. |
| 25420 | */ |
| 25421 | |
| 25422 | struct _LedSkeletonPrivate |
| 25423 | { |
| 25424 | GValue *properties; |
| 25425 | GList *changed_properties; |
| 25426 | GSource *changed_properties_idle_source; |
| 25427 | GMainContext *context; |
| 25428 | GMutex lock; |
| 25429 | }; |
| 25430 | |
| 25431 | static void |
| 25432 | _led_skeleton_handle_method_call ( |
| 25433 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25434 | const gchar *sender G_GNUC_UNUSED, |
| 25435 | const gchar *object_path G_GNUC_UNUSED, |
| 25436 | const gchar *interface_name, |
| 25437 | const gchar *method_name, |
| 25438 | GVariant *parameters, |
| 25439 | GDBusMethodInvocation *invocation, |
| 25440 | gpointer user_data) |
| 25441 | { |
| 25442 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 25443 | _ExtendedGDBusMethodInfo *info; |
| 25444 | GVariantIter iter; |
| 25445 | GVariant *child; |
| 25446 | GValue *paramv; |
| 25447 | guint num_params; |
| 25448 | guint num_extra; |
| 25449 | guint n; |
| 25450 | guint signal_id; |
| 25451 | GValue return_value = G_VALUE_INIT; |
| 25452 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 25453 | g_assert (info != NULL); |
| 25454 | num_params = g_variant_n_children (parameters); |
| 25455 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 25456 | n = 0; |
| 25457 | g_value_init (¶mv[n], TYPE_LED); |
| 25458 | g_value_set_object (¶mv[n++], skeleton); |
| 25459 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 25460 | g_value_set_object (¶mv[n++], invocation); |
| 25461 | if (info->pass_fdlist) |
| 25462 | { |
| 25463 | #ifdef G_OS_UNIX |
| 25464 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 25465 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 25466 | #else |
| 25467 | g_assert_not_reached (); |
| 25468 | #endif |
| 25469 | } |
| 25470 | g_variant_iter_init (&iter, parameters); |
| 25471 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 25472 | { |
| 25473 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 25474 | if (arg_info->use_gvariant) |
| 25475 | { |
| 25476 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 25477 | g_value_set_variant (¶mv[n], child); |
| 25478 | n++; |
| 25479 | } |
| 25480 | else |
| 25481 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 25482 | g_variant_unref (child); |
| 25483 | } |
| 25484 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 25485 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 25486 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 25487 | if (!g_value_get_boolean (&return_value)) |
| 25488 | 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); |
| 25489 | g_value_unset (&return_value); |
| 25490 | for (n = 0; n < num_params + num_extra; n++) |
| 25491 | g_value_unset (¶mv[n]); |
| 25492 | g_free (paramv); |
| 25493 | } |
| 25494 | |
| 25495 | static GVariant * |
| 25496 | _led_skeleton_handle_get_property ( |
| 25497 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25498 | const gchar *sender G_GNUC_UNUSED, |
| 25499 | const gchar *object_path G_GNUC_UNUSED, |
| 25500 | const gchar *interface_name G_GNUC_UNUSED, |
| 25501 | const gchar *property_name, |
| 25502 | GError **error, |
| 25503 | gpointer user_data) |
| 25504 | { |
| 25505 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 25506 | GValue value = G_VALUE_INIT; |
| 25507 | GParamSpec *pspec; |
| 25508 | _ExtendedGDBusPropertyInfo *info; |
| 25509 | GVariant *ret; |
| 25510 | ret = NULL; |
| 25511 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 25512 | g_assert (info != NULL); |
| 25513 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25514 | if (pspec == NULL) |
| 25515 | { |
| 25516 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25517 | } |
| 25518 | else |
| 25519 | { |
| 25520 | g_value_init (&value, pspec->value_type); |
| 25521 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25522 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 25523 | g_value_unset (&value); |
| 25524 | } |
| 25525 | return ret; |
| 25526 | } |
| 25527 | |
| 25528 | static gboolean |
| 25529 | _led_skeleton_handle_set_property ( |
| 25530 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25531 | const gchar *sender G_GNUC_UNUSED, |
| 25532 | const gchar *object_path G_GNUC_UNUSED, |
| 25533 | const gchar *interface_name G_GNUC_UNUSED, |
| 25534 | const gchar *property_name, |
| 25535 | GVariant *variant, |
| 25536 | GError **error, |
| 25537 | gpointer user_data) |
| 25538 | { |
| 25539 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 25540 | GValue value = G_VALUE_INIT; |
| 25541 | GParamSpec *pspec; |
| 25542 | _ExtendedGDBusPropertyInfo *info; |
| 25543 | gboolean ret; |
| 25544 | ret = FALSE; |
| 25545 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 25546 | g_assert (info != NULL); |
| 25547 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25548 | if (pspec == NULL) |
| 25549 | { |
| 25550 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25551 | } |
| 25552 | else |
| 25553 | { |
| 25554 | if (info->use_gvariant) |
| 25555 | g_value_set_variant (&value, variant); |
| 25556 | else |
| 25557 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 25558 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25559 | g_value_unset (&value); |
| 25560 | ret = TRUE; |
| 25561 | } |
| 25562 | return ret; |
| 25563 | } |
| 25564 | |
| 25565 | static const GDBusInterfaceVTable _led_skeleton_vtable = |
| 25566 | { |
| 25567 | _led_skeleton_handle_method_call, |
| 25568 | _led_skeleton_handle_get_property, |
| 25569 | _led_skeleton_handle_set_property, |
| 25570 | {NULL} |
| 25571 | }; |
| 25572 | |
| 25573 | static GDBusInterfaceInfo * |
| 25574 | led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25575 | { |
| 25576 | return led_interface_info (); |
| 25577 | } |
| 25578 | |
| 25579 | static GDBusInterfaceVTable * |
| 25580 | led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25581 | { |
| 25582 | return (GDBusInterfaceVTable *) &_led_skeleton_vtable; |
| 25583 | } |
| 25584 | |
| 25585 | static GVariant * |
| 25586 | led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 25587 | { |
| 25588 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 25589 | |
| 25590 | GVariantBuilder builder; |
| 25591 | guint n; |
| 25592 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25593 | if (_led_interface_info.parent_struct.properties == NULL) |
| 25594 | goto out; |
| 25595 | for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++) |
| 25596 | { |
| 25597 | GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n]; |
| 25598 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 25599 | { |
| 25600 | GVariant *value; |
| 25601 | 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); |
| 25602 | if (value != NULL) |
| 25603 | { |
| 25604 | g_variant_take_ref (value); |
| 25605 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 25606 | g_variant_unref (value); |
| 25607 | } |
| 25608 | } |
| 25609 | } |
| 25610 | out: |
| 25611 | return g_variant_builder_end (&builder); |
| 25612 | } |
| 25613 | |
| 25614 | static gboolean _led_emit_changed (gpointer user_data); |
| 25615 | |
| 25616 | static void |
| 25617 | led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 25618 | { |
| 25619 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 25620 | gboolean emit_changed = FALSE; |
| 25621 | |
| 25622 | g_mutex_lock (&skeleton->priv->lock); |
| 25623 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25624 | { |
| 25625 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25626 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25627 | emit_changed = TRUE; |
| 25628 | } |
| 25629 | g_mutex_unlock (&skeleton->priv->lock); |
| 25630 | |
| 25631 | if (emit_changed) |
| 25632 | _led_emit_changed (skeleton); |
| 25633 | } |
| 25634 | |
| 25635 | static void led_skeleton_iface_init (LedIface *iface); |
| 25636 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25637 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25638 | G_ADD_PRIVATE (LedSkeleton) |
| 25639 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 25640 | |
| 25641 | #else |
| 25642 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25643 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 25644 | |
| 25645 | #endif |
| 25646 | static void |
| 25647 | led_skeleton_finalize (GObject *object) |
| 25648 | { |
| 25649 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25650 | guint n; |
| 25651 | for (n = 0; n < 2; n++) |
| 25652 | g_value_unset (&skeleton->priv->properties[n]); |
| 25653 | g_free (skeleton->priv->properties); |
| 25654 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25655 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25656 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25657 | g_main_context_unref (skeleton->priv->context); |
| 25658 | g_mutex_clear (&skeleton->priv->lock); |
| 25659 | G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object); |
| 25660 | } |
| 25661 | |
| 25662 | static void |
| 25663 | led_skeleton_get_property (GObject *object, |
| 25664 | guint prop_id, |
| 25665 | GValue *value, |
| 25666 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25667 | { |
| 25668 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25669 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25670 | g_mutex_lock (&skeleton->priv->lock); |
| 25671 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 25672 | g_mutex_unlock (&skeleton->priv->lock); |
| 25673 | } |
| 25674 | |
| 25675 | static gboolean |
| 25676 | _led_emit_changed (gpointer user_data) |
| 25677 | { |
| 25678 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 25679 | GList *l; |
| 25680 | GVariantBuilder builder; |
| 25681 | GVariantBuilder invalidated_builder; |
| 25682 | guint num_changes; |
| 25683 | |
| 25684 | g_mutex_lock (&skeleton->priv->lock); |
| 25685 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25686 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 25687 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 25688 | { |
| 25689 | ChangedProperty *cp = l->data; |
| 25690 | GVariant *variant; |
| 25691 | const GValue *cur_value; |
| 25692 | |
| 25693 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 25694 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 25695 | { |
| 25696 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 25697 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 25698 | g_variant_unref (variant); |
| 25699 | num_changes++; |
| 25700 | } |
| 25701 | } |
| 25702 | if (num_changes > 0) |
| 25703 | { |
| 25704 | GList *connections, *ll; |
| 25705 | GVariant *signal_variant; |
| 25706 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led", |
| 25707 | &builder, &invalidated_builder)); |
| 25708 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25709 | for (ll = connections; ll != NULL; ll = ll->next) |
| 25710 | { |
| 25711 | GDBusConnection *connection = ll->data; |
| 25712 | |
| 25713 | g_dbus_connection_emit_signal (connection, |
| 25714 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 25715 | "org.freedesktop.DBus.Properties", |
| 25716 | "PropertiesChanged", |
| 25717 | signal_variant, |
| 25718 | NULL); |
| 25719 | } |
| 25720 | g_variant_unref (signal_variant); |
| 25721 | g_list_free_full (connections, g_object_unref); |
| 25722 | } |
| 25723 | else |
| 25724 | { |
| 25725 | g_variant_builder_clear (&builder); |
| 25726 | g_variant_builder_clear (&invalidated_builder); |
| 25727 | } |
| 25728 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25729 | skeleton->priv->changed_properties = NULL; |
| 25730 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25731 | g_mutex_unlock (&skeleton->priv->lock); |
| 25732 | return FALSE; |
| 25733 | } |
| 25734 | |
| 25735 | static void |
| 25736 | _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 25737 | { |
| 25738 | ChangedProperty *cp; |
| 25739 | GList *l; |
| 25740 | cp = NULL; |
| 25741 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 25742 | { |
| 25743 | ChangedProperty *i_cp = l->data; |
| 25744 | if (i_cp->info == info) |
| 25745 | { |
| 25746 | cp = i_cp; |
| 25747 | break; |
| 25748 | } |
| 25749 | } |
| 25750 | if (cp == NULL) |
| 25751 | { |
| 25752 | cp = g_new0 (ChangedProperty, 1); |
| 25753 | cp->prop_id = prop_id; |
| 25754 | cp->info = info; |
| 25755 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 25756 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 25757 | g_value_copy (orig_value, &cp->orig_value); |
| 25758 | } |
| 25759 | } |
| 25760 | |
| 25761 | static void |
| 25762 | led_skeleton_notify (GObject *object, |
| 25763 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25764 | { |
| 25765 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25766 | g_mutex_lock (&skeleton->priv->lock); |
| 25767 | if (skeleton->priv->changed_properties != NULL && |
| 25768 | skeleton->priv->changed_properties_idle_source == NULL) |
| 25769 | { |
| 25770 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 25771 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 25772 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 25773 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 25774 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 25775 | } |
| 25776 | g_mutex_unlock (&skeleton->priv->lock); |
| 25777 | } |
| 25778 | |
| 25779 | static void |
| 25780 | led_skeleton_set_property (GObject *object, |
| 25781 | guint prop_id, |
| 25782 | const GValue *value, |
| 25783 | GParamSpec *pspec) |
| 25784 | { |
| 25785 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25786 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25787 | g_mutex_lock (&skeleton->priv->lock); |
| 25788 | g_object_freeze_notify (object); |
| 25789 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 25790 | { |
| 25791 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 25792 | _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 25793 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 25794 | g_object_notify_by_pspec (object, pspec); |
| 25795 | } |
| 25796 | g_mutex_unlock (&skeleton->priv->lock); |
| 25797 | g_object_thaw_notify (object); |
| 25798 | } |
| 25799 | |
| 25800 | static void |
| 25801 | led_skeleton_init (LedSkeleton *skeleton) |
| 25802 | { |
| 25803 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25804 | skeleton->priv = led_skeleton_get_instance_private (skeleton); |
| 25805 | #else |
| 25806 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate); |
| 25807 | #endif |
| 25808 | |
| 25809 | g_mutex_init (&skeleton->priv->lock); |
| 25810 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 25811 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 25812 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 25813 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 25814 | } |
| 25815 | |
| 25816 | static gint |
| 25817 | led_skeleton_get_color (Led *object) |
| 25818 | { |
| 25819 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25820 | gint value; |
| 25821 | g_mutex_lock (&skeleton->priv->lock); |
| 25822 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 25823 | g_mutex_unlock (&skeleton->priv->lock); |
| 25824 | return value; |
| 25825 | } |
| 25826 | |
| 25827 | static const gchar * |
| 25828 | led_skeleton_get_function (Led *object) |
| 25829 | { |
| 25830 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 25831 | const gchar *value; |
| 25832 | g_mutex_lock (&skeleton->priv->lock); |
| 25833 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 25834 | g_mutex_unlock (&skeleton->priv->lock); |
| 25835 | return value; |
| 25836 | } |
| 25837 | |
| 25838 | static void |
| 25839 | led_skeleton_class_init (LedSkeletonClass *klass) |
| 25840 | { |
| 25841 | GObjectClass *gobject_class; |
| 25842 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 25843 | |
| 25844 | gobject_class = G_OBJECT_CLASS (klass); |
| 25845 | gobject_class->finalize = led_skeleton_finalize; |
| 25846 | gobject_class->get_property = led_skeleton_get_property; |
| 25847 | gobject_class->set_property = led_skeleton_set_property; |
| 25848 | gobject_class->notify = led_skeleton_notify; |
| 25849 | |
| 25850 | |
| 25851 | led_override_properties (gobject_class, 1); |
| 25852 | |
| 25853 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 25854 | skeleton_class->get_info = led_skeleton_dbus_interface_get_info; |
| 25855 | skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties; |
| 25856 | skeleton_class->flush = led_skeleton_dbus_interface_flush; |
| 25857 | skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable; |
| 25858 | |
| 25859 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 25860 | g_type_class_add_private (klass, sizeof (LedSkeletonPrivate)); |
| 25861 | #endif |
| 25862 | } |
| 25863 | |
| 25864 | static void |
| 25865 | led_skeleton_iface_init (LedIface *iface) |
| 25866 | { |
| 25867 | iface->get_color = led_skeleton_get_color; |
| 25868 | iface->get_function = led_skeleton_get_function; |
| 25869 | } |
| 25870 | |
| 25871 | /** |
| 25872 | * led_skeleton_new: |
| 25873 | * |
| 25874 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 25875 | * |
| 25876 | * Returns: (transfer full) (type LedSkeleton): The skeleton object. |
| 25877 | */ |
| 25878 | Led * |
| 25879 | led_skeleton_new (void) |
| 25880 | { |
| 25881 | return LED (g_object_new (TYPE_LED_SKELETON, NULL)); |
| 25882 | } |
| 25883 | |
| 25884 | /* ------------------------------------------------------------------------ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 25885 | * Code for interface org.openbmc.HostIpmi |
| 25886 | * ------------------------------------------------------------------------ |
| 25887 | */ |
| 25888 | |
| 25889 | /** |
| 25890 | * SECTION:HostIpmi |
| 25891 | * @title: HostIpmi |
| 25892 | * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface |
| 25893 | * |
| 25894 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C. |
| 25895 | */ |
| 25896 | |
| 25897 | /* ---- Introspection data for org.openbmc.HostIpmi ---- */ |
| 25898 | |
| 25899 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq = |
| 25900 | { |
| 25901 | { |
| 25902 | -1, |
| 25903 | (gchar *) "seq", |
| 25904 | (gchar *) "y", |
| 25905 | NULL |
| 25906 | }, |
| 25907 | FALSE |
| 25908 | }; |
| 25909 | |
| 25910 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn = |
| 25911 | { |
| 25912 | { |
| 25913 | -1, |
| 25914 | (gchar *) "netfn", |
| 25915 | (gchar *) "y", |
| 25916 | NULL |
| 25917 | }, |
| 25918 | FALSE |
| 25919 | }; |
| 25920 | |
| 25921 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd = |
| 25922 | { |
| 25923 | { |
| 25924 | -1, |
| 25925 | (gchar *) "cmd", |
| 25926 | (gchar *) "y", |
| 25927 | NULL |
| 25928 | }, |
| 25929 | FALSE |
| 25930 | }; |
| 25931 | |
| 25932 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data = |
| 25933 | { |
| 25934 | { |
| 25935 | -1, |
| 25936 | (gchar *) "data", |
| 25937 | (gchar *) "ay", |
| 25938 | NULL |
| 25939 | }, |
| 25940 | FALSE |
| 25941 | }; |
| 25942 | |
| 25943 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] = |
| 25944 | { |
| 25945 | &_host_ipmi_method_info_send_message_IN_ARG_seq, |
| 25946 | &_host_ipmi_method_info_send_message_IN_ARG_netfn, |
| 25947 | &_host_ipmi_method_info_send_message_IN_ARG_cmd, |
| 25948 | &_host_ipmi_method_info_send_message_IN_ARG_data, |
| 25949 | NULL |
| 25950 | }; |
| 25951 | |
| 25952 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 = |
| 25953 | { |
| 25954 | { |
| 25955 | -1, |
| 25956 | (gchar *) "unnamed_arg4", |
| 25957 | (gchar *) "x", |
| 25958 | NULL |
| 25959 | }, |
| 25960 | FALSE |
| 25961 | }; |
| 25962 | |
| 25963 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] = |
| 25964 | { |
| 25965 | &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4, |
| 25966 | NULL |
| 25967 | }; |
| 25968 | |
| 25969 | static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message = |
| 25970 | { |
| 25971 | { |
| 25972 | -1, |
| 25973 | (gchar *) "sendMessage", |
| 25974 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers, |
| 25975 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers, |
| 25976 | NULL |
| 25977 | }, |
| 25978 | "handle-send-message", |
| 25979 | FALSE |
| 25980 | }; |
| 25981 | |
| 25982 | static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] = |
| 25983 | { |
| 25984 | &_host_ipmi_method_info_send_message, |
| 25985 | NULL |
| 25986 | }; |
| 25987 | |
| 25988 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq = |
| 25989 | { |
| 25990 | { |
| 25991 | -1, |
| 25992 | (gchar *) "seq", |
| 25993 | (gchar *) "y", |
| 25994 | NULL |
| 25995 | }, |
| 25996 | FALSE |
| 25997 | }; |
| 25998 | |
| 25999 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn = |
| 26000 | { |
| 26001 | { |
| 26002 | -1, |
| 26003 | (gchar *) "netfn", |
| 26004 | (gchar *) "y", |
| 26005 | NULL |
| 26006 | }, |
| 26007 | FALSE |
| 26008 | }; |
| 26009 | |
| 26010 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd = |
| 26011 | { |
| 26012 | { |
| 26013 | -1, |
| 26014 | (gchar *) "cmd", |
| 26015 | (gchar *) "y", |
| 26016 | NULL |
| 26017 | }, |
| 26018 | FALSE |
| 26019 | }; |
| 26020 | |
| 26021 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data = |
| 26022 | { |
| 26023 | { |
| 26024 | -1, |
| 26025 | (gchar *) "data", |
| 26026 | (gchar *) "ay", |
| 26027 | NULL |
| 26028 | }, |
| 26029 | FALSE |
| 26030 | }; |
| 26031 | |
| 26032 | static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] = |
| 26033 | { |
| 26034 | &_host_ipmi_signal_info_received_message_ARG_seq, |
| 26035 | &_host_ipmi_signal_info_received_message_ARG_netfn, |
| 26036 | &_host_ipmi_signal_info_received_message_ARG_cmd, |
| 26037 | &_host_ipmi_signal_info_received_message_ARG_data, |
| 26038 | NULL |
| 26039 | }; |
| 26040 | |
| 26041 | static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message = |
| 26042 | { |
| 26043 | { |
| 26044 | -1, |
| 26045 | (gchar *) "ReceivedMessage", |
| 26046 | (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers, |
| 26047 | NULL |
| 26048 | }, |
| 26049 | "received-message" |
| 26050 | }; |
| 26051 | |
| 26052 | static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] = |
| 26053 | { |
| 26054 | &_host_ipmi_signal_info_received_message, |
| 26055 | NULL |
| 26056 | }; |
| 26057 | |
| 26058 | static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info = |
| 26059 | { |
| 26060 | { |
| 26061 | -1, |
| 26062 | (gchar *) "org.openbmc.HostIpmi", |
| 26063 | (GDBusMethodInfo **) &_host_ipmi_method_info_pointers, |
| 26064 | (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers, |
| 26065 | NULL, |
| 26066 | NULL |
| 26067 | }, |
| 26068 | "host-ipmi", |
| 26069 | }; |
| 26070 | |
| 26071 | |
| 26072 | /** |
| 26073 | * host_ipmi_interface_info: |
| 26074 | * |
| 26075 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface. |
| 26076 | * |
| 26077 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 26078 | */ |
| 26079 | GDBusInterfaceInfo * |
| 26080 | host_ipmi_interface_info (void) |
| 26081 | { |
| 26082 | return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct; |
| 26083 | } |
| 26084 | |
| 26085 | /** |
| 26086 | * host_ipmi_override_properties: |
| 26087 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 26088 | * @property_id_begin: The property id to assign to the first overridden property. |
| 26089 | * |
| 26090 | * Overrides all #GObject properties in the #HostIpmi interface for a concrete class. |
| 26091 | * The properties are overridden in the order they are defined. |
| 26092 | * |
| 26093 | * Returns: The last property id. |
| 26094 | */ |
| 26095 | guint |
| 26096 | host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin) |
| 26097 | { |
| 26098 | return property_id_begin - 1; |
| 26099 | } |
| 26100 | |
| 26101 | |
| 26102 | |
| 26103 | /** |
| 26104 | * HostIpmi: |
| 26105 | * |
| 26106 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 26107 | */ |
| 26108 | |
| 26109 | /** |
| 26110 | * HostIpmiIface: |
| 26111 | * @parent_iface: The parent interface. |
| 26112 | * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal. |
| 26113 | * @received_message: Handler for the #HostIpmi::received-message signal. |
| 26114 | * |
| 26115 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 26116 | */ |
| 26117 | |
| 26118 | typedef HostIpmiIface HostIpmiInterface; |
| 26119 | G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT); |
| 26120 | |
| 26121 | static void |
| 26122 | host_ipmi_default_init (HostIpmiIface *iface) |
| 26123 | { |
| 26124 | /* GObject signals for incoming D-Bus method calls: */ |
| 26125 | /** |
| 26126 | * HostIpmi::handle-send-message: |
| 26127 | * @object: A #HostIpmi. |
| 26128 | * @invocation: A #GDBusMethodInvocation. |
| 26129 | * @arg_seq: Argument passed by remote caller. |
| 26130 | * @arg_netfn: Argument passed by remote caller. |
| 26131 | * @arg_cmd: Argument passed by remote caller. |
| 26132 | * @arg_data: Argument passed by remote caller. |
| 26133 | * |
| 26134 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. |
| 26135 | * |
| 26136 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call host_ipmi_complete_send_message() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 26137 | * |
| 26138 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 26139 | */ |
| 26140 | g_signal_new ("handle-send-message", |
| 26141 | G_TYPE_FROM_INTERFACE (iface), |
| 26142 | G_SIGNAL_RUN_LAST, |
| 26143 | G_STRUCT_OFFSET (HostIpmiIface, handle_send_message), |
| 26144 | g_signal_accumulator_true_handled, |
| 26145 | NULL, |
| 26146 | g_cclosure_marshal_generic, |
| 26147 | G_TYPE_BOOLEAN, |
| 26148 | 5, |
| 26149 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 26150 | |
| 26151 | /* GObject signals for received D-Bus signals: */ |
| 26152 | /** |
| 26153 | * HostIpmi::received-message: |
| 26154 | * @object: A #HostIpmi. |
| 26155 | * @arg_seq: Argument. |
| 26156 | * @arg_netfn: Argument. |
| 26157 | * @arg_cmd: Argument. |
| 26158 | * @arg_data: Argument. |
| 26159 | * |
| 26160 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received. |
| 26161 | * |
| 26162 | * 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. |
| 26163 | */ |
| 26164 | g_signal_new ("received-message", |
| 26165 | G_TYPE_FROM_INTERFACE (iface), |
| 26166 | G_SIGNAL_RUN_LAST, |
| 26167 | G_STRUCT_OFFSET (HostIpmiIface, received_message), |
| 26168 | NULL, |
| 26169 | NULL, |
| 26170 | g_cclosure_marshal_generic, |
| 26171 | G_TYPE_NONE, |
| 26172 | 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 26173 | |
| 26174 | } |
| 26175 | |
| 26176 | /** |
| 26177 | * host_ipmi_emit_received_message: |
| 26178 | * @object: A #HostIpmi. |
| 26179 | * @arg_seq: Argument to pass with the signal. |
| 26180 | * @arg_netfn: Argument to pass with the signal. |
| 26181 | * @arg_cmd: Argument to pass with the signal. |
| 26182 | * @arg_data: Argument to pass with the signal. |
| 26183 | * |
| 26184 | * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal. |
| 26185 | */ |
| 26186 | void |
| 26187 | host_ipmi_emit_received_message ( |
| 26188 | HostIpmi *object, |
| 26189 | guchar arg_seq, |
| 26190 | guchar arg_netfn, |
| 26191 | guchar arg_cmd, |
| 26192 | const gchar *arg_data) |
| 26193 | { |
| 26194 | g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data); |
| 26195 | } |
| 26196 | |
| 26197 | /** |
| 26198 | * host_ipmi_call_send_message: |
| 26199 | * @proxy: A #HostIpmiProxy. |
| 26200 | * @arg_seq: Argument to pass with the method invocation. |
| 26201 | * @arg_netfn: Argument to pass with the method invocation. |
| 26202 | * @arg_cmd: Argument to pass with the method invocation. |
| 26203 | * @arg_data: Argument to pass with the method invocation. |
| 26204 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26205 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26206 | * @user_data: User data to pass to @callback. |
| 26207 | * |
| 26208 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. |
| 26209 | * 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. |
| 26210 | * You can then call host_ipmi_call_send_message_finish() to get the result of the operation. |
| 26211 | * |
| 26212 | * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method. |
| 26213 | */ |
| 26214 | void |
| 26215 | host_ipmi_call_send_message ( |
| 26216 | HostIpmi *proxy, |
| 26217 | guchar arg_seq, |
| 26218 | guchar arg_netfn, |
| 26219 | guchar arg_cmd, |
| 26220 | const gchar *arg_data, |
| 26221 | GCancellable *cancellable, |
| 26222 | GAsyncReadyCallback callback, |
| 26223 | gpointer user_data) |
| 26224 | { |
| 26225 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 26226 | "sendMessage", |
| 26227 | g_variant_new ("(yyy^ay)", |
| 26228 | arg_seq, |
| 26229 | arg_netfn, |
| 26230 | arg_cmd, |
| 26231 | arg_data), |
| 26232 | G_DBUS_CALL_FLAGS_NONE, |
| 26233 | -1, |
| 26234 | cancellable, |
| 26235 | callback, |
| 26236 | user_data); |
| 26237 | } |
| 26238 | |
| 26239 | /** |
| 26240 | * host_ipmi_call_send_message_finish: |
| 26241 | * @proxy: A #HostIpmiProxy. |
| 26242 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 26243 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message(). |
| 26244 | * @error: Return location for error or %NULL. |
| 26245 | * |
| 26246 | * Finishes an operation started with host_ipmi_call_send_message(). |
| 26247 | * |
| 26248 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26249 | */ |
| 26250 | gboolean |
| 26251 | host_ipmi_call_send_message_finish ( |
| 26252 | HostIpmi *proxy, |
| 26253 | gint64 *out_unnamed_arg4, |
| 26254 | GAsyncResult *res, |
| 26255 | GError **error) |
| 26256 | { |
| 26257 | GVariant *_ret; |
| 26258 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26259 | if (_ret == NULL) |
| 26260 | goto _out; |
| 26261 | g_variant_get (_ret, |
| 26262 | "(x)", |
| 26263 | out_unnamed_arg4); |
| 26264 | g_variant_unref (_ret); |
| 26265 | _out: |
| 26266 | return _ret != NULL; |
| 26267 | } |
| 26268 | |
| 26269 | /** |
| 26270 | * host_ipmi_call_send_message_sync: |
| 26271 | * @proxy: A #HostIpmiProxy. |
| 26272 | * @arg_seq: Argument to pass with the method invocation. |
| 26273 | * @arg_netfn: Argument to pass with the method invocation. |
| 26274 | * @arg_cmd: Argument to pass with the method invocation. |
| 26275 | * @arg_data: Argument to pass with the method invocation. |
| 26276 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 26277 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26278 | * @error: Return location for error or %NULL. |
| 26279 | * |
| 26280 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 26281 | * |
| 26282 | * See host_ipmi_call_send_message() for the asynchronous version of this method. |
| 26283 | * |
| 26284 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26285 | */ |
| 26286 | gboolean |
| 26287 | host_ipmi_call_send_message_sync ( |
| 26288 | HostIpmi *proxy, |
| 26289 | guchar arg_seq, |
| 26290 | guchar arg_netfn, |
| 26291 | guchar arg_cmd, |
| 26292 | const gchar *arg_data, |
| 26293 | gint64 *out_unnamed_arg4, |
| 26294 | GCancellable *cancellable, |
| 26295 | GError **error) |
| 26296 | { |
| 26297 | GVariant *_ret; |
| 26298 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26299 | "sendMessage", |
| 26300 | g_variant_new ("(yyy^ay)", |
| 26301 | arg_seq, |
| 26302 | arg_netfn, |
| 26303 | arg_cmd, |
| 26304 | arg_data), |
| 26305 | G_DBUS_CALL_FLAGS_NONE, |
| 26306 | -1, |
| 26307 | cancellable, |
| 26308 | error); |
| 26309 | if (_ret == NULL) |
| 26310 | goto _out; |
| 26311 | g_variant_get (_ret, |
| 26312 | "(x)", |
| 26313 | out_unnamed_arg4); |
| 26314 | g_variant_unref (_ret); |
| 26315 | _out: |
| 26316 | return _ret != NULL; |
| 26317 | } |
| 26318 | |
| 26319 | /** |
| 26320 | * host_ipmi_complete_send_message: |
| 26321 | * @object: A #HostIpmi. |
| 26322 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26323 | * @unnamed_arg4: Parameter to return. |
| 26324 | * |
| 26325 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 26326 | * |
| 26327 | * This method will free @invocation, you cannot use it afterwards. |
| 26328 | */ |
| 26329 | void |
| 26330 | host_ipmi_complete_send_message ( |
| 26331 | HostIpmi *object, |
| 26332 | GDBusMethodInvocation *invocation, |
| 26333 | gint64 unnamed_arg4) |
| 26334 | { |
| 26335 | g_dbus_method_invocation_return_value (invocation, |
| 26336 | g_variant_new ("(x)", |
| 26337 | unnamed_arg4)); |
| 26338 | } |
| 26339 | |
| 26340 | /* ------------------------------------------------------------------------ */ |
| 26341 | |
| 26342 | /** |
| 26343 | * HostIpmiProxy: |
| 26344 | * |
| 26345 | * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API. |
| 26346 | */ |
| 26347 | |
| 26348 | /** |
| 26349 | * HostIpmiProxyClass: |
| 26350 | * @parent_class: The parent class. |
| 26351 | * |
| 26352 | * Class structure for #HostIpmiProxy. |
| 26353 | */ |
| 26354 | |
| 26355 | struct _HostIpmiProxyPrivate |
| 26356 | { |
| 26357 | GData *qdata; |
| 26358 | }; |
| 26359 | |
| 26360 | static void host_ipmi_proxy_iface_init (HostIpmiIface *iface); |
| 26361 | |
| 26362 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26363 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 26364 | G_ADD_PRIVATE (HostIpmiProxy) |
| 26365 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 26366 | |
| 26367 | #else |
| 26368 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 26369 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 26370 | |
| 26371 | #endif |
| 26372 | static void |
| 26373 | host_ipmi_proxy_finalize (GObject *object) |
| 26374 | { |
| 26375 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (object); |
| 26376 | g_datalist_clear (&proxy->priv->qdata); |
| 26377 | G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object); |
| 26378 | } |
| 26379 | |
| 26380 | static void |
| 26381 | host_ipmi_proxy_get_property (GObject *object, |
| 26382 | guint prop_id, |
| 26383 | GValue *value, |
| 26384 | GParamSpec *pspec G_GNUC_UNUSED) |
| 26385 | { |
| 26386 | } |
| 26387 | |
| 26388 | static void |
| 26389 | host_ipmi_proxy_set_property (GObject *object, |
| 26390 | guint prop_id, |
| 26391 | const GValue *value, |
| 26392 | GParamSpec *pspec G_GNUC_UNUSED) |
| 26393 | { |
| 26394 | } |
| 26395 | |
| 26396 | static void |
| 26397 | host_ipmi_proxy_g_signal (GDBusProxy *proxy, |
| 26398 | const gchar *sender_name G_GNUC_UNUSED, |
| 26399 | const gchar *signal_name, |
| 26400 | GVariant *parameters) |
| 26401 | { |
| 26402 | _ExtendedGDBusSignalInfo *info; |
| 26403 | GVariantIter iter; |
| 26404 | GVariant *child; |
| 26405 | GValue *paramv; |
| 26406 | guint num_params; |
| 26407 | guint n; |
| 26408 | guint signal_id; |
| 26409 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name); |
| 26410 | if (info == NULL) |
| 26411 | return; |
| 26412 | num_params = g_variant_n_children (parameters); |
| 26413 | paramv = g_new0 (GValue, num_params + 1); |
| 26414 | g_value_init (¶mv[0], TYPE_HOST_IPMI); |
| 26415 | g_value_set_object (¶mv[0], proxy); |
| 26416 | g_variant_iter_init (&iter, parameters); |
| 26417 | n = 1; |
| 26418 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 26419 | { |
| 26420 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 26421 | if (arg_info->use_gvariant) |
| 26422 | { |
| 26423 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 26424 | g_value_set_variant (¶mv[n], child); |
| 26425 | n++; |
| 26426 | } |
| 26427 | else |
| 26428 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 26429 | g_variant_unref (child); |
| 26430 | } |
| 26431 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 26432 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 26433 | for (n = 0; n < num_params + 1; n++) |
| 26434 | g_value_unset (¶mv[n]); |
| 26435 | g_free (paramv); |
| 26436 | } |
| 26437 | |
| 26438 | static void |
| 26439 | host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 26440 | GVariant *changed_properties, |
| 26441 | const gchar *const *invalidated_properties) |
| 26442 | { |
| 26443 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy); |
| 26444 | guint n; |
| 26445 | const gchar *key; |
| 26446 | GVariantIter *iter; |
| 26447 | _ExtendedGDBusPropertyInfo *info; |
| 26448 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 26449 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 26450 | { |
| 26451 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key); |
| 26452 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 26453 | if (info != NULL) |
| 26454 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 26455 | } |
| 26456 | g_variant_iter_free (iter); |
| 26457 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 26458 | { |
| 26459 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]); |
| 26460 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 26461 | if (info != NULL) |
| 26462 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 26463 | } |
| 26464 | } |
| 26465 | |
| 26466 | static void |
| 26467 | host_ipmi_proxy_init (HostIpmiProxy *proxy) |
| 26468 | { |
| 26469 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26470 | proxy->priv = host_ipmi_proxy_get_instance_private (proxy); |
| 26471 | #else |
| 26472 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate); |
| 26473 | #endif |
| 26474 | |
| 26475 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ()); |
| 26476 | } |
| 26477 | |
| 26478 | static void |
| 26479 | host_ipmi_proxy_class_init (HostIpmiProxyClass *klass) |
| 26480 | { |
| 26481 | GObjectClass *gobject_class; |
| 26482 | GDBusProxyClass *proxy_class; |
| 26483 | |
| 26484 | gobject_class = G_OBJECT_CLASS (klass); |
| 26485 | gobject_class->finalize = host_ipmi_proxy_finalize; |
| 26486 | gobject_class->get_property = host_ipmi_proxy_get_property; |
| 26487 | gobject_class->set_property = host_ipmi_proxy_set_property; |
| 26488 | |
| 26489 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 26490 | proxy_class->g_signal = host_ipmi_proxy_g_signal; |
| 26491 | proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed; |
| 26492 | |
| 26493 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 26494 | g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate)); |
| 26495 | #endif |
| 26496 | } |
| 26497 | |
| 26498 | static void |
| 26499 | host_ipmi_proxy_iface_init (HostIpmiIface *iface) |
| 26500 | { |
| 26501 | } |
| 26502 | |
| 26503 | /** |
| 26504 | * host_ipmi_proxy_new: |
| 26505 | * @connection: A #GDBusConnection. |
| 26506 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26507 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 26508 | * @object_path: An object path. |
| 26509 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26510 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 26511 | * @user_data: User data to pass to @callback. |
| 26512 | * |
| 26513 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details. |
| 26514 | * |
| 26515 | * 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. |
| 26516 | * You can then call host_ipmi_proxy_new_finish() to get the result of the operation. |
| 26517 | * |
| 26518 | * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 26519 | */ |
| 26520 | void |
| 26521 | host_ipmi_proxy_new ( |
| 26522 | GDBusConnection *connection, |
| 26523 | GDBusProxyFlags flags, |
| 26524 | const gchar *name, |
| 26525 | const gchar *object_path, |
| 26526 | GCancellable *cancellable, |
| 26527 | GAsyncReadyCallback callback, |
| 26528 | gpointer user_data) |
| 26529 | { |
| 26530 | g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); |
| 26531 | } |
| 26532 | |
| 26533 | /** |
| 26534 | * host_ipmi_proxy_new_finish: |
| 26535 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new(). |
| 26536 | * @error: Return location for error or %NULL |
| 26537 | * |
| 26538 | * Finishes an operation started with host_ipmi_proxy_new(). |
| 26539 | * |
| 26540 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 26541 | */ |
| 26542 | HostIpmi * |
| 26543 | host_ipmi_proxy_new_finish ( |
| 26544 | GAsyncResult *res, |
| 26545 | GError **error) |
| 26546 | { |
| 26547 | GObject *ret; |
| 26548 | GObject *source_object; |
| 26549 | source_object = g_async_result_get_source_object (res); |
| 26550 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 26551 | g_object_unref (source_object); |
| 26552 | if (ret != NULL) |
| 26553 | return HOST_IPMI (ret); |
| 26554 | else |
| 26555 | return NULL; |
| 26556 | } |
| 26557 | |
| 26558 | /** |
| 26559 | * host_ipmi_proxy_new_sync: |
| 26560 | * @connection: A #GDBusConnection. |
| 26561 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26562 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 26563 | * @object_path: An object path. |
| 26564 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26565 | * @error: Return location for error or %NULL |
| 26566 | * |
| 26567 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details. |
| 26568 | * |
| 26569 | * The calling thread is blocked until a reply is received. |
| 26570 | * |
| 26571 | * See host_ipmi_proxy_new() for the asynchronous version of this constructor. |
| 26572 | * |
| 26573 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 26574 | */ |
| 26575 | HostIpmi * |
| 26576 | host_ipmi_proxy_new_sync ( |
| 26577 | GDBusConnection *connection, |
| 26578 | GDBusProxyFlags flags, |
| 26579 | const gchar *name, |
| 26580 | const gchar *object_path, |
| 26581 | GCancellable *cancellable, |
| 26582 | GError **error) |
| 26583 | { |
| 26584 | GInitable *ret; |
| 26585 | ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); |
| 26586 | if (ret != NULL) |
| 26587 | return HOST_IPMI (ret); |
| 26588 | else |
| 26589 | return NULL; |
| 26590 | } |
| 26591 | |
| 26592 | |
| 26593 | /** |
| 26594 | * host_ipmi_proxy_new_for_bus: |
| 26595 | * @bus_type: A #GBusType. |
| 26596 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26597 | * @name: A bus name (well-known or unique). |
| 26598 | * @object_path: An object path. |
| 26599 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26600 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 26601 | * @user_data: User data to pass to @callback. |
| 26602 | * |
| 26603 | * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 26604 | * |
| 26605 | * 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. |
| 26606 | * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation. |
| 26607 | * |
| 26608 | * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 26609 | */ |
| 26610 | void |
| 26611 | host_ipmi_proxy_new_for_bus ( |
| 26612 | GBusType bus_type, |
| 26613 | GDBusProxyFlags flags, |
| 26614 | const gchar *name, |
| 26615 | const gchar *object_path, |
| 26616 | GCancellable *cancellable, |
| 26617 | GAsyncReadyCallback callback, |
| 26618 | gpointer user_data) |
| 26619 | { |
| 26620 | g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); |
| 26621 | } |
| 26622 | |
| 26623 | /** |
| 26624 | * host_ipmi_proxy_new_for_bus_finish: |
| 26625 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus(). |
| 26626 | * @error: Return location for error or %NULL |
| 26627 | * |
| 26628 | * Finishes an operation started with host_ipmi_proxy_new_for_bus(). |
| 26629 | * |
| 26630 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 26631 | */ |
| 26632 | HostIpmi * |
| 26633 | host_ipmi_proxy_new_for_bus_finish ( |
| 26634 | GAsyncResult *res, |
| 26635 | GError **error) |
| 26636 | { |
| 26637 | GObject *ret; |
| 26638 | GObject *source_object; |
| 26639 | source_object = g_async_result_get_source_object (res); |
| 26640 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 26641 | g_object_unref (source_object); |
| 26642 | if (ret != NULL) |
| 26643 | return HOST_IPMI (ret); |
| 26644 | else |
| 26645 | return NULL; |
| 26646 | } |
| 26647 | |
| 26648 | /** |
| 26649 | * host_ipmi_proxy_new_for_bus_sync: |
| 26650 | * @bus_type: A #GBusType. |
| 26651 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26652 | * @name: A bus name (well-known or unique). |
| 26653 | * @object_path: An object path. |
| 26654 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26655 | * @error: Return location for error or %NULL |
| 26656 | * |
| 26657 | * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 26658 | * |
| 26659 | * The calling thread is blocked until a reply is received. |
| 26660 | * |
| 26661 | * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 26662 | * |
| 26663 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 26664 | */ |
| 26665 | HostIpmi * |
| 26666 | host_ipmi_proxy_new_for_bus_sync ( |
| 26667 | GBusType bus_type, |
| 26668 | GDBusProxyFlags flags, |
| 26669 | const gchar *name, |
| 26670 | const gchar *object_path, |
| 26671 | GCancellable *cancellable, |
| 26672 | GError **error) |
| 26673 | { |
| 26674 | GInitable *ret; |
| 26675 | ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); |
| 26676 | if (ret != NULL) |
| 26677 | return HOST_IPMI (ret); |
| 26678 | else |
| 26679 | return NULL; |
| 26680 | } |
| 26681 | |
| 26682 | |
| 26683 | /* ------------------------------------------------------------------------ */ |
| 26684 | |
| 26685 | /** |
| 26686 | * HostIpmiSkeleton: |
| 26687 | * |
| 26688 | * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API. |
| 26689 | */ |
| 26690 | |
| 26691 | /** |
| 26692 | * HostIpmiSkeletonClass: |
| 26693 | * @parent_class: The parent class. |
| 26694 | * |
| 26695 | * Class structure for #HostIpmiSkeleton. |
| 26696 | */ |
| 26697 | |
| 26698 | struct _HostIpmiSkeletonPrivate |
| 26699 | { |
| 26700 | GValue *properties; |
| 26701 | GList *changed_properties; |
| 26702 | GSource *changed_properties_idle_source; |
| 26703 | GMainContext *context; |
| 26704 | GMutex lock; |
| 26705 | }; |
| 26706 | |
| 26707 | static void |
| 26708 | _host_ipmi_skeleton_handle_method_call ( |
| 26709 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26710 | const gchar *sender G_GNUC_UNUSED, |
| 26711 | const gchar *object_path G_GNUC_UNUSED, |
| 26712 | const gchar *interface_name, |
| 26713 | const gchar *method_name, |
| 26714 | GVariant *parameters, |
| 26715 | GDBusMethodInvocation *invocation, |
| 26716 | gpointer user_data) |
| 26717 | { |
| 26718 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 26719 | _ExtendedGDBusMethodInfo *info; |
| 26720 | GVariantIter iter; |
| 26721 | GVariant *child; |
| 26722 | GValue *paramv; |
| 26723 | guint num_params; |
| 26724 | guint num_extra; |
| 26725 | guint n; |
| 26726 | guint signal_id; |
| 26727 | GValue return_value = G_VALUE_INIT; |
| 26728 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 26729 | g_assert (info != NULL); |
| 26730 | num_params = g_variant_n_children (parameters); |
| 26731 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 26732 | n = 0; |
| 26733 | g_value_init (¶mv[n], TYPE_HOST_IPMI); |
| 26734 | g_value_set_object (¶mv[n++], skeleton); |
| 26735 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 26736 | g_value_set_object (¶mv[n++], invocation); |
| 26737 | if (info->pass_fdlist) |
| 26738 | { |
| 26739 | #ifdef G_OS_UNIX |
| 26740 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 26741 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 26742 | #else |
| 26743 | g_assert_not_reached (); |
| 26744 | #endif |
| 26745 | } |
| 26746 | g_variant_iter_init (&iter, parameters); |
| 26747 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 26748 | { |
| 26749 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 26750 | if (arg_info->use_gvariant) |
| 26751 | { |
| 26752 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 26753 | g_value_set_variant (¶mv[n], child); |
| 26754 | n++; |
| 26755 | } |
| 26756 | else |
| 26757 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 26758 | g_variant_unref (child); |
| 26759 | } |
| 26760 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 26761 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 26762 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 26763 | if (!g_value_get_boolean (&return_value)) |
| 26764 | 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); |
| 26765 | g_value_unset (&return_value); |
| 26766 | for (n = 0; n < num_params + num_extra; n++) |
| 26767 | g_value_unset (¶mv[n]); |
| 26768 | g_free (paramv); |
| 26769 | } |
| 26770 | |
| 26771 | static GVariant * |
| 26772 | _host_ipmi_skeleton_handle_get_property ( |
| 26773 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26774 | const gchar *sender G_GNUC_UNUSED, |
| 26775 | const gchar *object_path G_GNUC_UNUSED, |
| 26776 | const gchar *interface_name G_GNUC_UNUSED, |
| 26777 | const gchar *property_name, |
| 26778 | GError **error, |
| 26779 | gpointer user_data) |
| 26780 | { |
| 26781 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 26782 | GValue value = G_VALUE_INIT; |
| 26783 | GParamSpec *pspec; |
| 26784 | _ExtendedGDBusPropertyInfo *info; |
| 26785 | GVariant *ret; |
| 26786 | ret = NULL; |
| 26787 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 26788 | g_assert (info != NULL); |
| 26789 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 26790 | if (pspec == NULL) |
| 26791 | { |
| 26792 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 26793 | } |
| 26794 | else |
| 26795 | { |
| 26796 | g_value_init (&value, pspec->value_type); |
| 26797 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 26798 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 26799 | g_value_unset (&value); |
| 26800 | } |
| 26801 | return ret; |
| 26802 | } |
| 26803 | |
| 26804 | static gboolean |
| 26805 | _host_ipmi_skeleton_handle_set_property ( |
| 26806 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26807 | const gchar *sender G_GNUC_UNUSED, |
| 26808 | const gchar *object_path G_GNUC_UNUSED, |
| 26809 | const gchar *interface_name G_GNUC_UNUSED, |
| 26810 | const gchar *property_name, |
| 26811 | GVariant *variant, |
| 26812 | GError **error, |
| 26813 | gpointer user_data) |
| 26814 | { |
| 26815 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 26816 | GValue value = G_VALUE_INIT; |
| 26817 | GParamSpec *pspec; |
| 26818 | _ExtendedGDBusPropertyInfo *info; |
| 26819 | gboolean ret; |
| 26820 | ret = FALSE; |
| 26821 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 26822 | g_assert (info != NULL); |
| 26823 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 26824 | if (pspec == NULL) |
| 26825 | { |
| 26826 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 26827 | } |
| 26828 | else |
| 26829 | { |
| 26830 | if (info->use_gvariant) |
| 26831 | g_value_set_variant (&value, variant); |
| 26832 | else |
| 26833 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 26834 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 26835 | g_value_unset (&value); |
| 26836 | ret = TRUE; |
| 26837 | } |
| 26838 | return ret; |
| 26839 | } |
| 26840 | |
| 26841 | static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable = |
| 26842 | { |
| 26843 | _host_ipmi_skeleton_handle_method_call, |
| 26844 | _host_ipmi_skeleton_handle_get_property, |
| 26845 | _host_ipmi_skeleton_handle_set_property, |
| 26846 | {NULL} |
| 26847 | }; |
| 26848 | |
| 26849 | static GDBusInterfaceInfo * |
| 26850 | host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 26851 | { |
| 26852 | return host_ipmi_interface_info (); |
| 26853 | } |
| 26854 | |
| 26855 | static GDBusInterfaceVTable * |
| 26856 | host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 26857 | { |
| 26858 | return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable; |
| 26859 | } |
| 26860 | |
| 26861 | static GVariant * |
| 26862 | host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 26863 | { |
| 26864 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton); |
| 26865 | |
| 26866 | GVariantBuilder builder; |
| 26867 | guint n; |
| 26868 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 26869 | if (_host_ipmi_interface_info.parent_struct.properties == NULL) |
| 26870 | goto out; |
| 26871 | for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++) |
| 26872 | { |
| 26873 | GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n]; |
| 26874 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 26875 | { |
| 26876 | GVariant *value; |
| 26877 | value = _host_ipmi_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", info->name, NULL, skeleton); |
| 26878 | if (value != NULL) |
| 26879 | { |
| 26880 | g_variant_take_ref (value); |
| 26881 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 26882 | g_variant_unref (value); |
| 26883 | } |
| 26884 | } |
| 26885 | } |
| 26886 | out: |
| 26887 | return g_variant_builder_end (&builder); |
| 26888 | } |
| 26889 | |
| 26890 | static void |
| 26891 | host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 26892 | { |
| 26893 | } |
| 26894 | |
| 26895 | static void |
| 26896 | _host_ipmi_on_signal_received_message ( |
| 26897 | HostIpmi *object, |
| 26898 | guchar arg_seq, |
| 26899 | guchar arg_netfn, |
| 26900 | guchar arg_cmd, |
| 26901 | const gchar *arg_data) |
| 26902 | { |
| 26903 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 26904 | |
| 26905 | GList *connections, *l; |
| 26906 | GVariant *signal_variant; |
| 26907 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 26908 | |
| 26909 | signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)", |
| 26910 | arg_seq, |
| 26911 | arg_netfn, |
| 26912 | arg_cmd, |
| 26913 | arg_data)); |
| 26914 | for (l = connections; l != NULL; l = l->next) |
| 26915 | { |
| 26916 | GDBusConnection *connection = l->data; |
| 26917 | g_dbus_connection_emit_signal (connection, |
| 26918 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage", |
| 26919 | signal_variant, NULL); |
| 26920 | } |
| 26921 | g_variant_unref (signal_variant); |
| 26922 | g_list_free_full (connections, g_object_unref); |
| 26923 | } |
| 26924 | |
| 26925 | static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface); |
| 26926 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26927 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 26928 | G_ADD_PRIVATE (HostIpmiSkeleton) |
| 26929 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 26930 | |
| 26931 | #else |
| 26932 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 26933 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 26934 | |
| 26935 | #endif |
| 26936 | static void |
| 26937 | host_ipmi_skeleton_finalize (GObject *object) |
| 26938 | { |
| 26939 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 26940 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 26941 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 26942 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 26943 | g_main_context_unref (skeleton->priv->context); |
| 26944 | g_mutex_clear (&skeleton->priv->lock); |
| 26945 | G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object); |
| 26946 | } |
| 26947 | |
| 26948 | static void |
| 26949 | host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton) |
| 26950 | { |
| 26951 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26952 | skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton); |
| 26953 | #else |
| 26954 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate); |
| 26955 | #endif |
| 26956 | |
| 26957 | g_mutex_init (&skeleton->priv->lock); |
| 26958 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 26959 | } |
| 26960 | |
| 26961 | static void |
| 26962 | host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass) |
| 26963 | { |
| 26964 | GObjectClass *gobject_class; |
| 26965 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 26966 | |
| 26967 | gobject_class = G_OBJECT_CLASS (klass); |
| 26968 | gobject_class->finalize = host_ipmi_skeleton_finalize; |
| 26969 | |
| 26970 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 26971 | skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info; |
| 26972 | skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties; |
| 26973 | skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush; |
| 26974 | skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable; |
| 26975 | |
| 26976 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 26977 | g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate)); |
| 26978 | #endif |
| 26979 | } |
| 26980 | |
| 26981 | static void |
| 26982 | host_ipmi_skeleton_iface_init (HostIpmiIface *iface) |
| 26983 | { |
| 26984 | iface->received_message = _host_ipmi_on_signal_received_message; |
| 26985 | } |
| 26986 | |
| 26987 | /** |
| 26988 | * host_ipmi_skeleton_new: |
| 26989 | * |
| 26990 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 26991 | * |
| 26992 | * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object. |
| 26993 | */ |
| 26994 | HostIpmi * |
| 26995 | host_ipmi_skeleton_new (void) |
| 26996 | { |
| 26997 | return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL)); |
| 26998 | } |
| 26999 | |
| 27000 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27001 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 27002 | * ------------------------------------------------------------------------ |
| 27003 | */ |
| 27004 | |
| 27005 | /** |
| 27006 | * SECTION:Object |
| 27007 | * @title: Object |
| 27008 | * @short_description: Specialized GDBusObject types |
| 27009 | * |
| 27010 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 27011 | */ |
| 27012 | |
| 27013 | /** |
| 27014 | * Object: |
| 27015 | * |
| 27016 | * The #Object type is a specialized container of interfaces. |
| 27017 | */ |
| 27018 | |
| 27019 | /** |
| 27020 | * ObjectIface: |
| 27021 | * @parent_iface: The parent interface. |
| 27022 | * |
| 27023 | * Virtual table for the #Object interface. |
| 27024 | */ |
| 27025 | |
| 27026 | typedef ObjectIface ObjectInterface; |
| 27027 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 27028 | |
| 27029 | static void |
| 27030 | object_default_init (ObjectIface *iface) |
| 27031 | { |
| 27032 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27033 | * Object:fan: |
| 27034 | * |
| 27035 | * 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. |
| 27036 | * |
| 27037 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27038 | */ |
| 27039 | g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27040 | |
| 27041 | /** |
| 27042 | * Object:sensor-value: |
| 27043 | * |
| 27044 | * 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. |
| 27045 | * |
| 27046 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27047 | */ |
| 27048 | 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)); |
| 27049 | |
| 27050 | /** |
| 27051 | * Object:sensor-threshold: |
| 27052 | * |
| 27053 | * 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. |
| 27054 | * |
| 27055 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27056 | */ |
| 27057 | 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)); |
| 27058 | |
| 27059 | /** |
| 27060 | * Object:sensor-i2c: |
| 27061 | * |
| 27062 | * 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. |
| 27063 | * |
| 27064 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27065 | */ |
| 27066 | 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)); |
| 27067 | |
| 27068 | /** |
| 27069 | * Object:sensor-match: |
| 27070 | * |
| 27071 | * 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. |
| 27072 | * |
| 27073 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27074 | */ |
| 27075 | 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)); |
| 27076 | |
| 27077 | /** |
| 27078 | * Object:process: |
| 27079 | * |
| 27080 | * 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. |
| 27081 | * |
| 27082 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27083 | */ |
| 27084 | g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27085 | |
| 27086 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27087 | * Object:shared-resource: |
| 27088 | * |
| 27089 | * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any. |
| 27090 | * |
| 27091 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27092 | */ |
| 27093 | g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27094 | |
| 27095 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27096 | * Object:control: |
| 27097 | * |
| 27098 | * 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. |
| 27099 | * |
| 27100 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27101 | */ |
| 27102 | g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27103 | |
| 27104 | /** |
| 27105 | * Object:control-bmc: |
| 27106 | * |
| 27107 | * 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. |
| 27108 | * |
| 27109 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27110 | */ |
| 27111 | 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)); |
| 27112 | |
| 27113 | /** |
| 27114 | * Object:control-host: |
| 27115 | * |
| 27116 | * 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. |
| 27117 | * |
| 27118 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27119 | */ |
| 27120 | 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)); |
| 27121 | |
| 27122 | /** |
| 27123 | * Object:control-power: |
| 27124 | * |
| 27125 | * 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. |
| 27126 | * |
| 27127 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27128 | */ |
| 27129 | 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)); |
| 27130 | |
| 27131 | /** |
| 27132 | * Object:watchdog: |
| 27133 | * |
| 27134 | * 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. |
| 27135 | * |
| 27136 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27137 | */ |
| 27138 | g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27139 | |
| 27140 | /** |
| 27141 | * Object:event-log: |
| 27142 | * |
| 27143 | * 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. |
| 27144 | * |
| 27145 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27146 | */ |
| 27147 | 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)); |
| 27148 | |
| 27149 | /** |
| 27150 | * Object:flash: |
| 27151 | * |
| 27152 | * 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. |
| 27153 | * |
| 27154 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27155 | */ |
| 27156 | g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27157 | |
| 27158 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27159 | * Object:flash-control: |
| 27160 | * |
| 27161 | * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any. |
| 27162 | * |
| 27163 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27164 | */ |
| 27165 | g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27166 | |
| 27167 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27168 | * Object:button: |
| 27169 | * |
| 27170 | * 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. |
| 27171 | * |
| 27172 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27173 | */ |
| 27174 | g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27175 | |
| 27176 | /** |
| 27177 | * Object:led: |
| 27178 | * |
| 27179 | * 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. |
| 27180 | * |
| 27181 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27182 | */ |
| 27183 | g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27184 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 27185 | /** |
| 27186 | * Object:host-ipmi: |
| 27187 | * |
| 27188 | * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any. |
| 27189 | * |
| 27190 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 27191 | */ |
| 27192 | g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 27193 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27194 | } |
| 27195 | |
| 27196 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27197 | * object_get_fan: |
| 27198 | * @object: A #Object. |
| 27199 | * |
| 27200 | * 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. |
| 27201 | * |
| 27202 | * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27203 | */ |
| 27204 | Fan *object_get_fan (Object *object) |
| 27205 | { |
| 27206 | GDBusInterface *ret; |
| 27207 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 27208 | if (ret == NULL) |
| 27209 | return NULL; |
| 27210 | return FAN (ret); |
| 27211 | } |
| 27212 | |
| 27213 | /** |
| 27214 | * object_get_sensor_value: |
| 27215 | * @object: A #Object. |
| 27216 | * |
| 27217 | * 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. |
| 27218 | * |
| 27219 | * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27220 | */ |
| 27221 | SensorValue *object_get_sensor_value (Object *object) |
| 27222 | { |
| 27223 | GDBusInterface *ret; |
| 27224 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 27225 | if (ret == NULL) |
| 27226 | return NULL; |
| 27227 | return SENSOR_VALUE (ret); |
| 27228 | } |
| 27229 | |
| 27230 | /** |
| 27231 | * object_get_sensor_threshold: |
| 27232 | * @object: A #Object. |
| 27233 | * |
| 27234 | * 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. |
| 27235 | * |
| 27236 | * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27237 | */ |
| 27238 | SensorThreshold *object_get_sensor_threshold (Object *object) |
| 27239 | { |
| 27240 | GDBusInterface *ret; |
| 27241 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 27242 | if (ret == NULL) |
| 27243 | return NULL; |
| 27244 | return SENSOR_THRESHOLD (ret); |
| 27245 | } |
| 27246 | |
| 27247 | /** |
| 27248 | * object_get_sensor_i2c: |
| 27249 | * @object: A #Object. |
| 27250 | * |
| 27251 | * 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. |
| 27252 | * |
| 27253 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27254 | */ |
| 27255 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 27256 | { |
| 27257 | GDBusInterface *ret; |
| 27258 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 27259 | if (ret == NULL) |
| 27260 | return NULL; |
| 27261 | return SENSOR_I2C (ret); |
| 27262 | } |
| 27263 | |
| 27264 | /** |
| 27265 | * object_get_sensor_match: |
| 27266 | * @object: A #Object. |
| 27267 | * |
| 27268 | * 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. |
| 27269 | * |
| 27270 | * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27271 | */ |
| 27272 | SensorMatch *object_get_sensor_match (Object *object) |
| 27273 | { |
| 27274 | GDBusInterface *ret; |
| 27275 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 27276 | if (ret == NULL) |
| 27277 | return NULL; |
| 27278 | return SENSOR_MATCH (ret); |
| 27279 | } |
| 27280 | |
| 27281 | /** |
| 27282 | * object_get_process: |
| 27283 | * @object: A #Object. |
| 27284 | * |
| 27285 | * 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. |
| 27286 | * |
| 27287 | * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27288 | */ |
| 27289 | Process *object_get_process (Object *object) |
| 27290 | { |
| 27291 | GDBusInterface *ret; |
| 27292 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 27293 | if (ret == NULL) |
| 27294 | return NULL; |
| 27295 | return PROCESS (ret); |
| 27296 | } |
| 27297 | |
| 27298 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27299 | * object_get_shared_resource: |
| 27300 | * @object: A #Object. |
| 27301 | * |
| 27302 | * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any. |
| 27303 | * |
| 27304 | * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27305 | */ |
| 27306 | SharedResource *object_get_shared_resource (Object *object) |
| 27307 | { |
| 27308 | GDBusInterface *ret; |
| 27309 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 27310 | if (ret == NULL) |
| 27311 | return NULL; |
| 27312 | return SHARED_RESOURCE (ret); |
| 27313 | } |
| 27314 | |
| 27315 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27316 | * object_get_control: |
| 27317 | * @object: A #Object. |
| 27318 | * |
| 27319 | * 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. |
| 27320 | * |
| 27321 | * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27322 | */ |
| 27323 | Control *object_get_control (Object *object) |
| 27324 | { |
| 27325 | GDBusInterface *ret; |
| 27326 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 27327 | if (ret == NULL) |
| 27328 | return NULL; |
| 27329 | return CONTROL (ret); |
| 27330 | } |
| 27331 | |
| 27332 | /** |
| 27333 | * object_get_control_bmc: |
| 27334 | * @object: A #Object. |
| 27335 | * |
| 27336 | * 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. |
| 27337 | * |
| 27338 | * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27339 | */ |
| 27340 | ControlBmc *object_get_control_bmc (Object *object) |
| 27341 | { |
| 27342 | GDBusInterface *ret; |
| 27343 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 27344 | if (ret == NULL) |
| 27345 | return NULL; |
| 27346 | return CONTROL_BMC (ret); |
| 27347 | } |
| 27348 | |
| 27349 | /** |
| 27350 | * object_get_control_host: |
| 27351 | * @object: A #Object. |
| 27352 | * |
| 27353 | * 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. |
| 27354 | * |
| 27355 | * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27356 | */ |
| 27357 | ControlHost *object_get_control_host (Object *object) |
| 27358 | { |
| 27359 | GDBusInterface *ret; |
| 27360 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 27361 | if (ret == NULL) |
| 27362 | return NULL; |
| 27363 | return CONTROL_HOST (ret); |
| 27364 | } |
| 27365 | |
| 27366 | /** |
| 27367 | * object_get_control_power: |
| 27368 | * @object: A #Object. |
| 27369 | * |
| 27370 | * 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. |
| 27371 | * |
| 27372 | * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27373 | */ |
| 27374 | ControlPower *object_get_control_power (Object *object) |
| 27375 | { |
| 27376 | GDBusInterface *ret; |
| 27377 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 27378 | if (ret == NULL) |
| 27379 | return NULL; |
| 27380 | return CONTROL_POWER (ret); |
| 27381 | } |
| 27382 | |
| 27383 | /** |
| 27384 | * object_get_watchdog: |
| 27385 | * @object: A #Object. |
| 27386 | * |
| 27387 | * 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. |
| 27388 | * |
| 27389 | * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27390 | */ |
| 27391 | Watchdog *object_get_watchdog (Object *object) |
| 27392 | { |
| 27393 | GDBusInterface *ret; |
| 27394 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 27395 | if (ret == NULL) |
| 27396 | return NULL; |
| 27397 | return WATCHDOG (ret); |
| 27398 | } |
| 27399 | |
| 27400 | /** |
| 27401 | * object_get_event_log: |
| 27402 | * @object: A #Object. |
| 27403 | * |
| 27404 | * 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. |
| 27405 | * |
| 27406 | * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27407 | */ |
| 27408 | EventLog *object_get_event_log (Object *object) |
| 27409 | { |
| 27410 | GDBusInterface *ret; |
| 27411 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 27412 | if (ret == NULL) |
| 27413 | return NULL; |
| 27414 | return EVENT_LOG (ret); |
| 27415 | } |
| 27416 | |
| 27417 | /** |
| 27418 | * object_get_flash: |
| 27419 | * @object: A #Object. |
| 27420 | * |
| 27421 | * 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. |
| 27422 | * |
| 27423 | * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27424 | */ |
| 27425 | Flash *object_get_flash (Object *object) |
| 27426 | { |
| 27427 | GDBusInterface *ret; |
| 27428 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 27429 | if (ret == NULL) |
| 27430 | return NULL; |
| 27431 | return FLASH (ret); |
| 27432 | } |
| 27433 | |
| 27434 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27435 | * object_get_flash_control: |
| 27436 | * @object: A #Object. |
| 27437 | * |
| 27438 | * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any. |
| 27439 | * |
| 27440 | * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27441 | */ |
| 27442 | FlashControl *object_get_flash_control (Object *object) |
| 27443 | { |
| 27444 | GDBusInterface *ret; |
| 27445 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 27446 | if (ret == NULL) |
| 27447 | return NULL; |
| 27448 | return FLASH_CONTROL (ret); |
| 27449 | } |
| 27450 | |
| 27451 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27452 | * object_get_button: |
| 27453 | * @object: A #Object. |
| 27454 | * |
| 27455 | * 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. |
| 27456 | * |
| 27457 | * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27458 | */ |
| 27459 | Button *object_get_button (Object *object) |
| 27460 | { |
| 27461 | GDBusInterface *ret; |
| 27462 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 27463 | if (ret == NULL) |
| 27464 | return NULL; |
| 27465 | return BUTTON (ret); |
| 27466 | } |
| 27467 | |
| 27468 | /** |
| 27469 | * object_get_led: |
| 27470 | * @object: A #Object. |
| 27471 | * |
| 27472 | * 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. |
| 27473 | * |
| 27474 | * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27475 | */ |
| 27476 | Led *object_get_led (Object *object) |
| 27477 | { |
| 27478 | GDBusInterface *ret; |
| 27479 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 27480 | if (ret == NULL) |
| 27481 | return NULL; |
| 27482 | return LED (ret); |
| 27483 | } |
| 27484 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 27485 | /** |
| 27486 | * object_get_host_ipmi: |
| 27487 | * @object: A #Object. |
| 27488 | * |
| 27489 | * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any. |
| 27490 | * |
| 27491 | * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 27492 | */ |
| 27493 | HostIpmi *object_get_host_ipmi (Object *object) |
| 27494 | { |
| 27495 | GDBusInterface *ret; |
| 27496 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 27497 | if (ret == NULL) |
| 27498 | return NULL; |
| 27499 | return HOST_IPMI (ret); |
| 27500 | } |
| 27501 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27502 | |
| 27503 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27504 | * object_peek_fan: (skip) |
| 27505 | * @object: A #Object. |
| 27506 | * |
| 27507 | * Like object_get_fan() but doesn't increase the reference count on the returned object. |
| 27508 | * |
| 27509 | * <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> |
| 27510 | * |
| 27511 | * 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. |
| 27512 | */ |
| 27513 | Fan *object_peek_fan (Object *object) |
| 27514 | { |
| 27515 | GDBusInterface *ret; |
| 27516 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 27517 | if (ret == NULL) |
| 27518 | return NULL; |
| 27519 | g_object_unref (ret); |
| 27520 | return FAN (ret); |
| 27521 | } |
| 27522 | |
| 27523 | /** |
| 27524 | * object_peek_sensor_value: (skip) |
| 27525 | * @object: A #Object. |
| 27526 | * |
| 27527 | * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. |
| 27528 | * |
| 27529 | * <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> |
| 27530 | * |
| 27531 | * 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. |
| 27532 | */ |
| 27533 | SensorValue *object_peek_sensor_value (Object *object) |
| 27534 | { |
| 27535 | GDBusInterface *ret; |
| 27536 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 27537 | if (ret == NULL) |
| 27538 | return NULL; |
| 27539 | g_object_unref (ret); |
| 27540 | return SENSOR_VALUE (ret); |
| 27541 | } |
| 27542 | |
| 27543 | /** |
| 27544 | * object_peek_sensor_threshold: (skip) |
| 27545 | * @object: A #Object. |
| 27546 | * |
| 27547 | * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. |
| 27548 | * |
| 27549 | * <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> |
| 27550 | * |
| 27551 | * 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. |
| 27552 | */ |
| 27553 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
| 27554 | { |
| 27555 | GDBusInterface *ret; |
| 27556 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 27557 | if (ret == NULL) |
| 27558 | return NULL; |
| 27559 | g_object_unref (ret); |
| 27560 | return SENSOR_THRESHOLD (ret); |
| 27561 | } |
| 27562 | |
| 27563 | /** |
| 27564 | * object_peek_sensor_i2c: (skip) |
| 27565 | * @object: A #Object. |
| 27566 | * |
| 27567 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 27568 | * |
| 27569 | * <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> |
| 27570 | * |
| 27571 | * 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. |
| 27572 | */ |
| 27573 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 27574 | { |
| 27575 | GDBusInterface *ret; |
| 27576 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 27577 | if (ret == NULL) |
| 27578 | return NULL; |
| 27579 | g_object_unref (ret); |
| 27580 | return SENSOR_I2C (ret); |
| 27581 | } |
| 27582 | |
| 27583 | /** |
| 27584 | * object_peek_sensor_match: (skip) |
| 27585 | * @object: A #Object. |
| 27586 | * |
| 27587 | * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. |
| 27588 | * |
| 27589 | * <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> |
| 27590 | * |
| 27591 | * 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. |
| 27592 | */ |
| 27593 | SensorMatch *object_peek_sensor_match (Object *object) |
| 27594 | { |
| 27595 | GDBusInterface *ret; |
| 27596 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 27597 | if (ret == NULL) |
| 27598 | return NULL; |
| 27599 | g_object_unref (ret); |
| 27600 | return SENSOR_MATCH (ret); |
| 27601 | } |
| 27602 | |
| 27603 | /** |
| 27604 | * object_peek_process: (skip) |
| 27605 | * @object: A #Object. |
| 27606 | * |
| 27607 | * Like object_get_process() but doesn't increase the reference count on the returned object. |
| 27608 | * |
| 27609 | * <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> |
| 27610 | * |
| 27611 | * 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. |
| 27612 | */ |
| 27613 | Process *object_peek_process (Object *object) |
| 27614 | { |
| 27615 | GDBusInterface *ret; |
| 27616 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 27617 | if (ret == NULL) |
| 27618 | return NULL; |
| 27619 | g_object_unref (ret); |
| 27620 | return PROCESS (ret); |
| 27621 | } |
| 27622 | |
| 27623 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27624 | * object_peek_shared_resource: (skip) |
| 27625 | * @object: A #Object. |
| 27626 | * |
| 27627 | * Like object_get_shared_resource() but doesn't increase the reference count on the returned object. |
| 27628 | * |
| 27629 | * <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> |
| 27630 | * |
| 27631 | * Returns: (transfer none): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 27632 | */ |
| 27633 | SharedResource *object_peek_shared_resource (Object *object) |
| 27634 | { |
| 27635 | GDBusInterface *ret; |
| 27636 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 27637 | if (ret == NULL) |
| 27638 | return NULL; |
| 27639 | g_object_unref (ret); |
| 27640 | return SHARED_RESOURCE (ret); |
| 27641 | } |
| 27642 | |
| 27643 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27644 | * object_peek_control: (skip) |
| 27645 | * @object: A #Object. |
| 27646 | * |
| 27647 | * Like object_get_control() but doesn't increase the reference count on the returned object. |
| 27648 | * |
| 27649 | * <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> |
| 27650 | * |
| 27651 | * 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. |
| 27652 | */ |
| 27653 | Control *object_peek_control (Object *object) |
| 27654 | { |
| 27655 | GDBusInterface *ret; |
| 27656 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 27657 | if (ret == NULL) |
| 27658 | return NULL; |
| 27659 | g_object_unref (ret); |
| 27660 | return CONTROL (ret); |
| 27661 | } |
| 27662 | |
| 27663 | /** |
| 27664 | * object_peek_control_bmc: (skip) |
| 27665 | * @object: A #Object. |
| 27666 | * |
| 27667 | * Like object_get_control_bmc() but doesn't increase the reference count on the returned object. |
| 27668 | * |
| 27669 | * <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> |
| 27670 | * |
| 27671 | * 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. |
| 27672 | */ |
| 27673 | ControlBmc *object_peek_control_bmc (Object *object) |
| 27674 | { |
| 27675 | GDBusInterface *ret; |
| 27676 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 27677 | if (ret == NULL) |
| 27678 | return NULL; |
| 27679 | g_object_unref (ret); |
| 27680 | return CONTROL_BMC (ret); |
| 27681 | } |
| 27682 | |
| 27683 | /** |
| 27684 | * object_peek_control_host: (skip) |
| 27685 | * @object: A #Object. |
| 27686 | * |
| 27687 | * Like object_get_control_host() but doesn't increase the reference count on the returned object. |
| 27688 | * |
| 27689 | * <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> |
| 27690 | * |
| 27691 | * 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. |
| 27692 | */ |
| 27693 | ControlHost *object_peek_control_host (Object *object) |
| 27694 | { |
| 27695 | GDBusInterface *ret; |
| 27696 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 27697 | if (ret == NULL) |
| 27698 | return NULL; |
| 27699 | g_object_unref (ret); |
| 27700 | return CONTROL_HOST (ret); |
| 27701 | } |
| 27702 | |
| 27703 | /** |
| 27704 | * object_peek_control_power: (skip) |
| 27705 | * @object: A #Object. |
| 27706 | * |
| 27707 | * Like object_get_control_power() but doesn't increase the reference count on the returned object. |
| 27708 | * |
| 27709 | * <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> |
| 27710 | * |
| 27711 | * 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. |
| 27712 | */ |
| 27713 | ControlPower *object_peek_control_power (Object *object) |
| 27714 | { |
| 27715 | GDBusInterface *ret; |
| 27716 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 27717 | if (ret == NULL) |
| 27718 | return NULL; |
| 27719 | g_object_unref (ret); |
| 27720 | return CONTROL_POWER (ret); |
| 27721 | } |
| 27722 | |
| 27723 | /** |
| 27724 | * object_peek_watchdog: (skip) |
| 27725 | * @object: A #Object. |
| 27726 | * |
| 27727 | * Like object_get_watchdog() but doesn't increase the reference count on the returned object. |
| 27728 | * |
| 27729 | * <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> |
| 27730 | * |
| 27731 | * 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. |
| 27732 | */ |
| 27733 | Watchdog *object_peek_watchdog (Object *object) |
| 27734 | { |
| 27735 | GDBusInterface *ret; |
| 27736 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 27737 | if (ret == NULL) |
| 27738 | return NULL; |
| 27739 | g_object_unref (ret); |
| 27740 | return WATCHDOG (ret); |
| 27741 | } |
| 27742 | |
| 27743 | /** |
| 27744 | * object_peek_event_log: (skip) |
| 27745 | * @object: A #Object. |
| 27746 | * |
| 27747 | * Like object_get_event_log() but doesn't increase the reference count on the returned object. |
| 27748 | * |
| 27749 | * <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> |
| 27750 | * |
| 27751 | * 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. |
| 27752 | */ |
| 27753 | EventLog *object_peek_event_log (Object *object) |
| 27754 | { |
| 27755 | GDBusInterface *ret; |
| 27756 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 27757 | if (ret == NULL) |
| 27758 | return NULL; |
| 27759 | g_object_unref (ret); |
| 27760 | return EVENT_LOG (ret); |
| 27761 | } |
| 27762 | |
| 27763 | /** |
| 27764 | * object_peek_flash: (skip) |
| 27765 | * @object: A #Object. |
| 27766 | * |
| 27767 | * Like object_get_flash() but doesn't increase the reference count on the returned object. |
| 27768 | * |
| 27769 | * <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> |
| 27770 | * |
| 27771 | * 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. |
| 27772 | */ |
| 27773 | Flash *object_peek_flash (Object *object) |
| 27774 | { |
| 27775 | GDBusInterface *ret; |
| 27776 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 27777 | if (ret == NULL) |
| 27778 | return NULL; |
| 27779 | g_object_unref (ret); |
| 27780 | return FLASH (ret); |
| 27781 | } |
| 27782 | |
| 27783 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27784 | * object_peek_flash_control: (skip) |
| 27785 | * @object: A #Object. |
| 27786 | * |
| 27787 | * Like object_get_flash_control() but doesn't increase the reference count on the returned object. |
| 27788 | * |
| 27789 | * <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> |
| 27790 | * |
| 27791 | * Returns: (transfer none): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 27792 | */ |
| 27793 | FlashControl *object_peek_flash_control (Object *object) |
| 27794 | { |
| 27795 | GDBusInterface *ret; |
| 27796 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 27797 | if (ret == NULL) |
| 27798 | return NULL; |
| 27799 | g_object_unref (ret); |
| 27800 | return FLASH_CONTROL (ret); |
| 27801 | } |
| 27802 | |
| 27803 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27804 | * object_peek_button: (skip) |
| 27805 | * @object: A #Object. |
| 27806 | * |
| 27807 | * Like object_get_button() but doesn't increase the reference count on the returned object. |
| 27808 | * |
| 27809 | * <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> |
| 27810 | * |
| 27811 | * 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. |
| 27812 | */ |
| 27813 | Button *object_peek_button (Object *object) |
| 27814 | { |
| 27815 | GDBusInterface *ret; |
| 27816 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 27817 | if (ret == NULL) |
| 27818 | return NULL; |
| 27819 | g_object_unref (ret); |
| 27820 | return BUTTON (ret); |
| 27821 | } |
| 27822 | |
| 27823 | /** |
| 27824 | * object_peek_led: (skip) |
| 27825 | * @object: A #Object. |
| 27826 | * |
| 27827 | * Like object_get_led() but doesn't increase the reference count on the returned object. |
| 27828 | * |
| 27829 | * <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> |
| 27830 | * |
| 27831 | * 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. |
| 27832 | */ |
| 27833 | Led *object_peek_led (Object *object) |
| 27834 | { |
| 27835 | GDBusInterface *ret; |
| 27836 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 27837 | if (ret == NULL) |
| 27838 | return NULL; |
| 27839 | g_object_unref (ret); |
| 27840 | return LED (ret); |
| 27841 | } |
| 27842 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 27843 | /** |
| 27844 | * object_peek_host_ipmi: (skip) |
| 27845 | * @object: A #Object. |
| 27846 | * |
| 27847 | * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object. |
| 27848 | * |
| 27849 | * <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> |
| 27850 | * |
| 27851 | * Returns: (transfer none): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 27852 | */ |
| 27853 | HostIpmi *object_peek_host_ipmi (Object *object) |
| 27854 | { |
| 27855 | GDBusInterface *ret; |
| 27856 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 27857 | if (ret == NULL) |
| 27858 | return NULL; |
| 27859 | g_object_unref (ret); |
| 27860 | return HOST_IPMI (ret); |
| 27861 | } |
| 27862 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27863 | |
| 27864 | static void |
| 27865 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 27866 | { |
| 27867 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 27868 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 27869 | * anything about, for example old generated code in this process talking to |
| 27870 | * newer generated code in the other process. */ |
| 27871 | if (info != NULL) |
| 27872 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 27873 | } |
| 27874 | |
| 27875 | /** |
| 27876 | * ObjectProxy: |
| 27877 | * |
| 27878 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 27879 | */ |
| 27880 | |
| 27881 | /** |
| 27882 | * ObjectProxyClass: |
| 27883 | * @parent_class: The parent class. |
| 27884 | * |
| 27885 | * Class structure for #ObjectProxy. |
| 27886 | */ |
| 27887 | |
| 27888 | static void |
| 27889 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 27890 | { |
| 27891 | } |
| 27892 | |
| 27893 | static void |
| 27894 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 27895 | { |
| 27896 | iface->interface_added = object_notify; |
| 27897 | iface->interface_removed = object_notify; |
| 27898 | } |
| 27899 | |
| 27900 | |
| 27901 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 27902 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 27903 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 27904 | |
| 27905 | static void |
| 27906 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 27907 | { |
| 27908 | } |
| 27909 | |
| 27910 | static void |
| 27911 | object_proxy_set_property (GObject *gobject, |
| 27912 | guint prop_id, |
| 27913 | const GValue *value G_GNUC_UNUSED, |
| 27914 | GParamSpec *pspec) |
| 27915 | { |
| 27916 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 27917 | } |
| 27918 | |
| 27919 | static void |
| 27920 | object_proxy_get_property (GObject *gobject, |
| 27921 | guint prop_id, |
| 27922 | GValue *value, |
| 27923 | GParamSpec *pspec) |
| 27924 | { |
| 27925 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 27926 | GDBusInterface *interface; |
| 27927 | |
| 27928 | switch (prop_id) |
| 27929 | { |
| 27930 | case 1: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27931 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 27932 | g_value_take_object (value, interface); |
| 27933 | break; |
| 27934 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27935 | case 2: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27936 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 27937 | g_value_take_object (value, interface); |
| 27938 | break; |
| 27939 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27940 | case 3: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 27941 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27942 | g_value_take_object (value, interface); |
| 27943 | break; |
| 27944 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27945 | case 4: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 27946 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27947 | g_value_take_object (value, interface); |
| 27948 | break; |
| 27949 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27950 | case 5: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 27951 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27952 | g_value_take_object (value, interface); |
| 27953 | break; |
| 27954 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27955 | case 6: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 27956 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27957 | g_value_take_object (value, interface); |
| 27958 | break; |
| 27959 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27960 | case 7: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27961 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27962 | g_value_take_object (value, interface); |
| 27963 | break; |
| 27964 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27965 | case 8: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27966 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27967 | g_value_take_object (value, interface); |
| 27968 | break; |
| 27969 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27970 | case 9: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27971 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27972 | g_value_take_object (value, interface); |
| 27973 | break; |
| 27974 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27975 | case 10: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27976 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27977 | g_value_take_object (value, interface); |
| 27978 | break; |
| 27979 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27980 | case 11: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27981 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27982 | g_value_take_object (value, interface); |
| 27983 | break; |
| 27984 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27985 | case 12: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27986 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27987 | g_value_take_object (value, interface); |
| 27988 | break; |
| 27989 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27990 | case 13: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27991 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27992 | g_value_take_object (value, interface); |
| 27993 | break; |
| 27994 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 27995 | case 14: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 27996 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 27997 | g_value_take_object (value, interface); |
| 27998 | break; |
| 27999 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28000 | case 15: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28001 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28002 | g_value_take_object (value, interface); |
| 28003 | break; |
| 28004 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28005 | case 16: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28006 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 28007 | g_value_take_object (value, interface); |
| 28008 | break; |
| 28009 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28010 | case 17: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28011 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 28012 | g_value_take_object (value, interface); |
| 28013 | break; |
| 28014 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28015 | case 18: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 28016 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 28017 | g_value_take_object (value, interface); |
| 28018 | break; |
| 28019 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28020 | default: |
| 28021 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 28022 | break; |
| 28023 | } |
| 28024 | } |
| 28025 | |
| 28026 | static void |
| 28027 | object_proxy_class_init (ObjectProxyClass *klass) |
| 28028 | { |
| 28029 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 28030 | |
| 28031 | gobject_class->set_property = object_proxy_set_property; |
| 28032 | gobject_class->get_property = object_proxy_get_property; |
| 28033 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28034 | g_object_class_override_property (gobject_class, 1, "fan"); |
| 28035 | g_object_class_override_property (gobject_class, 2, "sensor-value"); |
| 28036 | g_object_class_override_property (gobject_class, 3, "sensor-threshold"); |
| 28037 | g_object_class_override_property (gobject_class, 4, "sensor-i2c"); |
| 28038 | g_object_class_override_property (gobject_class, 5, "sensor-match"); |
| 28039 | g_object_class_override_property (gobject_class, 6, "process"); |
| 28040 | g_object_class_override_property (gobject_class, 7, "shared-resource"); |
| 28041 | g_object_class_override_property (gobject_class, 8, "control"); |
| 28042 | g_object_class_override_property (gobject_class, 9, "control-bmc"); |
| 28043 | g_object_class_override_property (gobject_class, 10, "control-host"); |
| 28044 | g_object_class_override_property (gobject_class, 11, "control-power"); |
| 28045 | g_object_class_override_property (gobject_class, 12, "watchdog"); |
| 28046 | g_object_class_override_property (gobject_class, 13, "event-log"); |
| 28047 | g_object_class_override_property (gobject_class, 14, "flash"); |
| 28048 | g_object_class_override_property (gobject_class, 15, "flash-control"); |
| 28049 | g_object_class_override_property (gobject_class, 16, "button"); |
| 28050 | g_object_class_override_property (gobject_class, 17, "led"); |
| 28051 | g_object_class_override_property (gobject_class, 18, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28052 | } |
| 28053 | |
| 28054 | /** |
| 28055 | * object_proxy_new: |
| 28056 | * @connection: A #GDBusConnection. |
| 28057 | * @object_path: An object path. |
| 28058 | * |
| 28059 | * Creates a new proxy object. |
| 28060 | * |
| 28061 | * Returns: (transfer full): The proxy object. |
| 28062 | */ |
| 28063 | ObjectProxy * |
| 28064 | object_proxy_new (GDBusConnection *connection, |
| 28065 | const gchar *object_path) |
| 28066 | { |
| 28067 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 28068 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 28069 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 28070 | } |
| 28071 | |
| 28072 | /** |
| 28073 | * ObjectSkeleton: |
| 28074 | * |
| 28075 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 28076 | */ |
| 28077 | |
| 28078 | /** |
| 28079 | * ObjectSkeletonClass: |
| 28080 | * @parent_class: The parent class. |
| 28081 | * |
| 28082 | * Class structure for #ObjectSkeleton. |
| 28083 | */ |
| 28084 | |
| 28085 | static void |
| 28086 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 28087 | { |
| 28088 | } |
| 28089 | |
| 28090 | |
| 28091 | static void |
| 28092 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 28093 | { |
| 28094 | iface->interface_added = object_notify; |
| 28095 | iface->interface_removed = object_notify; |
| 28096 | } |
| 28097 | |
| 28098 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 28099 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 28100 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 28101 | |
| 28102 | static void |
| 28103 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 28104 | { |
| 28105 | } |
| 28106 | |
| 28107 | static void |
| 28108 | object_skeleton_set_property (GObject *gobject, |
| 28109 | guint prop_id, |
| 28110 | const GValue *value, |
| 28111 | GParamSpec *pspec) |
| 28112 | { |
| 28113 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 28114 | GDBusInterfaceSkeleton *interface; |
| 28115 | |
| 28116 | switch (prop_id) |
| 28117 | { |
| 28118 | case 1: |
| 28119 | interface = g_value_get_object (value); |
| 28120 | if (interface != NULL) |
| 28121 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28122 | g_warn_if_fail (IS_FAN (interface)); |
| 28123 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28124 | } |
| 28125 | else |
| 28126 | { |
| 28127 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan"); |
| 28128 | } |
| 28129 | break; |
| 28130 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28131 | case 2: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28132 | interface = g_value_get_object (value); |
| 28133 | if (interface != NULL) |
| 28134 | { |
| 28135 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
| 28136 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28137 | } |
| 28138 | else |
| 28139 | { |
| 28140 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); |
| 28141 | } |
| 28142 | break; |
| 28143 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28144 | case 3: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28145 | interface = g_value_get_object (value); |
| 28146 | if (interface != NULL) |
| 28147 | { |
| 28148 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
| 28149 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28150 | } |
| 28151 | else |
| 28152 | { |
| 28153 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); |
| 28154 | } |
| 28155 | break; |
| 28156 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28157 | case 4: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28158 | interface = g_value_get_object (value); |
| 28159 | if (interface != NULL) |
| 28160 | { |
| 28161 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
| 28162 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28163 | } |
| 28164 | else |
| 28165 | { |
| 28166 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); |
| 28167 | } |
| 28168 | break; |
| 28169 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28170 | case 5: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28171 | interface = g_value_get_object (value); |
| 28172 | if (interface != NULL) |
| 28173 | { |
| 28174 | g_warn_if_fail (IS_SENSOR_MATCH (interface)); |
| 28175 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28176 | } |
| 28177 | else |
| 28178 | { |
| 28179 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); |
| 28180 | } |
| 28181 | break; |
| 28182 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28183 | case 6: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28184 | interface = g_value_get_object (value); |
| 28185 | if (interface != NULL) |
| 28186 | { |
| 28187 | g_warn_if_fail (IS_PROCESS (interface)); |
| 28188 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28189 | } |
| 28190 | else |
| 28191 | { |
| 28192 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process"); |
| 28193 | } |
| 28194 | break; |
| 28195 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28196 | case 7: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28197 | interface = g_value_get_object (value); |
| 28198 | if (interface != NULL) |
| 28199 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28200 | g_warn_if_fail (IS_SHARED_RESOURCE (interface)); |
| 28201 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28202 | } |
| 28203 | else |
| 28204 | { |
| 28205 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource"); |
| 28206 | } |
| 28207 | break; |
| 28208 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28209 | case 8: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28210 | interface = g_value_get_object (value); |
| 28211 | if (interface != NULL) |
| 28212 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28213 | g_warn_if_fail (IS_CONTROL (interface)); |
| 28214 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28215 | } |
| 28216 | else |
| 28217 | { |
| 28218 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control"); |
| 28219 | } |
| 28220 | break; |
| 28221 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28222 | case 9: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28223 | interface = g_value_get_object (value); |
| 28224 | if (interface != NULL) |
| 28225 | { |
| 28226 | g_warn_if_fail (IS_CONTROL_BMC (interface)); |
| 28227 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28228 | } |
| 28229 | else |
| 28230 | { |
| 28231 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc"); |
| 28232 | } |
| 28233 | break; |
| 28234 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28235 | case 10: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28236 | interface = g_value_get_object (value); |
| 28237 | if (interface != NULL) |
| 28238 | { |
| 28239 | g_warn_if_fail (IS_CONTROL_HOST (interface)); |
| 28240 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28241 | } |
| 28242 | else |
| 28243 | { |
| 28244 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host"); |
| 28245 | } |
| 28246 | break; |
| 28247 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28248 | case 11: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28249 | interface = g_value_get_object (value); |
| 28250 | if (interface != NULL) |
| 28251 | { |
| 28252 | g_warn_if_fail (IS_CONTROL_POWER (interface)); |
| 28253 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28254 | } |
| 28255 | else |
| 28256 | { |
| 28257 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power"); |
| 28258 | } |
| 28259 | break; |
| 28260 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28261 | case 12: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28262 | interface = g_value_get_object (value); |
| 28263 | if (interface != NULL) |
| 28264 | { |
| 28265 | g_warn_if_fail (IS_WATCHDOG (interface)); |
| 28266 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28267 | } |
| 28268 | else |
| 28269 | { |
| 28270 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); |
| 28271 | } |
| 28272 | break; |
| 28273 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28274 | case 13: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28275 | interface = g_value_get_object (value); |
| 28276 | if (interface != NULL) |
| 28277 | { |
| 28278 | g_warn_if_fail (IS_EVENT_LOG (interface)); |
| 28279 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28280 | } |
| 28281 | else |
| 28282 | { |
| 28283 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog"); |
| 28284 | } |
| 28285 | break; |
| 28286 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28287 | case 14: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28288 | interface = g_value_get_object (value); |
| 28289 | if (interface != NULL) |
| 28290 | { |
| 28291 | g_warn_if_fail (IS_FLASH (interface)); |
| 28292 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28293 | } |
| 28294 | else |
| 28295 | { |
| 28296 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash"); |
| 28297 | } |
| 28298 | break; |
| 28299 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28300 | case 15: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28301 | interface = g_value_get_object (value); |
| 28302 | if (interface != NULL) |
| 28303 | { |
| 28304 | g_warn_if_fail (IS_FLASH_CONTROL (interface)); |
| 28305 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28306 | } |
| 28307 | else |
| 28308 | { |
| 28309 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl"); |
| 28310 | } |
| 28311 | break; |
| 28312 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28313 | case 16: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28314 | interface = g_value_get_object (value); |
| 28315 | if (interface != NULL) |
| 28316 | { |
| 28317 | g_warn_if_fail (IS_BUTTON (interface)); |
| 28318 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28319 | } |
| 28320 | else |
| 28321 | { |
| 28322 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button"); |
| 28323 | } |
| 28324 | break; |
| 28325 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28326 | case 17: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28327 | interface = g_value_get_object (value); |
| 28328 | if (interface != NULL) |
| 28329 | { |
| 28330 | g_warn_if_fail (IS_LED (interface)); |
| 28331 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28332 | } |
| 28333 | else |
| 28334 | { |
| 28335 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led"); |
| 28336 | } |
| 28337 | break; |
| 28338 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28339 | case 18: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 28340 | interface = g_value_get_object (value); |
| 28341 | if (interface != NULL) |
| 28342 | { |
| 28343 | g_warn_if_fail (IS_HOST_IPMI (interface)); |
| 28344 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 28345 | } |
| 28346 | else |
| 28347 | { |
| 28348 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi"); |
| 28349 | } |
| 28350 | break; |
| 28351 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28352 | default: |
| 28353 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 28354 | break; |
| 28355 | } |
| 28356 | } |
| 28357 | |
| 28358 | static void |
| 28359 | object_skeleton_get_property (GObject *gobject, |
| 28360 | guint prop_id, |
| 28361 | GValue *value, |
| 28362 | GParamSpec *pspec) |
| 28363 | { |
| 28364 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 28365 | GDBusInterface *interface; |
| 28366 | |
| 28367 | switch (prop_id) |
| 28368 | { |
| 28369 | case 1: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28370 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 28371 | g_value_take_object (value, interface); |
| 28372 | break; |
| 28373 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28374 | case 2: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28375 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 28376 | g_value_take_object (value, interface); |
| 28377 | break; |
| 28378 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28379 | case 3: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 28380 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28381 | g_value_take_object (value, interface); |
| 28382 | break; |
| 28383 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28384 | case 4: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 28385 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28386 | g_value_take_object (value, interface); |
| 28387 | break; |
| 28388 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28389 | case 5: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 28390 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28391 | g_value_take_object (value, interface); |
| 28392 | break; |
| 28393 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28394 | case 6: |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 28395 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28396 | g_value_take_object (value, interface); |
| 28397 | break; |
| 28398 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28399 | case 7: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28400 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28401 | g_value_take_object (value, interface); |
| 28402 | break; |
| 28403 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28404 | case 8: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28405 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28406 | g_value_take_object (value, interface); |
| 28407 | break; |
| 28408 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28409 | case 9: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28410 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28411 | g_value_take_object (value, interface); |
| 28412 | break; |
| 28413 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28414 | case 10: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28415 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28416 | g_value_take_object (value, interface); |
| 28417 | break; |
| 28418 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28419 | case 11: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28420 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28421 | g_value_take_object (value, interface); |
| 28422 | break; |
| 28423 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28424 | case 12: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28425 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28426 | g_value_take_object (value, interface); |
| 28427 | break; |
| 28428 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28429 | case 13: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28430 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28431 | g_value_take_object (value, interface); |
| 28432 | break; |
| 28433 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28434 | case 14: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28435 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 28436 | g_value_take_object (value, interface); |
| 28437 | break; |
| 28438 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28439 | case 15: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28440 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28441 | g_value_take_object (value, interface); |
| 28442 | break; |
| 28443 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28444 | case 16: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28445 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 28446 | g_value_take_object (value, interface); |
| 28447 | break; |
| 28448 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28449 | case 17: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28450 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 28451 | g_value_take_object (value, interface); |
| 28452 | break; |
| 28453 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28454 | case 18: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 28455 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 28456 | g_value_take_object (value, interface); |
| 28457 | break; |
| 28458 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28459 | default: |
| 28460 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 28461 | break; |
| 28462 | } |
| 28463 | } |
| 28464 | |
| 28465 | static void |
| 28466 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 28467 | { |
| 28468 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 28469 | |
| 28470 | gobject_class->set_property = object_skeleton_set_property; |
| 28471 | gobject_class->get_property = object_skeleton_get_property; |
| 28472 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 28473 | g_object_class_override_property (gobject_class, 1, "fan"); |
| 28474 | g_object_class_override_property (gobject_class, 2, "sensor-value"); |
| 28475 | g_object_class_override_property (gobject_class, 3, "sensor-threshold"); |
| 28476 | g_object_class_override_property (gobject_class, 4, "sensor-i2c"); |
| 28477 | g_object_class_override_property (gobject_class, 5, "sensor-match"); |
| 28478 | g_object_class_override_property (gobject_class, 6, "process"); |
| 28479 | g_object_class_override_property (gobject_class, 7, "shared-resource"); |
| 28480 | g_object_class_override_property (gobject_class, 8, "control"); |
| 28481 | g_object_class_override_property (gobject_class, 9, "control-bmc"); |
| 28482 | g_object_class_override_property (gobject_class, 10, "control-host"); |
| 28483 | g_object_class_override_property (gobject_class, 11, "control-power"); |
| 28484 | g_object_class_override_property (gobject_class, 12, "watchdog"); |
| 28485 | g_object_class_override_property (gobject_class, 13, "event-log"); |
| 28486 | g_object_class_override_property (gobject_class, 14, "flash"); |
| 28487 | g_object_class_override_property (gobject_class, 15, "flash-control"); |
| 28488 | g_object_class_override_property (gobject_class, 16, "button"); |
| 28489 | g_object_class_override_property (gobject_class, 17, "led"); |
| 28490 | g_object_class_override_property (gobject_class, 18, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28491 | } |
| 28492 | |
| 28493 | /** |
| 28494 | * object_skeleton_new: |
| 28495 | * @object_path: An object path. |
| 28496 | * |
| 28497 | * Creates a new skeleton object. |
| 28498 | * |
| 28499 | * Returns: (transfer full): The skeleton object. |
| 28500 | */ |
| 28501 | ObjectSkeleton * |
| 28502 | object_skeleton_new (const gchar *object_path) |
| 28503 | { |
| 28504 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 28505 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 28506 | } |
| 28507 | |
| 28508 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28509 | * object_skeleton_set_fan: |
| 28510 | * @object: A #ObjectSkeleton. |
| 28511 | * @interface_: (allow-none): A #Fan or %NULL to clear the interface. |
| 28512 | * |
| 28513 | * 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. |
| 28514 | */ |
| 28515 | void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_) |
| 28516 | { |
| 28517 | g_object_set (G_OBJECT (object), "fan", interface_, NULL); |
| 28518 | } |
| 28519 | |
| 28520 | /** |
| 28521 | * object_skeleton_set_sensor_value: |
| 28522 | * @object: A #ObjectSkeleton. |
| 28523 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
| 28524 | * |
| 28525 | * 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. |
| 28526 | */ |
| 28527 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
| 28528 | { |
| 28529 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
| 28530 | } |
| 28531 | |
| 28532 | /** |
| 28533 | * object_skeleton_set_sensor_threshold: |
| 28534 | * @object: A #ObjectSkeleton. |
| 28535 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
| 28536 | * |
| 28537 | * 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. |
| 28538 | */ |
| 28539 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
| 28540 | { |
| 28541 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
| 28542 | } |
| 28543 | |
| 28544 | /** |
| 28545 | * object_skeleton_set_sensor_i2c: |
| 28546 | * @object: A #ObjectSkeleton. |
| 28547 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 28548 | * |
| 28549 | * 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. |
| 28550 | */ |
| 28551 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 28552 | { |
| 28553 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 28554 | } |
| 28555 | |
| 28556 | /** |
| 28557 | * object_skeleton_set_sensor_match: |
| 28558 | * @object: A #ObjectSkeleton. |
| 28559 | * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. |
| 28560 | * |
| 28561 | * 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. |
| 28562 | */ |
| 28563 | void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) |
| 28564 | { |
| 28565 | g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); |
| 28566 | } |
| 28567 | |
| 28568 | /** |
| 28569 | * object_skeleton_set_process: |
| 28570 | * @object: A #ObjectSkeleton. |
| 28571 | * @interface_: (allow-none): A #Process or %NULL to clear the interface. |
| 28572 | * |
| 28573 | * 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. |
| 28574 | */ |
| 28575 | void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_) |
| 28576 | { |
| 28577 | g_object_set (G_OBJECT (object), "process", interface_, NULL); |
| 28578 | } |
| 28579 | |
| 28580 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28581 | * object_skeleton_set_shared_resource: |
| 28582 | * @object: A #ObjectSkeleton. |
| 28583 | * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface. |
| 28584 | * |
| 28585 | * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object. |
| 28586 | */ |
| 28587 | void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_) |
| 28588 | { |
| 28589 | g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL); |
| 28590 | } |
| 28591 | |
| 28592 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28593 | * object_skeleton_set_control: |
| 28594 | * @object: A #ObjectSkeleton. |
| 28595 | * @interface_: (allow-none): A #Control or %NULL to clear the interface. |
| 28596 | * |
| 28597 | * 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. |
| 28598 | */ |
| 28599 | void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_) |
| 28600 | { |
| 28601 | g_object_set (G_OBJECT (object), "control", interface_, NULL); |
| 28602 | } |
| 28603 | |
| 28604 | /** |
| 28605 | * object_skeleton_set_control_bmc: |
| 28606 | * @object: A #ObjectSkeleton. |
| 28607 | * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface. |
| 28608 | * |
| 28609 | * 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. |
| 28610 | */ |
| 28611 | void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_) |
| 28612 | { |
| 28613 | g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL); |
| 28614 | } |
| 28615 | |
| 28616 | /** |
| 28617 | * object_skeleton_set_control_host: |
| 28618 | * @object: A #ObjectSkeleton. |
| 28619 | * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface. |
| 28620 | * |
| 28621 | * 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. |
| 28622 | */ |
| 28623 | void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_) |
| 28624 | { |
| 28625 | g_object_set (G_OBJECT (object), "control-host", interface_, NULL); |
| 28626 | } |
| 28627 | |
| 28628 | /** |
| 28629 | * object_skeleton_set_control_power: |
| 28630 | * @object: A #ObjectSkeleton. |
| 28631 | * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface. |
| 28632 | * |
| 28633 | * 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. |
| 28634 | */ |
| 28635 | void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_) |
| 28636 | { |
| 28637 | g_object_set (G_OBJECT (object), "control-power", interface_, NULL); |
| 28638 | } |
| 28639 | |
| 28640 | /** |
| 28641 | * object_skeleton_set_watchdog: |
| 28642 | * @object: A #ObjectSkeleton. |
| 28643 | * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. |
| 28644 | * |
| 28645 | * 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. |
| 28646 | */ |
| 28647 | void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) |
| 28648 | { |
| 28649 | g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); |
| 28650 | } |
| 28651 | |
| 28652 | /** |
| 28653 | * object_skeleton_set_event_log: |
| 28654 | * @object: A #ObjectSkeleton. |
| 28655 | * @interface_: (allow-none): A #EventLog or %NULL to clear the interface. |
| 28656 | * |
| 28657 | * 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. |
| 28658 | */ |
| 28659 | void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_) |
| 28660 | { |
| 28661 | g_object_set (G_OBJECT (object), "event-log", interface_, NULL); |
| 28662 | } |
| 28663 | |
| 28664 | /** |
| 28665 | * object_skeleton_set_flash: |
| 28666 | * @object: A #ObjectSkeleton. |
| 28667 | * @interface_: (allow-none): A #Flash or %NULL to clear the interface. |
| 28668 | * |
| 28669 | * 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. |
| 28670 | */ |
| 28671 | void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_) |
| 28672 | { |
| 28673 | g_object_set (G_OBJECT (object), "flash", interface_, NULL); |
| 28674 | } |
| 28675 | |
| 28676 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28677 | * object_skeleton_set_flash_control: |
| 28678 | * @object: A #ObjectSkeleton. |
| 28679 | * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface. |
| 28680 | * |
| 28681 | * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object. |
| 28682 | */ |
| 28683 | void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_) |
| 28684 | { |
| 28685 | g_object_set (G_OBJECT (object), "flash-control", interface_, NULL); |
| 28686 | } |
| 28687 | |
| 28688 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28689 | * object_skeleton_set_button: |
| 28690 | * @object: A #ObjectSkeleton. |
| 28691 | * @interface_: (allow-none): A #Button or %NULL to clear the interface. |
| 28692 | * |
| 28693 | * 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. |
| 28694 | */ |
| 28695 | void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_) |
| 28696 | { |
| 28697 | g_object_set (G_OBJECT (object), "button", interface_, NULL); |
| 28698 | } |
| 28699 | |
| 28700 | /** |
| 28701 | * object_skeleton_set_led: |
| 28702 | * @object: A #ObjectSkeleton. |
| 28703 | * @interface_: (allow-none): A #Led or %NULL to clear the interface. |
| 28704 | * |
| 28705 | * 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. |
| 28706 | */ |
| 28707 | void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_) |
| 28708 | { |
| 28709 | g_object_set (G_OBJECT (object), "led", interface_, NULL); |
| 28710 | } |
| 28711 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 28712 | /** |
| 28713 | * object_skeleton_set_host_ipmi: |
| 28714 | * @object: A #ObjectSkeleton. |
| 28715 | * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface. |
| 28716 | * |
| 28717 | * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object. |
| 28718 | */ |
| 28719 | void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_) |
| 28720 | { |
| 28721 | g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL); |
| 28722 | } |
| 28723 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28724 | |
| 28725 | /* ------------------------------------------------------------------------ |
| 28726 | * Code for ObjectManager client |
| 28727 | * ------------------------------------------------------------------------ |
| 28728 | */ |
| 28729 | |
| 28730 | /** |
| 28731 | * SECTION:ObjectManagerClient |
| 28732 | * @title: ObjectManagerClient |
| 28733 | * @short_description: Generated GDBusObjectManagerClient type |
| 28734 | * |
| 28735 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 28736 | */ |
| 28737 | |
| 28738 | /** |
| 28739 | * ObjectManagerClient: |
| 28740 | * |
| 28741 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 28742 | */ |
| 28743 | |
| 28744 | /** |
| 28745 | * ObjectManagerClientClass: |
| 28746 | * @parent_class: The parent class. |
| 28747 | * |
| 28748 | * Class structure for #ObjectManagerClient. |
| 28749 | */ |
| 28750 | |
| 28751 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 28752 | |
| 28753 | static void |
| 28754 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 28755 | { |
| 28756 | } |
| 28757 | |
| 28758 | static void |
| 28759 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 28760 | { |
| 28761 | } |
| 28762 | |
| 28763 | /** |
| 28764 | * object_manager_client_get_proxy_type: |
| 28765 | * @manager: A #GDBusObjectManagerClient. |
| 28766 | * @object_path: The object path of the remote object (unused). |
| 28767 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 28768 | * @user_data: User data (unused). |
| 28769 | * |
| 28770 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 28771 | * |
| 28772 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 28773 | */ |
| 28774 | GType |
| 28775 | 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) |
| 28776 | { |
| 28777 | static gsize once_init_value = 0; |
| 28778 | static GHashTable *lookup_hash; |
| 28779 | GType ret; |
| 28780 | |
| 28781 | if (interface_name == NULL) |
| 28782 | return TYPE_OBJECT_PROXY; |
| 28783 | if (g_once_init_enter (&once_init_value)) |
| 28784 | { |
| 28785 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28786 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY)); |
| 28787 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28788 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); |
| 28789 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
| 28790 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); |
| 28791 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY)); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28792 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28793 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY)); |
| 28794 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY)); |
| 28795 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY)); |
| 28796 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY)); |
| 28797 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); |
| 28798 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY)); |
| 28799 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY)); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 28800 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28801 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY)); |
| 28802 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY)); |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 28803 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28804 | g_once_init_leave (&once_init_value, 1); |
| 28805 | } |
| 28806 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 28807 | if (ret == (GType) 0) |
| 28808 | ret = G_TYPE_DBUS_PROXY; |
| 28809 | return ret; |
| 28810 | } |
| 28811 | |
| 28812 | /** |
| 28813 | * object_manager_client_new: |
| 28814 | * @connection: A #GDBusConnection. |
| 28815 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 28816 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28817 | * @object_path: An object path. |
| 28818 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28819 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28820 | * @user_data: User data to pass to @callback. |
| 28821 | * |
| 28822 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 28823 | * |
| 28824 | * 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. |
| 28825 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 28826 | * |
| 28827 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 28828 | */ |
| 28829 | void |
| 28830 | object_manager_client_new ( |
| 28831 | GDBusConnection *connection, |
| 28832 | GDBusObjectManagerClientFlags flags, |
| 28833 | const gchar *name, |
| 28834 | const gchar *object_path, |
| 28835 | GCancellable *cancellable, |
| 28836 | GAsyncReadyCallback callback, |
| 28837 | gpointer user_data) |
| 28838 | { |
| 28839 | 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); |
| 28840 | } |
| 28841 | |
| 28842 | /** |
| 28843 | * object_manager_client_new_finish: |
| 28844 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 28845 | * @error: Return location for error or %NULL |
| 28846 | * |
| 28847 | * Finishes an operation started with object_manager_client_new(). |
| 28848 | * |
| 28849 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 28850 | */ |
| 28851 | GDBusObjectManager * |
| 28852 | object_manager_client_new_finish ( |
| 28853 | GAsyncResult *res, |
| 28854 | GError **error) |
| 28855 | { |
| 28856 | GObject *ret; |
| 28857 | GObject *source_object; |
| 28858 | source_object = g_async_result_get_source_object (res); |
| 28859 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28860 | g_object_unref (source_object); |
| 28861 | if (ret != NULL) |
| 28862 | return G_DBUS_OBJECT_MANAGER (ret); |
| 28863 | else |
| 28864 | return NULL; |
| 28865 | } |
| 28866 | |
| 28867 | /** |
| 28868 | * object_manager_client_new_sync: |
| 28869 | * @connection: A #GDBusConnection. |
| 28870 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 28871 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28872 | * @object_path: An object path. |
| 28873 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28874 | * @error: Return location for error or %NULL |
| 28875 | * |
| 28876 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 28877 | * |
| 28878 | * The calling thread is blocked until a reply is received. |
| 28879 | * |
| 28880 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 28881 | * |
| 28882 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 28883 | */ |
| 28884 | GDBusObjectManager * |
| 28885 | object_manager_client_new_sync ( |
| 28886 | GDBusConnection *connection, |
| 28887 | GDBusObjectManagerClientFlags flags, |
| 28888 | const gchar *name, |
| 28889 | const gchar *object_path, |
| 28890 | GCancellable *cancellable, |
| 28891 | GError **error) |
| 28892 | { |
| 28893 | GInitable *ret; |
| 28894 | 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); |
| 28895 | if (ret != NULL) |
| 28896 | return G_DBUS_OBJECT_MANAGER (ret); |
| 28897 | else |
| 28898 | return NULL; |
| 28899 | } |
| 28900 | |
| 28901 | |
| 28902 | /** |
| 28903 | * object_manager_client_new_for_bus: |
| 28904 | * @bus_type: A #GBusType. |
| 28905 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 28906 | * @name: A bus name (well-known or unique). |
| 28907 | * @object_path: An object path. |
| 28908 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28909 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28910 | * @user_data: User data to pass to @callback. |
| 28911 | * |
| 28912 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 28913 | * |
| 28914 | * 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. |
| 28915 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 28916 | * |
| 28917 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 28918 | */ |
| 28919 | void |
| 28920 | object_manager_client_new_for_bus ( |
| 28921 | GBusType bus_type, |
| 28922 | GDBusObjectManagerClientFlags flags, |
| 28923 | const gchar *name, |
| 28924 | const gchar *object_path, |
| 28925 | GCancellable *cancellable, |
| 28926 | GAsyncReadyCallback callback, |
| 28927 | gpointer user_data) |
| 28928 | { |
| 28929 | 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); |
| 28930 | } |
| 28931 | |
| 28932 | /** |
| 28933 | * object_manager_client_new_for_bus_finish: |
| 28934 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 28935 | * @error: Return location for error or %NULL |
| 28936 | * |
| 28937 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 28938 | * |
| 28939 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 28940 | */ |
| 28941 | GDBusObjectManager * |
| 28942 | object_manager_client_new_for_bus_finish ( |
| 28943 | GAsyncResult *res, |
| 28944 | GError **error) |
| 28945 | { |
| 28946 | GObject *ret; |
| 28947 | GObject *source_object; |
| 28948 | source_object = g_async_result_get_source_object (res); |
| 28949 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28950 | g_object_unref (source_object); |
| 28951 | if (ret != NULL) |
| 28952 | return G_DBUS_OBJECT_MANAGER (ret); |
| 28953 | else |
| 28954 | return NULL; |
| 28955 | } |
| 28956 | |
| 28957 | /** |
| 28958 | * object_manager_client_new_for_bus_sync: |
| 28959 | * @bus_type: A #GBusType. |
| 28960 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 28961 | * @name: A bus name (well-known or unique). |
| 28962 | * @object_path: An object path. |
| 28963 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28964 | * @error: Return location for error or %NULL |
| 28965 | * |
| 28966 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 28967 | * |
| 28968 | * The calling thread is blocked until a reply is received. |
| 28969 | * |
| 28970 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 28971 | * |
| 28972 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 28973 | */ |
| 28974 | GDBusObjectManager * |
| 28975 | object_manager_client_new_for_bus_sync ( |
| 28976 | GBusType bus_type, |
| 28977 | GDBusObjectManagerClientFlags flags, |
| 28978 | const gchar *name, |
| 28979 | const gchar *object_path, |
| 28980 | GCancellable *cancellable, |
| 28981 | GError **error) |
| 28982 | { |
| 28983 | GInitable *ret; |
| 28984 | 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); |
| 28985 | if (ret != NULL) |
| 28986 | return G_DBUS_OBJECT_MANAGER (ret); |
| 28987 | else |
| 28988 | return NULL; |
| 28989 | } |
| 28990 | |
| 28991 | |