Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 1 | /* |
Norman James | 47750bc | 2015-10-20 09:46:10 -0500 | [diff] [blame] | 2 | * Generated by gdbus-codegen 2.40.2. DO NOT EDIT. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 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 | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 152 | * Code for interface org.openbmc.Object.Mapper |
| 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * SECTION:ObjectMapper |
| 158 | * @title: ObjectMapper |
| 159 | * @short_description: Generated C code for the org.openbmc.Object.Mapper D-Bus interface |
| 160 | * |
| 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface in C. |
| 162 | */ |
| 163 | |
| 164 | /* ---- Introspection data for org.openbmc.Object.Mapper ---- */ |
| 165 | |
| 166 | static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_object_path = |
| 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "object_path", |
| 171 | (gchar *) "s", |
| 172 | NULL |
| 173 | }, |
| 174 | FALSE |
| 175 | }; |
| 176 | |
| 177 | static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_interface_name = |
| 178 | { |
| 179 | { |
| 180 | -1, |
| 181 | (gchar *) "interface_name", |
| 182 | (gchar *) "s", |
| 183 | NULL |
| 184 | }, |
| 185 | FALSE |
| 186 | }; |
| 187 | |
| 188 | static const _ExtendedGDBusArgInfo * const _object_mapper_signal_info_object_added_ARG_pointers[] = |
| 189 | { |
| 190 | &_object_mapper_signal_info_object_added_ARG_object_path, |
| 191 | &_object_mapper_signal_info_object_added_ARG_interface_name, |
| 192 | NULL |
| 193 | }; |
| 194 | |
| 195 | static const _ExtendedGDBusSignalInfo _object_mapper_signal_info_object_added = |
| 196 | { |
| 197 | { |
| 198 | -1, |
| 199 | (gchar *) "ObjectAdded", |
| 200 | (GDBusArgInfo **) &_object_mapper_signal_info_object_added_ARG_pointers, |
| 201 | NULL |
| 202 | }, |
| 203 | "object-added" |
| 204 | }; |
| 205 | |
| 206 | static const _ExtendedGDBusSignalInfo * const _object_mapper_signal_info_pointers[] = |
| 207 | { |
| 208 | &_object_mapper_signal_info_object_added, |
| 209 | NULL |
| 210 | }; |
| 211 | |
| 212 | static const _ExtendedGDBusInterfaceInfo _object_mapper_interface_info = |
| 213 | { |
| 214 | { |
| 215 | -1, |
| 216 | (gchar *) "org.openbmc.Object.Mapper", |
| 217 | NULL, |
| 218 | (GDBusSignalInfo **) &_object_mapper_signal_info_pointers, |
| 219 | NULL, |
| 220 | NULL |
| 221 | }, |
| 222 | "object-mapper", |
| 223 | }; |
| 224 | |
| 225 | |
| 226 | /** |
| 227 | * object_mapper_interface_info: |
| 228 | * |
| 229 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface. |
| 230 | * |
| 231 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 232 | */ |
| 233 | GDBusInterfaceInfo * |
| 234 | object_mapper_interface_info (void) |
| 235 | { |
| 236 | return (GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct; |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * object_mapper_override_properties: |
| 241 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 242 | * @property_id_begin: The property id to assign to the first overridden property. |
| 243 | * |
| 244 | * Overrides all #GObject properties in the #ObjectMapper interface for a concrete class. |
| 245 | * The properties are overridden in the order they are defined. |
| 246 | * |
| 247 | * Returns: The last property id. |
| 248 | */ |
| 249 | guint |
| 250 | object_mapper_override_properties (GObjectClass *klass, guint property_id_begin) |
| 251 | { |
| 252 | return property_id_begin - 1; |
| 253 | } |
| 254 | |
| 255 | |
| 256 | |
| 257 | /** |
| 258 | * ObjectMapper: |
| 259 | * |
| 260 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. |
| 261 | */ |
| 262 | |
| 263 | /** |
| 264 | * ObjectMapperIface: |
| 265 | * @parent_iface: The parent interface. |
| 266 | * @object_added: Handler for the #ObjectMapper::object-added signal. |
| 267 | * |
| 268 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. |
| 269 | */ |
| 270 | |
| 271 | typedef ObjectMapperIface ObjectMapperInterface; |
| 272 | G_DEFINE_INTERFACE (ObjectMapper, object_mapper, G_TYPE_OBJECT); |
| 273 | |
| 274 | static void |
| 275 | object_mapper_default_init (ObjectMapperIface *iface) |
| 276 | { |
| 277 | /* GObject signals for received D-Bus signals: */ |
| 278 | /** |
| 279 | * ObjectMapper::object-added: |
| 280 | * @object: A #ObjectMapper. |
| 281 | * @arg_object_path: Argument. |
| 282 | * @arg_interface_name: Argument. |
| 283 | * |
| 284 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> is received. |
| 285 | * |
| 286 | * 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. |
| 287 | */ |
| 288 | g_signal_new ("object-added", |
| 289 | G_TYPE_FROM_INTERFACE (iface), |
| 290 | G_SIGNAL_RUN_LAST, |
| 291 | G_STRUCT_OFFSET (ObjectMapperIface, object_added), |
| 292 | NULL, |
| 293 | NULL, |
| 294 | g_cclosure_marshal_generic, |
| 295 | G_TYPE_NONE, |
| 296 | 2, G_TYPE_STRING, G_TYPE_STRING); |
| 297 | |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * object_mapper_emit_object_added: |
| 302 | * @object: A #ObjectMapper. |
| 303 | * @arg_object_path: Argument to pass with the signal. |
| 304 | * @arg_interface_name: Argument to pass with the signal. |
| 305 | * |
| 306 | * Emits the <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> D-Bus signal. |
| 307 | */ |
| 308 | void |
| 309 | object_mapper_emit_object_added ( |
| 310 | ObjectMapper *object, |
| 311 | const gchar *arg_object_path, |
| 312 | const gchar *arg_interface_name) |
| 313 | { |
| 314 | g_signal_emit_by_name (object, "object-added", arg_object_path, arg_interface_name); |
| 315 | } |
| 316 | |
| 317 | /* ------------------------------------------------------------------------ */ |
| 318 | |
| 319 | /** |
| 320 | * ObjectMapperProxy: |
| 321 | * |
| 322 | * The #ObjectMapperProxy structure contains only private data and should only be accessed using the provided API. |
| 323 | */ |
| 324 | |
| 325 | /** |
| 326 | * ObjectMapperProxyClass: |
| 327 | * @parent_class: The parent class. |
| 328 | * |
| 329 | * Class structure for #ObjectMapperProxy. |
| 330 | */ |
| 331 | |
| 332 | struct _ObjectMapperProxyPrivate |
| 333 | { |
| 334 | GData *qdata; |
| 335 | }; |
| 336 | |
| 337 | static void object_mapper_proxy_iface_init (ObjectMapperIface *iface); |
| 338 | |
| 339 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 340 | G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY, |
| 341 | G_ADD_PRIVATE (ObjectMapperProxy) |
| 342 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init)); |
| 343 | |
| 344 | #else |
| 345 | G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY, |
| 346 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init)); |
| 347 | |
| 348 | #endif |
| 349 | static void |
| 350 | object_mapper_proxy_finalize (GObject *object) |
| 351 | { |
| 352 | ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (object); |
| 353 | g_datalist_clear (&proxy->priv->qdata); |
| 354 | G_OBJECT_CLASS (object_mapper_proxy_parent_class)->finalize (object); |
| 355 | } |
| 356 | |
| 357 | static void |
| 358 | object_mapper_proxy_get_property (GObject *object, |
| 359 | guint prop_id, |
| 360 | GValue *value, |
| 361 | GParamSpec *pspec G_GNUC_UNUSED) |
| 362 | { |
| 363 | } |
| 364 | |
| 365 | static void |
| 366 | object_mapper_proxy_set_property (GObject *object, |
| 367 | guint prop_id, |
| 368 | const GValue *value, |
| 369 | GParamSpec *pspec G_GNUC_UNUSED) |
| 370 | { |
| 371 | } |
| 372 | |
| 373 | static void |
| 374 | object_mapper_proxy_g_signal (GDBusProxy *proxy, |
| 375 | const gchar *sender_name G_GNUC_UNUSED, |
| 376 | const gchar *signal_name, |
| 377 | GVariant *parameters) |
| 378 | { |
| 379 | _ExtendedGDBusSignalInfo *info; |
| 380 | GVariantIter iter; |
| 381 | GVariant *child; |
| 382 | GValue *paramv; |
| 383 | guint num_params; |
| 384 | guint n; |
| 385 | guint signal_id; |
| 386 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, signal_name); |
| 387 | if (info == NULL) |
| 388 | return; |
| 389 | num_params = g_variant_n_children (parameters); |
| 390 | paramv = g_new0 (GValue, num_params + 1); |
| 391 | g_value_init (¶mv[0], TYPE_OBJECT_MAPPER); |
| 392 | g_value_set_object (¶mv[0], proxy); |
| 393 | g_variant_iter_init (&iter, parameters); |
| 394 | n = 1; |
| 395 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 396 | { |
| 397 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 398 | if (arg_info->use_gvariant) |
| 399 | { |
| 400 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 401 | g_value_set_variant (¶mv[n], child); |
| 402 | n++; |
| 403 | } |
| 404 | else |
| 405 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 406 | g_variant_unref (child); |
| 407 | } |
| 408 | signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER); |
| 409 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 410 | for (n = 0; n < num_params + 1; n++) |
| 411 | g_value_unset (¶mv[n]); |
| 412 | g_free (paramv); |
| 413 | } |
| 414 | |
| 415 | static void |
| 416 | object_mapper_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 417 | GVariant *changed_properties, |
| 418 | const gchar *const *invalidated_properties) |
| 419 | { |
| 420 | ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (_proxy); |
| 421 | guint n; |
| 422 | const gchar *key; |
| 423 | GVariantIter *iter; |
| 424 | _ExtendedGDBusPropertyInfo *info; |
| 425 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 426 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 427 | { |
| 428 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, key); |
| 429 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 430 | if (info != NULL) |
| 431 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 432 | } |
| 433 | g_variant_iter_free (iter); |
| 434 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 435 | { |
| 436 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, invalidated_properties[n]); |
| 437 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 438 | if (info != NULL) |
| 439 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | static void |
| 444 | object_mapper_proxy_init (ObjectMapperProxy *proxy) |
| 445 | { |
| 446 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 447 | proxy->priv = object_mapper_proxy_get_instance_private (proxy); |
| 448 | #else |
| 449 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxyPrivate); |
| 450 | #endif |
| 451 | |
| 452 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), object_mapper_interface_info ()); |
| 453 | } |
| 454 | |
| 455 | static void |
| 456 | object_mapper_proxy_class_init (ObjectMapperProxyClass *klass) |
| 457 | { |
| 458 | GObjectClass *gobject_class; |
| 459 | GDBusProxyClass *proxy_class; |
| 460 | |
| 461 | gobject_class = G_OBJECT_CLASS (klass); |
| 462 | gobject_class->finalize = object_mapper_proxy_finalize; |
| 463 | gobject_class->get_property = object_mapper_proxy_get_property; |
| 464 | gobject_class->set_property = object_mapper_proxy_set_property; |
| 465 | |
| 466 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 467 | proxy_class->g_signal = object_mapper_proxy_g_signal; |
| 468 | proxy_class->g_properties_changed = object_mapper_proxy_g_properties_changed; |
| 469 | |
| 470 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 471 | g_type_class_add_private (klass, sizeof (ObjectMapperProxyPrivate)); |
| 472 | #endif |
| 473 | } |
| 474 | |
| 475 | static void |
| 476 | object_mapper_proxy_iface_init (ObjectMapperIface *iface) |
| 477 | { |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * object_mapper_proxy_new: |
| 482 | * @connection: A #GDBusConnection. |
| 483 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 484 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 485 | * @object_path: An object path. |
| 486 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 487 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 488 | * @user_data: User data to pass to @callback. |
| 489 | * |
| 490 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new() for more details. |
| 491 | * |
| 492 | * 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. |
| 493 | * You can then call object_mapper_proxy_new_finish() to get the result of the operation. |
| 494 | * |
| 495 | * See object_mapper_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 496 | */ |
| 497 | void |
| 498 | object_mapper_proxy_new ( |
| 499 | GDBusConnection *connection, |
| 500 | GDBusProxyFlags flags, |
| 501 | const gchar *name, |
| 502 | const gchar *object_path, |
| 503 | GCancellable *cancellable, |
| 504 | GAsyncReadyCallback callback, |
| 505 | gpointer user_data) |
| 506 | { |
| 507 | g_async_initable_new_async (TYPE_OBJECT_MAPPER_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.Object.Mapper", NULL); |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * object_mapper_proxy_new_finish: |
| 512 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new(). |
| 513 | * @error: Return location for error or %NULL |
| 514 | * |
| 515 | * Finishes an operation started with object_mapper_proxy_new(). |
| 516 | * |
| 517 | * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set. |
| 518 | */ |
| 519 | ObjectMapper * |
| 520 | object_mapper_proxy_new_finish ( |
| 521 | GAsyncResult *res, |
| 522 | GError **error) |
| 523 | { |
| 524 | GObject *ret; |
| 525 | GObject *source_object; |
| 526 | source_object = g_async_result_get_source_object (res); |
| 527 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 528 | g_object_unref (source_object); |
| 529 | if (ret != NULL) |
| 530 | return OBJECT_MAPPER (ret); |
| 531 | else |
| 532 | return NULL; |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * object_mapper_proxy_new_sync: |
| 537 | * @connection: A #GDBusConnection. |
| 538 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 539 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 540 | * @object_path: An object path. |
| 541 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 542 | * @error: Return location for error or %NULL |
| 543 | * |
| 544 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new_sync() for more details. |
| 545 | * |
| 546 | * The calling thread is blocked until a reply is received. |
| 547 | * |
| 548 | * See object_mapper_proxy_new() for the asynchronous version of this constructor. |
| 549 | * |
| 550 | * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set. |
| 551 | */ |
| 552 | ObjectMapper * |
| 553 | object_mapper_proxy_new_sync ( |
| 554 | GDBusConnection *connection, |
| 555 | GDBusProxyFlags flags, |
| 556 | const gchar *name, |
| 557 | const gchar *object_path, |
| 558 | GCancellable *cancellable, |
| 559 | GError **error) |
| 560 | { |
| 561 | GInitable *ret; |
| 562 | ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL); |
| 563 | if (ret != NULL) |
| 564 | return OBJECT_MAPPER (ret); |
| 565 | else |
| 566 | return NULL; |
| 567 | } |
| 568 | |
| 569 | |
| 570 | /** |
| 571 | * object_mapper_proxy_new_for_bus: |
| 572 | * @bus_type: A #GBusType. |
| 573 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 574 | * @name: A bus name (well-known or unique). |
| 575 | * @object_path: An object path. |
| 576 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 577 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 578 | * @user_data: User data to pass to @callback. |
| 579 | * |
| 580 | * Like object_mapper_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 581 | * |
| 582 | * 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. |
| 583 | * You can then call object_mapper_proxy_new_for_bus_finish() to get the result of the operation. |
| 584 | * |
| 585 | * See object_mapper_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 586 | */ |
| 587 | void |
| 588 | object_mapper_proxy_new_for_bus ( |
| 589 | GBusType bus_type, |
| 590 | GDBusProxyFlags flags, |
| 591 | const gchar *name, |
| 592 | const gchar *object_path, |
| 593 | GCancellable *cancellable, |
| 594 | GAsyncReadyCallback callback, |
| 595 | gpointer user_data) |
| 596 | { |
| 597 | g_async_initable_new_async (TYPE_OBJECT_MAPPER_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.Object.Mapper", NULL); |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * object_mapper_proxy_new_for_bus_finish: |
| 602 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new_for_bus(). |
| 603 | * @error: Return location for error or %NULL |
| 604 | * |
| 605 | * Finishes an operation started with object_mapper_proxy_new_for_bus(). |
| 606 | * |
| 607 | * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set. |
| 608 | */ |
| 609 | ObjectMapper * |
| 610 | object_mapper_proxy_new_for_bus_finish ( |
| 611 | GAsyncResult *res, |
| 612 | GError **error) |
| 613 | { |
| 614 | GObject *ret; |
| 615 | GObject *source_object; |
| 616 | source_object = g_async_result_get_source_object (res); |
| 617 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 618 | g_object_unref (source_object); |
| 619 | if (ret != NULL) |
| 620 | return OBJECT_MAPPER (ret); |
| 621 | else |
| 622 | return NULL; |
| 623 | } |
| 624 | |
| 625 | /** |
| 626 | * object_mapper_proxy_new_for_bus_sync: |
| 627 | * @bus_type: A #GBusType. |
| 628 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 629 | * @name: A bus name (well-known or unique). |
| 630 | * @object_path: An object path. |
| 631 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 632 | * @error: Return location for error or %NULL |
| 633 | * |
| 634 | * Like object_mapper_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 635 | * |
| 636 | * The calling thread is blocked until a reply is received. |
| 637 | * |
| 638 | * See object_mapper_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 639 | * |
| 640 | * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set. |
| 641 | */ |
| 642 | ObjectMapper * |
| 643 | object_mapper_proxy_new_for_bus_sync ( |
| 644 | GBusType bus_type, |
| 645 | GDBusProxyFlags flags, |
| 646 | const gchar *name, |
| 647 | const gchar *object_path, |
| 648 | GCancellable *cancellable, |
| 649 | GError **error) |
| 650 | { |
| 651 | GInitable *ret; |
| 652 | ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL); |
| 653 | if (ret != NULL) |
| 654 | return OBJECT_MAPPER (ret); |
| 655 | else |
| 656 | return NULL; |
| 657 | } |
| 658 | |
| 659 | |
| 660 | /* ------------------------------------------------------------------------ */ |
| 661 | |
| 662 | /** |
| 663 | * ObjectMapperSkeleton: |
| 664 | * |
| 665 | * The #ObjectMapperSkeleton structure contains only private data and should only be accessed using the provided API. |
| 666 | */ |
| 667 | |
| 668 | /** |
| 669 | * ObjectMapperSkeletonClass: |
| 670 | * @parent_class: The parent class. |
| 671 | * |
| 672 | * Class structure for #ObjectMapperSkeleton. |
| 673 | */ |
| 674 | |
| 675 | struct _ObjectMapperSkeletonPrivate |
| 676 | { |
| 677 | GValue *properties; |
| 678 | GList *changed_properties; |
| 679 | GSource *changed_properties_idle_source; |
| 680 | GMainContext *context; |
| 681 | GMutex lock; |
| 682 | }; |
| 683 | |
| 684 | static void |
| 685 | _object_mapper_skeleton_handle_method_call ( |
| 686 | GDBusConnection *connection G_GNUC_UNUSED, |
| 687 | const gchar *sender G_GNUC_UNUSED, |
| 688 | const gchar *object_path G_GNUC_UNUSED, |
| 689 | const gchar *interface_name, |
| 690 | const gchar *method_name, |
| 691 | GVariant *parameters, |
| 692 | GDBusMethodInvocation *invocation, |
| 693 | gpointer user_data) |
| 694 | { |
| 695 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data); |
| 696 | _ExtendedGDBusMethodInfo *info; |
| 697 | GVariantIter iter; |
| 698 | GVariant *child; |
| 699 | GValue *paramv; |
| 700 | guint num_params; |
| 701 | guint num_extra; |
| 702 | guint n; |
| 703 | guint signal_id; |
| 704 | GValue return_value = G_VALUE_INIT; |
| 705 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 706 | g_assert (info != NULL); |
| 707 | num_params = g_variant_n_children (parameters); |
| 708 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 709 | n = 0; |
| 710 | g_value_init (¶mv[n], TYPE_OBJECT_MAPPER); |
| 711 | g_value_set_object (¶mv[n++], skeleton); |
| 712 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 713 | g_value_set_object (¶mv[n++], invocation); |
| 714 | if (info->pass_fdlist) |
| 715 | { |
| 716 | #ifdef G_OS_UNIX |
| 717 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 718 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 719 | #else |
| 720 | g_assert_not_reached (); |
| 721 | #endif |
| 722 | } |
| 723 | g_variant_iter_init (&iter, parameters); |
| 724 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 725 | { |
| 726 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 727 | if (arg_info->use_gvariant) |
| 728 | { |
| 729 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 730 | g_value_set_variant (¶mv[n], child); |
| 731 | n++; |
| 732 | } |
| 733 | else |
| 734 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 735 | g_variant_unref (child); |
| 736 | } |
| 737 | signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER); |
| 738 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 739 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 740 | if (!g_value_get_boolean (&return_value)) |
| 741 | 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); |
| 742 | g_value_unset (&return_value); |
| 743 | for (n = 0; n < num_params + num_extra; n++) |
| 744 | g_value_unset (¶mv[n]); |
| 745 | g_free (paramv); |
| 746 | } |
| 747 | |
| 748 | static GVariant * |
| 749 | _object_mapper_skeleton_handle_get_property ( |
| 750 | GDBusConnection *connection G_GNUC_UNUSED, |
| 751 | const gchar *sender G_GNUC_UNUSED, |
| 752 | const gchar *object_path G_GNUC_UNUSED, |
| 753 | const gchar *interface_name G_GNUC_UNUSED, |
| 754 | const gchar *property_name, |
| 755 | GError **error, |
| 756 | gpointer user_data) |
| 757 | { |
| 758 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data); |
| 759 | GValue value = G_VALUE_INIT; |
| 760 | GParamSpec *pspec; |
| 761 | _ExtendedGDBusPropertyInfo *info; |
| 762 | GVariant *ret; |
| 763 | ret = NULL; |
| 764 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name); |
| 765 | g_assert (info != NULL); |
| 766 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 767 | if (pspec == NULL) |
| 768 | { |
| 769 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 770 | } |
| 771 | else |
| 772 | { |
| 773 | g_value_init (&value, pspec->value_type); |
| 774 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 775 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 776 | g_value_unset (&value); |
| 777 | } |
| 778 | return ret; |
| 779 | } |
| 780 | |
| 781 | static gboolean |
| 782 | _object_mapper_skeleton_handle_set_property ( |
| 783 | GDBusConnection *connection G_GNUC_UNUSED, |
| 784 | const gchar *sender G_GNUC_UNUSED, |
| 785 | const gchar *object_path G_GNUC_UNUSED, |
| 786 | const gchar *interface_name G_GNUC_UNUSED, |
| 787 | const gchar *property_name, |
| 788 | GVariant *variant, |
| 789 | GError **error, |
| 790 | gpointer user_data) |
| 791 | { |
| 792 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data); |
| 793 | GValue value = G_VALUE_INIT; |
| 794 | GParamSpec *pspec; |
| 795 | _ExtendedGDBusPropertyInfo *info; |
| 796 | gboolean ret; |
| 797 | ret = FALSE; |
| 798 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name); |
| 799 | g_assert (info != NULL); |
| 800 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 801 | if (pspec == NULL) |
| 802 | { |
| 803 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 804 | } |
| 805 | else |
| 806 | { |
| 807 | if (info->use_gvariant) |
| 808 | g_value_set_variant (&value, variant); |
| 809 | else |
| 810 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 811 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 812 | g_value_unset (&value); |
| 813 | ret = TRUE; |
| 814 | } |
| 815 | return ret; |
| 816 | } |
| 817 | |
| 818 | static const GDBusInterfaceVTable _object_mapper_skeleton_vtable = |
| 819 | { |
| 820 | _object_mapper_skeleton_handle_method_call, |
| 821 | _object_mapper_skeleton_handle_get_property, |
| 822 | _object_mapper_skeleton_handle_set_property, |
| 823 | {NULL} |
| 824 | }; |
| 825 | |
| 826 | static GDBusInterfaceInfo * |
| 827 | object_mapper_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 828 | { |
| 829 | return object_mapper_interface_info (); |
| 830 | } |
| 831 | |
| 832 | static GDBusInterfaceVTable * |
| 833 | object_mapper_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 834 | { |
| 835 | return (GDBusInterfaceVTable *) &_object_mapper_skeleton_vtable; |
| 836 | } |
| 837 | |
| 838 | static GVariant * |
| 839 | object_mapper_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 840 | { |
| 841 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (_skeleton); |
| 842 | |
| 843 | GVariantBuilder builder; |
| 844 | guint n; |
| 845 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 846 | if (_object_mapper_interface_info.parent_struct.properties == NULL) |
| 847 | goto out; |
| 848 | for (n = 0; _object_mapper_interface_info.parent_struct.properties[n] != NULL; n++) |
| 849 | { |
| 850 | GDBusPropertyInfo *info = _object_mapper_interface_info.parent_struct.properties[n]; |
| 851 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 852 | { |
| 853 | GVariant *value; |
| 854 | value = _object_mapper_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.Object.Mapper", info->name, NULL, skeleton); |
| 855 | if (value != NULL) |
| 856 | { |
| 857 | g_variant_take_ref (value); |
| 858 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 859 | g_variant_unref (value); |
| 860 | } |
| 861 | } |
| 862 | } |
| 863 | out: |
| 864 | return g_variant_builder_end (&builder); |
| 865 | } |
| 866 | |
| 867 | static void |
| 868 | object_mapper_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 869 | { |
| 870 | } |
| 871 | |
| 872 | static void |
| 873 | _object_mapper_on_signal_object_added ( |
| 874 | ObjectMapper *object, |
| 875 | const gchar *arg_object_path, |
| 876 | const gchar *arg_interface_name) |
| 877 | { |
| 878 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object); |
| 879 | |
| 880 | GList *connections, *l; |
| 881 | GVariant *signal_variant; |
| 882 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 883 | |
| 884 | signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", |
| 885 | arg_object_path, |
| 886 | arg_interface_name)); |
| 887 | for (l = connections; l != NULL; l = l->next) |
| 888 | { |
| 889 | GDBusConnection *connection = l->data; |
| 890 | g_dbus_connection_emit_signal (connection, |
| 891 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Object.Mapper", "ObjectAdded", |
| 892 | signal_variant, NULL); |
| 893 | } |
| 894 | g_variant_unref (signal_variant); |
| 895 | g_list_free_full (connections, g_object_unref); |
| 896 | } |
| 897 | |
| 898 | static void object_mapper_skeleton_iface_init (ObjectMapperIface *iface); |
| 899 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 900 | G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 901 | G_ADD_PRIVATE (ObjectMapperSkeleton) |
| 902 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init)); |
| 903 | |
| 904 | #else |
| 905 | G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 906 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init)); |
| 907 | |
| 908 | #endif |
| 909 | static void |
| 910 | object_mapper_skeleton_finalize (GObject *object) |
| 911 | { |
| 912 | ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object); |
| 913 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 914 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 915 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 916 | g_main_context_unref (skeleton->priv->context); |
| 917 | g_mutex_clear (&skeleton->priv->lock); |
| 918 | G_OBJECT_CLASS (object_mapper_skeleton_parent_class)->finalize (object); |
| 919 | } |
| 920 | |
| 921 | static void |
| 922 | object_mapper_skeleton_init (ObjectMapperSkeleton *skeleton) |
| 923 | { |
| 924 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 925 | skeleton->priv = object_mapper_skeleton_get_instance_private (skeleton); |
| 926 | #else |
| 927 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeletonPrivate); |
| 928 | #endif |
| 929 | |
| 930 | g_mutex_init (&skeleton->priv->lock); |
| 931 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 932 | } |
| 933 | |
| 934 | static void |
| 935 | object_mapper_skeleton_class_init (ObjectMapperSkeletonClass *klass) |
| 936 | { |
| 937 | GObjectClass *gobject_class; |
| 938 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 939 | |
| 940 | gobject_class = G_OBJECT_CLASS (klass); |
| 941 | gobject_class->finalize = object_mapper_skeleton_finalize; |
| 942 | |
| 943 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 944 | skeleton_class->get_info = object_mapper_skeleton_dbus_interface_get_info; |
| 945 | skeleton_class->get_properties = object_mapper_skeleton_dbus_interface_get_properties; |
| 946 | skeleton_class->flush = object_mapper_skeleton_dbus_interface_flush; |
| 947 | skeleton_class->get_vtable = object_mapper_skeleton_dbus_interface_get_vtable; |
| 948 | |
| 949 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 950 | g_type_class_add_private (klass, sizeof (ObjectMapperSkeletonPrivate)); |
| 951 | #endif |
| 952 | } |
| 953 | |
| 954 | static void |
| 955 | object_mapper_skeleton_iface_init (ObjectMapperIface *iface) |
| 956 | { |
| 957 | iface->object_added = _object_mapper_on_signal_object_added; |
| 958 | } |
| 959 | |
| 960 | /** |
| 961 | * object_mapper_skeleton_new: |
| 962 | * |
| 963 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. |
| 964 | * |
| 965 | * Returns: (transfer full) (type ObjectMapperSkeleton): The skeleton object. |
| 966 | */ |
| 967 | ObjectMapper * |
| 968 | object_mapper_skeleton_new (void) |
| 969 | { |
| 970 | return OBJECT_MAPPER (g_object_new (TYPE_OBJECT_MAPPER_SKELETON, NULL)); |
| 971 | } |
| 972 | |
| 973 | /* ------------------------------------------------------------------------ |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 974 | * Code for interface org.openbmc.Hwmon |
| 975 | * ------------------------------------------------------------------------ |
| 976 | */ |
| 977 | |
| 978 | /** |
| 979 | * SECTION:Hwmon |
| 980 | * @title: Hwmon |
| 981 | * @short_description: Generated C code for the org.openbmc.Hwmon D-Bus interface |
| 982 | * |
| 983 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface in C. |
| 984 | */ |
| 985 | |
| 986 | /* ---- Introspection data for org.openbmc.Hwmon ---- */ |
| 987 | |
| 988 | static const _ExtendedGDBusPropertyInfo _hwmon_property_info_poll_interval = |
| 989 | { |
| 990 | { |
| 991 | -1, |
| 992 | (gchar *) "poll_interval", |
| 993 | (gchar *) "i", |
| 994 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 995 | NULL |
| 996 | }, |
| 997 | "poll-interval", |
| 998 | FALSE |
| 999 | }; |
| 1000 | |
| 1001 | static const _ExtendedGDBusPropertyInfo _hwmon_property_info_sysfs_path = |
| 1002 | { |
| 1003 | { |
| 1004 | -1, |
| 1005 | (gchar *) "sysfs_path", |
| 1006 | (gchar *) "s", |
| 1007 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 1008 | NULL |
| 1009 | }, |
| 1010 | "sysfs-path", |
| 1011 | FALSE |
| 1012 | }; |
| 1013 | |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1014 | static const _ExtendedGDBusPropertyInfo _hwmon_property_info_scale = |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1015 | { |
| 1016 | { |
| 1017 | -1, |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1018 | (gchar *) "scale", |
| 1019 | (gchar *) "i", |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1020 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 1021 | NULL |
| 1022 | }, |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1023 | "scale", |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1024 | FALSE |
| 1025 | }; |
| 1026 | |
| 1027 | static const _ExtendedGDBusPropertyInfo * const _hwmon_property_info_pointers[] = |
| 1028 | { |
| 1029 | &_hwmon_property_info_poll_interval, |
| 1030 | &_hwmon_property_info_sysfs_path, |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1031 | &_hwmon_property_info_scale, |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1032 | NULL |
| 1033 | }; |
| 1034 | |
| 1035 | static const _ExtendedGDBusInterfaceInfo _hwmon_interface_info = |
| 1036 | { |
| 1037 | { |
| 1038 | -1, |
| 1039 | (gchar *) "org.openbmc.Hwmon", |
| 1040 | NULL, |
| 1041 | NULL, |
| 1042 | (GDBusPropertyInfo **) &_hwmon_property_info_pointers, |
| 1043 | NULL |
| 1044 | }, |
| 1045 | "hwmon", |
| 1046 | }; |
| 1047 | |
| 1048 | |
| 1049 | /** |
| 1050 | * hwmon_interface_info: |
| 1051 | * |
| 1052 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface. |
| 1053 | * |
| 1054 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 1055 | */ |
| 1056 | GDBusInterfaceInfo * |
| 1057 | hwmon_interface_info (void) |
| 1058 | { |
| 1059 | return (GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct; |
| 1060 | } |
| 1061 | |
| 1062 | /** |
| 1063 | * hwmon_override_properties: |
| 1064 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 1065 | * @property_id_begin: The property id to assign to the first overridden property. |
| 1066 | * |
| 1067 | * Overrides all #GObject properties in the #Hwmon interface for a concrete class. |
| 1068 | * The properties are overridden in the order they are defined. |
| 1069 | * |
| 1070 | * Returns: The last property id. |
| 1071 | */ |
| 1072 | guint |
| 1073 | hwmon_override_properties (GObjectClass *klass, guint property_id_begin) |
| 1074 | { |
| 1075 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 1076 | g_object_class_override_property (klass, property_id_begin++, "sysfs-path"); |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1077 | g_object_class_override_property (klass, property_id_begin++, "scale"); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1078 | return property_id_begin - 1; |
| 1079 | } |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | /** |
| 1084 | * Hwmon: |
| 1085 | * |
| 1086 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. |
| 1087 | */ |
| 1088 | |
| 1089 | /** |
| 1090 | * HwmonIface: |
| 1091 | * @parent_iface: The parent interface. |
| 1092 | * @get_poll_interval: Getter for the #Hwmon:poll-interval property. |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1093 | * @get_scale: Getter for the #Hwmon:scale property. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1094 | * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1095 | * |
| 1096 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. |
| 1097 | */ |
| 1098 | |
| 1099 | typedef HwmonIface HwmonInterface; |
| 1100 | G_DEFINE_INTERFACE (Hwmon, hwmon, G_TYPE_OBJECT); |
| 1101 | |
| 1102 | static void |
| 1103 | hwmon_default_init (HwmonIface *iface) |
| 1104 | { |
| 1105 | /* GObject properties for D-Bus properties: */ |
| 1106 | /** |
| 1107 | * Hwmon:poll-interval: |
| 1108 | * |
| 1109 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link>. |
| 1110 | * |
| 1111 | * 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. |
| 1112 | */ |
| 1113 | g_object_interface_install_property (iface, |
| 1114 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1115 | /** |
| 1116 | * Hwmon:sysfs-path: |
| 1117 | * |
| 1118 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link>. |
| 1119 | * |
| 1120 | * 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. |
| 1121 | */ |
| 1122 | g_object_interface_install_property (iface, |
| 1123 | g_param_spec_string ("sysfs-path", "sysfs_path", "sysfs_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1124 | /** |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1125 | * Hwmon:scale: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1126 | * |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1127 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link>. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1128 | * |
| 1129 | * 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. |
| 1130 | */ |
| 1131 | g_object_interface_install_property (iface, |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1132 | g_param_spec_int ("scale", "scale", "scale", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | /** |
| 1136 | * hwmon_get_poll_interval: (skip) |
| 1137 | * @object: A #Hwmon. |
| 1138 | * |
| 1139 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property. |
| 1140 | * |
| 1141 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1142 | * |
| 1143 | * Returns: The property value. |
| 1144 | */ |
| 1145 | gint |
| 1146 | hwmon_get_poll_interval (Hwmon *object) |
| 1147 | { |
| 1148 | return HWMON_GET_IFACE (object)->get_poll_interval (object); |
| 1149 | } |
| 1150 | |
| 1151 | /** |
| 1152 | * hwmon_set_poll_interval: (skip) |
| 1153 | * @object: A #Hwmon. |
| 1154 | * @value: The value to set. |
| 1155 | * |
| 1156 | * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 1157 | * |
| 1158 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1159 | */ |
| 1160 | void |
| 1161 | hwmon_set_poll_interval (Hwmon *object, gint value) |
| 1162 | { |
| 1163 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 1164 | } |
| 1165 | |
| 1166 | /** |
| 1167 | * hwmon_get_sysfs_path: (skip) |
| 1168 | * @object: A #Hwmon. |
| 1169 | * |
| 1170 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property. |
| 1171 | * |
| 1172 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1173 | * |
| 1174 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hwmon_dup_sysfs_path() if on another thread.</warning> |
| 1175 | * |
| 1176 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 1177 | */ |
| 1178 | const gchar * |
| 1179 | hwmon_get_sysfs_path (Hwmon *object) |
| 1180 | { |
| 1181 | return HWMON_GET_IFACE (object)->get_sysfs_path (object); |
| 1182 | } |
| 1183 | |
| 1184 | /** |
| 1185 | * hwmon_dup_sysfs_path: (skip) |
| 1186 | * @object: A #Hwmon. |
| 1187 | * |
| 1188 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property. |
| 1189 | * |
| 1190 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1191 | * |
| 1192 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 1193 | */ |
| 1194 | gchar * |
| 1195 | hwmon_dup_sysfs_path (Hwmon *object) |
| 1196 | { |
| 1197 | gchar *value; |
| 1198 | g_object_get (G_OBJECT (object), "sysfs-path", &value, NULL); |
| 1199 | return value; |
| 1200 | } |
| 1201 | |
| 1202 | /** |
| 1203 | * hwmon_set_sysfs_path: (skip) |
| 1204 | * @object: A #Hwmon. |
| 1205 | * @value: The value to set. |
| 1206 | * |
| 1207 | * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property to @value. |
| 1208 | * |
| 1209 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1210 | */ |
| 1211 | void |
| 1212 | hwmon_set_sysfs_path (Hwmon *object, const gchar *value) |
| 1213 | { |
| 1214 | g_object_set (G_OBJECT (object), "sysfs-path", value, NULL); |
| 1215 | } |
| 1216 | |
| 1217 | /** |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1218 | * hwmon_get_scale: (skip) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1219 | * @object: A #Hwmon. |
| 1220 | * |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1221 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1222 | * |
| 1223 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1224 | * |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1225 | * Returns: The property value. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1226 | */ |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1227 | gint |
| 1228 | hwmon_get_scale (Hwmon *object) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1229 | { |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1230 | return HWMON_GET_IFACE (object)->get_scale (object); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1231 | } |
| 1232 | |
| 1233 | /** |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1234 | * hwmon_set_scale: (skip) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1235 | * @object: A #Hwmon. |
| 1236 | * @value: The value to set. |
| 1237 | * |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1238 | * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property to @value. |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1239 | * |
| 1240 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1241 | */ |
| 1242 | void |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1243 | hwmon_set_scale (Hwmon *object, gint value) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1244 | { |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1245 | g_object_set (G_OBJECT (object), "scale", value, NULL); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1246 | } |
| 1247 | |
| 1248 | /* ------------------------------------------------------------------------ */ |
| 1249 | |
| 1250 | /** |
| 1251 | * HwmonProxy: |
| 1252 | * |
| 1253 | * The #HwmonProxy structure contains only private data and should only be accessed using the provided API. |
| 1254 | */ |
| 1255 | |
| 1256 | /** |
| 1257 | * HwmonProxyClass: |
| 1258 | * @parent_class: The parent class. |
| 1259 | * |
| 1260 | * Class structure for #HwmonProxy. |
| 1261 | */ |
| 1262 | |
| 1263 | struct _HwmonProxyPrivate |
| 1264 | { |
| 1265 | GData *qdata; |
| 1266 | }; |
| 1267 | |
| 1268 | static void hwmon_proxy_iface_init (HwmonIface *iface); |
| 1269 | |
| 1270 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1271 | G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY, |
| 1272 | G_ADD_PRIVATE (HwmonProxy) |
| 1273 | G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init)); |
| 1274 | |
| 1275 | #else |
| 1276 | G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY, |
| 1277 | G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init)); |
| 1278 | |
| 1279 | #endif |
| 1280 | static void |
| 1281 | hwmon_proxy_finalize (GObject *object) |
| 1282 | { |
| 1283 | HwmonProxy *proxy = HWMON_PROXY (object); |
| 1284 | g_datalist_clear (&proxy->priv->qdata); |
| 1285 | G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object); |
| 1286 | } |
| 1287 | |
| 1288 | static void |
| 1289 | hwmon_proxy_get_property (GObject *object, |
| 1290 | guint prop_id, |
| 1291 | GValue *value, |
| 1292 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1293 | { |
| 1294 | const _ExtendedGDBusPropertyInfo *info; |
| 1295 | GVariant *variant; |
| 1296 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1297 | info = _hwmon_property_info_pointers[prop_id - 1]; |
| 1298 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1299 | if (info->use_gvariant) |
| 1300 | { |
| 1301 | g_value_set_variant (value, variant); |
| 1302 | } |
| 1303 | else |
| 1304 | { |
| 1305 | if (variant != NULL) |
| 1306 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1307 | } |
| 1308 | if (variant != NULL) |
| 1309 | g_variant_unref (variant); |
| 1310 | } |
| 1311 | |
| 1312 | static void |
| 1313 | hwmon_proxy_set_property_cb (GDBusProxy *proxy, |
| 1314 | GAsyncResult *res, |
| 1315 | gpointer user_data) |
| 1316 | { |
| 1317 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1318 | GError *error; |
| 1319 | GVariant *_ret; |
| 1320 | error = NULL; |
| 1321 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1322 | if (!_ret) |
| 1323 | { |
| 1324 | g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)", |
| 1325 | info->parent_struct.name, |
| 1326 | error->message, g_quark_to_string (error->domain), error->code); |
| 1327 | g_error_free (error); |
| 1328 | } |
| 1329 | else |
| 1330 | { |
| 1331 | g_variant_unref (_ret); |
| 1332 | } |
| 1333 | } |
| 1334 | |
| 1335 | static void |
| 1336 | hwmon_proxy_set_property (GObject *object, |
| 1337 | guint prop_id, |
| 1338 | const GValue *value, |
| 1339 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1340 | { |
| 1341 | const _ExtendedGDBusPropertyInfo *info; |
| 1342 | GVariant *variant; |
| 1343 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1344 | info = _hwmon_property_info_pointers[prop_id - 1]; |
| 1345 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1346 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1347 | "org.freedesktop.DBus.Properties.Set", |
| 1348 | g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant), |
| 1349 | G_DBUS_CALL_FLAGS_NONE, |
| 1350 | -1, |
| 1351 | NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 1352 | g_variant_unref (variant); |
| 1353 | } |
| 1354 | |
| 1355 | static void |
| 1356 | hwmon_proxy_g_signal (GDBusProxy *proxy, |
| 1357 | const gchar *sender_name G_GNUC_UNUSED, |
| 1358 | const gchar *signal_name, |
| 1359 | GVariant *parameters) |
| 1360 | { |
| 1361 | _ExtendedGDBusSignalInfo *info; |
| 1362 | GVariantIter iter; |
| 1363 | GVariant *child; |
| 1364 | GValue *paramv; |
| 1365 | guint num_params; |
| 1366 | guint n; |
| 1367 | guint signal_id; |
| 1368 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name); |
| 1369 | if (info == NULL) |
| 1370 | return; |
| 1371 | num_params = g_variant_n_children (parameters); |
| 1372 | paramv = g_new0 (GValue, num_params + 1); |
| 1373 | g_value_init (¶mv[0], TYPE_HWMON); |
| 1374 | g_value_set_object (¶mv[0], proxy); |
| 1375 | g_variant_iter_init (&iter, parameters); |
| 1376 | n = 1; |
| 1377 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1378 | { |
| 1379 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1380 | if (arg_info->use_gvariant) |
| 1381 | { |
| 1382 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1383 | g_value_set_variant (¶mv[n], child); |
| 1384 | n++; |
| 1385 | } |
| 1386 | else |
| 1387 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1388 | g_variant_unref (child); |
| 1389 | } |
| 1390 | signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON); |
| 1391 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1392 | for (n = 0; n < num_params + 1; n++) |
| 1393 | g_value_unset (¶mv[n]); |
| 1394 | g_free (paramv); |
| 1395 | } |
| 1396 | |
| 1397 | static void |
| 1398 | hwmon_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 1399 | GVariant *changed_properties, |
| 1400 | const gchar *const *invalidated_properties) |
| 1401 | { |
| 1402 | HwmonProxy *proxy = HWMON_PROXY (_proxy); |
| 1403 | guint n; |
| 1404 | const gchar *key; |
| 1405 | GVariantIter *iter; |
| 1406 | _ExtendedGDBusPropertyInfo *info; |
| 1407 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 1408 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1409 | { |
| 1410 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key); |
| 1411 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1412 | if (info != NULL) |
| 1413 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1414 | } |
| 1415 | g_variant_iter_free (iter); |
| 1416 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1417 | { |
| 1418 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]); |
| 1419 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1420 | if (info != NULL) |
| 1421 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | static gint |
| 1426 | hwmon_proxy_get_poll_interval (Hwmon *object) |
| 1427 | { |
| 1428 | HwmonProxy *proxy = HWMON_PROXY (object); |
| 1429 | GVariant *variant; |
| 1430 | gint value = 0; |
| 1431 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 1432 | if (variant != NULL) |
| 1433 | { |
| 1434 | value = g_variant_get_int32 (variant); |
| 1435 | g_variant_unref (variant); |
| 1436 | } |
| 1437 | return value; |
| 1438 | } |
| 1439 | |
| 1440 | static const gchar * |
| 1441 | hwmon_proxy_get_sysfs_path (Hwmon *object) |
| 1442 | { |
| 1443 | HwmonProxy *proxy = HWMON_PROXY (object); |
| 1444 | GVariant *variant; |
| 1445 | const gchar *value = NULL; |
| 1446 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path"); |
| 1447 | if (variant != NULL) |
| 1448 | { |
| 1449 | value = g_variant_get_string (variant, NULL); |
| 1450 | g_variant_unref (variant); |
| 1451 | } |
| 1452 | return value; |
| 1453 | } |
| 1454 | |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1455 | static gint |
| 1456 | hwmon_proxy_get_scale (Hwmon *object) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1457 | { |
| 1458 | HwmonProxy *proxy = HWMON_PROXY (object); |
| 1459 | GVariant *variant; |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1460 | gint value = 0; |
| 1461 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "scale"); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1462 | if (variant != NULL) |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1463 | { |
| 1464 | value = g_variant_get_int32 (variant); |
| 1465 | g_variant_unref (variant); |
| 1466 | } |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1467 | return value; |
| 1468 | } |
| 1469 | |
| 1470 | static void |
| 1471 | hwmon_proxy_init (HwmonProxy *proxy) |
| 1472 | { |
| 1473 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1474 | proxy->priv = hwmon_proxy_get_instance_private (proxy); |
| 1475 | #else |
| 1476 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate); |
| 1477 | #endif |
| 1478 | |
| 1479 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ()); |
| 1480 | } |
| 1481 | |
| 1482 | static void |
| 1483 | hwmon_proxy_class_init (HwmonProxyClass *klass) |
| 1484 | { |
| 1485 | GObjectClass *gobject_class; |
| 1486 | GDBusProxyClass *proxy_class; |
| 1487 | |
| 1488 | gobject_class = G_OBJECT_CLASS (klass); |
| 1489 | gobject_class->finalize = hwmon_proxy_finalize; |
| 1490 | gobject_class->get_property = hwmon_proxy_get_property; |
| 1491 | gobject_class->set_property = hwmon_proxy_set_property; |
| 1492 | |
| 1493 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 1494 | proxy_class->g_signal = hwmon_proxy_g_signal; |
| 1495 | proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed; |
| 1496 | |
| 1497 | hwmon_override_properties (gobject_class, 1); |
| 1498 | |
| 1499 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1500 | g_type_class_add_private (klass, sizeof (HwmonProxyPrivate)); |
| 1501 | #endif |
| 1502 | } |
| 1503 | |
| 1504 | static void |
| 1505 | hwmon_proxy_iface_init (HwmonIface *iface) |
| 1506 | { |
| 1507 | iface->get_poll_interval = hwmon_proxy_get_poll_interval; |
| 1508 | iface->get_sysfs_path = hwmon_proxy_get_sysfs_path; |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 1509 | iface->get_scale = hwmon_proxy_get_scale; |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 1510 | } |
| 1511 | |
| 1512 | /** |
| 1513 | * hwmon_proxy_new: |
| 1514 | * @connection: A #GDBusConnection. |
| 1515 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1516 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1517 | * @object_path: An object path. |
| 1518 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1519 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1520 | * @user_data: User data to pass to @callback. |
| 1521 | * |
| 1522 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new() for more details. |
| 1523 | * |
| 1524 | * 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. |
| 1525 | * You can then call hwmon_proxy_new_finish() to get the result of the operation. |
| 1526 | * |
| 1527 | * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 1528 | */ |
| 1529 | void |
| 1530 | hwmon_proxy_new ( |
| 1531 | GDBusConnection *connection, |
| 1532 | GDBusProxyFlags flags, |
| 1533 | const gchar *name, |
| 1534 | const gchar *object_path, |
| 1535 | GCancellable *cancellable, |
| 1536 | GAsyncReadyCallback callback, |
| 1537 | gpointer user_data) |
| 1538 | { |
| 1539 | g_async_initable_new_async (TYPE_HWMON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); |
| 1540 | } |
| 1541 | |
| 1542 | /** |
| 1543 | * hwmon_proxy_new_finish: |
| 1544 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new(). |
| 1545 | * @error: Return location for error or %NULL |
| 1546 | * |
| 1547 | * Finishes an operation started with hwmon_proxy_new(). |
| 1548 | * |
| 1549 | * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. |
| 1550 | */ |
| 1551 | Hwmon * |
| 1552 | hwmon_proxy_new_finish ( |
| 1553 | GAsyncResult *res, |
| 1554 | GError **error) |
| 1555 | { |
| 1556 | GObject *ret; |
| 1557 | GObject *source_object; |
| 1558 | source_object = g_async_result_get_source_object (res); |
| 1559 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1560 | g_object_unref (source_object); |
| 1561 | if (ret != NULL) |
| 1562 | return HWMON (ret); |
| 1563 | else |
| 1564 | return NULL; |
| 1565 | } |
| 1566 | |
| 1567 | /** |
| 1568 | * hwmon_proxy_new_sync: |
| 1569 | * @connection: A #GDBusConnection. |
| 1570 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1571 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1572 | * @object_path: An object path. |
| 1573 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1574 | * @error: Return location for error or %NULL |
| 1575 | * |
| 1576 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new_sync() for more details. |
| 1577 | * |
| 1578 | * The calling thread is blocked until a reply is received. |
| 1579 | * |
| 1580 | * See hwmon_proxy_new() for the asynchronous version of this constructor. |
| 1581 | * |
| 1582 | * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. |
| 1583 | */ |
| 1584 | Hwmon * |
| 1585 | hwmon_proxy_new_sync ( |
| 1586 | GDBusConnection *connection, |
| 1587 | GDBusProxyFlags flags, |
| 1588 | const gchar *name, |
| 1589 | const gchar *object_path, |
| 1590 | GCancellable *cancellable, |
| 1591 | GError **error) |
| 1592 | { |
| 1593 | GInitable *ret; |
| 1594 | ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); |
| 1595 | if (ret != NULL) |
| 1596 | return HWMON (ret); |
| 1597 | else |
| 1598 | return NULL; |
| 1599 | } |
| 1600 | |
| 1601 | |
| 1602 | /** |
| 1603 | * hwmon_proxy_new_for_bus: |
| 1604 | * @bus_type: A #GBusType. |
| 1605 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1606 | * @name: A bus name (well-known or unique). |
| 1607 | * @object_path: An object path. |
| 1608 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1609 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1610 | * @user_data: User data to pass to @callback. |
| 1611 | * |
| 1612 | * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 1613 | * |
| 1614 | * 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. |
| 1615 | * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation. |
| 1616 | * |
| 1617 | * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 1618 | */ |
| 1619 | void |
| 1620 | hwmon_proxy_new_for_bus ( |
| 1621 | GBusType bus_type, |
| 1622 | GDBusProxyFlags flags, |
| 1623 | const gchar *name, |
| 1624 | const gchar *object_path, |
| 1625 | GCancellable *cancellable, |
| 1626 | GAsyncReadyCallback callback, |
| 1627 | gpointer user_data) |
| 1628 | { |
| 1629 | g_async_initable_new_async (TYPE_HWMON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); |
| 1630 | } |
| 1631 | |
| 1632 | /** |
| 1633 | * hwmon_proxy_new_for_bus_finish: |
| 1634 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus(). |
| 1635 | * @error: Return location for error or %NULL |
| 1636 | * |
| 1637 | * Finishes an operation started with hwmon_proxy_new_for_bus(). |
| 1638 | * |
| 1639 | * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. |
| 1640 | */ |
| 1641 | Hwmon * |
| 1642 | hwmon_proxy_new_for_bus_finish ( |
| 1643 | GAsyncResult *res, |
| 1644 | GError **error) |
| 1645 | { |
| 1646 | GObject *ret; |
| 1647 | GObject *source_object; |
| 1648 | source_object = g_async_result_get_source_object (res); |
| 1649 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1650 | g_object_unref (source_object); |
| 1651 | if (ret != NULL) |
| 1652 | return HWMON (ret); |
| 1653 | else |
| 1654 | return NULL; |
| 1655 | } |
| 1656 | |
| 1657 | /** |
| 1658 | * hwmon_proxy_new_for_bus_sync: |
| 1659 | * @bus_type: A #GBusType. |
| 1660 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1661 | * @name: A bus name (well-known or unique). |
| 1662 | * @object_path: An object path. |
| 1663 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1664 | * @error: Return location for error or %NULL |
| 1665 | * |
| 1666 | * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 1667 | * |
| 1668 | * The calling thread is blocked until a reply is received. |
| 1669 | * |
| 1670 | * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 1671 | * |
| 1672 | * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. |
| 1673 | */ |
| 1674 | Hwmon * |
| 1675 | hwmon_proxy_new_for_bus_sync ( |
| 1676 | GBusType bus_type, |
| 1677 | GDBusProxyFlags flags, |
| 1678 | const gchar *name, |
| 1679 | const gchar *object_path, |
| 1680 | GCancellable *cancellable, |
| 1681 | GError **error) |
| 1682 | { |
| 1683 | GInitable *ret; |
| 1684 | ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); |
| 1685 | if (ret != NULL) |
| 1686 | return HWMON (ret); |
| 1687 | else |
| 1688 | return NULL; |
| 1689 | } |
| 1690 | |
| 1691 | |
| 1692 | /* ------------------------------------------------------------------------ */ |
| 1693 | |
| 1694 | /** |
| 1695 | * HwmonSkeleton: |
| 1696 | * |
| 1697 | * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API. |
| 1698 | */ |
| 1699 | |
| 1700 | /** |
| 1701 | * HwmonSkeletonClass: |
| 1702 | * @parent_class: The parent class. |
| 1703 | * |
| 1704 | * Class structure for #HwmonSkeleton. |
| 1705 | */ |
| 1706 | |
| 1707 | struct _HwmonSkeletonPrivate |
| 1708 | { |
| 1709 | GValue *properties; |
| 1710 | GList *changed_properties; |
| 1711 | GSource *changed_properties_idle_source; |
| 1712 | GMainContext *context; |
| 1713 | GMutex lock; |
| 1714 | }; |
| 1715 | |
| 1716 | static void |
| 1717 | _hwmon_skeleton_handle_method_call ( |
| 1718 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1719 | const gchar *sender G_GNUC_UNUSED, |
| 1720 | const gchar *object_path G_GNUC_UNUSED, |
| 1721 | const gchar *interface_name, |
| 1722 | const gchar *method_name, |
| 1723 | GVariant *parameters, |
| 1724 | GDBusMethodInvocation *invocation, |
| 1725 | gpointer user_data) |
| 1726 | { |
| 1727 | HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); |
| 1728 | _ExtendedGDBusMethodInfo *info; |
| 1729 | GVariantIter iter; |
| 1730 | GVariant *child; |
| 1731 | GValue *paramv; |
| 1732 | guint num_params; |
| 1733 | guint num_extra; |
| 1734 | guint n; |
| 1735 | guint signal_id; |
| 1736 | GValue return_value = G_VALUE_INIT; |
| 1737 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1738 | g_assert (info != NULL); |
| 1739 | num_params = g_variant_n_children (parameters); |
| 1740 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1741 | n = 0; |
| 1742 | g_value_init (¶mv[n], TYPE_HWMON); |
| 1743 | g_value_set_object (¶mv[n++], skeleton); |
| 1744 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1745 | g_value_set_object (¶mv[n++], invocation); |
| 1746 | if (info->pass_fdlist) |
| 1747 | { |
| 1748 | #ifdef G_OS_UNIX |
| 1749 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1750 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1751 | #else |
| 1752 | g_assert_not_reached (); |
| 1753 | #endif |
| 1754 | } |
| 1755 | g_variant_iter_init (&iter, parameters); |
| 1756 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1757 | { |
| 1758 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1759 | if (arg_info->use_gvariant) |
| 1760 | { |
| 1761 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1762 | g_value_set_variant (¶mv[n], child); |
| 1763 | n++; |
| 1764 | } |
| 1765 | else |
| 1766 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1767 | g_variant_unref (child); |
| 1768 | } |
| 1769 | signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON); |
| 1770 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1771 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1772 | if (!g_value_get_boolean (&return_value)) |
| 1773 | 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); |
| 1774 | g_value_unset (&return_value); |
| 1775 | for (n = 0; n < num_params + num_extra; n++) |
| 1776 | g_value_unset (¶mv[n]); |
| 1777 | g_free (paramv); |
| 1778 | } |
| 1779 | |
| 1780 | static GVariant * |
| 1781 | _hwmon_skeleton_handle_get_property ( |
| 1782 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1783 | const gchar *sender G_GNUC_UNUSED, |
| 1784 | const gchar *object_path G_GNUC_UNUSED, |
| 1785 | const gchar *interface_name G_GNUC_UNUSED, |
| 1786 | const gchar *property_name, |
| 1787 | GError **error, |
| 1788 | gpointer user_data) |
| 1789 | { |
| 1790 | HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); |
| 1791 | GValue value = G_VALUE_INIT; |
| 1792 | GParamSpec *pspec; |
| 1793 | _ExtendedGDBusPropertyInfo *info; |
| 1794 | GVariant *ret; |
| 1795 | ret = NULL; |
| 1796 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name); |
| 1797 | g_assert (info != NULL); |
| 1798 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1799 | if (pspec == NULL) |
| 1800 | { |
| 1801 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1802 | } |
| 1803 | else |
| 1804 | { |
| 1805 | g_value_init (&value, pspec->value_type); |
| 1806 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1807 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1808 | g_value_unset (&value); |
| 1809 | } |
| 1810 | return ret; |
| 1811 | } |
| 1812 | |
| 1813 | static gboolean |
| 1814 | _hwmon_skeleton_handle_set_property ( |
| 1815 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1816 | const gchar *sender G_GNUC_UNUSED, |
| 1817 | const gchar *object_path G_GNUC_UNUSED, |
| 1818 | const gchar *interface_name G_GNUC_UNUSED, |
| 1819 | const gchar *property_name, |
| 1820 | GVariant *variant, |
| 1821 | GError **error, |
| 1822 | gpointer user_data) |
| 1823 | { |
| 1824 | HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); |
| 1825 | GValue value = G_VALUE_INIT; |
| 1826 | GParamSpec *pspec; |
| 1827 | _ExtendedGDBusPropertyInfo *info; |
| 1828 | gboolean ret; |
| 1829 | ret = FALSE; |
| 1830 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name); |
| 1831 | g_assert (info != NULL); |
| 1832 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1833 | if (pspec == NULL) |
| 1834 | { |
| 1835 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1836 | } |
| 1837 | else |
| 1838 | { |
| 1839 | if (info->use_gvariant) |
| 1840 | g_value_set_variant (&value, variant); |
| 1841 | else |
| 1842 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1843 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1844 | g_value_unset (&value); |
| 1845 | ret = TRUE; |
| 1846 | } |
| 1847 | return ret; |
| 1848 | } |
| 1849 | |
| 1850 | static const GDBusInterfaceVTable _hwmon_skeleton_vtable = |
| 1851 | { |
| 1852 | _hwmon_skeleton_handle_method_call, |
| 1853 | _hwmon_skeleton_handle_get_property, |
| 1854 | _hwmon_skeleton_handle_set_property, |
| 1855 | {NULL} |
| 1856 | }; |
| 1857 | |
| 1858 | static GDBusInterfaceInfo * |
| 1859 | hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1860 | { |
| 1861 | return hwmon_interface_info (); |
| 1862 | } |
| 1863 | |
| 1864 | static GDBusInterfaceVTable * |
| 1865 | hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1866 | { |
| 1867 | return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable; |
| 1868 | } |
| 1869 | |
| 1870 | static GVariant * |
| 1871 | hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 1872 | { |
| 1873 | HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton); |
| 1874 | |
| 1875 | GVariantBuilder builder; |
| 1876 | guint n; |
| 1877 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1878 | if (_hwmon_interface_info.parent_struct.properties == NULL) |
| 1879 | goto out; |
| 1880 | for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++) |
| 1881 | { |
| 1882 | GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n]; |
| 1883 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1884 | { |
| 1885 | GVariant *value; |
| 1886 | value = _hwmon_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Hwmon", info->name, NULL, skeleton); |
| 1887 | if (value != NULL) |
| 1888 | { |
| 1889 | g_variant_take_ref (value); |
| 1890 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1891 | g_variant_unref (value); |
| 1892 | } |
| 1893 | } |
| 1894 | } |
| 1895 | out: |
| 1896 | return g_variant_builder_end (&builder); |
| 1897 | } |
| 1898 | |
| 1899 | static gboolean _hwmon_emit_changed (gpointer user_data); |
| 1900 | |
| 1901 | static void |
| 1902 | hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 1903 | { |
| 1904 | HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton); |
| 1905 | gboolean emit_changed = FALSE; |
| 1906 | |
| 1907 | g_mutex_lock (&skeleton->priv->lock); |
| 1908 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1909 | { |
| 1910 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1911 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1912 | emit_changed = TRUE; |
| 1913 | } |
| 1914 | g_mutex_unlock (&skeleton->priv->lock); |
| 1915 | |
| 1916 | if (emit_changed) |
| 1917 | _hwmon_emit_changed (skeleton); |
| 1918 | } |
| 1919 | |
| 1920 | static void hwmon_skeleton_iface_init (HwmonIface *iface); |
| 1921 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1922 | G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1923 | G_ADD_PRIVATE (HwmonSkeleton) |
| 1924 | G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init)); |
| 1925 | |
| 1926 | #else |
| 1927 | G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1928 | G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init)); |
| 1929 | |
| 1930 | #endif |
| 1931 | static void |
| 1932 | hwmon_skeleton_finalize (GObject *object) |
| 1933 | { |
| 1934 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 1935 | guint n; |
| 1936 | for (n = 0; n < 3; n++) |
| 1937 | g_value_unset (&skeleton->priv->properties[n]); |
| 1938 | g_free (skeleton->priv->properties); |
| 1939 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1940 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1941 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1942 | g_main_context_unref (skeleton->priv->context); |
| 1943 | g_mutex_clear (&skeleton->priv->lock); |
| 1944 | G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object); |
| 1945 | } |
| 1946 | |
| 1947 | static void |
| 1948 | hwmon_skeleton_get_property (GObject *object, |
| 1949 | guint prop_id, |
| 1950 | GValue *value, |
| 1951 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1952 | { |
| 1953 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 1954 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1955 | g_mutex_lock (&skeleton->priv->lock); |
| 1956 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1957 | g_mutex_unlock (&skeleton->priv->lock); |
| 1958 | } |
| 1959 | |
| 1960 | static gboolean |
| 1961 | _hwmon_emit_changed (gpointer user_data) |
| 1962 | { |
| 1963 | HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); |
| 1964 | GList *l; |
| 1965 | GVariantBuilder builder; |
| 1966 | GVariantBuilder invalidated_builder; |
| 1967 | guint num_changes; |
| 1968 | |
| 1969 | g_mutex_lock (&skeleton->priv->lock); |
| 1970 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1971 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1972 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1973 | { |
| 1974 | ChangedProperty *cp = l->data; |
| 1975 | GVariant *variant; |
| 1976 | const GValue *cur_value; |
| 1977 | |
| 1978 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1979 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1980 | { |
| 1981 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1982 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1983 | g_variant_unref (variant); |
| 1984 | num_changes++; |
| 1985 | } |
| 1986 | } |
| 1987 | if (num_changes > 0) |
| 1988 | { |
| 1989 | GList *connections, *ll; |
| 1990 | GVariant *signal_variant; |
| 1991 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon", |
| 1992 | &builder, &invalidated_builder)); |
| 1993 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1994 | for (ll = connections; ll != NULL; ll = ll->next) |
| 1995 | { |
| 1996 | GDBusConnection *connection = ll->data; |
| 1997 | |
| 1998 | g_dbus_connection_emit_signal (connection, |
| 1999 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 2000 | "org.freedesktop.DBus.Properties", |
| 2001 | "PropertiesChanged", |
| 2002 | signal_variant, |
| 2003 | NULL); |
| 2004 | } |
| 2005 | g_variant_unref (signal_variant); |
| 2006 | g_list_free_full (connections, g_object_unref); |
| 2007 | } |
| 2008 | else |
| 2009 | { |
| 2010 | g_variant_builder_clear (&builder); |
| 2011 | g_variant_builder_clear (&invalidated_builder); |
| 2012 | } |
| 2013 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 2014 | skeleton->priv->changed_properties = NULL; |
| 2015 | skeleton->priv->changed_properties_idle_source = NULL; |
| 2016 | g_mutex_unlock (&skeleton->priv->lock); |
| 2017 | return FALSE; |
| 2018 | } |
| 2019 | |
| 2020 | static void |
| 2021 | _hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 2022 | { |
| 2023 | ChangedProperty *cp; |
| 2024 | GList *l; |
| 2025 | cp = NULL; |
| 2026 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 2027 | { |
| 2028 | ChangedProperty *i_cp = l->data; |
| 2029 | if (i_cp->info == info) |
| 2030 | { |
| 2031 | cp = i_cp; |
| 2032 | break; |
| 2033 | } |
| 2034 | } |
| 2035 | if (cp == NULL) |
| 2036 | { |
| 2037 | cp = g_new0 (ChangedProperty, 1); |
| 2038 | cp->prop_id = prop_id; |
| 2039 | cp->info = info; |
| 2040 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 2041 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 2042 | g_value_copy (orig_value, &cp->orig_value); |
| 2043 | } |
| 2044 | } |
| 2045 | |
| 2046 | static void |
| 2047 | hwmon_skeleton_notify (GObject *object, |
| 2048 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2049 | { |
| 2050 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 2051 | g_mutex_lock (&skeleton->priv->lock); |
| 2052 | if (skeleton->priv->changed_properties != NULL && |
| 2053 | skeleton->priv->changed_properties_idle_source == NULL) |
| 2054 | { |
| 2055 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 2056 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 2057 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 2058 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 2059 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 2060 | } |
| 2061 | g_mutex_unlock (&skeleton->priv->lock); |
| 2062 | } |
| 2063 | |
| 2064 | static void |
| 2065 | hwmon_skeleton_set_property (GObject *object, |
| 2066 | guint prop_id, |
| 2067 | const GValue *value, |
| 2068 | GParamSpec *pspec) |
| 2069 | { |
| 2070 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 2071 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 2072 | g_mutex_lock (&skeleton->priv->lock); |
| 2073 | g_object_freeze_notify (object); |
| 2074 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 2075 | { |
| 2076 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 2077 | _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 2078 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 2079 | g_object_notify_by_pspec (object, pspec); |
| 2080 | } |
| 2081 | g_mutex_unlock (&skeleton->priv->lock); |
| 2082 | g_object_thaw_notify (object); |
| 2083 | } |
| 2084 | |
| 2085 | static void |
| 2086 | hwmon_skeleton_init (HwmonSkeleton *skeleton) |
| 2087 | { |
| 2088 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2089 | skeleton->priv = hwmon_skeleton_get_instance_private (skeleton); |
| 2090 | #else |
| 2091 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate); |
| 2092 | #endif |
| 2093 | |
| 2094 | g_mutex_init (&skeleton->priv->lock); |
| 2095 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 2096 | skeleton->priv->properties = g_new0 (GValue, 3); |
| 2097 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 2098 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 2099 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 2100 | } |
| 2101 | |
| 2102 | static gint |
| 2103 | hwmon_skeleton_get_poll_interval (Hwmon *object) |
| 2104 | { |
| 2105 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 2106 | gint value; |
| 2107 | g_mutex_lock (&skeleton->priv->lock); |
| 2108 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 2109 | g_mutex_unlock (&skeleton->priv->lock); |
| 2110 | return value; |
| 2111 | } |
| 2112 | |
| 2113 | static const gchar * |
| 2114 | hwmon_skeleton_get_sysfs_path (Hwmon *object) |
| 2115 | { |
| 2116 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
| 2117 | const gchar *value; |
| 2118 | g_mutex_lock (&skeleton->priv->lock); |
| 2119 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 2120 | g_mutex_unlock (&skeleton->priv->lock); |
| 2121 | return value; |
| 2122 | } |
| 2123 | |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 2124 | static gint |
| 2125 | hwmon_skeleton_get_scale (Hwmon *object) |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 2126 | { |
| 2127 | HwmonSkeleton *skeleton = HWMON_SKELETON (object); |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 2128 | gint value; |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 2129 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 2130 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 2131 | g_mutex_unlock (&skeleton->priv->lock); |
| 2132 | return value; |
| 2133 | } |
| 2134 | |
| 2135 | static void |
| 2136 | hwmon_skeleton_class_init (HwmonSkeletonClass *klass) |
| 2137 | { |
| 2138 | GObjectClass *gobject_class; |
| 2139 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 2140 | |
| 2141 | gobject_class = G_OBJECT_CLASS (klass); |
| 2142 | gobject_class->finalize = hwmon_skeleton_finalize; |
| 2143 | gobject_class->get_property = hwmon_skeleton_get_property; |
| 2144 | gobject_class->set_property = hwmon_skeleton_set_property; |
| 2145 | gobject_class->notify = hwmon_skeleton_notify; |
| 2146 | |
| 2147 | |
| 2148 | hwmon_override_properties (gobject_class, 1); |
| 2149 | |
| 2150 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 2151 | skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info; |
| 2152 | skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties; |
| 2153 | skeleton_class->flush = hwmon_skeleton_dbus_interface_flush; |
| 2154 | skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable; |
| 2155 | |
| 2156 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 2157 | g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate)); |
| 2158 | #endif |
| 2159 | } |
| 2160 | |
| 2161 | static void |
| 2162 | hwmon_skeleton_iface_init (HwmonIface *iface) |
| 2163 | { |
| 2164 | iface->get_poll_interval = hwmon_skeleton_get_poll_interval; |
| 2165 | iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path; |
Norman James | 7482845 | 2015-11-17 13:10:34 -0600 | [diff] [blame] | 2166 | iface->get_scale = hwmon_skeleton_get_scale; |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 2167 | } |
| 2168 | |
| 2169 | /** |
| 2170 | * hwmon_skeleton_new: |
| 2171 | * |
| 2172 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. |
| 2173 | * |
| 2174 | * Returns: (transfer full) (type HwmonSkeleton): The skeleton object. |
| 2175 | */ |
| 2176 | Hwmon * |
| 2177 | hwmon_skeleton_new (void) |
| 2178 | { |
| 2179 | return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL)); |
| 2180 | } |
| 2181 | |
| 2182 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2183 | * Code for interface org.openbmc.Fan |
| 2184 | * ------------------------------------------------------------------------ |
| 2185 | */ |
| 2186 | |
| 2187 | /** |
| 2188 | * SECTION:Fan |
| 2189 | * @title: Fan |
| 2190 | * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface |
| 2191 | * |
| 2192 | * 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. |
| 2193 | */ |
| 2194 | |
| 2195 | /* ---- Introspection data for org.openbmc.Fan ---- */ |
| 2196 | |
| 2197 | static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone = |
| 2198 | { |
| 2199 | { |
| 2200 | -1, |
| 2201 | (gchar *) "cooling_zone", |
| 2202 | (gchar *) "i", |
| 2203 | NULL |
| 2204 | }, |
| 2205 | FALSE |
| 2206 | }; |
| 2207 | |
| 2208 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] = |
| 2209 | { |
| 2210 | &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone, |
| 2211 | NULL |
| 2212 | }; |
| 2213 | |
| 2214 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone = |
| 2215 | { |
| 2216 | { |
| 2217 | -1, |
| 2218 | (gchar *) "setCoolingZone", |
| 2219 | (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers, |
| 2220 | NULL, |
| 2221 | NULL |
| 2222 | }, |
| 2223 | "handle-set-cooling-zone", |
| 2224 | FALSE |
| 2225 | }; |
| 2226 | |
| 2227 | static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed = |
| 2228 | { |
| 2229 | { |
| 2230 | -1, |
| 2231 | (gchar *) "speed", |
| 2232 | (gchar *) "i", |
| 2233 | NULL |
| 2234 | }, |
| 2235 | FALSE |
| 2236 | }; |
| 2237 | |
| 2238 | static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] = |
| 2239 | { |
| 2240 | &_fan_method_info_get_speed_OUT_ARG_speed, |
| 2241 | NULL |
| 2242 | }; |
| 2243 | |
| 2244 | static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed = |
| 2245 | { |
| 2246 | { |
| 2247 | -1, |
| 2248 | (gchar *) "getSpeed", |
| 2249 | NULL, |
| 2250 | (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers, |
| 2251 | NULL |
| 2252 | }, |
| 2253 | "handle-get-speed", |
| 2254 | FALSE |
| 2255 | }; |
| 2256 | |
| 2257 | static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed = |
| 2258 | { |
| 2259 | { |
| 2260 | -1, |
| 2261 | (gchar *) "speed", |
| 2262 | (gchar *) "i", |
| 2263 | NULL |
| 2264 | }, |
| 2265 | FALSE |
| 2266 | }; |
| 2267 | |
| 2268 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] = |
| 2269 | { |
| 2270 | &_fan_method_info_set_speed_IN_ARG_speed, |
| 2271 | NULL |
| 2272 | }; |
| 2273 | |
| 2274 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed = |
| 2275 | { |
| 2276 | { |
| 2277 | -1, |
| 2278 | (gchar *) "setSpeed", |
| 2279 | (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers, |
| 2280 | NULL, |
| 2281 | NULL |
| 2282 | }, |
| 2283 | "handle-set-speed", |
| 2284 | FALSE |
| 2285 | }; |
| 2286 | |
| 2287 | static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] = |
| 2288 | { |
| 2289 | &_fan_method_info_set_cooling_zone, |
| 2290 | &_fan_method_info_get_speed, |
| 2291 | &_fan_method_info_set_speed, |
| 2292 | NULL |
| 2293 | }; |
| 2294 | |
| 2295 | static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed = |
| 2296 | { |
| 2297 | { |
| 2298 | -1, |
| 2299 | (gchar *) "speed", |
| 2300 | (gchar *) "i", |
| 2301 | NULL |
| 2302 | }, |
| 2303 | FALSE |
| 2304 | }; |
| 2305 | |
| 2306 | static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] = |
| 2307 | { |
| 2308 | &_fan_signal_info_speed_changed_ARG_speed, |
| 2309 | NULL |
| 2310 | }; |
| 2311 | |
| 2312 | static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed = |
| 2313 | { |
| 2314 | { |
| 2315 | -1, |
| 2316 | (gchar *) "SpeedChanged", |
| 2317 | (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers, |
| 2318 | NULL |
| 2319 | }, |
| 2320 | "speed-changed" |
| 2321 | }; |
| 2322 | |
| 2323 | static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error = |
| 2324 | { |
| 2325 | { |
| 2326 | -1, |
| 2327 | (gchar *) "TachError", |
| 2328 | NULL, |
| 2329 | NULL |
| 2330 | }, |
| 2331 | "tach-error" |
| 2332 | }; |
| 2333 | |
| 2334 | static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] = |
| 2335 | { |
| 2336 | &_fan_signal_info_speed_changed, |
| 2337 | &_fan_signal_info_tach_error, |
| 2338 | NULL |
| 2339 | }; |
| 2340 | |
| 2341 | static const _ExtendedGDBusPropertyInfo _fan_property_info_speed = |
| 2342 | { |
| 2343 | { |
| 2344 | -1, |
| 2345 | (gchar *) "speed", |
| 2346 | (gchar *) "i", |
| 2347 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2348 | NULL |
| 2349 | }, |
| 2350 | "speed", |
| 2351 | FALSE |
| 2352 | }; |
| 2353 | |
| 2354 | static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone = |
| 2355 | { |
| 2356 | { |
| 2357 | -1, |
| 2358 | (gchar *) "cooling_zone", |
| 2359 | (gchar *) "i", |
| 2360 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2361 | NULL |
| 2362 | }, |
| 2363 | "cooling-zone", |
| 2364 | FALSE |
| 2365 | }; |
| 2366 | |
| 2367 | static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num = |
| 2368 | { |
| 2369 | { |
| 2370 | -1, |
| 2371 | (gchar *) "pwm_num", |
| 2372 | (gchar *) "i", |
| 2373 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2374 | NULL |
| 2375 | }, |
| 2376 | "pwm-num", |
| 2377 | FALSE |
| 2378 | }; |
| 2379 | |
| 2380 | static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] = |
| 2381 | { |
| 2382 | &_fan_property_info_speed, |
| 2383 | &_fan_property_info_cooling_zone, |
| 2384 | &_fan_property_info_pwm_num, |
| 2385 | NULL |
| 2386 | }; |
| 2387 | |
| 2388 | static const _ExtendedGDBusInterfaceInfo _fan_interface_info = |
| 2389 | { |
| 2390 | { |
| 2391 | -1, |
| 2392 | (gchar *) "org.openbmc.Fan", |
| 2393 | (GDBusMethodInfo **) &_fan_method_info_pointers, |
| 2394 | (GDBusSignalInfo **) &_fan_signal_info_pointers, |
| 2395 | (GDBusPropertyInfo **) &_fan_property_info_pointers, |
| 2396 | NULL |
| 2397 | }, |
| 2398 | "fan", |
| 2399 | }; |
| 2400 | |
| 2401 | |
| 2402 | /** |
| 2403 | * fan_interface_info: |
| 2404 | * |
| 2405 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface. |
| 2406 | * |
| 2407 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 2408 | */ |
| 2409 | GDBusInterfaceInfo * |
| 2410 | fan_interface_info (void) |
| 2411 | { |
| 2412 | return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct; |
| 2413 | } |
| 2414 | |
| 2415 | /** |
| 2416 | * fan_override_properties: |
| 2417 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 2418 | * @property_id_begin: The property id to assign to the first overridden property. |
| 2419 | * |
| 2420 | * Overrides all #GObject properties in the #Fan interface for a concrete class. |
| 2421 | * The properties are overridden in the order they are defined. |
| 2422 | * |
| 2423 | * Returns: The last property id. |
| 2424 | */ |
| 2425 | guint |
| 2426 | fan_override_properties (GObjectClass *klass, guint property_id_begin) |
| 2427 | { |
| 2428 | g_object_class_override_property (klass, property_id_begin++, "speed"); |
| 2429 | g_object_class_override_property (klass, property_id_begin++, "cooling-zone"); |
| 2430 | g_object_class_override_property (klass, property_id_begin++, "pwm-num"); |
| 2431 | return property_id_begin - 1; |
| 2432 | } |
| 2433 | |
| 2434 | |
| 2435 | |
| 2436 | /** |
| 2437 | * Fan: |
| 2438 | * |
| 2439 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 2440 | */ |
| 2441 | |
| 2442 | /** |
| 2443 | * FanIface: |
| 2444 | * @parent_iface: The parent interface. |
| 2445 | * @handle_get_speed: Handler for the #Fan::handle-get-speed signal. |
| 2446 | * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal. |
| 2447 | * @handle_set_speed: Handler for the #Fan::handle-set-speed signal. |
| 2448 | * @get_cooling_zone: Getter for the #Fan:cooling-zone property. |
| 2449 | * @get_pwm_num: Getter for the #Fan:pwm-num property. |
| 2450 | * @get_speed: Getter for the #Fan:speed property. |
| 2451 | * @speed_changed: Handler for the #Fan::speed-changed signal. |
| 2452 | * @tach_error: Handler for the #Fan::tach-error signal. |
| 2453 | * |
| 2454 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 2455 | */ |
| 2456 | |
| 2457 | typedef FanIface FanInterface; |
| 2458 | G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT); |
| 2459 | |
| 2460 | static void |
| 2461 | fan_default_init (FanIface *iface) |
| 2462 | { |
| 2463 | /* GObject signals for incoming D-Bus method calls: */ |
| 2464 | /** |
| 2465 | * Fan::handle-set-cooling-zone: |
| 2466 | * @object: A #Fan. |
| 2467 | * @invocation: A #GDBusMethodInvocation. |
| 2468 | * @arg_cooling_zone: Argument passed by remote caller. |
| 2469 | * |
| 2470 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. |
| 2471 | * |
| 2472 | * 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. |
| 2473 | * |
| 2474 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2475 | */ |
| 2476 | g_signal_new ("handle-set-cooling-zone", |
| 2477 | G_TYPE_FROM_INTERFACE (iface), |
| 2478 | G_SIGNAL_RUN_LAST, |
| 2479 | G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone), |
| 2480 | g_signal_accumulator_true_handled, |
| 2481 | NULL, |
| 2482 | g_cclosure_marshal_generic, |
| 2483 | G_TYPE_BOOLEAN, |
| 2484 | 2, |
| 2485 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 2486 | |
| 2487 | /** |
| 2488 | * Fan::handle-get-speed: |
| 2489 | * @object: A #Fan. |
| 2490 | * @invocation: A #GDBusMethodInvocation. |
| 2491 | * |
| 2492 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. |
| 2493 | * |
| 2494 | * 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. |
| 2495 | * |
| 2496 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2497 | */ |
| 2498 | g_signal_new ("handle-get-speed", |
| 2499 | G_TYPE_FROM_INTERFACE (iface), |
| 2500 | G_SIGNAL_RUN_LAST, |
| 2501 | G_STRUCT_OFFSET (FanIface, handle_get_speed), |
| 2502 | g_signal_accumulator_true_handled, |
| 2503 | NULL, |
| 2504 | g_cclosure_marshal_generic, |
| 2505 | G_TYPE_BOOLEAN, |
| 2506 | 1, |
| 2507 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 2508 | |
| 2509 | /** |
| 2510 | * Fan::handle-set-speed: |
| 2511 | * @object: A #Fan. |
| 2512 | * @invocation: A #GDBusMethodInvocation. |
| 2513 | * @arg_speed: Argument passed by remote caller. |
| 2514 | * |
| 2515 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. |
| 2516 | * |
| 2517 | * 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. |
| 2518 | * |
| 2519 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 2520 | */ |
| 2521 | g_signal_new ("handle-set-speed", |
| 2522 | G_TYPE_FROM_INTERFACE (iface), |
| 2523 | G_SIGNAL_RUN_LAST, |
| 2524 | G_STRUCT_OFFSET (FanIface, handle_set_speed), |
| 2525 | g_signal_accumulator_true_handled, |
| 2526 | NULL, |
| 2527 | g_cclosure_marshal_generic, |
| 2528 | G_TYPE_BOOLEAN, |
| 2529 | 2, |
| 2530 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 2531 | |
| 2532 | /* GObject signals for received D-Bus signals: */ |
| 2533 | /** |
| 2534 | * Fan::speed-changed: |
| 2535 | * @object: A #Fan. |
| 2536 | * @arg_speed: Argument. |
| 2537 | * |
| 2538 | * 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. |
| 2539 | * |
| 2540 | * 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. |
| 2541 | */ |
| 2542 | g_signal_new ("speed-changed", |
| 2543 | G_TYPE_FROM_INTERFACE (iface), |
| 2544 | G_SIGNAL_RUN_LAST, |
| 2545 | G_STRUCT_OFFSET (FanIface, speed_changed), |
| 2546 | NULL, |
| 2547 | NULL, |
| 2548 | g_cclosure_marshal_generic, |
| 2549 | G_TYPE_NONE, |
| 2550 | 1, G_TYPE_INT); |
| 2551 | |
| 2552 | /** |
| 2553 | * Fan::tach-error: |
| 2554 | * @object: A #Fan. |
| 2555 | * |
| 2556 | * 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. |
| 2557 | * |
| 2558 | * 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. |
| 2559 | */ |
| 2560 | g_signal_new ("tach-error", |
| 2561 | G_TYPE_FROM_INTERFACE (iface), |
| 2562 | G_SIGNAL_RUN_LAST, |
| 2563 | G_STRUCT_OFFSET (FanIface, tach_error), |
| 2564 | NULL, |
| 2565 | NULL, |
| 2566 | g_cclosure_marshal_generic, |
| 2567 | G_TYPE_NONE, |
| 2568 | 0); |
| 2569 | |
| 2570 | /* GObject properties for D-Bus properties: */ |
| 2571 | /** |
| 2572 | * Fan:speed: |
| 2573 | * |
| 2574 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>. |
| 2575 | * |
| 2576 | * 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. |
| 2577 | */ |
| 2578 | g_object_interface_install_property (iface, |
| 2579 | g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2580 | /** |
| 2581 | * Fan:cooling-zone: |
| 2582 | * |
| 2583 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>. |
| 2584 | * |
| 2585 | * 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. |
| 2586 | */ |
| 2587 | g_object_interface_install_property (iface, |
| 2588 | g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2589 | /** |
| 2590 | * Fan:pwm-num: |
| 2591 | * |
| 2592 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>. |
| 2593 | * |
| 2594 | * 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. |
| 2595 | */ |
| 2596 | g_object_interface_install_property (iface, |
| 2597 | g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2598 | } |
| 2599 | |
| 2600 | /** |
| 2601 | * fan_get_speed: (skip) |
| 2602 | * @object: A #Fan. |
| 2603 | * |
| 2604 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property. |
| 2605 | * |
| 2606 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2607 | * |
| 2608 | * Returns: The property value. |
| 2609 | */ |
| 2610 | gint |
| 2611 | fan_get_speed (Fan *object) |
| 2612 | { |
| 2613 | return FAN_GET_IFACE (object)->get_speed (object); |
| 2614 | } |
| 2615 | |
| 2616 | /** |
| 2617 | * fan_set_speed: (skip) |
| 2618 | * @object: A #Fan. |
| 2619 | * @value: The value to set. |
| 2620 | * |
| 2621 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value. |
| 2622 | * |
| 2623 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2624 | */ |
| 2625 | void |
| 2626 | fan_set_speed (Fan *object, gint value) |
| 2627 | { |
| 2628 | g_object_set (G_OBJECT (object), "speed", value, NULL); |
| 2629 | } |
| 2630 | |
| 2631 | /** |
| 2632 | * fan_get_cooling_zone: (skip) |
| 2633 | * @object: A #Fan. |
| 2634 | * |
| 2635 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property. |
| 2636 | * |
| 2637 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2638 | * |
| 2639 | * Returns: The property value. |
| 2640 | */ |
| 2641 | gint |
| 2642 | fan_get_cooling_zone (Fan *object) |
| 2643 | { |
| 2644 | return FAN_GET_IFACE (object)->get_cooling_zone (object); |
| 2645 | } |
| 2646 | |
| 2647 | /** |
| 2648 | * fan_set_cooling_zone: (skip) |
| 2649 | * @object: A #Fan. |
| 2650 | * @value: The value to set. |
| 2651 | * |
| 2652 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value. |
| 2653 | * |
| 2654 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2655 | */ |
| 2656 | void |
| 2657 | fan_set_cooling_zone (Fan *object, gint value) |
| 2658 | { |
| 2659 | g_object_set (G_OBJECT (object), "cooling-zone", value, NULL); |
| 2660 | } |
| 2661 | |
| 2662 | /** |
| 2663 | * fan_get_pwm_num: (skip) |
| 2664 | * @object: A #Fan. |
| 2665 | * |
| 2666 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property. |
| 2667 | * |
| 2668 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2669 | * |
| 2670 | * Returns: The property value. |
| 2671 | */ |
| 2672 | gint |
| 2673 | fan_get_pwm_num (Fan *object) |
| 2674 | { |
| 2675 | return FAN_GET_IFACE (object)->get_pwm_num (object); |
| 2676 | } |
| 2677 | |
| 2678 | /** |
| 2679 | * fan_set_pwm_num: (skip) |
| 2680 | * @object: A #Fan. |
| 2681 | * @value: The value to set. |
| 2682 | * |
| 2683 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value. |
| 2684 | * |
| 2685 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2686 | */ |
| 2687 | void |
| 2688 | fan_set_pwm_num (Fan *object, gint value) |
| 2689 | { |
| 2690 | g_object_set (G_OBJECT (object), "pwm-num", value, NULL); |
| 2691 | } |
| 2692 | |
| 2693 | /** |
| 2694 | * fan_emit_speed_changed: |
| 2695 | * @object: A #Fan. |
| 2696 | * @arg_speed: Argument to pass with the signal. |
| 2697 | * |
| 2698 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal. |
| 2699 | */ |
| 2700 | void |
| 2701 | fan_emit_speed_changed ( |
| 2702 | Fan *object, |
| 2703 | gint arg_speed) |
| 2704 | { |
| 2705 | g_signal_emit_by_name (object, "speed-changed", arg_speed); |
| 2706 | } |
| 2707 | |
| 2708 | /** |
| 2709 | * fan_emit_tach_error: |
| 2710 | * @object: A #Fan. |
| 2711 | * |
| 2712 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal. |
| 2713 | */ |
| 2714 | void |
| 2715 | fan_emit_tach_error ( |
| 2716 | Fan *object) |
| 2717 | { |
| 2718 | g_signal_emit_by_name (object, "tach-error"); |
| 2719 | } |
| 2720 | |
| 2721 | /** |
| 2722 | * fan_call_set_cooling_zone: |
| 2723 | * @proxy: A #FanProxy. |
| 2724 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 2725 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2726 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2727 | * @user_data: User data to pass to @callback. |
| 2728 | * |
| 2729 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. |
| 2730 | * 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. |
| 2731 | * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation. |
| 2732 | * |
| 2733 | * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method. |
| 2734 | */ |
| 2735 | void |
| 2736 | fan_call_set_cooling_zone ( |
| 2737 | Fan *proxy, |
| 2738 | gint arg_cooling_zone, |
| 2739 | GCancellable *cancellable, |
| 2740 | GAsyncReadyCallback callback, |
| 2741 | gpointer user_data) |
| 2742 | { |
| 2743 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2744 | "setCoolingZone", |
| 2745 | g_variant_new ("(i)", |
| 2746 | arg_cooling_zone), |
| 2747 | G_DBUS_CALL_FLAGS_NONE, |
| 2748 | -1, |
| 2749 | cancellable, |
| 2750 | callback, |
| 2751 | user_data); |
| 2752 | } |
| 2753 | |
| 2754 | /** |
| 2755 | * fan_call_set_cooling_zone_finish: |
| 2756 | * @proxy: A #FanProxy. |
| 2757 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone(). |
| 2758 | * @error: Return location for error or %NULL. |
| 2759 | * |
| 2760 | * Finishes an operation started with fan_call_set_cooling_zone(). |
| 2761 | * |
| 2762 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2763 | */ |
| 2764 | gboolean |
| 2765 | fan_call_set_cooling_zone_finish ( |
| 2766 | Fan *proxy, |
| 2767 | GAsyncResult *res, |
| 2768 | GError **error) |
| 2769 | { |
| 2770 | GVariant *_ret; |
| 2771 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2772 | if (_ret == NULL) |
| 2773 | goto _out; |
| 2774 | g_variant_get (_ret, |
| 2775 | "()"); |
| 2776 | g_variant_unref (_ret); |
| 2777 | _out: |
| 2778 | return _ret != NULL; |
| 2779 | } |
| 2780 | |
| 2781 | /** |
| 2782 | * fan_call_set_cooling_zone_sync: |
| 2783 | * @proxy: A #FanProxy. |
| 2784 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 2785 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2786 | * @error: Return location for error or %NULL. |
| 2787 | * |
| 2788 | * 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. |
| 2789 | * |
| 2790 | * See fan_call_set_cooling_zone() for the asynchronous version of this method. |
| 2791 | * |
| 2792 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2793 | */ |
| 2794 | gboolean |
| 2795 | fan_call_set_cooling_zone_sync ( |
| 2796 | Fan *proxy, |
| 2797 | gint arg_cooling_zone, |
| 2798 | GCancellable *cancellable, |
| 2799 | GError **error) |
| 2800 | { |
| 2801 | GVariant *_ret; |
| 2802 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2803 | "setCoolingZone", |
| 2804 | g_variant_new ("(i)", |
| 2805 | arg_cooling_zone), |
| 2806 | G_DBUS_CALL_FLAGS_NONE, |
| 2807 | -1, |
| 2808 | cancellable, |
| 2809 | error); |
| 2810 | if (_ret == NULL) |
| 2811 | goto _out; |
| 2812 | g_variant_get (_ret, |
| 2813 | "()"); |
| 2814 | g_variant_unref (_ret); |
| 2815 | _out: |
| 2816 | return _ret != NULL; |
| 2817 | } |
| 2818 | |
| 2819 | /** |
| 2820 | * fan_call_get_speed: |
| 2821 | * @proxy: A #FanProxy. |
| 2822 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2823 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2824 | * @user_data: User data to pass to @callback. |
| 2825 | * |
| 2826 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. |
| 2827 | * 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. |
| 2828 | * You can then call fan_call_get_speed_finish() to get the result of the operation. |
| 2829 | * |
| 2830 | * See fan_call_get_speed_sync() for the synchronous, blocking version of this method. |
| 2831 | */ |
| 2832 | void |
| 2833 | fan_call_get_speed ( |
| 2834 | Fan *proxy, |
| 2835 | GCancellable *cancellable, |
| 2836 | GAsyncReadyCallback callback, |
| 2837 | gpointer user_data) |
| 2838 | { |
| 2839 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2840 | "getSpeed", |
| 2841 | g_variant_new ("()"), |
| 2842 | G_DBUS_CALL_FLAGS_NONE, |
| 2843 | -1, |
| 2844 | cancellable, |
| 2845 | callback, |
| 2846 | user_data); |
| 2847 | } |
| 2848 | |
| 2849 | /** |
| 2850 | * fan_call_get_speed_finish: |
| 2851 | * @proxy: A #FanProxy. |
| 2852 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 2853 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed(). |
| 2854 | * @error: Return location for error or %NULL. |
| 2855 | * |
| 2856 | * Finishes an operation started with fan_call_get_speed(). |
| 2857 | * |
| 2858 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2859 | */ |
| 2860 | gboolean |
| 2861 | fan_call_get_speed_finish ( |
| 2862 | Fan *proxy, |
| 2863 | gint *out_speed, |
| 2864 | GAsyncResult *res, |
| 2865 | GError **error) |
| 2866 | { |
| 2867 | GVariant *_ret; |
| 2868 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2869 | if (_ret == NULL) |
| 2870 | goto _out; |
| 2871 | g_variant_get (_ret, |
| 2872 | "(i)", |
| 2873 | out_speed); |
| 2874 | g_variant_unref (_ret); |
| 2875 | _out: |
| 2876 | return _ret != NULL; |
| 2877 | } |
| 2878 | |
| 2879 | /** |
| 2880 | * fan_call_get_speed_sync: |
| 2881 | * @proxy: A #FanProxy. |
| 2882 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 2883 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2884 | * @error: Return location for error or %NULL. |
| 2885 | * |
| 2886 | * 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. |
| 2887 | * |
| 2888 | * See fan_call_get_speed() for the asynchronous version of this method. |
| 2889 | * |
| 2890 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2891 | */ |
| 2892 | gboolean |
| 2893 | fan_call_get_speed_sync ( |
| 2894 | Fan *proxy, |
| 2895 | gint *out_speed, |
| 2896 | GCancellable *cancellable, |
| 2897 | GError **error) |
| 2898 | { |
| 2899 | GVariant *_ret; |
| 2900 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2901 | "getSpeed", |
| 2902 | g_variant_new ("()"), |
| 2903 | G_DBUS_CALL_FLAGS_NONE, |
| 2904 | -1, |
| 2905 | cancellable, |
| 2906 | error); |
| 2907 | if (_ret == NULL) |
| 2908 | goto _out; |
| 2909 | g_variant_get (_ret, |
| 2910 | "(i)", |
| 2911 | out_speed); |
| 2912 | g_variant_unref (_ret); |
| 2913 | _out: |
| 2914 | return _ret != NULL; |
| 2915 | } |
| 2916 | |
| 2917 | /** |
| 2918 | * fan_call_set_speed: |
| 2919 | * @proxy: A #FanProxy. |
| 2920 | * @arg_speed: Argument to pass with the method invocation. |
| 2921 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2922 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2923 | * @user_data: User data to pass to @callback. |
| 2924 | * |
| 2925 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. |
| 2926 | * 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. |
| 2927 | * You can then call fan_call_set_speed_finish() to get the result of the operation. |
| 2928 | * |
| 2929 | * See fan_call_set_speed_sync() for the synchronous, blocking version of this method. |
| 2930 | */ |
| 2931 | void |
| 2932 | fan_call_set_speed ( |
| 2933 | Fan *proxy, |
| 2934 | gint arg_speed, |
| 2935 | GCancellable *cancellable, |
| 2936 | GAsyncReadyCallback callback, |
| 2937 | gpointer user_data) |
| 2938 | { |
| 2939 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 2940 | "setSpeed", |
| 2941 | g_variant_new ("(i)", |
| 2942 | arg_speed), |
| 2943 | G_DBUS_CALL_FLAGS_NONE, |
| 2944 | -1, |
| 2945 | cancellable, |
| 2946 | callback, |
| 2947 | user_data); |
| 2948 | } |
| 2949 | |
| 2950 | /** |
| 2951 | * fan_call_set_speed_finish: |
| 2952 | * @proxy: A #FanProxy. |
| 2953 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed(). |
| 2954 | * @error: Return location for error or %NULL. |
| 2955 | * |
| 2956 | * Finishes an operation started with fan_call_set_speed(). |
| 2957 | * |
| 2958 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2959 | */ |
| 2960 | gboolean |
| 2961 | fan_call_set_speed_finish ( |
| 2962 | Fan *proxy, |
| 2963 | GAsyncResult *res, |
| 2964 | GError **error) |
| 2965 | { |
| 2966 | GVariant *_ret; |
| 2967 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2968 | if (_ret == NULL) |
| 2969 | goto _out; |
| 2970 | g_variant_get (_ret, |
| 2971 | "()"); |
| 2972 | g_variant_unref (_ret); |
| 2973 | _out: |
| 2974 | return _ret != NULL; |
| 2975 | } |
| 2976 | |
| 2977 | /** |
| 2978 | * fan_call_set_speed_sync: |
| 2979 | * @proxy: A #FanProxy. |
| 2980 | * @arg_speed: Argument to pass with the method invocation. |
| 2981 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2982 | * @error: Return location for error or %NULL. |
| 2983 | * |
| 2984 | * 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. |
| 2985 | * |
| 2986 | * See fan_call_set_speed() for the asynchronous version of this method. |
| 2987 | * |
| 2988 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2989 | */ |
| 2990 | gboolean |
| 2991 | fan_call_set_speed_sync ( |
| 2992 | Fan *proxy, |
| 2993 | gint arg_speed, |
| 2994 | GCancellable *cancellable, |
| 2995 | GError **error) |
| 2996 | { |
| 2997 | GVariant *_ret; |
| 2998 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 2999 | "setSpeed", |
| 3000 | g_variant_new ("(i)", |
| 3001 | arg_speed), |
| 3002 | G_DBUS_CALL_FLAGS_NONE, |
| 3003 | -1, |
| 3004 | cancellable, |
| 3005 | error); |
| 3006 | if (_ret == NULL) |
| 3007 | goto _out; |
| 3008 | g_variant_get (_ret, |
| 3009 | "()"); |
| 3010 | g_variant_unref (_ret); |
| 3011 | _out: |
| 3012 | return _ret != NULL; |
| 3013 | } |
| 3014 | |
| 3015 | /** |
| 3016 | * fan_complete_set_cooling_zone: |
| 3017 | * @object: A #Fan. |
| 3018 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3019 | * |
| 3020 | * 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. |
| 3021 | * |
| 3022 | * This method will free @invocation, you cannot use it afterwards. |
| 3023 | */ |
| 3024 | void |
| 3025 | fan_complete_set_cooling_zone ( |
| 3026 | Fan *object, |
| 3027 | GDBusMethodInvocation *invocation) |
| 3028 | { |
| 3029 | g_dbus_method_invocation_return_value (invocation, |
| 3030 | g_variant_new ("()")); |
| 3031 | } |
| 3032 | |
| 3033 | /** |
| 3034 | * fan_complete_get_speed: |
| 3035 | * @object: A #Fan. |
| 3036 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3037 | * @speed: Parameter to return. |
| 3038 | * |
| 3039 | * 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. |
| 3040 | * |
| 3041 | * This method will free @invocation, you cannot use it afterwards. |
| 3042 | */ |
| 3043 | void |
| 3044 | fan_complete_get_speed ( |
| 3045 | Fan *object, |
| 3046 | GDBusMethodInvocation *invocation, |
| 3047 | gint speed) |
| 3048 | { |
| 3049 | g_dbus_method_invocation_return_value (invocation, |
| 3050 | g_variant_new ("(i)", |
| 3051 | speed)); |
| 3052 | } |
| 3053 | |
| 3054 | /** |
| 3055 | * fan_complete_set_speed: |
| 3056 | * @object: A #Fan. |
| 3057 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3058 | * |
| 3059 | * 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. |
| 3060 | * |
| 3061 | * This method will free @invocation, you cannot use it afterwards. |
| 3062 | */ |
| 3063 | void |
| 3064 | fan_complete_set_speed ( |
| 3065 | Fan *object, |
| 3066 | GDBusMethodInvocation *invocation) |
| 3067 | { |
| 3068 | g_dbus_method_invocation_return_value (invocation, |
| 3069 | g_variant_new ("()")); |
| 3070 | } |
| 3071 | |
| 3072 | /* ------------------------------------------------------------------------ */ |
| 3073 | |
| 3074 | /** |
| 3075 | * FanProxy: |
| 3076 | * |
| 3077 | * The #FanProxy structure contains only private data and should only be accessed using the provided API. |
| 3078 | */ |
| 3079 | |
| 3080 | /** |
| 3081 | * FanProxyClass: |
| 3082 | * @parent_class: The parent class. |
| 3083 | * |
| 3084 | * Class structure for #FanProxy. |
| 3085 | */ |
| 3086 | |
| 3087 | struct _FanProxyPrivate |
| 3088 | { |
| 3089 | GData *qdata; |
| 3090 | }; |
| 3091 | |
| 3092 | static void fan_proxy_iface_init (FanIface *iface); |
| 3093 | |
| 3094 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3095 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 3096 | G_ADD_PRIVATE (FanProxy) |
| 3097 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 3098 | |
| 3099 | #else |
| 3100 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 3101 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 3102 | |
| 3103 | #endif |
| 3104 | static void |
| 3105 | fan_proxy_finalize (GObject *object) |
| 3106 | { |
| 3107 | FanProxy *proxy = FAN_PROXY (object); |
| 3108 | g_datalist_clear (&proxy->priv->qdata); |
| 3109 | G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object); |
| 3110 | } |
| 3111 | |
| 3112 | static void |
| 3113 | fan_proxy_get_property (GObject *object, |
| 3114 | guint prop_id, |
| 3115 | GValue *value, |
| 3116 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3117 | { |
| 3118 | const _ExtendedGDBusPropertyInfo *info; |
| 3119 | GVariant *variant; |
| 3120 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3121 | info = _fan_property_info_pointers[prop_id - 1]; |
| 3122 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3123 | if (info->use_gvariant) |
| 3124 | { |
| 3125 | g_value_set_variant (value, variant); |
| 3126 | } |
| 3127 | else |
| 3128 | { |
| 3129 | if (variant != NULL) |
| 3130 | g_dbus_gvariant_to_gvalue (variant, value); |
| 3131 | } |
| 3132 | if (variant != NULL) |
| 3133 | g_variant_unref (variant); |
| 3134 | } |
| 3135 | |
| 3136 | static void |
| 3137 | fan_proxy_set_property_cb (GDBusProxy *proxy, |
| 3138 | GAsyncResult *res, |
| 3139 | gpointer user_data) |
| 3140 | { |
| 3141 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 3142 | GError *error; |
| 3143 | GVariant *_ret; |
| 3144 | error = NULL; |
| 3145 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 3146 | if (!_ret) |
| 3147 | { |
| 3148 | g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)", |
| 3149 | info->parent_struct.name, |
| 3150 | error->message, g_quark_to_string (error->domain), error->code); |
| 3151 | g_error_free (error); |
| 3152 | } |
| 3153 | else |
| 3154 | { |
| 3155 | g_variant_unref (_ret); |
| 3156 | } |
| 3157 | } |
| 3158 | |
| 3159 | static void |
| 3160 | fan_proxy_set_property (GObject *object, |
| 3161 | guint prop_id, |
| 3162 | const GValue *value, |
| 3163 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3164 | { |
| 3165 | const _ExtendedGDBusPropertyInfo *info; |
| 3166 | GVariant *variant; |
| 3167 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3168 | info = _fan_property_info_pointers[prop_id - 1]; |
| 3169 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3170 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 3171 | "org.freedesktop.DBus.Properties.Set", |
| 3172 | g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant), |
| 3173 | G_DBUS_CALL_FLAGS_NONE, |
| 3174 | -1, |
| 3175 | NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 3176 | g_variant_unref (variant); |
| 3177 | } |
| 3178 | |
| 3179 | static void |
| 3180 | fan_proxy_g_signal (GDBusProxy *proxy, |
| 3181 | const gchar *sender_name G_GNUC_UNUSED, |
| 3182 | const gchar *signal_name, |
| 3183 | GVariant *parameters) |
| 3184 | { |
| 3185 | _ExtendedGDBusSignalInfo *info; |
| 3186 | GVariantIter iter; |
| 3187 | GVariant *child; |
| 3188 | GValue *paramv; |
| 3189 | guint num_params; |
| 3190 | guint n; |
| 3191 | guint signal_id; |
| 3192 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name); |
| 3193 | if (info == NULL) |
| 3194 | return; |
| 3195 | num_params = g_variant_n_children (parameters); |
| 3196 | paramv = g_new0 (GValue, num_params + 1); |
| 3197 | g_value_init (¶mv[0], TYPE_FAN); |
| 3198 | g_value_set_object (¶mv[0], proxy); |
| 3199 | g_variant_iter_init (&iter, parameters); |
| 3200 | n = 1; |
| 3201 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3202 | { |
| 3203 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 3204 | if (arg_info->use_gvariant) |
| 3205 | { |
| 3206 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3207 | g_value_set_variant (¶mv[n], child); |
| 3208 | n++; |
| 3209 | } |
| 3210 | else |
| 3211 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3212 | g_variant_unref (child); |
| 3213 | } |
| 3214 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 3215 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 3216 | for (n = 0; n < num_params + 1; n++) |
| 3217 | g_value_unset (¶mv[n]); |
| 3218 | g_free (paramv); |
| 3219 | } |
| 3220 | |
| 3221 | static void |
| 3222 | fan_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 3223 | GVariant *changed_properties, |
| 3224 | const gchar *const *invalidated_properties) |
| 3225 | { |
| 3226 | FanProxy *proxy = FAN_PROXY (_proxy); |
| 3227 | guint n; |
| 3228 | const gchar *key; |
| 3229 | GVariantIter *iter; |
| 3230 | _ExtendedGDBusPropertyInfo *info; |
| 3231 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 3232 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 3233 | { |
| 3234 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key); |
| 3235 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 3236 | if (info != NULL) |
| 3237 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3238 | } |
| 3239 | g_variant_iter_free (iter); |
| 3240 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 3241 | { |
| 3242 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]); |
| 3243 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 3244 | if (info != NULL) |
| 3245 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3246 | } |
| 3247 | } |
| 3248 | |
| 3249 | static gint |
| 3250 | fan_proxy_get_speed (Fan *object) |
| 3251 | { |
| 3252 | FanProxy *proxy = FAN_PROXY (object); |
| 3253 | GVariant *variant; |
| 3254 | gint value = 0; |
| 3255 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed"); |
| 3256 | if (variant != NULL) |
| 3257 | { |
| 3258 | value = g_variant_get_int32 (variant); |
| 3259 | g_variant_unref (variant); |
| 3260 | } |
| 3261 | return value; |
| 3262 | } |
| 3263 | |
| 3264 | static gint |
| 3265 | fan_proxy_get_cooling_zone (Fan *object) |
| 3266 | { |
| 3267 | FanProxy *proxy = FAN_PROXY (object); |
| 3268 | GVariant *variant; |
| 3269 | gint value = 0; |
| 3270 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone"); |
| 3271 | if (variant != NULL) |
| 3272 | { |
| 3273 | value = g_variant_get_int32 (variant); |
| 3274 | g_variant_unref (variant); |
| 3275 | } |
| 3276 | return value; |
| 3277 | } |
| 3278 | |
| 3279 | static gint |
| 3280 | fan_proxy_get_pwm_num (Fan *object) |
| 3281 | { |
| 3282 | FanProxy *proxy = FAN_PROXY (object); |
| 3283 | GVariant *variant; |
| 3284 | gint value = 0; |
| 3285 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num"); |
| 3286 | if (variant != NULL) |
| 3287 | { |
| 3288 | value = g_variant_get_int32 (variant); |
| 3289 | g_variant_unref (variant); |
| 3290 | } |
| 3291 | return value; |
| 3292 | } |
| 3293 | |
| 3294 | static void |
| 3295 | fan_proxy_init (FanProxy *proxy) |
| 3296 | { |
| 3297 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3298 | proxy->priv = fan_proxy_get_instance_private (proxy); |
| 3299 | #else |
| 3300 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate); |
| 3301 | #endif |
| 3302 | |
| 3303 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ()); |
| 3304 | } |
| 3305 | |
| 3306 | static void |
| 3307 | fan_proxy_class_init (FanProxyClass *klass) |
| 3308 | { |
| 3309 | GObjectClass *gobject_class; |
| 3310 | GDBusProxyClass *proxy_class; |
| 3311 | |
| 3312 | gobject_class = G_OBJECT_CLASS (klass); |
| 3313 | gobject_class->finalize = fan_proxy_finalize; |
| 3314 | gobject_class->get_property = fan_proxy_get_property; |
| 3315 | gobject_class->set_property = fan_proxy_set_property; |
| 3316 | |
| 3317 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 3318 | proxy_class->g_signal = fan_proxy_g_signal; |
| 3319 | proxy_class->g_properties_changed = fan_proxy_g_properties_changed; |
| 3320 | |
| 3321 | fan_override_properties (gobject_class, 1); |
| 3322 | |
| 3323 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 3324 | g_type_class_add_private (klass, sizeof (FanProxyPrivate)); |
| 3325 | #endif |
| 3326 | } |
| 3327 | |
| 3328 | static void |
| 3329 | fan_proxy_iface_init (FanIface *iface) |
| 3330 | { |
| 3331 | iface->get_speed = fan_proxy_get_speed; |
| 3332 | iface->get_cooling_zone = fan_proxy_get_cooling_zone; |
| 3333 | iface->get_pwm_num = fan_proxy_get_pwm_num; |
| 3334 | } |
| 3335 | |
| 3336 | /** |
| 3337 | * fan_proxy_new: |
| 3338 | * @connection: A #GDBusConnection. |
| 3339 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3340 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3341 | * @object_path: An object path. |
| 3342 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3343 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3344 | * @user_data: User data to pass to @callback. |
| 3345 | * |
| 3346 | * 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. |
| 3347 | * |
| 3348 | * 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. |
| 3349 | * You can then call fan_proxy_new_finish() to get the result of the operation. |
| 3350 | * |
| 3351 | * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 3352 | */ |
| 3353 | void |
| 3354 | fan_proxy_new ( |
| 3355 | GDBusConnection *connection, |
| 3356 | GDBusProxyFlags flags, |
| 3357 | const gchar *name, |
| 3358 | const gchar *object_path, |
| 3359 | GCancellable *cancellable, |
| 3360 | GAsyncReadyCallback callback, |
| 3361 | gpointer user_data) |
| 3362 | { |
| 3363 | 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); |
| 3364 | } |
| 3365 | |
| 3366 | /** |
| 3367 | * fan_proxy_new_finish: |
| 3368 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new(). |
| 3369 | * @error: Return location for error or %NULL |
| 3370 | * |
| 3371 | * Finishes an operation started with fan_proxy_new(). |
| 3372 | * |
| 3373 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 3374 | */ |
| 3375 | Fan * |
| 3376 | fan_proxy_new_finish ( |
| 3377 | GAsyncResult *res, |
| 3378 | GError **error) |
| 3379 | { |
| 3380 | GObject *ret; |
| 3381 | GObject *source_object; |
| 3382 | source_object = g_async_result_get_source_object (res); |
| 3383 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3384 | g_object_unref (source_object); |
| 3385 | if (ret != NULL) |
| 3386 | return FAN (ret); |
| 3387 | else |
| 3388 | return NULL; |
| 3389 | } |
| 3390 | |
| 3391 | /** |
| 3392 | * fan_proxy_new_sync: |
| 3393 | * @connection: A #GDBusConnection. |
| 3394 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3395 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3396 | * @object_path: An object path. |
| 3397 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3398 | * @error: Return location for error or %NULL |
| 3399 | * |
| 3400 | * 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. |
| 3401 | * |
| 3402 | * The calling thread is blocked until a reply is received. |
| 3403 | * |
| 3404 | * See fan_proxy_new() for the asynchronous version of this constructor. |
| 3405 | * |
| 3406 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 3407 | */ |
| 3408 | Fan * |
| 3409 | fan_proxy_new_sync ( |
| 3410 | GDBusConnection *connection, |
| 3411 | GDBusProxyFlags flags, |
| 3412 | const gchar *name, |
| 3413 | const gchar *object_path, |
| 3414 | GCancellable *cancellable, |
| 3415 | GError **error) |
| 3416 | { |
| 3417 | GInitable *ret; |
| 3418 | 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); |
| 3419 | if (ret != NULL) |
| 3420 | return FAN (ret); |
| 3421 | else |
| 3422 | return NULL; |
| 3423 | } |
| 3424 | |
| 3425 | |
| 3426 | /** |
| 3427 | * fan_proxy_new_for_bus: |
| 3428 | * @bus_type: A #GBusType. |
| 3429 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3430 | * @name: A bus name (well-known or unique). |
| 3431 | * @object_path: An object path. |
| 3432 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3433 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3434 | * @user_data: User data to pass to @callback. |
| 3435 | * |
| 3436 | * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 3437 | * |
| 3438 | * 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. |
| 3439 | * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation. |
| 3440 | * |
| 3441 | * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 3442 | */ |
| 3443 | void |
| 3444 | fan_proxy_new_for_bus ( |
| 3445 | GBusType bus_type, |
| 3446 | GDBusProxyFlags flags, |
| 3447 | const gchar *name, |
| 3448 | const gchar *object_path, |
| 3449 | GCancellable *cancellable, |
| 3450 | GAsyncReadyCallback callback, |
| 3451 | gpointer user_data) |
| 3452 | { |
| 3453 | 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); |
| 3454 | } |
| 3455 | |
| 3456 | /** |
| 3457 | * fan_proxy_new_for_bus_finish: |
| 3458 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus(). |
| 3459 | * @error: Return location for error or %NULL |
| 3460 | * |
| 3461 | * Finishes an operation started with fan_proxy_new_for_bus(). |
| 3462 | * |
| 3463 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 3464 | */ |
| 3465 | Fan * |
| 3466 | fan_proxy_new_for_bus_finish ( |
| 3467 | GAsyncResult *res, |
| 3468 | GError **error) |
| 3469 | { |
| 3470 | GObject *ret; |
| 3471 | GObject *source_object; |
| 3472 | source_object = g_async_result_get_source_object (res); |
| 3473 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3474 | g_object_unref (source_object); |
| 3475 | if (ret != NULL) |
| 3476 | return FAN (ret); |
| 3477 | else |
| 3478 | return NULL; |
| 3479 | } |
| 3480 | |
| 3481 | /** |
| 3482 | * fan_proxy_new_for_bus_sync: |
| 3483 | * @bus_type: A #GBusType. |
| 3484 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3485 | * @name: A bus name (well-known or unique). |
| 3486 | * @object_path: An object path. |
| 3487 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3488 | * @error: Return location for error or %NULL |
| 3489 | * |
| 3490 | * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 3491 | * |
| 3492 | * The calling thread is blocked until a reply is received. |
| 3493 | * |
| 3494 | * See fan_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 3495 | * |
| 3496 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 3497 | */ |
| 3498 | Fan * |
| 3499 | fan_proxy_new_for_bus_sync ( |
| 3500 | GBusType bus_type, |
| 3501 | GDBusProxyFlags flags, |
| 3502 | const gchar *name, |
| 3503 | const gchar *object_path, |
| 3504 | GCancellable *cancellable, |
| 3505 | GError **error) |
| 3506 | { |
| 3507 | GInitable *ret; |
| 3508 | 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); |
| 3509 | if (ret != NULL) |
| 3510 | return FAN (ret); |
| 3511 | else |
| 3512 | return NULL; |
| 3513 | } |
| 3514 | |
| 3515 | |
| 3516 | /* ------------------------------------------------------------------------ */ |
| 3517 | |
| 3518 | /** |
| 3519 | * FanSkeleton: |
| 3520 | * |
| 3521 | * The #FanSkeleton structure contains only private data and should only be accessed using the provided API. |
| 3522 | */ |
| 3523 | |
| 3524 | /** |
| 3525 | * FanSkeletonClass: |
| 3526 | * @parent_class: The parent class. |
| 3527 | * |
| 3528 | * Class structure for #FanSkeleton. |
| 3529 | */ |
| 3530 | |
| 3531 | struct _FanSkeletonPrivate |
| 3532 | { |
| 3533 | GValue *properties; |
| 3534 | GList *changed_properties; |
| 3535 | GSource *changed_properties_idle_source; |
| 3536 | GMainContext *context; |
| 3537 | GMutex lock; |
| 3538 | }; |
| 3539 | |
| 3540 | static void |
| 3541 | _fan_skeleton_handle_method_call ( |
| 3542 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3543 | const gchar *sender G_GNUC_UNUSED, |
| 3544 | const gchar *object_path G_GNUC_UNUSED, |
| 3545 | const gchar *interface_name, |
| 3546 | const gchar *method_name, |
| 3547 | GVariant *parameters, |
| 3548 | GDBusMethodInvocation *invocation, |
| 3549 | gpointer user_data) |
| 3550 | { |
| 3551 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3552 | _ExtendedGDBusMethodInfo *info; |
| 3553 | GVariantIter iter; |
| 3554 | GVariant *child; |
| 3555 | GValue *paramv; |
| 3556 | guint num_params; |
| 3557 | guint num_extra; |
| 3558 | guint n; |
| 3559 | guint signal_id; |
| 3560 | GValue return_value = G_VALUE_INIT; |
| 3561 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 3562 | g_assert (info != NULL); |
| 3563 | num_params = g_variant_n_children (parameters); |
| 3564 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 3565 | n = 0; |
| 3566 | g_value_init (¶mv[n], TYPE_FAN); |
| 3567 | g_value_set_object (¶mv[n++], skeleton); |
| 3568 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 3569 | g_value_set_object (¶mv[n++], invocation); |
| 3570 | if (info->pass_fdlist) |
| 3571 | { |
| 3572 | #ifdef G_OS_UNIX |
| 3573 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 3574 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 3575 | #else |
| 3576 | g_assert_not_reached (); |
| 3577 | #endif |
| 3578 | } |
| 3579 | g_variant_iter_init (&iter, parameters); |
| 3580 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3581 | { |
| 3582 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 3583 | if (arg_info->use_gvariant) |
| 3584 | { |
| 3585 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3586 | g_value_set_variant (¶mv[n], child); |
| 3587 | n++; |
| 3588 | } |
| 3589 | else |
| 3590 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3591 | g_variant_unref (child); |
| 3592 | } |
| 3593 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 3594 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 3595 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 3596 | if (!g_value_get_boolean (&return_value)) |
| 3597 | 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); |
| 3598 | g_value_unset (&return_value); |
| 3599 | for (n = 0; n < num_params + num_extra; n++) |
| 3600 | g_value_unset (¶mv[n]); |
| 3601 | g_free (paramv); |
| 3602 | } |
| 3603 | |
| 3604 | static GVariant * |
| 3605 | _fan_skeleton_handle_get_property ( |
| 3606 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3607 | const gchar *sender G_GNUC_UNUSED, |
| 3608 | const gchar *object_path G_GNUC_UNUSED, |
| 3609 | const gchar *interface_name G_GNUC_UNUSED, |
| 3610 | const gchar *property_name, |
| 3611 | GError **error, |
| 3612 | gpointer user_data) |
| 3613 | { |
| 3614 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3615 | GValue value = G_VALUE_INIT; |
| 3616 | GParamSpec *pspec; |
| 3617 | _ExtendedGDBusPropertyInfo *info; |
| 3618 | GVariant *ret; |
| 3619 | ret = NULL; |
| 3620 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 3621 | g_assert (info != NULL); |
| 3622 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3623 | if (pspec == NULL) |
| 3624 | { |
| 3625 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3626 | } |
| 3627 | else |
| 3628 | { |
| 3629 | g_value_init (&value, pspec->value_type); |
| 3630 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3631 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3632 | g_value_unset (&value); |
| 3633 | } |
| 3634 | return ret; |
| 3635 | } |
| 3636 | |
| 3637 | static gboolean |
| 3638 | _fan_skeleton_handle_set_property ( |
| 3639 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3640 | const gchar *sender G_GNUC_UNUSED, |
| 3641 | const gchar *object_path G_GNUC_UNUSED, |
| 3642 | const gchar *interface_name G_GNUC_UNUSED, |
| 3643 | const gchar *property_name, |
| 3644 | GVariant *variant, |
| 3645 | GError **error, |
| 3646 | gpointer user_data) |
| 3647 | { |
| 3648 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3649 | GValue value = G_VALUE_INIT; |
| 3650 | GParamSpec *pspec; |
| 3651 | _ExtendedGDBusPropertyInfo *info; |
| 3652 | gboolean ret; |
| 3653 | ret = FALSE; |
| 3654 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 3655 | g_assert (info != NULL); |
| 3656 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3657 | if (pspec == NULL) |
| 3658 | { |
| 3659 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3660 | } |
| 3661 | else |
| 3662 | { |
| 3663 | if (info->use_gvariant) |
| 3664 | g_value_set_variant (&value, variant); |
| 3665 | else |
| 3666 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 3667 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3668 | g_value_unset (&value); |
| 3669 | ret = TRUE; |
| 3670 | } |
| 3671 | return ret; |
| 3672 | } |
| 3673 | |
| 3674 | static const GDBusInterfaceVTable _fan_skeleton_vtable = |
| 3675 | { |
| 3676 | _fan_skeleton_handle_method_call, |
| 3677 | _fan_skeleton_handle_get_property, |
| 3678 | _fan_skeleton_handle_set_property, |
| 3679 | {NULL} |
| 3680 | }; |
| 3681 | |
| 3682 | static GDBusInterfaceInfo * |
| 3683 | fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3684 | { |
| 3685 | return fan_interface_info (); |
| 3686 | } |
| 3687 | |
| 3688 | static GDBusInterfaceVTable * |
| 3689 | fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3690 | { |
| 3691 | return (GDBusInterfaceVTable *) &_fan_skeleton_vtable; |
| 3692 | } |
| 3693 | |
| 3694 | static GVariant * |
| 3695 | fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 3696 | { |
| 3697 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 3698 | |
| 3699 | GVariantBuilder builder; |
| 3700 | guint n; |
| 3701 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3702 | if (_fan_interface_info.parent_struct.properties == NULL) |
| 3703 | goto out; |
| 3704 | for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++) |
| 3705 | { |
| 3706 | GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n]; |
| 3707 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3708 | { |
| 3709 | GVariant *value; |
| 3710 | 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); |
| 3711 | if (value != NULL) |
| 3712 | { |
| 3713 | g_variant_take_ref (value); |
| 3714 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3715 | g_variant_unref (value); |
| 3716 | } |
| 3717 | } |
| 3718 | } |
| 3719 | out: |
| 3720 | return g_variant_builder_end (&builder); |
| 3721 | } |
| 3722 | |
| 3723 | static gboolean _fan_emit_changed (gpointer user_data); |
| 3724 | |
| 3725 | static void |
| 3726 | fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 3727 | { |
| 3728 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 3729 | gboolean emit_changed = FALSE; |
| 3730 | |
| 3731 | g_mutex_lock (&skeleton->priv->lock); |
| 3732 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3733 | { |
| 3734 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3735 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3736 | emit_changed = TRUE; |
| 3737 | } |
| 3738 | g_mutex_unlock (&skeleton->priv->lock); |
| 3739 | |
| 3740 | if (emit_changed) |
| 3741 | _fan_emit_changed (skeleton); |
| 3742 | } |
| 3743 | |
| 3744 | static void |
| 3745 | _fan_on_signal_speed_changed ( |
| 3746 | Fan *object, |
| 3747 | gint arg_speed) |
| 3748 | { |
| 3749 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3750 | |
| 3751 | GList *connections, *l; |
| 3752 | GVariant *signal_variant; |
| 3753 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3754 | |
| 3755 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 3756 | arg_speed)); |
| 3757 | for (l = connections; l != NULL; l = l->next) |
| 3758 | { |
| 3759 | GDBusConnection *connection = l->data; |
| 3760 | g_dbus_connection_emit_signal (connection, |
| 3761 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged", |
| 3762 | signal_variant, NULL); |
| 3763 | } |
| 3764 | g_variant_unref (signal_variant); |
| 3765 | g_list_free_full (connections, g_object_unref); |
| 3766 | } |
| 3767 | |
| 3768 | static void |
| 3769 | _fan_on_signal_tach_error ( |
| 3770 | Fan *object) |
| 3771 | { |
| 3772 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3773 | |
| 3774 | GList *connections, *l; |
| 3775 | GVariant *signal_variant; |
| 3776 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3777 | |
| 3778 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 3779 | for (l = connections; l != NULL; l = l->next) |
| 3780 | { |
| 3781 | GDBusConnection *connection = l->data; |
| 3782 | g_dbus_connection_emit_signal (connection, |
| 3783 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError", |
| 3784 | signal_variant, NULL); |
| 3785 | } |
| 3786 | g_variant_unref (signal_variant); |
| 3787 | g_list_free_full (connections, g_object_unref); |
| 3788 | } |
| 3789 | |
| 3790 | static void fan_skeleton_iface_init (FanIface *iface); |
| 3791 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3792 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3793 | G_ADD_PRIVATE (FanSkeleton) |
| 3794 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 3795 | |
| 3796 | #else |
| 3797 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3798 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 3799 | |
| 3800 | #endif |
| 3801 | static void |
| 3802 | fan_skeleton_finalize (GObject *object) |
| 3803 | { |
| 3804 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3805 | guint n; |
| 3806 | for (n = 0; n < 3; n++) |
| 3807 | g_value_unset (&skeleton->priv->properties[n]); |
| 3808 | g_free (skeleton->priv->properties); |
| 3809 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3810 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3811 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3812 | g_main_context_unref (skeleton->priv->context); |
| 3813 | g_mutex_clear (&skeleton->priv->lock); |
| 3814 | G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object); |
| 3815 | } |
| 3816 | |
| 3817 | static void |
| 3818 | fan_skeleton_get_property (GObject *object, |
| 3819 | guint prop_id, |
| 3820 | GValue *value, |
| 3821 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3822 | { |
| 3823 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3824 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3825 | g_mutex_lock (&skeleton->priv->lock); |
| 3826 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 3827 | g_mutex_unlock (&skeleton->priv->lock); |
| 3828 | } |
| 3829 | |
| 3830 | static gboolean |
| 3831 | _fan_emit_changed (gpointer user_data) |
| 3832 | { |
| 3833 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 3834 | GList *l; |
| 3835 | GVariantBuilder builder; |
| 3836 | GVariantBuilder invalidated_builder; |
| 3837 | guint num_changes; |
| 3838 | |
| 3839 | g_mutex_lock (&skeleton->priv->lock); |
| 3840 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3841 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 3842 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3843 | { |
| 3844 | ChangedProperty *cp = l->data; |
| 3845 | GVariant *variant; |
| 3846 | const GValue *cur_value; |
| 3847 | |
| 3848 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3849 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3850 | { |
| 3851 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3852 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3853 | g_variant_unref (variant); |
| 3854 | num_changes++; |
| 3855 | } |
| 3856 | } |
| 3857 | if (num_changes > 0) |
| 3858 | { |
| 3859 | GList *connections, *ll; |
| 3860 | GVariant *signal_variant; |
| 3861 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan", |
| 3862 | &builder, &invalidated_builder)); |
| 3863 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3864 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3865 | { |
| 3866 | GDBusConnection *connection = ll->data; |
| 3867 | |
| 3868 | g_dbus_connection_emit_signal (connection, |
| 3869 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3870 | "org.freedesktop.DBus.Properties", |
| 3871 | "PropertiesChanged", |
| 3872 | signal_variant, |
| 3873 | NULL); |
| 3874 | } |
| 3875 | g_variant_unref (signal_variant); |
| 3876 | g_list_free_full (connections, g_object_unref); |
| 3877 | } |
| 3878 | else |
| 3879 | { |
| 3880 | g_variant_builder_clear (&builder); |
| 3881 | g_variant_builder_clear (&invalidated_builder); |
| 3882 | } |
| 3883 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3884 | skeleton->priv->changed_properties = NULL; |
| 3885 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3886 | g_mutex_unlock (&skeleton->priv->lock); |
| 3887 | return FALSE; |
| 3888 | } |
| 3889 | |
| 3890 | static void |
| 3891 | _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 3892 | { |
| 3893 | ChangedProperty *cp; |
| 3894 | GList *l; |
| 3895 | cp = NULL; |
| 3896 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 3897 | { |
| 3898 | ChangedProperty *i_cp = l->data; |
| 3899 | if (i_cp->info == info) |
| 3900 | { |
| 3901 | cp = i_cp; |
| 3902 | break; |
| 3903 | } |
| 3904 | } |
| 3905 | if (cp == NULL) |
| 3906 | { |
| 3907 | cp = g_new0 (ChangedProperty, 1); |
| 3908 | cp->prop_id = prop_id; |
| 3909 | cp->info = info; |
| 3910 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 3911 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 3912 | g_value_copy (orig_value, &cp->orig_value); |
| 3913 | } |
| 3914 | } |
| 3915 | |
| 3916 | static void |
| 3917 | fan_skeleton_notify (GObject *object, |
| 3918 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3919 | { |
| 3920 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3921 | g_mutex_lock (&skeleton->priv->lock); |
| 3922 | if (skeleton->priv->changed_properties != NULL && |
| 3923 | skeleton->priv->changed_properties_idle_source == NULL) |
| 3924 | { |
| 3925 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 3926 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 3927 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 3928 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 3929 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 3930 | } |
| 3931 | g_mutex_unlock (&skeleton->priv->lock); |
| 3932 | } |
| 3933 | |
| 3934 | static void |
| 3935 | fan_skeleton_set_property (GObject *object, |
| 3936 | guint prop_id, |
| 3937 | const GValue *value, |
| 3938 | GParamSpec *pspec) |
| 3939 | { |
| 3940 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3941 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 3942 | g_mutex_lock (&skeleton->priv->lock); |
| 3943 | g_object_freeze_notify (object); |
| 3944 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 3945 | { |
| 3946 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 3947 | _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 3948 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 3949 | g_object_notify_by_pspec (object, pspec); |
| 3950 | } |
| 3951 | g_mutex_unlock (&skeleton->priv->lock); |
| 3952 | g_object_thaw_notify (object); |
| 3953 | } |
| 3954 | |
| 3955 | static void |
| 3956 | fan_skeleton_init (FanSkeleton *skeleton) |
| 3957 | { |
| 3958 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3959 | skeleton->priv = fan_skeleton_get_instance_private (skeleton); |
| 3960 | #else |
| 3961 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate); |
| 3962 | #endif |
| 3963 | |
| 3964 | g_mutex_init (&skeleton->priv->lock); |
| 3965 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 3966 | skeleton->priv->properties = g_new0 (GValue, 3); |
| 3967 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 3968 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 3969 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 3970 | } |
| 3971 | |
| 3972 | static gint |
| 3973 | fan_skeleton_get_speed (Fan *object) |
| 3974 | { |
| 3975 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3976 | gint value; |
| 3977 | g_mutex_lock (&skeleton->priv->lock); |
| 3978 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 3979 | g_mutex_unlock (&skeleton->priv->lock); |
| 3980 | return value; |
| 3981 | } |
| 3982 | |
| 3983 | static gint |
| 3984 | fan_skeleton_get_cooling_zone (Fan *object) |
| 3985 | { |
| 3986 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3987 | gint value; |
| 3988 | g_mutex_lock (&skeleton->priv->lock); |
| 3989 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 3990 | g_mutex_unlock (&skeleton->priv->lock); |
| 3991 | return value; |
| 3992 | } |
| 3993 | |
| 3994 | static gint |
| 3995 | fan_skeleton_get_pwm_num (Fan *object) |
| 3996 | { |
| 3997 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 3998 | gint value; |
| 3999 | g_mutex_lock (&skeleton->priv->lock); |
| 4000 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 4001 | g_mutex_unlock (&skeleton->priv->lock); |
| 4002 | return value; |
| 4003 | } |
| 4004 | |
| 4005 | static void |
| 4006 | fan_skeleton_class_init (FanSkeletonClass *klass) |
| 4007 | { |
| 4008 | GObjectClass *gobject_class; |
| 4009 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 4010 | |
| 4011 | gobject_class = G_OBJECT_CLASS (klass); |
| 4012 | gobject_class->finalize = fan_skeleton_finalize; |
| 4013 | gobject_class->get_property = fan_skeleton_get_property; |
| 4014 | gobject_class->set_property = fan_skeleton_set_property; |
| 4015 | gobject_class->notify = fan_skeleton_notify; |
| 4016 | |
| 4017 | |
| 4018 | fan_override_properties (gobject_class, 1); |
| 4019 | |
| 4020 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 4021 | skeleton_class->get_info = fan_skeleton_dbus_interface_get_info; |
| 4022 | skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties; |
| 4023 | skeleton_class->flush = fan_skeleton_dbus_interface_flush; |
| 4024 | skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable; |
| 4025 | |
| 4026 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4027 | g_type_class_add_private (klass, sizeof (FanSkeletonPrivate)); |
| 4028 | #endif |
| 4029 | } |
| 4030 | |
| 4031 | static void |
| 4032 | fan_skeleton_iface_init (FanIface *iface) |
| 4033 | { |
| 4034 | iface->speed_changed = _fan_on_signal_speed_changed; |
| 4035 | iface->tach_error = _fan_on_signal_tach_error; |
| 4036 | iface->get_speed = fan_skeleton_get_speed; |
| 4037 | iface->get_cooling_zone = fan_skeleton_get_cooling_zone; |
| 4038 | iface->get_pwm_num = fan_skeleton_get_pwm_num; |
| 4039 | } |
| 4040 | |
| 4041 | /** |
| 4042 | * fan_skeleton_new: |
| 4043 | * |
| 4044 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 4045 | * |
| 4046 | * Returns: (transfer full) (type FanSkeleton): The skeleton object. |
| 4047 | */ |
| 4048 | Fan * |
| 4049 | fan_skeleton_new (void) |
| 4050 | { |
| 4051 | return FAN (g_object_new (TYPE_FAN_SKELETON, NULL)); |
| 4052 | } |
| 4053 | |
| 4054 | /* ------------------------------------------------------------------------ |
| 4055 | * Code for interface org.openbmc.SensorValue |
| 4056 | * ------------------------------------------------------------------------ |
| 4057 | */ |
| 4058 | |
| 4059 | /** |
| 4060 | * SECTION:SensorValue |
| 4061 | * @title: SensorValue |
| 4062 | * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface |
| 4063 | * |
| 4064 | * 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. |
| 4065 | */ |
| 4066 | |
| 4067 | /* ---- Introspection data for org.openbmc.SensorValue ---- */ |
| 4068 | |
| 4069 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = |
| 4070 | { |
| 4071 | { |
| 4072 | -1, |
| 4073 | (gchar *) "init", |
| 4074 | NULL, |
| 4075 | NULL, |
| 4076 | NULL |
| 4077 | }, |
| 4078 | "handle-init", |
| 4079 | FALSE |
| 4080 | }; |
| 4081 | |
| 4082 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = |
| 4083 | { |
| 4084 | { |
| 4085 | -1, |
| 4086 | (gchar *) "value", |
| 4087 | (gchar *) "v", |
| 4088 | NULL |
| 4089 | }, |
| 4090 | FALSE |
| 4091 | }; |
| 4092 | |
| 4093 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = |
| 4094 | { |
| 4095 | &_sensor_value_method_info_get_value_OUT_ARG_value, |
| 4096 | NULL |
| 4097 | }; |
| 4098 | |
| 4099 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = |
| 4100 | { |
| 4101 | { |
| 4102 | -1, |
| 4103 | (gchar *) "getValue", |
| 4104 | NULL, |
| 4105 | (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, |
| 4106 | NULL |
| 4107 | }, |
| 4108 | "handle-get-value", |
| 4109 | FALSE |
| 4110 | }; |
| 4111 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 4112 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = |
| 4113 | { |
| 4114 | { |
| 4115 | -1, |
| 4116 | (gchar *) "value", |
| 4117 | (gchar *) "v", |
| 4118 | NULL |
| 4119 | }, |
| 4120 | FALSE |
| 4121 | }; |
| 4122 | |
| 4123 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = |
| 4124 | { |
| 4125 | &_sensor_value_method_info_set_value_IN_ARG_value, |
| 4126 | NULL |
| 4127 | }; |
| 4128 | |
| 4129 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = |
| 4130 | { |
| 4131 | { |
| 4132 | -1, |
| 4133 | (gchar *) "setValue", |
| 4134 | (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, |
| 4135 | NULL, |
| 4136 | NULL |
| 4137 | }, |
| 4138 | "handle-set-value", |
| 4139 | FALSE |
| 4140 | }; |
| 4141 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4142 | static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = |
| 4143 | { |
| 4144 | &_sensor_value_method_info_init, |
| 4145 | &_sensor_value_method_info_get_value, |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 4146 | &_sensor_value_method_info_set_value, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4147 | NULL |
| 4148 | }; |
| 4149 | |
| 4150 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = |
| 4151 | { |
| 4152 | { |
| 4153 | -1, |
| 4154 | (gchar *) "value", |
| 4155 | (gchar *) "v", |
| 4156 | NULL |
| 4157 | }, |
| 4158 | FALSE |
| 4159 | }; |
| 4160 | |
| 4161 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = |
| 4162 | { |
| 4163 | { |
| 4164 | -1, |
| 4165 | (gchar *) "units", |
| 4166 | (gchar *) "s", |
| 4167 | NULL |
| 4168 | }, |
| 4169 | FALSE |
| 4170 | }; |
| 4171 | |
| 4172 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = |
| 4173 | { |
| 4174 | &_sensor_value_signal_info_changed_ARG_value, |
| 4175 | &_sensor_value_signal_info_changed_ARG_units, |
| 4176 | NULL |
| 4177 | }; |
| 4178 | |
| 4179 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = |
| 4180 | { |
| 4181 | { |
| 4182 | -1, |
| 4183 | (gchar *) "Changed", |
| 4184 | (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, |
| 4185 | NULL |
| 4186 | }, |
| 4187 | "changed" |
| 4188 | }; |
| 4189 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4190 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error = |
| 4191 | { |
| 4192 | { |
| 4193 | -1, |
| 4194 | (gchar *) "Error", |
| 4195 | NULL, |
| 4196 | NULL |
| 4197 | }, |
| 4198 | "error" |
| 4199 | }; |
| 4200 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4201 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = |
| 4202 | { |
| 4203 | { |
| 4204 | -1, |
| 4205 | (gchar *) "bus_name", |
| 4206 | (gchar *) "s", |
| 4207 | NULL |
| 4208 | }, |
| 4209 | FALSE |
| 4210 | }; |
| 4211 | |
| 4212 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = |
| 4213 | { |
| 4214 | &_sensor_value_signal_info_heartbeat_ARG_bus_name, |
| 4215 | NULL |
| 4216 | }; |
| 4217 | |
| 4218 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = |
| 4219 | { |
| 4220 | { |
| 4221 | -1, |
| 4222 | (gchar *) "Heartbeat", |
| 4223 | (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, |
| 4224 | NULL |
| 4225 | }, |
| 4226 | "heartbeat" |
| 4227 | }; |
| 4228 | |
| 4229 | static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = |
| 4230 | { |
| 4231 | &_sensor_value_signal_info_changed, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4232 | &_sensor_value_signal_info_error, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4233 | &_sensor_value_signal_info_heartbeat, |
| 4234 | NULL |
| 4235 | }; |
| 4236 | |
| 4237 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = |
| 4238 | { |
| 4239 | { |
| 4240 | -1, |
| 4241 | (gchar *) "value", |
| 4242 | (gchar *) "v", |
| 4243 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4244 | NULL |
| 4245 | }, |
| 4246 | "value", |
| 4247 | FALSE |
| 4248 | }; |
| 4249 | |
| 4250 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = |
| 4251 | { |
| 4252 | { |
| 4253 | -1, |
| 4254 | (gchar *) "units", |
| 4255 | (gchar *) "s", |
| 4256 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4257 | NULL |
| 4258 | }, |
| 4259 | "units", |
| 4260 | FALSE |
| 4261 | }; |
| 4262 | |
| 4263 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = |
| 4264 | { |
| 4265 | { |
| 4266 | -1, |
| 4267 | (gchar *) "poll_interval", |
| 4268 | (gchar *) "i", |
| 4269 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4270 | NULL |
| 4271 | }, |
| 4272 | "poll-interval", |
| 4273 | FALSE |
| 4274 | }; |
| 4275 | |
| 4276 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = |
| 4277 | { |
| 4278 | { |
| 4279 | -1, |
| 4280 | (gchar *) "heatbeat", |
| 4281 | (gchar *) "i", |
| 4282 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4283 | NULL |
| 4284 | }, |
| 4285 | "heatbeat", |
| 4286 | FALSE |
| 4287 | }; |
| 4288 | |
| 4289 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = |
| 4290 | { |
| 4291 | { |
| 4292 | -1, |
| 4293 | (gchar *) "settable", |
| 4294 | (gchar *) "b", |
| 4295 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4296 | NULL |
| 4297 | }, |
| 4298 | "settable", |
| 4299 | FALSE |
| 4300 | }; |
| 4301 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4302 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
| 4303 | { |
| 4304 | &_sensor_value_property_info_value, |
| 4305 | &_sensor_value_property_info_units, |
| 4306 | &_sensor_value_property_info_poll_interval, |
| 4307 | &_sensor_value_property_info_heatbeat, |
| 4308 | &_sensor_value_property_info_settable, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4309 | NULL |
| 4310 | }; |
| 4311 | |
| 4312 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
| 4313 | { |
| 4314 | { |
| 4315 | -1, |
| 4316 | (gchar *) "org.openbmc.SensorValue", |
| 4317 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 4318 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 4319 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
| 4320 | NULL |
| 4321 | }, |
| 4322 | "sensor-value", |
| 4323 | }; |
| 4324 | |
| 4325 | |
| 4326 | /** |
| 4327 | * sensor_value_interface_info: |
| 4328 | * |
| 4329 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. |
| 4330 | * |
| 4331 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 4332 | */ |
| 4333 | GDBusInterfaceInfo * |
| 4334 | sensor_value_interface_info (void) |
| 4335 | { |
| 4336 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
| 4337 | } |
| 4338 | |
| 4339 | /** |
| 4340 | * sensor_value_override_properties: |
| 4341 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 4342 | * @property_id_begin: The property id to assign to the first overridden property. |
| 4343 | * |
| 4344 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
| 4345 | * The properties are overridden in the order they are defined. |
| 4346 | * |
| 4347 | * Returns: The last property id. |
| 4348 | */ |
| 4349 | guint |
| 4350 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
| 4351 | { |
| 4352 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 4353 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 4354 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 4355 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 4356 | g_object_class_override_property (klass, property_id_begin++, "settable"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4357 | return property_id_begin - 1; |
| 4358 | } |
| 4359 | |
| 4360 | |
| 4361 | |
| 4362 | /** |
| 4363 | * SensorValue: |
| 4364 | * |
| 4365 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 4366 | */ |
| 4367 | |
| 4368 | /** |
| 4369 | * SensorValueIface: |
| 4370 | * @parent_iface: The parent interface. |
| 4371 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 4372 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 4373 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4374 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4375 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
| 4376 | * @get_settable: Getter for the #SensorValue:settable property. |
| 4377 | * @get_units: Getter for the #SensorValue:units property. |
| 4378 | * @get_value: Getter for the #SensorValue:value property. |
| 4379 | * @changed: Handler for the #SensorValue::changed signal. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4380 | * @error: Handler for the #SensorValue::error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4381 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
| 4382 | * |
| 4383 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 4384 | */ |
| 4385 | |
| 4386 | typedef SensorValueIface SensorValueInterface; |
| 4387 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
| 4388 | |
| 4389 | static void |
| 4390 | sensor_value_default_init (SensorValueIface *iface) |
| 4391 | { |
| 4392 | /* GObject signals for incoming D-Bus method calls: */ |
| 4393 | /** |
| 4394 | * SensorValue::handle-init: |
| 4395 | * @object: A #SensorValue. |
| 4396 | * @invocation: A #GDBusMethodInvocation. |
| 4397 | * |
| 4398 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. |
| 4399 | * |
| 4400 | * 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. |
| 4401 | * |
| 4402 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 4403 | */ |
| 4404 | g_signal_new ("handle-init", |
| 4405 | G_TYPE_FROM_INTERFACE (iface), |
| 4406 | G_SIGNAL_RUN_LAST, |
| 4407 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
| 4408 | g_signal_accumulator_true_handled, |
| 4409 | NULL, |
| 4410 | g_cclosure_marshal_generic, |
| 4411 | G_TYPE_BOOLEAN, |
| 4412 | 1, |
| 4413 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 4414 | |
| 4415 | /** |
| 4416 | * SensorValue::handle-get-value: |
| 4417 | * @object: A #SensorValue. |
| 4418 | * @invocation: A #GDBusMethodInvocation. |
| 4419 | * |
| 4420 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. |
| 4421 | * |
| 4422 | * 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. |
| 4423 | * |
| 4424 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 4425 | */ |
| 4426 | g_signal_new ("handle-get-value", |
| 4427 | G_TYPE_FROM_INTERFACE (iface), |
| 4428 | G_SIGNAL_RUN_LAST, |
| 4429 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
| 4430 | g_signal_accumulator_true_handled, |
| 4431 | NULL, |
| 4432 | g_cclosure_marshal_generic, |
| 4433 | G_TYPE_BOOLEAN, |
| 4434 | 1, |
| 4435 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 4436 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 4437 | /** |
| 4438 | * SensorValue::handle-set-value: |
| 4439 | * @object: A #SensorValue. |
| 4440 | * @invocation: A #GDBusMethodInvocation. |
| 4441 | * @arg_value: Argument passed by remote caller. |
| 4442 | * |
| 4443 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. |
| 4444 | * |
| 4445 | * 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. |
| 4446 | * |
| 4447 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 4448 | */ |
| 4449 | g_signal_new ("handle-set-value", |
| 4450 | G_TYPE_FROM_INTERFACE (iface), |
| 4451 | G_SIGNAL_RUN_LAST, |
| 4452 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
| 4453 | g_signal_accumulator_true_handled, |
| 4454 | NULL, |
| 4455 | g_cclosure_marshal_generic, |
| 4456 | G_TYPE_BOOLEAN, |
| 4457 | 2, |
| 4458 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 4459 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4460 | /* GObject signals for received D-Bus signals: */ |
| 4461 | /** |
| 4462 | * SensorValue::changed: |
| 4463 | * @object: A #SensorValue. |
| 4464 | * @arg_value: Argument. |
| 4465 | * @arg_units: Argument. |
| 4466 | * |
| 4467 | * 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. |
| 4468 | * |
| 4469 | * 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. |
| 4470 | */ |
| 4471 | g_signal_new ("changed", |
| 4472 | G_TYPE_FROM_INTERFACE (iface), |
| 4473 | G_SIGNAL_RUN_LAST, |
| 4474 | G_STRUCT_OFFSET (SensorValueIface, changed), |
| 4475 | NULL, |
| 4476 | NULL, |
| 4477 | g_cclosure_marshal_generic, |
| 4478 | G_TYPE_NONE, |
| 4479 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
| 4480 | |
| 4481 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4482 | * SensorValue::error: |
| 4483 | * @object: A #SensorValue. |
| 4484 | * |
| 4485 | * 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. |
| 4486 | * |
| 4487 | * 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. |
| 4488 | */ |
| 4489 | g_signal_new ("error", |
| 4490 | G_TYPE_FROM_INTERFACE (iface), |
| 4491 | G_SIGNAL_RUN_LAST, |
| 4492 | G_STRUCT_OFFSET (SensorValueIface, error), |
| 4493 | NULL, |
| 4494 | NULL, |
| 4495 | g_cclosure_marshal_generic, |
| 4496 | G_TYPE_NONE, |
| 4497 | 0); |
| 4498 | |
| 4499 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4500 | * SensorValue::heartbeat: |
| 4501 | * @object: A #SensorValue. |
| 4502 | * @arg_bus_name: Argument. |
| 4503 | * |
| 4504 | * 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. |
| 4505 | * |
| 4506 | * 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. |
| 4507 | */ |
| 4508 | g_signal_new ("heartbeat", |
| 4509 | G_TYPE_FROM_INTERFACE (iface), |
| 4510 | G_SIGNAL_RUN_LAST, |
| 4511 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
| 4512 | NULL, |
| 4513 | NULL, |
| 4514 | g_cclosure_marshal_generic, |
| 4515 | G_TYPE_NONE, |
| 4516 | 1, G_TYPE_STRING); |
| 4517 | |
| 4518 | /* GObject properties for D-Bus properties: */ |
| 4519 | /** |
| 4520 | * SensorValue:value: |
| 4521 | * |
| 4522 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. |
| 4523 | * |
| 4524 | * 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. |
| 4525 | */ |
| 4526 | g_object_interface_install_property (iface, |
| 4527 | g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4528 | /** |
| 4529 | * SensorValue:units: |
| 4530 | * |
| 4531 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. |
| 4532 | * |
| 4533 | * 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. |
| 4534 | */ |
| 4535 | g_object_interface_install_property (iface, |
| 4536 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4537 | /** |
| 4538 | * SensorValue:poll-interval: |
| 4539 | * |
| 4540 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. |
| 4541 | * |
| 4542 | * 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. |
| 4543 | */ |
| 4544 | g_object_interface_install_property (iface, |
| 4545 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4546 | /** |
| 4547 | * SensorValue:heatbeat: |
| 4548 | * |
| 4549 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. |
| 4550 | * |
| 4551 | * 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. |
| 4552 | */ |
| 4553 | g_object_interface_install_property (iface, |
| 4554 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4555 | /** |
| 4556 | * SensorValue:settable: |
| 4557 | * |
| 4558 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. |
| 4559 | * |
| 4560 | * 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. |
| 4561 | */ |
| 4562 | g_object_interface_install_property (iface, |
| 4563 | 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] | 4564 | } |
| 4565 | |
| 4566 | /** |
| 4567 | * sensor_value_get_value: (skip) |
| 4568 | * @object: A #SensorValue. |
| 4569 | * |
| 4570 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 4571 | * |
| 4572 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4573 | * |
| 4574 | * <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> |
| 4575 | * |
| 4576 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4577 | */ |
| 4578 | GVariant * |
| 4579 | sensor_value_get_value (SensorValue *object) |
| 4580 | { |
| 4581 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
| 4582 | } |
| 4583 | |
| 4584 | /** |
| 4585 | * sensor_value_dup_value: (skip) |
| 4586 | * @object: A #SensorValue. |
| 4587 | * |
| 4588 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 4589 | * |
| 4590 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4591 | * |
| 4592 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 4593 | */ |
| 4594 | GVariant * |
| 4595 | sensor_value_dup_value (SensorValue *object) |
| 4596 | { |
| 4597 | GVariant *value; |
| 4598 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 4599 | return value; |
| 4600 | } |
| 4601 | |
| 4602 | /** |
| 4603 | * sensor_value_set_value: (skip) |
| 4604 | * @object: A #SensorValue. |
| 4605 | * @value: The value to set. |
| 4606 | * |
| 4607 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. |
| 4608 | * |
| 4609 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4610 | */ |
| 4611 | void |
| 4612 | sensor_value_set_value (SensorValue *object, GVariant *value) |
| 4613 | { |
| 4614 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 4615 | } |
| 4616 | |
| 4617 | /** |
| 4618 | * sensor_value_get_units: (skip) |
| 4619 | * @object: A #SensorValue. |
| 4620 | * |
| 4621 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 4622 | * |
| 4623 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4624 | * |
| 4625 | * <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> |
| 4626 | * |
| 4627 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4628 | */ |
| 4629 | const gchar * |
| 4630 | sensor_value_get_units (SensorValue *object) |
| 4631 | { |
| 4632 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
| 4633 | } |
| 4634 | |
| 4635 | /** |
| 4636 | * sensor_value_dup_units: (skip) |
| 4637 | * @object: A #SensorValue. |
| 4638 | * |
| 4639 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 4640 | * |
| 4641 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4642 | * |
| 4643 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4644 | */ |
| 4645 | gchar * |
| 4646 | sensor_value_dup_units (SensorValue *object) |
| 4647 | { |
| 4648 | gchar *value; |
| 4649 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 4650 | return value; |
| 4651 | } |
| 4652 | |
| 4653 | /** |
| 4654 | * sensor_value_set_units: (skip) |
| 4655 | * @object: A #SensorValue. |
| 4656 | * @value: The value to set. |
| 4657 | * |
| 4658 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. |
| 4659 | * |
| 4660 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4661 | */ |
| 4662 | void |
| 4663 | sensor_value_set_units (SensorValue *object, const gchar *value) |
| 4664 | { |
| 4665 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 4666 | } |
| 4667 | |
| 4668 | /** |
| 4669 | * sensor_value_get_poll_interval: (skip) |
| 4670 | * @object: A #SensorValue. |
| 4671 | * |
| 4672 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. |
| 4673 | * |
| 4674 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4675 | * |
| 4676 | * Returns: The property value. |
| 4677 | */ |
| 4678 | gint |
| 4679 | sensor_value_get_poll_interval (SensorValue *object) |
| 4680 | { |
| 4681 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
| 4682 | } |
| 4683 | |
| 4684 | /** |
| 4685 | * sensor_value_set_poll_interval: (skip) |
| 4686 | * @object: A #SensorValue. |
| 4687 | * @value: The value to set. |
| 4688 | * |
| 4689 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 4690 | * |
| 4691 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4692 | */ |
| 4693 | void |
| 4694 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
| 4695 | { |
| 4696 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 4697 | } |
| 4698 | |
| 4699 | /** |
| 4700 | * sensor_value_get_heatbeat: (skip) |
| 4701 | * @object: A #SensorValue. |
| 4702 | * |
| 4703 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. |
| 4704 | * |
| 4705 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4706 | * |
| 4707 | * Returns: The property value. |
| 4708 | */ |
| 4709 | gint |
| 4710 | sensor_value_get_heatbeat (SensorValue *object) |
| 4711 | { |
| 4712 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
| 4713 | } |
| 4714 | |
| 4715 | /** |
| 4716 | * sensor_value_set_heatbeat: (skip) |
| 4717 | * @object: A #SensorValue. |
| 4718 | * @value: The value to set. |
| 4719 | * |
| 4720 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 4721 | * |
| 4722 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4723 | */ |
| 4724 | void |
| 4725 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
| 4726 | { |
| 4727 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 4728 | } |
| 4729 | |
| 4730 | /** |
| 4731 | * sensor_value_get_settable: (skip) |
| 4732 | * @object: A #SensorValue. |
| 4733 | * |
| 4734 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. |
| 4735 | * |
| 4736 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 4737 | * |
| 4738 | * Returns: The property value. |
| 4739 | */ |
| 4740 | gboolean |
| 4741 | sensor_value_get_settable (SensorValue *object) |
| 4742 | { |
| 4743 | return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); |
| 4744 | } |
| 4745 | |
| 4746 | /** |
| 4747 | * sensor_value_set_settable: (skip) |
| 4748 | * @object: A #SensorValue. |
| 4749 | * @value: The value to set. |
| 4750 | * |
| 4751 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. |
| 4752 | * |
| 4753 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 4754 | */ |
| 4755 | void |
| 4756 | sensor_value_set_settable (SensorValue *object, gboolean value) |
| 4757 | { |
| 4758 | g_object_set (G_OBJECT (object), "settable", value, NULL); |
| 4759 | } |
| 4760 | |
| 4761 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4762 | * sensor_value_emit_changed: |
| 4763 | * @object: A #SensorValue. |
| 4764 | * @arg_value: Argument to pass with the signal. |
| 4765 | * @arg_units: Argument to pass with the signal. |
| 4766 | * |
| 4767 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. |
| 4768 | */ |
| 4769 | void |
| 4770 | sensor_value_emit_changed ( |
| 4771 | SensorValue *object, |
| 4772 | GVariant *arg_value, |
| 4773 | const gchar *arg_units) |
| 4774 | { |
| 4775 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
| 4776 | } |
| 4777 | |
| 4778 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4779 | * sensor_value_emit_error: |
| 4780 | * @object: A #SensorValue. |
| 4781 | * |
| 4782 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal. |
| 4783 | */ |
| 4784 | void |
| 4785 | sensor_value_emit_error ( |
| 4786 | SensorValue *object) |
| 4787 | { |
| 4788 | g_signal_emit_by_name (object, "error"); |
| 4789 | } |
| 4790 | |
| 4791 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4792 | * sensor_value_emit_heartbeat: |
| 4793 | * @object: A #SensorValue. |
| 4794 | * @arg_bus_name: Argument to pass with the signal. |
| 4795 | * |
| 4796 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 4797 | */ |
| 4798 | void |
| 4799 | sensor_value_emit_heartbeat ( |
| 4800 | SensorValue *object, |
| 4801 | const gchar *arg_bus_name) |
| 4802 | { |
| 4803 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 4804 | } |
| 4805 | |
| 4806 | /** |
| 4807 | * sensor_value_call_init: |
| 4808 | * @proxy: A #SensorValueProxy. |
| 4809 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4810 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4811 | * @user_data: User data to pass to @callback. |
| 4812 | * |
| 4813 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. |
| 4814 | * 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. |
| 4815 | * You can then call sensor_value_call_init_finish() to get the result of the operation. |
| 4816 | * |
| 4817 | * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. |
| 4818 | */ |
| 4819 | void |
| 4820 | sensor_value_call_init ( |
| 4821 | SensorValue *proxy, |
| 4822 | GCancellable *cancellable, |
| 4823 | GAsyncReadyCallback callback, |
| 4824 | gpointer user_data) |
| 4825 | { |
| 4826 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4827 | "init", |
| 4828 | g_variant_new ("()"), |
| 4829 | G_DBUS_CALL_FLAGS_NONE, |
| 4830 | -1, |
| 4831 | cancellable, |
| 4832 | callback, |
| 4833 | user_data); |
| 4834 | } |
| 4835 | |
| 4836 | /** |
| 4837 | * sensor_value_call_init_finish: |
| 4838 | * @proxy: A #SensorValueProxy. |
| 4839 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). |
| 4840 | * @error: Return location for error or %NULL. |
| 4841 | * |
| 4842 | * Finishes an operation started with sensor_value_call_init(). |
| 4843 | * |
| 4844 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4845 | */ |
| 4846 | gboolean |
| 4847 | sensor_value_call_init_finish ( |
| 4848 | SensorValue *proxy, |
| 4849 | GAsyncResult *res, |
| 4850 | GError **error) |
| 4851 | { |
| 4852 | GVariant *_ret; |
| 4853 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4854 | if (_ret == NULL) |
| 4855 | goto _out; |
| 4856 | g_variant_get (_ret, |
| 4857 | "()"); |
| 4858 | g_variant_unref (_ret); |
| 4859 | _out: |
| 4860 | return _ret != NULL; |
| 4861 | } |
| 4862 | |
| 4863 | /** |
| 4864 | * sensor_value_call_init_sync: |
| 4865 | * @proxy: A #SensorValueProxy. |
| 4866 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4867 | * @error: Return location for error or %NULL. |
| 4868 | * |
| 4869 | * 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. |
| 4870 | * |
| 4871 | * See sensor_value_call_init() for the asynchronous version of this method. |
| 4872 | * |
| 4873 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4874 | */ |
| 4875 | gboolean |
| 4876 | sensor_value_call_init_sync ( |
| 4877 | SensorValue *proxy, |
| 4878 | GCancellable *cancellable, |
| 4879 | GError **error) |
| 4880 | { |
| 4881 | GVariant *_ret; |
| 4882 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4883 | "init", |
| 4884 | g_variant_new ("()"), |
| 4885 | G_DBUS_CALL_FLAGS_NONE, |
| 4886 | -1, |
| 4887 | cancellable, |
| 4888 | error); |
| 4889 | if (_ret == NULL) |
| 4890 | goto _out; |
| 4891 | g_variant_get (_ret, |
| 4892 | "()"); |
| 4893 | g_variant_unref (_ret); |
| 4894 | _out: |
| 4895 | return _ret != NULL; |
| 4896 | } |
| 4897 | |
| 4898 | /** |
| 4899 | * sensor_value_call_get_value: |
| 4900 | * @proxy: A #SensorValueProxy. |
| 4901 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4902 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 4903 | * @user_data: User data to pass to @callback. |
| 4904 | * |
| 4905 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. |
| 4906 | * 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. |
| 4907 | * You can then call sensor_value_call_get_value_finish() to get the result of the operation. |
| 4908 | * |
| 4909 | * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. |
| 4910 | */ |
| 4911 | void |
| 4912 | sensor_value_call_get_value ( |
| 4913 | SensorValue *proxy, |
| 4914 | GCancellable *cancellable, |
| 4915 | GAsyncReadyCallback callback, |
| 4916 | gpointer user_data) |
| 4917 | { |
| 4918 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4919 | "getValue", |
| 4920 | g_variant_new ("()"), |
| 4921 | G_DBUS_CALL_FLAGS_NONE, |
| 4922 | -1, |
| 4923 | cancellable, |
| 4924 | callback, |
| 4925 | user_data); |
| 4926 | } |
| 4927 | |
| 4928 | /** |
| 4929 | * sensor_value_call_get_value_finish: |
| 4930 | * @proxy: A #SensorValueProxy. |
| 4931 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 4932 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). |
| 4933 | * @error: Return location for error or %NULL. |
| 4934 | * |
| 4935 | * Finishes an operation started with sensor_value_call_get_value(). |
| 4936 | * |
| 4937 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4938 | */ |
| 4939 | gboolean |
| 4940 | sensor_value_call_get_value_finish ( |
| 4941 | SensorValue *proxy, |
| 4942 | GVariant **out_value, |
| 4943 | GAsyncResult *res, |
| 4944 | GError **error) |
| 4945 | { |
| 4946 | GVariant *_ret; |
| 4947 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4948 | if (_ret == NULL) |
| 4949 | goto _out; |
| 4950 | g_variant_get (_ret, |
| 4951 | "(@v)", |
| 4952 | out_value); |
| 4953 | g_variant_unref (_ret); |
| 4954 | _out: |
| 4955 | return _ret != NULL; |
| 4956 | } |
| 4957 | |
| 4958 | /** |
| 4959 | * sensor_value_call_get_value_sync: |
| 4960 | * @proxy: A #SensorValueProxy. |
| 4961 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 4962 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4963 | * @error: Return location for error or %NULL. |
| 4964 | * |
| 4965 | * 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. |
| 4966 | * |
| 4967 | * See sensor_value_call_get_value() for the asynchronous version of this method. |
| 4968 | * |
| 4969 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 4970 | */ |
| 4971 | gboolean |
| 4972 | sensor_value_call_get_value_sync ( |
| 4973 | SensorValue *proxy, |
| 4974 | GVariant **out_value, |
| 4975 | GCancellable *cancellable, |
| 4976 | GError **error) |
| 4977 | { |
| 4978 | GVariant *_ret; |
| 4979 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 4980 | "getValue", |
| 4981 | g_variant_new ("()"), |
| 4982 | G_DBUS_CALL_FLAGS_NONE, |
| 4983 | -1, |
| 4984 | cancellable, |
| 4985 | error); |
| 4986 | if (_ret == NULL) |
| 4987 | goto _out; |
| 4988 | g_variant_get (_ret, |
| 4989 | "(@v)", |
| 4990 | out_value); |
| 4991 | g_variant_unref (_ret); |
| 4992 | _out: |
| 4993 | return _ret != NULL; |
| 4994 | } |
| 4995 | |
| 4996 | /** |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 4997 | * sensor_value_call_set_value: |
| 4998 | * @proxy: A #SensorValueProxy. |
| 4999 | * @arg_value: Argument to pass with the method invocation. |
| 5000 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5001 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 5002 | * @user_data: User data to pass to @callback. |
| 5003 | * |
| 5004 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. |
| 5005 | * 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. |
| 5006 | * You can then call sensor_value_call_set_value_finish() to get the result of the operation. |
| 5007 | * |
| 5008 | * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. |
| 5009 | */ |
| 5010 | void |
| 5011 | sensor_value_call_set_value ( |
| 5012 | SensorValue *proxy, |
| 5013 | GVariant *arg_value, |
| 5014 | GCancellable *cancellable, |
| 5015 | GAsyncReadyCallback callback, |
| 5016 | gpointer user_data) |
| 5017 | { |
| 5018 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5019 | "setValue", |
| 5020 | g_variant_new ("(@v)", |
| 5021 | arg_value), |
| 5022 | G_DBUS_CALL_FLAGS_NONE, |
| 5023 | -1, |
| 5024 | cancellable, |
| 5025 | callback, |
| 5026 | user_data); |
| 5027 | } |
| 5028 | |
| 5029 | /** |
| 5030 | * sensor_value_call_set_value_finish: |
| 5031 | * @proxy: A #SensorValueProxy. |
| 5032 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). |
| 5033 | * @error: Return location for error or %NULL. |
| 5034 | * |
| 5035 | * Finishes an operation started with sensor_value_call_set_value(). |
| 5036 | * |
| 5037 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5038 | */ |
| 5039 | gboolean |
| 5040 | sensor_value_call_set_value_finish ( |
| 5041 | SensorValue *proxy, |
| 5042 | GAsyncResult *res, |
| 5043 | GError **error) |
| 5044 | { |
| 5045 | GVariant *_ret; |
| 5046 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5047 | if (_ret == NULL) |
| 5048 | goto _out; |
| 5049 | g_variant_get (_ret, |
| 5050 | "()"); |
| 5051 | g_variant_unref (_ret); |
| 5052 | _out: |
| 5053 | return _ret != NULL; |
| 5054 | } |
| 5055 | |
| 5056 | /** |
| 5057 | * sensor_value_call_set_value_sync: |
| 5058 | * @proxy: A #SensorValueProxy. |
| 5059 | * @arg_value: Argument to pass with the method invocation. |
| 5060 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5061 | * @error: Return location for error or %NULL. |
| 5062 | * |
| 5063 | * 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. |
| 5064 | * |
| 5065 | * See sensor_value_call_set_value() for the asynchronous version of this method. |
| 5066 | * |
| 5067 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5068 | */ |
| 5069 | gboolean |
| 5070 | sensor_value_call_set_value_sync ( |
| 5071 | SensorValue *proxy, |
| 5072 | GVariant *arg_value, |
| 5073 | GCancellable *cancellable, |
| 5074 | GError **error) |
| 5075 | { |
| 5076 | GVariant *_ret; |
| 5077 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5078 | "setValue", |
| 5079 | g_variant_new ("(@v)", |
| 5080 | arg_value), |
| 5081 | G_DBUS_CALL_FLAGS_NONE, |
| 5082 | -1, |
| 5083 | cancellable, |
| 5084 | error); |
| 5085 | if (_ret == NULL) |
| 5086 | goto _out; |
| 5087 | g_variant_get (_ret, |
| 5088 | "()"); |
| 5089 | g_variant_unref (_ret); |
| 5090 | _out: |
| 5091 | return _ret != NULL; |
| 5092 | } |
| 5093 | |
| 5094 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5095 | * sensor_value_complete_init: |
| 5096 | * @object: A #SensorValue. |
| 5097 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5098 | * |
| 5099 | * 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. |
| 5100 | * |
| 5101 | * This method will free @invocation, you cannot use it afterwards. |
| 5102 | */ |
| 5103 | void |
| 5104 | sensor_value_complete_init ( |
| 5105 | SensorValue *object, |
| 5106 | GDBusMethodInvocation *invocation) |
| 5107 | { |
| 5108 | g_dbus_method_invocation_return_value (invocation, |
| 5109 | g_variant_new ("()")); |
| 5110 | } |
| 5111 | |
| 5112 | /** |
| 5113 | * sensor_value_complete_get_value: |
| 5114 | * @object: A #SensorValue. |
| 5115 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5116 | * @value: Parameter to return. |
| 5117 | * |
| 5118 | * 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. |
| 5119 | * |
| 5120 | * This method will free @invocation, you cannot use it afterwards. |
| 5121 | */ |
| 5122 | void |
| 5123 | sensor_value_complete_get_value ( |
| 5124 | SensorValue *object, |
| 5125 | GDBusMethodInvocation *invocation, |
| 5126 | GVariant *value) |
| 5127 | { |
| 5128 | g_dbus_method_invocation_return_value (invocation, |
| 5129 | g_variant_new ("(@v)", |
| 5130 | value)); |
| 5131 | } |
| 5132 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 5133 | /** |
| 5134 | * sensor_value_complete_set_value: |
| 5135 | * @object: A #SensorValue. |
| 5136 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5137 | * |
| 5138 | * 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. |
| 5139 | * |
| 5140 | * This method will free @invocation, you cannot use it afterwards. |
| 5141 | */ |
| 5142 | void |
| 5143 | sensor_value_complete_set_value ( |
| 5144 | SensorValue *object, |
| 5145 | GDBusMethodInvocation *invocation) |
| 5146 | { |
| 5147 | g_dbus_method_invocation_return_value (invocation, |
| 5148 | g_variant_new ("()")); |
| 5149 | } |
| 5150 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5151 | /* ------------------------------------------------------------------------ */ |
| 5152 | |
| 5153 | /** |
| 5154 | * SensorValueProxy: |
| 5155 | * |
| 5156 | * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. |
| 5157 | */ |
| 5158 | |
| 5159 | /** |
| 5160 | * SensorValueProxyClass: |
| 5161 | * @parent_class: The parent class. |
| 5162 | * |
| 5163 | * Class structure for #SensorValueProxy. |
| 5164 | */ |
| 5165 | |
| 5166 | struct _SensorValueProxyPrivate |
| 5167 | { |
| 5168 | GData *qdata; |
| 5169 | }; |
| 5170 | |
| 5171 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
| 5172 | |
| 5173 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5174 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 5175 | G_ADD_PRIVATE (SensorValueProxy) |
| 5176 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 5177 | |
| 5178 | #else |
| 5179 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 5180 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 5181 | |
| 5182 | #endif |
| 5183 | static void |
| 5184 | sensor_value_proxy_finalize (GObject *object) |
| 5185 | { |
| 5186 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5187 | g_datalist_clear (&proxy->priv->qdata); |
| 5188 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
| 5189 | } |
| 5190 | |
| 5191 | static void |
| 5192 | sensor_value_proxy_get_property (GObject *object, |
| 5193 | guint prop_id, |
| 5194 | GValue *value, |
| 5195 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5196 | { |
| 5197 | const _ExtendedGDBusPropertyInfo *info; |
| 5198 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 5199 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5200 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 5201 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5202 | if (info->use_gvariant) |
| 5203 | { |
| 5204 | g_value_set_variant (value, variant); |
| 5205 | } |
| 5206 | else |
| 5207 | { |
| 5208 | if (variant != NULL) |
| 5209 | g_dbus_gvariant_to_gvalue (variant, value); |
| 5210 | } |
| 5211 | if (variant != NULL) |
| 5212 | g_variant_unref (variant); |
| 5213 | } |
| 5214 | |
| 5215 | static void |
| 5216 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
| 5217 | GAsyncResult *res, |
| 5218 | gpointer user_data) |
| 5219 | { |
| 5220 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5221 | GError *error; |
| 5222 | GVariant *_ret; |
| 5223 | error = NULL; |
| 5224 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5225 | if (!_ret) |
| 5226 | { |
| 5227 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", |
| 5228 | info->parent_struct.name, |
| 5229 | error->message, g_quark_to_string (error->domain), error->code); |
| 5230 | g_error_free (error); |
| 5231 | } |
| 5232 | else |
| 5233 | { |
| 5234 | g_variant_unref (_ret); |
| 5235 | } |
| 5236 | } |
| 5237 | |
| 5238 | static void |
| 5239 | sensor_value_proxy_set_property (GObject *object, |
| 5240 | guint prop_id, |
| 5241 | const GValue *value, |
| 5242 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5243 | { |
| 5244 | const _ExtendedGDBusPropertyInfo *info; |
| 5245 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 5246 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5247 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 5248 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5249 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5250 | "org.freedesktop.DBus.Properties.Set", |
| 5251 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
| 5252 | G_DBUS_CALL_FLAGS_NONE, |
| 5253 | -1, |
| 5254 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5255 | g_variant_unref (variant); |
| 5256 | } |
| 5257 | |
| 5258 | static void |
| 5259 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
| 5260 | const gchar *sender_name G_GNUC_UNUSED, |
| 5261 | const gchar *signal_name, |
| 5262 | GVariant *parameters) |
| 5263 | { |
| 5264 | _ExtendedGDBusSignalInfo *info; |
| 5265 | GVariantIter iter; |
| 5266 | GVariant *child; |
| 5267 | GValue *paramv; |
| 5268 | guint num_params; |
| 5269 | guint n; |
| 5270 | guint signal_id; |
| 5271 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); |
| 5272 | if (info == NULL) |
| 5273 | return; |
| 5274 | num_params = g_variant_n_children (parameters); |
| 5275 | paramv = g_new0 (GValue, num_params + 1); |
| 5276 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
| 5277 | g_value_set_object (¶mv[0], proxy); |
| 5278 | g_variant_iter_init (&iter, parameters); |
| 5279 | n = 1; |
| 5280 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5281 | { |
| 5282 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5283 | if (arg_info->use_gvariant) |
| 5284 | { |
| 5285 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5286 | g_value_set_variant (¶mv[n], child); |
| 5287 | n++; |
| 5288 | } |
| 5289 | else |
| 5290 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5291 | g_variant_unref (child); |
| 5292 | } |
| 5293 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 5294 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5295 | for (n = 0; n < num_params + 1; n++) |
| 5296 | g_value_unset (¶mv[n]); |
| 5297 | g_free (paramv); |
| 5298 | } |
| 5299 | |
| 5300 | static void |
| 5301 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5302 | GVariant *changed_properties, |
| 5303 | const gchar *const *invalidated_properties) |
| 5304 | { |
| 5305 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
| 5306 | guint n; |
| 5307 | const gchar *key; |
| 5308 | GVariantIter *iter; |
| 5309 | _ExtendedGDBusPropertyInfo *info; |
| 5310 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 5311 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5312 | { |
| 5313 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); |
| 5314 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5315 | if (info != NULL) |
| 5316 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5317 | } |
| 5318 | g_variant_iter_free (iter); |
| 5319 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5320 | { |
| 5321 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); |
| 5322 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5323 | if (info != NULL) |
| 5324 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5325 | } |
| 5326 | } |
| 5327 | |
| 5328 | static GVariant * |
| 5329 | sensor_value_proxy_get_value (SensorValue *object) |
| 5330 | { |
| 5331 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5332 | GVariant *variant; |
| 5333 | GVariant *value = NULL; |
| 5334 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 5335 | value = variant; |
| 5336 | if (variant != NULL) |
| 5337 | g_variant_unref (variant); |
| 5338 | return value; |
| 5339 | } |
| 5340 | |
| 5341 | static const gchar * |
| 5342 | sensor_value_proxy_get_units (SensorValue *object) |
| 5343 | { |
| 5344 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5345 | GVariant *variant; |
| 5346 | const gchar *value = NULL; |
| 5347 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 5348 | if (variant != NULL) |
| 5349 | { |
| 5350 | value = g_variant_get_string (variant, NULL); |
| 5351 | g_variant_unref (variant); |
| 5352 | } |
| 5353 | return value; |
| 5354 | } |
| 5355 | |
| 5356 | static gint |
| 5357 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
| 5358 | { |
| 5359 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5360 | GVariant *variant; |
| 5361 | gint value = 0; |
| 5362 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 5363 | if (variant != NULL) |
| 5364 | { |
| 5365 | value = g_variant_get_int32 (variant); |
| 5366 | g_variant_unref (variant); |
| 5367 | } |
| 5368 | return value; |
| 5369 | } |
| 5370 | |
| 5371 | static gint |
| 5372 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
| 5373 | { |
| 5374 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5375 | GVariant *variant; |
| 5376 | gint value = 0; |
| 5377 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 5378 | if (variant != NULL) |
| 5379 | { |
| 5380 | value = g_variant_get_int32 (variant); |
| 5381 | g_variant_unref (variant); |
| 5382 | } |
| 5383 | return value; |
| 5384 | } |
| 5385 | |
| 5386 | static gboolean |
| 5387 | sensor_value_proxy_get_settable (SensorValue *object) |
| 5388 | { |
| 5389 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 5390 | GVariant *variant; |
| 5391 | gboolean value = 0; |
| 5392 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); |
| 5393 | if (variant != NULL) |
| 5394 | { |
| 5395 | value = g_variant_get_boolean (variant); |
| 5396 | g_variant_unref (variant); |
| 5397 | } |
| 5398 | return value; |
| 5399 | } |
| 5400 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5401 | static void |
| 5402 | sensor_value_proxy_init (SensorValueProxy *proxy) |
| 5403 | { |
| 5404 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5405 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
| 5406 | #else |
| 5407 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); |
| 5408 | #endif |
| 5409 | |
| 5410 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); |
| 5411 | } |
| 5412 | |
| 5413 | static void |
| 5414 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
| 5415 | { |
| 5416 | GObjectClass *gobject_class; |
| 5417 | GDBusProxyClass *proxy_class; |
| 5418 | |
| 5419 | gobject_class = G_OBJECT_CLASS (klass); |
| 5420 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 5421 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 5422 | gobject_class->set_property = sensor_value_proxy_set_property; |
| 5423 | |
| 5424 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 5425 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 5426 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
| 5427 | |
| 5428 | sensor_value_override_properties (gobject_class, 1); |
| 5429 | |
| 5430 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5431 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
| 5432 | #endif |
| 5433 | } |
| 5434 | |
| 5435 | static void |
| 5436 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
| 5437 | { |
| 5438 | iface->get_value = sensor_value_proxy_get_value; |
| 5439 | iface->get_units = sensor_value_proxy_get_units; |
| 5440 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 5441 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
| 5442 | iface->get_settable = sensor_value_proxy_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5443 | } |
| 5444 | |
| 5445 | /** |
| 5446 | * sensor_value_proxy_new: |
| 5447 | * @connection: A #GDBusConnection. |
| 5448 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5449 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5450 | * @object_path: An object path. |
| 5451 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5452 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5453 | * @user_data: User data to pass to @callback. |
| 5454 | * |
| 5455 | * 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. |
| 5456 | * |
| 5457 | * 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. |
| 5458 | * You can then call sensor_value_proxy_new_finish() to get the result of the operation. |
| 5459 | * |
| 5460 | * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 5461 | */ |
| 5462 | void |
| 5463 | sensor_value_proxy_new ( |
| 5464 | GDBusConnection *connection, |
| 5465 | GDBusProxyFlags flags, |
| 5466 | const gchar *name, |
| 5467 | const gchar *object_path, |
| 5468 | GCancellable *cancellable, |
| 5469 | GAsyncReadyCallback callback, |
| 5470 | gpointer user_data) |
| 5471 | { |
| 5472 | 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); |
| 5473 | } |
| 5474 | |
| 5475 | /** |
| 5476 | * sensor_value_proxy_new_finish: |
| 5477 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). |
| 5478 | * @error: Return location for error or %NULL |
| 5479 | * |
| 5480 | * Finishes an operation started with sensor_value_proxy_new(). |
| 5481 | * |
| 5482 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5483 | */ |
| 5484 | SensorValue * |
| 5485 | sensor_value_proxy_new_finish ( |
| 5486 | GAsyncResult *res, |
| 5487 | GError **error) |
| 5488 | { |
| 5489 | GObject *ret; |
| 5490 | GObject *source_object; |
| 5491 | source_object = g_async_result_get_source_object (res); |
| 5492 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5493 | g_object_unref (source_object); |
| 5494 | if (ret != NULL) |
| 5495 | return SENSOR_VALUE (ret); |
| 5496 | else |
| 5497 | return NULL; |
| 5498 | } |
| 5499 | |
| 5500 | /** |
| 5501 | * sensor_value_proxy_new_sync: |
| 5502 | * @connection: A #GDBusConnection. |
| 5503 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5504 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5505 | * @object_path: An object path. |
| 5506 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5507 | * @error: Return location for error or %NULL |
| 5508 | * |
| 5509 | * 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. |
| 5510 | * |
| 5511 | * The calling thread is blocked until a reply is received. |
| 5512 | * |
| 5513 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
| 5514 | * |
| 5515 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5516 | */ |
| 5517 | SensorValue * |
| 5518 | sensor_value_proxy_new_sync ( |
| 5519 | GDBusConnection *connection, |
| 5520 | GDBusProxyFlags flags, |
| 5521 | const gchar *name, |
| 5522 | const gchar *object_path, |
| 5523 | GCancellable *cancellable, |
| 5524 | GError **error) |
| 5525 | { |
| 5526 | GInitable *ret; |
| 5527 | 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); |
| 5528 | if (ret != NULL) |
| 5529 | return SENSOR_VALUE (ret); |
| 5530 | else |
| 5531 | return NULL; |
| 5532 | } |
| 5533 | |
| 5534 | |
| 5535 | /** |
| 5536 | * sensor_value_proxy_new_for_bus: |
| 5537 | * @bus_type: A #GBusType. |
| 5538 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5539 | * @name: A bus name (well-known or unique). |
| 5540 | * @object_path: An object path. |
| 5541 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5542 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5543 | * @user_data: User data to pass to @callback. |
| 5544 | * |
| 5545 | * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 5546 | * |
| 5547 | * 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. |
| 5548 | * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. |
| 5549 | * |
| 5550 | * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 5551 | */ |
| 5552 | void |
| 5553 | sensor_value_proxy_new_for_bus ( |
| 5554 | GBusType bus_type, |
| 5555 | GDBusProxyFlags flags, |
| 5556 | const gchar *name, |
| 5557 | const gchar *object_path, |
| 5558 | GCancellable *cancellable, |
| 5559 | GAsyncReadyCallback callback, |
| 5560 | gpointer user_data) |
| 5561 | { |
| 5562 | 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); |
| 5563 | } |
| 5564 | |
| 5565 | /** |
| 5566 | * sensor_value_proxy_new_for_bus_finish: |
| 5567 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). |
| 5568 | * @error: Return location for error or %NULL |
| 5569 | * |
| 5570 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
| 5571 | * |
| 5572 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5573 | */ |
| 5574 | SensorValue * |
| 5575 | sensor_value_proxy_new_for_bus_finish ( |
| 5576 | GAsyncResult *res, |
| 5577 | GError **error) |
| 5578 | { |
| 5579 | GObject *ret; |
| 5580 | GObject *source_object; |
| 5581 | source_object = g_async_result_get_source_object (res); |
| 5582 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5583 | g_object_unref (source_object); |
| 5584 | if (ret != NULL) |
| 5585 | return SENSOR_VALUE (ret); |
| 5586 | else |
| 5587 | return NULL; |
| 5588 | } |
| 5589 | |
| 5590 | /** |
| 5591 | * sensor_value_proxy_new_for_bus_sync: |
| 5592 | * @bus_type: A #GBusType. |
| 5593 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5594 | * @name: A bus name (well-known or unique). |
| 5595 | * @object_path: An object path. |
| 5596 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5597 | * @error: Return location for error or %NULL |
| 5598 | * |
| 5599 | * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 5600 | * |
| 5601 | * The calling thread is blocked until a reply is received. |
| 5602 | * |
| 5603 | * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 5604 | * |
| 5605 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 5606 | */ |
| 5607 | SensorValue * |
| 5608 | sensor_value_proxy_new_for_bus_sync ( |
| 5609 | GBusType bus_type, |
| 5610 | GDBusProxyFlags flags, |
| 5611 | const gchar *name, |
| 5612 | const gchar *object_path, |
| 5613 | GCancellable *cancellable, |
| 5614 | GError **error) |
| 5615 | { |
| 5616 | GInitable *ret; |
| 5617 | 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); |
| 5618 | if (ret != NULL) |
| 5619 | return SENSOR_VALUE (ret); |
| 5620 | else |
| 5621 | return NULL; |
| 5622 | } |
| 5623 | |
| 5624 | |
| 5625 | /* ------------------------------------------------------------------------ */ |
| 5626 | |
| 5627 | /** |
| 5628 | * SensorValueSkeleton: |
| 5629 | * |
| 5630 | * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. |
| 5631 | */ |
| 5632 | |
| 5633 | /** |
| 5634 | * SensorValueSkeletonClass: |
| 5635 | * @parent_class: The parent class. |
| 5636 | * |
| 5637 | * Class structure for #SensorValueSkeleton. |
| 5638 | */ |
| 5639 | |
| 5640 | struct _SensorValueSkeletonPrivate |
| 5641 | { |
| 5642 | GValue *properties; |
| 5643 | GList *changed_properties; |
| 5644 | GSource *changed_properties_idle_source; |
| 5645 | GMainContext *context; |
| 5646 | GMutex lock; |
| 5647 | }; |
| 5648 | |
| 5649 | static void |
| 5650 | _sensor_value_skeleton_handle_method_call ( |
| 5651 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5652 | const gchar *sender G_GNUC_UNUSED, |
| 5653 | const gchar *object_path G_GNUC_UNUSED, |
| 5654 | const gchar *interface_name, |
| 5655 | const gchar *method_name, |
| 5656 | GVariant *parameters, |
| 5657 | GDBusMethodInvocation *invocation, |
| 5658 | gpointer user_data) |
| 5659 | { |
| 5660 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5661 | _ExtendedGDBusMethodInfo *info; |
| 5662 | GVariantIter iter; |
| 5663 | GVariant *child; |
| 5664 | GValue *paramv; |
| 5665 | guint num_params; |
| 5666 | guint num_extra; |
| 5667 | guint n; |
| 5668 | guint signal_id; |
| 5669 | GValue return_value = G_VALUE_INIT; |
| 5670 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 5671 | g_assert (info != NULL); |
| 5672 | num_params = g_variant_n_children (parameters); |
| 5673 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 5674 | n = 0; |
| 5675 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
| 5676 | g_value_set_object (¶mv[n++], skeleton); |
| 5677 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 5678 | g_value_set_object (¶mv[n++], invocation); |
| 5679 | if (info->pass_fdlist) |
| 5680 | { |
| 5681 | #ifdef G_OS_UNIX |
| 5682 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 5683 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 5684 | #else |
| 5685 | g_assert_not_reached (); |
| 5686 | #endif |
| 5687 | } |
| 5688 | g_variant_iter_init (&iter, parameters); |
| 5689 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5690 | { |
| 5691 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 5692 | if (arg_info->use_gvariant) |
| 5693 | { |
| 5694 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5695 | g_value_set_variant (¶mv[n], child); |
| 5696 | n++; |
| 5697 | } |
| 5698 | else |
| 5699 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5700 | g_variant_unref (child); |
| 5701 | } |
| 5702 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 5703 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 5704 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 5705 | if (!g_value_get_boolean (&return_value)) |
| 5706 | 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); |
| 5707 | g_value_unset (&return_value); |
| 5708 | for (n = 0; n < num_params + num_extra; n++) |
| 5709 | g_value_unset (¶mv[n]); |
| 5710 | g_free (paramv); |
| 5711 | } |
| 5712 | |
| 5713 | static GVariant * |
| 5714 | _sensor_value_skeleton_handle_get_property ( |
| 5715 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5716 | const gchar *sender G_GNUC_UNUSED, |
| 5717 | const gchar *object_path G_GNUC_UNUSED, |
| 5718 | const gchar *interface_name G_GNUC_UNUSED, |
| 5719 | const gchar *property_name, |
| 5720 | GError **error, |
| 5721 | gpointer user_data) |
| 5722 | { |
| 5723 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5724 | GValue value = G_VALUE_INIT; |
| 5725 | GParamSpec *pspec; |
| 5726 | _ExtendedGDBusPropertyInfo *info; |
| 5727 | GVariant *ret; |
| 5728 | ret = NULL; |
| 5729 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 5730 | g_assert (info != NULL); |
| 5731 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5732 | if (pspec == NULL) |
| 5733 | { |
| 5734 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5735 | } |
| 5736 | else |
| 5737 | { |
| 5738 | g_value_init (&value, pspec->value_type); |
| 5739 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5740 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5741 | g_value_unset (&value); |
| 5742 | } |
| 5743 | return ret; |
| 5744 | } |
| 5745 | |
| 5746 | static gboolean |
| 5747 | _sensor_value_skeleton_handle_set_property ( |
| 5748 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5749 | const gchar *sender G_GNUC_UNUSED, |
| 5750 | const gchar *object_path G_GNUC_UNUSED, |
| 5751 | const gchar *interface_name G_GNUC_UNUSED, |
| 5752 | const gchar *property_name, |
| 5753 | GVariant *variant, |
| 5754 | GError **error, |
| 5755 | gpointer user_data) |
| 5756 | { |
| 5757 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5758 | GValue value = G_VALUE_INIT; |
| 5759 | GParamSpec *pspec; |
| 5760 | _ExtendedGDBusPropertyInfo *info; |
| 5761 | gboolean ret; |
| 5762 | ret = FALSE; |
| 5763 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 5764 | g_assert (info != NULL); |
| 5765 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5766 | if (pspec == NULL) |
| 5767 | { |
| 5768 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5769 | } |
| 5770 | else |
| 5771 | { |
| 5772 | if (info->use_gvariant) |
| 5773 | g_value_set_variant (&value, variant); |
| 5774 | else |
| 5775 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 5776 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5777 | g_value_unset (&value); |
| 5778 | ret = TRUE; |
| 5779 | } |
| 5780 | return ret; |
| 5781 | } |
| 5782 | |
| 5783 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
| 5784 | { |
| 5785 | _sensor_value_skeleton_handle_method_call, |
| 5786 | _sensor_value_skeleton_handle_get_property, |
| 5787 | _sensor_value_skeleton_handle_set_property, |
| 5788 | {NULL} |
| 5789 | }; |
| 5790 | |
| 5791 | static GDBusInterfaceInfo * |
| 5792 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5793 | { |
| 5794 | return sensor_value_interface_info (); |
| 5795 | } |
| 5796 | |
| 5797 | static GDBusInterfaceVTable * |
| 5798 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 5799 | { |
| 5800 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
| 5801 | } |
| 5802 | |
| 5803 | static GVariant * |
| 5804 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 5805 | { |
| 5806 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 5807 | |
| 5808 | GVariantBuilder builder; |
| 5809 | guint n; |
| 5810 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5811 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
| 5812 | goto out; |
| 5813 | for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) |
| 5814 | { |
| 5815 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
| 5816 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 5817 | { |
| 5818 | GVariant *value; |
| 5819 | 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); |
| 5820 | if (value != NULL) |
| 5821 | { |
| 5822 | g_variant_take_ref (value); |
| 5823 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 5824 | g_variant_unref (value); |
| 5825 | } |
| 5826 | } |
| 5827 | } |
| 5828 | out: |
| 5829 | return g_variant_builder_end (&builder); |
| 5830 | } |
| 5831 | |
| 5832 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
| 5833 | |
| 5834 | static void |
| 5835 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 5836 | { |
| 5837 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 5838 | gboolean emit_changed = FALSE; |
| 5839 | |
| 5840 | g_mutex_lock (&skeleton->priv->lock); |
| 5841 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5842 | { |
| 5843 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5844 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5845 | emit_changed = TRUE; |
| 5846 | } |
| 5847 | g_mutex_unlock (&skeleton->priv->lock); |
| 5848 | |
| 5849 | if (emit_changed) |
| 5850 | _sensor_value_emit_changed (skeleton); |
| 5851 | } |
| 5852 | |
| 5853 | static void |
| 5854 | _sensor_value_on_signal_changed ( |
| 5855 | SensorValue *object, |
| 5856 | GVariant *arg_value, |
| 5857 | const gchar *arg_units) |
| 5858 | { |
| 5859 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5860 | |
| 5861 | GList *connections, *l; |
| 5862 | GVariant *signal_variant; |
| 5863 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5864 | |
| 5865 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
| 5866 | arg_value, |
| 5867 | arg_units)); |
| 5868 | for (l = connections; l != NULL; l = l->next) |
| 5869 | { |
| 5870 | GDBusConnection *connection = l->data; |
| 5871 | g_dbus_connection_emit_signal (connection, |
| 5872 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", |
| 5873 | signal_variant, NULL); |
| 5874 | } |
| 5875 | g_variant_unref (signal_variant); |
| 5876 | g_list_free_full (connections, g_object_unref); |
| 5877 | } |
| 5878 | |
| 5879 | static void |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 5880 | _sensor_value_on_signal_error ( |
| 5881 | SensorValue *object) |
| 5882 | { |
| 5883 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5884 | |
| 5885 | GList *connections, *l; |
| 5886 | GVariant *signal_variant; |
| 5887 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5888 | |
| 5889 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 5890 | for (l = connections; l != NULL; l = l->next) |
| 5891 | { |
| 5892 | GDBusConnection *connection = l->data; |
| 5893 | g_dbus_connection_emit_signal (connection, |
| 5894 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error", |
| 5895 | signal_variant, NULL); |
| 5896 | } |
| 5897 | g_variant_unref (signal_variant); |
| 5898 | g_list_free_full (connections, g_object_unref); |
| 5899 | } |
| 5900 | |
| 5901 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5902 | _sensor_value_on_signal_heartbeat ( |
| 5903 | SensorValue *object, |
| 5904 | const gchar *arg_bus_name) |
| 5905 | { |
| 5906 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5907 | |
| 5908 | GList *connections, *l; |
| 5909 | GVariant *signal_variant; |
| 5910 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5911 | |
| 5912 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 5913 | arg_bus_name)); |
| 5914 | for (l = connections; l != NULL; l = l->next) |
| 5915 | { |
| 5916 | GDBusConnection *connection = l->data; |
| 5917 | g_dbus_connection_emit_signal (connection, |
| 5918 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", |
| 5919 | signal_variant, NULL); |
| 5920 | } |
| 5921 | g_variant_unref (signal_variant); |
| 5922 | g_list_free_full (connections, g_object_unref); |
| 5923 | } |
| 5924 | |
| 5925 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
| 5926 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5927 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5928 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 5929 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 5930 | |
| 5931 | #else |
| 5932 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 5933 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 5934 | |
| 5935 | #endif |
| 5936 | static void |
| 5937 | sensor_value_skeleton_finalize (GObject *object) |
| 5938 | { |
| 5939 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 5940 | guint n; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 5941 | for (n = 0; n < 5; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5942 | g_value_unset (&skeleton->priv->properties[n]); |
| 5943 | g_free (skeleton->priv->properties); |
| 5944 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5945 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 5946 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 5947 | g_main_context_unref (skeleton->priv->context); |
| 5948 | g_mutex_clear (&skeleton->priv->lock); |
| 5949 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
| 5950 | } |
| 5951 | |
| 5952 | static void |
| 5953 | sensor_value_skeleton_get_property (GObject *object, |
| 5954 | guint prop_id, |
| 5955 | GValue *value, |
| 5956 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5957 | { |
| 5958 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 5959 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 5960 | g_mutex_lock (&skeleton->priv->lock); |
| 5961 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 5962 | g_mutex_unlock (&skeleton->priv->lock); |
| 5963 | } |
| 5964 | |
| 5965 | static gboolean |
| 5966 | _sensor_value_emit_changed (gpointer user_data) |
| 5967 | { |
| 5968 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 5969 | GList *l; |
| 5970 | GVariantBuilder builder; |
| 5971 | GVariantBuilder invalidated_builder; |
| 5972 | guint num_changes; |
| 5973 | |
| 5974 | g_mutex_lock (&skeleton->priv->lock); |
| 5975 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5976 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 5977 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 5978 | { |
| 5979 | ChangedProperty *cp = l->data; |
| 5980 | GVariant *variant; |
| 5981 | const GValue *cur_value; |
| 5982 | |
| 5983 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 5984 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 5985 | { |
| 5986 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 5987 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 5988 | g_variant_unref (variant); |
| 5989 | num_changes++; |
| 5990 | } |
| 5991 | } |
| 5992 | if (num_changes > 0) |
| 5993 | { |
| 5994 | GList *connections, *ll; |
| 5995 | GVariant *signal_variant; |
| 5996 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", |
| 5997 | &builder, &invalidated_builder)); |
| 5998 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5999 | for (ll = connections; ll != NULL; ll = ll->next) |
| 6000 | { |
| 6001 | GDBusConnection *connection = ll->data; |
| 6002 | |
| 6003 | g_dbus_connection_emit_signal (connection, |
| 6004 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6005 | "org.freedesktop.DBus.Properties", |
| 6006 | "PropertiesChanged", |
| 6007 | signal_variant, |
| 6008 | NULL); |
| 6009 | } |
| 6010 | g_variant_unref (signal_variant); |
| 6011 | g_list_free_full (connections, g_object_unref); |
| 6012 | } |
| 6013 | else |
| 6014 | { |
| 6015 | g_variant_builder_clear (&builder); |
| 6016 | g_variant_builder_clear (&invalidated_builder); |
| 6017 | } |
| 6018 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6019 | skeleton->priv->changed_properties = NULL; |
| 6020 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6021 | g_mutex_unlock (&skeleton->priv->lock); |
| 6022 | return FALSE; |
| 6023 | } |
| 6024 | |
| 6025 | static void |
| 6026 | _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6027 | { |
| 6028 | ChangedProperty *cp; |
| 6029 | GList *l; |
| 6030 | cp = NULL; |
| 6031 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 6032 | { |
| 6033 | ChangedProperty *i_cp = l->data; |
| 6034 | if (i_cp->info == info) |
| 6035 | { |
| 6036 | cp = i_cp; |
| 6037 | break; |
| 6038 | } |
| 6039 | } |
| 6040 | if (cp == NULL) |
| 6041 | { |
| 6042 | cp = g_new0 (ChangedProperty, 1); |
| 6043 | cp->prop_id = prop_id; |
| 6044 | cp->info = info; |
| 6045 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 6046 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 6047 | g_value_copy (orig_value, &cp->orig_value); |
| 6048 | } |
| 6049 | } |
| 6050 | |
| 6051 | static void |
| 6052 | sensor_value_skeleton_notify (GObject *object, |
| 6053 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6054 | { |
| 6055 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6056 | g_mutex_lock (&skeleton->priv->lock); |
| 6057 | if (skeleton->priv->changed_properties != NULL && |
| 6058 | skeleton->priv->changed_properties_idle_source == NULL) |
| 6059 | { |
| 6060 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 6061 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 6062 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 6063 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 6064 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 6065 | } |
| 6066 | g_mutex_unlock (&skeleton->priv->lock); |
| 6067 | } |
| 6068 | |
| 6069 | static void |
| 6070 | sensor_value_skeleton_set_property (GObject *object, |
| 6071 | guint prop_id, |
| 6072 | const GValue *value, |
| 6073 | GParamSpec *pspec) |
| 6074 | { |
| 6075 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 6076 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6077 | g_mutex_lock (&skeleton->priv->lock); |
| 6078 | g_object_freeze_notify (object); |
| 6079 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 6080 | { |
| 6081 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 6082 | _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 6083 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 6084 | g_object_notify_by_pspec (object, pspec); |
| 6085 | } |
| 6086 | g_mutex_unlock (&skeleton->priv->lock); |
| 6087 | g_object_thaw_notify (object); |
| 6088 | } |
| 6089 | |
| 6090 | static void |
| 6091 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
| 6092 | { |
| 6093 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6094 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
| 6095 | #else |
| 6096 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); |
| 6097 | #endif |
| 6098 | |
| 6099 | g_mutex_init (&skeleton->priv->lock); |
| 6100 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 6101 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6102 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 6103 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 6104 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 6105 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 6106 | g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6107 | } |
| 6108 | |
| 6109 | static GVariant * |
| 6110 | sensor_value_skeleton_get_value (SensorValue *object) |
| 6111 | { |
| 6112 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6113 | GVariant *value; |
| 6114 | g_mutex_lock (&skeleton->priv->lock); |
| 6115 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 6116 | g_mutex_unlock (&skeleton->priv->lock); |
| 6117 | return value; |
| 6118 | } |
| 6119 | |
| 6120 | static const gchar * |
| 6121 | sensor_value_skeleton_get_units (SensorValue *object) |
| 6122 | { |
| 6123 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6124 | const gchar *value; |
| 6125 | g_mutex_lock (&skeleton->priv->lock); |
| 6126 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 6127 | g_mutex_unlock (&skeleton->priv->lock); |
| 6128 | return value; |
| 6129 | } |
| 6130 | |
| 6131 | static gint |
| 6132 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
| 6133 | { |
| 6134 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6135 | gint value; |
| 6136 | g_mutex_lock (&skeleton->priv->lock); |
| 6137 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 6138 | g_mutex_unlock (&skeleton->priv->lock); |
| 6139 | return value; |
| 6140 | } |
| 6141 | |
| 6142 | static gint |
| 6143 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
| 6144 | { |
| 6145 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6146 | gint value; |
| 6147 | g_mutex_lock (&skeleton->priv->lock); |
| 6148 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 6149 | g_mutex_unlock (&skeleton->priv->lock); |
| 6150 | return value; |
| 6151 | } |
| 6152 | |
| 6153 | static gboolean |
| 6154 | sensor_value_skeleton_get_settable (SensorValue *object) |
| 6155 | { |
| 6156 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 6157 | gboolean value; |
| 6158 | g_mutex_lock (&skeleton->priv->lock); |
| 6159 | value = g_value_get_boolean (&(skeleton->priv->properties[4])); |
| 6160 | g_mutex_unlock (&skeleton->priv->lock); |
| 6161 | return value; |
| 6162 | } |
| 6163 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6164 | static void |
| 6165 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
| 6166 | { |
| 6167 | GObjectClass *gobject_class; |
| 6168 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 6169 | |
| 6170 | gobject_class = G_OBJECT_CLASS (klass); |
| 6171 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 6172 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 6173 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 6174 | gobject_class->notify = sensor_value_skeleton_notify; |
| 6175 | |
| 6176 | |
| 6177 | sensor_value_override_properties (gobject_class, 1); |
| 6178 | |
| 6179 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 6180 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 6181 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 6182 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 6183 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
| 6184 | |
| 6185 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6186 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
| 6187 | #endif |
| 6188 | } |
| 6189 | |
| 6190 | static void |
| 6191 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
| 6192 | { |
| 6193 | iface->changed = _sensor_value_on_signal_changed; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 6194 | iface->error = _sensor_value_on_signal_error; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6195 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 6196 | iface->get_value = sensor_value_skeleton_get_value; |
| 6197 | iface->get_units = sensor_value_skeleton_get_units; |
| 6198 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 6199 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
| 6200 | iface->get_settable = sensor_value_skeleton_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 6201 | } |
| 6202 | |
| 6203 | /** |
| 6204 | * sensor_value_skeleton_new: |
| 6205 | * |
| 6206 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 6207 | * |
| 6208 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
| 6209 | */ |
| 6210 | SensorValue * |
| 6211 | sensor_value_skeleton_new (void) |
| 6212 | { |
| 6213 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
| 6214 | } |
| 6215 | |
| 6216 | /* ------------------------------------------------------------------------ |
| 6217 | * Code for interface org.openbmc.SensorThreshold |
| 6218 | * ------------------------------------------------------------------------ |
| 6219 | */ |
| 6220 | |
| 6221 | /** |
| 6222 | * SECTION:SensorThreshold |
| 6223 | * @title: SensorThreshold |
| 6224 | * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface |
| 6225 | * |
| 6226 | * 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. |
| 6227 | */ |
| 6228 | |
| 6229 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
| 6230 | |
| 6231 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
| 6232 | { |
| 6233 | { |
| 6234 | -1, |
| 6235 | (gchar *) "state", |
| 6236 | (gchar *) "y", |
| 6237 | NULL |
| 6238 | }, |
| 6239 | FALSE |
| 6240 | }; |
| 6241 | |
| 6242 | static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = |
| 6243 | { |
| 6244 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
| 6245 | NULL |
| 6246 | }; |
| 6247 | |
| 6248 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
| 6249 | { |
| 6250 | { |
| 6251 | -1, |
| 6252 | (gchar *) "getState", |
| 6253 | NULL, |
| 6254 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
| 6255 | NULL |
| 6256 | }, |
| 6257 | "handle-get-state", |
| 6258 | FALSE |
| 6259 | }; |
| 6260 | |
| 6261 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
| 6262 | { |
| 6263 | &_sensor_threshold_method_info_get_state, |
| 6264 | NULL |
| 6265 | }; |
| 6266 | |
| 6267 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
| 6268 | { |
| 6269 | { |
| 6270 | -1, |
| 6271 | (gchar *) "Warning", |
| 6272 | NULL, |
| 6273 | NULL |
| 6274 | }, |
| 6275 | "warning" |
| 6276 | }; |
| 6277 | |
| 6278 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
| 6279 | { |
| 6280 | { |
| 6281 | -1, |
| 6282 | (gchar *) "Critical", |
| 6283 | NULL, |
| 6284 | NULL |
| 6285 | }, |
| 6286 | "critical" |
| 6287 | }; |
| 6288 | |
| 6289 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
| 6290 | { |
| 6291 | { |
| 6292 | -1, |
| 6293 | (gchar *) "Normal", |
| 6294 | NULL, |
| 6295 | NULL |
| 6296 | }, |
| 6297 | "normal" |
| 6298 | }; |
| 6299 | |
| 6300 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
| 6301 | { |
| 6302 | &_sensor_threshold_signal_info_warning, |
| 6303 | &_sensor_threshold_signal_info_critical, |
| 6304 | &_sensor_threshold_signal_info_normal, |
| 6305 | NULL |
| 6306 | }; |
| 6307 | |
| 6308 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
| 6309 | { |
| 6310 | { |
| 6311 | -1, |
| 6312 | (gchar *) "lower_critical", |
| 6313 | (gchar *) "v", |
| 6314 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6315 | NULL |
| 6316 | }, |
| 6317 | "lower-critical", |
| 6318 | FALSE |
| 6319 | }; |
| 6320 | |
| 6321 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
| 6322 | { |
| 6323 | { |
| 6324 | -1, |
| 6325 | (gchar *) "lower_warning", |
| 6326 | (gchar *) "v", |
| 6327 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6328 | NULL |
| 6329 | }, |
| 6330 | "lower-warning", |
| 6331 | FALSE |
| 6332 | }; |
| 6333 | |
| 6334 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
| 6335 | { |
| 6336 | { |
| 6337 | -1, |
| 6338 | (gchar *) "upper_warning", |
| 6339 | (gchar *) "v", |
| 6340 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6341 | NULL |
| 6342 | }, |
| 6343 | "upper-warning", |
| 6344 | FALSE |
| 6345 | }; |
| 6346 | |
| 6347 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
| 6348 | { |
| 6349 | { |
| 6350 | -1, |
| 6351 | (gchar *) "upper_critical", |
| 6352 | (gchar *) "v", |
| 6353 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6354 | NULL |
| 6355 | }, |
| 6356 | "upper-critical", |
| 6357 | FALSE |
| 6358 | }; |
| 6359 | |
| 6360 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
| 6361 | { |
| 6362 | { |
| 6363 | -1, |
| 6364 | (gchar *) "state", |
| 6365 | (gchar *) "y", |
| 6366 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 6367 | NULL |
| 6368 | }, |
| 6369 | "state", |
| 6370 | FALSE |
| 6371 | }; |
| 6372 | |
| 6373 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
| 6374 | { |
| 6375 | &_sensor_threshold_property_info_lower_critical, |
| 6376 | &_sensor_threshold_property_info_lower_warning, |
| 6377 | &_sensor_threshold_property_info_upper_warning, |
| 6378 | &_sensor_threshold_property_info_upper_critical, |
| 6379 | &_sensor_threshold_property_info_state, |
| 6380 | NULL |
| 6381 | }; |
| 6382 | |
| 6383 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
| 6384 | { |
| 6385 | { |
| 6386 | -1, |
| 6387 | (gchar *) "org.openbmc.SensorThreshold", |
| 6388 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 6389 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 6390 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
| 6391 | NULL |
| 6392 | }, |
| 6393 | "sensor-threshold", |
| 6394 | }; |
| 6395 | |
| 6396 | |
| 6397 | /** |
| 6398 | * sensor_threshold_interface_info: |
| 6399 | * |
| 6400 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. |
| 6401 | * |
| 6402 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 6403 | */ |
| 6404 | GDBusInterfaceInfo * |
| 6405 | sensor_threshold_interface_info (void) |
| 6406 | { |
| 6407 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
| 6408 | } |
| 6409 | |
| 6410 | /** |
| 6411 | * sensor_threshold_override_properties: |
| 6412 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 6413 | * @property_id_begin: The property id to assign to the first overridden property. |
| 6414 | * |
| 6415 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
| 6416 | * The properties are overridden in the order they are defined. |
| 6417 | * |
| 6418 | * Returns: The last property id. |
| 6419 | */ |
| 6420 | guint |
| 6421 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 6422 | { |
| 6423 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 6424 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 6425 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 6426 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 6427 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 6428 | return property_id_begin - 1; |
| 6429 | } |
| 6430 | |
| 6431 | |
| 6432 | |
| 6433 | /** |
| 6434 | * SensorThreshold: |
| 6435 | * |
| 6436 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 6437 | */ |
| 6438 | |
| 6439 | /** |
| 6440 | * SensorThresholdIface: |
| 6441 | * @parent_iface: The parent interface. |
| 6442 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 6443 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 6444 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 6445 | * @get_state: Getter for the #SensorThreshold:state property. |
| 6446 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 6447 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 6448 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 6449 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 6450 | * @warning: Handler for the #SensorThreshold::warning signal. |
| 6451 | * |
| 6452 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 6453 | */ |
| 6454 | |
| 6455 | typedef SensorThresholdIface SensorThresholdInterface; |
| 6456 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
| 6457 | |
| 6458 | static void |
| 6459 | sensor_threshold_default_init (SensorThresholdIface *iface) |
| 6460 | { |
| 6461 | /* GObject signals for incoming D-Bus method calls: */ |
| 6462 | /** |
| 6463 | * SensorThreshold::handle-get-state: |
| 6464 | * @object: A #SensorThreshold. |
| 6465 | * @invocation: A #GDBusMethodInvocation. |
| 6466 | * |
| 6467 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. |
| 6468 | * |
| 6469 | * 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. |
| 6470 | * |
| 6471 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 6472 | */ |
| 6473 | g_signal_new ("handle-get-state", |
| 6474 | G_TYPE_FROM_INTERFACE (iface), |
| 6475 | G_SIGNAL_RUN_LAST, |
| 6476 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
| 6477 | g_signal_accumulator_true_handled, |
| 6478 | NULL, |
| 6479 | g_cclosure_marshal_generic, |
| 6480 | G_TYPE_BOOLEAN, |
| 6481 | 1, |
| 6482 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 6483 | |
| 6484 | /* GObject signals for received D-Bus signals: */ |
| 6485 | /** |
| 6486 | * SensorThreshold::warning: |
| 6487 | * @object: A #SensorThreshold. |
| 6488 | * |
| 6489 | * 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. |
| 6490 | * |
| 6491 | * 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. |
| 6492 | */ |
| 6493 | g_signal_new ("warning", |
| 6494 | G_TYPE_FROM_INTERFACE (iface), |
| 6495 | G_SIGNAL_RUN_LAST, |
| 6496 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
| 6497 | NULL, |
| 6498 | NULL, |
| 6499 | g_cclosure_marshal_generic, |
| 6500 | G_TYPE_NONE, |
| 6501 | 0); |
| 6502 | |
| 6503 | /** |
| 6504 | * SensorThreshold::critical: |
| 6505 | * @object: A #SensorThreshold. |
| 6506 | * |
| 6507 | * 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. |
| 6508 | * |
| 6509 | * 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. |
| 6510 | */ |
| 6511 | g_signal_new ("critical", |
| 6512 | G_TYPE_FROM_INTERFACE (iface), |
| 6513 | G_SIGNAL_RUN_LAST, |
| 6514 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
| 6515 | NULL, |
| 6516 | NULL, |
| 6517 | g_cclosure_marshal_generic, |
| 6518 | G_TYPE_NONE, |
| 6519 | 0); |
| 6520 | |
| 6521 | /** |
| 6522 | * SensorThreshold::normal: |
| 6523 | * @object: A #SensorThreshold. |
| 6524 | * |
| 6525 | * 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. |
| 6526 | * |
| 6527 | * 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. |
| 6528 | */ |
| 6529 | g_signal_new ("normal", |
| 6530 | G_TYPE_FROM_INTERFACE (iface), |
| 6531 | G_SIGNAL_RUN_LAST, |
| 6532 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
| 6533 | NULL, |
| 6534 | NULL, |
| 6535 | g_cclosure_marshal_generic, |
| 6536 | G_TYPE_NONE, |
| 6537 | 0); |
| 6538 | |
| 6539 | /* GObject properties for D-Bus properties: */ |
| 6540 | /** |
| 6541 | * SensorThreshold:lower-critical: |
| 6542 | * |
| 6543 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. |
| 6544 | * |
| 6545 | * 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. |
| 6546 | */ |
| 6547 | g_object_interface_install_property (iface, |
| 6548 | g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6549 | /** |
| 6550 | * SensorThreshold:lower-warning: |
| 6551 | * |
| 6552 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. |
| 6553 | * |
| 6554 | * 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. |
| 6555 | */ |
| 6556 | g_object_interface_install_property (iface, |
| 6557 | g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6558 | /** |
| 6559 | * SensorThreshold:upper-warning: |
| 6560 | * |
| 6561 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. |
| 6562 | * |
| 6563 | * 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. |
| 6564 | */ |
| 6565 | g_object_interface_install_property (iface, |
| 6566 | g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6567 | /** |
| 6568 | * SensorThreshold:upper-critical: |
| 6569 | * |
| 6570 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. |
| 6571 | * |
| 6572 | * 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. |
| 6573 | */ |
| 6574 | g_object_interface_install_property (iface, |
| 6575 | g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6576 | /** |
| 6577 | * SensorThreshold:state: |
| 6578 | * |
| 6579 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. |
| 6580 | * |
| 6581 | * 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. |
| 6582 | */ |
| 6583 | g_object_interface_install_property (iface, |
| 6584 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6585 | } |
| 6586 | |
| 6587 | /** |
| 6588 | * sensor_threshold_get_lower_critical: (skip) |
| 6589 | * @object: A #SensorThreshold. |
| 6590 | * |
| 6591 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 6592 | * |
| 6593 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6594 | * |
| 6595 | * <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> |
| 6596 | * |
| 6597 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6598 | */ |
| 6599 | GVariant * |
| 6600 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
| 6601 | { |
| 6602 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
| 6603 | } |
| 6604 | |
| 6605 | /** |
| 6606 | * sensor_threshold_dup_lower_critical: (skip) |
| 6607 | * @object: A #SensorThreshold. |
| 6608 | * |
| 6609 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 6610 | * |
| 6611 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6612 | * |
| 6613 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6614 | */ |
| 6615 | GVariant * |
| 6616 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 6617 | { |
| 6618 | GVariant *value; |
| 6619 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 6620 | return value; |
| 6621 | } |
| 6622 | |
| 6623 | /** |
| 6624 | * sensor_threshold_set_lower_critical: (skip) |
| 6625 | * @object: A #SensorThreshold. |
| 6626 | * @value: The value to set. |
| 6627 | * |
| 6628 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. |
| 6629 | * |
| 6630 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6631 | */ |
| 6632 | void |
| 6633 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
| 6634 | { |
| 6635 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 6636 | } |
| 6637 | |
| 6638 | /** |
| 6639 | * sensor_threshold_get_lower_warning: (skip) |
| 6640 | * @object: A #SensorThreshold. |
| 6641 | * |
| 6642 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 6643 | * |
| 6644 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6645 | * |
| 6646 | * <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> |
| 6647 | * |
| 6648 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6649 | */ |
| 6650 | GVariant * |
| 6651 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
| 6652 | { |
| 6653 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
| 6654 | } |
| 6655 | |
| 6656 | /** |
| 6657 | * sensor_threshold_dup_lower_warning: (skip) |
| 6658 | * @object: A #SensorThreshold. |
| 6659 | * |
| 6660 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 6661 | * |
| 6662 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6663 | * |
| 6664 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6665 | */ |
| 6666 | GVariant * |
| 6667 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 6668 | { |
| 6669 | GVariant *value; |
| 6670 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 6671 | return value; |
| 6672 | } |
| 6673 | |
| 6674 | /** |
| 6675 | * sensor_threshold_set_lower_warning: (skip) |
| 6676 | * @object: A #SensorThreshold. |
| 6677 | * @value: The value to set. |
| 6678 | * |
| 6679 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. |
| 6680 | * |
| 6681 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6682 | */ |
| 6683 | void |
| 6684 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
| 6685 | { |
| 6686 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 6687 | } |
| 6688 | |
| 6689 | /** |
| 6690 | * sensor_threshold_get_upper_warning: (skip) |
| 6691 | * @object: A #SensorThreshold. |
| 6692 | * |
| 6693 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 6694 | * |
| 6695 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6696 | * |
| 6697 | * <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> |
| 6698 | * |
| 6699 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6700 | */ |
| 6701 | GVariant * |
| 6702 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
| 6703 | { |
| 6704 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
| 6705 | } |
| 6706 | |
| 6707 | /** |
| 6708 | * sensor_threshold_dup_upper_warning: (skip) |
| 6709 | * @object: A #SensorThreshold. |
| 6710 | * |
| 6711 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 6712 | * |
| 6713 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6714 | * |
| 6715 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6716 | */ |
| 6717 | GVariant * |
| 6718 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 6719 | { |
| 6720 | GVariant *value; |
| 6721 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 6722 | return value; |
| 6723 | } |
| 6724 | |
| 6725 | /** |
| 6726 | * sensor_threshold_set_upper_warning: (skip) |
| 6727 | * @object: A #SensorThreshold. |
| 6728 | * @value: The value to set. |
| 6729 | * |
| 6730 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. |
| 6731 | * |
| 6732 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6733 | */ |
| 6734 | void |
| 6735 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
| 6736 | { |
| 6737 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 6738 | } |
| 6739 | |
| 6740 | /** |
| 6741 | * sensor_threshold_get_upper_critical: (skip) |
| 6742 | * @object: A #SensorThreshold. |
| 6743 | * |
| 6744 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 6745 | * |
| 6746 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6747 | * |
| 6748 | * <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> |
| 6749 | * |
| 6750 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6751 | */ |
| 6752 | GVariant * |
| 6753 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
| 6754 | { |
| 6755 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
| 6756 | } |
| 6757 | |
| 6758 | /** |
| 6759 | * sensor_threshold_dup_upper_critical: (skip) |
| 6760 | * @object: A #SensorThreshold. |
| 6761 | * |
| 6762 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 6763 | * |
| 6764 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6765 | * |
| 6766 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 6767 | */ |
| 6768 | GVariant * |
| 6769 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 6770 | { |
| 6771 | GVariant *value; |
| 6772 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 6773 | return value; |
| 6774 | } |
| 6775 | |
| 6776 | /** |
| 6777 | * sensor_threshold_set_upper_critical: (skip) |
| 6778 | * @object: A #SensorThreshold. |
| 6779 | * @value: The value to set. |
| 6780 | * |
| 6781 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. |
| 6782 | * |
| 6783 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6784 | */ |
| 6785 | void |
| 6786 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
| 6787 | { |
| 6788 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 6789 | } |
| 6790 | |
| 6791 | /** |
| 6792 | * sensor_threshold_get_state: (skip) |
| 6793 | * @object: A #SensorThreshold. |
| 6794 | * |
| 6795 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. |
| 6796 | * |
| 6797 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 6798 | * |
| 6799 | * Returns: The property value. |
| 6800 | */ |
| 6801 | guchar |
| 6802 | sensor_threshold_get_state (SensorThreshold *object) |
| 6803 | { |
| 6804 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
| 6805 | } |
| 6806 | |
| 6807 | /** |
| 6808 | * sensor_threshold_set_state: (skip) |
| 6809 | * @object: A #SensorThreshold. |
| 6810 | * @value: The value to set. |
| 6811 | * |
| 6812 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. |
| 6813 | * |
| 6814 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 6815 | */ |
| 6816 | void |
| 6817 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
| 6818 | { |
| 6819 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 6820 | } |
| 6821 | |
| 6822 | /** |
| 6823 | * sensor_threshold_emit_warning: |
| 6824 | * @object: A #SensorThreshold. |
| 6825 | * |
| 6826 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. |
| 6827 | */ |
| 6828 | void |
| 6829 | sensor_threshold_emit_warning ( |
| 6830 | SensorThreshold *object) |
| 6831 | { |
| 6832 | g_signal_emit_by_name (object, "warning"); |
| 6833 | } |
| 6834 | |
| 6835 | /** |
| 6836 | * sensor_threshold_emit_critical: |
| 6837 | * @object: A #SensorThreshold. |
| 6838 | * |
| 6839 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. |
| 6840 | */ |
| 6841 | void |
| 6842 | sensor_threshold_emit_critical ( |
| 6843 | SensorThreshold *object) |
| 6844 | { |
| 6845 | g_signal_emit_by_name (object, "critical"); |
| 6846 | } |
| 6847 | |
| 6848 | /** |
| 6849 | * sensor_threshold_emit_normal: |
| 6850 | * @object: A #SensorThreshold. |
| 6851 | * |
| 6852 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. |
| 6853 | */ |
| 6854 | void |
| 6855 | sensor_threshold_emit_normal ( |
| 6856 | SensorThreshold *object) |
| 6857 | { |
| 6858 | g_signal_emit_by_name (object, "normal"); |
| 6859 | } |
| 6860 | |
| 6861 | /** |
| 6862 | * sensor_threshold_call_get_state: |
| 6863 | * @proxy: A #SensorThresholdProxy. |
| 6864 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6865 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 6866 | * @user_data: User data to pass to @callback. |
| 6867 | * |
| 6868 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. |
| 6869 | * 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. |
| 6870 | * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. |
| 6871 | * |
| 6872 | * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. |
| 6873 | */ |
| 6874 | void |
| 6875 | sensor_threshold_call_get_state ( |
| 6876 | SensorThreshold *proxy, |
| 6877 | GCancellable *cancellable, |
| 6878 | GAsyncReadyCallback callback, |
| 6879 | gpointer user_data) |
| 6880 | { |
| 6881 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 6882 | "getState", |
| 6883 | g_variant_new ("()"), |
| 6884 | G_DBUS_CALL_FLAGS_NONE, |
| 6885 | -1, |
| 6886 | cancellable, |
| 6887 | callback, |
| 6888 | user_data); |
| 6889 | } |
| 6890 | |
| 6891 | /** |
| 6892 | * sensor_threshold_call_get_state_finish: |
| 6893 | * @proxy: A #SensorThresholdProxy. |
| 6894 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 6895 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). |
| 6896 | * @error: Return location for error or %NULL. |
| 6897 | * |
| 6898 | * Finishes an operation started with sensor_threshold_call_get_state(). |
| 6899 | * |
| 6900 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 6901 | */ |
| 6902 | gboolean |
| 6903 | sensor_threshold_call_get_state_finish ( |
| 6904 | SensorThreshold *proxy, |
| 6905 | guchar *out_state, |
| 6906 | GAsyncResult *res, |
| 6907 | GError **error) |
| 6908 | { |
| 6909 | GVariant *_ret; |
| 6910 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 6911 | if (_ret == NULL) |
| 6912 | goto _out; |
| 6913 | g_variant_get (_ret, |
| 6914 | "(y)", |
| 6915 | out_state); |
| 6916 | g_variant_unref (_ret); |
| 6917 | _out: |
| 6918 | return _ret != NULL; |
| 6919 | } |
| 6920 | |
| 6921 | /** |
| 6922 | * sensor_threshold_call_get_state_sync: |
| 6923 | * @proxy: A #SensorThresholdProxy. |
| 6924 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 6925 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6926 | * @error: Return location for error or %NULL. |
| 6927 | * |
| 6928 | * 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. |
| 6929 | * |
| 6930 | * See sensor_threshold_call_get_state() for the asynchronous version of this method. |
| 6931 | * |
| 6932 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 6933 | */ |
| 6934 | gboolean |
| 6935 | sensor_threshold_call_get_state_sync ( |
| 6936 | SensorThreshold *proxy, |
| 6937 | guchar *out_state, |
| 6938 | GCancellable *cancellable, |
| 6939 | GError **error) |
| 6940 | { |
| 6941 | GVariant *_ret; |
| 6942 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 6943 | "getState", |
| 6944 | g_variant_new ("()"), |
| 6945 | G_DBUS_CALL_FLAGS_NONE, |
| 6946 | -1, |
| 6947 | cancellable, |
| 6948 | error); |
| 6949 | if (_ret == NULL) |
| 6950 | goto _out; |
| 6951 | g_variant_get (_ret, |
| 6952 | "(y)", |
| 6953 | out_state); |
| 6954 | g_variant_unref (_ret); |
| 6955 | _out: |
| 6956 | return _ret != NULL; |
| 6957 | } |
| 6958 | |
| 6959 | /** |
| 6960 | * sensor_threshold_complete_get_state: |
| 6961 | * @object: A #SensorThreshold. |
| 6962 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 6963 | * @state: Parameter to return. |
| 6964 | * |
| 6965 | * 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. |
| 6966 | * |
| 6967 | * This method will free @invocation, you cannot use it afterwards. |
| 6968 | */ |
| 6969 | void |
| 6970 | sensor_threshold_complete_get_state ( |
| 6971 | SensorThreshold *object, |
| 6972 | GDBusMethodInvocation *invocation, |
| 6973 | guchar state) |
| 6974 | { |
| 6975 | g_dbus_method_invocation_return_value (invocation, |
| 6976 | g_variant_new ("(y)", |
| 6977 | state)); |
| 6978 | } |
| 6979 | |
| 6980 | /* ------------------------------------------------------------------------ */ |
| 6981 | |
| 6982 | /** |
| 6983 | * SensorThresholdProxy: |
| 6984 | * |
| 6985 | * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 6986 | */ |
| 6987 | |
| 6988 | /** |
| 6989 | * SensorThresholdProxyClass: |
| 6990 | * @parent_class: The parent class. |
| 6991 | * |
| 6992 | * Class structure for #SensorThresholdProxy. |
| 6993 | */ |
| 6994 | |
| 6995 | struct _SensorThresholdProxyPrivate |
| 6996 | { |
| 6997 | GData *qdata; |
| 6998 | }; |
| 6999 | |
| 7000 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
| 7001 | |
| 7002 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7003 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 7004 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 7005 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 7006 | |
| 7007 | #else |
| 7008 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 7009 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 7010 | |
| 7011 | #endif |
| 7012 | static void |
| 7013 | sensor_threshold_proxy_finalize (GObject *object) |
| 7014 | { |
| 7015 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7016 | g_datalist_clear (&proxy->priv->qdata); |
| 7017 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
| 7018 | } |
| 7019 | |
| 7020 | static void |
| 7021 | sensor_threshold_proxy_get_property (GObject *object, |
| 7022 | guint prop_id, |
| 7023 | GValue *value, |
| 7024 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7025 | { |
| 7026 | const _ExtendedGDBusPropertyInfo *info; |
| 7027 | GVariant *variant; |
| 7028 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7029 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 7030 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 7031 | if (info->use_gvariant) |
| 7032 | { |
| 7033 | g_value_set_variant (value, variant); |
| 7034 | } |
| 7035 | else |
| 7036 | { |
| 7037 | if (variant != NULL) |
| 7038 | g_dbus_gvariant_to_gvalue (variant, value); |
| 7039 | } |
| 7040 | if (variant != NULL) |
| 7041 | g_variant_unref (variant); |
| 7042 | } |
| 7043 | |
| 7044 | static void |
| 7045 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 7046 | GAsyncResult *res, |
| 7047 | gpointer user_data) |
| 7048 | { |
| 7049 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 7050 | GError *error; |
| 7051 | GVariant *_ret; |
| 7052 | error = NULL; |
| 7053 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 7054 | if (!_ret) |
| 7055 | { |
| 7056 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", |
| 7057 | info->parent_struct.name, |
| 7058 | error->message, g_quark_to_string (error->domain), error->code); |
| 7059 | g_error_free (error); |
| 7060 | } |
| 7061 | else |
| 7062 | { |
| 7063 | g_variant_unref (_ret); |
| 7064 | } |
| 7065 | } |
| 7066 | |
| 7067 | static void |
| 7068 | sensor_threshold_proxy_set_property (GObject *object, |
| 7069 | guint prop_id, |
| 7070 | const GValue *value, |
| 7071 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7072 | { |
| 7073 | const _ExtendedGDBusPropertyInfo *info; |
| 7074 | GVariant *variant; |
| 7075 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7076 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 7077 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7078 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 7079 | "org.freedesktop.DBus.Properties.Set", |
| 7080 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
| 7081 | G_DBUS_CALL_FLAGS_NONE, |
| 7082 | -1, |
| 7083 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 7084 | g_variant_unref (variant); |
| 7085 | } |
| 7086 | |
| 7087 | static void |
| 7088 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 7089 | const gchar *sender_name G_GNUC_UNUSED, |
| 7090 | const gchar *signal_name, |
| 7091 | GVariant *parameters) |
| 7092 | { |
| 7093 | _ExtendedGDBusSignalInfo *info; |
| 7094 | GVariantIter iter; |
| 7095 | GVariant *child; |
| 7096 | GValue *paramv; |
| 7097 | guint num_params; |
| 7098 | guint n; |
| 7099 | guint signal_id; |
| 7100 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); |
| 7101 | if (info == NULL) |
| 7102 | return; |
| 7103 | num_params = g_variant_n_children (parameters); |
| 7104 | paramv = g_new0 (GValue, num_params + 1); |
| 7105 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
| 7106 | g_value_set_object (¶mv[0], proxy); |
| 7107 | g_variant_iter_init (&iter, parameters); |
| 7108 | n = 1; |
| 7109 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7110 | { |
| 7111 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 7112 | if (arg_info->use_gvariant) |
| 7113 | { |
| 7114 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7115 | g_value_set_variant (¶mv[n], child); |
| 7116 | n++; |
| 7117 | } |
| 7118 | else |
| 7119 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7120 | g_variant_unref (child); |
| 7121 | } |
| 7122 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 7123 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 7124 | for (n = 0; n < num_params + 1; n++) |
| 7125 | g_value_unset (¶mv[n]); |
| 7126 | g_free (paramv); |
| 7127 | } |
| 7128 | |
| 7129 | static void |
| 7130 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 7131 | GVariant *changed_properties, |
| 7132 | const gchar *const *invalidated_properties) |
| 7133 | { |
| 7134 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
| 7135 | guint n; |
| 7136 | const gchar *key; |
| 7137 | GVariantIter *iter; |
| 7138 | _ExtendedGDBusPropertyInfo *info; |
| 7139 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 7140 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 7141 | { |
| 7142 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); |
| 7143 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 7144 | if (info != NULL) |
| 7145 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7146 | } |
| 7147 | g_variant_iter_free (iter); |
| 7148 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 7149 | { |
| 7150 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 7151 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 7152 | if (info != NULL) |
| 7153 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7154 | } |
| 7155 | } |
| 7156 | |
| 7157 | static GVariant * |
| 7158 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
| 7159 | { |
| 7160 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7161 | GVariant *variant; |
| 7162 | GVariant *value = NULL; |
| 7163 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); |
| 7164 | value = variant; |
| 7165 | if (variant != NULL) |
| 7166 | g_variant_unref (variant); |
| 7167 | return value; |
| 7168 | } |
| 7169 | |
| 7170 | static GVariant * |
| 7171 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
| 7172 | { |
| 7173 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7174 | GVariant *variant; |
| 7175 | GVariant *value = NULL; |
| 7176 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); |
| 7177 | value = variant; |
| 7178 | if (variant != NULL) |
| 7179 | g_variant_unref (variant); |
| 7180 | return value; |
| 7181 | } |
| 7182 | |
| 7183 | static GVariant * |
| 7184 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
| 7185 | { |
| 7186 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7187 | GVariant *variant; |
| 7188 | GVariant *value = NULL; |
| 7189 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); |
| 7190 | value = variant; |
| 7191 | if (variant != NULL) |
| 7192 | g_variant_unref (variant); |
| 7193 | return value; |
| 7194 | } |
| 7195 | |
| 7196 | static GVariant * |
| 7197 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
| 7198 | { |
| 7199 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7200 | GVariant *variant; |
| 7201 | GVariant *value = NULL; |
| 7202 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); |
| 7203 | value = variant; |
| 7204 | if (variant != NULL) |
| 7205 | g_variant_unref (variant); |
| 7206 | return value; |
| 7207 | } |
| 7208 | |
| 7209 | static guchar |
| 7210 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
| 7211 | { |
| 7212 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 7213 | GVariant *variant; |
| 7214 | guchar value = 0; |
| 7215 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 7216 | if (variant != NULL) |
| 7217 | { |
| 7218 | value = g_variant_get_byte (variant); |
| 7219 | g_variant_unref (variant); |
| 7220 | } |
| 7221 | return value; |
| 7222 | } |
| 7223 | |
| 7224 | static void |
| 7225 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
| 7226 | { |
| 7227 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7228 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
| 7229 | #else |
| 7230 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); |
| 7231 | #endif |
| 7232 | |
| 7233 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); |
| 7234 | } |
| 7235 | |
| 7236 | static void |
| 7237 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
| 7238 | { |
| 7239 | GObjectClass *gobject_class; |
| 7240 | GDBusProxyClass *proxy_class; |
| 7241 | |
| 7242 | gobject_class = G_OBJECT_CLASS (klass); |
| 7243 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 7244 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 7245 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
| 7246 | |
| 7247 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 7248 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 7249 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
| 7250 | |
| 7251 | sensor_threshold_override_properties (gobject_class, 1); |
| 7252 | |
| 7253 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7254 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
| 7255 | #endif |
| 7256 | } |
| 7257 | |
| 7258 | static void |
| 7259 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
| 7260 | { |
| 7261 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 7262 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 7263 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 7264 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 7265 | iface->get_state = sensor_threshold_proxy_get_state; |
| 7266 | } |
| 7267 | |
| 7268 | /** |
| 7269 | * sensor_threshold_proxy_new: |
| 7270 | * @connection: A #GDBusConnection. |
| 7271 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7272 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7273 | * @object_path: An object path. |
| 7274 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7275 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7276 | * @user_data: User data to pass to @callback. |
| 7277 | * |
| 7278 | * 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. |
| 7279 | * |
| 7280 | * 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. |
| 7281 | * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. |
| 7282 | * |
| 7283 | * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 7284 | */ |
| 7285 | void |
| 7286 | sensor_threshold_proxy_new ( |
| 7287 | GDBusConnection *connection, |
| 7288 | GDBusProxyFlags flags, |
| 7289 | const gchar *name, |
| 7290 | const gchar *object_path, |
| 7291 | GCancellable *cancellable, |
| 7292 | GAsyncReadyCallback callback, |
| 7293 | gpointer user_data) |
| 7294 | { |
| 7295 | 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); |
| 7296 | } |
| 7297 | |
| 7298 | /** |
| 7299 | * sensor_threshold_proxy_new_finish: |
| 7300 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). |
| 7301 | * @error: Return location for error or %NULL |
| 7302 | * |
| 7303 | * Finishes an operation started with sensor_threshold_proxy_new(). |
| 7304 | * |
| 7305 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7306 | */ |
| 7307 | SensorThreshold * |
| 7308 | sensor_threshold_proxy_new_finish ( |
| 7309 | GAsyncResult *res, |
| 7310 | GError **error) |
| 7311 | { |
| 7312 | GObject *ret; |
| 7313 | GObject *source_object; |
| 7314 | source_object = g_async_result_get_source_object (res); |
| 7315 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7316 | g_object_unref (source_object); |
| 7317 | if (ret != NULL) |
| 7318 | return SENSOR_THRESHOLD (ret); |
| 7319 | else |
| 7320 | return NULL; |
| 7321 | } |
| 7322 | |
| 7323 | /** |
| 7324 | * sensor_threshold_proxy_new_sync: |
| 7325 | * @connection: A #GDBusConnection. |
| 7326 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7327 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7328 | * @object_path: An object path. |
| 7329 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7330 | * @error: Return location for error or %NULL |
| 7331 | * |
| 7332 | * 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. |
| 7333 | * |
| 7334 | * The calling thread is blocked until a reply is received. |
| 7335 | * |
| 7336 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
| 7337 | * |
| 7338 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7339 | */ |
| 7340 | SensorThreshold * |
| 7341 | sensor_threshold_proxy_new_sync ( |
| 7342 | GDBusConnection *connection, |
| 7343 | GDBusProxyFlags flags, |
| 7344 | const gchar *name, |
| 7345 | const gchar *object_path, |
| 7346 | GCancellable *cancellable, |
| 7347 | GError **error) |
| 7348 | { |
| 7349 | GInitable *ret; |
| 7350 | 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); |
| 7351 | if (ret != NULL) |
| 7352 | return SENSOR_THRESHOLD (ret); |
| 7353 | else |
| 7354 | return NULL; |
| 7355 | } |
| 7356 | |
| 7357 | |
| 7358 | /** |
| 7359 | * sensor_threshold_proxy_new_for_bus: |
| 7360 | * @bus_type: A #GBusType. |
| 7361 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7362 | * @name: A bus name (well-known or unique). |
| 7363 | * @object_path: An object path. |
| 7364 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7365 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7366 | * @user_data: User data to pass to @callback. |
| 7367 | * |
| 7368 | * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 7369 | * |
| 7370 | * 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. |
| 7371 | * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 7372 | * |
| 7373 | * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 7374 | */ |
| 7375 | void |
| 7376 | sensor_threshold_proxy_new_for_bus ( |
| 7377 | GBusType bus_type, |
| 7378 | GDBusProxyFlags flags, |
| 7379 | const gchar *name, |
| 7380 | const gchar *object_path, |
| 7381 | GCancellable *cancellable, |
| 7382 | GAsyncReadyCallback callback, |
| 7383 | gpointer user_data) |
| 7384 | { |
| 7385 | 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); |
| 7386 | } |
| 7387 | |
| 7388 | /** |
| 7389 | * sensor_threshold_proxy_new_for_bus_finish: |
| 7390 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). |
| 7391 | * @error: Return location for error or %NULL |
| 7392 | * |
| 7393 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
| 7394 | * |
| 7395 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7396 | */ |
| 7397 | SensorThreshold * |
| 7398 | sensor_threshold_proxy_new_for_bus_finish ( |
| 7399 | GAsyncResult *res, |
| 7400 | GError **error) |
| 7401 | { |
| 7402 | GObject *ret; |
| 7403 | GObject *source_object; |
| 7404 | source_object = g_async_result_get_source_object (res); |
| 7405 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7406 | g_object_unref (source_object); |
| 7407 | if (ret != NULL) |
| 7408 | return SENSOR_THRESHOLD (ret); |
| 7409 | else |
| 7410 | return NULL; |
| 7411 | } |
| 7412 | |
| 7413 | /** |
| 7414 | * sensor_threshold_proxy_new_for_bus_sync: |
| 7415 | * @bus_type: A #GBusType. |
| 7416 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7417 | * @name: A bus name (well-known or unique). |
| 7418 | * @object_path: An object path. |
| 7419 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7420 | * @error: Return location for error or %NULL |
| 7421 | * |
| 7422 | * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 7423 | * |
| 7424 | * The calling thread is blocked until a reply is received. |
| 7425 | * |
| 7426 | * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 7427 | * |
| 7428 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7429 | */ |
| 7430 | SensorThreshold * |
| 7431 | sensor_threshold_proxy_new_for_bus_sync ( |
| 7432 | GBusType bus_type, |
| 7433 | GDBusProxyFlags flags, |
| 7434 | const gchar *name, |
| 7435 | const gchar *object_path, |
| 7436 | GCancellable *cancellable, |
| 7437 | GError **error) |
| 7438 | { |
| 7439 | GInitable *ret; |
| 7440 | 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); |
| 7441 | if (ret != NULL) |
| 7442 | return SENSOR_THRESHOLD (ret); |
| 7443 | else |
| 7444 | return NULL; |
| 7445 | } |
| 7446 | |
| 7447 | |
| 7448 | /* ------------------------------------------------------------------------ */ |
| 7449 | |
| 7450 | /** |
| 7451 | * SensorThresholdSkeleton: |
| 7452 | * |
| 7453 | * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 7454 | */ |
| 7455 | |
| 7456 | /** |
| 7457 | * SensorThresholdSkeletonClass: |
| 7458 | * @parent_class: The parent class. |
| 7459 | * |
| 7460 | * Class structure for #SensorThresholdSkeleton. |
| 7461 | */ |
| 7462 | |
| 7463 | struct _SensorThresholdSkeletonPrivate |
| 7464 | { |
| 7465 | GValue *properties; |
| 7466 | GList *changed_properties; |
| 7467 | GSource *changed_properties_idle_source; |
| 7468 | GMainContext *context; |
| 7469 | GMutex lock; |
| 7470 | }; |
| 7471 | |
| 7472 | static void |
| 7473 | _sensor_threshold_skeleton_handle_method_call ( |
| 7474 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7475 | const gchar *sender G_GNUC_UNUSED, |
| 7476 | const gchar *object_path G_GNUC_UNUSED, |
| 7477 | const gchar *interface_name, |
| 7478 | const gchar *method_name, |
| 7479 | GVariant *parameters, |
| 7480 | GDBusMethodInvocation *invocation, |
| 7481 | gpointer user_data) |
| 7482 | { |
| 7483 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7484 | _ExtendedGDBusMethodInfo *info; |
| 7485 | GVariantIter iter; |
| 7486 | GVariant *child; |
| 7487 | GValue *paramv; |
| 7488 | guint num_params; |
| 7489 | guint num_extra; |
| 7490 | guint n; |
| 7491 | guint signal_id; |
| 7492 | GValue return_value = G_VALUE_INIT; |
| 7493 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 7494 | g_assert (info != NULL); |
| 7495 | num_params = g_variant_n_children (parameters); |
| 7496 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 7497 | n = 0; |
| 7498 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
| 7499 | g_value_set_object (¶mv[n++], skeleton); |
| 7500 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 7501 | g_value_set_object (¶mv[n++], invocation); |
| 7502 | if (info->pass_fdlist) |
| 7503 | { |
| 7504 | #ifdef G_OS_UNIX |
| 7505 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 7506 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 7507 | #else |
| 7508 | g_assert_not_reached (); |
| 7509 | #endif |
| 7510 | } |
| 7511 | g_variant_iter_init (&iter, parameters); |
| 7512 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7513 | { |
| 7514 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 7515 | if (arg_info->use_gvariant) |
| 7516 | { |
| 7517 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7518 | g_value_set_variant (¶mv[n], child); |
| 7519 | n++; |
| 7520 | } |
| 7521 | else |
| 7522 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7523 | g_variant_unref (child); |
| 7524 | } |
| 7525 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 7526 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 7527 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 7528 | if (!g_value_get_boolean (&return_value)) |
| 7529 | 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); |
| 7530 | g_value_unset (&return_value); |
| 7531 | for (n = 0; n < num_params + num_extra; n++) |
| 7532 | g_value_unset (¶mv[n]); |
| 7533 | g_free (paramv); |
| 7534 | } |
| 7535 | |
| 7536 | static GVariant * |
| 7537 | _sensor_threshold_skeleton_handle_get_property ( |
| 7538 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7539 | const gchar *sender G_GNUC_UNUSED, |
| 7540 | const gchar *object_path G_GNUC_UNUSED, |
| 7541 | const gchar *interface_name G_GNUC_UNUSED, |
| 7542 | const gchar *property_name, |
| 7543 | GError **error, |
| 7544 | gpointer user_data) |
| 7545 | { |
| 7546 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7547 | GValue value = G_VALUE_INIT; |
| 7548 | GParamSpec *pspec; |
| 7549 | _ExtendedGDBusPropertyInfo *info; |
| 7550 | GVariant *ret; |
| 7551 | ret = NULL; |
| 7552 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 7553 | g_assert (info != NULL); |
| 7554 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7555 | if (pspec == NULL) |
| 7556 | { |
| 7557 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7558 | } |
| 7559 | else |
| 7560 | { |
| 7561 | g_value_init (&value, pspec->value_type); |
| 7562 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7563 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7564 | g_value_unset (&value); |
| 7565 | } |
| 7566 | return ret; |
| 7567 | } |
| 7568 | |
| 7569 | static gboolean |
| 7570 | _sensor_threshold_skeleton_handle_set_property ( |
| 7571 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7572 | const gchar *sender G_GNUC_UNUSED, |
| 7573 | const gchar *object_path G_GNUC_UNUSED, |
| 7574 | const gchar *interface_name G_GNUC_UNUSED, |
| 7575 | const gchar *property_name, |
| 7576 | GVariant *variant, |
| 7577 | GError **error, |
| 7578 | gpointer user_data) |
| 7579 | { |
| 7580 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7581 | GValue value = G_VALUE_INIT; |
| 7582 | GParamSpec *pspec; |
| 7583 | _ExtendedGDBusPropertyInfo *info; |
| 7584 | gboolean ret; |
| 7585 | ret = FALSE; |
| 7586 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 7587 | g_assert (info != NULL); |
| 7588 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7589 | if (pspec == NULL) |
| 7590 | { |
| 7591 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7592 | } |
| 7593 | else |
| 7594 | { |
| 7595 | if (info->use_gvariant) |
| 7596 | g_value_set_variant (&value, variant); |
| 7597 | else |
| 7598 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 7599 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7600 | g_value_unset (&value); |
| 7601 | ret = TRUE; |
| 7602 | } |
| 7603 | return ret; |
| 7604 | } |
| 7605 | |
| 7606 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
| 7607 | { |
| 7608 | _sensor_threshold_skeleton_handle_method_call, |
| 7609 | _sensor_threshold_skeleton_handle_get_property, |
| 7610 | _sensor_threshold_skeleton_handle_set_property, |
| 7611 | {NULL} |
| 7612 | }; |
| 7613 | |
| 7614 | static GDBusInterfaceInfo * |
| 7615 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7616 | { |
| 7617 | return sensor_threshold_interface_info (); |
| 7618 | } |
| 7619 | |
| 7620 | static GDBusInterfaceVTable * |
| 7621 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7622 | { |
| 7623 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
| 7624 | } |
| 7625 | |
| 7626 | static GVariant * |
| 7627 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 7628 | { |
| 7629 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 7630 | |
| 7631 | GVariantBuilder builder; |
| 7632 | guint n; |
| 7633 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7634 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
| 7635 | goto out; |
| 7636 | for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 7637 | { |
| 7638 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
| 7639 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 7640 | { |
| 7641 | GVariant *value; |
| 7642 | 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); |
| 7643 | if (value != NULL) |
| 7644 | { |
| 7645 | g_variant_take_ref (value); |
| 7646 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 7647 | g_variant_unref (value); |
| 7648 | } |
| 7649 | } |
| 7650 | } |
| 7651 | out: |
| 7652 | return g_variant_builder_end (&builder); |
| 7653 | } |
| 7654 | |
| 7655 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
| 7656 | |
| 7657 | static void |
| 7658 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 7659 | { |
| 7660 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 7661 | gboolean emit_changed = FALSE; |
| 7662 | |
| 7663 | g_mutex_lock (&skeleton->priv->lock); |
| 7664 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7665 | { |
| 7666 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7667 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7668 | emit_changed = TRUE; |
| 7669 | } |
| 7670 | g_mutex_unlock (&skeleton->priv->lock); |
| 7671 | |
| 7672 | if (emit_changed) |
| 7673 | _sensor_threshold_emit_changed (skeleton); |
| 7674 | } |
| 7675 | |
| 7676 | static void |
| 7677 | _sensor_threshold_on_signal_warning ( |
| 7678 | SensorThreshold *object) |
| 7679 | { |
| 7680 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7681 | |
| 7682 | GList *connections, *l; |
| 7683 | GVariant *signal_variant; |
| 7684 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7685 | |
| 7686 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7687 | for (l = connections; l != NULL; l = l->next) |
| 7688 | { |
| 7689 | GDBusConnection *connection = l->data; |
| 7690 | g_dbus_connection_emit_signal (connection, |
| 7691 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", |
| 7692 | signal_variant, NULL); |
| 7693 | } |
| 7694 | g_variant_unref (signal_variant); |
| 7695 | g_list_free_full (connections, g_object_unref); |
| 7696 | } |
| 7697 | |
| 7698 | static void |
| 7699 | _sensor_threshold_on_signal_critical ( |
| 7700 | SensorThreshold *object) |
| 7701 | { |
| 7702 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7703 | |
| 7704 | GList *connections, *l; |
| 7705 | GVariant *signal_variant; |
| 7706 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7707 | |
| 7708 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7709 | for (l = connections; l != NULL; l = l->next) |
| 7710 | { |
| 7711 | GDBusConnection *connection = l->data; |
| 7712 | g_dbus_connection_emit_signal (connection, |
| 7713 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", |
| 7714 | signal_variant, NULL); |
| 7715 | } |
| 7716 | g_variant_unref (signal_variant); |
| 7717 | g_list_free_full (connections, g_object_unref); |
| 7718 | } |
| 7719 | |
| 7720 | static void |
| 7721 | _sensor_threshold_on_signal_normal ( |
| 7722 | SensorThreshold *object) |
| 7723 | { |
| 7724 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7725 | |
| 7726 | GList *connections, *l; |
| 7727 | GVariant *signal_variant; |
| 7728 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7729 | |
| 7730 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 7731 | for (l = connections; l != NULL; l = l->next) |
| 7732 | { |
| 7733 | GDBusConnection *connection = l->data; |
| 7734 | g_dbus_connection_emit_signal (connection, |
| 7735 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", |
| 7736 | signal_variant, NULL); |
| 7737 | } |
| 7738 | g_variant_unref (signal_variant); |
| 7739 | g_list_free_full (connections, g_object_unref); |
| 7740 | } |
| 7741 | |
| 7742 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
| 7743 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7744 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7745 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 7746 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 7747 | |
| 7748 | #else |
| 7749 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7750 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 7751 | |
| 7752 | #endif |
| 7753 | static void |
| 7754 | sensor_threshold_skeleton_finalize (GObject *object) |
| 7755 | { |
| 7756 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7757 | guint n; |
| 7758 | for (n = 0; n < 5; n++) |
| 7759 | g_value_unset (&skeleton->priv->properties[n]); |
| 7760 | g_free (skeleton->priv->properties); |
| 7761 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7762 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7763 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7764 | g_main_context_unref (skeleton->priv->context); |
| 7765 | g_mutex_clear (&skeleton->priv->lock); |
| 7766 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
| 7767 | } |
| 7768 | |
| 7769 | static void |
| 7770 | sensor_threshold_skeleton_get_property (GObject *object, |
| 7771 | guint prop_id, |
| 7772 | GValue *value, |
| 7773 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7774 | { |
| 7775 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7776 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7777 | g_mutex_lock (&skeleton->priv->lock); |
| 7778 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 7779 | g_mutex_unlock (&skeleton->priv->lock); |
| 7780 | } |
| 7781 | |
| 7782 | static gboolean |
| 7783 | _sensor_threshold_emit_changed (gpointer user_data) |
| 7784 | { |
| 7785 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 7786 | GList *l; |
| 7787 | GVariantBuilder builder; |
| 7788 | GVariantBuilder invalidated_builder; |
| 7789 | guint num_changes; |
| 7790 | |
| 7791 | g_mutex_lock (&skeleton->priv->lock); |
| 7792 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7793 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 7794 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 7795 | { |
| 7796 | ChangedProperty *cp = l->data; |
| 7797 | GVariant *variant; |
| 7798 | const GValue *cur_value; |
| 7799 | |
| 7800 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 7801 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 7802 | { |
| 7803 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 7804 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 7805 | g_variant_unref (variant); |
| 7806 | num_changes++; |
| 7807 | } |
| 7808 | } |
| 7809 | if (num_changes > 0) |
| 7810 | { |
| 7811 | GList *connections, *ll; |
| 7812 | GVariant *signal_variant; |
| 7813 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", |
| 7814 | &builder, &invalidated_builder)); |
| 7815 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7816 | for (ll = connections; ll != NULL; ll = ll->next) |
| 7817 | { |
| 7818 | GDBusConnection *connection = ll->data; |
| 7819 | |
| 7820 | g_dbus_connection_emit_signal (connection, |
| 7821 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 7822 | "org.freedesktop.DBus.Properties", |
| 7823 | "PropertiesChanged", |
| 7824 | signal_variant, |
| 7825 | NULL); |
| 7826 | } |
| 7827 | g_variant_unref (signal_variant); |
| 7828 | g_list_free_full (connections, g_object_unref); |
| 7829 | } |
| 7830 | else |
| 7831 | { |
| 7832 | g_variant_builder_clear (&builder); |
| 7833 | g_variant_builder_clear (&invalidated_builder); |
| 7834 | } |
| 7835 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7836 | skeleton->priv->changed_properties = NULL; |
| 7837 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7838 | g_mutex_unlock (&skeleton->priv->lock); |
| 7839 | return FALSE; |
| 7840 | } |
| 7841 | |
| 7842 | static void |
| 7843 | _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 7844 | { |
| 7845 | ChangedProperty *cp; |
| 7846 | GList *l; |
| 7847 | cp = NULL; |
| 7848 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 7849 | { |
| 7850 | ChangedProperty *i_cp = l->data; |
| 7851 | if (i_cp->info == info) |
| 7852 | { |
| 7853 | cp = i_cp; |
| 7854 | break; |
| 7855 | } |
| 7856 | } |
| 7857 | if (cp == NULL) |
| 7858 | { |
| 7859 | cp = g_new0 (ChangedProperty, 1); |
| 7860 | cp->prop_id = prop_id; |
| 7861 | cp->info = info; |
| 7862 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 7863 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 7864 | g_value_copy (orig_value, &cp->orig_value); |
| 7865 | } |
| 7866 | } |
| 7867 | |
| 7868 | static void |
| 7869 | sensor_threshold_skeleton_notify (GObject *object, |
| 7870 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7871 | { |
| 7872 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7873 | g_mutex_lock (&skeleton->priv->lock); |
| 7874 | if (skeleton->priv->changed_properties != NULL && |
| 7875 | skeleton->priv->changed_properties_idle_source == NULL) |
| 7876 | { |
| 7877 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 7878 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 7879 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 7880 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 7881 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 7882 | } |
| 7883 | g_mutex_unlock (&skeleton->priv->lock); |
| 7884 | } |
| 7885 | |
| 7886 | static void |
| 7887 | sensor_threshold_skeleton_set_property (GObject *object, |
| 7888 | guint prop_id, |
| 7889 | const GValue *value, |
| 7890 | GParamSpec *pspec) |
| 7891 | { |
| 7892 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7893 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 7894 | g_mutex_lock (&skeleton->priv->lock); |
| 7895 | g_object_freeze_notify (object); |
| 7896 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 7897 | { |
| 7898 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 7899 | _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 7900 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 7901 | g_object_notify_by_pspec (object, pspec); |
| 7902 | } |
| 7903 | g_mutex_unlock (&skeleton->priv->lock); |
| 7904 | g_object_thaw_notify (object); |
| 7905 | } |
| 7906 | |
| 7907 | static void |
| 7908 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
| 7909 | { |
| 7910 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7911 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
| 7912 | #else |
| 7913 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); |
| 7914 | #endif |
| 7915 | |
| 7916 | g_mutex_init (&skeleton->priv->lock); |
| 7917 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 7918 | skeleton->priv->properties = g_new0 (GValue, 5); |
| 7919 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 7920 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 7921 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 7922 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 7923 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
| 7924 | } |
| 7925 | |
| 7926 | static GVariant * |
| 7927 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
| 7928 | { |
| 7929 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7930 | GVariant *value; |
| 7931 | g_mutex_lock (&skeleton->priv->lock); |
| 7932 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 7933 | g_mutex_unlock (&skeleton->priv->lock); |
| 7934 | return value; |
| 7935 | } |
| 7936 | |
| 7937 | static GVariant * |
| 7938 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
| 7939 | { |
| 7940 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7941 | GVariant *value; |
| 7942 | g_mutex_lock (&skeleton->priv->lock); |
| 7943 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
| 7944 | g_mutex_unlock (&skeleton->priv->lock); |
| 7945 | return value; |
| 7946 | } |
| 7947 | |
| 7948 | static GVariant * |
| 7949 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
| 7950 | { |
| 7951 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7952 | GVariant *value; |
| 7953 | g_mutex_lock (&skeleton->priv->lock); |
| 7954 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
| 7955 | g_mutex_unlock (&skeleton->priv->lock); |
| 7956 | return value; |
| 7957 | } |
| 7958 | |
| 7959 | static GVariant * |
| 7960 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
| 7961 | { |
| 7962 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7963 | GVariant *value; |
| 7964 | g_mutex_lock (&skeleton->priv->lock); |
| 7965 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
| 7966 | g_mutex_unlock (&skeleton->priv->lock); |
| 7967 | return value; |
| 7968 | } |
| 7969 | |
| 7970 | static guchar |
| 7971 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
| 7972 | { |
| 7973 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 7974 | guchar value; |
| 7975 | g_mutex_lock (&skeleton->priv->lock); |
| 7976 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
| 7977 | g_mutex_unlock (&skeleton->priv->lock); |
| 7978 | return value; |
| 7979 | } |
| 7980 | |
| 7981 | static void |
| 7982 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
| 7983 | { |
| 7984 | GObjectClass *gobject_class; |
| 7985 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 7986 | |
| 7987 | gobject_class = G_OBJECT_CLASS (klass); |
| 7988 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 7989 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 7990 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 7991 | gobject_class->notify = sensor_threshold_skeleton_notify; |
| 7992 | |
| 7993 | |
| 7994 | sensor_threshold_override_properties (gobject_class, 1); |
| 7995 | |
| 7996 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 7997 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 7998 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 7999 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 8000 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
| 8001 | |
| 8002 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8003 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
| 8004 | #endif |
| 8005 | } |
| 8006 | |
| 8007 | static void |
| 8008 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
| 8009 | { |
| 8010 | iface->warning = _sensor_threshold_on_signal_warning; |
| 8011 | iface->critical = _sensor_threshold_on_signal_critical; |
| 8012 | iface->normal = _sensor_threshold_on_signal_normal; |
| 8013 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 8014 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 8015 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 8016 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 8017 | iface->get_state = sensor_threshold_skeleton_get_state; |
| 8018 | } |
| 8019 | |
| 8020 | /** |
| 8021 | * sensor_threshold_skeleton_new: |
| 8022 | * |
| 8023 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 8024 | * |
| 8025 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
| 8026 | */ |
| 8027 | SensorThreshold * |
| 8028 | sensor_threshold_skeleton_new (void) |
| 8029 | { |
| 8030 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
| 8031 | } |
| 8032 | |
| 8033 | /* ------------------------------------------------------------------------ |
| 8034 | * Code for interface org.openbmc.SensorI2c |
| 8035 | * ------------------------------------------------------------------------ |
| 8036 | */ |
| 8037 | |
| 8038 | /** |
| 8039 | * SECTION:SensorI2c |
| 8040 | * @title: SensorI2c |
| 8041 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 8042 | * |
| 8043 | * 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. |
| 8044 | */ |
| 8045 | |
| 8046 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 8047 | |
| 8048 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 8049 | { |
| 8050 | { |
| 8051 | -1, |
| 8052 | (gchar *) "dev_path", |
| 8053 | (gchar *) "s", |
| 8054 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 8055 | NULL |
| 8056 | }, |
| 8057 | "dev-path", |
| 8058 | FALSE |
| 8059 | }; |
| 8060 | |
| 8061 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 8062 | { |
| 8063 | { |
| 8064 | -1, |
| 8065 | (gchar *) "address", |
| 8066 | (gchar *) "s", |
| 8067 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 8068 | NULL |
| 8069 | }, |
| 8070 | "address", |
| 8071 | FALSE |
| 8072 | }; |
| 8073 | |
| 8074 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 8075 | { |
| 8076 | &_sensor_i2c_property_info_dev_path, |
| 8077 | &_sensor_i2c_property_info_address, |
| 8078 | NULL |
| 8079 | }; |
| 8080 | |
| 8081 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 8082 | { |
| 8083 | { |
| 8084 | -1, |
| 8085 | (gchar *) "org.openbmc.SensorI2c", |
| 8086 | NULL, |
| 8087 | NULL, |
| 8088 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 8089 | NULL |
| 8090 | }, |
| 8091 | "sensor-i2c", |
| 8092 | }; |
| 8093 | |
| 8094 | |
| 8095 | /** |
| 8096 | * sensor_i2c_interface_info: |
| 8097 | * |
| 8098 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 8099 | * |
| 8100 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 8101 | */ |
| 8102 | GDBusInterfaceInfo * |
| 8103 | sensor_i2c_interface_info (void) |
| 8104 | { |
| 8105 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 8106 | } |
| 8107 | |
| 8108 | /** |
| 8109 | * sensor_i2c_override_properties: |
| 8110 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 8111 | * @property_id_begin: The property id to assign to the first overridden property. |
| 8112 | * |
| 8113 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 8114 | * The properties are overridden in the order they are defined. |
| 8115 | * |
| 8116 | * Returns: The last property id. |
| 8117 | */ |
| 8118 | guint |
| 8119 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 8120 | { |
| 8121 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 8122 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 8123 | return property_id_begin - 1; |
| 8124 | } |
| 8125 | |
| 8126 | |
| 8127 | |
| 8128 | /** |
| 8129 | * SensorI2c: |
| 8130 | * |
| 8131 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 8132 | */ |
| 8133 | |
| 8134 | /** |
| 8135 | * SensorI2cIface: |
| 8136 | * @parent_iface: The parent interface. |
| 8137 | * @get_address: Getter for the #SensorI2c:address property. |
| 8138 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 8139 | * |
| 8140 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 8141 | */ |
| 8142 | |
| 8143 | typedef SensorI2cIface SensorI2cInterface; |
| 8144 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 8145 | |
| 8146 | static void |
| 8147 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 8148 | { |
| 8149 | /* GObject properties for D-Bus properties: */ |
| 8150 | /** |
| 8151 | * SensorI2c:dev-path: |
| 8152 | * |
| 8153 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 8154 | * |
| 8155 | * 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. |
| 8156 | */ |
| 8157 | g_object_interface_install_property (iface, |
| 8158 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8159 | /** |
| 8160 | * SensorI2c:address: |
| 8161 | * |
| 8162 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 8163 | * |
| 8164 | * 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. |
| 8165 | */ |
| 8166 | g_object_interface_install_property (iface, |
| 8167 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8168 | } |
| 8169 | |
| 8170 | /** |
| 8171 | * sensor_i2c_get_dev_path: (skip) |
| 8172 | * @object: A #SensorI2c. |
| 8173 | * |
| 8174 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 8175 | * |
| 8176 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8177 | * |
| 8178 | * <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> |
| 8179 | * |
| 8180 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 8181 | */ |
| 8182 | const gchar * |
| 8183 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 8184 | { |
| 8185 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 8186 | } |
| 8187 | |
| 8188 | /** |
| 8189 | * sensor_i2c_dup_dev_path: (skip) |
| 8190 | * @object: A #SensorI2c. |
| 8191 | * |
| 8192 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 8193 | * |
| 8194 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8195 | * |
| 8196 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 8197 | */ |
| 8198 | gchar * |
| 8199 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 8200 | { |
| 8201 | gchar *value; |
| 8202 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 8203 | return value; |
| 8204 | } |
| 8205 | |
| 8206 | /** |
| 8207 | * sensor_i2c_set_dev_path: (skip) |
| 8208 | * @object: A #SensorI2c. |
| 8209 | * @value: The value to set. |
| 8210 | * |
| 8211 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 8212 | * |
| 8213 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8214 | */ |
| 8215 | void |
| 8216 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 8217 | { |
| 8218 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 8219 | } |
| 8220 | |
| 8221 | /** |
| 8222 | * sensor_i2c_get_address: (skip) |
| 8223 | * @object: A #SensorI2c. |
| 8224 | * |
| 8225 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 8226 | * |
| 8227 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8228 | * |
| 8229 | * <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> |
| 8230 | * |
| 8231 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 8232 | */ |
| 8233 | const gchar * |
| 8234 | sensor_i2c_get_address (SensorI2c *object) |
| 8235 | { |
| 8236 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 8237 | } |
| 8238 | |
| 8239 | /** |
| 8240 | * sensor_i2c_dup_address: (skip) |
| 8241 | * @object: A #SensorI2c. |
| 8242 | * |
| 8243 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 8244 | * |
| 8245 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8246 | * |
| 8247 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 8248 | */ |
| 8249 | gchar * |
| 8250 | sensor_i2c_dup_address (SensorI2c *object) |
| 8251 | { |
| 8252 | gchar *value; |
| 8253 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 8254 | return value; |
| 8255 | } |
| 8256 | |
| 8257 | /** |
| 8258 | * sensor_i2c_set_address: (skip) |
| 8259 | * @object: A #SensorI2c. |
| 8260 | * @value: The value to set. |
| 8261 | * |
| 8262 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 8263 | * |
| 8264 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 8265 | */ |
| 8266 | void |
| 8267 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 8268 | { |
| 8269 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 8270 | } |
| 8271 | |
| 8272 | /* ------------------------------------------------------------------------ */ |
| 8273 | |
| 8274 | /** |
| 8275 | * SensorI2cProxy: |
| 8276 | * |
| 8277 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 8278 | */ |
| 8279 | |
| 8280 | /** |
| 8281 | * SensorI2cProxyClass: |
| 8282 | * @parent_class: The parent class. |
| 8283 | * |
| 8284 | * Class structure for #SensorI2cProxy. |
| 8285 | */ |
| 8286 | |
| 8287 | struct _SensorI2cProxyPrivate |
| 8288 | { |
| 8289 | GData *qdata; |
| 8290 | }; |
| 8291 | |
| 8292 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 8293 | |
| 8294 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8295 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 8296 | G_ADD_PRIVATE (SensorI2cProxy) |
| 8297 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 8298 | |
| 8299 | #else |
| 8300 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 8301 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 8302 | |
| 8303 | #endif |
| 8304 | static void |
| 8305 | sensor_i2c_proxy_finalize (GObject *object) |
| 8306 | { |
| 8307 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 8308 | g_datalist_clear (&proxy->priv->qdata); |
| 8309 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 8310 | } |
| 8311 | |
| 8312 | static void |
| 8313 | sensor_i2c_proxy_get_property (GObject *object, |
| 8314 | guint prop_id, |
| 8315 | GValue *value, |
| 8316 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8317 | { |
| 8318 | const _ExtendedGDBusPropertyInfo *info; |
| 8319 | GVariant *variant; |
| 8320 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8321 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 8322 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 8323 | if (info->use_gvariant) |
| 8324 | { |
| 8325 | g_value_set_variant (value, variant); |
| 8326 | } |
| 8327 | else |
| 8328 | { |
| 8329 | if (variant != NULL) |
| 8330 | g_dbus_gvariant_to_gvalue (variant, value); |
| 8331 | } |
| 8332 | if (variant != NULL) |
| 8333 | g_variant_unref (variant); |
| 8334 | } |
| 8335 | |
| 8336 | static void |
| 8337 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 8338 | GAsyncResult *res, |
| 8339 | gpointer user_data) |
| 8340 | { |
| 8341 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 8342 | GError *error; |
| 8343 | GVariant *_ret; |
| 8344 | error = NULL; |
| 8345 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 8346 | if (!_ret) |
| 8347 | { |
| 8348 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 8349 | info->parent_struct.name, |
| 8350 | error->message, g_quark_to_string (error->domain), error->code); |
| 8351 | g_error_free (error); |
| 8352 | } |
| 8353 | else |
| 8354 | { |
| 8355 | g_variant_unref (_ret); |
| 8356 | } |
| 8357 | } |
| 8358 | |
| 8359 | static void |
| 8360 | sensor_i2c_proxy_set_property (GObject *object, |
| 8361 | guint prop_id, |
| 8362 | const GValue *value, |
| 8363 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8364 | { |
| 8365 | const _ExtendedGDBusPropertyInfo *info; |
| 8366 | GVariant *variant; |
| 8367 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8368 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 8369 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8370 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 8371 | "org.freedesktop.DBus.Properties.Set", |
| 8372 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 8373 | G_DBUS_CALL_FLAGS_NONE, |
| 8374 | -1, |
| 8375 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 8376 | g_variant_unref (variant); |
| 8377 | } |
| 8378 | |
| 8379 | static void |
| 8380 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 8381 | const gchar *sender_name G_GNUC_UNUSED, |
| 8382 | const gchar *signal_name, |
| 8383 | GVariant *parameters) |
| 8384 | { |
| 8385 | _ExtendedGDBusSignalInfo *info; |
| 8386 | GVariantIter iter; |
| 8387 | GVariant *child; |
| 8388 | GValue *paramv; |
| 8389 | guint num_params; |
| 8390 | guint n; |
| 8391 | guint signal_id; |
| 8392 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 8393 | if (info == NULL) |
| 8394 | return; |
| 8395 | num_params = g_variant_n_children (parameters); |
| 8396 | paramv = g_new0 (GValue, num_params + 1); |
| 8397 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 8398 | g_value_set_object (¶mv[0], proxy); |
| 8399 | g_variant_iter_init (&iter, parameters); |
| 8400 | n = 1; |
| 8401 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8402 | { |
| 8403 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 8404 | if (arg_info->use_gvariant) |
| 8405 | { |
| 8406 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8407 | g_value_set_variant (¶mv[n], child); |
| 8408 | n++; |
| 8409 | } |
| 8410 | else |
| 8411 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8412 | g_variant_unref (child); |
| 8413 | } |
| 8414 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 8415 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 8416 | for (n = 0; n < num_params + 1; n++) |
| 8417 | g_value_unset (¶mv[n]); |
| 8418 | g_free (paramv); |
| 8419 | } |
| 8420 | |
| 8421 | static void |
| 8422 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 8423 | GVariant *changed_properties, |
| 8424 | const gchar *const *invalidated_properties) |
| 8425 | { |
| 8426 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 8427 | guint n; |
| 8428 | const gchar *key; |
| 8429 | GVariantIter *iter; |
| 8430 | _ExtendedGDBusPropertyInfo *info; |
| 8431 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 8432 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 8433 | { |
| 8434 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 8435 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 8436 | if (info != NULL) |
| 8437 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8438 | } |
| 8439 | g_variant_iter_free (iter); |
| 8440 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 8441 | { |
| 8442 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 8443 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 8444 | if (info != NULL) |
| 8445 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8446 | } |
| 8447 | } |
| 8448 | |
| 8449 | static const gchar * |
| 8450 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 8451 | { |
| 8452 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 8453 | GVariant *variant; |
| 8454 | const gchar *value = NULL; |
| 8455 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 8456 | if (variant != NULL) |
| 8457 | { |
| 8458 | value = g_variant_get_string (variant, NULL); |
| 8459 | g_variant_unref (variant); |
| 8460 | } |
| 8461 | return value; |
| 8462 | } |
| 8463 | |
| 8464 | static const gchar * |
| 8465 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 8466 | { |
| 8467 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 8468 | GVariant *variant; |
| 8469 | const gchar *value = NULL; |
| 8470 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 8471 | if (variant != NULL) |
| 8472 | { |
| 8473 | value = g_variant_get_string (variant, NULL); |
| 8474 | g_variant_unref (variant); |
| 8475 | } |
| 8476 | return value; |
| 8477 | } |
| 8478 | |
| 8479 | static void |
| 8480 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 8481 | { |
| 8482 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8483 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 8484 | #else |
| 8485 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 8486 | #endif |
| 8487 | |
| 8488 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 8489 | } |
| 8490 | |
| 8491 | static void |
| 8492 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 8493 | { |
| 8494 | GObjectClass *gobject_class; |
| 8495 | GDBusProxyClass *proxy_class; |
| 8496 | |
| 8497 | gobject_class = G_OBJECT_CLASS (klass); |
| 8498 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 8499 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 8500 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 8501 | |
| 8502 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 8503 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 8504 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 8505 | |
| 8506 | sensor_i2c_override_properties (gobject_class, 1); |
| 8507 | |
| 8508 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8509 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 8510 | #endif |
| 8511 | } |
| 8512 | |
| 8513 | static void |
| 8514 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 8515 | { |
| 8516 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 8517 | iface->get_address = sensor_i2c_proxy_get_address; |
| 8518 | } |
| 8519 | |
| 8520 | /** |
| 8521 | * sensor_i2c_proxy_new: |
| 8522 | * @connection: A #GDBusConnection. |
| 8523 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8524 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8525 | * @object_path: An object path. |
| 8526 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8527 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8528 | * @user_data: User data to pass to @callback. |
| 8529 | * |
| 8530 | * 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. |
| 8531 | * |
| 8532 | * 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. |
| 8533 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 8534 | * |
| 8535 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 8536 | */ |
| 8537 | void |
| 8538 | sensor_i2c_proxy_new ( |
| 8539 | GDBusConnection *connection, |
| 8540 | GDBusProxyFlags flags, |
| 8541 | const gchar *name, |
| 8542 | const gchar *object_path, |
| 8543 | GCancellable *cancellable, |
| 8544 | GAsyncReadyCallback callback, |
| 8545 | gpointer user_data) |
| 8546 | { |
| 8547 | 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); |
| 8548 | } |
| 8549 | |
| 8550 | /** |
| 8551 | * sensor_i2c_proxy_new_finish: |
| 8552 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 8553 | * @error: Return location for error or %NULL |
| 8554 | * |
| 8555 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 8556 | * |
| 8557 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8558 | */ |
| 8559 | SensorI2c * |
| 8560 | sensor_i2c_proxy_new_finish ( |
| 8561 | GAsyncResult *res, |
| 8562 | GError **error) |
| 8563 | { |
| 8564 | GObject *ret; |
| 8565 | GObject *source_object; |
| 8566 | source_object = g_async_result_get_source_object (res); |
| 8567 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8568 | g_object_unref (source_object); |
| 8569 | if (ret != NULL) |
| 8570 | return SENSOR_I2C (ret); |
| 8571 | else |
| 8572 | return NULL; |
| 8573 | } |
| 8574 | |
| 8575 | /** |
| 8576 | * sensor_i2c_proxy_new_sync: |
| 8577 | * @connection: A #GDBusConnection. |
| 8578 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8579 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8580 | * @object_path: An object path. |
| 8581 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8582 | * @error: Return location for error or %NULL |
| 8583 | * |
| 8584 | * 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. |
| 8585 | * |
| 8586 | * The calling thread is blocked until a reply is received. |
| 8587 | * |
| 8588 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 8589 | * |
| 8590 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8591 | */ |
| 8592 | SensorI2c * |
| 8593 | sensor_i2c_proxy_new_sync ( |
| 8594 | GDBusConnection *connection, |
| 8595 | GDBusProxyFlags flags, |
| 8596 | const gchar *name, |
| 8597 | const gchar *object_path, |
| 8598 | GCancellable *cancellable, |
| 8599 | GError **error) |
| 8600 | { |
| 8601 | GInitable *ret; |
| 8602 | 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); |
| 8603 | if (ret != NULL) |
| 8604 | return SENSOR_I2C (ret); |
| 8605 | else |
| 8606 | return NULL; |
| 8607 | } |
| 8608 | |
| 8609 | |
| 8610 | /** |
| 8611 | * sensor_i2c_proxy_new_for_bus: |
| 8612 | * @bus_type: A #GBusType. |
| 8613 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8614 | * @name: A bus name (well-known or unique). |
| 8615 | * @object_path: An object path. |
| 8616 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8617 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8618 | * @user_data: User data to pass to @callback. |
| 8619 | * |
| 8620 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 8621 | * |
| 8622 | * 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. |
| 8623 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 8624 | * |
| 8625 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 8626 | */ |
| 8627 | void |
| 8628 | sensor_i2c_proxy_new_for_bus ( |
| 8629 | GBusType bus_type, |
| 8630 | GDBusProxyFlags flags, |
| 8631 | const gchar *name, |
| 8632 | const gchar *object_path, |
| 8633 | GCancellable *cancellable, |
| 8634 | GAsyncReadyCallback callback, |
| 8635 | gpointer user_data) |
| 8636 | { |
| 8637 | 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); |
| 8638 | } |
| 8639 | |
| 8640 | /** |
| 8641 | * sensor_i2c_proxy_new_for_bus_finish: |
| 8642 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 8643 | * @error: Return location for error or %NULL |
| 8644 | * |
| 8645 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 8646 | * |
| 8647 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8648 | */ |
| 8649 | SensorI2c * |
| 8650 | sensor_i2c_proxy_new_for_bus_finish ( |
| 8651 | GAsyncResult *res, |
| 8652 | GError **error) |
| 8653 | { |
| 8654 | GObject *ret; |
| 8655 | GObject *source_object; |
| 8656 | source_object = g_async_result_get_source_object (res); |
| 8657 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8658 | g_object_unref (source_object); |
| 8659 | if (ret != NULL) |
| 8660 | return SENSOR_I2C (ret); |
| 8661 | else |
| 8662 | return NULL; |
| 8663 | } |
| 8664 | |
| 8665 | /** |
| 8666 | * sensor_i2c_proxy_new_for_bus_sync: |
| 8667 | * @bus_type: A #GBusType. |
| 8668 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8669 | * @name: A bus name (well-known or unique). |
| 8670 | * @object_path: An object path. |
| 8671 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8672 | * @error: Return location for error or %NULL |
| 8673 | * |
| 8674 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 8675 | * |
| 8676 | * The calling thread is blocked until a reply is received. |
| 8677 | * |
| 8678 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 8679 | * |
| 8680 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 8681 | */ |
| 8682 | SensorI2c * |
| 8683 | sensor_i2c_proxy_new_for_bus_sync ( |
| 8684 | GBusType bus_type, |
| 8685 | GDBusProxyFlags flags, |
| 8686 | const gchar *name, |
| 8687 | const gchar *object_path, |
| 8688 | GCancellable *cancellable, |
| 8689 | GError **error) |
| 8690 | { |
| 8691 | GInitable *ret; |
| 8692 | 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); |
| 8693 | if (ret != NULL) |
| 8694 | return SENSOR_I2C (ret); |
| 8695 | else |
| 8696 | return NULL; |
| 8697 | } |
| 8698 | |
| 8699 | |
| 8700 | /* ------------------------------------------------------------------------ */ |
| 8701 | |
| 8702 | /** |
| 8703 | * SensorI2cSkeleton: |
| 8704 | * |
| 8705 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 8706 | */ |
| 8707 | |
| 8708 | /** |
| 8709 | * SensorI2cSkeletonClass: |
| 8710 | * @parent_class: The parent class. |
| 8711 | * |
| 8712 | * Class structure for #SensorI2cSkeleton. |
| 8713 | */ |
| 8714 | |
| 8715 | struct _SensorI2cSkeletonPrivate |
| 8716 | { |
| 8717 | GValue *properties; |
| 8718 | GList *changed_properties; |
| 8719 | GSource *changed_properties_idle_source; |
| 8720 | GMainContext *context; |
| 8721 | GMutex lock; |
| 8722 | }; |
| 8723 | |
| 8724 | static void |
| 8725 | _sensor_i2c_skeleton_handle_method_call ( |
| 8726 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8727 | const gchar *sender G_GNUC_UNUSED, |
| 8728 | const gchar *object_path G_GNUC_UNUSED, |
| 8729 | const gchar *interface_name, |
| 8730 | const gchar *method_name, |
| 8731 | GVariant *parameters, |
| 8732 | GDBusMethodInvocation *invocation, |
| 8733 | gpointer user_data) |
| 8734 | { |
| 8735 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8736 | _ExtendedGDBusMethodInfo *info; |
| 8737 | GVariantIter iter; |
| 8738 | GVariant *child; |
| 8739 | GValue *paramv; |
| 8740 | guint num_params; |
| 8741 | guint num_extra; |
| 8742 | guint n; |
| 8743 | guint signal_id; |
| 8744 | GValue return_value = G_VALUE_INIT; |
| 8745 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 8746 | g_assert (info != NULL); |
| 8747 | num_params = g_variant_n_children (parameters); |
| 8748 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 8749 | n = 0; |
| 8750 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 8751 | g_value_set_object (¶mv[n++], skeleton); |
| 8752 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 8753 | g_value_set_object (¶mv[n++], invocation); |
| 8754 | if (info->pass_fdlist) |
| 8755 | { |
| 8756 | #ifdef G_OS_UNIX |
| 8757 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 8758 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 8759 | #else |
| 8760 | g_assert_not_reached (); |
| 8761 | #endif |
| 8762 | } |
| 8763 | g_variant_iter_init (&iter, parameters); |
| 8764 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8765 | { |
| 8766 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 8767 | if (arg_info->use_gvariant) |
| 8768 | { |
| 8769 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8770 | g_value_set_variant (¶mv[n], child); |
| 8771 | n++; |
| 8772 | } |
| 8773 | else |
| 8774 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8775 | g_variant_unref (child); |
| 8776 | } |
| 8777 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 8778 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 8779 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 8780 | if (!g_value_get_boolean (&return_value)) |
| 8781 | 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); |
| 8782 | g_value_unset (&return_value); |
| 8783 | for (n = 0; n < num_params + num_extra; n++) |
| 8784 | g_value_unset (¶mv[n]); |
| 8785 | g_free (paramv); |
| 8786 | } |
| 8787 | |
| 8788 | static GVariant * |
| 8789 | _sensor_i2c_skeleton_handle_get_property ( |
| 8790 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8791 | const gchar *sender G_GNUC_UNUSED, |
| 8792 | const gchar *object_path G_GNUC_UNUSED, |
| 8793 | const gchar *interface_name G_GNUC_UNUSED, |
| 8794 | const gchar *property_name, |
| 8795 | GError **error, |
| 8796 | gpointer user_data) |
| 8797 | { |
| 8798 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8799 | GValue value = G_VALUE_INIT; |
| 8800 | GParamSpec *pspec; |
| 8801 | _ExtendedGDBusPropertyInfo *info; |
| 8802 | GVariant *ret; |
| 8803 | ret = NULL; |
| 8804 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 8805 | g_assert (info != NULL); |
| 8806 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8807 | if (pspec == NULL) |
| 8808 | { |
| 8809 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8810 | } |
| 8811 | else |
| 8812 | { |
| 8813 | g_value_init (&value, pspec->value_type); |
| 8814 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8815 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8816 | g_value_unset (&value); |
| 8817 | } |
| 8818 | return ret; |
| 8819 | } |
| 8820 | |
| 8821 | static gboolean |
| 8822 | _sensor_i2c_skeleton_handle_set_property ( |
| 8823 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8824 | const gchar *sender G_GNUC_UNUSED, |
| 8825 | const gchar *object_path G_GNUC_UNUSED, |
| 8826 | const gchar *interface_name G_GNUC_UNUSED, |
| 8827 | const gchar *property_name, |
| 8828 | GVariant *variant, |
| 8829 | GError **error, |
| 8830 | gpointer user_data) |
| 8831 | { |
| 8832 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8833 | GValue value = G_VALUE_INIT; |
| 8834 | GParamSpec *pspec; |
| 8835 | _ExtendedGDBusPropertyInfo *info; |
| 8836 | gboolean ret; |
| 8837 | ret = FALSE; |
| 8838 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 8839 | g_assert (info != NULL); |
| 8840 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8841 | if (pspec == NULL) |
| 8842 | { |
| 8843 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8844 | } |
| 8845 | else |
| 8846 | { |
| 8847 | if (info->use_gvariant) |
| 8848 | g_value_set_variant (&value, variant); |
| 8849 | else |
| 8850 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 8851 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8852 | g_value_unset (&value); |
| 8853 | ret = TRUE; |
| 8854 | } |
| 8855 | return ret; |
| 8856 | } |
| 8857 | |
| 8858 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 8859 | { |
| 8860 | _sensor_i2c_skeleton_handle_method_call, |
| 8861 | _sensor_i2c_skeleton_handle_get_property, |
| 8862 | _sensor_i2c_skeleton_handle_set_property, |
| 8863 | {NULL} |
| 8864 | }; |
| 8865 | |
| 8866 | static GDBusInterfaceInfo * |
| 8867 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8868 | { |
| 8869 | return sensor_i2c_interface_info (); |
| 8870 | } |
| 8871 | |
| 8872 | static GDBusInterfaceVTable * |
| 8873 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8874 | { |
| 8875 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 8876 | } |
| 8877 | |
| 8878 | static GVariant * |
| 8879 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 8880 | { |
| 8881 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 8882 | |
| 8883 | GVariantBuilder builder; |
| 8884 | guint n; |
| 8885 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8886 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 8887 | goto out; |
| 8888 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 8889 | { |
| 8890 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 8891 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 8892 | { |
| 8893 | GVariant *value; |
| 8894 | 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); |
| 8895 | if (value != NULL) |
| 8896 | { |
| 8897 | g_variant_take_ref (value); |
| 8898 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 8899 | g_variant_unref (value); |
| 8900 | } |
| 8901 | } |
| 8902 | } |
| 8903 | out: |
| 8904 | return g_variant_builder_end (&builder); |
| 8905 | } |
| 8906 | |
| 8907 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 8908 | |
| 8909 | static void |
| 8910 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 8911 | { |
| 8912 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 8913 | gboolean emit_changed = FALSE; |
| 8914 | |
| 8915 | g_mutex_lock (&skeleton->priv->lock); |
| 8916 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8917 | { |
| 8918 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8919 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8920 | emit_changed = TRUE; |
| 8921 | } |
| 8922 | g_mutex_unlock (&skeleton->priv->lock); |
| 8923 | |
| 8924 | if (emit_changed) |
| 8925 | _sensor_i2c_emit_changed (skeleton); |
| 8926 | } |
| 8927 | |
| 8928 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 8929 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8930 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8931 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 8932 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 8933 | |
| 8934 | #else |
| 8935 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8936 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 8937 | |
| 8938 | #endif |
| 8939 | static void |
| 8940 | sensor_i2c_skeleton_finalize (GObject *object) |
| 8941 | { |
| 8942 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8943 | guint n; |
| 8944 | for (n = 0; n < 2; n++) |
| 8945 | g_value_unset (&skeleton->priv->properties[n]); |
| 8946 | g_free (skeleton->priv->properties); |
| 8947 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8948 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8949 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8950 | g_main_context_unref (skeleton->priv->context); |
| 8951 | g_mutex_clear (&skeleton->priv->lock); |
| 8952 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 8953 | } |
| 8954 | |
| 8955 | static void |
| 8956 | sensor_i2c_skeleton_get_property (GObject *object, |
| 8957 | guint prop_id, |
| 8958 | GValue *value, |
| 8959 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8960 | { |
| 8961 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 8962 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8963 | g_mutex_lock (&skeleton->priv->lock); |
| 8964 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 8965 | g_mutex_unlock (&skeleton->priv->lock); |
| 8966 | } |
| 8967 | |
| 8968 | static gboolean |
| 8969 | _sensor_i2c_emit_changed (gpointer user_data) |
| 8970 | { |
| 8971 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 8972 | GList *l; |
| 8973 | GVariantBuilder builder; |
| 8974 | GVariantBuilder invalidated_builder; |
| 8975 | guint num_changes; |
| 8976 | |
| 8977 | g_mutex_lock (&skeleton->priv->lock); |
| 8978 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8979 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 8980 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 8981 | { |
| 8982 | ChangedProperty *cp = l->data; |
| 8983 | GVariant *variant; |
| 8984 | const GValue *cur_value; |
| 8985 | |
| 8986 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 8987 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 8988 | { |
| 8989 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 8990 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 8991 | g_variant_unref (variant); |
| 8992 | num_changes++; |
| 8993 | } |
| 8994 | } |
| 8995 | if (num_changes > 0) |
| 8996 | { |
| 8997 | GList *connections, *ll; |
| 8998 | GVariant *signal_variant; |
| 8999 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 9000 | &builder, &invalidated_builder)); |
| 9001 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 9002 | for (ll = connections; ll != NULL; ll = ll->next) |
| 9003 | { |
| 9004 | GDBusConnection *connection = ll->data; |
| 9005 | |
| 9006 | g_dbus_connection_emit_signal (connection, |
| 9007 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 9008 | "org.freedesktop.DBus.Properties", |
| 9009 | "PropertiesChanged", |
| 9010 | signal_variant, |
| 9011 | NULL); |
| 9012 | } |
| 9013 | g_variant_unref (signal_variant); |
| 9014 | g_list_free_full (connections, g_object_unref); |
| 9015 | } |
| 9016 | else |
| 9017 | { |
| 9018 | g_variant_builder_clear (&builder); |
| 9019 | g_variant_builder_clear (&invalidated_builder); |
| 9020 | } |
| 9021 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9022 | skeleton->priv->changed_properties = NULL; |
| 9023 | skeleton->priv->changed_properties_idle_source = NULL; |
| 9024 | g_mutex_unlock (&skeleton->priv->lock); |
| 9025 | return FALSE; |
| 9026 | } |
| 9027 | |
| 9028 | static void |
| 9029 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 9030 | { |
| 9031 | ChangedProperty *cp; |
| 9032 | GList *l; |
| 9033 | cp = NULL; |
| 9034 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 9035 | { |
| 9036 | ChangedProperty *i_cp = l->data; |
| 9037 | if (i_cp->info == info) |
| 9038 | { |
| 9039 | cp = i_cp; |
| 9040 | break; |
| 9041 | } |
| 9042 | } |
| 9043 | if (cp == NULL) |
| 9044 | { |
| 9045 | cp = g_new0 (ChangedProperty, 1); |
| 9046 | cp->prop_id = prop_id; |
| 9047 | cp->info = info; |
| 9048 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 9049 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 9050 | g_value_copy (orig_value, &cp->orig_value); |
| 9051 | } |
| 9052 | } |
| 9053 | |
| 9054 | static void |
| 9055 | sensor_i2c_skeleton_notify (GObject *object, |
| 9056 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9057 | { |
| 9058 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 9059 | g_mutex_lock (&skeleton->priv->lock); |
| 9060 | if (skeleton->priv->changed_properties != NULL && |
| 9061 | skeleton->priv->changed_properties_idle_source == NULL) |
| 9062 | { |
| 9063 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 9064 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 9065 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 9066 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 9067 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 9068 | } |
| 9069 | g_mutex_unlock (&skeleton->priv->lock); |
| 9070 | } |
| 9071 | |
| 9072 | static void |
| 9073 | sensor_i2c_skeleton_set_property (GObject *object, |
| 9074 | guint prop_id, |
| 9075 | const GValue *value, |
| 9076 | GParamSpec *pspec) |
| 9077 | { |
| 9078 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 9079 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9080 | g_mutex_lock (&skeleton->priv->lock); |
| 9081 | g_object_freeze_notify (object); |
| 9082 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 9083 | { |
| 9084 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 9085 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 9086 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 9087 | g_object_notify_by_pspec (object, pspec); |
| 9088 | } |
| 9089 | g_mutex_unlock (&skeleton->priv->lock); |
| 9090 | g_object_thaw_notify (object); |
| 9091 | } |
| 9092 | |
| 9093 | static void |
| 9094 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 9095 | { |
| 9096 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9097 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 9098 | #else |
| 9099 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 9100 | #endif |
| 9101 | |
| 9102 | g_mutex_init (&skeleton->priv->lock); |
| 9103 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 9104 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 9105 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 9106 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 9107 | } |
| 9108 | |
| 9109 | static const gchar * |
| 9110 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 9111 | { |
| 9112 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 9113 | const gchar *value; |
| 9114 | g_mutex_lock (&skeleton->priv->lock); |
| 9115 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 9116 | g_mutex_unlock (&skeleton->priv->lock); |
| 9117 | return value; |
| 9118 | } |
| 9119 | |
| 9120 | static const gchar * |
| 9121 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 9122 | { |
| 9123 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 9124 | const gchar *value; |
| 9125 | g_mutex_lock (&skeleton->priv->lock); |
| 9126 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 9127 | g_mutex_unlock (&skeleton->priv->lock); |
| 9128 | return value; |
| 9129 | } |
| 9130 | |
| 9131 | static void |
| 9132 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 9133 | { |
| 9134 | GObjectClass *gobject_class; |
| 9135 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 9136 | |
| 9137 | gobject_class = G_OBJECT_CLASS (klass); |
| 9138 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 9139 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 9140 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 9141 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 9142 | |
| 9143 | |
| 9144 | sensor_i2c_override_properties (gobject_class, 1); |
| 9145 | |
| 9146 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 9147 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 9148 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 9149 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 9150 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 9151 | |
| 9152 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9153 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 9154 | #endif |
| 9155 | } |
| 9156 | |
| 9157 | static void |
| 9158 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 9159 | { |
| 9160 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 9161 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 9162 | } |
| 9163 | |
| 9164 | /** |
| 9165 | * sensor_i2c_skeleton_new: |
| 9166 | * |
| 9167 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 9168 | * |
| 9169 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 9170 | */ |
| 9171 | SensorI2c * |
| 9172 | sensor_i2c_skeleton_new (void) |
| 9173 | { |
| 9174 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 9175 | } |
| 9176 | |
| 9177 | /* ------------------------------------------------------------------------ |
| 9178 | * Code for interface org.openbmc.SensorMatch |
| 9179 | * ------------------------------------------------------------------------ |
| 9180 | */ |
| 9181 | |
| 9182 | /** |
| 9183 | * SECTION:SensorMatch |
| 9184 | * @title: SensorMatch |
| 9185 | * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface |
| 9186 | * |
| 9187 | * 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. |
| 9188 | */ |
| 9189 | |
| 9190 | /* ---- Introspection data for org.openbmc.SensorMatch ---- */ |
| 9191 | |
| 9192 | static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = |
| 9193 | { |
| 9194 | { |
| 9195 | -1, |
| 9196 | (gchar *) "state", |
| 9197 | (gchar *) "y", |
| 9198 | NULL |
| 9199 | }, |
| 9200 | FALSE |
| 9201 | }; |
| 9202 | |
| 9203 | static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = |
| 9204 | { |
| 9205 | &_sensor_match_signal_info_sensor_match_ARG_state, |
| 9206 | NULL |
| 9207 | }; |
| 9208 | |
| 9209 | static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = |
| 9210 | { |
| 9211 | { |
| 9212 | -1, |
| 9213 | (gchar *) "SensorMatch", |
| 9214 | (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, |
| 9215 | NULL |
| 9216 | }, |
| 9217 | "sensor-match" |
| 9218 | }; |
| 9219 | |
| 9220 | static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = |
| 9221 | { |
| 9222 | &_sensor_match_signal_info_sensor_match, |
| 9223 | NULL |
| 9224 | }; |
| 9225 | |
| 9226 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = |
| 9227 | { |
| 9228 | { |
| 9229 | -1, |
| 9230 | (gchar *) "match_value", |
| 9231 | (gchar *) "v", |
| 9232 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 9233 | NULL |
| 9234 | }, |
| 9235 | "match-value", |
| 9236 | FALSE |
| 9237 | }; |
| 9238 | |
| 9239 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = |
| 9240 | { |
| 9241 | { |
| 9242 | -1, |
| 9243 | (gchar *) "state", |
| 9244 | (gchar *) "y", |
| 9245 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 9246 | NULL |
| 9247 | }, |
| 9248 | "state", |
| 9249 | FALSE |
| 9250 | }; |
| 9251 | |
| 9252 | static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = |
| 9253 | { |
| 9254 | &_sensor_match_property_info_match_value, |
| 9255 | &_sensor_match_property_info_state, |
| 9256 | NULL |
| 9257 | }; |
| 9258 | |
| 9259 | static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = |
| 9260 | { |
| 9261 | { |
| 9262 | -1, |
| 9263 | (gchar *) "org.openbmc.SensorMatch", |
| 9264 | NULL, |
| 9265 | (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, |
| 9266 | (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, |
| 9267 | NULL |
| 9268 | }, |
| 9269 | "sensor-match", |
| 9270 | }; |
| 9271 | |
| 9272 | |
| 9273 | /** |
| 9274 | * sensor_match_interface_info: |
| 9275 | * |
| 9276 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. |
| 9277 | * |
| 9278 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 9279 | */ |
| 9280 | GDBusInterfaceInfo * |
| 9281 | sensor_match_interface_info (void) |
| 9282 | { |
| 9283 | return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; |
| 9284 | } |
| 9285 | |
| 9286 | /** |
| 9287 | * sensor_match_override_properties: |
| 9288 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 9289 | * @property_id_begin: The property id to assign to the first overridden property. |
| 9290 | * |
| 9291 | * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. |
| 9292 | * The properties are overridden in the order they are defined. |
| 9293 | * |
| 9294 | * Returns: The last property id. |
| 9295 | */ |
| 9296 | guint |
| 9297 | sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) |
| 9298 | { |
| 9299 | g_object_class_override_property (klass, property_id_begin++, "match-value"); |
| 9300 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 9301 | return property_id_begin - 1; |
| 9302 | } |
| 9303 | |
| 9304 | |
| 9305 | |
| 9306 | /** |
| 9307 | * SensorMatch: |
| 9308 | * |
| 9309 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 9310 | */ |
| 9311 | |
| 9312 | /** |
| 9313 | * SensorMatchIface: |
| 9314 | * @parent_iface: The parent interface. |
| 9315 | * @get_match_value: Getter for the #SensorMatch:match-value property. |
| 9316 | * @get_state: Getter for the #SensorMatch:state property. |
| 9317 | * @sensor_match: Handler for the #SensorMatch::sensor-match signal. |
| 9318 | * |
| 9319 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 9320 | */ |
| 9321 | |
| 9322 | typedef SensorMatchIface SensorMatchInterface; |
| 9323 | G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); |
| 9324 | |
| 9325 | static void |
| 9326 | sensor_match_default_init (SensorMatchIface *iface) |
| 9327 | { |
| 9328 | /* GObject signals for received D-Bus signals: */ |
| 9329 | /** |
| 9330 | * SensorMatch::sensor-match: |
| 9331 | * @object: A #SensorMatch. |
| 9332 | * @arg_state: Argument. |
| 9333 | * |
| 9334 | * 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. |
| 9335 | * |
| 9336 | * 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. |
| 9337 | */ |
| 9338 | g_signal_new ("sensor-match", |
| 9339 | G_TYPE_FROM_INTERFACE (iface), |
| 9340 | G_SIGNAL_RUN_LAST, |
| 9341 | G_STRUCT_OFFSET (SensorMatchIface, sensor_match), |
| 9342 | NULL, |
| 9343 | NULL, |
| 9344 | g_cclosure_marshal_generic, |
| 9345 | G_TYPE_NONE, |
| 9346 | 1, G_TYPE_UCHAR); |
| 9347 | |
| 9348 | /* GObject properties for D-Bus properties: */ |
| 9349 | /** |
| 9350 | * SensorMatch:match-value: |
| 9351 | * |
| 9352 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. |
| 9353 | * |
| 9354 | * 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. |
| 9355 | */ |
| 9356 | g_object_interface_install_property (iface, |
| 9357 | g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 9358 | /** |
| 9359 | * SensorMatch:state: |
| 9360 | * |
| 9361 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. |
| 9362 | * |
| 9363 | * 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. |
| 9364 | */ |
| 9365 | g_object_interface_install_property (iface, |
| 9366 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 9367 | } |
| 9368 | |
| 9369 | /** |
| 9370 | * sensor_match_get_match_value: (skip) |
| 9371 | * @object: A #SensorMatch. |
| 9372 | * |
| 9373 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 9374 | * |
| 9375 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9376 | * |
| 9377 | * <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> |
| 9378 | * |
| 9379 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 9380 | */ |
| 9381 | GVariant * |
| 9382 | sensor_match_get_match_value (SensorMatch *object) |
| 9383 | { |
| 9384 | return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); |
| 9385 | } |
| 9386 | |
| 9387 | /** |
| 9388 | * sensor_match_dup_match_value: (skip) |
| 9389 | * @object: A #SensorMatch. |
| 9390 | * |
| 9391 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 9392 | * |
| 9393 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9394 | * |
| 9395 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 9396 | */ |
| 9397 | GVariant * |
| 9398 | sensor_match_dup_match_value (SensorMatch *object) |
| 9399 | { |
| 9400 | GVariant *value; |
| 9401 | g_object_get (G_OBJECT (object), "match-value", &value, NULL); |
| 9402 | return value; |
| 9403 | } |
| 9404 | |
| 9405 | /** |
| 9406 | * sensor_match_set_match_value: (skip) |
| 9407 | * @object: A #SensorMatch. |
| 9408 | * @value: The value to set. |
| 9409 | * |
| 9410 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. |
| 9411 | * |
| 9412 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 9413 | */ |
| 9414 | void |
| 9415 | sensor_match_set_match_value (SensorMatch *object, GVariant *value) |
| 9416 | { |
| 9417 | g_object_set (G_OBJECT (object), "match-value", value, NULL); |
| 9418 | } |
| 9419 | |
| 9420 | /** |
| 9421 | * sensor_match_get_state: (skip) |
| 9422 | * @object: A #SensorMatch. |
| 9423 | * |
| 9424 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. |
| 9425 | * |
| 9426 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 9427 | * |
| 9428 | * Returns: The property value. |
| 9429 | */ |
| 9430 | guchar |
| 9431 | sensor_match_get_state (SensorMatch *object) |
| 9432 | { |
| 9433 | return SENSOR_MATCH_GET_IFACE (object)->get_state (object); |
| 9434 | } |
| 9435 | |
| 9436 | /** |
| 9437 | * sensor_match_set_state: (skip) |
| 9438 | * @object: A #SensorMatch. |
| 9439 | * @value: The value to set. |
| 9440 | * |
| 9441 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. |
| 9442 | * |
| 9443 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 9444 | */ |
| 9445 | void |
| 9446 | sensor_match_set_state (SensorMatch *object, guchar value) |
| 9447 | { |
| 9448 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 9449 | } |
| 9450 | |
| 9451 | /** |
| 9452 | * sensor_match_emit_sensor_match: |
| 9453 | * @object: A #SensorMatch. |
| 9454 | * @arg_state: Argument to pass with the signal. |
| 9455 | * |
| 9456 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. |
| 9457 | */ |
| 9458 | void |
| 9459 | sensor_match_emit_sensor_match ( |
| 9460 | SensorMatch *object, |
| 9461 | guchar arg_state) |
| 9462 | { |
| 9463 | g_signal_emit_by_name (object, "sensor-match", arg_state); |
| 9464 | } |
| 9465 | |
| 9466 | /* ------------------------------------------------------------------------ */ |
| 9467 | |
| 9468 | /** |
| 9469 | * SensorMatchProxy: |
| 9470 | * |
| 9471 | * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. |
| 9472 | */ |
| 9473 | |
| 9474 | /** |
| 9475 | * SensorMatchProxyClass: |
| 9476 | * @parent_class: The parent class. |
| 9477 | * |
| 9478 | * Class structure for #SensorMatchProxy. |
| 9479 | */ |
| 9480 | |
| 9481 | struct _SensorMatchProxyPrivate |
| 9482 | { |
| 9483 | GData *qdata; |
| 9484 | }; |
| 9485 | |
| 9486 | static void sensor_match_proxy_iface_init (SensorMatchIface *iface); |
| 9487 | |
| 9488 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9489 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 9490 | G_ADD_PRIVATE (SensorMatchProxy) |
| 9491 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 9492 | |
| 9493 | #else |
| 9494 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 9495 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 9496 | |
| 9497 | #endif |
| 9498 | static void |
| 9499 | sensor_match_proxy_finalize (GObject *object) |
| 9500 | { |
| 9501 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9502 | g_datalist_clear (&proxy->priv->qdata); |
| 9503 | G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); |
| 9504 | } |
| 9505 | |
| 9506 | static void |
| 9507 | sensor_match_proxy_get_property (GObject *object, |
| 9508 | guint prop_id, |
| 9509 | GValue *value, |
| 9510 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9511 | { |
| 9512 | const _ExtendedGDBusPropertyInfo *info; |
| 9513 | GVariant *variant; |
| 9514 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9515 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 9516 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 9517 | if (info->use_gvariant) |
| 9518 | { |
| 9519 | g_value_set_variant (value, variant); |
| 9520 | } |
| 9521 | else |
| 9522 | { |
| 9523 | if (variant != NULL) |
| 9524 | g_dbus_gvariant_to_gvalue (variant, value); |
| 9525 | } |
| 9526 | if (variant != NULL) |
| 9527 | g_variant_unref (variant); |
| 9528 | } |
| 9529 | |
| 9530 | static void |
| 9531 | sensor_match_proxy_set_property_cb (GDBusProxy *proxy, |
| 9532 | GAsyncResult *res, |
| 9533 | gpointer user_data) |
| 9534 | { |
| 9535 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 9536 | GError *error; |
| 9537 | GVariant *_ret; |
| 9538 | error = NULL; |
| 9539 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 9540 | if (!_ret) |
| 9541 | { |
| 9542 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", |
| 9543 | info->parent_struct.name, |
| 9544 | error->message, g_quark_to_string (error->domain), error->code); |
| 9545 | g_error_free (error); |
| 9546 | } |
| 9547 | else |
| 9548 | { |
| 9549 | g_variant_unref (_ret); |
| 9550 | } |
| 9551 | } |
| 9552 | |
| 9553 | static void |
| 9554 | sensor_match_proxy_set_property (GObject *object, |
| 9555 | guint prop_id, |
| 9556 | const GValue *value, |
| 9557 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9558 | { |
| 9559 | const _ExtendedGDBusPropertyInfo *info; |
| 9560 | GVariant *variant; |
| 9561 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9562 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 9563 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 9564 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 9565 | "org.freedesktop.DBus.Properties.Set", |
| 9566 | g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), |
| 9567 | G_DBUS_CALL_FLAGS_NONE, |
| 9568 | -1, |
| 9569 | NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 9570 | g_variant_unref (variant); |
| 9571 | } |
| 9572 | |
| 9573 | static void |
| 9574 | sensor_match_proxy_g_signal (GDBusProxy *proxy, |
| 9575 | const gchar *sender_name G_GNUC_UNUSED, |
| 9576 | const gchar *signal_name, |
| 9577 | GVariant *parameters) |
| 9578 | { |
| 9579 | _ExtendedGDBusSignalInfo *info; |
| 9580 | GVariantIter iter; |
| 9581 | GVariant *child; |
| 9582 | GValue *paramv; |
| 9583 | guint num_params; |
| 9584 | guint n; |
| 9585 | guint signal_id; |
| 9586 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); |
| 9587 | if (info == NULL) |
| 9588 | return; |
| 9589 | num_params = g_variant_n_children (parameters); |
| 9590 | paramv = g_new0 (GValue, num_params + 1); |
| 9591 | g_value_init (¶mv[0], TYPE_SENSOR_MATCH); |
| 9592 | g_value_set_object (¶mv[0], proxy); |
| 9593 | g_variant_iter_init (&iter, parameters); |
| 9594 | n = 1; |
| 9595 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9596 | { |
| 9597 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 9598 | if (arg_info->use_gvariant) |
| 9599 | { |
| 9600 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9601 | g_value_set_variant (¶mv[n], child); |
| 9602 | n++; |
| 9603 | } |
| 9604 | else |
| 9605 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9606 | g_variant_unref (child); |
| 9607 | } |
| 9608 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 9609 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 9610 | for (n = 0; n < num_params + 1; n++) |
| 9611 | g_value_unset (¶mv[n]); |
| 9612 | g_free (paramv); |
| 9613 | } |
| 9614 | |
| 9615 | static void |
| 9616 | sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 9617 | GVariant *changed_properties, |
| 9618 | const gchar *const *invalidated_properties) |
| 9619 | { |
| 9620 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); |
| 9621 | guint n; |
| 9622 | const gchar *key; |
| 9623 | GVariantIter *iter; |
| 9624 | _ExtendedGDBusPropertyInfo *info; |
| 9625 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 9626 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 9627 | { |
| 9628 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); |
| 9629 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 9630 | if (info != NULL) |
| 9631 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9632 | } |
| 9633 | g_variant_iter_free (iter); |
| 9634 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 9635 | { |
| 9636 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); |
| 9637 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 9638 | if (info != NULL) |
| 9639 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9640 | } |
| 9641 | } |
| 9642 | |
| 9643 | static GVariant * |
| 9644 | sensor_match_proxy_get_match_value (SensorMatch *object) |
| 9645 | { |
| 9646 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9647 | GVariant *variant; |
| 9648 | GVariant *value = NULL; |
| 9649 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); |
| 9650 | value = variant; |
| 9651 | if (variant != NULL) |
| 9652 | g_variant_unref (variant); |
| 9653 | return value; |
| 9654 | } |
| 9655 | |
| 9656 | static guchar |
| 9657 | sensor_match_proxy_get_state (SensorMatch *object) |
| 9658 | { |
| 9659 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 9660 | GVariant *variant; |
| 9661 | guchar value = 0; |
| 9662 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 9663 | if (variant != NULL) |
| 9664 | { |
| 9665 | value = g_variant_get_byte (variant); |
| 9666 | g_variant_unref (variant); |
| 9667 | } |
| 9668 | return value; |
| 9669 | } |
| 9670 | |
| 9671 | static void |
| 9672 | sensor_match_proxy_init (SensorMatchProxy *proxy) |
| 9673 | { |
| 9674 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9675 | proxy->priv = sensor_match_proxy_get_instance_private (proxy); |
| 9676 | #else |
| 9677 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); |
| 9678 | #endif |
| 9679 | |
| 9680 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); |
| 9681 | } |
| 9682 | |
| 9683 | static void |
| 9684 | sensor_match_proxy_class_init (SensorMatchProxyClass *klass) |
| 9685 | { |
| 9686 | GObjectClass *gobject_class; |
| 9687 | GDBusProxyClass *proxy_class; |
| 9688 | |
| 9689 | gobject_class = G_OBJECT_CLASS (klass); |
| 9690 | gobject_class->finalize = sensor_match_proxy_finalize; |
| 9691 | gobject_class->get_property = sensor_match_proxy_get_property; |
| 9692 | gobject_class->set_property = sensor_match_proxy_set_property; |
| 9693 | |
| 9694 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 9695 | proxy_class->g_signal = sensor_match_proxy_g_signal; |
| 9696 | proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; |
| 9697 | |
| 9698 | sensor_match_override_properties (gobject_class, 1); |
| 9699 | |
| 9700 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9701 | g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); |
| 9702 | #endif |
| 9703 | } |
| 9704 | |
| 9705 | static void |
| 9706 | sensor_match_proxy_iface_init (SensorMatchIface *iface) |
| 9707 | { |
| 9708 | iface->get_match_value = sensor_match_proxy_get_match_value; |
| 9709 | iface->get_state = sensor_match_proxy_get_state; |
| 9710 | } |
| 9711 | |
| 9712 | /** |
| 9713 | * sensor_match_proxy_new: |
| 9714 | * @connection: A #GDBusConnection. |
| 9715 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9716 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9717 | * @object_path: An object path. |
| 9718 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9719 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9720 | * @user_data: User data to pass to @callback. |
| 9721 | * |
| 9722 | * 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. |
| 9723 | * |
| 9724 | * 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. |
| 9725 | * You can then call sensor_match_proxy_new_finish() to get the result of the operation. |
| 9726 | * |
| 9727 | * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 9728 | */ |
| 9729 | void |
| 9730 | sensor_match_proxy_new ( |
| 9731 | GDBusConnection *connection, |
| 9732 | GDBusProxyFlags flags, |
| 9733 | const gchar *name, |
| 9734 | const gchar *object_path, |
| 9735 | GCancellable *cancellable, |
| 9736 | GAsyncReadyCallback callback, |
| 9737 | gpointer user_data) |
| 9738 | { |
| 9739 | 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); |
| 9740 | } |
| 9741 | |
| 9742 | /** |
| 9743 | * sensor_match_proxy_new_finish: |
| 9744 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). |
| 9745 | * @error: Return location for error or %NULL |
| 9746 | * |
| 9747 | * Finishes an operation started with sensor_match_proxy_new(). |
| 9748 | * |
| 9749 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9750 | */ |
| 9751 | SensorMatch * |
| 9752 | sensor_match_proxy_new_finish ( |
| 9753 | GAsyncResult *res, |
| 9754 | GError **error) |
| 9755 | { |
| 9756 | GObject *ret; |
| 9757 | GObject *source_object; |
| 9758 | source_object = g_async_result_get_source_object (res); |
| 9759 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9760 | g_object_unref (source_object); |
| 9761 | if (ret != NULL) |
| 9762 | return SENSOR_MATCH (ret); |
| 9763 | else |
| 9764 | return NULL; |
| 9765 | } |
| 9766 | |
| 9767 | /** |
| 9768 | * sensor_match_proxy_new_sync: |
| 9769 | * @connection: A #GDBusConnection. |
| 9770 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9771 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9772 | * @object_path: An object path. |
| 9773 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9774 | * @error: Return location for error or %NULL |
| 9775 | * |
| 9776 | * 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. |
| 9777 | * |
| 9778 | * The calling thread is blocked until a reply is received. |
| 9779 | * |
| 9780 | * See sensor_match_proxy_new() for the asynchronous version of this constructor. |
| 9781 | * |
| 9782 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9783 | */ |
| 9784 | SensorMatch * |
| 9785 | sensor_match_proxy_new_sync ( |
| 9786 | GDBusConnection *connection, |
| 9787 | GDBusProxyFlags flags, |
| 9788 | const gchar *name, |
| 9789 | const gchar *object_path, |
| 9790 | GCancellable *cancellable, |
| 9791 | GError **error) |
| 9792 | { |
| 9793 | GInitable *ret; |
| 9794 | 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); |
| 9795 | if (ret != NULL) |
| 9796 | return SENSOR_MATCH (ret); |
| 9797 | else |
| 9798 | return NULL; |
| 9799 | } |
| 9800 | |
| 9801 | |
| 9802 | /** |
| 9803 | * sensor_match_proxy_new_for_bus: |
| 9804 | * @bus_type: A #GBusType. |
| 9805 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9806 | * @name: A bus name (well-known or unique). |
| 9807 | * @object_path: An object path. |
| 9808 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9809 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9810 | * @user_data: User data to pass to @callback. |
| 9811 | * |
| 9812 | * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 9813 | * |
| 9814 | * 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. |
| 9815 | * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. |
| 9816 | * |
| 9817 | * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 9818 | */ |
| 9819 | void |
| 9820 | sensor_match_proxy_new_for_bus ( |
| 9821 | GBusType bus_type, |
| 9822 | GDBusProxyFlags flags, |
| 9823 | const gchar *name, |
| 9824 | const gchar *object_path, |
| 9825 | GCancellable *cancellable, |
| 9826 | GAsyncReadyCallback callback, |
| 9827 | gpointer user_data) |
| 9828 | { |
| 9829 | 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); |
| 9830 | } |
| 9831 | |
| 9832 | /** |
| 9833 | * sensor_match_proxy_new_for_bus_finish: |
| 9834 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). |
| 9835 | * @error: Return location for error or %NULL |
| 9836 | * |
| 9837 | * Finishes an operation started with sensor_match_proxy_new_for_bus(). |
| 9838 | * |
| 9839 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9840 | */ |
| 9841 | SensorMatch * |
| 9842 | sensor_match_proxy_new_for_bus_finish ( |
| 9843 | GAsyncResult *res, |
| 9844 | GError **error) |
| 9845 | { |
| 9846 | GObject *ret; |
| 9847 | GObject *source_object; |
| 9848 | source_object = g_async_result_get_source_object (res); |
| 9849 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9850 | g_object_unref (source_object); |
| 9851 | if (ret != NULL) |
| 9852 | return SENSOR_MATCH (ret); |
| 9853 | else |
| 9854 | return NULL; |
| 9855 | } |
| 9856 | |
| 9857 | /** |
| 9858 | * sensor_match_proxy_new_for_bus_sync: |
| 9859 | * @bus_type: A #GBusType. |
| 9860 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9861 | * @name: A bus name (well-known or unique). |
| 9862 | * @object_path: An object path. |
| 9863 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9864 | * @error: Return location for error or %NULL |
| 9865 | * |
| 9866 | * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 9867 | * |
| 9868 | * The calling thread is blocked until a reply is received. |
| 9869 | * |
| 9870 | * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 9871 | * |
| 9872 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 9873 | */ |
| 9874 | SensorMatch * |
| 9875 | sensor_match_proxy_new_for_bus_sync ( |
| 9876 | GBusType bus_type, |
| 9877 | GDBusProxyFlags flags, |
| 9878 | const gchar *name, |
| 9879 | const gchar *object_path, |
| 9880 | GCancellable *cancellable, |
| 9881 | GError **error) |
| 9882 | { |
| 9883 | GInitable *ret; |
| 9884 | 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); |
| 9885 | if (ret != NULL) |
| 9886 | return SENSOR_MATCH (ret); |
| 9887 | else |
| 9888 | return NULL; |
| 9889 | } |
| 9890 | |
| 9891 | |
| 9892 | /* ------------------------------------------------------------------------ */ |
| 9893 | |
| 9894 | /** |
| 9895 | * SensorMatchSkeleton: |
| 9896 | * |
| 9897 | * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. |
| 9898 | */ |
| 9899 | |
| 9900 | /** |
| 9901 | * SensorMatchSkeletonClass: |
| 9902 | * @parent_class: The parent class. |
| 9903 | * |
| 9904 | * Class structure for #SensorMatchSkeleton. |
| 9905 | */ |
| 9906 | |
| 9907 | struct _SensorMatchSkeletonPrivate |
| 9908 | { |
| 9909 | GValue *properties; |
| 9910 | GList *changed_properties; |
| 9911 | GSource *changed_properties_idle_source; |
| 9912 | GMainContext *context; |
| 9913 | GMutex lock; |
| 9914 | }; |
| 9915 | |
| 9916 | static void |
| 9917 | _sensor_match_skeleton_handle_method_call ( |
| 9918 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9919 | const gchar *sender G_GNUC_UNUSED, |
| 9920 | const gchar *object_path G_GNUC_UNUSED, |
| 9921 | const gchar *interface_name, |
| 9922 | const gchar *method_name, |
| 9923 | GVariant *parameters, |
| 9924 | GDBusMethodInvocation *invocation, |
| 9925 | gpointer user_data) |
| 9926 | { |
| 9927 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9928 | _ExtendedGDBusMethodInfo *info; |
| 9929 | GVariantIter iter; |
| 9930 | GVariant *child; |
| 9931 | GValue *paramv; |
| 9932 | guint num_params; |
| 9933 | guint num_extra; |
| 9934 | guint n; |
| 9935 | guint signal_id; |
| 9936 | GValue return_value = G_VALUE_INIT; |
| 9937 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 9938 | g_assert (info != NULL); |
| 9939 | num_params = g_variant_n_children (parameters); |
| 9940 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 9941 | n = 0; |
| 9942 | g_value_init (¶mv[n], TYPE_SENSOR_MATCH); |
| 9943 | g_value_set_object (¶mv[n++], skeleton); |
| 9944 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 9945 | g_value_set_object (¶mv[n++], invocation); |
| 9946 | if (info->pass_fdlist) |
| 9947 | { |
| 9948 | #ifdef G_OS_UNIX |
| 9949 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 9950 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 9951 | #else |
| 9952 | g_assert_not_reached (); |
| 9953 | #endif |
| 9954 | } |
| 9955 | g_variant_iter_init (&iter, parameters); |
| 9956 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9957 | { |
| 9958 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 9959 | if (arg_info->use_gvariant) |
| 9960 | { |
| 9961 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9962 | g_value_set_variant (¶mv[n], child); |
| 9963 | n++; |
| 9964 | } |
| 9965 | else |
| 9966 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9967 | g_variant_unref (child); |
| 9968 | } |
| 9969 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 9970 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 9971 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 9972 | if (!g_value_get_boolean (&return_value)) |
| 9973 | 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); |
| 9974 | g_value_unset (&return_value); |
| 9975 | for (n = 0; n < num_params + num_extra; n++) |
| 9976 | g_value_unset (¶mv[n]); |
| 9977 | g_free (paramv); |
| 9978 | } |
| 9979 | |
| 9980 | static GVariant * |
| 9981 | _sensor_match_skeleton_handle_get_property ( |
| 9982 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9983 | const gchar *sender G_GNUC_UNUSED, |
| 9984 | const gchar *object_path G_GNUC_UNUSED, |
| 9985 | const gchar *interface_name G_GNUC_UNUSED, |
| 9986 | const gchar *property_name, |
| 9987 | GError **error, |
| 9988 | gpointer user_data) |
| 9989 | { |
| 9990 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 9991 | GValue value = G_VALUE_INIT; |
| 9992 | GParamSpec *pspec; |
| 9993 | _ExtendedGDBusPropertyInfo *info; |
| 9994 | GVariant *ret; |
| 9995 | ret = NULL; |
| 9996 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 9997 | g_assert (info != NULL); |
| 9998 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9999 | if (pspec == NULL) |
| 10000 | { |
| 10001 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10002 | } |
| 10003 | else |
| 10004 | { |
| 10005 | g_value_init (&value, pspec->value_type); |
| 10006 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10007 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 10008 | g_value_unset (&value); |
| 10009 | } |
| 10010 | return ret; |
| 10011 | } |
| 10012 | |
| 10013 | static gboolean |
| 10014 | _sensor_match_skeleton_handle_set_property ( |
| 10015 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10016 | const gchar *sender G_GNUC_UNUSED, |
| 10017 | const gchar *object_path G_GNUC_UNUSED, |
| 10018 | const gchar *interface_name G_GNUC_UNUSED, |
| 10019 | const gchar *property_name, |
| 10020 | GVariant *variant, |
| 10021 | GError **error, |
| 10022 | gpointer user_data) |
| 10023 | { |
| 10024 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 10025 | GValue value = G_VALUE_INIT; |
| 10026 | GParamSpec *pspec; |
| 10027 | _ExtendedGDBusPropertyInfo *info; |
| 10028 | gboolean ret; |
| 10029 | ret = FALSE; |
| 10030 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 10031 | g_assert (info != NULL); |
| 10032 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 10033 | if (pspec == NULL) |
| 10034 | { |
| 10035 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 10036 | } |
| 10037 | else |
| 10038 | { |
| 10039 | if (info->use_gvariant) |
| 10040 | g_value_set_variant (&value, variant); |
| 10041 | else |
| 10042 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 10043 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 10044 | g_value_unset (&value); |
| 10045 | ret = TRUE; |
| 10046 | } |
| 10047 | return ret; |
| 10048 | } |
| 10049 | |
| 10050 | static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = |
| 10051 | { |
| 10052 | _sensor_match_skeleton_handle_method_call, |
| 10053 | _sensor_match_skeleton_handle_get_property, |
| 10054 | _sensor_match_skeleton_handle_set_property, |
| 10055 | {NULL} |
| 10056 | }; |
| 10057 | |
| 10058 | static GDBusInterfaceInfo * |
| 10059 | sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10060 | { |
| 10061 | return sensor_match_interface_info (); |
| 10062 | } |
| 10063 | |
| 10064 | static GDBusInterfaceVTable * |
| 10065 | sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 10066 | { |
| 10067 | return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; |
| 10068 | } |
| 10069 | |
| 10070 | static GVariant * |
| 10071 | sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 10072 | { |
| 10073 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 10074 | |
| 10075 | GVariantBuilder builder; |
| 10076 | guint n; |
| 10077 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 10078 | if (_sensor_match_interface_info.parent_struct.properties == NULL) |
| 10079 | goto out; |
| 10080 | for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) |
| 10081 | { |
| 10082 | GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; |
| 10083 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 10084 | { |
| 10085 | GVariant *value; |
| 10086 | 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); |
| 10087 | if (value != NULL) |
| 10088 | { |
| 10089 | g_variant_take_ref (value); |
| 10090 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 10091 | g_variant_unref (value); |
| 10092 | } |
| 10093 | } |
| 10094 | } |
| 10095 | out: |
| 10096 | return g_variant_builder_end (&builder); |
| 10097 | } |
| 10098 | |
| 10099 | static gboolean _sensor_match_emit_changed (gpointer user_data); |
| 10100 | |
| 10101 | static void |
| 10102 | sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 10103 | { |
| 10104 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 10105 | gboolean emit_changed = FALSE; |
| 10106 | |
| 10107 | g_mutex_lock (&skeleton->priv->lock); |
| 10108 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 10109 | { |
| 10110 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 10111 | skeleton->priv->changed_properties_idle_source = NULL; |
| 10112 | emit_changed = TRUE; |
| 10113 | } |
| 10114 | g_mutex_unlock (&skeleton->priv->lock); |
| 10115 | |
| 10116 | if (emit_changed) |
| 10117 | _sensor_match_emit_changed (skeleton); |
| 10118 | } |
| 10119 | |
| 10120 | static void |
| 10121 | _sensor_match_on_signal_sensor_match ( |
| 10122 | SensorMatch *object, |
| 10123 | guchar arg_state) |
| 10124 | { |
| 10125 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10126 | |
| 10127 | GList *connections, *l; |
| 10128 | GVariant *signal_variant; |
| 10129 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 10130 | |
| 10131 | signal_variant = g_variant_ref_sink (g_variant_new ("(y)", |
| 10132 | arg_state)); |
| 10133 | for (l = connections; l != NULL; l = l->next) |
| 10134 | { |
| 10135 | GDBusConnection *connection = l->data; |
| 10136 | g_dbus_connection_emit_signal (connection, |
| 10137 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", |
| 10138 | signal_variant, NULL); |
| 10139 | } |
| 10140 | g_variant_unref (signal_variant); |
| 10141 | g_list_free_full (connections, g_object_unref); |
| 10142 | } |
| 10143 | |
| 10144 | static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); |
| 10145 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10146 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10147 | G_ADD_PRIVATE (SensorMatchSkeleton) |
| 10148 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 10149 | |
| 10150 | #else |
| 10151 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 10152 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 10153 | |
| 10154 | #endif |
| 10155 | static void |
| 10156 | sensor_match_skeleton_finalize (GObject *object) |
| 10157 | { |
| 10158 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10159 | guint n; |
| 10160 | for (n = 0; n < 2; n++) |
| 10161 | g_value_unset (&skeleton->priv->properties[n]); |
| 10162 | g_free (skeleton->priv->properties); |
| 10163 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 10164 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 10165 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 10166 | g_main_context_unref (skeleton->priv->context); |
| 10167 | g_mutex_clear (&skeleton->priv->lock); |
| 10168 | G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); |
| 10169 | } |
| 10170 | |
| 10171 | static void |
| 10172 | sensor_match_skeleton_get_property (GObject *object, |
| 10173 | guint prop_id, |
| 10174 | GValue *value, |
| 10175 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10176 | { |
| 10177 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10178 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10179 | g_mutex_lock (&skeleton->priv->lock); |
| 10180 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 10181 | g_mutex_unlock (&skeleton->priv->lock); |
| 10182 | } |
| 10183 | |
| 10184 | static gboolean |
| 10185 | _sensor_match_emit_changed (gpointer user_data) |
| 10186 | { |
| 10187 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 10188 | GList *l; |
| 10189 | GVariantBuilder builder; |
| 10190 | GVariantBuilder invalidated_builder; |
| 10191 | guint num_changes; |
| 10192 | |
| 10193 | g_mutex_lock (&skeleton->priv->lock); |
| 10194 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 10195 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 10196 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 10197 | { |
| 10198 | ChangedProperty *cp = l->data; |
| 10199 | GVariant *variant; |
| 10200 | const GValue *cur_value; |
| 10201 | |
| 10202 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 10203 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 10204 | { |
| 10205 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 10206 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 10207 | g_variant_unref (variant); |
| 10208 | num_changes++; |
| 10209 | } |
| 10210 | } |
| 10211 | if (num_changes > 0) |
| 10212 | { |
| 10213 | GList *connections, *ll; |
| 10214 | GVariant *signal_variant; |
| 10215 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", |
| 10216 | &builder, &invalidated_builder)); |
| 10217 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 10218 | for (ll = connections; ll != NULL; ll = ll->next) |
| 10219 | { |
| 10220 | GDBusConnection *connection = ll->data; |
| 10221 | |
| 10222 | g_dbus_connection_emit_signal (connection, |
| 10223 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 10224 | "org.freedesktop.DBus.Properties", |
| 10225 | "PropertiesChanged", |
| 10226 | signal_variant, |
| 10227 | NULL); |
| 10228 | } |
| 10229 | g_variant_unref (signal_variant); |
| 10230 | g_list_free_full (connections, g_object_unref); |
| 10231 | } |
| 10232 | else |
| 10233 | { |
| 10234 | g_variant_builder_clear (&builder); |
| 10235 | g_variant_builder_clear (&invalidated_builder); |
| 10236 | } |
| 10237 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 10238 | skeleton->priv->changed_properties = NULL; |
| 10239 | skeleton->priv->changed_properties_idle_source = NULL; |
| 10240 | g_mutex_unlock (&skeleton->priv->lock); |
| 10241 | return FALSE; |
| 10242 | } |
| 10243 | |
| 10244 | static void |
| 10245 | _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 10246 | { |
| 10247 | ChangedProperty *cp; |
| 10248 | GList *l; |
| 10249 | cp = NULL; |
| 10250 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 10251 | { |
| 10252 | ChangedProperty *i_cp = l->data; |
| 10253 | if (i_cp->info == info) |
| 10254 | { |
| 10255 | cp = i_cp; |
| 10256 | break; |
| 10257 | } |
| 10258 | } |
| 10259 | if (cp == NULL) |
| 10260 | { |
| 10261 | cp = g_new0 (ChangedProperty, 1); |
| 10262 | cp->prop_id = prop_id; |
| 10263 | cp->info = info; |
| 10264 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 10265 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 10266 | g_value_copy (orig_value, &cp->orig_value); |
| 10267 | } |
| 10268 | } |
| 10269 | |
| 10270 | static void |
| 10271 | sensor_match_skeleton_notify (GObject *object, |
| 10272 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10273 | { |
| 10274 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10275 | g_mutex_lock (&skeleton->priv->lock); |
| 10276 | if (skeleton->priv->changed_properties != NULL && |
| 10277 | skeleton->priv->changed_properties_idle_source == NULL) |
| 10278 | { |
| 10279 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 10280 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 10281 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 10282 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 10283 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 10284 | } |
| 10285 | g_mutex_unlock (&skeleton->priv->lock); |
| 10286 | } |
| 10287 | |
| 10288 | static void |
| 10289 | sensor_match_skeleton_set_property (GObject *object, |
| 10290 | guint prop_id, |
| 10291 | const GValue *value, |
| 10292 | GParamSpec *pspec) |
| 10293 | { |
| 10294 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10295 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10296 | g_mutex_lock (&skeleton->priv->lock); |
| 10297 | g_object_freeze_notify (object); |
| 10298 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 10299 | { |
| 10300 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 10301 | _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 10302 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 10303 | g_object_notify_by_pspec (object, pspec); |
| 10304 | } |
| 10305 | g_mutex_unlock (&skeleton->priv->lock); |
| 10306 | g_object_thaw_notify (object); |
| 10307 | } |
| 10308 | |
| 10309 | static void |
| 10310 | sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) |
| 10311 | { |
| 10312 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10313 | skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); |
| 10314 | #else |
| 10315 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); |
| 10316 | #endif |
| 10317 | |
| 10318 | g_mutex_init (&skeleton->priv->lock); |
| 10319 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 10320 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 10321 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 10322 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); |
| 10323 | } |
| 10324 | |
| 10325 | static GVariant * |
| 10326 | sensor_match_skeleton_get_match_value (SensorMatch *object) |
| 10327 | { |
| 10328 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10329 | GVariant *value; |
| 10330 | g_mutex_lock (&skeleton->priv->lock); |
| 10331 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 10332 | g_mutex_unlock (&skeleton->priv->lock); |
| 10333 | return value; |
| 10334 | } |
| 10335 | |
| 10336 | static guchar |
| 10337 | sensor_match_skeleton_get_state (SensorMatch *object) |
| 10338 | { |
| 10339 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 10340 | guchar value; |
| 10341 | g_mutex_lock (&skeleton->priv->lock); |
| 10342 | value = g_value_get_uchar (&(skeleton->priv->properties[1])); |
| 10343 | g_mutex_unlock (&skeleton->priv->lock); |
| 10344 | return value; |
| 10345 | } |
| 10346 | |
| 10347 | static void |
| 10348 | sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) |
| 10349 | { |
| 10350 | GObjectClass *gobject_class; |
| 10351 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 10352 | |
| 10353 | gobject_class = G_OBJECT_CLASS (klass); |
| 10354 | gobject_class->finalize = sensor_match_skeleton_finalize; |
| 10355 | gobject_class->get_property = sensor_match_skeleton_get_property; |
| 10356 | gobject_class->set_property = sensor_match_skeleton_set_property; |
| 10357 | gobject_class->notify = sensor_match_skeleton_notify; |
| 10358 | |
| 10359 | |
| 10360 | sensor_match_override_properties (gobject_class, 1); |
| 10361 | |
| 10362 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 10363 | skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; |
| 10364 | skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; |
| 10365 | skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; |
| 10366 | skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; |
| 10367 | |
| 10368 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10369 | g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); |
| 10370 | #endif |
| 10371 | } |
| 10372 | |
| 10373 | static void |
| 10374 | sensor_match_skeleton_iface_init (SensorMatchIface *iface) |
| 10375 | { |
| 10376 | iface->sensor_match = _sensor_match_on_signal_sensor_match; |
| 10377 | iface->get_match_value = sensor_match_skeleton_get_match_value; |
| 10378 | iface->get_state = sensor_match_skeleton_get_state; |
| 10379 | } |
| 10380 | |
| 10381 | /** |
| 10382 | * sensor_match_skeleton_new: |
| 10383 | * |
| 10384 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 10385 | * |
| 10386 | * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. |
| 10387 | */ |
| 10388 | SensorMatch * |
| 10389 | sensor_match_skeleton_new (void) |
| 10390 | { |
| 10391 | return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); |
| 10392 | } |
| 10393 | |
| 10394 | /* ------------------------------------------------------------------------ |
| 10395 | * Code for interface org.openbmc.Process |
| 10396 | * ------------------------------------------------------------------------ |
| 10397 | */ |
| 10398 | |
| 10399 | /** |
| 10400 | * SECTION:Process |
| 10401 | * @title: Process |
| 10402 | * @short_description: Generated C code for the org.openbmc.Process D-Bus interface |
| 10403 | * |
| 10404 | * 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. |
| 10405 | */ |
| 10406 | |
| 10407 | /* ---- Introspection data for org.openbmc.Process ---- */ |
| 10408 | |
| 10409 | static const _ExtendedGDBusMethodInfo _process_method_info_stop = |
| 10410 | { |
| 10411 | { |
| 10412 | -1, |
| 10413 | (gchar *) "stop", |
| 10414 | NULL, |
| 10415 | NULL, |
| 10416 | NULL |
| 10417 | }, |
| 10418 | "handle-stop", |
| 10419 | FALSE |
| 10420 | }; |
| 10421 | |
| 10422 | static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] = |
| 10423 | { |
| 10424 | &_process_method_info_stop, |
| 10425 | NULL |
| 10426 | }; |
| 10427 | |
| 10428 | static const _ExtendedGDBusInterfaceInfo _process_interface_info = |
| 10429 | { |
| 10430 | { |
| 10431 | -1, |
| 10432 | (gchar *) "org.openbmc.Process", |
| 10433 | (GDBusMethodInfo **) &_process_method_info_pointers, |
| 10434 | NULL, |
| 10435 | NULL, |
| 10436 | NULL |
| 10437 | }, |
| 10438 | "process", |
| 10439 | }; |
| 10440 | |
| 10441 | |
| 10442 | /** |
| 10443 | * process_interface_info: |
| 10444 | * |
| 10445 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface. |
| 10446 | * |
| 10447 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 10448 | */ |
| 10449 | GDBusInterfaceInfo * |
| 10450 | process_interface_info (void) |
| 10451 | { |
| 10452 | return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct; |
| 10453 | } |
| 10454 | |
| 10455 | /** |
| 10456 | * process_override_properties: |
| 10457 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 10458 | * @property_id_begin: The property id to assign to the first overridden property. |
| 10459 | * |
| 10460 | * Overrides all #GObject properties in the #Process interface for a concrete class. |
| 10461 | * The properties are overridden in the order they are defined. |
| 10462 | * |
| 10463 | * Returns: The last property id. |
| 10464 | */ |
| 10465 | guint |
| 10466 | process_override_properties (GObjectClass *klass, guint property_id_begin) |
| 10467 | { |
| 10468 | return property_id_begin - 1; |
| 10469 | } |
| 10470 | |
| 10471 | |
| 10472 | |
| 10473 | /** |
| 10474 | * Process: |
| 10475 | * |
| 10476 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10477 | */ |
| 10478 | |
| 10479 | /** |
| 10480 | * ProcessIface: |
| 10481 | * @parent_iface: The parent interface. |
| 10482 | * @handle_stop: Handler for the #Process::handle-stop signal. |
| 10483 | * |
| 10484 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10485 | */ |
| 10486 | |
| 10487 | typedef ProcessIface ProcessInterface; |
| 10488 | G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT); |
| 10489 | |
| 10490 | static void |
| 10491 | process_default_init (ProcessIface *iface) |
| 10492 | { |
| 10493 | /* GObject signals for incoming D-Bus method calls: */ |
| 10494 | /** |
| 10495 | * Process::handle-stop: |
| 10496 | * @object: A #Process. |
| 10497 | * @invocation: A #GDBusMethodInvocation. |
| 10498 | * |
| 10499 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. |
| 10500 | * |
| 10501 | * 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. |
| 10502 | * |
| 10503 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 10504 | */ |
| 10505 | g_signal_new ("handle-stop", |
| 10506 | G_TYPE_FROM_INTERFACE (iface), |
| 10507 | G_SIGNAL_RUN_LAST, |
| 10508 | G_STRUCT_OFFSET (ProcessIface, handle_stop), |
| 10509 | g_signal_accumulator_true_handled, |
| 10510 | NULL, |
| 10511 | g_cclosure_marshal_generic, |
| 10512 | G_TYPE_BOOLEAN, |
| 10513 | 1, |
| 10514 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 10515 | |
| 10516 | } |
| 10517 | |
| 10518 | /** |
| 10519 | * process_call_stop: |
| 10520 | * @proxy: A #ProcessProxy. |
| 10521 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10522 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 10523 | * @user_data: User data to pass to @callback. |
| 10524 | * |
| 10525 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. |
| 10526 | * 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. |
| 10527 | * You can then call process_call_stop_finish() to get the result of the operation. |
| 10528 | * |
| 10529 | * See process_call_stop_sync() for the synchronous, blocking version of this method. |
| 10530 | */ |
| 10531 | void |
| 10532 | process_call_stop ( |
| 10533 | Process *proxy, |
| 10534 | GCancellable *cancellable, |
| 10535 | GAsyncReadyCallback callback, |
| 10536 | gpointer user_data) |
| 10537 | { |
| 10538 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 10539 | "stop", |
| 10540 | g_variant_new ("()"), |
| 10541 | G_DBUS_CALL_FLAGS_NONE, |
| 10542 | -1, |
| 10543 | cancellable, |
| 10544 | callback, |
| 10545 | user_data); |
| 10546 | } |
| 10547 | |
| 10548 | /** |
| 10549 | * process_call_stop_finish: |
| 10550 | * @proxy: A #ProcessProxy. |
| 10551 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop(). |
| 10552 | * @error: Return location for error or %NULL. |
| 10553 | * |
| 10554 | * Finishes an operation started with process_call_stop(). |
| 10555 | * |
| 10556 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10557 | */ |
| 10558 | gboolean |
| 10559 | process_call_stop_finish ( |
| 10560 | Process *proxy, |
| 10561 | GAsyncResult *res, |
| 10562 | GError **error) |
| 10563 | { |
| 10564 | GVariant *_ret; |
| 10565 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 10566 | if (_ret == NULL) |
| 10567 | goto _out; |
| 10568 | g_variant_get (_ret, |
| 10569 | "()"); |
| 10570 | g_variant_unref (_ret); |
| 10571 | _out: |
| 10572 | return _ret != NULL; |
| 10573 | } |
| 10574 | |
| 10575 | /** |
| 10576 | * process_call_stop_sync: |
| 10577 | * @proxy: A #ProcessProxy. |
| 10578 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10579 | * @error: Return location for error or %NULL. |
| 10580 | * |
| 10581 | * 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. |
| 10582 | * |
| 10583 | * See process_call_stop() for the asynchronous version of this method. |
| 10584 | * |
| 10585 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10586 | */ |
| 10587 | gboolean |
| 10588 | process_call_stop_sync ( |
| 10589 | Process *proxy, |
| 10590 | GCancellable *cancellable, |
| 10591 | GError **error) |
| 10592 | { |
| 10593 | GVariant *_ret; |
| 10594 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 10595 | "stop", |
| 10596 | g_variant_new ("()"), |
| 10597 | G_DBUS_CALL_FLAGS_NONE, |
| 10598 | -1, |
| 10599 | cancellable, |
| 10600 | error); |
| 10601 | if (_ret == NULL) |
| 10602 | goto _out; |
| 10603 | g_variant_get (_ret, |
| 10604 | "()"); |
| 10605 | g_variant_unref (_ret); |
| 10606 | _out: |
| 10607 | return _ret != NULL; |
| 10608 | } |
| 10609 | |
| 10610 | /** |
| 10611 | * process_complete_stop: |
| 10612 | * @object: A #Process. |
| 10613 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 10614 | * |
| 10615 | * 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. |
| 10616 | * |
| 10617 | * This method will free @invocation, you cannot use it afterwards. |
| 10618 | */ |
| 10619 | void |
| 10620 | process_complete_stop ( |
| 10621 | Process *object, |
| 10622 | GDBusMethodInvocation *invocation) |
| 10623 | { |
| 10624 | g_dbus_method_invocation_return_value (invocation, |
| 10625 | g_variant_new ("()")); |
| 10626 | } |
| 10627 | |
| 10628 | /* ------------------------------------------------------------------------ */ |
| 10629 | |
| 10630 | /** |
| 10631 | * ProcessProxy: |
| 10632 | * |
| 10633 | * The #ProcessProxy structure contains only private data and should only be accessed using the provided API. |
| 10634 | */ |
| 10635 | |
| 10636 | /** |
| 10637 | * ProcessProxyClass: |
| 10638 | * @parent_class: The parent class. |
| 10639 | * |
| 10640 | * Class structure for #ProcessProxy. |
| 10641 | */ |
| 10642 | |
| 10643 | struct _ProcessProxyPrivate |
| 10644 | { |
| 10645 | GData *qdata; |
| 10646 | }; |
| 10647 | |
| 10648 | static void process_proxy_iface_init (ProcessIface *iface); |
| 10649 | |
| 10650 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10651 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 10652 | G_ADD_PRIVATE (ProcessProxy) |
| 10653 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 10654 | |
| 10655 | #else |
| 10656 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 10657 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 10658 | |
| 10659 | #endif |
| 10660 | static void |
| 10661 | process_proxy_finalize (GObject *object) |
| 10662 | { |
| 10663 | ProcessProxy *proxy = PROCESS_PROXY (object); |
| 10664 | g_datalist_clear (&proxy->priv->qdata); |
| 10665 | G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object); |
| 10666 | } |
| 10667 | |
| 10668 | static void |
| 10669 | process_proxy_get_property (GObject *object, |
| 10670 | guint prop_id, |
| 10671 | GValue *value, |
| 10672 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10673 | { |
| 10674 | } |
| 10675 | |
| 10676 | static void |
| 10677 | process_proxy_set_property (GObject *object, |
| 10678 | guint prop_id, |
| 10679 | const GValue *value, |
| 10680 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10681 | { |
| 10682 | } |
| 10683 | |
| 10684 | static void |
| 10685 | process_proxy_g_signal (GDBusProxy *proxy, |
| 10686 | const gchar *sender_name G_GNUC_UNUSED, |
| 10687 | const gchar *signal_name, |
| 10688 | GVariant *parameters) |
| 10689 | { |
| 10690 | _ExtendedGDBusSignalInfo *info; |
| 10691 | GVariantIter iter; |
| 10692 | GVariant *child; |
| 10693 | GValue *paramv; |
| 10694 | guint num_params; |
| 10695 | guint n; |
| 10696 | guint signal_id; |
| 10697 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name); |
| 10698 | if (info == NULL) |
| 10699 | return; |
| 10700 | num_params = g_variant_n_children (parameters); |
| 10701 | paramv = g_new0 (GValue, num_params + 1); |
| 10702 | g_value_init (¶mv[0], TYPE_PROCESS); |
| 10703 | g_value_set_object (¶mv[0], proxy); |
| 10704 | g_variant_iter_init (&iter, parameters); |
| 10705 | n = 1; |
| 10706 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10707 | { |
| 10708 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 10709 | if (arg_info->use_gvariant) |
| 10710 | { |
| 10711 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10712 | g_value_set_variant (¶mv[n], child); |
| 10713 | n++; |
| 10714 | } |
| 10715 | else |
| 10716 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10717 | g_variant_unref (child); |
| 10718 | } |
| 10719 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 10720 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 10721 | for (n = 0; n < num_params + 1; n++) |
| 10722 | g_value_unset (¶mv[n]); |
| 10723 | g_free (paramv); |
| 10724 | } |
| 10725 | |
| 10726 | static void |
| 10727 | process_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 10728 | GVariant *changed_properties, |
| 10729 | const gchar *const *invalidated_properties) |
| 10730 | { |
| 10731 | ProcessProxy *proxy = PROCESS_PROXY (_proxy); |
| 10732 | guint n; |
| 10733 | const gchar *key; |
| 10734 | GVariantIter *iter; |
| 10735 | _ExtendedGDBusPropertyInfo *info; |
| 10736 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 10737 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 10738 | { |
| 10739 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key); |
| 10740 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 10741 | if (info != NULL) |
| 10742 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10743 | } |
| 10744 | g_variant_iter_free (iter); |
| 10745 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 10746 | { |
| 10747 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]); |
| 10748 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 10749 | if (info != NULL) |
| 10750 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10751 | } |
| 10752 | } |
| 10753 | |
| 10754 | static void |
| 10755 | process_proxy_init (ProcessProxy *proxy) |
| 10756 | { |
| 10757 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10758 | proxy->priv = process_proxy_get_instance_private (proxy); |
| 10759 | #else |
| 10760 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate); |
| 10761 | #endif |
| 10762 | |
| 10763 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ()); |
| 10764 | } |
| 10765 | |
| 10766 | static void |
| 10767 | process_proxy_class_init (ProcessProxyClass *klass) |
| 10768 | { |
| 10769 | GObjectClass *gobject_class; |
| 10770 | GDBusProxyClass *proxy_class; |
| 10771 | |
| 10772 | gobject_class = G_OBJECT_CLASS (klass); |
| 10773 | gobject_class->finalize = process_proxy_finalize; |
| 10774 | gobject_class->get_property = process_proxy_get_property; |
| 10775 | gobject_class->set_property = process_proxy_set_property; |
| 10776 | |
| 10777 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 10778 | proxy_class->g_signal = process_proxy_g_signal; |
| 10779 | proxy_class->g_properties_changed = process_proxy_g_properties_changed; |
| 10780 | |
| 10781 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10782 | g_type_class_add_private (klass, sizeof (ProcessProxyPrivate)); |
| 10783 | #endif |
| 10784 | } |
| 10785 | |
| 10786 | static void |
| 10787 | process_proxy_iface_init (ProcessIface *iface) |
| 10788 | { |
| 10789 | } |
| 10790 | |
| 10791 | /** |
| 10792 | * process_proxy_new: |
| 10793 | * @connection: A #GDBusConnection. |
| 10794 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10795 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10796 | * @object_path: An object path. |
| 10797 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10798 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10799 | * @user_data: User data to pass to @callback. |
| 10800 | * |
| 10801 | * 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. |
| 10802 | * |
| 10803 | * 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. |
| 10804 | * You can then call process_proxy_new_finish() to get the result of the operation. |
| 10805 | * |
| 10806 | * See process_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 10807 | */ |
| 10808 | void |
| 10809 | process_proxy_new ( |
| 10810 | GDBusConnection *connection, |
| 10811 | GDBusProxyFlags flags, |
| 10812 | const gchar *name, |
| 10813 | const gchar *object_path, |
| 10814 | GCancellable *cancellable, |
| 10815 | GAsyncReadyCallback callback, |
| 10816 | gpointer user_data) |
| 10817 | { |
| 10818 | 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); |
| 10819 | } |
| 10820 | |
| 10821 | /** |
| 10822 | * process_proxy_new_finish: |
| 10823 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new(). |
| 10824 | * @error: Return location for error or %NULL |
| 10825 | * |
| 10826 | * Finishes an operation started with process_proxy_new(). |
| 10827 | * |
| 10828 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10829 | */ |
| 10830 | Process * |
| 10831 | process_proxy_new_finish ( |
| 10832 | GAsyncResult *res, |
| 10833 | GError **error) |
| 10834 | { |
| 10835 | GObject *ret; |
| 10836 | GObject *source_object; |
| 10837 | source_object = g_async_result_get_source_object (res); |
| 10838 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10839 | g_object_unref (source_object); |
| 10840 | if (ret != NULL) |
| 10841 | return PROCESS (ret); |
| 10842 | else |
| 10843 | return NULL; |
| 10844 | } |
| 10845 | |
| 10846 | /** |
| 10847 | * process_proxy_new_sync: |
| 10848 | * @connection: A #GDBusConnection. |
| 10849 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10850 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 10851 | * @object_path: An object path. |
| 10852 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10853 | * @error: Return location for error or %NULL |
| 10854 | * |
| 10855 | * 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. |
| 10856 | * |
| 10857 | * The calling thread is blocked until a reply is received. |
| 10858 | * |
| 10859 | * See process_proxy_new() for the asynchronous version of this constructor. |
| 10860 | * |
| 10861 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10862 | */ |
| 10863 | Process * |
| 10864 | process_proxy_new_sync ( |
| 10865 | GDBusConnection *connection, |
| 10866 | GDBusProxyFlags flags, |
| 10867 | const gchar *name, |
| 10868 | const gchar *object_path, |
| 10869 | GCancellable *cancellable, |
| 10870 | GError **error) |
| 10871 | { |
| 10872 | GInitable *ret; |
| 10873 | 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); |
| 10874 | if (ret != NULL) |
| 10875 | return PROCESS (ret); |
| 10876 | else |
| 10877 | return NULL; |
| 10878 | } |
| 10879 | |
| 10880 | |
| 10881 | /** |
| 10882 | * process_proxy_new_for_bus: |
| 10883 | * @bus_type: A #GBusType. |
| 10884 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10885 | * @name: A bus name (well-known or unique). |
| 10886 | * @object_path: An object path. |
| 10887 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10888 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 10889 | * @user_data: User data to pass to @callback. |
| 10890 | * |
| 10891 | * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 10892 | * |
| 10893 | * 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. |
| 10894 | * You can then call process_proxy_new_for_bus_finish() to get the result of the operation. |
| 10895 | * |
| 10896 | * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 10897 | */ |
| 10898 | void |
| 10899 | process_proxy_new_for_bus ( |
| 10900 | GBusType bus_type, |
| 10901 | GDBusProxyFlags flags, |
| 10902 | const gchar *name, |
| 10903 | const gchar *object_path, |
| 10904 | GCancellable *cancellable, |
| 10905 | GAsyncReadyCallback callback, |
| 10906 | gpointer user_data) |
| 10907 | { |
| 10908 | 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); |
| 10909 | } |
| 10910 | |
| 10911 | /** |
| 10912 | * process_proxy_new_for_bus_finish: |
| 10913 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus(). |
| 10914 | * @error: Return location for error or %NULL |
| 10915 | * |
| 10916 | * Finishes an operation started with process_proxy_new_for_bus(). |
| 10917 | * |
| 10918 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10919 | */ |
| 10920 | Process * |
| 10921 | process_proxy_new_for_bus_finish ( |
| 10922 | GAsyncResult *res, |
| 10923 | GError **error) |
| 10924 | { |
| 10925 | GObject *ret; |
| 10926 | GObject *source_object; |
| 10927 | source_object = g_async_result_get_source_object (res); |
| 10928 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 10929 | g_object_unref (source_object); |
| 10930 | if (ret != NULL) |
| 10931 | return PROCESS (ret); |
| 10932 | else |
| 10933 | return NULL; |
| 10934 | } |
| 10935 | |
| 10936 | /** |
| 10937 | * process_proxy_new_for_bus_sync: |
| 10938 | * @bus_type: A #GBusType. |
| 10939 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 10940 | * @name: A bus name (well-known or unique). |
| 10941 | * @object_path: An object path. |
| 10942 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10943 | * @error: Return location for error or %NULL |
| 10944 | * |
| 10945 | * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 10946 | * |
| 10947 | * The calling thread is blocked until a reply is received. |
| 10948 | * |
| 10949 | * See process_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 10950 | * |
| 10951 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 10952 | */ |
| 10953 | Process * |
| 10954 | process_proxy_new_for_bus_sync ( |
| 10955 | GBusType bus_type, |
| 10956 | GDBusProxyFlags flags, |
| 10957 | const gchar *name, |
| 10958 | const gchar *object_path, |
| 10959 | GCancellable *cancellable, |
| 10960 | GError **error) |
| 10961 | { |
| 10962 | GInitable *ret; |
| 10963 | 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); |
| 10964 | if (ret != NULL) |
| 10965 | return PROCESS (ret); |
| 10966 | else |
| 10967 | return NULL; |
| 10968 | } |
| 10969 | |
| 10970 | |
| 10971 | /* ------------------------------------------------------------------------ */ |
| 10972 | |
| 10973 | /** |
| 10974 | * ProcessSkeleton: |
| 10975 | * |
| 10976 | * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API. |
| 10977 | */ |
| 10978 | |
| 10979 | /** |
| 10980 | * ProcessSkeletonClass: |
| 10981 | * @parent_class: The parent class. |
| 10982 | * |
| 10983 | * Class structure for #ProcessSkeleton. |
| 10984 | */ |
| 10985 | |
| 10986 | struct _ProcessSkeletonPrivate |
| 10987 | { |
| 10988 | GValue *properties; |
| 10989 | GList *changed_properties; |
| 10990 | GSource *changed_properties_idle_source; |
| 10991 | GMainContext *context; |
| 10992 | GMutex lock; |
| 10993 | }; |
| 10994 | |
| 10995 | static void |
| 10996 | _process_skeleton_handle_method_call ( |
| 10997 | GDBusConnection *connection G_GNUC_UNUSED, |
| 10998 | const gchar *sender G_GNUC_UNUSED, |
| 10999 | const gchar *object_path G_GNUC_UNUSED, |
| 11000 | const gchar *interface_name, |
| 11001 | const gchar *method_name, |
| 11002 | GVariant *parameters, |
| 11003 | GDBusMethodInvocation *invocation, |
| 11004 | gpointer user_data) |
| 11005 | { |
| 11006 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 11007 | _ExtendedGDBusMethodInfo *info; |
| 11008 | GVariantIter iter; |
| 11009 | GVariant *child; |
| 11010 | GValue *paramv; |
| 11011 | guint num_params; |
| 11012 | guint num_extra; |
| 11013 | guint n; |
| 11014 | guint signal_id; |
| 11015 | GValue return_value = G_VALUE_INIT; |
| 11016 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 11017 | g_assert (info != NULL); |
| 11018 | num_params = g_variant_n_children (parameters); |
| 11019 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 11020 | n = 0; |
| 11021 | g_value_init (¶mv[n], TYPE_PROCESS); |
| 11022 | g_value_set_object (¶mv[n++], skeleton); |
| 11023 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 11024 | g_value_set_object (¶mv[n++], invocation); |
| 11025 | if (info->pass_fdlist) |
| 11026 | { |
| 11027 | #ifdef G_OS_UNIX |
| 11028 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 11029 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 11030 | #else |
| 11031 | g_assert_not_reached (); |
| 11032 | #endif |
| 11033 | } |
| 11034 | g_variant_iter_init (&iter, parameters); |
| 11035 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11036 | { |
| 11037 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 11038 | if (arg_info->use_gvariant) |
| 11039 | { |
| 11040 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11041 | g_value_set_variant (¶mv[n], child); |
| 11042 | n++; |
| 11043 | } |
| 11044 | else |
| 11045 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11046 | g_variant_unref (child); |
| 11047 | } |
| 11048 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 11049 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 11050 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 11051 | if (!g_value_get_boolean (&return_value)) |
| 11052 | 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); |
| 11053 | g_value_unset (&return_value); |
| 11054 | for (n = 0; n < num_params + num_extra; n++) |
| 11055 | g_value_unset (¶mv[n]); |
| 11056 | g_free (paramv); |
| 11057 | } |
| 11058 | |
| 11059 | static GVariant * |
| 11060 | _process_skeleton_handle_get_property ( |
| 11061 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11062 | const gchar *sender G_GNUC_UNUSED, |
| 11063 | const gchar *object_path G_GNUC_UNUSED, |
| 11064 | const gchar *interface_name G_GNUC_UNUSED, |
| 11065 | const gchar *property_name, |
| 11066 | GError **error, |
| 11067 | gpointer user_data) |
| 11068 | { |
| 11069 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 11070 | GValue value = G_VALUE_INIT; |
| 11071 | GParamSpec *pspec; |
| 11072 | _ExtendedGDBusPropertyInfo *info; |
| 11073 | GVariant *ret; |
| 11074 | ret = NULL; |
| 11075 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 11076 | g_assert (info != NULL); |
| 11077 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11078 | if (pspec == NULL) |
| 11079 | { |
| 11080 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11081 | } |
| 11082 | else |
| 11083 | { |
| 11084 | g_value_init (&value, pspec->value_type); |
| 11085 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11086 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11087 | g_value_unset (&value); |
| 11088 | } |
| 11089 | return ret; |
| 11090 | } |
| 11091 | |
| 11092 | static gboolean |
| 11093 | _process_skeleton_handle_set_property ( |
| 11094 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11095 | const gchar *sender G_GNUC_UNUSED, |
| 11096 | const gchar *object_path G_GNUC_UNUSED, |
| 11097 | const gchar *interface_name G_GNUC_UNUSED, |
| 11098 | const gchar *property_name, |
| 11099 | GVariant *variant, |
| 11100 | GError **error, |
| 11101 | gpointer user_data) |
| 11102 | { |
| 11103 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 11104 | GValue value = G_VALUE_INIT; |
| 11105 | GParamSpec *pspec; |
| 11106 | _ExtendedGDBusPropertyInfo *info; |
| 11107 | gboolean ret; |
| 11108 | ret = FALSE; |
| 11109 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 11110 | g_assert (info != NULL); |
| 11111 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11112 | if (pspec == NULL) |
| 11113 | { |
| 11114 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11115 | } |
| 11116 | else |
| 11117 | { |
| 11118 | if (info->use_gvariant) |
| 11119 | g_value_set_variant (&value, variant); |
| 11120 | else |
| 11121 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 11122 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11123 | g_value_unset (&value); |
| 11124 | ret = TRUE; |
| 11125 | } |
| 11126 | return ret; |
| 11127 | } |
| 11128 | |
| 11129 | static const GDBusInterfaceVTable _process_skeleton_vtable = |
| 11130 | { |
| 11131 | _process_skeleton_handle_method_call, |
| 11132 | _process_skeleton_handle_get_property, |
| 11133 | _process_skeleton_handle_set_property, |
| 11134 | {NULL} |
| 11135 | }; |
| 11136 | |
| 11137 | static GDBusInterfaceInfo * |
| 11138 | process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11139 | { |
| 11140 | return process_interface_info (); |
| 11141 | } |
| 11142 | |
| 11143 | static GDBusInterfaceVTable * |
| 11144 | process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11145 | { |
| 11146 | return (GDBusInterfaceVTable *) &_process_skeleton_vtable; |
| 11147 | } |
| 11148 | |
| 11149 | static GVariant * |
| 11150 | process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 11151 | { |
| 11152 | ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton); |
| 11153 | |
| 11154 | GVariantBuilder builder; |
| 11155 | guint n; |
| 11156 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 11157 | if (_process_interface_info.parent_struct.properties == NULL) |
| 11158 | goto out; |
| 11159 | for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++) |
| 11160 | { |
| 11161 | GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n]; |
| 11162 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 11163 | { |
| 11164 | GVariant *value; |
| 11165 | 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); |
| 11166 | if (value != NULL) |
| 11167 | { |
| 11168 | g_variant_take_ref (value); |
| 11169 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 11170 | g_variant_unref (value); |
| 11171 | } |
| 11172 | } |
| 11173 | } |
| 11174 | out: |
| 11175 | return g_variant_builder_end (&builder); |
| 11176 | } |
| 11177 | |
| 11178 | static void |
| 11179 | process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 11180 | { |
| 11181 | } |
| 11182 | |
| 11183 | static void process_skeleton_iface_init (ProcessIface *iface); |
| 11184 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11185 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 11186 | G_ADD_PRIVATE (ProcessSkeleton) |
| 11187 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 11188 | |
| 11189 | #else |
| 11190 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 11191 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 11192 | |
| 11193 | #endif |
| 11194 | static void |
| 11195 | process_skeleton_finalize (GObject *object) |
| 11196 | { |
| 11197 | ProcessSkeleton *skeleton = PROCESS_SKELETON (object); |
| 11198 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 11199 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 11200 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 11201 | g_main_context_unref (skeleton->priv->context); |
| 11202 | g_mutex_clear (&skeleton->priv->lock); |
| 11203 | G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object); |
| 11204 | } |
| 11205 | |
| 11206 | static void |
| 11207 | process_skeleton_init (ProcessSkeleton *skeleton) |
| 11208 | { |
| 11209 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11210 | skeleton->priv = process_skeleton_get_instance_private (skeleton); |
| 11211 | #else |
| 11212 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate); |
| 11213 | #endif |
| 11214 | |
| 11215 | g_mutex_init (&skeleton->priv->lock); |
| 11216 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 11217 | } |
| 11218 | |
| 11219 | static void |
| 11220 | process_skeleton_class_init (ProcessSkeletonClass *klass) |
| 11221 | { |
| 11222 | GObjectClass *gobject_class; |
| 11223 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 11224 | |
| 11225 | gobject_class = G_OBJECT_CLASS (klass); |
| 11226 | gobject_class->finalize = process_skeleton_finalize; |
| 11227 | |
| 11228 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 11229 | skeleton_class->get_info = process_skeleton_dbus_interface_get_info; |
| 11230 | skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties; |
| 11231 | skeleton_class->flush = process_skeleton_dbus_interface_flush; |
| 11232 | skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable; |
| 11233 | |
| 11234 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 11235 | g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate)); |
| 11236 | #endif |
| 11237 | } |
| 11238 | |
| 11239 | static void |
| 11240 | process_skeleton_iface_init (ProcessIface *iface) |
| 11241 | { |
| 11242 | } |
| 11243 | |
| 11244 | /** |
| 11245 | * process_skeleton_new: |
| 11246 | * |
| 11247 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 11248 | * |
| 11249 | * Returns: (transfer full) (type ProcessSkeleton): The skeleton object. |
| 11250 | */ |
| 11251 | Process * |
| 11252 | process_skeleton_new (void) |
| 11253 | { |
| 11254 | return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL)); |
| 11255 | } |
| 11256 | |
| 11257 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 11258 | * Code for interface org.openbmc.SharedResource |
| 11259 | * ------------------------------------------------------------------------ |
| 11260 | */ |
| 11261 | |
| 11262 | /** |
| 11263 | * SECTION:SharedResource |
| 11264 | * @title: SharedResource |
| 11265 | * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface |
| 11266 | * |
| 11267 | * 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. |
| 11268 | */ |
| 11269 | |
| 11270 | /* ---- Introspection data for org.openbmc.SharedResource ---- */ |
| 11271 | |
| 11272 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name = |
| 11273 | { |
| 11274 | { |
| 11275 | -1, |
| 11276 | (gchar *) "name", |
| 11277 | (gchar *) "s", |
| 11278 | NULL |
| 11279 | }, |
| 11280 | FALSE |
| 11281 | }; |
| 11282 | |
| 11283 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] = |
| 11284 | { |
| 11285 | &_shared_resource_method_info_lock_IN_ARG_name, |
| 11286 | NULL |
| 11287 | }; |
| 11288 | |
| 11289 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock = |
| 11290 | { |
| 11291 | { |
| 11292 | -1, |
| 11293 | (gchar *) "lock", |
| 11294 | (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers, |
| 11295 | NULL, |
| 11296 | NULL |
| 11297 | }, |
| 11298 | "handle-lock", |
| 11299 | FALSE |
| 11300 | }; |
| 11301 | |
| 11302 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock = |
| 11303 | { |
| 11304 | { |
| 11305 | -1, |
| 11306 | (gchar *) "unlock", |
| 11307 | NULL, |
| 11308 | NULL, |
| 11309 | NULL |
| 11310 | }, |
| 11311 | "handle-unlock", |
| 11312 | FALSE |
| 11313 | }; |
| 11314 | |
| 11315 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock = |
| 11316 | { |
| 11317 | { |
| 11318 | -1, |
| 11319 | (gchar *) "lock", |
| 11320 | (gchar *) "b", |
| 11321 | NULL |
| 11322 | }, |
| 11323 | FALSE |
| 11324 | }; |
| 11325 | |
| 11326 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name = |
| 11327 | { |
| 11328 | { |
| 11329 | -1, |
| 11330 | (gchar *) "name", |
| 11331 | (gchar *) "s", |
| 11332 | NULL |
| 11333 | }, |
| 11334 | FALSE |
| 11335 | }; |
| 11336 | |
| 11337 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] = |
| 11338 | { |
| 11339 | &_shared_resource_method_info_is_locked_OUT_ARG_lock, |
| 11340 | &_shared_resource_method_info_is_locked_OUT_ARG_name, |
| 11341 | NULL |
| 11342 | }; |
| 11343 | |
| 11344 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked = |
| 11345 | { |
| 11346 | { |
| 11347 | -1, |
| 11348 | (gchar *) "isLocked", |
| 11349 | NULL, |
| 11350 | (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers, |
| 11351 | NULL |
| 11352 | }, |
| 11353 | "handle-is-locked", |
| 11354 | FALSE |
| 11355 | }; |
| 11356 | |
| 11357 | static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] = |
| 11358 | { |
| 11359 | &_shared_resource_method_info_lock, |
| 11360 | &_shared_resource_method_info_unlock, |
| 11361 | &_shared_resource_method_info_is_locked, |
| 11362 | NULL |
| 11363 | }; |
| 11364 | |
| 11365 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock = |
| 11366 | { |
| 11367 | { |
| 11368 | -1, |
| 11369 | (gchar *) "lock", |
| 11370 | (gchar *) "b", |
| 11371 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 11372 | NULL |
| 11373 | }, |
| 11374 | "lock", |
| 11375 | FALSE |
| 11376 | }; |
| 11377 | |
| 11378 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name = |
| 11379 | { |
| 11380 | { |
| 11381 | -1, |
| 11382 | (gchar *) "name", |
| 11383 | (gchar *) "s", |
| 11384 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 11385 | NULL |
| 11386 | }, |
| 11387 | "name", |
| 11388 | FALSE |
| 11389 | }; |
| 11390 | |
| 11391 | static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] = |
| 11392 | { |
| 11393 | &_shared_resource_property_info_lock, |
| 11394 | &_shared_resource_property_info_name, |
| 11395 | NULL |
| 11396 | }; |
| 11397 | |
| 11398 | static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info = |
| 11399 | { |
| 11400 | { |
| 11401 | -1, |
| 11402 | (gchar *) "org.openbmc.SharedResource", |
| 11403 | (GDBusMethodInfo **) &_shared_resource_method_info_pointers, |
| 11404 | NULL, |
| 11405 | (GDBusPropertyInfo **) &_shared_resource_property_info_pointers, |
| 11406 | NULL |
| 11407 | }, |
| 11408 | "shared-resource", |
| 11409 | }; |
| 11410 | |
| 11411 | |
| 11412 | /** |
| 11413 | * shared_resource_interface_info: |
| 11414 | * |
| 11415 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface. |
| 11416 | * |
| 11417 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 11418 | */ |
| 11419 | GDBusInterfaceInfo * |
| 11420 | shared_resource_interface_info (void) |
| 11421 | { |
| 11422 | return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct; |
| 11423 | } |
| 11424 | |
| 11425 | /** |
| 11426 | * shared_resource_override_properties: |
| 11427 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 11428 | * @property_id_begin: The property id to assign to the first overridden property. |
| 11429 | * |
| 11430 | * Overrides all #GObject properties in the #SharedResource interface for a concrete class. |
| 11431 | * The properties are overridden in the order they are defined. |
| 11432 | * |
| 11433 | * Returns: The last property id. |
| 11434 | */ |
| 11435 | guint |
| 11436 | shared_resource_override_properties (GObjectClass *klass, guint property_id_begin) |
| 11437 | { |
| 11438 | g_object_class_override_property (klass, property_id_begin++, "lock"); |
| 11439 | g_object_class_override_property (klass, property_id_begin++, "name"); |
| 11440 | return property_id_begin - 1; |
| 11441 | } |
| 11442 | |
| 11443 | |
| 11444 | |
| 11445 | /** |
| 11446 | * SharedResource: |
| 11447 | * |
| 11448 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 11449 | */ |
| 11450 | |
| 11451 | /** |
| 11452 | * SharedResourceIface: |
| 11453 | * @parent_iface: The parent interface. |
| 11454 | * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal. |
| 11455 | * @handle_lock: Handler for the #SharedResource::handle-lock signal. |
| 11456 | * @handle_unlock: Handler for the #SharedResource::handle-unlock signal. |
| 11457 | * @get_lock: Getter for the #SharedResource:lock property. |
| 11458 | * @get_name: Getter for the #SharedResource:name property. |
| 11459 | * |
| 11460 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 11461 | */ |
| 11462 | |
| 11463 | typedef SharedResourceIface SharedResourceInterface; |
| 11464 | G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT); |
| 11465 | |
| 11466 | static void |
| 11467 | shared_resource_default_init (SharedResourceIface *iface) |
| 11468 | { |
| 11469 | /* GObject signals for incoming D-Bus method calls: */ |
| 11470 | /** |
| 11471 | * SharedResource::handle-lock: |
| 11472 | * @object: A #SharedResource. |
| 11473 | * @invocation: A #GDBusMethodInvocation. |
| 11474 | * @arg_name: Argument passed by remote caller. |
| 11475 | * |
| 11476 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. |
| 11477 | * |
| 11478 | * 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. |
| 11479 | * |
| 11480 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11481 | */ |
| 11482 | g_signal_new ("handle-lock", |
| 11483 | G_TYPE_FROM_INTERFACE (iface), |
| 11484 | G_SIGNAL_RUN_LAST, |
| 11485 | G_STRUCT_OFFSET (SharedResourceIface, handle_lock), |
| 11486 | g_signal_accumulator_true_handled, |
| 11487 | NULL, |
| 11488 | g_cclosure_marshal_generic, |
| 11489 | G_TYPE_BOOLEAN, |
| 11490 | 2, |
| 11491 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 11492 | |
| 11493 | /** |
| 11494 | * SharedResource::handle-unlock: |
| 11495 | * @object: A #SharedResource. |
| 11496 | * @invocation: A #GDBusMethodInvocation. |
| 11497 | * |
| 11498 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. |
| 11499 | * |
| 11500 | * 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. |
| 11501 | * |
| 11502 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11503 | */ |
| 11504 | g_signal_new ("handle-unlock", |
| 11505 | G_TYPE_FROM_INTERFACE (iface), |
| 11506 | G_SIGNAL_RUN_LAST, |
| 11507 | G_STRUCT_OFFSET (SharedResourceIface, handle_unlock), |
| 11508 | g_signal_accumulator_true_handled, |
| 11509 | NULL, |
| 11510 | g_cclosure_marshal_generic, |
| 11511 | G_TYPE_BOOLEAN, |
| 11512 | 1, |
| 11513 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 11514 | |
| 11515 | /** |
| 11516 | * SharedResource::handle-is-locked: |
| 11517 | * @object: A #SharedResource. |
| 11518 | * @invocation: A #GDBusMethodInvocation. |
| 11519 | * |
| 11520 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. |
| 11521 | * |
| 11522 | * 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. |
| 11523 | * |
| 11524 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11525 | */ |
| 11526 | g_signal_new ("handle-is-locked", |
| 11527 | G_TYPE_FROM_INTERFACE (iface), |
| 11528 | G_SIGNAL_RUN_LAST, |
| 11529 | G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked), |
| 11530 | g_signal_accumulator_true_handled, |
| 11531 | NULL, |
| 11532 | g_cclosure_marshal_generic, |
| 11533 | G_TYPE_BOOLEAN, |
| 11534 | 1, |
| 11535 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 11536 | |
| 11537 | /* GObject properties for D-Bus properties: */ |
| 11538 | /** |
| 11539 | * SharedResource:lock: |
| 11540 | * |
| 11541 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>. |
| 11542 | * |
| 11543 | * 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. |
| 11544 | */ |
| 11545 | g_object_interface_install_property (iface, |
| 11546 | g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11547 | /** |
| 11548 | * SharedResource:name: |
| 11549 | * |
| 11550 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>. |
| 11551 | * |
| 11552 | * 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. |
| 11553 | */ |
| 11554 | g_object_interface_install_property (iface, |
| 11555 | g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11556 | } |
| 11557 | |
| 11558 | /** |
| 11559 | * shared_resource_get_lock: (skip) |
| 11560 | * @object: A #SharedResource. |
| 11561 | * |
| 11562 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property. |
| 11563 | * |
| 11564 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 11565 | * |
| 11566 | * Returns: The property value. |
| 11567 | */ |
| 11568 | gboolean |
| 11569 | shared_resource_get_lock (SharedResource *object) |
| 11570 | { |
| 11571 | return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object); |
| 11572 | } |
| 11573 | |
| 11574 | /** |
| 11575 | * shared_resource_set_lock: (skip) |
| 11576 | * @object: A #SharedResource. |
| 11577 | * @value: The value to set. |
| 11578 | * |
| 11579 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value. |
| 11580 | * |
| 11581 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 11582 | */ |
| 11583 | void |
| 11584 | shared_resource_set_lock (SharedResource *object, gboolean value) |
| 11585 | { |
| 11586 | g_object_set (G_OBJECT (object), "lock", value, NULL); |
| 11587 | } |
| 11588 | |
| 11589 | /** |
| 11590 | * shared_resource_get_name: (skip) |
| 11591 | * @object: A #SharedResource. |
| 11592 | * |
| 11593 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 11594 | * |
| 11595 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 11596 | * |
| 11597 | * <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> |
| 11598 | * |
| 11599 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 11600 | */ |
| 11601 | const gchar * |
| 11602 | shared_resource_get_name (SharedResource *object) |
| 11603 | { |
| 11604 | return SHARED_RESOURCE_GET_IFACE (object)->get_name (object); |
| 11605 | } |
| 11606 | |
| 11607 | /** |
| 11608 | * shared_resource_dup_name: (skip) |
| 11609 | * @object: A #SharedResource. |
| 11610 | * |
| 11611 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 11612 | * |
| 11613 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 11614 | * |
| 11615 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 11616 | */ |
| 11617 | gchar * |
| 11618 | shared_resource_dup_name (SharedResource *object) |
| 11619 | { |
| 11620 | gchar *value; |
| 11621 | g_object_get (G_OBJECT (object), "name", &value, NULL); |
| 11622 | return value; |
| 11623 | } |
| 11624 | |
| 11625 | /** |
| 11626 | * shared_resource_set_name: (skip) |
| 11627 | * @object: A #SharedResource. |
| 11628 | * @value: The value to set. |
| 11629 | * |
| 11630 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value. |
| 11631 | * |
| 11632 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 11633 | */ |
| 11634 | void |
| 11635 | shared_resource_set_name (SharedResource *object, const gchar *value) |
| 11636 | { |
| 11637 | g_object_set (G_OBJECT (object), "name", value, NULL); |
| 11638 | } |
| 11639 | |
| 11640 | /** |
| 11641 | * shared_resource_call_lock: |
| 11642 | * @proxy: A #SharedResourceProxy. |
| 11643 | * @arg_name: Argument to pass with the method invocation. |
| 11644 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11645 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 11646 | * @user_data: User data to pass to @callback. |
| 11647 | * |
| 11648 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. |
| 11649 | * 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. |
| 11650 | * You can then call shared_resource_call_lock_finish() to get the result of the operation. |
| 11651 | * |
| 11652 | * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method. |
| 11653 | */ |
| 11654 | void |
| 11655 | shared_resource_call_lock ( |
| 11656 | SharedResource *proxy, |
| 11657 | const gchar *arg_name, |
| 11658 | GCancellable *cancellable, |
| 11659 | GAsyncReadyCallback callback, |
| 11660 | gpointer user_data) |
| 11661 | { |
| 11662 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 11663 | "lock", |
| 11664 | g_variant_new ("(s)", |
| 11665 | arg_name), |
| 11666 | G_DBUS_CALL_FLAGS_NONE, |
| 11667 | -1, |
| 11668 | cancellable, |
| 11669 | callback, |
| 11670 | user_data); |
| 11671 | } |
| 11672 | |
| 11673 | /** |
| 11674 | * shared_resource_call_lock_finish: |
| 11675 | * @proxy: A #SharedResourceProxy. |
| 11676 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock(). |
| 11677 | * @error: Return location for error or %NULL. |
| 11678 | * |
| 11679 | * Finishes an operation started with shared_resource_call_lock(). |
| 11680 | * |
| 11681 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11682 | */ |
| 11683 | gboolean |
| 11684 | shared_resource_call_lock_finish ( |
| 11685 | SharedResource *proxy, |
| 11686 | GAsyncResult *res, |
| 11687 | GError **error) |
| 11688 | { |
| 11689 | GVariant *_ret; |
| 11690 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 11691 | if (_ret == NULL) |
| 11692 | goto _out; |
| 11693 | g_variant_get (_ret, |
| 11694 | "()"); |
| 11695 | g_variant_unref (_ret); |
| 11696 | _out: |
| 11697 | return _ret != NULL; |
| 11698 | } |
| 11699 | |
| 11700 | /** |
| 11701 | * shared_resource_call_lock_sync: |
| 11702 | * @proxy: A #SharedResourceProxy. |
| 11703 | * @arg_name: Argument to pass with the method invocation. |
| 11704 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11705 | * @error: Return location for error or %NULL. |
| 11706 | * |
| 11707 | * 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. |
| 11708 | * |
| 11709 | * See shared_resource_call_lock() for the asynchronous version of this method. |
| 11710 | * |
| 11711 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11712 | */ |
| 11713 | gboolean |
| 11714 | shared_resource_call_lock_sync ( |
| 11715 | SharedResource *proxy, |
| 11716 | const gchar *arg_name, |
| 11717 | GCancellable *cancellable, |
| 11718 | GError **error) |
| 11719 | { |
| 11720 | GVariant *_ret; |
| 11721 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 11722 | "lock", |
| 11723 | g_variant_new ("(s)", |
| 11724 | arg_name), |
| 11725 | G_DBUS_CALL_FLAGS_NONE, |
| 11726 | -1, |
| 11727 | cancellable, |
| 11728 | error); |
| 11729 | if (_ret == NULL) |
| 11730 | goto _out; |
| 11731 | g_variant_get (_ret, |
| 11732 | "()"); |
| 11733 | g_variant_unref (_ret); |
| 11734 | _out: |
| 11735 | return _ret != NULL; |
| 11736 | } |
| 11737 | |
| 11738 | /** |
| 11739 | * shared_resource_call_unlock: |
| 11740 | * @proxy: A #SharedResourceProxy. |
| 11741 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11742 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 11743 | * @user_data: User data to pass to @callback. |
| 11744 | * |
| 11745 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. |
| 11746 | * 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. |
| 11747 | * You can then call shared_resource_call_unlock_finish() to get the result of the operation. |
| 11748 | * |
| 11749 | * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method. |
| 11750 | */ |
| 11751 | void |
| 11752 | shared_resource_call_unlock ( |
| 11753 | SharedResource *proxy, |
| 11754 | GCancellable *cancellable, |
| 11755 | GAsyncReadyCallback callback, |
| 11756 | gpointer user_data) |
| 11757 | { |
| 11758 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 11759 | "unlock", |
| 11760 | g_variant_new ("()"), |
| 11761 | G_DBUS_CALL_FLAGS_NONE, |
| 11762 | -1, |
| 11763 | cancellable, |
| 11764 | callback, |
| 11765 | user_data); |
| 11766 | } |
| 11767 | |
| 11768 | /** |
| 11769 | * shared_resource_call_unlock_finish: |
| 11770 | * @proxy: A #SharedResourceProxy. |
| 11771 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock(). |
| 11772 | * @error: Return location for error or %NULL. |
| 11773 | * |
| 11774 | * Finishes an operation started with shared_resource_call_unlock(). |
| 11775 | * |
| 11776 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11777 | */ |
| 11778 | gboolean |
| 11779 | shared_resource_call_unlock_finish ( |
| 11780 | SharedResource *proxy, |
| 11781 | GAsyncResult *res, |
| 11782 | GError **error) |
| 11783 | { |
| 11784 | GVariant *_ret; |
| 11785 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 11786 | if (_ret == NULL) |
| 11787 | goto _out; |
| 11788 | g_variant_get (_ret, |
| 11789 | "()"); |
| 11790 | g_variant_unref (_ret); |
| 11791 | _out: |
| 11792 | return _ret != NULL; |
| 11793 | } |
| 11794 | |
| 11795 | /** |
| 11796 | * shared_resource_call_unlock_sync: |
| 11797 | * @proxy: A #SharedResourceProxy. |
| 11798 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11799 | * @error: Return location for error or %NULL. |
| 11800 | * |
| 11801 | * 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. |
| 11802 | * |
| 11803 | * See shared_resource_call_unlock() for the asynchronous version of this method. |
| 11804 | * |
| 11805 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11806 | */ |
| 11807 | gboolean |
| 11808 | shared_resource_call_unlock_sync ( |
| 11809 | SharedResource *proxy, |
| 11810 | GCancellable *cancellable, |
| 11811 | GError **error) |
| 11812 | { |
| 11813 | GVariant *_ret; |
| 11814 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 11815 | "unlock", |
| 11816 | g_variant_new ("()"), |
| 11817 | G_DBUS_CALL_FLAGS_NONE, |
| 11818 | -1, |
| 11819 | cancellable, |
| 11820 | error); |
| 11821 | if (_ret == NULL) |
| 11822 | goto _out; |
| 11823 | g_variant_get (_ret, |
| 11824 | "()"); |
| 11825 | g_variant_unref (_ret); |
| 11826 | _out: |
| 11827 | return _ret != NULL; |
| 11828 | } |
| 11829 | |
| 11830 | /** |
| 11831 | * shared_resource_call_is_locked: |
| 11832 | * @proxy: A #SharedResourceProxy. |
| 11833 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11834 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 11835 | * @user_data: User data to pass to @callback. |
| 11836 | * |
| 11837 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. |
| 11838 | * 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. |
| 11839 | * You can then call shared_resource_call_is_locked_finish() to get the result of the operation. |
| 11840 | * |
| 11841 | * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method. |
| 11842 | */ |
| 11843 | void |
| 11844 | shared_resource_call_is_locked ( |
| 11845 | SharedResource *proxy, |
| 11846 | GCancellable *cancellable, |
| 11847 | GAsyncReadyCallback callback, |
| 11848 | gpointer user_data) |
| 11849 | { |
| 11850 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 11851 | "isLocked", |
| 11852 | g_variant_new ("()"), |
| 11853 | G_DBUS_CALL_FLAGS_NONE, |
| 11854 | -1, |
| 11855 | cancellable, |
| 11856 | callback, |
| 11857 | user_data); |
| 11858 | } |
| 11859 | |
| 11860 | /** |
| 11861 | * shared_resource_call_is_locked_finish: |
| 11862 | * @proxy: A #SharedResourceProxy. |
| 11863 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 11864 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 11865 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked(). |
| 11866 | * @error: Return location for error or %NULL. |
| 11867 | * |
| 11868 | * Finishes an operation started with shared_resource_call_is_locked(). |
| 11869 | * |
| 11870 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11871 | */ |
| 11872 | gboolean |
| 11873 | shared_resource_call_is_locked_finish ( |
| 11874 | SharedResource *proxy, |
| 11875 | gboolean *out_lock, |
| 11876 | gchar **out_name, |
| 11877 | GAsyncResult *res, |
| 11878 | GError **error) |
| 11879 | { |
| 11880 | GVariant *_ret; |
| 11881 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 11882 | if (_ret == NULL) |
| 11883 | goto _out; |
| 11884 | g_variant_get (_ret, |
| 11885 | "(bs)", |
| 11886 | out_lock, |
| 11887 | out_name); |
| 11888 | g_variant_unref (_ret); |
| 11889 | _out: |
| 11890 | return _ret != NULL; |
| 11891 | } |
| 11892 | |
| 11893 | /** |
| 11894 | * shared_resource_call_is_locked_sync: |
| 11895 | * @proxy: A #SharedResourceProxy. |
| 11896 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 11897 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 11898 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11899 | * @error: Return location for error or %NULL. |
| 11900 | * |
| 11901 | * 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. |
| 11902 | * |
| 11903 | * See shared_resource_call_is_locked() for the asynchronous version of this method. |
| 11904 | * |
| 11905 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 11906 | */ |
| 11907 | gboolean |
| 11908 | shared_resource_call_is_locked_sync ( |
| 11909 | SharedResource *proxy, |
| 11910 | gboolean *out_lock, |
| 11911 | gchar **out_name, |
| 11912 | GCancellable *cancellable, |
| 11913 | GError **error) |
| 11914 | { |
| 11915 | GVariant *_ret; |
| 11916 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 11917 | "isLocked", |
| 11918 | g_variant_new ("()"), |
| 11919 | G_DBUS_CALL_FLAGS_NONE, |
| 11920 | -1, |
| 11921 | cancellable, |
| 11922 | error); |
| 11923 | if (_ret == NULL) |
| 11924 | goto _out; |
| 11925 | g_variant_get (_ret, |
| 11926 | "(bs)", |
| 11927 | out_lock, |
| 11928 | out_name); |
| 11929 | g_variant_unref (_ret); |
| 11930 | _out: |
| 11931 | return _ret != NULL; |
| 11932 | } |
| 11933 | |
| 11934 | /** |
| 11935 | * shared_resource_complete_lock: |
| 11936 | * @object: A #SharedResource. |
| 11937 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 11938 | * |
| 11939 | * 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. |
| 11940 | * |
| 11941 | * This method will free @invocation, you cannot use it afterwards. |
| 11942 | */ |
| 11943 | void |
| 11944 | shared_resource_complete_lock ( |
| 11945 | SharedResource *object, |
| 11946 | GDBusMethodInvocation *invocation) |
| 11947 | { |
| 11948 | g_dbus_method_invocation_return_value (invocation, |
| 11949 | g_variant_new ("()")); |
| 11950 | } |
| 11951 | |
| 11952 | /** |
| 11953 | * shared_resource_complete_unlock: |
| 11954 | * @object: A #SharedResource. |
| 11955 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 11956 | * |
| 11957 | * 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. |
| 11958 | * |
| 11959 | * This method will free @invocation, you cannot use it afterwards. |
| 11960 | */ |
| 11961 | void |
| 11962 | shared_resource_complete_unlock ( |
| 11963 | SharedResource *object, |
| 11964 | GDBusMethodInvocation *invocation) |
| 11965 | { |
| 11966 | g_dbus_method_invocation_return_value (invocation, |
| 11967 | g_variant_new ("()")); |
| 11968 | } |
| 11969 | |
| 11970 | /** |
| 11971 | * shared_resource_complete_is_locked: |
| 11972 | * @object: A #SharedResource. |
| 11973 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 11974 | * @lock: Parameter to return. |
| 11975 | * @name: Parameter to return. |
| 11976 | * |
| 11977 | * 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. |
| 11978 | * |
| 11979 | * This method will free @invocation, you cannot use it afterwards. |
| 11980 | */ |
| 11981 | void |
| 11982 | shared_resource_complete_is_locked ( |
| 11983 | SharedResource *object, |
| 11984 | GDBusMethodInvocation *invocation, |
| 11985 | gboolean lock, |
| 11986 | const gchar *name) |
| 11987 | { |
| 11988 | g_dbus_method_invocation_return_value (invocation, |
| 11989 | g_variant_new ("(bs)", |
| 11990 | lock, |
| 11991 | name)); |
| 11992 | } |
| 11993 | |
| 11994 | /* ------------------------------------------------------------------------ */ |
| 11995 | |
| 11996 | /** |
| 11997 | * SharedResourceProxy: |
| 11998 | * |
| 11999 | * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API. |
| 12000 | */ |
| 12001 | |
| 12002 | /** |
| 12003 | * SharedResourceProxyClass: |
| 12004 | * @parent_class: The parent class. |
| 12005 | * |
| 12006 | * Class structure for #SharedResourceProxy. |
| 12007 | */ |
| 12008 | |
| 12009 | struct _SharedResourceProxyPrivate |
| 12010 | { |
| 12011 | GData *qdata; |
| 12012 | }; |
| 12013 | |
| 12014 | static void shared_resource_proxy_iface_init (SharedResourceIface *iface); |
| 12015 | |
| 12016 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12017 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 12018 | G_ADD_PRIVATE (SharedResourceProxy) |
| 12019 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 12020 | |
| 12021 | #else |
| 12022 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 12023 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 12024 | |
| 12025 | #endif |
| 12026 | static void |
| 12027 | shared_resource_proxy_finalize (GObject *object) |
| 12028 | { |
| 12029 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 12030 | g_datalist_clear (&proxy->priv->qdata); |
| 12031 | G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object); |
| 12032 | } |
| 12033 | |
| 12034 | static void |
| 12035 | shared_resource_proxy_get_property (GObject *object, |
| 12036 | guint prop_id, |
| 12037 | GValue *value, |
| 12038 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12039 | { |
| 12040 | const _ExtendedGDBusPropertyInfo *info; |
| 12041 | GVariant *variant; |
| 12042 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12043 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 12044 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 12045 | if (info->use_gvariant) |
| 12046 | { |
| 12047 | g_value_set_variant (value, variant); |
| 12048 | } |
| 12049 | else |
| 12050 | { |
| 12051 | if (variant != NULL) |
| 12052 | g_dbus_gvariant_to_gvalue (variant, value); |
| 12053 | } |
| 12054 | if (variant != NULL) |
| 12055 | g_variant_unref (variant); |
| 12056 | } |
| 12057 | |
| 12058 | static void |
| 12059 | shared_resource_proxy_set_property_cb (GDBusProxy *proxy, |
| 12060 | GAsyncResult *res, |
| 12061 | gpointer user_data) |
| 12062 | { |
| 12063 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 12064 | GError *error; |
| 12065 | GVariant *_ret; |
| 12066 | error = NULL; |
| 12067 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 12068 | if (!_ret) |
| 12069 | { |
| 12070 | g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)", |
| 12071 | info->parent_struct.name, |
| 12072 | error->message, g_quark_to_string (error->domain), error->code); |
| 12073 | g_error_free (error); |
| 12074 | } |
| 12075 | else |
| 12076 | { |
| 12077 | g_variant_unref (_ret); |
| 12078 | } |
| 12079 | } |
| 12080 | |
| 12081 | static void |
| 12082 | shared_resource_proxy_set_property (GObject *object, |
| 12083 | guint prop_id, |
| 12084 | const GValue *value, |
| 12085 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12086 | { |
| 12087 | const _ExtendedGDBusPropertyInfo *info; |
| 12088 | GVariant *variant; |
| 12089 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12090 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 12091 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 12092 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 12093 | "org.freedesktop.DBus.Properties.Set", |
| 12094 | g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant), |
| 12095 | G_DBUS_CALL_FLAGS_NONE, |
| 12096 | -1, |
| 12097 | NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 12098 | g_variant_unref (variant); |
| 12099 | } |
| 12100 | |
| 12101 | static void |
| 12102 | shared_resource_proxy_g_signal (GDBusProxy *proxy, |
| 12103 | const gchar *sender_name G_GNUC_UNUSED, |
| 12104 | const gchar *signal_name, |
| 12105 | GVariant *parameters) |
| 12106 | { |
| 12107 | _ExtendedGDBusSignalInfo *info; |
| 12108 | GVariantIter iter; |
| 12109 | GVariant *child; |
| 12110 | GValue *paramv; |
| 12111 | guint num_params; |
| 12112 | guint n; |
| 12113 | guint signal_id; |
| 12114 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name); |
| 12115 | if (info == NULL) |
| 12116 | return; |
| 12117 | num_params = g_variant_n_children (parameters); |
| 12118 | paramv = g_new0 (GValue, num_params + 1); |
| 12119 | g_value_init (¶mv[0], TYPE_SHARED_RESOURCE); |
| 12120 | g_value_set_object (¶mv[0], proxy); |
| 12121 | g_variant_iter_init (&iter, parameters); |
| 12122 | n = 1; |
| 12123 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12124 | { |
| 12125 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 12126 | if (arg_info->use_gvariant) |
| 12127 | { |
| 12128 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12129 | g_value_set_variant (¶mv[n], child); |
| 12130 | n++; |
| 12131 | } |
| 12132 | else |
| 12133 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12134 | g_variant_unref (child); |
| 12135 | } |
| 12136 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 12137 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 12138 | for (n = 0; n < num_params + 1; n++) |
| 12139 | g_value_unset (¶mv[n]); |
| 12140 | g_free (paramv); |
| 12141 | } |
| 12142 | |
| 12143 | static void |
| 12144 | shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 12145 | GVariant *changed_properties, |
| 12146 | const gchar *const *invalidated_properties) |
| 12147 | { |
| 12148 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy); |
| 12149 | guint n; |
| 12150 | const gchar *key; |
| 12151 | GVariantIter *iter; |
| 12152 | _ExtendedGDBusPropertyInfo *info; |
| 12153 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 12154 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 12155 | { |
| 12156 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key); |
| 12157 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 12158 | if (info != NULL) |
| 12159 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12160 | } |
| 12161 | g_variant_iter_free (iter); |
| 12162 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 12163 | { |
| 12164 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]); |
| 12165 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 12166 | if (info != NULL) |
| 12167 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12168 | } |
| 12169 | } |
| 12170 | |
| 12171 | static gboolean |
| 12172 | shared_resource_proxy_get_lock (SharedResource *object) |
| 12173 | { |
| 12174 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 12175 | GVariant *variant; |
| 12176 | gboolean value = 0; |
| 12177 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock"); |
| 12178 | if (variant != NULL) |
| 12179 | { |
| 12180 | value = g_variant_get_boolean (variant); |
| 12181 | g_variant_unref (variant); |
| 12182 | } |
| 12183 | return value; |
| 12184 | } |
| 12185 | |
| 12186 | static const gchar * |
| 12187 | shared_resource_proxy_get_name (SharedResource *object) |
| 12188 | { |
| 12189 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 12190 | GVariant *variant; |
| 12191 | const gchar *value = NULL; |
| 12192 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name"); |
| 12193 | if (variant != NULL) |
| 12194 | { |
| 12195 | value = g_variant_get_string (variant, NULL); |
| 12196 | g_variant_unref (variant); |
| 12197 | } |
| 12198 | return value; |
| 12199 | } |
| 12200 | |
| 12201 | static void |
| 12202 | shared_resource_proxy_init (SharedResourceProxy *proxy) |
| 12203 | { |
| 12204 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12205 | proxy->priv = shared_resource_proxy_get_instance_private (proxy); |
| 12206 | #else |
| 12207 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate); |
| 12208 | #endif |
| 12209 | |
| 12210 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ()); |
| 12211 | } |
| 12212 | |
| 12213 | static void |
| 12214 | shared_resource_proxy_class_init (SharedResourceProxyClass *klass) |
| 12215 | { |
| 12216 | GObjectClass *gobject_class; |
| 12217 | GDBusProxyClass *proxy_class; |
| 12218 | |
| 12219 | gobject_class = G_OBJECT_CLASS (klass); |
| 12220 | gobject_class->finalize = shared_resource_proxy_finalize; |
| 12221 | gobject_class->get_property = shared_resource_proxy_get_property; |
| 12222 | gobject_class->set_property = shared_resource_proxy_set_property; |
| 12223 | |
| 12224 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 12225 | proxy_class->g_signal = shared_resource_proxy_g_signal; |
| 12226 | proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed; |
| 12227 | |
| 12228 | shared_resource_override_properties (gobject_class, 1); |
| 12229 | |
| 12230 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12231 | g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate)); |
| 12232 | #endif |
| 12233 | } |
| 12234 | |
| 12235 | static void |
| 12236 | shared_resource_proxy_iface_init (SharedResourceIface *iface) |
| 12237 | { |
| 12238 | iface->get_lock = shared_resource_proxy_get_lock; |
| 12239 | iface->get_name = shared_resource_proxy_get_name; |
| 12240 | } |
| 12241 | |
| 12242 | /** |
| 12243 | * shared_resource_proxy_new: |
| 12244 | * @connection: A #GDBusConnection. |
| 12245 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12246 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12247 | * @object_path: An object path. |
| 12248 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12249 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12250 | * @user_data: User data to pass to @callback. |
| 12251 | * |
| 12252 | * 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. |
| 12253 | * |
| 12254 | * 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. |
| 12255 | * You can then call shared_resource_proxy_new_finish() to get the result of the operation. |
| 12256 | * |
| 12257 | * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 12258 | */ |
| 12259 | void |
| 12260 | shared_resource_proxy_new ( |
| 12261 | GDBusConnection *connection, |
| 12262 | GDBusProxyFlags flags, |
| 12263 | const gchar *name, |
| 12264 | const gchar *object_path, |
| 12265 | GCancellable *cancellable, |
| 12266 | GAsyncReadyCallback callback, |
| 12267 | gpointer user_data) |
| 12268 | { |
| 12269 | 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); |
| 12270 | } |
| 12271 | |
| 12272 | /** |
| 12273 | * shared_resource_proxy_new_finish: |
| 12274 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new(). |
| 12275 | * @error: Return location for error or %NULL |
| 12276 | * |
| 12277 | * Finishes an operation started with shared_resource_proxy_new(). |
| 12278 | * |
| 12279 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 12280 | */ |
| 12281 | SharedResource * |
| 12282 | shared_resource_proxy_new_finish ( |
| 12283 | GAsyncResult *res, |
| 12284 | GError **error) |
| 12285 | { |
| 12286 | GObject *ret; |
| 12287 | GObject *source_object; |
| 12288 | source_object = g_async_result_get_source_object (res); |
| 12289 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12290 | g_object_unref (source_object); |
| 12291 | if (ret != NULL) |
| 12292 | return SHARED_RESOURCE (ret); |
| 12293 | else |
| 12294 | return NULL; |
| 12295 | } |
| 12296 | |
| 12297 | /** |
| 12298 | * shared_resource_proxy_new_sync: |
| 12299 | * @connection: A #GDBusConnection. |
| 12300 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12301 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12302 | * @object_path: An object path. |
| 12303 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12304 | * @error: Return location for error or %NULL |
| 12305 | * |
| 12306 | * 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. |
| 12307 | * |
| 12308 | * The calling thread is blocked until a reply is received. |
| 12309 | * |
| 12310 | * See shared_resource_proxy_new() for the asynchronous version of this constructor. |
| 12311 | * |
| 12312 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 12313 | */ |
| 12314 | SharedResource * |
| 12315 | shared_resource_proxy_new_sync ( |
| 12316 | GDBusConnection *connection, |
| 12317 | GDBusProxyFlags flags, |
| 12318 | const gchar *name, |
| 12319 | const gchar *object_path, |
| 12320 | GCancellable *cancellable, |
| 12321 | GError **error) |
| 12322 | { |
| 12323 | GInitable *ret; |
| 12324 | 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); |
| 12325 | if (ret != NULL) |
| 12326 | return SHARED_RESOURCE (ret); |
| 12327 | else |
| 12328 | return NULL; |
| 12329 | } |
| 12330 | |
| 12331 | |
| 12332 | /** |
| 12333 | * shared_resource_proxy_new_for_bus: |
| 12334 | * @bus_type: A #GBusType. |
| 12335 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12336 | * @name: A bus name (well-known or unique). |
| 12337 | * @object_path: An object path. |
| 12338 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12339 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12340 | * @user_data: User data to pass to @callback. |
| 12341 | * |
| 12342 | * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 12343 | * |
| 12344 | * 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. |
| 12345 | * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation. |
| 12346 | * |
| 12347 | * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 12348 | */ |
| 12349 | void |
| 12350 | shared_resource_proxy_new_for_bus ( |
| 12351 | GBusType bus_type, |
| 12352 | GDBusProxyFlags flags, |
| 12353 | const gchar *name, |
| 12354 | const gchar *object_path, |
| 12355 | GCancellable *cancellable, |
| 12356 | GAsyncReadyCallback callback, |
| 12357 | gpointer user_data) |
| 12358 | { |
| 12359 | 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); |
| 12360 | } |
| 12361 | |
| 12362 | /** |
| 12363 | * shared_resource_proxy_new_for_bus_finish: |
| 12364 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus(). |
| 12365 | * @error: Return location for error or %NULL |
| 12366 | * |
| 12367 | * Finishes an operation started with shared_resource_proxy_new_for_bus(). |
| 12368 | * |
| 12369 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 12370 | */ |
| 12371 | SharedResource * |
| 12372 | shared_resource_proxy_new_for_bus_finish ( |
| 12373 | GAsyncResult *res, |
| 12374 | GError **error) |
| 12375 | { |
| 12376 | GObject *ret; |
| 12377 | GObject *source_object; |
| 12378 | source_object = g_async_result_get_source_object (res); |
| 12379 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12380 | g_object_unref (source_object); |
| 12381 | if (ret != NULL) |
| 12382 | return SHARED_RESOURCE (ret); |
| 12383 | else |
| 12384 | return NULL; |
| 12385 | } |
| 12386 | |
| 12387 | /** |
| 12388 | * shared_resource_proxy_new_for_bus_sync: |
| 12389 | * @bus_type: A #GBusType. |
| 12390 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12391 | * @name: A bus name (well-known or unique). |
| 12392 | * @object_path: An object path. |
| 12393 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12394 | * @error: Return location for error or %NULL |
| 12395 | * |
| 12396 | * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 12397 | * |
| 12398 | * The calling thread is blocked until a reply is received. |
| 12399 | * |
| 12400 | * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 12401 | * |
| 12402 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 12403 | */ |
| 12404 | SharedResource * |
| 12405 | shared_resource_proxy_new_for_bus_sync ( |
| 12406 | GBusType bus_type, |
| 12407 | GDBusProxyFlags flags, |
| 12408 | const gchar *name, |
| 12409 | const gchar *object_path, |
| 12410 | GCancellable *cancellable, |
| 12411 | GError **error) |
| 12412 | { |
| 12413 | GInitable *ret; |
| 12414 | 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); |
| 12415 | if (ret != NULL) |
| 12416 | return SHARED_RESOURCE (ret); |
| 12417 | else |
| 12418 | return NULL; |
| 12419 | } |
| 12420 | |
| 12421 | |
| 12422 | /* ------------------------------------------------------------------------ */ |
| 12423 | |
| 12424 | /** |
| 12425 | * SharedResourceSkeleton: |
| 12426 | * |
| 12427 | * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API. |
| 12428 | */ |
| 12429 | |
| 12430 | /** |
| 12431 | * SharedResourceSkeletonClass: |
| 12432 | * @parent_class: The parent class. |
| 12433 | * |
| 12434 | * Class structure for #SharedResourceSkeleton. |
| 12435 | */ |
| 12436 | |
| 12437 | struct _SharedResourceSkeletonPrivate |
| 12438 | { |
| 12439 | GValue *properties; |
| 12440 | GList *changed_properties; |
| 12441 | GSource *changed_properties_idle_source; |
| 12442 | GMainContext *context; |
| 12443 | GMutex lock; |
| 12444 | }; |
| 12445 | |
| 12446 | static void |
| 12447 | _shared_resource_skeleton_handle_method_call ( |
| 12448 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12449 | const gchar *sender G_GNUC_UNUSED, |
| 12450 | const gchar *object_path G_GNUC_UNUSED, |
| 12451 | const gchar *interface_name, |
| 12452 | const gchar *method_name, |
| 12453 | GVariant *parameters, |
| 12454 | GDBusMethodInvocation *invocation, |
| 12455 | gpointer user_data) |
| 12456 | { |
| 12457 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 12458 | _ExtendedGDBusMethodInfo *info; |
| 12459 | GVariantIter iter; |
| 12460 | GVariant *child; |
| 12461 | GValue *paramv; |
| 12462 | guint num_params; |
| 12463 | guint num_extra; |
| 12464 | guint n; |
| 12465 | guint signal_id; |
| 12466 | GValue return_value = G_VALUE_INIT; |
| 12467 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 12468 | g_assert (info != NULL); |
| 12469 | num_params = g_variant_n_children (parameters); |
| 12470 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 12471 | n = 0; |
| 12472 | g_value_init (¶mv[n], TYPE_SHARED_RESOURCE); |
| 12473 | g_value_set_object (¶mv[n++], skeleton); |
| 12474 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 12475 | g_value_set_object (¶mv[n++], invocation); |
| 12476 | if (info->pass_fdlist) |
| 12477 | { |
| 12478 | #ifdef G_OS_UNIX |
| 12479 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 12480 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 12481 | #else |
| 12482 | g_assert_not_reached (); |
| 12483 | #endif |
| 12484 | } |
| 12485 | g_variant_iter_init (&iter, parameters); |
| 12486 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12487 | { |
| 12488 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 12489 | if (arg_info->use_gvariant) |
| 12490 | { |
| 12491 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12492 | g_value_set_variant (¶mv[n], child); |
| 12493 | n++; |
| 12494 | } |
| 12495 | else |
| 12496 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12497 | g_variant_unref (child); |
| 12498 | } |
| 12499 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 12500 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 12501 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 12502 | if (!g_value_get_boolean (&return_value)) |
| 12503 | 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); |
| 12504 | g_value_unset (&return_value); |
| 12505 | for (n = 0; n < num_params + num_extra; n++) |
| 12506 | g_value_unset (¶mv[n]); |
| 12507 | g_free (paramv); |
| 12508 | } |
| 12509 | |
| 12510 | static GVariant * |
| 12511 | _shared_resource_skeleton_handle_get_property ( |
| 12512 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12513 | const gchar *sender G_GNUC_UNUSED, |
| 12514 | const gchar *object_path G_GNUC_UNUSED, |
| 12515 | const gchar *interface_name G_GNUC_UNUSED, |
| 12516 | const gchar *property_name, |
| 12517 | GError **error, |
| 12518 | gpointer user_data) |
| 12519 | { |
| 12520 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 12521 | GValue value = G_VALUE_INIT; |
| 12522 | GParamSpec *pspec; |
| 12523 | _ExtendedGDBusPropertyInfo *info; |
| 12524 | GVariant *ret; |
| 12525 | ret = NULL; |
| 12526 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 12527 | g_assert (info != NULL); |
| 12528 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12529 | if (pspec == NULL) |
| 12530 | { |
| 12531 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12532 | } |
| 12533 | else |
| 12534 | { |
| 12535 | g_value_init (&value, pspec->value_type); |
| 12536 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12537 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 12538 | g_value_unset (&value); |
| 12539 | } |
| 12540 | return ret; |
| 12541 | } |
| 12542 | |
| 12543 | static gboolean |
| 12544 | _shared_resource_skeleton_handle_set_property ( |
| 12545 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12546 | const gchar *sender G_GNUC_UNUSED, |
| 12547 | const gchar *object_path G_GNUC_UNUSED, |
| 12548 | const gchar *interface_name G_GNUC_UNUSED, |
| 12549 | const gchar *property_name, |
| 12550 | GVariant *variant, |
| 12551 | GError **error, |
| 12552 | gpointer user_data) |
| 12553 | { |
| 12554 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 12555 | GValue value = G_VALUE_INIT; |
| 12556 | GParamSpec *pspec; |
| 12557 | _ExtendedGDBusPropertyInfo *info; |
| 12558 | gboolean ret; |
| 12559 | ret = FALSE; |
| 12560 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 12561 | g_assert (info != NULL); |
| 12562 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12563 | if (pspec == NULL) |
| 12564 | { |
| 12565 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12566 | } |
| 12567 | else |
| 12568 | { |
| 12569 | if (info->use_gvariant) |
| 12570 | g_value_set_variant (&value, variant); |
| 12571 | else |
| 12572 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 12573 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12574 | g_value_unset (&value); |
| 12575 | ret = TRUE; |
| 12576 | } |
| 12577 | return ret; |
| 12578 | } |
| 12579 | |
| 12580 | static const GDBusInterfaceVTable _shared_resource_skeleton_vtable = |
| 12581 | { |
| 12582 | _shared_resource_skeleton_handle_method_call, |
| 12583 | _shared_resource_skeleton_handle_get_property, |
| 12584 | _shared_resource_skeleton_handle_set_property, |
| 12585 | {NULL} |
| 12586 | }; |
| 12587 | |
| 12588 | static GDBusInterfaceInfo * |
| 12589 | shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 12590 | { |
| 12591 | return shared_resource_interface_info (); |
| 12592 | } |
| 12593 | |
| 12594 | static GDBusInterfaceVTable * |
| 12595 | shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 12596 | { |
| 12597 | return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable; |
| 12598 | } |
| 12599 | |
| 12600 | static GVariant * |
| 12601 | shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 12602 | { |
| 12603 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 12604 | |
| 12605 | GVariantBuilder builder; |
| 12606 | guint n; |
| 12607 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12608 | if (_shared_resource_interface_info.parent_struct.properties == NULL) |
| 12609 | goto out; |
| 12610 | for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++) |
| 12611 | { |
| 12612 | GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n]; |
| 12613 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 12614 | { |
| 12615 | GVariant *value; |
| 12616 | 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); |
| 12617 | if (value != NULL) |
| 12618 | { |
| 12619 | g_variant_take_ref (value); |
| 12620 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 12621 | g_variant_unref (value); |
| 12622 | } |
| 12623 | } |
| 12624 | } |
| 12625 | out: |
| 12626 | return g_variant_builder_end (&builder); |
| 12627 | } |
| 12628 | |
| 12629 | static gboolean _shared_resource_emit_changed (gpointer user_data); |
| 12630 | |
| 12631 | static void |
| 12632 | shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 12633 | { |
| 12634 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 12635 | gboolean emit_changed = FALSE; |
| 12636 | |
| 12637 | g_mutex_lock (&skeleton->priv->lock); |
| 12638 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12639 | { |
| 12640 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12641 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12642 | emit_changed = TRUE; |
| 12643 | } |
| 12644 | g_mutex_unlock (&skeleton->priv->lock); |
| 12645 | |
| 12646 | if (emit_changed) |
| 12647 | _shared_resource_emit_changed (skeleton); |
| 12648 | } |
| 12649 | |
| 12650 | static void shared_resource_skeleton_iface_init (SharedResourceIface *iface); |
| 12651 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12652 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12653 | G_ADD_PRIVATE (SharedResourceSkeleton) |
| 12654 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 12655 | |
| 12656 | #else |
| 12657 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12658 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 12659 | |
| 12660 | #endif |
| 12661 | static void |
| 12662 | shared_resource_skeleton_finalize (GObject *object) |
| 12663 | { |
| 12664 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12665 | guint n; |
| 12666 | for (n = 0; n < 2; n++) |
| 12667 | g_value_unset (&skeleton->priv->properties[n]); |
| 12668 | g_free (skeleton->priv->properties); |
| 12669 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12670 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12671 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12672 | g_main_context_unref (skeleton->priv->context); |
| 12673 | g_mutex_clear (&skeleton->priv->lock); |
| 12674 | G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object); |
| 12675 | } |
| 12676 | |
| 12677 | static void |
| 12678 | shared_resource_skeleton_get_property (GObject *object, |
| 12679 | guint prop_id, |
| 12680 | GValue *value, |
| 12681 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12682 | { |
| 12683 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12684 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12685 | g_mutex_lock (&skeleton->priv->lock); |
| 12686 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 12687 | g_mutex_unlock (&skeleton->priv->lock); |
| 12688 | } |
| 12689 | |
| 12690 | static gboolean |
| 12691 | _shared_resource_emit_changed (gpointer user_data) |
| 12692 | { |
| 12693 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 12694 | GList *l; |
| 12695 | GVariantBuilder builder; |
| 12696 | GVariantBuilder invalidated_builder; |
| 12697 | guint num_changes; |
| 12698 | |
| 12699 | g_mutex_lock (&skeleton->priv->lock); |
| 12700 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12701 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 12702 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 12703 | { |
| 12704 | ChangedProperty *cp = l->data; |
| 12705 | GVariant *variant; |
| 12706 | const GValue *cur_value; |
| 12707 | |
| 12708 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 12709 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 12710 | { |
| 12711 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 12712 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 12713 | g_variant_unref (variant); |
| 12714 | num_changes++; |
| 12715 | } |
| 12716 | } |
| 12717 | if (num_changes > 0) |
| 12718 | { |
| 12719 | GList *connections, *ll; |
| 12720 | GVariant *signal_variant; |
| 12721 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource", |
| 12722 | &builder, &invalidated_builder)); |
| 12723 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12724 | for (ll = connections; ll != NULL; ll = ll->next) |
| 12725 | { |
| 12726 | GDBusConnection *connection = ll->data; |
| 12727 | |
| 12728 | g_dbus_connection_emit_signal (connection, |
| 12729 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 12730 | "org.freedesktop.DBus.Properties", |
| 12731 | "PropertiesChanged", |
| 12732 | signal_variant, |
| 12733 | NULL); |
| 12734 | } |
| 12735 | g_variant_unref (signal_variant); |
| 12736 | g_list_free_full (connections, g_object_unref); |
| 12737 | } |
| 12738 | else |
| 12739 | { |
| 12740 | g_variant_builder_clear (&builder); |
| 12741 | g_variant_builder_clear (&invalidated_builder); |
| 12742 | } |
| 12743 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12744 | skeleton->priv->changed_properties = NULL; |
| 12745 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12746 | g_mutex_unlock (&skeleton->priv->lock); |
| 12747 | return FALSE; |
| 12748 | } |
| 12749 | |
| 12750 | static void |
| 12751 | _shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 12752 | { |
| 12753 | ChangedProperty *cp; |
| 12754 | GList *l; |
| 12755 | cp = NULL; |
| 12756 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 12757 | { |
| 12758 | ChangedProperty *i_cp = l->data; |
| 12759 | if (i_cp->info == info) |
| 12760 | { |
| 12761 | cp = i_cp; |
| 12762 | break; |
| 12763 | } |
| 12764 | } |
| 12765 | if (cp == NULL) |
| 12766 | { |
| 12767 | cp = g_new0 (ChangedProperty, 1); |
| 12768 | cp->prop_id = prop_id; |
| 12769 | cp->info = info; |
| 12770 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 12771 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 12772 | g_value_copy (orig_value, &cp->orig_value); |
| 12773 | } |
| 12774 | } |
| 12775 | |
| 12776 | static void |
| 12777 | shared_resource_skeleton_notify (GObject *object, |
| 12778 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12779 | { |
| 12780 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12781 | g_mutex_lock (&skeleton->priv->lock); |
| 12782 | if (skeleton->priv->changed_properties != NULL && |
| 12783 | skeleton->priv->changed_properties_idle_source == NULL) |
| 12784 | { |
| 12785 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 12786 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 12787 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 12788 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 12789 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 12790 | } |
| 12791 | g_mutex_unlock (&skeleton->priv->lock); |
| 12792 | } |
| 12793 | |
| 12794 | static void |
| 12795 | shared_resource_skeleton_set_property (GObject *object, |
| 12796 | guint prop_id, |
| 12797 | const GValue *value, |
| 12798 | GParamSpec *pspec) |
| 12799 | { |
| 12800 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12801 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12802 | g_mutex_lock (&skeleton->priv->lock); |
| 12803 | g_object_freeze_notify (object); |
| 12804 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 12805 | { |
| 12806 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 12807 | _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 12808 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 12809 | g_object_notify_by_pspec (object, pspec); |
| 12810 | } |
| 12811 | g_mutex_unlock (&skeleton->priv->lock); |
| 12812 | g_object_thaw_notify (object); |
| 12813 | } |
| 12814 | |
| 12815 | static void |
| 12816 | shared_resource_skeleton_init (SharedResourceSkeleton *skeleton) |
| 12817 | { |
| 12818 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12819 | skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton); |
| 12820 | #else |
| 12821 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate); |
| 12822 | #endif |
| 12823 | |
| 12824 | g_mutex_init (&skeleton->priv->lock); |
| 12825 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 12826 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 12827 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
| 12828 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 12829 | } |
| 12830 | |
| 12831 | static gboolean |
| 12832 | shared_resource_skeleton_get_lock (SharedResource *object) |
| 12833 | { |
| 12834 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12835 | gboolean value; |
| 12836 | g_mutex_lock (&skeleton->priv->lock); |
| 12837 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 12838 | g_mutex_unlock (&skeleton->priv->lock); |
| 12839 | return value; |
| 12840 | } |
| 12841 | |
| 12842 | static const gchar * |
| 12843 | shared_resource_skeleton_get_name (SharedResource *object) |
| 12844 | { |
| 12845 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 12846 | const gchar *value; |
| 12847 | g_mutex_lock (&skeleton->priv->lock); |
| 12848 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 12849 | g_mutex_unlock (&skeleton->priv->lock); |
| 12850 | return value; |
| 12851 | } |
| 12852 | |
| 12853 | static void |
| 12854 | shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass) |
| 12855 | { |
| 12856 | GObjectClass *gobject_class; |
| 12857 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 12858 | |
| 12859 | gobject_class = G_OBJECT_CLASS (klass); |
| 12860 | gobject_class->finalize = shared_resource_skeleton_finalize; |
| 12861 | gobject_class->get_property = shared_resource_skeleton_get_property; |
| 12862 | gobject_class->set_property = shared_resource_skeleton_set_property; |
| 12863 | gobject_class->notify = shared_resource_skeleton_notify; |
| 12864 | |
| 12865 | |
| 12866 | shared_resource_override_properties (gobject_class, 1); |
| 12867 | |
| 12868 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 12869 | skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info; |
| 12870 | skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties; |
| 12871 | skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush; |
| 12872 | skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable; |
| 12873 | |
| 12874 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12875 | g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate)); |
| 12876 | #endif |
| 12877 | } |
| 12878 | |
| 12879 | static void |
| 12880 | shared_resource_skeleton_iface_init (SharedResourceIface *iface) |
| 12881 | { |
| 12882 | iface->get_lock = shared_resource_skeleton_get_lock; |
| 12883 | iface->get_name = shared_resource_skeleton_get_name; |
| 12884 | } |
| 12885 | |
| 12886 | /** |
| 12887 | * shared_resource_skeleton_new: |
| 12888 | * |
| 12889 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 12890 | * |
| 12891 | * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object. |
| 12892 | */ |
| 12893 | SharedResource * |
| 12894 | shared_resource_skeleton_new (void) |
| 12895 | { |
| 12896 | return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL)); |
| 12897 | } |
| 12898 | |
| 12899 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 12900 | * Code for interface org.openbmc.Control |
| 12901 | * ------------------------------------------------------------------------ |
| 12902 | */ |
| 12903 | |
| 12904 | /** |
| 12905 | * SECTION:Control |
| 12906 | * @title: Control |
| 12907 | * @short_description: Generated C code for the org.openbmc.Control D-Bus interface |
| 12908 | * |
| 12909 | * 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. |
| 12910 | */ |
| 12911 | |
| 12912 | /* ---- Introspection data for org.openbmc.Control ---- */ |
| 12913 | |
| 12914 | static const _ExtendedGDBusMethodInfo _control_method_info_init = |
| 12915 | { |
| 12916 | { |
| 12917 | -1, |
| 12918 | (gchar *) "init", |
| 12919 | NULL, |
| 12920 | NULL, |
| 12921 | NULL |
| 12922 | }, |
| 12923 | "handle-init", |
| 12924 | FALSE |
| 12925 | }; |
| 12926 | |
| 12927 | static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = |
| 12928 | { |
| 12929 | &_control_method_info_init, |
| 12930 | NULL |
| 12931 | }; |
| 12932 | |
| 12933 | static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name = |
| 12934 | { |
| 12935 | { |
| 12936 | -1, |
| 12937 | (gchar *) "bus_name", |
| 12938 | (gchar *) "s", |
| 12939 | NULL |
| 12940 | }, |
| 12941 | FALSE |
| 12942 | }; |
| 12943 | |
| 12944 | static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] = |
| 12945 | { |
| 12946 | &_control_signal_info_heartbeat_ARG_bus_name, |
| 12947 | NULL |
| 12948 | }; |
| 12949 | |
| 12950 | static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat = |
| 12951 | { |
| 12952 | { |
| 12953 | -1, |
| 12954 | (gchar *) "Heartbeat", |
| 12955 | (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers, |
| 12956 | NULL |
| 12957 | }, |
| 12958 | "heartbeat" |
| 12959 | }; |
| 12960 | |
| 12961 | static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name = |
| 12962 | { |
| 12963 | { |
| 12964 | -1, |
| 12965 | (gchar *) "state_name", |
| 12966 | (gchar *) "s", |
| 12967 | NULL |
| 12968 | }, |
| 12969 | FALSE |
| 12970 | }; |
| 12971 | |
| 12972 | static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] = |
| 12973 | { |
| 12974 | &_control_signal_info_goto_system_state_ARG_state_name, |
| 12975 | NULL |
| 12976 | }; |
| 12977 | |
| 12978 | static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state = |
| 12979 | { |
| 12980 | { |
| 12981 | -1, |
| 12982 | (gchar *) "GotoSystemState", |
| 12983 | (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers, |
| 12984 | NULL |
| 12985 | }, |
| 12986 | "goto-system-state" |
| 12987 | }; |
| 12988 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 12989 | static const _ExtendedGDBusSignalInfo _control_signal_info_started = |
| 12990 | { |
| 12991 | { |
| 12992 | -1, |
| 12993 | (gchar *) "Started", |
| 12994 | NULL, |
| 12995 | NULL |
| 12996 | }, |
| 12997 | "started" |
| 12998 | }; |
| 12999 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13000 | static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] = |
| 13001 | { |
| 13002 | &_control_signal_info_heartbeat, |
| 13003 | &_control_signal_info_goto_system_state, |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 13004 | &_control_signal_info_started, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13005 | NULL |
| 13006 | }; |
| 13007 | |
| 13008 | static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = |
| 13009 | { |
| 13010 | { |
| 13011 | -1, |
| 13012 | (gchar *) "poll_interval", |
| 13013 | (gchar *) "i", |
| 13014 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 13015 | NULL |
| 13016 | }, |
| 13017 | "poll-interval", |
| 13018 | FALSE |
| 13019 | }; |
| 13020 | |
| 13021 | static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat = |
| 13022 | { |
| 13023 | { |
| 13024 | -1, |
| 13025 | (gchar *) "heatbeat", |
| 13026 | (gchar *) "i", |
| 13027 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 13028 | NULL |
| 13029 | }, |
| 13030 | "heatbeat", |
| 13031 | FALSE |
| 13032 | }; |
| 13033 | |
| 13034 | static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] = |
| 13035 | { |
| 13036 | &_control_property_info_poll_interval, |
| 13037 | &_control_property_info_heatbeat, |
| 13038 | NULL |
| 13039 | }; |
| 13040 | |
| 13041 | static const _ExtendedGDBusInterfaceInfo _control_interface_info = |
| 13042 | { |
| 13043 | { |
| 13044 | -1, |
| 13045 | (gchar *) "org.openbmc.Control", |
| 13046 | (GDBusMethodInfo **) &_control_method_info_pointers, |
| 13047 | (GDBusSignalInfo **) &_control_signal_info_pointers, |
| 13048 | (GDBusPropertyInfo **) &_control_property_info_pointers, |
| 13049 | NULL |
| 13050 | }, |
| 13051 | "control", |
| 13052 | }; |
| 13053 | |
| 13054 | |
| 13055 | /** |
| 13056 | * control_interface_info: |
| 13057 | * |
| 13058 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface. |
| 13059 | * |
| 13060 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 13061 | */ |
| 13062 | GDBusInterfaceInfo * |
| 13063 | control_interface_info (void) |
| 13064 | { |
| 13065 | return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct; |
| 13066 | } |
| 13067 | |
| 13068 | /** |
| 13069 | * control_override_properties: |
| 13070 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 13071 | * @property_id_begin: The property id to assign to the first overridden property. |
| 13072 | * |
| 13073 | * Overrides all #GObject properties in the #Control interface for a concrete class. |
| 13074 | * The properties are overridden in the order they are defined. |
| 13075 | * |
| 13076 | * Returns: The last property id. |
| 13077 | */ |
| 13078 | guint |
| 13079 | control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 13080 | { |
| 13081 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 13082 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 13083 | return property_id_begin - 1; |
| 13084 | } |
| 13085 | |
| 13086 | |
| 13087 | |
| 13088 | /** |
| 13089 | * Control: |
| 13090 | * |
| 13091 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 13092 | */ |
| 13093 | |
| 13094 | /** |
| 13095 | * ControlIface: |
| 13096 | * @parent_iface: The parent interface. |
| 13097 | * @handle_init: Handler for the #Control::handle-init signal. |
| 13098 | * @get_heatbeat: Getter for the #Control:heatbeat property. |
| 13099 | * @get_poll_interval: Getter for the #Control:poll-interval property. |
| 13100 | * @goto_system_state: Handler for the #Control::goto-system-state signal. |
| 13101 | * @heartbeat: Handler for the #Control::heartbeat signal. |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 13102 | * @started: Handler for the #Control::started signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13103 | * |
| 13104 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 13105 | */ |
| 13106 | |
| 13107 | typedef ControlIface ControlInterface; |
| 13108 | G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT); |
| 13109 | |
| 13110 | static void |
| 13111 | control_default_init (ControlIface *iface) |
| 13112 | { |
| 13113 | /* GObject signals for incoming D-Bus method calls: */ |
| 13114 | /** |
| 13115 | * Control::handle-init: |
| 13116 | * @object: A #Control. |
| 13117 | * @invocation: A #GDBusMethodInvocation. |
| 13118 | * |
| 13119 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. |
| 13120 | * |
| 13121 | * 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. |
| 13122 | * |
| 13123 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13124 | */ |
| 13125 | g_signal_new ("handle-init", |
| 13126 | G_TYPE_FROM_INTERFACE (iface), |
| 13127 | G_SIGNAL_RUN_LAST, |
| 13128 | G_STRUCT_OFFSET (ControlIface, handle_init), |
| 13129 | g_signal_accumulator_true_handled, |
| 13130 | NULL, |
| 13131 | g_cclosure_marshal_generic, |
| 13132 | G_TYPE_BOOLEAN, |
| 13133 | 1, |
| 13134 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13135 | |
| 13136 | /* GObject signals for received D-Bus signals: */ |
| 13137 | /** |
| 13138 | * Control::heartbeat: |
| 13139 | * @object: A #Control. |
| 13140 | * @arg_bus_name: Argument. |
| 13141 | * |
| 13142 | * 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. |
| 13143 | * |
| 13144 | * 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. |
| 13145 | */ |
| 13146 | g_signal_new ("heartbeat", |
| 13147 | G_TYPE_FROM_INTERFACE (iface), |
| 13148 | G_SIGNAL_RUN_LAST, |
| 13149 | G_STRUCT_OFFSET (ControlIface, heartbeat), |
| 13150 | NULL, |
| 13151 | NULL, |
| 13152 | g_cclosure_marshal_generic, |
| 13153 | G_TYPE_NONE, |
| 13154 | 1, G_TYPE_STRING); |
| 13155 | |
| 13156 | /** |
| 13157 | * Control::goto-system-state: |
| 13158 | * @object: A #Control. |
| 13159 | * @arg_state_name: Argument. |
| 13160 | * |
| 13161 | * 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. |
| 13162 | * |
| 13163 | * 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. |
| 13164 | */ |
| 13165 | g_signal_new ("goto-system-state", |
| 13166 | G_TYPE_FROM_INTERFACE (iface), |
| 13167 | G_SIGNAL_RUN_LAST, |
| 13168 | G_STRUCT_OFFSET (ControlIface, goto_system_state), |
| 13169 | NULL, |
| 13170 | NULL, |
| 13171 | g_cclosure_marshal_generic, |
| 13172 | G_TYPE_NONE, |
| 13173 | 1, G_TYPE_STRING); |
| 13174 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 13175 | /** |
| 13176 | * Control::started: |
| 13177 | * @object: A #Control. |
| 13178 | * |
| 13179 | * 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. |
| 13180 | * |
| 13181 | * 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. |
| 13182 | */ |
| 13183 | g_signal_new ("started", |
| 13184 | G_TYPE_FROM_INTERFACE (iface), |
| 13185 | G_SIGNAL_RUN_LAST, |
| 13186 | G_STRUCT_OFFSET (ControlIface, started), |
| 13187 | NULL, |
| 13188 | NULL, |
| 13189 | g_cclosure_marshal_generic, |
| 13190 | G_TYPE_NONE, |
| 13191 | 0); |
| 13192 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13193 | /* GObject properties for D-Bus properties: */ |
| 13194 | /** |
| 13195 | * Control:poll-interval: |
| 13196 | * |
| 13197 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. |
| 13198 | * |
| 13199 | * 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. |
| 13200 | */ |
| 13201 | g_object_interface_install_property (iface, |
| 13202 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 13203 | /** |
| 13204 | * Control:heatbeat: |
| 13205 | * |
| 13206 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>. |
| 13207 | * |
| 13208 | * 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. |
| 13209 | */ |
| 13210 | g_object_interface_install_property (iface, |
| 13211 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 13212 | } |
| 13213 | |
| 13214 | /** |
| 13215 | * control_get_poll_interval: (skip) |
| 13216 | * @object: A #Control. |
| 13217 | * |
| 13218 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. |
| 13219 | * |
| 13220 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 13221 | * |
| 13222 | * Returns: The property value. |
| 13223 | */ |
| 13224 | gint |
| 13225 | control_get_poll_interval (Control *object) |
| 13226 | { |
| 13227 | return CONTROL_GET_IFACE (object)->get_poll_interval (object); |
| 13228 | } |
| 13229 | |
| 13230 | /** |
| 13231 | * control_set_poll_interval: (skip) |
| 13232 | * @object: A #Control. |
| 13233 | * @value: The value to set. |
| 13234 | * |
| 13235 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 13236 | * |
| 13237 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 13238 | */ |
| 13239 | void |
| 13240 | control_set_poll_interval (Control *object, gint value) |
| 13241 | { |
| 13242 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 13243 | } |
| 13244 | |
| 13245 | /** |
| 13246 | * control_get_heatbeat: (skip) |
| 13247 | * @object: A #Control. |
| 13248 | * |
| 13249 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property. |
| 13250 | * |
| 13251 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 13252 | * |
| 13253 | * Returns: The property value. |
| 13254 | */ |
| 13255 | gint |
| 13256 | control_get_heatbeat (Control *object) |
| 13257 | { |
| 13258 | return CONTROL_GET_IFACE (object)->get_heatbeat (object); |
| 13259 | } |
| 13260 | |
| 13261 | /** |
| 13262 | * control_set_heatbeat: (skip) |
| 13263 | * @object: A #Control. |
| 13264 | * @value: The value to set. |
| 13265 | * |
| 13266 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 13267 | * |
| 13268 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 13269 | */ |
| 13270 | void |
| 13271 | control_set_heatbeat (Control *object, gint value) |
| 13272 | { |
| 13273 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 13274 | } |
| 13275 | |
| 13276 | /** |
| 13277 | * control_emit_heartbeat: |
| 13278 | * @object: A #Control. |
| 13279 | * @arg_bus_name: Argument to pass with the signal. |
| 13280 | * |
| 13281 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 13282 | */ |
| 13283 | void |
| 13284 | control_emit_heartbeat ( |
| 13285 | Control *object, |
| 13286 | const gchar *arg_bus_name) |
| 13287 | { |
| 13288 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 13289 | } |
| 13290 | |
| 13291 | /** |
| 13292 | * control_emit_goto_system_state: |
| 13293 | * @object: A #Control. |
| 13294 | * @arg_state_name: Argument to pass with the signal. |
| 13295 | * |
| 13296 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal. |
| 13297 | */ |
| 13298 | void |
| 13299 | control_emit_goto_system_state ( |
| 13300 | Control *object, |
| 13301 | const gchar *arg_state_name) |
| 13302 | { |
| 13303 | g_signal_emit_by_name (object, "goto-system-state", arg_state_name); |
| 13304 | } |
| 13305 | |
| 13306 | /** |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 13307 | * control_emit_started: |
| 13308 | * @object: A #Control. |
| 13309 | * |
| 13310 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal. |
| 13311 | */ |
| 13312 | void |
| 13313 | control_emit_started ( |
| 13314 | Control *object) |
| 13315 | { |
| 13316 | g_signal_emit_by_name (object, "started"); |
| 13317 | } |
| 13318 | |
| 13319 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13320 | * control_call_init: |
| 13321 | * @proxy: A #ControlProxy. |
| 13322 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13323 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13324 | * @user_data: User data to pass to @callback. |
| 13325 | * |
| 13326 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. |
| 13327 | * 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. |
| 13328 | * You can then call control_call_init_finish() to get the result of the operation. |
| 13329 | * |
| 13330 | * See control_call_init_sync() for the synchronous, blocking version of this method. |
| 13331 | */ |
| 13332 | void |
| 13333 | control_call_init ( |
| 13334 | Control *proxy, |
| 13335 | GCancellable *cancellable, |
| 13336 | GAsyncReadyCallback callback, |
| 13337 | gpointer user_data) |
| 13338 | { |
| 13339 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13340 | "init", |
| 13341 | g_variant_new ("()"), |
| 13342 | G_DBUS_CALL_FLAGS_NONE, |
| 13343 | -1, |
| 13344 | cancellable, |
| 13345 | callback, |
| 13346 | user_data); |
| 13347 | } |
| 13348 | |
| 13349 | /** |
| 13350 | * control_call_init_finish: |
| 13351 | * @proxy: A #ControlProxy. |
| 13352 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). |
| 13353 | * @error: Return location for error or %NULL. |
| 13354 | * |
| 13355 | * Finishes an operation started with control_call_init(). |
| 13356 | * |
| 13357 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13358 | */ |
| 13359 | gboolean |
| 13360 | control_call_init_finish ( |
| 13361 | Control *proxy, |
| 13362 | GAsyncResult *res, |
| 13363 | GError **error) |
| 13364 | { |
| 13365 | GVariant *_ret; |
| 13366 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13367 | if (_ret == NULL) |
| 13368 | goto _out; |
| 13369 | g_variant_get (_ret, |
| 13370 | "()"); |
| 13371 | g_variant_unref (_ret); |
| 13372 | _out: |
| 13373 | return _ret != NULL; |
| 13374 | } |
| 13375 | |
| 13376 | /** |
| 13377 | * control_call_init_sync: |
| 13378 | * @proxy: A #ControlProxy. |
| 13379 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13380 | * @error: Return location for error or %NULL. |
| 13381 | * |
| 13382 | * 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. |
| 13383 | * |
| 13384 | * See control_call_init() for the asynchronous version of this method. |
| 13385 | * |
| 13386 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13387 | */ |
| 13388 | gboolean |
| 13389 | control_call_init_sync ( |
| 13390 | Control *proxy, |
| 13391 | GCancellable *cancellable, |
| 13392 | GError **error) |
| 13393 | { |
| 13394 | GVariant *_ret; |
| 13395 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13396 | "init", |
| 13397 | g_variant_new ("()"), |
| 13398 | G_DBUS_CALL_FLAGS_NONE, |
| 13399 | -1, |
| 13400 | cancellable, |
| 13401 | error); |
| 13402 | if (_ret == NULL) |
| 13403 | goto _out; |
| 13404 | g_variant_get (_ret, |
| 13405 | "()"); |
| 13406 | g_variant_unref (_ret); |
| 13407 | _out: |
| 13408 | return _ret != NULL; |
| 13409 | } |
| 13410 | |
| 13411 | /** |
| 13412 | * control_complete_init: |
| 13413 | * @object: A #Control. |
| 13414 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13415 | * |
| 13416 | * 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. |
| 13417 | * |
| 13418 | * This method will free @invocation, you cannot use it afterwards. |
| 13419 | */ |
| 13420 | void |
| 13421 | control_complete_init ( |
| 13422 | Control *object, |
| 13423 | GDBusMethodInvocation *invocation) |
| 13424 | { |
| 13425 | g_dbus_method_invocation_return_value (invocation, |
| 13426 | g_variant_new ("()")); |
| 13427 | } |
| 13428 | |
| 13429 | /* ------------------------------------------------------------------------ */ |
| 13430 | |
| 13431 | /** |
| 13432 | * ControlProxy: |
| 13433 | * |
| 13434 | * The #ControlProxy structure contains only private data and should only be accessed using the provided API. |
| 13435 | */ |
| 13436 | |
| 13437 | /** |
| 13438 | * ControlProxyClass: |
| 13439 | * @parent_class: The parent class. |
| 13440 | * |
| 13441 | * Class structure for #ControlProxy. |
| 13442 | */ |
| 13443 | |
| 13444 | struct _ControlProxyPrivate |
| 13445 | { |
| 13446 | GData *qdata; |
| 13447 | }; |
| 13448 | |
| 13449 | static void control_proxy_iface_init (ControlIface *iface); |
| 13450 | |
| 13451 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13452 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 13453 | G_ADD_PRIVATE (ControlProxy) |
| 13454 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 13455 | |
| 13456 | #else |
| 13457 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 13458 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 13459 | |
| 13460 | #endif |
| 13461 | static void |
| 13462 | control_proxy_finalize (GObject *object) |
| 13463 | { |
| 13464 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 13465 | g_datalist_clear (&proxy->priv->qdata); |
| 13466 | G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object); |
| 13467 | } |
| 13468 | |
| 13469 | static void |
| 13470 | control_proxy_get_property (GObject *object, |
| 13471 | guint prop_id, |
| 13472 | GValue *value, |
| 13473 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13474 | { |
| 13475 | const _ExtendedGDBusPropertyInfo *info; |
| 13476 | GVariant *variant; |
| 13477 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 13478 | info = _control_property_info_pointers[prop_id - 1]; |
| 13479 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 13480 | if (info->use_gvariant) |
| 13481 | { |
| 13482 | g_value_set_variant (value, variant); |
| 13483 | } |
| 13484 | else |
| 13485 | { |
| 13486 | if (variant != NULL) |
| 13487 | g_dbus_gvariant_to_gvalue (variant, value); |
| 13488 | } |
| 13489 | if (variant != NULL) |
| 13490 | g_variant_unref (variant); |
| 13491 | } |
| 13492 | |
| 13493 | static void |
| 13494 | control_proxy_set_property_cb (GDBusProxy *proxy, |
| 13495 | GAsyncResult *res, |
| 13496 | gpointer user_data) |
| 13497 | { |
| 13498 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 13499 | GError *error; |
| 13500 | GVariant *_ret; |
| 13501 | error = NULL; |
| 13502 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 13503 | if (!_ret) |
| 13504 | { |
| 13505 | g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)", |
| 13506 | info->parent_struct.name, |
| 13507 | error->message, g_quark_to_string (error->domain), error->code); |
| 13508 | g_error_free (error); |
| 13509 | } |
| 13510 | else |
| 13511 | { |
| 13512 | g_variant_unref (_ret); |
| 13513 | } |
| 13514 | } |
| 13515 | |
| 13516 | static void |
| 13517 | control_proxy_set_property (GObject *object, |
| 13518 | guint prop_id, |
| 13519 | const GValue *value, |
| 13520 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13521 | { |
| 13522 | const _ExtendedGDBusPropertyInfo *info; |
| 13523 | GVariant *variant; |
| 13524 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 13525 | info = _control_property_info_pointers[prop_id - 1]; |
| 13526 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 13527 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 13528 | "org.freedesktop.DBus.Properties.Set", |
| 13529 | g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant), |
| 13530 | G_DBUS_CALL_FLAGS_NONE, |
| 13531 | -1, |
| 13532 | NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 13533 | g_variant_unref (variant); |
| 13534 | } |
| 13535 | |
| 13536 | static void |
| 13537 | control_proxy_g_signal (GDBusProxy *proxy, |
| 13538 | const gchar *sender_name G_GNUC_UNUSED, |
| 13539 | const gchar *signal_name, |
| 13540 | GVariant *parameters) |
| 13541 | { |
| 13542 | _ExtendedGDBusSignalInfo *info; |
| 13543 | GVariantIter iter; |
| 13544 | GVariant *child; |
| 13545 | GValue *paramv; |
| 13546 | guint num_params; |
| 13547 | guint n; |
| 13548 | guint signal_id; |
| 13549 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name); |
| 13550 | if (info == NULL) |
| 13551 | return; |
| 13552 | num_params = g_variant_n_children (parameters); |
| 13553 | paramv = g_new0 (GValue, num_params + 1); |
| 13554 | g_value_init (¶mv[0], TYPE_CONTROL); |
| 13555 | g_value_set_object (¶mv[0], proxy); |
| 13556 | g_variant_iter_init (&iter, parameters); |
| 13557 | n = 1; |
| 13558 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13559 | { |
| 13560 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 13561 | if (arg_info->use_gvariant) |
| 13562 | { |
| 13563 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13564 | g_value_set_variant (¶mv[n], child); |
| 13565 | n++; |
| 13566 | } |
| 13567 | else |
| 13568 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13569 | g_variant_unref (child); |
| 13570 | } |
| 13571 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 13572 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 13573 | for (n = 0; n < num_params + 1; n++) |
| 13574 | g_value_unset (¶mv[n]); |
| 13575 | g_free (paramv); |
| 13576 | } |
| 13577 | |
| 13578 | static void |
| 13579 | control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 13580 | GVariant *changed_properties, |
| 13581 | const gchar *const *invalidated_properties) |
| 13582 | { |
| 13583 | ControlProxy *proxy = CONTROL_PROXY (_proxy); |
| 13584 | guint n; |
| 13585 | const gchar *key; |
| 13586 | GVariantIter *iter; |
| 13587 | _ExtendedGDBusPropertyInfo *info; |
| 13588 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 13589 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 13590 | { |
| 13591 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key); |
| 13592 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 13593 | if (info != NULL) |
| 13594 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13595 | } |
| 13596 | g_variant_iter_free (iter); |
| 13597 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 13598 | { |
| 13599 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]); |
| 13600 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 13601 | if (info != NULL) |
| 13602 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13603 | } |
| 13604 | } |
| 13605 | |
| 13606 | static gint |
| 13607 | control_proxy_get_poll_interval (Control *object) |
| 13608 | { |
| 13609 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 13610 | GVariant *variant; |
| 13611 | gint value = 0; |
| 13612 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 13613 | if (variant != NULL) |
| 13614 | { |
| 13615 | value = g_variant_get_int32 (variant); |
| 13616 | g_variant_unref (variant); |
| 13617 | } |
| 13618 | return value; |
| 13619 | } |
| 13620 | |
| 13621 | static gint |
| 13622 | control_proxy_get_heatbeat (Control *object) |
| 13623 | { |
| 13624 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 13625 | GVariant *variant; |
| 13626 | gint value = 0; |
| 13627 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 13628 | if (variant != NULL) |
| 13629 | { |
| 13630 | value = g_variant_get_int32 (variant); |
| 13631 | g_variant_unref (variant); |
| 13632 | } |
| 13633 | return value; |
| 13634 | } |
| 13635 | |
| 13636 | static void |
| 13637 | control_proxy_init (ControlProxy *proxy) |
| 13638 | { |
| 13639 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13640 | proxy->priv = control_proxy_get_instance_private (proxy); |
| 13641 | #else |
| 13642 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate); |
| 13643 | #endif |
| 13644 | |
| 13645 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ()); |
| 13646 | } |
| 13647 | |
| 13648 | static void |
| 13649 | control_proxy_class_init (ControlProxyClass *klass) |
| 13650 | { |
| 13651 | GObjectClass *gobject_class; |
| 13652 | GDBusProxyClass *proxy_class; |
| 13653 | |
| 13654 | gobject_class = G_OBJECT_CLASS (klass); |
| 13655 | gobject_class->finalize = control_proxy_finalize; |
| 13656 | gobject_class->get_property = control_proxy_get_property; |
| 13657 | gobject_class->set_property = control_proxy_set_property; |
| 13658 | |
| 13659 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 13660 | proxy_class->g_signal = control_proxy_g_signal; |
| 13661 | proxy_class->g_properties_changed = control_proxy_g_properties_changed; |
| 13662 | |
| 13663 | control_override_properties (gobject_class, 1); |
| 13664 | |
| 13665 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13666 | g_type_class_add_private (klass, sizeof (ControlProxyPrivate)); |
| 13667 | #endif |
| 13668 | } |
| 13669 | |
| 13670 | static void |
| 13671 | control_proxy_iface_init (ControlIface *iface) |
| 13672 | { |
| 13673 | iface->get_poll_interval = control_proxy_get_poll_interval; |
| 13674 | iface->get_heatbeat = control_proxy_get_heatbeat; |
| 13675 | } |
| 13676 | |
| 13677 | /** |
| 13678 | * control_proxy_new: |
| 13679 | * @connection: A #GDBusConnection. |
| 13680 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13681 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13682 | * @object_path: An object path. |
| 13683 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13684 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13685 | * @user_data: User data to pass to @callback. |
| 13686 | * |
| 13687 | * 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. |
| 13688 | * |
| 13689 | * 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. |
| 13690 | * You can then call control_proxy_new_finish() to get the result of the operation. |
| 13691 | * |
| 13692 | * See control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 13693 | */ |
| 13694 | void |
| 13695 | control_proxy_new ( |
| 13696 | GDBusConnection *connection, |
| 13697 | GDBusProxyFlags flags, |
| 13698 | const gchar *name, |
| 13699 | const gchar *object_path, |
| 13700 | GCancellable *cancellable, |
| 13701 | GAsyncReadyCallback callback, |
| 13702 | gpointer user_data) |
| 13703 | { |
| 13704 | 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); |
| 13705 | } |
| 13706 | |
| 13707 | /** |
| 13708 | * control_proxy_new_finish: |
| 13709 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new(). |
| 13710 | * @error: Return location for error or %NULL |
| 13711 | * |
| 13712 | * Finishes an operation started with control_proxy_new(). |
| 13713 | * |
| 13714 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 13715 | */ |
| 13716 | Control * |
| 13717 | control_proxy_new_finish ( |
| 13718 | GAsyncResult *res, |
| 13719 | GError **error) |
| 13720 | { |
| 13721 | GObject *ret; |
| 13722 | GObject *source_object; |
| 13723 | source_object = g_async_result_get_source_object (res); |
| 13724 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 13725 | g_object_unref (source_object); |
| 13726 | if (ret != NULL) |
| 13727 | return CONTROL (ret); |
| 13728 | else |
| 13729 | return NULL; |
| 13730 | } |
| 13731 | |
| 13732 | /** |
| 13733 | * control_proxy_new_sync: |
| 13734 | * @connection: A #GDBusConnection. |
| 13735 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13736 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13737 | * @object_path: An object path. |
| 13738 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13739 | * @error: Return location for error or %NULL |
| 13740 | * |
| 13741 | * 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. |
| 13742 | * |
| 13743 | * The calling thread is blocked until a reply is received. |
| 13744 | * |
| 13745 | * See control_proxy_new() for the asynchronous version of this constructor. |
| 13746 | * |
| 13747 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 13748 | */ |
| 13749 | Control * |
| 13750 | control_proxy_new_sync ( |
| 13751 | GDBusConnection *connection, |
| 13752 | GDBusProxyFlags flags, |
| 13753 | const gchar *name, |
| 13754 | const gchar *object_path, |
| 13755 | GCancellable *cancellable, |
| 13756 | GError **error) |
| 13757 | { |
| 13758 | GInitable *ret; |
| 13759 | 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); |
| 13760 | if (ret != NULL) |
| 13761 | return CONTROL (ret); |
| 13762 | else |
| 13763 | return NULL; |
| 13764 | } |
| 13765 | |
| 13766 | |
| 13767 | /** |
| 13768 | * control_proxy_new_for_bus: |
| 13769 | * @bus_type: A #GBusType. |
| 13770 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13771 | * @name: A bus name (well-known or unique). |
| 13772 | * @object_path: An object path. |
| 13773 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13774 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13775 | * @user_data: User data to pass to @callback. |
| 13776 | * |
| 13777 | * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 13778 | * |
| 13779 | * 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. |
| 13780 | * You can then call control_proxy_new_for_bus_finish() to get the result of the operation. |
| 13781 | * |
| 13782 | * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 13783 | */ |
| 13784 | void |
| 13785 | control_proxy_new_for_bus ( |
| 13786 | GBusType bus_type, |
| 13787 | GDBusProxyFlags flags, |
| 13788 | const gchar *name, |
| 13789 | const gchar *object_path, |
| 13790 | GCancellable *cancellable, |
| 13791 | GAsyncReadyCallback callback, |
| 13792 | gpointer user_data) |
| 13793 | { |
| 13794 | 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); |
| 13795 | } |
| 13796 | |
| 13797 | /** |
| 13798 | * control_proxy_new_for_bus_finish: |
| 13799 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus(). |
| 13800 | * @error: Return location for error or %NULL |
| 13801 | * |
| 13802 | * Finishes an operation started with control_proxy_new_for_bus(). |
| 13803 | * |
| 13804 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 13805 | */ |
| 13806 | Control * |
| 13807 | control_proxy_new_for_bus_finish ( |
| 13808 | GAsyncResult *res, |
| 13809 | GError **error) |
| 13810 | { |
| 13811 | GObject *ret; |
| 13812 | GObject *source_object; |
| 13813 | source_object = g_async_result_get_source_object (res); |
| 13814 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 13815 | g_object_unref (source_object); |
| 13816 | if (ret != NULL) |
| 13817 | return CONTROL (ret); |
| 13818 | else |
| 13819 | return NULL; |
| 13820 | } |
| 13821 | |
| 13822 | /** |
| 13823 | * control_proxy_new_for_bus_sync: |
| 13824 | * @bus_type: A #GBusType. |
| 13825 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13826 | * @name: A bus name (well-known or unique). |
| 13827 | * @object_path: An object path. |
| 13828 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13829 | * @error: Return location for error or %NULL |
| 13830 | * |
| 13831 | * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 13832 | * |
| 13833 | * The calling thread is blocked until a reply is received. |
| 13834 | * |
| 13835 | * See control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 13836 | * |
| 13837 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 13838 | */ |
| 13839 | Control * |
| 13840 | control_proxy_new_for_bus_sync ( |
| 13841 | GBusType bus_type, |
| 13842 | GDBusProxyFlags flags, |
| 13843 | const gchar *name, |
| 13844 | const gchar *object_path, |
| 13845 | GCancellable *cancellable, |
| 13846 | GError **error) |
| 13847 | { |
| 13848 | GInitable *ret; |
| 13849 | 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); |
| 13850 | if (ret != NULL) |
| 13851 | return CONTROL (ret); |
| 13852 | else |
| 13853 | return NULL; |
| 13854 | } |
| 13855 | |
| 13856 | |
| 13857 | /* ------------------------------------------------------------------------ */ |
| 13858 | |
| 13859 | /** |
| 13860 | * ControlSkeleton: |
| 13861 | * |
| 13862 | * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 13863 | */ |
| 13864 | |
| 13865 | /** |
| 13866 | * ControlSkeletonClass: |
| 13867 | * @parent_class: The parent class. |
| 13868 | * |
| 13869 | * Class structure for #ControlSkeleton. |
| 13870 | */ |
| 13871 | |
| 13872 | struct _ControlSkeletonPrivate |
| 13873 | { |
| 13874 | GValue *properties; |
| 13875 | GList *changed_properties; |
| 13876 | GSource *changed_properties_idle_source; |
| 13877 | GMainContext *context; |
| 13878 | GMutex lock; |
| 13879 | }; |
| 13880 | |
| 13881 | static void |
| 13882 | _control_skeleton_handle_method_call ( |
| 13883 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13884 | const gchar *sender G_GNUC_UNUSED, |
| 13885 | const gchar *object_path G_GNUC_UNUSED, |
| 13886 | const gchar *interface_name, |
| 13887 | const gchar *method_name, |
| 13888 | GVariant *parameters, |
| 13889 | GDBusMethodInvocation *invocation, |
| 13890 | gpointer user_data) |
| 13891 | { |
| 13892 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 13893 | _ExtendedGDBusMethodInfo *info; |
| 13894 | GVariantIter iter; |
| 13895 | GVariant *child; |
| 13896 | GValue *paramv; |
| 13897 | guint num_params; |
| 13898 | guint num_extra; |
| 13899 | guint n; |
| 13900 | guint signal_id; |
| 13901 | GValue return_value = G_VALUE_INIT; |
| 13902 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 13903 | g_assert (info != NULL); |
| 13904 | num_params = g_variant_n_children (parameters); |
| 13905 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 13906 | n = 0; |
| 13907 | g_value_init (¶mv[n], TYPE_CONTROL); |
| 13908 | g_value_set_object (¶mv[n++], skeleton); |
| 13909 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 13910 | g_value_set_object (¶mv[n++], invocation); |
| 13911 | if (info->pass_fdlist) |
| 13912 | { |
| 13913 | #ifdef G_OS_UNIX |
| 13914 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 13915 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 13916 | #else |
| 13917 | g_assert_not_reached (); |
| 13918 | #endif |
| 13919 | } |
| 13920 | g_variant_iter_init (&iter, parameters); |
| 13921 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13922 | { |
| 13923 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 13924 | if (arg_info->use_gvariant) |
| 13925 | { |
| 13926 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13927 | g_value_set_variant (¶mv[n], child); |
| 13928 | n++; |
| 13929 | } |
| 13930 | else |
| 13931 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13932 | g_variant_unref (child); |
| 13933 | } |
| 13934 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 13935 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 13936 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 13937 | if (!g_value_get_boolean (&return_value)) |
| 13938 | 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); |
| 13939 | g_value_unset (&return_value); |
| 13940 | for (n = 0; n < num_params + num_extra; n++) |
| 13941 | g_value_unset (¶mv[n]); |
| 13942 | g_free (paramv); |
| 13943 | } |
| 13944 | |
| 13945 | static GVariant * |
| 13946 | _control_skeleton_handle_get_property ( |
| 13947 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13948 | const gchar *sender G_GNUC_UNUSED, |
| 13949 | const gchar *object_path G_GNUC_UNUSED, |
| 13950 | const gchar *interface_name G_GNUC_UNUSED, |
| 13951 | const gchar *property_name, |
| 13952 | GError **error, |
| 13953 | gpointer user_data) |
| 13954 | { |
| 13955 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 13956 | GValue value = G_VALUE_INIT; |
| 13957 | GParamSpec *pspec; |
| 13958 | _ExtendedGDBusPropertyInfo *info; |
| 13959 | GVariant *ret; |
| 13960 | ret = NULL; |
| 13961 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 13962 | g_assert (info != NULL); |
| 13963 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13964 | if (pspec == NULL) |
| 13965 | { |
| 13966 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 13967 | } |
| 13968 | else |
| 13969 | { |
| 13970 | g_value_init (&value, pspec->value_type); |
| 13971 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 13972 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 13973 | g_value_unset (&value); |
| 13974 | } |
| 13975 | return ret; |
| 13976 | } |
| 13977 | |
| 13978 | static gboolean |
| 13979 | _control_skeleton_handle_set_property ( |
| 13980 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13981 | const gchar *sender G_GNUC_UNUSED, |
| 13982 | const gchar *object_path G_GNUC_UNUSED, |
| 13983 | const gchar *interface_name G_GNUC_UNUSED, |
| 13984 | const gchar *property_name, |
| 13985 | GVariant *variant, |
| 13986 | GError **error, |
| 13987 | gpointer user_data) |
| 13988 | { |
| 13989 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 13990 | GValue value = G_VALUE_INIT; |
| 13991 | GParamSpec *pspec; |
| 13992 | _ExtendedGDBusPropertyInfo *info; |
| 13993 | gboolean ret; |
| 13994 | ret = FALSE; |
| 13995 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 13996 | g_assert (info != NULL); |
| 13997 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13998 | if (pspec == NULL) |
| 13999 | { |
| 14000 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 14001 | } |
| 14002 | else |
| 14003 | { |
| 14004 | if (info->use_gvariant) |
| 14005 | g_value_set_variant (&value, variant); |
| 14006 | else |
| 14007 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 14008 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 14009 | g_value_unset (&value); |
| 14010 | ret = TRUE; |
| 14011 | } |
| 14012 | return ret; |
| 14013 | } |
| 14014 | |
| 14015 | static const GDBusInterfaceVTable _control_skeleton_vtable = |
| 14016 | { |
| 14017 | _control_skeleton_handle_method_call, |
| 14018 | _control_skeleton_handle_get_property, |
| 14019 | _control_skeleton_handle_set_property, |
| 14020 | {NULL} |
| 14021 | }; |
| 14022 | |
| 14023 | static GDBusInterfaceInfo * |
| 14024 | control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14025 | { |
| 14026 | return control_interface_info (); |
| 14027 | } |
| 14028 | |
| 14029 | static GDBusInterfaceVTable * |
| 14030 | control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 14031 | { |
| 14032 | return (GDBusInterfaceVTable *) &_control_skeleton_vtable; |
| 14033 | } |
| 14034 | |
| 14035 | static GVariant * |
| 14036 | control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 14037 | { |
| 14038 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 14039 | |
| 14040 | GVariantBuilder builder; |
| 14041 | guint n; |
| 14042 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 14043 | if (_control_interface_info.parent_struct.properties == NULL) |
| 14044 | goto out; |
| 14045 | for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 14046 | { |
| 14047 | GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n]; |
| 14048 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 14049 | { |
| 14050 | GVariant *value; |
| 14051 | 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); |
| 14052 | if (value != NULL) |
| 14053 | { |
| 14054 | g_variant_take_ref (value); |
| 14055 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 14056 | g_variant_unref (value); |
| 14057 | } |
| 14058 | } |
| 14059 | } |
| 14060 | out: |
| 14061 | return g_variant_builder_end (&builder); |
| 14062 | } |
| 14063 | |
| 14064 | static gboolean _control_emit_changed (gpointer user_data); |
| 14065 | |
| 14066 | static void |
| 14067 | control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 14068 | { |
| 14069 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 14070 | gboolean emit_changed = FALSE; |
| 14071 | |
| 14072 | g_mutex_lock (&skeleton->priv->lock); |
| 14073 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 14074 | { |
| 14075 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 14076 | skeleton->priv->changed_properties_idle_source = NULL; |
| 14077 | emit_changed = TRUE; |
| 14078 | } |
| 14079 | g_mutex_unlock (&skeleton->priv->lock); |
| 14080 | |
| 14081 | if (emit_changed) |
| 14082 | _control_emit_changed (skeleton); |
| 14083 | } |
| 14084 | |
| 14085 | static void |
| 14086 | _control_on_signal_heartbeat ( |
| 14087 | Control *object, |
| 14088 | const gchar *arg_bus_name) |
| 14089 | { |
| 14090 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14091 | |
| 14092 | GList *connections, *l; |
| 14093 | GVariant *signal_variant; |
| 14094 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14095 | |
| 14096 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 14097 | arg_bus_name)); |
| 14098 | for (l = connections; l != NULL; l = l->next) |
| 14099 | { |
| 14100 | GDBusConnection *connection = l->data; |
| 14101 | g_dbus_connection_emit_signal (connection, |
| 14102 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat", |
| 14103 | signal_variant, NULL); |
| 14104 | } |
| 14105 | g_variant_unref (signal_variant); |
| 14106 | g_list_free_full (connections, g_object_unref); |
| 14107 | } |
| 14108 | |
| 14109 | static void |
| 14110 | _control_on_signal_goto_system_state ( |
| 14111 | Control *object, |
| 14112 | const gchar *arg_state_name) |
| 14113 | { |
| 14114 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14115 | |
| 14116 | GList *connections, *l; |
| 14117 | GVariant *signal_variant; |
| 14118 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14119 | |
| 14120 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 14121 | arg_state_name)); |
| 14122 | for (l = connections; l != NULL; l = l->next) |
| 14123 | { |
| 14124 | GDBusConnection *connection = l->data; |
| 14125 | g_dbus_connection_emit_signal (connection, |
| 14126 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState", |
| 14127 | signal_variant, NULL); |
| 14128 | } |
| 14129 | g_variant_unref (signal_variant); |
| 14130 | g_list_free_full (connections, g_object_unref); |
| 14131 | } |
| 14132 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 14133 | static void |
| 14134 | _control_on_signal_started ( |
| 14135 | Control *object) |
| 14136 | { |
| 14137 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14138 | |
| 14139 | GList *connections, *l; |
| 14140 | GVariant *signal_variant; |
| 14141 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14142 | |
| 14143 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 14144 | for (l = connections; l != NULL; l = l->next) |
| 14145 | { |
| 14146 | GDBusConnection *connection = l->data; |
| 14147 | g_dbus_connection_emit_signal (connection, |
| 14148 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started", |
| 14149 | signal_variant, NULL); |
| 14150 | } |
| 14151 | g_variant_unref (signal_variant); |
| 14152 | g_list_free_full (connections, g_object_unref); |
| 14153 | } |
| 14154 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14155 | static void control_skeleton_iface_init (ControlIface *iface); |
| 14156 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14157 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14158 | G_ADD_PRIVATE (ControlSkeleton) |
| 14159 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 14160 | |
| 14161 | #else |
| 14162 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 14163 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 14164 | |
| 14165 | #endif |
| 14166 | static void |
| 14167 | control_skeleton_finalize (GObject *object) |
| 14168 | { |
| 14169 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14170 | guint n; |
| 14171 | for (n = 0; n < 2; n++) |
| 14172 | g_value_unset (&skeleton->priv->properties[n]); |
| 14173 | g_free (skeleton->priv->properties); |
| 14174 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 14175 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 14176 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 14177 | g_main_context_unref (skeleton->priv->context); |
| 14178 | g_mutex_clear (&skeleton->priv->lock); |
| 14179 | G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object); |
| 14180 | } |
| 14181 | |
| 14182 | static void |
| 14183 | control_skeleton_get_property (GObject *object, |
| 14184 | guint prop_id, |
| 14185 | GValue *value, |
| 14186 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14187 | { |
| 14188 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14189 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 14190 | g_mutex_lock (&skeleton->priv->lock); |
| 14191 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 14192 | g_mutex_unlock (&skeleton->priv->lock); |
| 14193 | } |
| 14194 | |
| 14195 | static gboolean |
| 14196 | _control_emit_changed (gpointer user_data) |
| 14197 | { |
| 14198 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 14199 | GList *l; |
| 14200 | GVariantBuilder builder; |
| 14201 | GVariantBuilder invalidated_builder; |
| 14202 | guint num_changes; |
| 14203 | |
| 14204 | g_mutex_lock (&skeleton->priv->lock); |
| 14205 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 14206 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 14207 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 14208 | { |
| 14209 | ChangedProperty *cp = l->data; |
| 14210 | GVariant *variant; |
| 14211 | const GValue *cur_value; |
| 14212 | |
| 14213 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 14214 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 14215 | { |
| 14216 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 14217 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 14218 | g_variant_unref (variant); |
| 14219 | num_changes++; |
| 14220 | } |
| 14221 | } |
| 14222 | if (num_changes > 0) |
| 14223 | { |
| 14224 | GList *connections, *ll; |
| 14225 | GVariant *signal_variant; |
| 14226 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control", |
| 14227 | &builder, &invalidated_builder)); |
| 14228 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 14229 | for (ll = connections; ll != NULL; ll = ll->next) |
| 14230 | { |
| 14231 | GDBusConnection *connection = ll->data; |
| 14232 | |
| 14233 | g_dbus_connection_emit_signal (connection, |
| 14234 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 14235 | "org.freedesktop.DBus.Properties", |
| 14236 | "PropertiesChanged", |
| 14237 | signal_variant, |
| 14238 | NULL); |
| 14239 | } |
| 14240 | g_variant_unref (signal_variant); |
| 14241 | g_list_free_full (connections, g_object_unref); |
| 14242 | } |
| 14243 | else |
| 14244 | { |
| 14245 | g_variant_builder_clear (&builder); |
| 14246 | g_variant_builder_clear (&invalidated_builder); |
| 14247 | } |
| 14248 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 14249 | skeleton->priv->changed_properties = NULL; |
| 14250 | skeleton->priv->changed_properties_idle_source = NULL; |
| 14251 | g_mutex_unlock (&skeleton->priv->lock); |
| 14252 | return FALSE; |
| 14253 | } |
| 14254 | |
| 14255 | static void |
| 14256 | _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 14257 | { |
| 14258 | ChangedProperty *cp; |
| 14259 | GList *l; |
| 14260 | cp = NULL; |
| 14261 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 14262 | { |
| 14263 | ChangedProperty *i_cp = l->data; |
| 14264 | if (i_cp->info == info) |
| 14265 | { |
| 14266 | cp = i_cp; |
| 14267 | break; |
| 14268 | } |
| 14269 | } |
| 14270 | if (cp == NULL) |
| 14271 | { |
| 14272 | cp = g_new0 (ChangedProperty, 1); |
| 14273 | cp->prop_id = prop_id; |
| 14274 | cp->info = info; |
| 14275 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 14276 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 14277 | g_value_copy (orig_value, &cp->orig_value); |
| 14278 | } |
| 14279 | } |
| 14280 | |
| 14281 | static void |
| 14282 | control_skeleton_notify (GObject *object, |
| 14283 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14284 | { |
| 14285 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14286 | g_mutex_lock (&skeleton->priv->lock); |
| 14287 | if (skeleton->priv->changed_properties != NULL && |
| 14288 | skeleton->priv->changed_properties_idle_source == NULL) |
| 14289 | { |
| 14290 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 14291 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 14292 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 14293 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 14294 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 14295 | } |
| 14296 | g_mutex_unlock (&skeleton->priv->lock); |
| 14297 | } |
| 14298 | |
| 14299 | static void |
| 14300 | control_skeleton_set_property (GObject *object, |
| 14301 | guint prop_id, |
| 14302 | const GValue *value, |
| 14303 | GParamSpec *pspec) |
| 14304 | { |
| 14305 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14306 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 14307 | g_mutex_lock (&skeleton->priv->lock); |
| 14308 | g_object_freeze_notify (object); |
| 14309 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 14310 | { |
| 14311 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 14312 | _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 14313 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 14314 | g_object_notify_by_pspec (object, pspec); |
| 14315 | } |
| 14316 | g_mutex_unlock (&skeleton->priv->lock); |
| 14317 | g_object_thaw_notify (object); |
| 14318 | } |
| 14319 | |
| 14320 | static void |
| 14321 | control_skeleton_init (ControlSkeleton *skeleton) |
| 14322 | { |
| 14323 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14324 | skeleton->priv = control_skeleton_get_instance_private (skeleton); |
| 14325 | #else |
| 14326 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate); |
| 14327 | #endif |
| 14328 | |
| 14329 | g_mutex_init (&skeleton->priv->lock); |
| 14330 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 14331 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 14332 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 14333 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 14334 | } |
| 14335 | |
| 14336 | static gint |
| 14337 | control_skeleton_get_poll_interval (Control *object) |
| 14338 | { |
| 14339 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14340 | gint value; |
| 14341 | g_mutex_lock (&skeleton->priv->lock); |
| 14342 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 14343 | g_mutex_unlock (&skeleton->priv->lock); |
| 14344 | return value; |
| 14345 | } |
| 14346 | |
| 14347 | static gint |
| 14348 | control_skeleton_get_heatbeat (Control *object) |
| 14349 | { |
| 14350 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 14351 | gint value; |
| 14352 | g_mutex_lock (&skeleton->priv->lock); |
| 14353 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 14354 | g_mutex_unlock (&skeleton->priv->lock); |
| 14355 | return value; |
| 14356 | } |
| 14357 | |
| 14358 | static void |
| 14359 | control_skeleton_class_init (ControlSkeletonClass *klass) |
| 14360 | { |
| 14361 | GObjectClass *gobject_class; |
| 14362 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 14363 | |
| 14364 | gobject_class = G_OBJECT_CLASS (klass); |
| 14365 | gobject_class->finalize = control_skeleton_finalize; |
| 14366 | gobject_class->get_property = control_skeleton_get_property; |
| 14367 | gobject_class->set_property = control_skeleton_set_property; |
| 14368 | gobject_class->notify = control_skeleton_notify; |
| 14369 | |
| 14370 | |
| 14371 | control_override_properties (gobject_class, 1); |
| 14372 | |
| 14373 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 14374 | skeleton_class->get_info = control_skeleton_dbus_interface_get_info; |
| 14375 | skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties; |
| 14376 | skeleton_class->flush = control_skeleton_dbus_interface_flush; |
| 14377 | skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable; |
| 14378 | |
| 14379 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 14380 | g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate)); |
| 14381 | #endif |
| 14382 | } |
| 14383 | |
| 14384 | static void |
| 14385 | control_skeleton_iface_init (ControlIface *iface) |
| 14386 | { |
| 14387 | iface->heartbeat = _control_on_signal_heartbeat; |
| 14388 | iface->goto_system_state = _control_on_signal_goto_system_state; |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 14389 | iface->started = _control_on_signal_started; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14390 | iface->get_poll_interval = control_skeleton_get_poll_interval; |
| 14391 | iface->get_heatbeat = control_skeleton_get_heatbeat; |
| 14392 | } |
| 14393 | |
| 14394 | /** |
| 14395 | * control_skeleton_new: |
| 14396 | * |
| 14397 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 14398 | * |
| 14399 | * Returns: (transfer full) (type ControlSkeleton): The skeleton object. |
| 14400 | */ |
| 14401 | Control * |
| 14402 | control_skeleton_new (void) |
| 14403 | { |
| 14404 | return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL)); |
| 14405 | } |
| 14406 | |
| 14407 | /* ------------------------------------------------------------------------ |
| 14408 | * Code for interface org.openbmc.control.Bmc |
| 14409 | * ------------------------------------------------------------------------ |
| 14410 | */ |
| 14411 | |
| 14412 | /** |
| 14413 | * SECTION:ControlBmc |
| 14414 | * @title: ControlBmc |
| 14415 | * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface |
| 14416 | * |
| 14417 | * 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. |
| 14418 | */ |
| 14419 | |
| 14420 | /* ---- Introspection data for org.openbmc.control.Bmc ---- */ |
| 14421 | |
| 14422 | static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder = |
| 14423 | { |
| 14424 | { |
| 14425 | -1, |
| 14426 | (gchar *) "place_holder", |
| 14427 | NULL, |
| 14428 | NULL, |
| 14429 | NULL |
| 14430 | }, |
| 14431 | "handle-place-holder", |
| 14432 | FALSE |
| 14433 | }; |
| 14434 | |
| 14435 | static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] = |
| 14436 | { |
| 14437 | &_control_bmc_method_info_place_holder, |
| 14438 | NULL |
| 14439 | }; |
| 14440 | |
| 14441 | static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info = |
| 14442 | { |
| 14443 | { |
| 14444 | -1, |
| 14445 | (gchar *) "org.openbmc.control.Bmc", |
| 14446 | (GDBusMethodInfo **) &_control_bmc_method_info_pointers, |
| 14447 | NULL, |
| 14448 | NULL, |
| 14449 | NULL |
| 14450 | }, |
| 14451 | "control-bmc", |
| 14452 | }; |
| 14453 | |
| 14454 | |
| 14455 | /** |
| 14456 | * control_bmc_interface_info: |
| 14457 | * |
| 14458 | * 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. |
| 14459 | * |
| 14460 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 14461 | */ |
| 14462 | GDBusInterfaceInfo * |
| 14463 | control_bmc_interface_info (void) |
| 14464 | { |
| 14465 | return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct; |
| 14466 | } |
| 14467 | |
| 14468 | /** |
| 14469 | * control_bmc_override_properties: |
| 14470 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 14471 | * @property_id_begin: The property id to assign to the first overridden property. |
| 14472 | * |
| 14473 | * Overrides all #GObject properties in the #ControlBmc interface for a concrete class. |
| 14474 | * The properties are overridden in the order they are defined. |
| 14475 | * |
| 14476 | * Returns: The last property id. |
| 14477 | */ |
| 14478 | guint |
| 14479 | control_bmc_override_properties (GObjectClass *klass, guint property_id_begin) |
| 14480 | { |
| 14481 | return property_id_begin - 1; |
| 14482 | } |
| 14483 | |
| 14484 | |
| 14485 | |
| 14486 | /** |
| 14487 | * ControlBmc: |
| 14488 | * |
| 14489 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 14490 | */ |
| 14491 | |
| 14492 | /** |
| 14493 | * ControlBmcIface: |
| 14494 | * @parent_iface: The parent interface. |
| 14495 | * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal. |
| 14496 | * |
| 14497 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 14498 | */ |
| 14499 | |
| 14500 | typedef ControlBmcIface ControlBmcInterface; |
| 14501 | G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT); |
| 14502 | |
| 14503 | static void |
| 14504 | control_bmc_default_init (ControlBmcIface *iface) |
| 14505 | { |
| 14506 | /* GObject signals for incoming D-Bus method calls: */ |
| 14507 | /** |
| 14508 | * ControlBmc::handle-place-holder: |
| 14509 | * @object: A #ControlBmc. |
| 14510 | * @invocation: A #GDBusMethodInvocation. |
| 14511 | * |
| 14512 | * 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. |
| 14513 | * |
| 14514 | * 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. |
| 14515 | * |
| 14516 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14517 | */ |
| 14518 | g_signal_new ("handle-place-holder", |
| 14519 | G_TYPE_FROM_INTERFACE (iface), |
| 14520 | G_SIGNAL_RUN_LAST, |
| 14521 | G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder), |
| 14522 | g_signal_accumulator_true_handled, |
| 14523 | NULL, |
| 14524 | g_cclosure_marshal_generic, |
| 14525 | G_TYPE_BOOLEAN, |
| 14526 | 1, |
| 14527 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14528 | |
| 14529 | } |
| 14530 | |
| 14531 | /** |
| 14532 | * control_bmc_call_place_holder: |
| 14533 | * @proxy: A #ControlBmcProxy. |
| 14534 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14535 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14536 | * @user_data: User data to pass to @callback. |
| 14537 | * |
| 14538 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. |
| 14539 | * 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. |
| 14540 | * You can then call control_bmc_call_place_holder_finish() to get the result of the operation. |
| 14541 | * |
| 14542 | * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method. |
| 14543 | */ |
| 14544 | void |
| 14545 | control_bmc_call_place_holder ( |
| 14546 | ControlBmc *proxy, |
| 14547 | GCancellable *cancellable, |
| 14548 | GAsyncReadyCallback callback, |
| 14549 | gpointer user_data) |
| 14550 | { |
| 14551 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14552 | "place_holder", |
| 14553 | g_variant_new ("()"), |
| 14554 | G_DBUS_CALL_FLAGS_NONE, |
| 14555 | -1, |
| 14556 | cancellable, |
| 14557 | callback, |
| 14558 | user_data); |
| 14559 | } |
| 14560 | |
| 14561 | /** |
| 14562 | * control_bmc_call_place_holder_finish: |
| 14563 | * @proxy: A #ControlBmcProxy. |
| 14564 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder(). |
| 14565 | * @error: Return location for error or %NULL. |
| 14566 | * |
| 14567 | * Finishes an operation started with control_bmc_call_place_holder(). |
| 14568 | * |
| 14569 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14570 | */ |
| 14571 | gboolean |
| 14572 | control_bmc_call_place_holder_finish ( |
| 14573 | ControlBmc *proxy, |
| 14574 | GAsyncResult *res, |
| 14575 | GError **error) |
| 14576 | { |
| 14577 | GVariant *_ret; |
| 14578 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14579 | if (_ret == NULL) |
| 14580 | goto _out; |
| 14581 | g_variant_get (_ret, |
| 14582 | "()"); |
| 14583 | g_variant_unref (_ret); |
| 14584 | _out: |
| 14585 | return _ret != NULL; |
| 14586 | } |
| 14587 | |
| 14588 | /** |
| 14589 | * control_bmc_call_place_holder_sync: |
| 14590 | * @proxy: A #ControlBmcProxy. |
| 14591 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14592 | * @error: Return location for error or %NULL. |
| 14593 | * |
| 14594 | * 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. |
| 14595 | * |
| 14596 | * See control_bmc_call_place_holder() for the asynchronous version of this method. |
| 14597 | * |
| 14598 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14599 | */ |
| 14600 | gboolean |
| 14601 | control_bmc_call_place_holder_sync ( |
| 14602 | ControlBmc *proxy, |
| 14603 | GCancellable *cancellable, |
| 14604 | GError **error) |
| 14605 | { |
| 14606 | GVariant *_ret; |
| 14607 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14608 | "place_holder", |
| 14609 | g_variant_new ("()"), |
| 14610 | G_DBUS_CALL_FLAGS_NONE, |
| 14611 | -1, |
| 14612 | cancellable, |
| 14613 | error); |
| 14614 | if (_ret == NULL) |
| 14615 | goto _out; |
| 14616 | g_variant_get (_ret, |
| 14617 | "()"); |
| 14618 | g_variant_unref (_ret); |
| 14619 | _out: |
| 14620 | return _ret != NULL; |
| 14621 | } |
| 14622 | |
| 14623 | /** |
| 14624 | * control_bmc_complete_place_holder: |
| 14625 | * @object: A #ControlBmc. |
| 14626 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 14627 | * |
| 14628 | * 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. |
| 14629 | * |
| 14630 | * This method will free @invocation, you cannot use it afterwards. |
| 14631 | */ |
| 14632 | void |
| 14633 | control_bmc_complete_place_holder ( |
| 14634 | ControlBmc *object, |
| 14635 | GDBusMethodInvocation *invocation) |
| 14636 | { |
| 14637 | g_dbus_method_invocation_return_value (invocation, |
| 14638 | g_variant_new ("()")); |
| 14639 | } |
| 14640 | |
| 14641 | /* ------------------------------------------------------------------------ */ |
| 14642 | |
| 14643 | /** |
| 14644 | * ControlBmcProxy: |
| 14645 | * |
| 14646 | * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API. |
| 14647 | */ |
| 14648 | |
| 14649 | /** |
| 14650 | * ControlBmcProxyClass: |
| 14651 | * @parent_class: The parent class. |
| 14652 | * |
| 14653 | * Class structure for #ControlBmcProxy. |
| 14654 | */ |
| 14655 | |
| 14656 | struct _ControlBmcProxyPrivate |
| 14657 | { |
| 14658 | GData *qdata; |
| 14659 | }; |
| 14660 | |
| 14661 | static void control_bmc_proxy_iface_init (ControlBmcIface *iface); |
| 14662 | |
| 14663 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14664 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 14665 | G_ADD_PRIVATE (ControlBmcProxy) |
| 14666 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 14667 | |
| 14668 | #else |
| 14669 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 14670 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 14671 | |
| 14672 | #endif |
| 14673 | static void |
| 14674 | control_bmc_proxy_finalize (GObject *object) |
| 14675 | { |
| 14676 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object); |
| 14677 | g_datalist_clear (&proxy->priv->qdata); |
| 14678 | G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object); |
| 14679 | } |
| 14680 | |
| 14681 | static void |
| 14682 | control_bmc_proxy_get_property (GObject *object, |
| 14683 | guint prop_id, |
| 14684 | GValue *value, |
| 14685 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14686 | { |
| 14687 | } |
| 14688 | |
| 14689 | static void |
| 14690 | control_bmc_proxy_set_property (GObject *object, |
| 14691 | guint prop_id, |
| 14692 | const GValue *value, |
| 14693 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14694 | { |
| 14695 | } |
| 14696 | |
| 14697 | static void |
| 14698 | control_bmc_proxy_g_signal (GDBusProxy *proxy, |
| 14699 | const gchar *sender_name G_GNUC_UNUSED, |
| 14700 | const gchar *signal_name, |
| 14701 | GVariant *parameters) |
| 14702 | { |
| 14703 | _ExtendedGDBusSignalInfo *info; |
| 14704 | GVariantIter iter; |
| 14705 | GVariant *child; |
| 14706 | GValue *paramv; |
| 14707 | guint num_params; |
| 14708 | guint n; |
| 14709 | guint signal_id; |
| 14710 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name); |
| 14711 | if (info == NULL) |
| 14712 | return; |
| 14713 | num_params = g_variant_n_children (parameters); |
| 14714 | paramv = g_new0 (GValue, num_params + 1); |
| 14715 | g_value_init (¶mv[0], TYPE_CONTROL_BMC); |
| 14716 | g_value_set_object (¶mv[0], proxy); |
| 14717 | g_variant_iter_init (&iter, parameters); |
| 14718 | n = 1; |
| 14719 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 14720 | { |
| 14721 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 14722 | if (arg_info->use_gvariant) |
| 14723 | { |
| 14724 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 14725 | g_value_set_variant (¶mv[n], child); |
| 14726 | n++; |
| 14727 | } |
| 14728 | else |
| 14729 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 14730 | g_variant_unref (child); |
| 14731 | } |
| 14732 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 14733 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 14734 | for (n = 0; n < num_params + 1; n++) |
| 14735 | g_value_unset (¶mv[n]); |
| 14736 | g_free (paramv); |
| 14737 | } |
| 14738 | |
| 14739 | static void |
| 14740 | control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 14741 | GVariant *changed_properties, |
| 14742 | const gchar *const *invalidated_properties) |
| 14743 | { |
| 14744 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy); |
| 14745 | guint n; |
| 14746 | const gchar *key; |
| 14747 | GVariantIter *iter; |
| 14748 | _ExtendedGDBusPropertyInfo *info; |
| 14749 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 14750 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 14751 | { |
| 14752 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key); |
| 14753 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 14754 | if (info != NULL) |
| 14755 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 14756 | } |
| 14757 | g_variant_iter_free (iter); |
| 14758 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 14759 | { |
| 14760 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]); |
| 14761 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 14762 | if (info != NULL) |
| 14763 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 14764 | } |
| 14765 | } |
| 14766 | |
| 14767 | static void |
| 14768 | control_bmc_proxy_init (ControlBmcProxy *proxy) |
| 14769 | { |
| 14770 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14771 | proxy->priv = control_bmc_proxy_get_instance_private (proxy); |
| 14772 | #else |
| 14773 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate); |
| 14774 | #endif |
| 14775 | |
| 14776 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ()); |
| 14777 | } |
| 14778 | |
| 14779 | static void |
| 14780 | control_bmc_proxy_class_init (ControlBmcProxyClass *klass) |
| 14781 | { |
| 14782 | GObjectClass *gobject_class; |
| 14783 | GDBusProxyClass *proxy_class; |
| 14784 | |
| 14785 | gobject_class = G_OBJECT_CLASS (klass); |
| 14786 | gobject_class->finalize = control_bmc_proxy_finalize; |
| 14787 | gobject_class->get_property = control_bmc_proxy_get_property; |
| 14788 | gobject_class->set_property = control_bmc_proxy_set_property; |
| 14789 | |
| 14790 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 14791 | proxy_class->g_signal = control_bmc_proxy_g_signal; |
| 14792 | proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed; |
| 14793 | |
| 14794 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 14795 | g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate)); |
| 14796 | #endif |
| 14797 | } |
| 14798 | |
| 14799 | static void |
| 14800 | control_bmc_proxy_iface_init (ControlBmcIface *iface) |
| 14801 | { |
| 14802 | } |
| 14803 | |
| 14804 | /** |
| 14805 | * control_bmc_proxy_new: |
| 14806 | * @connection: A #GDBusConnection. |
| 14807 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14808 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 14809 | * @object_path: An object path. |
| 14810 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14811 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 14812 | * @user_data: User data to pass to @callback. |
| 14813 | * |
| 14814 | * 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. |
| 14815 | * |
| 14816 | * 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. |
| 14817 | * You can then call control_bmc_proxy_new_finish() to get the result of the operation. |
| 14818 | * |
| 14819 | * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 14820 | */ |
| 14821 | void |
| 14822 | control_bmc_proxy_new ( |
| 14823 | GDBusConnection *connection, |
| 14824 | GDBusProxyFlags flags, |
| 14825 | const gchar *name, |
| 14826 | const gchar *object_path, |
| 14827 | GCancellable *cancellable, |
| 14828 | GAsyncReadyCallback callback, |
| 14829 | gpointer user_data) |
| 14830 | { |
| 14831 | 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); |
| 14832 | } |
| 14833 | |
| 14834 | /** |
| 14835 | * control_bmc_proxy_new_finish: |
| 14836 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new(). |
| 14837 | * @error: Return location for error or %NULL |
| 14838 | * |
| 14839 | * Finishes an operation started with control_bmc_proxy_new(). |
| 14840 | * |
| 14841 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 14842 | */ |
| 14843 | ControlBmc * |
| 14844 | control_bmc_proxy_new_finish ( |
| 14845 | GAsyncResult *res, |
| 14846 | GError **error) |
| 14847 | { |
| 14848 | GObject *ret; |
| 14849 | GObject *source_object; |
| 14850 | source_object = g_async_result_get_source_object (res); |
| 14851 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 14852 | g_object_unref (source_object); |
| 14853 | if (ret != NULL) |
| 14854 | return CONTROL_BMC (ret); |
| 14855 | else |
| 14856 | return NULL; |
| 14857 | } |
| 14858 | |
| 14859 | /** |
| 14860 | * control_bmc_proxy_new_sync: |
| 14861 | * @connection: A #GDBusConnection. |
| 14862 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14863 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 14864 | * @object_path: An object path. |
| 14865 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14866 | * @error: Return location for error or %NULL |
| 14867 | * |
| 14868 | * 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. |
| 14869 | * |
| 14870 | * The calling thread is blocked until a reply is received. |
| 14871 | * |
| 14872 | * See control_bmc_proxy_new() for the asynchronous version of this constructor. |
| 14873 | * |
| 14874 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 14875 | */ |
| 14876 | ControlBmc * |
| 14877 | control_bmc_proxy_new_sync ( |
| 14878 | GDBusConnection *connection, |
| 14879 | GDBusProxyFlags flags, |
| 14880 | const gchar *name, |
| 14881 | const gchar *object_path, |
| 14882 | GCancellable *cancellable, |
| 14883 | GError **error) |
| 14884 | { |
| 14885 | GInitable *ret; |
| 14886 | 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); |
| 14887 | if (ret != NULL) |
| 14888 | return CONTROL_BMC (ret); |
| 14889 | else |
| 14890 | return NULL; |
| 14891 | } |
| 14892 | |
| 14893 | |
| 14894 | /** |
| 14895 | * control_bmc_proxy_new_for_bus: |
| 14896 | * @bus_type: A #GBusType. |
| 14897 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14898 | * @name: A bus name (well-known or unique). |
| 14899 | * @object_path: An object path. |
| 14900 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14901 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 14902 | * @user_data: User data to pass to @callback. |
| 14903 | * |
| 14904 | * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 14905 | * |
| 14906 | * 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. |
| 14907 | * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation. |
| 14908 | * |
| 14909 | * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 14910 | */ |
| 14911 | void |
| 14912 | control_bmc_proxy_new_for_bus ( |
| 14913 | GBusType bus_type, |
| 14914 | GDBusProxyFlags flags, |
| 14915 | const gchar *name, |
| 14916 | const gchar *object_path, |
| 14917 | GCancellable *cancellable, |
| 14918 | GAsyncReadyCallback callback, |
| 14919 | gpointer user_data) |
| 14920 | { |
| 14921 | 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); |
| 14922 | } |
| 14923 | |
| 14924 | /** |
| 14925 | * control_bmc_proxy_new_for_bus_finish: |
| 14926 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus(). |
| 14927 | * @error: Return location for error or %NULL |
| 14928 | * |
| 14929 | * Finishes an operation started with control_bmc_proxy_new_for_bus(). |
| 14930 | * |
| 14931 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 14932 | */ |
| 14933 | ControlBmc * |
| 14934 | control_bmc_proxy_new_for_bus_finish ( |
| 14935 | GAsyncResult *res, |
| 14936 | GError **error) |
| 14937 | { |
| 14938 | GObject *ret; |
| 14939 | GObject *source_object; |
| 14940 | source_object = g_async_result_get_source_object (res); |
| 14941 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 14942 | g_object_unref (source_object); |
| 14943 | if (ret != NULL) |
| 14944 | return CONTROL_BMC (ret); |
| 14945 | else |
| 14946 | return NULL; |
| 14947 | } |
| 14948 | |
| 14949 | /** |
| 14950 | * control_bmc_proxy_new_for_bus_sync: |
| 14951 | * @bus_type: A #GBusType. |
| 14952 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 14953 | * @name: A bus name (well-known or unique). |
| 14954 | * @object_path: An object path. |
| 14955 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14956 | * @error: Return location for error or %NULL |
| 14957 | * |
| 14958 | * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 14959 | * |
| 14960 | * The calling thread is blocked until a reply is received. |
| 14961 | * |
| 14962 | * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 14963 | * |
| 14964 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 14965 | */ |
| 14966 | ControlBmc * |
| 14967 | control_bmc_proxy_new_for_bus_sync ( |
| 14968 | GBusType bus_type, |
| 14969 | GDBusProxyFlags flags, |
| 14970 | const gchar *name, |
| 14971 | const gchar *object_path, |
| 14972 | GCancellable *cancellable, |
| 14973 | GError **error) |
| 14974 | { |
| 14975 | GInitable *ret; |
| 14976 | 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); |
| 14977 | if (ret != NULL) |
| 14978 | return CONTROL_BMC (ret); |
| 14979 | else |
| 14980 | return NULL; |
| 14981 | } |
| 14982 | |
| 14983 | |
| 14984 | /* ------------------------------------------------------------------------ */ |
| 14985 | |
| 14986 | /** |
| 14987 | * ControlBmcSkeleton: |
| 14988 | * |
| 14989 | * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API. |
| 14990 | */ |
| 14991 | |
| 14992 | /** |
| 14993 | * ControlBmcSkeletonClass: |
| 14994 | * @parent_class: The parent class. |
| 14995 | * |
| 14996 | * Class structure for #ControlBmcSkeleton. |
| 14997 | */ |
| 14998 | |
| 14999 | struct _ControlBmcSkeletonPrivate |
| 15000 | { |
| 15001 | GValue *properties; |
| 15002 | GList *changed_properties; |
| 15003 | GSource *changed_properties_idle_source; |
| 15004 | GMainContext *context; |
| 15005 | GMutex lock; |
| 15006 | }; |
| 15007 | |
| 15008 | static void |
| 15009 | _control_bmc_skeleton_handle_method_call ( |
| 15010 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15011 | const gchar *sender G_GNUC_UNUSED, |
| 15012 | const gchar *object_path G_GNUC_UNUSED, |
| 15013 | const gchar *interface_name, |
| 15014 | const gchar *method_name, |
| 15015 | GVariant *parameters, |
| 15016 | GDBusMethodInvocation *invocation, |
| 15017 | gpointer user_data) |
| 15018 | { |
| 15019 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 15020 | _ExtendedGDBusMethodInfo *info; |
| 15021 | GVariantIter iter; |
| 15022 | GVariant *child; |
| 15023 | GValue *paramv; |
| 15024 | guint num_params; |
| 15025 | guint num_extra; |
| 15026 | guint n; |
| 15027 | guint signal_id; |
| 15028 | GValue return_value = G_VALUE_INIT; |
| 15029 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 15030 | g_assert (info != NULL); |
| 15031 | num_params = g_variant_n_children (parameters); |
| 15032 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 15033 | n = 0; |
| 15034 | g_value_init (¶mv[n], TYPE_CONTROL_BMC); |
| 15035 | g_value_set_object (¶mv[n++], skeleton); |
| 15036 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 15037 | g_value_set_object (¶mv[n++], invocation); |
| 15038 | if (info->pass_fdlist) |
| 15039 | { |
| 15040 | #ifdef G_OS_UNIX |
| 15041 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 15042 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 15043 | #else |
| 15044 | g_assert_not_reached (); |
| 15045 | #endif |
| 15046 | } |
| 15047 | g_variant_iter_init (&iter, parameters); |
| 15048 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15049 | { |
| 15050 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 15051 | if (arg_info->use_gvariant) |
| 15052 | { |
| 15053 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15054 | g_value_set_variant (¶mv[n], child); |
| 15055 | n++; |
| 15056 | } |
| 15057 | else |
| 15058 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15059 | g_variant_unref (child); |
| 15060 | } |
| 15061 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 15062 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 15063 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 15064 | if (!g_value_get_boolean (&return_value)) |
| 15065 | 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); |
| 15066 | g_value_unset (&return_value); |
| 15067 | for (n = 0; n < num_params + num_extra; n++) |
| 15068 | g_value_unset (¶mv[n]); |
| 15069 | g_free (paramv); |
| 15070 | } |
| 15071 | |
| 15072 | static GVariant * |
| 15073 | _control_bmc_skeleton_handle_get_property ( |
| 15074 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15075 | const gchar *sender G_GNUC_UNUSED, |
| 15076 | const gchar *object_path G_GNUC_UNUSED, |
| 15077 | const gchar *interface_name G_GNUC_UNUSED, |
| 15078 | const gchar *property_name, |
| 15079 | GError **error, |
| 15080 | gpointer user_data) |
| 15081 | { |
| 15082 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 15083 | GValue value = G_VALUE_INIT; |
| 15084 | GParamSpec *pspec; |
| 15085 | _ExtendedGDBusPropertyInfo *info; |
| 15086 | GVariant *ret; |
| 15087 | ret = NULL; |
| 15088 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 15089 | g_assert (info != NULL); |
| 15090 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15091 | if (pspec == NULL) |
| 15092 | { |
| 15093 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15094 | } |
| 15095 | else |
| 15096 | { |
| 15097 | g_value_init (&value, pspec->value_type); |
| 15098 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15099 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15100 | g_value_unset (&value); |
| 15101 | } |
| 15102 | return ret; |
| 15103 | } |
| 15104 | |
| 15105 | static gboolean |
| 15106 | _control_bmc_skeleton_handle_set_property ( |
| 15107 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15108 | const gchar *sender G_GNUC_UNUSED, |
| 15109 | const gchar *object_path G_GNUC_UNUSED, |
| 15110 | const gchar *interface_name G_GNUC_UNUSED, |
| 15111 | const gchar *property_name, |
| 15112 | GVariant *variant, |
| 15113 | GError **error, |
| 15114 | gpointer user_data) |
| 15115 | { |
| 15116 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 15117 | GValue value = G_VALUE_INIT; |
| 15118 | GParamSpec *pspec; |
| 15119 | _ExtendedGDBusPropertyInfo *info; |
| 15120 | gboolean ret; |
| 15121 | ret = FALSE; |
| 15122 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 15123 | g_assert (info != NULL); |
| 15124 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15125 | if (pspec == NULL) |
| 15126 | { |
| 15127 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15128 | } |
| 15129 | else |
| 15130 | { |
| 15131 | if (info->use_gvariant) |
| 15132 | g_value_set_variant (&value, variant); |
| 15133 | else |
| 15134 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 15135 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15136 | g_value_unset (&value); |
| 15137 | ret = TRUE; |
| 15138 | } |
| 15139 | return ret; |
| 15140 | } |
| 15141 | |
| 15142 | static const GDBusInterfaceVTable _control_bmc_skeleton_vtable = |
| 15143 | { |
| 15144 | _control_bmc_skeleton_handle_method_call, |
| 15145 | _control_bmc_skeleton_handle_get_property, |
| 15146 | _control_bmc_skeleton_handle_set_property, |
| 15147 | {NULL} |
| 15148 | }; |
| 15149 | |
| 15150 | static GDBusInterfaceInfo * |
| 15151 | control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15152 | { |
| 15153 | return control_bmc_interface_info (); |
| 15154 | } |
| 15155 | |
| 15156 | static GDBusInterfaceVTable * |
| 15157 | control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15158 | { |
| 15159 | return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable; |
| 15160 | } |
| 15161 | |
| 15162 | static GVariant * |
| 15163 | control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 15164 | { |
| 15165 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton); |
| 15166 | |
| 15167 | GVariantBuilder builder; |
| 15168 | guint n; |
| 15169 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15170 | if (_control_bmc_interface_info.parent_struct.properties == NULL) |
| 15171 | goto out; |
| 15172 | for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++) |
| 15173 | { |
| 15174 | GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n]; |
| 15175 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 15176 | { |
| 15177 | GVariant *value; |
| 15178 | 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); |
| 15179 | if (value != NULL) |
| 15180 | { |
| 15181 | g_variant_take_ref (value); |
| 15182 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 15183 | g_variant_unref (value); |
| 15184 | } |
| 15185 | } |
| 15186 | } |
| 15187 | out: |
| 15188 | return g_variant_builder_end (&builder); |
| 15189 | } |
| 15190 | |
| 15191 | static void |
| 15192 | control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 15193 | { |
| 15194 | } |
| 15195 | |
| 15196 | static void control_bmc_skeleton_iface_init (ControlBmcIface *iface); |
| 15197 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15198 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15199 | G_ADD_PRIVATE (ControlBmcSkeleton) |
| 15200 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 15201 | |
| 15202 | #else |
| 15203 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15204 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 15205 | |
| 15206 | #endif |
| 15207 | static void |
| 15208 | control_bmc_skeleton_finalize (GObject *object) |
| 15209 | { |
| 15210 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object); |
| 15211 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15212 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15213 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15214 | g_main_context_unref (skeleton->priv->context); |
| 15215 | g_mutex_clear (&skeleton->priv->lock); |
| 15216 | G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object); |
| 15217 | } |
| 15218 | |
| 15219 | static void |
| 15220 | control_bmc_skeleton_init (ControlBmcSkeleton *skeleton) |
| 15221 | { |
| 15222 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15223 | skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton); |
| 15224 | #else |
| 15225 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate); |
| 15226 | #endif |
| 15227 | |
| 15228 | g_mutex_init (&skeleton->priv->lock); |
| 15229 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 15230 | } |
| 15231 | |
| 15232 | static void |
| 15233 | control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass) |
| 15234 | { |
| 15235 | GObjectClass *gobject_class; |
| 15236 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 15237 | |
| 15238 | gobject_class = G_OBJECT_CLASS (klass); |
| 15239 | gobject_class->finalize = control_bmc_skeleton_finalize; |
| 15240 | |
| 15241 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 15242 | skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info; |
| 15243 | skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties; |
| 15244 | skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush; |
| 15245 | skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable; |
| 15246 | |
| 15247 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 15248 | g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate)); |
| 15249 | #endif |
| 15250 | } |
| 15251 | |
| 15252 | static void |
| 15253 | control_bmc_skeleton_iface_init (ControlBmcIface *iface) |
| 15254 | { |
| 15255 | } |
| 15256 | |
| 15257 | /** |
| 15258 | * control_bmc_skeleton_new: |
| 15259 | * |
| 15260 | * 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>. |
| 15261 | * |
| 15262 | * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object. |
| 15263 | */ |
| 15264 | ControlBmc * |
| 15265 | control_bmc_skeleton_new (void) |
| 15266 | { |
| 15267 | return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL)); |
| 15268 | } |
| 15269 | |
| 15270 | /* ------------------------------------------------------------------------ |
| 15271 | * Code for interface org.openbmc.control.Host |
| 15272 | * ------------------------------------------------------------------------ |
| 15273 | */ |
| 15274 | |
| 15275 | /** |
| 15276 | * SECTION:ControlHost |
| 15277 | * @title: ControlHost |
| 15278 | * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface |
| 15279 | * |
| 15280 | * 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. |
| 15281 | */ |
| 15282 | |
| 15283 | /* ---- Introspection data for org.openbmc.control.Host ---- */ |
| 15284 | |
| 15285 | static const _ExtendedGDBusMethodInfo _control_host_method_info_boot = |
| 15286 | { |
| 15287 | { |
| 15288 | -1, |
| 15289 | (gchar *) "boot", |
| 15290 | NULL, |
| 15291 | NULL, |
| 15292 | NULL |
| 15293 | }, |
| 15294 | "handle-boot", |
| 15295 | FALSE |
| 15296 | }; |
| 15297 | |
| 15298 | static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown = |
| 15299 | { |
| 15300 | { |
| 15301 | -1, |
| 15302 | (gchar *) "shutdown", |
| 15303 | NULL, |
| 15304 | NULL, |
| 15305 | NULL |
| 15306 | }, |
| 15307 | "handle-shutdown", |
| 15308 | FALSE |
| 15309 | }; |
| 15310 | |
| 15311 | static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot = |
| 15312 | { |
| 15313 | { |
| 15314 | -1, |
| 15315 | (gchar *) "reboot", |
| 15316 | NULL, |
| 15317 | NULL, |
| 15318 | NULL |
| 15319 | }, |
| 15320 | "handle-reboot", |
| 15321 | FALSE |
| 15322 | }; |
| 15323 | |
| 15324 | static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] = |
| 15325 | { |
| 15326 | &_control_host_method_info_boot, |
| 15327 | &_control_host_method_info_shutdown, |
| 15328 | &_control_host_method_info_reboot, |
| 15329 | NULL |
| 15330 | }; |
| 15331 | |
| 15332 | static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted = |
| 15333 | { |
| 15334 | { |
| 15335 | -1, |
| 15336 | (gchar *) "Booted", |
| 15337 | NULL, |
| 15338 | NULL |
| 15339 | }, |
| 15340 | "booted" |
| 15341 | }; |
| 15342 | |
| 15343 | static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] = |
| 15344 | { |
| 15345 | &_control_host_signal_info_booted, |
| 15346 | NULL |
| 15347 | }; |
| 15348 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15349 | static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode = |
| 15350 | { |
| 15351 | { |
| 15352 | -1, |
| 15353 | (gchar *) "debug_mode", |
| 15354 | (gchar *) "i", |
| 15355 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 15356 | NULL |
| 15357 | }, |
| 15358 | "debug-mode", |
| 15359 | FALSE |
| 15360 | }; |
| 15361 | |
| 15362 | static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side = |
| 15363 | { |
| 15364 | { |
| 15365 | -1, |
| 15366 | (gchar *) "flash_side", |
| 15367 | (gchar *) "s", |
| 15368 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 15369 | NULL |
| 15370 | }, |
| 15371 | "flash-side", |
| 15372 | FALSE |
| 15373 | }; |
| 15374 | |
| 15375 | static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] = |
| 15376 | { |
| 15377 | &_control_host_property_info_debug_mode, |
| 15378 | &_control_host_property_info_flash_side, |
| 15379 | NULL |
| 15380 | }; |
| 15381 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15382 | static const _ExtendedGDBusInterfaceInfo _control_host_interface_info = |
| 15383 | { |
| 15384 | { |
| 15385 | -1, |
| 15386 | (gchar *) "org.openbmc.control.Host", |
| 15387 | (GDBusMethodInfo **) &_control_host_method_info_pointers, |
| 15388 | (GDBusSignalInfo **) &_control_host_signal_info_pointers, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15389 | (GDBusPropertyInfo **) &_control_host_property_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15390 | NULL |
| 15391 | }, |
| 15392 | "control-host", |
| 15393 | }; |
| 15394 | |
| 15395 | |
| 15396 | /** |
| 15397 | * control_host_interface_info: |
| 15398 | * |
| 15399 | * 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. |
| 15400 | * |
| 15401 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 15402 | */ |
| 15403 | GDBusInterfaceInfo * |
| 15404 | control_host_interface_info (void) |
| 15405 | { |
| 15406 | return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct; |
| 15407 | } |
| 15408 | |
| 15409 | /** |
| 15410 | * control_host_override_properties: |
| 15411 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 15412 | * @property_id_begin: The property id to assign to the first overridden property. |
| 15413 | * |
| 15414 | * Overrides all #GObject properties in the #ControlHost interface for a concrete class. |
| 15415 | * The properties are overridden in the order they are defined. |
| 15416 | * |
| 15417 | * Returns: The last property id. |
| 15418 | */ |
| 15419 | guint |
| 15420 | control_host_override_properties (GObjectClass *klass, guint property_id_begin) |
| 15421 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15422 | g_object_class_override_property (klass, property_id_begin++, "debug-mode"); |
| 15423 | g_object_class_override_property (klass, property_id_begin++, "flash-side"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15424 | return property_id_begin - 1; |
| 15425 | } |
| 15426 | |
| 15427 | |
| 15428 | |
| 15429 | /** |
| 15430 | * ControlHost: |
| 15431 | * |
| 15432 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 15433 | */ |
| 15434 | |
| 15435 | /** |
| 15436 | * ControlHostIface: |
| 15437 | * @parent_iface: The parent interface. |
| 15438 | * @handle_boot: Handler for the #ControlHost::handle-boot signal. |
| 15439 | * @handle_reboot: Handler for the #ControlHost::handle-reboot signal. |
| 15440 | * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15441 | * @get_debug_mode: Getter for the #ControlHost:debug-mode property. |
| 15442 | * @get_flash_side: Getter for the #ControlHost:flash-side property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15443 | * @booted: Handler for the #ControlHost::booted signal. |
| 15444 | * |
| 15445 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 15446 | */ |
| 15447 | |
| 15448 | typedef ControlHostIface ControlHostInterface; |
| 15449 | G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT); |
| 15450 | |
| 15451 | static void |
| 15452 | control_host_default_init (ControlHostIface *iface) |
| 15453 | { |
| 15454 | /* GObject signals for incoming D-Bus method calls: */ |
| 15455 | /** |
| 15456 | * ControlHost::handle-boot: |
| 15457 | * @object: A #ControlHost. |
| 15458 | * @invocation: A #GDBusMethodInvocation. |
| 15459 | * |
| 15460 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. |
| 15461 | * |
| 15462 | * 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. |
| 15463 | * |
| 15464 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 15465 | */ |
| 15466 | g_signal_new ("handle-boot", |
| 15467 | G_TYPE_FROM_INTERFACE (iface), |
| 15468 | G_SIGNAL_RUN_LAST, |
| 15469 | G_STRUCT_OFFSET (ControlHostIface, handle_boot), |
| 15470 | g_signal_accumulator_true_handled, |
| 15471 | NULL, |
| 15472 | g_cclosure_marshal_generic, |
| 15473 | G_TYPE_BOOLEAN, |
| 15474 | 1, |
| 15475 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 15476 | |
| 15477 | /** |
| 15478 | * ControlHost::handle-shutdown: |
| 15479 | * @object: A #ControlHost. |
| 15480 | * @invocation: A #GDBusMethodInvocation. |
| 15481 | * |
| 15482 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. |
| 15483 | * |
| 15484 | * 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. |
| 15485 | * |
| 15486 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 15487 | */ |
| 15488 | g_signal_new ("handle-shutdown", |
| 15489 | G_TYPE_FROM_INTERFACE (iface), |
| 15490 | G_SIGNAL_RUN_LAST, |
| 15491 | G_STRUCT_OFFSET (ControlHostIface, handle_shutdown), |
| 15492 | g_signal_accumulator_true_handled, |
| 15493 | NULL, |
| 15494 | g_cclosure_marshal_generic, |
| 15495 | G_TYPE_BOOLEAN, |
| 15496 | 1, |
| 15497 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 15498 | |
| 15499 | /** |
| 15500 | * ControlHost::handle-reboot: |
| 15501 | * @object: A #ControlHost. |
| 15502 | * @invocation: A #GDBusMethodInvocation. |
| 15503 | * |
| 15504 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. |
| 15505 | * |
| 15506 | * 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. |
| 15507 | * |
| 15508 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 15509 | */ |
| 15510 | g_signal_new ("handle-reboot", |
| 15511 | G_TYPE_FROM_INTERFACE (iface), |
| 15512 | G_SIGNAL_RUN_LAST, |
| 15513 | G_STRUCT_OFFSET (ControlHostIface, handle_reboot), |
| 15514 | g_signal_accumulator_true_handled, |
| 15515 | NULL, |
| 15516 | g_cclosure_marshal_generic, |
| 15517 | G_TYPE_BOOLEAN, |
| 15518 | 1, |
| 15519 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 15520 | |
| 15521 | /* GObject signals for received D-Bus signals: */ |
| 15522 | /** |
| 15523 | * ControlHost::booted: |
| 15524 | * @object: A #ControlHost. |
| 15525 | * |
| 15526 | * 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. |
| 15527 | * |
| 15528 | * 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. |
| 15529 | */ |
| 15530 | g_signal_new ("booted", |
| 15531 | G_TYPE_FROM_INTERFACE (iface), |
| 15532 | G_SIGNAL_RUN_LAST, |
| 15533 | G_STRUCT_OFFSET (ControlHostIface, booted), |
| 15534 | NULL, |
| 15535 | NULL, |
| 15536 | g_cclosure_marshal_generic, |
| 15537 | G_TYPE_NONE, |
| 15538 | 0); |
| 15539 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15540 | /* GObject properties for D-Bus properties: */ |
| 15541 | /** |
| 15542 | * ControlHost:debug-mode: |
| 15543 | * |
| 15544 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>. |
| 15545 | * |
| 15546 | * 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. |
| 15547 | */ |
| 15548 | g_object_interface_install_property (iface, |
| 15549 | g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 15550 | /** |
| 15551 | * ControlHost:flash-side: |
| 15552 | * |
| 15553 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>. |
| 15554 | * |
| 15555 | * 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. |
| 15556 | */ |
| 15557 | g_object_interface_install_property (iface, |
| 15558 | g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 15559 | } |
| 15560 | |
| 15561 | /** |
| 15562 | * control_host_get_debug_mode: (skip) |
| 15563 | * @object: A #ControlHost. |
| 15564 | * |
| 15565 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property. |
| 15566 | * |
| 15567 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 15568 | * |
| 15569 | * Returns: The property value. |
| 15570 | */ |
| 15571 | gint |
| 15572 | control_host_get_debug_mode (ControlHost *object) |
| 15573 | { |
| 15574 | return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object); |
| 15575 | } |
| 15576 | |
| 15577 | /** |
| 15578 | * control_host_set_debug_mode: (skip) |
| 15579 | * @object: A #ControlHost. |
| 15580 | * @value: The value to set. |
| 15581 | * |
| 15582 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value. |
| 15583 | * |
| 15584 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 15585 | */ |
| 15586 | void |
| 15587 | control_host_set_debug_mode (ControlHost *object, gint value) |
| 15588 | { |
| 15589 | g_object_set (G_OBJECT (object), "debug-mode", value, NULL); |
| 15590 | } |
| 15591 | |
| 15592 | /** |
| 15593 | * control_host_get_flash_side: (skip) |
| 15594 | * @object: A #ControlHost. |
| 15595 | * |
| 15596 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. |
| 15597 | * |
| 15598 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 15599 | * |
| 15600 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use control_host_dup_flash_side() if on another thread.</warning> |
| 15601 | * |
| 15602 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 15603 | */ |
| 15604 | const gchar * |
| 15605 | control_host_get_flash_side (ControlHost *object) |
| 15606 | { |
| 15607 | return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object); |
| 15608 | } |
| 15609 | |
| 15610 | /** |
| 15611 | * control_host_dup_flash_side: (skip) |
| 15612 | * @object: A #ControlHost. |
| 15613 | * |
| 15614 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. |
| 15615 | * |
| 15616 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 15617 | * |
| 15618 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 15619 | */ |
| 15620 | gchar * |
| 15621 | control_host_dup_flash_side (ControlHost *object) |
| 15622 | { |
| 15623 | gchar *value; |
| 15624 | g_object_get (G_OBJECT (object), "flash-side", &value, NULL); |
| 15625 | return value; |
| 15626 | } |
| 15627 | |
| 15628 | /** |
| 15629 | * control_host_set_flash_side: (skip) |
| 15630 | * @object: A #ControlHost. |
| 15631 | * @value: The value to set. |
| 15632 | * |
| 15633 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value. |
| 15634 | * |
| 15635 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 15636 | */ |
| 15637 | void |
| 15638 | control_host_set_flash_side (ControlHost *object, const gchar *value) |
| 15639 | { |
| 15640 | g_object_set (G_OBJECT (object), "flash-side", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15641 | } |
| 15642 | |
| 15643 | /** |
| 15644 | * control_host_emit_booted: |
| 15645 | * @object: A #ControlHost. |
| 15646 | * |
| 15647 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal. |
| 15648 | */ |
| 15649 | void |
| 15650 | control_host_emit_booted ( |
| 15651 | ControlHost *object) |
| 15652 | { |
| 15653 | g_signal_emit_by_name (object, "booted"); |
| 15654 | } |
| 15655 | |
| 15656 | /** |
| 15657 | * control_host_call_boot: |
| 15658 | * @proxy: A #ControlHostProxy. |
| 15659 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15660 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 15661 | * @user_data: User data to pass to @callback. |
| 15662 | * |
| 15663 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. |
| 15664 | * 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. |
| 15665 | * You can then call control_host_call_boot_finish() to get the result of the operation. |
| 15666 | * |
| 15667 | * See control_host_call_boot_sync() for the synchronous, blocking version of this method. |
| 15668 | */ |
| 15669 | void |
| 15670 | control_host_call_boot ( |
| 15671 | ControlHost *proxy, |
| 15672 | GCancellable *cancellable, |
| 15673 | GAsyncReadyCallback callback, |
| 15674 | gpointer user_data) |
| 15675 | { |
| 15676 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 15677 | "boot", |
| 15678 | g_variant_new ("()"), |
| 15679 | G_DBUS_CALL_FLAGS_NONE, |
| 15680 | -1, |
| 15681 | cancellable, |
| 15682 | callback, |
| 15683 | user_data); |
| 15684 | } |
| 15685 | |
| 15686 | /** |
| 15687 | * control_host_call_boot_finish: |
| 15688 | * @proxy: A #ControlHostProxy. |
| 15689 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot(). |
| 15690 | * @error: Return location for error or %NULL. |
| 15691 | * |
| 15692 | * Finishes an operation started with control_host_call_boot(). |
| 15693 | * |
| 15694 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15695 | */ |
| 15696 | gboolean |
| 15697 | control_host_call_boot_finish ( |
| 15698 | ControlHost *proxy, |
| 15699 | GAsyncResult *res, |
| 15700 | GError **error) |
| 15701 | { |
| 15702 | GVariant *_ret; |
| 15703 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 15704 | if (_ret == NULL) |
| 15705 | goto _out; |
| 15706 | g_variant_get (_ret, |
| 15707 | "()"); |
| 15708 | g_variant_unref (_ret); |
| 15709 | _out: |
| 15710 | return _ret != NULL; |
| 15711 | } |
| 15712 | |
| 15713 | /** |
| 15714 | * control_host_call_boot_sync: |
| 15715 | * @proxy: A #ControlHostProxy. |
| 15716 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15717 | * @error: Return location for error or %NULL. |
| 15718 | * |
| 15719 | * 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. |
| 15720 | * |
| 15721 | * See control_host_call_boot() for the asynchronous version of this method. |
| 15722 | * |
| 15723 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15724 | */ |
| 15725 | gboolean |
| 15726 | control_host_call_boot_sync ( |
| 15727 | ControlHost *proxy, |
| 15728 | GCancellable *cancellable, |
| 15729 | GError **error) |
| 15730 | { |
| 15731 | GVariant *_ret; |
| 15732 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 15733 | "boot", |
| 15734 | g_variant_new ("()"), |
| 15735 | G_DBUS_CALL_FLAGS_NONE, |
| 15736 | -1, |
| 15737 | cancellable, |
| 15738 | error); |
| 15739 | if (_ret == NULL) |
| 15740 | goto _out; |
| 15741 | g_variant_get (_ret, |
| 15742 | "()"); |
| 15743 | g_variant_unref (_ret); |
| 15744 | _out: |
| 15745 | return _ret != NULL; |
| 15746 | } |
| 15747 | |
| 15748 | /** |
| 15749 | * control_host_call_shutdown: |
| 15750 | * @proxy: A #ControlHostProxy. |
| 15751 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15752 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 15753 | * @user_data: User data to pass to @callback. |
| 15754 | * |
| 15755 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. |
| 15756 | * 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. |
| 15757 | * You can then call control_host_call_shutdown_finish() to get the result of the operation. |
| 15758 | * |
| 15759 | * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method. |
| 15760 | */ |
| 15761 | void |
| 15762 | control_host_call_shutdown ( |
| 15763 | ControlHost *proxy, |
| 15764 | GCancellable *cancellable, |
| 15765 | GAsyncReadyCallback callback, |
| 15766 | gpointer user_data) |
| 15767 | { |
| 15768 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 15769 | "shutdown", |
| 15770 | g_variant_new ("()"), |
| 15771 | G_DBUS_CALL_FLAGS_NONE, |
| 15772 | -1, |
| 15773 | cancellable, |
| 15774 | callback, |
| 15775 | user_data); |
| 15776 | } |
| 15777 | |
| 15778 | /** |
| 15779 | * control_host_call_shutdown_finish: |
| 15780 | * @proxy: A #ControlHostProxy. |
| 15781 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown(). |
| 15782 | * @error: Return location for error or %NULL. |
| 15783 | * |
| 15784 | * Finishes an operation started with control_host_call_shutdown(). |
| 15785 | * |
| 15786 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15787 | */ |
| 15788 | gboolean |
| 15789 | control_host_call_shutdown_finish ( |
| 15790 | ControlHost *proxy, |
| 15791 | GAsyncResult *res, |
| 15792 | GError **error) |
| 15793 | { |
| 15794 | GVariant *_ret; |
| 15795 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 15796 | if (_ret == NULL) |
| 15797 | goto _out; |
| 15798 | g_variant_get (_ret, |
| 15799 | "()"); |
| 15800 | g_variant_unref (_ret); |
| 15801 | _out: |
| 15802 | return _ret != NULL; |
| 15803 | } |
| 15804 | |
| 15805 | /** |
| 15806 | * control_host_call_shutdown_sync: |
| 15807 | * @proxy: A #ControlHostProxy. |
| 15808 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15809 | * @error: Return location for error or %NULL. |
| 15810 | * |
| 15811 | * 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. |
| 15812 | * |
| 15813 | * See control_host_call_shutdown() for the asynchronous version of this method. |
| 15814 | * |
| 15815 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15816 | */ |
| 15817 | gboolean |
| 15818 | control_host_call_shutdown_sync ( |
| 15819 | ControlHost *proxy, |
| 15820 | GCancellable *cancellable, |
| 15821 | GError **error) |
| 15822 | { |
| 15823 | GVariant *_ret; |
| 15824 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 15825 | "shutdown", |
| 15826 | g_variant_new ("()"), |
| 15827 | G_DBUS_CALL_FLAGS_NONE, |
| 15828 | -1, |
| 15829 | cancellable, |
| 15830 | error); |
| 15831 | if (_ret == NULL) |
| 15832 | goto _out; |
| 15833 | g_variant_get (_ret, |
| 15834 | "()"); |
| 15835 | g_variant_unref (_ret); |
| 15836 | _out: |
| 15837 | return _ret != NULL; |
| 15838 | } |
| 15839 | |
| 15840 | /** |
| 15841 | * control_host_call_reboot: |
| 15842 | * @proxy: A #ControlHostProxy. |
| 15843 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15844 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 15845 | * @user_data: User data to pass to @callback. |
| 15846 | * |
| 15847 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. |
| 15848 | * 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. |
| 15849 | * You can then call control_host_call_reboot_finish() to get the result of the operation. |
| 15850 | * |
| 15851 | * See control_host_call_reboot_sync() for the synchronous, blocking version of this method. |
| 15852 | */ |
| 15853 | void |
| 15854 | control_host_call_reboot ( |
| 15855 | ControlHost *proxy, |
| 15856 | GCancellable *cancellable, |
| 15857 | GAsyncReadyCallback callback, |
| 15858 | gpointer user_data) |
| 15859 | { |
| 15860 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 15861 | "reboot", |
| 15862 | g_variant_new ("()"), |
| 15863 | G_DBUS_CALL_FLAGS_NONE, |
| 15864 | -1, |
| 15865 | cancellable, |
| 15866 | callback, |
| 15867 | user_data); |
| 15868 | } |
| 15869 | |
| 15870 | /** |
| 15871 | * control_host_call_reboot_finish: |
| 15872 | * @proxy: A #ControlHostProxy. |
| 15873 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot(). |
| 15874 | * @error: Return location for error or %NULL. |
| 15875 | * |
| 15876 | * Finishes an operation started with control_host_call_reboot(). |
| 15877 | * |
| 15878 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15879 | */ |
| 15880 | gboolean |
| 15881 | control_host_call_reboot_finish ( |
| 15882 | ControlHost *proxy, |
| 15883 | GAsyncResult *res, |
| 15884 | GError **error) |
| 15885 | { |
| 15886 | GVariant *_ret; |
| 15887 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 15888 | if (_ret == NULL) |
| 15889 | goto _out; |
| 15890 | g_variant_get (_ret, |
| 15891 | "()"); |
| 15892 | g_variant_unref (_ret); |
| 15893 | _out: |
| 15894 | return _ret != NULL; |
| 15895 | } |
| 15896 | |
| 15897 | /** |
| 15898 | * control_host_call_reboot_sync: |
| 15899 | * @proxy: A #ControlHostProxy. |
| 15900 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15901 | * @error: Return location for error or %NULL. |
| 15902 | * |
| 15903 | * 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. |
| 15904 | * |
| 15905 | * See control_host_call_reboot() for the asynchronous version of this method. |
| 15906 | * |
| 15907 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 15908 | */ |
| 15909 | gboolean |
| 15910 | control_host_call_reboot_sync ( |
| 15911 | ControlHost *proxy, |
| 15912 | GCancellable *cancellable, |
| 15913 | GError **error) |
| 15914 | { |
| 15915 | GVariant *_ret; |
| 15916 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 15917 | "reboot", |
| 15918 | g_variant_new ("()"), |
| 15919 | G_DBUS_CALL_FLAGS_NONE, |
| 15920 | -1, |
| 15921 | cancellable, |
| 15922 | error); |
| 15923 | if (_ret == NULL) |
| 15924 | goto _out; |
| 15925 | g_variant_get (_ret, |
| 15926 | "()"); |
| 15927 | g_variant_unref (_ret); |
| 15928 | _out: |
| 15929 | return _ret != NULL; |
| 15930 | } |
| 15931 | |
| 15932 | /** |
| 15933 | * control_host_complete_boot: |
| 15934 | * @object: A #ControlHost. |
| 15935 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15936 | * |
| 15937 | * 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. |
| 15938 | * |
| 15939 | * This method will free @invocation, you cannot use it afterwards. |
| 15940 | */ |
| 15941 | void |
| 15942 | control_host_complete_boot ( |
| 15943 | ControlHost *object, |
| 15944 | GDBusMethodInvocation *invocation) |
| 15945 | { |
| 15946 | g_dbus_method_invocation_return_value (invocation, |
| 15947 | g_variant_new ("()")); |
| 15948 | } |
| 15949 | |
| 15950 | /** |
| 15951 | * control_host_complete_shutdown: |
| 15952 | * @object: A #ControlHost. |
| 15953 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15954 | * |
| 15955 | * 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. |
| 15956 | * |
| 15957 | * This method will free @invocation, you cannot use it afterwards. |
| 15958 | */ |
| 15959 | void |
| 15960 | control_host_complete_shutdown ( |
| 15961 | ControlHost *object, |
| 15962 | GDBusMethodInvocation *invocation) |
| 15963 | { |
| 15964 | g_dbus_method_invocation_return_value (invocation, |
| 15965 | g_variant_new ("()")); |
| 15966 | } |
| 15967 | |
| 15968 | /** |
| 15969 | * control_host_complete_reboot: |
| 15970 | * @object: A #ControlHost. |
| 15971 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 15972 | * |
| 15973 | * 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. |
| 15974 | * |
| 15975 | * This method will free @invocation, you cannot use it afterwards. |
| 15976 | */ |
| 15977 | void |
| 15978 | control_host_complete_reboot ( |
| 15979 | ControlHost *object, |
| 15980 | GDBusMethodInvocation *invocation) |
| 15981 | { |
| 15982 | g_dbus_method_invocation_return_value (invocation, |
| 15983 | g_variant_new ("()")); |
| 15984 | } |
| 15985 | |
| 15986 | /* ------------------------------------------------------------------------ */ |
| 15987 | |
| 15988 | /** |
| 15989 | * ControlHostProxy: |
| 15990 | * |
| 15991 | * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API. |
| 15992 | */ |
| 15993 | |
| 15994 | /** |
| 15995 | * ControlHostProxyClass: |
| 15996 | * @parent_class: The parent class. |
| 15997 | * |
| 15998 | * Class structure for #ControlHostProxy. |
| 15999 | */ |
| 16000 | |
| 16001 | struct _ControlHostProxyPrivate |
| 16002 | { |
| 16003 | GData *qdata; |
| 16004 | }; |
| 16005 | |
| 16006 | static void control_host_proxy_iface_init (ControlHostIface *iface); |
| 16007 | |
| 16008 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16009 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 16010 | G_ADD_PRIVATE (ControlHostProxy) |
| 16011 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 16012 | |
| 16013 | #else |
| 16014 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 16015 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 16016 | |
| 16017 | #endif |
| 16018 | static void |
| 16019 | control_host_proxy_finalize (GObject *object) |
| 16020 | { |
| 16021 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 16022 | g_datalist_clear (&proxy->priv->qdata); |
| 16023 | G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object); |
| 16024 | } |
| 16025 | |
| 16026 | static void |
| 16027 | control_host_proxy_get_property (GObject *object, |
| 16028 | guint prop_id, |
| 16029 | GValue *value, |
| 16030 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16031 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16032 | const _ExtendedGDBusPropertyInfo *info; |
| 16033 | GVariant *variant; |
| 16034 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16035 | info = _control_host_property_info_pointers[prop_id - 1]; |
| 16036 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 16037 | if (info->use_gvariant) |
| 16038 | { |
| 16039 | g_value_set_variant (value, variant); |
| 16040 | } |
| 16041 | else |
| 16042 | { |
| 16043 | if (variant != NULL) |
| 16044 | g_dbus_gvariant_to_gvalue (variant, value); |
| 16045 | } |
| 16046 | if (variant != NULL) |
| 16047 | g_variant_unref (variant); |
| 16048 | } |
| 16049 | |
| 16050 | static void |
| 16051 | control_host_proxy_set_property_cb (GDBusProxy *proxy, |
| 16052 | GAsyncResult *res, |
| 16053 | gpointer user_data) |
| 16054 | { |
| 16055 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 16056 | GError *error; |
| 16057 | GVariant *_ret; |
| 16058 | error = NULL; |
| 16059 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 16060 | if (!_ret) |
| 16061 | { |
| 16062 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)", |
| 16063 | info->parent_struct.name, |
| 16064 | error->message, g_quark_to_string (error->domain), error->code); |
| 16065 | g_error_free (error); |
| 16066 | } |
| 16067 | else |
| 16068 | { |
| 16069 | g_variant_unref (_ret); |
| 16070 | } |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16071 | } |
| 16072 | |
| 16073 | static void |
| 16074 | control_host_proxy_set_property (GObject *object, |
| 16075 | guint prop_id, |
| 16076 | const GValue *value, |
| 16077 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16078 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16079 | const _ExtendedGDBusPropertyInfo *info; |
| 16080 | GVariant *variant; |
| 16081 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16082 | info = _control_host_property_info_pointers[prop_id - 1]; |
| 16083 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16084 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 16085 | "org.freedesktop.DBus.Properties.Set", |
| 16086 | g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant), |
| 16087 | G_DBUS_CALL_FLAGS_NONE, |
| 16088 | -1, |
| 16089 | NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 16090 | g_variant_unref (variant); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16091 | } |
| 16092 | |
| 16093 | static void |
| 16094 | control_host_proxy_g_signal (GDBusProxy *proxy, |
| 16095 | const gchar *sender_name G_GNUC_UNUSED, |
| 16096 | const gchar *signal_name, |
| 16097 | GVariant *parameters) |
| 16098 | { |
| 16099 | _ExtendedGDBusSignalInfo *info; |
| 16100 | GVariantIter iter; |
| 16101 | GVariant *child; |
| 16102 | GValue *paramv; |
| 16103 | guint num_params; |
| 16104 | guint n; |
| 16105 | guint signal_id; |
| 16106 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name); |
| 16107 | if (info == NULL) |
| 16108 | return; |
| 16109 | num_params = g_variant_n_children (parameters); |
| 16110 | paramv = g_new0 (GValue, num_params + 1); |
| 16111 | g_value_init (¶mv[0], TYPE_CONTROL_HOST); |
| 16112 | g_value_set_object (¶mv[0], proxy); |
| 16113 | g_variant_iter_init (&iter, parameters); |
| 16114 | n = 1; |
| 16115 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16116 | { |
| 16117 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 16118 | if (arg_info->use_gvariant) |
| 16119 | { |
| 16120 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16121 | g_value_set_variant (¶mv[n], child); |
| 16122 | n++; |
| 16123 | } |
| 16124 | else |
| 16125 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16126 | g_variant_unref (child); |
| 16127 | } |
| 16128 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 16129 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 16130 | for (n = 0; n < num_params + 1; n++) |
| 16131 | g_value_unset (¶mv[n]); |
| 16132 | g_free (paramv); |
| 16133 | } |
| 16134 | |
| 16135 | static void |
| 16136 | control_host_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 16137 | GVariant *changed_properties, |
| 16138 | const gchar *const *invalidated_properties) |
| 16139 | { |
| 16140 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy); |
| 16141 | guint n; |
| 16142 | const gchar *key; |
| 16143 | GVariantIter *iter; |
| 16144 | _ExtendedGDBusPropertyInfo *info; |
| 16145 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 16146 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 16147 | { |
| 16148 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key); |
| 16149 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 16150 | if (info != NULL) |
| 16151 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16152 | } |
| 16153 | g_variant_iter_free (iter); |
| 16154 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 16155 | { |
| 16156 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]); |
| 16157 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 16158 | if (info != NULL) |
| 16159 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16160 | } |
| 16161 | } |
| 16162 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16163 | static gint |
| 16164 | control_host_proxy_get_debug_mode (ControlHost *object) |
| 16165 | { |
| 16166 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 16167 | GVariant *variant; |
| 16168 | gint value = 0; |
| 16169 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode"); |
| 16170 | if (variant != NULL) |
| 16171 | { |
| 16172 | value = g_variant_get_int32 (variant); |
| 16173 | g_variant_unref (variant); |
| 16174 | } |
| 16175 | return value; |
| 16176 | } |
| 16177 | |
| 16178 | static const gchar * |
| 16179 | control_host_proxy_get_flash_side (ControlHost *object) |
| 16180 | { |
| 16181 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 16182 | GVariant *variant; |
| 16183 | const gchar *value = NULL; |
| 16184 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side"); |
| 16185 | if (variant != NULL) |
| 16186 | { |
| 16187 | value = g_variant_get_string (variant, NULL); |
| 16188 | g_variant_unref (variant); |
| 16189 | } |
| 16190 | return value; |
| 16191 | } |
| 16192 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16193 | static void |
| 16194 | control_host_proxy_init (ControlHostProxy *proxy) |
| 16195 | { |
| 16196 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16197 | proxy->priv = control_host_proxy_get_instance_private (proxy); |
| 16198 | #else |
| 16199 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate); |
| 16200 | #endif |
| 16201 | |
| 16202 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ()); |
| 16203 | } |
| 16204 | |
| 16205 | static void |
| 16206 | control_host_proxy_class_init (ControlHostProxyClass *klass) |
| 16207 | { |
| 16208 | GObjectClass *gobject_class; |
| 16209 | GDBusProxyClass *proxy_class; |
| 16210 | |
| 16211 | gobject_class = G_OBJECT_CLASS (klass); |
| 16212 | gobject_class->finalize = control_host_proxy_finalize; |
| 16213 | gobject_class->get_property = control_host_proxy_get_property; |
| 16214 | gobject_class->set_property = control_host_proxy_set_property; |
| 16215 | |
| 16216 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 16217 | proxy_class->g_signal = control_host_proxy_g_signal; |
| 16218 | proxy_class->g_properties_changed = control_host_proxy_g_properties_changed; |
| 16219 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16220 | control_host_override_properties (gobject_class, 1); |
| 16221 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16222 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16223 | g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate)); |
| 16224 | #endif |
| 16225 | } |
| 16226 | |
| 16227 | static void |
| 16228 | control_host_proxy_iface_init (ControlHostIface *iface) |
| 16229 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16230 | iface->get_debug_mode = control_host_proxy_get_debug_mode; |
| 16231 | iface->get_flash_side = control_host_proxy_get_flash_side; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16232 | } |
| 16233 | |
| 16234 | /** |
| 16235 | * control_host_proxy_new: |
| 16236 | * @connection: A #GDBusConnection. |
| 16237 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16238 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 16239 | * @object_path: An object path. |
| 16240 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16241 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 16242 | * @user_data: User data to pass to @callback. |
| 16243 | * |
| 16244 | * 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. |
| 16245 | * |
| 16246 | * 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. |
| 16247 | * You can then call control_host_proxy_new_finish() to get the result of the operation. |
| 16248 | * |
| 16249 | * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 16250 | */ |
| 16251 | void |
| 16252 | control_host_proxy_new ( |
| 16253 | GDBusConnection *connection, |
| 16254 | GDBusProxyFlags flags, |
| 16255 | const gchar *name, |
| 16256 | const gchar *object_path, |
| 16257 | GCancellable *cancellable, |
| 16258 | GAsyncReadyCallback callback, |
| 16259 | gpointer user_data) |
| 16260 | { |
| 16261 | 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); |
| 16262 | } |
| 16263 | |
| 16264 | /** |
| 16265 | * control_host_proxy_new_finish: |
| 16266 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new(). |
| 16267 | * @error: Return location for error or %NULL |
| 16268 | * |
| 16269 | * Finishes an operation started with control_host_proxy_new(). |
| 16270 | * |
| 16271 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 16272 | */ |
| 16273 | ControlHost * |
| 16274 | control_host_proxy_new_finish ( |
| 16275 | GAsyncResult *res, |
| 16276 | GError **error) |
| 16277 | { |
| 16278 | GObject *ret; |
| 16279 | GObject *source_object; |
| 16280 | source_object = g_async_result_get_source_object (res); |
| 16281 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 16282 | g_object_unref (source_object); |
| 16283 | if (ret != NULL) |
| 16284 | return CONTROL_HOST (ret); |
| 16285 | else |
| 16286 | return NULL; |
| 16287 | } |
| 16288 | |
| 16289 | /** |
| 16290 | * control_host_proxy_new_sync: |
| 16291 | * @connection: A #GDBusConnection. |
| 16292 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16293 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 16294 | * @object_path: An object path. |
| 16295 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16296 | * @error: Return location for error or %NULL |
| 16297 | * |
| 16298 | * 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. |
| 16299 | * |
| 16300 | * The calling thread is blocked until a reply is received. |
| 16301 | * |
| 16302 | * See control_host_proxy_new() for the asynchronous version of this constructor. |
| 16303 | * |
| 16304 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 16305 | */ |
| 16306 | ControlHost * |
| 16307 | control_host_proxy_new_sync ( |
| 16308 | GDBusConnection *connection, |
| 16309 | GDBusProxyFlags flags, |
| 16310 | const gchar *name, |
| 16311 | const gchar *object_path, |
| 16312 | GCancellable *cancellable, |
| 16313 | GError **error) |
| 16314 | { |
| 16315 | GInitable *ret; |
| 16316 | 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); |
| 16317 | if (ret != NULL) |
| 16318 | return CONTROL_HOST (ret); |
| 16319 | else |
| 16320 | return NULL; |
| 16321 | } |
| 16322 | |
| 16323 | |
| 16324 | /** |
| 16325 | * control_host_proxy_new_for_bus: |
| 16326 | * @bus_type: A #GBusType. |
| 16327 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16328 | * @name: A bus name (well-known or unique). |
| 16329 | * @object_path: An object path. |
| 16330 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16331 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 16332 | * @user_data: User data to pass to @callback. |
| 16333 | * |
| 16334 | * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 16335 | * |
| 16336 | * 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. |
| 16337 | * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation. |
| 16338 | * |
| 16339 | * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 16340 | */ |
| 16341 | void |
| 16342 | control_host_proxy_new_for_bus ( |
| 16343 | GBusType bus_type, |
| 16344 | GDBusProxyFlags flags, |
| 16345 | const gchar *name, |
| 16346 | const gchar *object_path, |
| 16347 | GCancellable *cancellable, |
| 16348 | GAsyncReadyCallback callback, |
| 16349 | gpointer user_data) |
| 16350 | { |
| 16351 | 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); |
| 16352 | } |
| 16353 | |
| 16354 | /** |
| 16355 | * control_host_proxy_new_for_bus_finish: |
| 16356 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus(). |
| 16357 | * @error: Return location for error or %NULL |
| 16358 | * |
| 16359 | * Finishes an operation started with control_host_proxy_new_for_bus(). |
| 16360 | * |
| 16361 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 16362 | */ |
| 16363 | ControlHost * |
| 16364 | control_host_proxy_new_for_bus_finish ( |
| 16365 | GAsyncResult *res, |
| 16366 | GError **error) |
| 16367 | { |
| 16368 | GObject *ret; |
| 16369 | GObject *source_object; |
| 16370 | source_object = g_async_result_get_source_object (res); |
| 16371 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 16372 | g_object_unref (source_object); |
| 16373 | if (ret != NULL) |
| 16374 | return CONTROL_HOST (ret); |
| 16375 | else |
| 16376 | return NULL; |
| 16377 | } |
| 16378 | |
| 16379 | /** |
| 16380 | * control_host_proxy_new_for_bus_sync: |
| 16381 | * @bus_type: A #GBusType. |
| 16382 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16383 | * @name: A bus name (well-known or unique). |
| 16384 | * @object_path: An object path. |
| 16385 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16386 | * @error: Return location for error or %NULL |
| 16387 | * |
| 16388 | * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 16389 | * |
| 16390 | * The calling thread is blocked until a reply is received. |
| 16391 | * |
| 16392 | * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 16393 | * |
| 16394 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 16395 | */ |
| 16396 | ControlHost * |
| 16397 | control_host_proxy_new_for_bus_sync ( |
| 16398 | GBusType bus_type, |
| 16399 | GDBusProxyFlags flags, |
| 16400 | const gchar *name, |
| 16401 | const gchar *object_path, |
| 16402 | GCancellable *cancellable, |
| 16403 | GError **error) |
| 16404 | { |
| 16405 | GInitable *ret; |
| 16406 | 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); |
| 16407 | if (ret != NULL) |
| 16408 | return CONTROL_HOST (ret); |
| 16409 | else |
| 16410 | return NULL; |
| 16411 | } |
| 16412 | |
| 16413 | |
| 16414 | /* ------------------------------------------------------------------------ */ |
| 16415 | |
| 16416 | /** |
| 16417 | * ControlHostSkeleton: |
| 16418 | * |
| 16419 | * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API. |
| 16420 | */ |
| 16421 | |
| 16422 | /** |
| 16423 | * ControlHostSkeletonClass: |
| 16424 | * @parent_class: The parent class. |
| 16425 | * |
| 16426 | * Class structure for #ControlHostSkeleton. |
| 16427 | */ |
| 16428 | |
| 16429 | struct _ControlHostSkeletonPrivate |
| 16430 | { |
| 16431 | GValue *properties; |
| 16432 | GList *changed_properties; |
| 16433 | GSource *changed_properties_idle_source; |
| 16434 | GMainContext *context; |
| 16435 | GMutex lock; |
| 16436 | }; |
| 16437 | |
| 16438 | static void |
| 16439 | _control_host_skeleton_handle_method_call ( |
| 16440 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16441 | const gchar *sender G_GNUC_UNUSED, |
| 16442 | const gchar *object_path G_GNUC_UNUSED, |
| 16443 | const gchar *interface_name, |
| 16444 | const gchar *method_name, |
| 16445 | GVariant *parameters, |
| 16446 | GDBusMethodInvocation *invocation, |
| 16447 | gpointer user_data) |
| 16448 | { |
| 16449 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 16450 | _ExtendedGDBusMethodInfo *info; |
| 16451 | GVariantIter iter; |
| 16452 | GVariant *child; |
| 16453 | GValue *paramv; |
| 16454 | guint num_params; |
| 16455 | guint num_extra; |
| 16456 | guint n; |
| 16457 | guint signal_id; |
| 16458 | GValue return_value = G_VALUE_INIT; |
| 16459 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 16460 | g_assert (info != NULL); |
| 16461 | num_params = g_variant_n_children (parameters); |
| 16462 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 16463 | n = 0; |
| 16464 | g_value_init (¶mv[n], TYPE_CONTROL_HOST); |
| 16465 | g_value_set_object (¶mv[n++], skeleton); |
| 16466 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 16467 | g_value_set_object (¶mv[n++], invocation); |
| 16468 | if (info->pass_fdlist) |
| 16469 | { |
| 16470 | #ifdef G_OS_UNIX |
| 16471 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 16472 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 16473 | #else |
| 16474 | g_assert_not_reached (); |
| 16475 | #endif |
| 16476 | } |
| 16477 | g_variant_iter_init (&iter, parameters); |
| 16478 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16479 | { |
| 16480 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 16481 | if (arg_info->use_gvariant) |
| 16482 | { |
| 16483 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16484 | g_value_set_variant (¶mv[n], child); |
| 16485 | n++; |
| 16486 | } |
| 16487 | else |
| 16488 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16489 | g_variant_unref (child); |
| 16490 | } |
| 16491 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 16492 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 16493 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 16494 | if (!g_value_get_boolean (&return_value)) |
| 16495 | 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); |
| 16496 | g_value_unset (&return_value); |
| 16497 | for (n = 0; n < num_params + num_extra; n++) |
| 16498 | g_value_unset (¶mv[n]); |
| 16499 | g_free (paramv); |
| 16500 | } |
| 16501 | |
| 16502 | static GVariant * |
| 16503 | _control_host_skeleton_handle_get_property ( |
| 16504 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16505 | const gchar *sender G_GNUC_UNUSED, |
| 16506 | const gchar *object_path G_GNUC_UNUSED, |
| 16507 | const gchar *interface_name G_GNUC_UNUSED, |
| 16508 | const gchar *property_name, |
| 16509 | GError **error, |
| 16510 | gpointer user_data) |
| 16511 | { |
| 16512 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 16513 | GValue value = G_VALUE_INIT; |
| 16514 | GParamSpec *pspec; |
| 16515 | _ExtendedGDBusPropertyInfo *info; |
| 16516 | GVariant *ret; |
| 16517 | ret = NULL; |
| 16518 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 16519 | g_assert (info != NULL); |
| 16520 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 16521 | if (pspec == NULL) |
| 16522 | { |
| 16523 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 16524 | } |
| 16525 | else |
| 16526 | { |
| 16527 | g_value_init (&value, pspec->value_type); |
| 16528 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 16529 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16530 | g_value_unset (&value); |
| 16531 | } |
| 16532 | return ret; |
| 16533 | } |
| 16534 | |
| 16535 | static gboolean |
| 16536 | _control_host_skeleton_handle_set_property ( |
| 16537 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16538 | const gchar *sender G_GNUC_UNUSED, |
| 16539 | const gchar *object_path G_GNUC_UNUSED, |
| 16540 | const gchar *interface_name G_GNUC_UNUSED, |
| 16541 | const gchar *property_name, |
| 16542 | GVariant *variant, |
| 16543 | GError **error, |
| 16544 | gpointer user_data) |
| 16545 | { |
| 16546 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 16547 | GValue value = G_VALUE_INIT; |
| 16548 | GParamSpec *pspec; |
| 16549 | _ExtendedGDBusPropertyInfo *info; |
| 16550 | gboolean ret; |
| 16551 | ret = FALSE; |
| 16552 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 16553 | g_assert (info != NULL); |
| 16554 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 16555 | if (pspec == NULL) |
| 16556 | { |
| 16557 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 16558 | } |
| 16559 | else |
| 16560 | { |
| 16561 | if (info->use_gvariant) |
| 16562 | g_value_set_variant (&value, variant); |
| 16563 | else |
| 16564 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 16565 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 16566 | g_value_unset (&value); |
| 16567 | ret = TRUE; |
| 16568 | } |
| 16569 | return ret; |
| 16570 | } |
| 16571 | |
| 16572 | static const GDBusInterfaceVTable _control_host_skeleton_vtable = |
| 16573 | { |
| 16574 | _control_host_skeleton_handle_method_call, |
| 16575 | _control_host_skeleton_handle_get_property, |
| 16576 | _control_host_skeleton_handle_set_property, |
| 16577 | {NULL} |
| 16578 | }; |
| 16579 | |
| 16580 | static GDBusInterfaceInfo * |
| 16581 | control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 16582 | { |
| 16583 | return control_host_interface_info (); |
| 16584 | } |
| 16585 | |
| 16586 | static GDBusInterfaceVTable * |
| 16587 | control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 16588 | { |
| 16589 | return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable; |
| 16590 | } |
| 16591 | |
| 16592 | static GVariant * |
| 16593 | control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 16594 | { |
| 16595 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 16596 | |
| 16597 | GVariantBuilder builder; |
| 16598 | guint n; |
| 16599 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 16600 | if (_control_host_interface_info.parent_struct.properties == NULL) |
| 16601 | goto out; |
| 16602 | for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++) |
| 16603 | { |
| 16604 | GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n]; |
| 16605 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 16606 | { |
| 16607 | GVariant *value; |
| 16608 | 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); |
| 16609 | if (value != NULL) |
| 16610 | { |
| 16611 | g_variant_take_ref (value); |
| 16612 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 16613 | g_variant_unref (value); |
| 16614 | } |
| 16615 | } |
| 16616 | } |
| 16617 | out: |
| 16618 | return g_variant_builder_end (&builder); |
| 16619 | } |
| 16620 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16621 | static gboolean _control_host_emit_changed (gpointer user_data); |
| 16622 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16623 | static void |
| 16624 | control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 16625 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16626 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 16627 | gboolean emit_changed = FALSE; |
| 16628 | |
| 16629 | g_mutex_lock (&skeleton->priv->lock); |
| 16630 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 16631 | { |
| 16632 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 16633 | skeleton->priv->changed_properties_idle_source = NULL; |
| 16634 | emit_changed = TRUE; |
| 16635 | } |
| 16636 | g_mutex_unlock (&skeleton->priv->lock); |
| 16637 | |
| 16638 | if (emit_changed) |
| 16639 | _control_host_emit_changed (skeleton); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16640 | } |
| 16641 | |
| 16642 | static void |
| 16643 | _control_host_on_signal_booted ( |
| 16644 | ControlHost *object) |
| 16645 | { |
| 16646 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16647 | |
| 16648 | GList *connections, *l; |
| 16649 | GVariant *signal_variant; |
| 16650 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 16651 | |
| 16652 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 16653 | for (l = connections; l != NULL; l = l->next) |
| 16654 | { |
| 16655 | GDBusConnection *connection = l->data; |
| 16656 | g_dbus_connection_emit_signal (connection, |
| 16657 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted", |
| 16658 | signal_variant, NULL); |
| 16659 | } |
| 16660 | g_variant_unref (signal_variant); |
| 16661 | g_list_free_full (connections, g_object_unref); |
| 16662 | } |
| 16663 | |
| 16664 | static void control_host_skeleton_iface_init (ControlHostIface *iface); |
| 16665 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16666 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 16667 | G_ADD_PRIVATE (ControlHostSkeleton) |
| 16668 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 16669 | |
| 16670 | #else |
| 16671 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 16672 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 16673 | |
| 16674 | #endif |
| 16675 | static void |
| 16676 | control_host_skeleton_finalize (GObject *object) |
| 16677 | { |
| 16678 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16679 | guint n; |
| 16680 | for (n = 0; n < 2; n++) |
| 16681 | g_value_unset (&skeleton->priv->properties[n]); |
| 16682 | g_free (skeleton->priv->properties); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16683 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 16684 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 16685 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 16686 | g_main_context_unref (skeleton->priv->context); |
| 16687 | g_mutex_clear (&skeleton->priv->lock); |
| 16688 | G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object); |
| 16689 | } |
| 16690 | |
| 16691 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16692 | control_host_skeleton_get_property (GObject *object, |
| 16693 | guint prop_id, |
| 16694 | GValue *value, |
| 16695 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16696 | { |
| 16697 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16698 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16699 | g_mutex_lock (&skeleton->priv->lock); |
| 16700 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 16701 | g_mutex_unlock (&skeleton->priv->lock); |
| 16702 | } |
| 16703 | |
| 16704 | static gboolean |
| 16705 | _control_host_emit_changed (gpointer user_data) |
| 16706 | { |
| 16707 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 16708 | GList *l; |
| 16709 | GVariantBuilder builder; |
| 16710 | GVariantBuilder invalidated_builder; |
| 16711 | guint num_changes; |
| 16712 | |
| 16713 | g_mutex_lock (&skeleton->priv->lock); |
| 16714 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 16715 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 16716 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 16717 | { |
| 16718 | ChangedProperty *cp = l->data; |
| 16719 | GVariant *variant; |
| 16720 | const GValue *cur_value; |
| 16721 | |
| 16722 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 16723 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 16724 | { |
| 16725 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 16726 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 16727 | g_variant_unref (variant); |
| 16728 | num_changes++; |
| 16729 | } |
| 16730 | } |
| 16731 | if (num_changes > 0) |
| 16732 | { |
| 16733 | GList *connections, *ll; |
| 16734 | GVariant *signal_variant; |
| 16735 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host", |
| 16736 | &builder, &invalidated_builder)); |
| 16737 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 16738 | for (ll = connections; ll != NULL; ll = ll->next) |
| 16739 | { |
| 16740 | GDBusConnection *connection = ll->data; |
| 16741 | |
| 16742 | g_dbus_connection_emit_signal (connection, |
| 16743 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 16744 | "org.freedesktop.DBus.Properties", |
| 16745 | "PropertiesChanged", |
| 16746 | signal_variant, |
| 16747 | NULL); |
| 16748 | } |
| 16749 | g_variant_unref (signal_variant); |
| 16750 | g_list_free_full (connections, g_object_unref); |
| 16751 | } |
| 16752 | else |
| 16753 | { |
| 16754 | g_variant_builder_clear (&builder); |
| 16755 | g_variant_builder_clear (&invalidated_builder); |
| 16756 | } |
| 16757 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 16758 | skeleton->priv->changed_properties = NULL; |
| 16759 | skeleton->priv->changed_properties_idle_source = NULL; |
| 16760 | g_mutex_unlock (&skeleton->priv->lock); |
| 16761 | return FALSE; |
| 16762 | } |
| 16763 | |
| 16764 | static void |
| 16765 | _control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 16766 | { |
| 16767 | ChangedProperty *cp; |
| 16768 | GList *l; |
| 16769 | cp = NULL; |
| 16770 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 16771 | { |
| 16772 | ChangedProperty *i_cp = l->data; |
| 16773 | if (i_cp->info == info) |
| 16774 | { |
| 16775 | cp = i_cp; |
| 16776 | break; |
| 16777 | } |
| 16778 | } |
| 16779 | if (cp == NULL) |
| 16780 | { |
| 16781 | cp = g_new0 (ChangedProperty, 1); |
| 16782 | cp->prop_id = prop_id; |
| 16783 | cp->info = info; |
| 16784 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 16785 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 16786 | g_value_copy (orig_value, &cp->orig_value); |
| 16787 | } |
| 16788 | } |
| 16789 | |
| 16790 | static void |
| 16791 | control_host_skeleton_notify (GObject *object, |
| 16792 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16793 | { |
| 16794 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16795 | g_mutex_lock (&skeleton->priv->lock); |
| 16796 | if (skeleton->priv->changed_properties != NULL && |
| 16797 | skeleton->priv->changed_properties_idle_source == NULL) |
| 16798 | { |
| 16799 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 16800 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 16801 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 16802 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 16803 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 16804 | } |
| 16805 | g_mutex_unlock (&skeleton->priv->lock); |
| 16806 | } |
| 16807 | |
| 16808 | static void |
| 16809 | control_host_skeleton_set_property (GObject *object, |
| 16810 | guint prop_id, |
| 16811 | const GValue *value, |
| 16812 | GParamSpec *pspec) |
| 16813 | { |
| 16814 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16815 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 16816 | g_mutex_lock (&skeleton->priv->lock); |
| 16817 | g_object_freeze_notify (object); |
| 16818 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 16819 | { |
| 16820 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 16821 | _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 16822 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 16823 | g_object_notify_by_pspec (object, pspec); |
| 16824 | } |
| 16825 | g_mutex_unlock (&skeleton->priv->lock); |
| 16826 | g_object_thaw_notify (object); |
| 16827 | } |
| 16828 | |
| 16829 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16830 | control_host_skeleton_init (ControlHostSkeleton *skeleton) |
| 16831 | { |
| 16832 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16833 | skeleton->priv = control_host_skeleton_get_instance_private (skeleton); |
| 16834 | #else |
| 16835 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate); |
| 16836 | #endif |
| 16837 | |
| 16838 | g_mutex_init (&skeleton->priv->lock); |
| 16839 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16840 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 16841 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 16842 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 16843 | } |
| 16844 | |
| 16845 | static gint |
| 16846 | control_host_skeleton_get_debug_mode (ControlHost *object) |
| 16847 | { |
| 16848 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16849 | gint value; |
| 16850 | g_mutex_lock (&skeleton->priv->lock); |
| 16851 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 16852 | g_mutex_unlock (&skeleton->priv->lock); |
| 16853 | return value; |
| 16854 | } |
| 16855 | |
| 16856 | static const gchar * |
| 16857 | control_host_skeleton_get_flash_side (ControlHost *object) |
| 16858 | { |
| 16859 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 16860 | const gchar *value; |
| 16861 | g_mutex_lock (&skeleton->priv->lock); |
| 16862 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 16863 | g_mutex_unlock (&skeleton->priv->lock); |
| 16864 | return value; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16865 | } |
| 16866 | |
| 16867 | static void |
| 16868 | control_host_skeleton_class_init (ControlHostSkeletonClass *klass) |
| 16869 | { |
| 16870 | GObjectClass *gobject_class; |
| 16871 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 16872 | |
| 16873 | gobject_class = G_OBJECT_CLASS (klass); |
| 16874 | gobject_class->finalize = control_host_skeleton_finalize; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16875 | gobject_class->get_property = control_host_skeleton_get_property; |
| 16876 | gobject_class->set_property = control_host_skeleton_set_property; |
| 16877 | gobject_class->notify = control_host_skeleton_notify; |
| 16878 | |
| 16879 | |
| 16880 | control_host_override_properties (gobject_class, 1); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16881 | |
| 16882 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 16883 | skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info; |
| 16884 | skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties; |
| 16885 | skeleton_class->flush = control_host_skeleton_dbus_interface_flush; |
| 16886 | skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable; |
| 16887 | |
| 16888 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16889 | g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate)); |
| 16890 | #endif |
| 16891 | } |
| 16892 | |
| 16893 | static void |
| 16894 | control_host_skeleton_iface_init (ControlHostIface *iface) |
| 16895 | { |
| 16896 | iface->booted = _control_host_on_signal_booted; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 16897 | iface->get_debug_mode = control_host_skeleton_get_debug_mode; |
| 16898 | iface->get_flash_side = control_host_skeleton_get_flash_side; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16899 | } |
| 16900 | |
| 16901 | /** |
| 16902 | * control_host_skeleton_new: |
| 16903 | * |
| 16904 | * 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>. |
| 16905 | * |
| 16906 | * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object. |
| 16907 | */ |
| 16908 | ControlHost * |
| 16909 | control_host_skeleton_new (void) |
| 16910 | { |
| 16911 | return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL)); |
| 16912 | } |
| 16913 | |
| 16914 | /* ------------------------------------------------------------------------ |
| 16915 | * Code for interface org.openbmc.control.Power |
| 16916 | * ------------------------------------------------------------------------ |
| 16917 | */ |
| 16918 | |
| 16919 | /** |
| 16920 | * SECTION:ControlPower |
| 16921 | * @title: ControlPower |
| 16922 | * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface |
| 16923 | * |
| 16924 | * 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. |
| 16925 | */ |
| 16926 | |
| 16927 | /* ---- Introspection data for org.openbmc.control.Power ---- */ |
| 16928 | |
| 16929 | static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state = |
| 16930 | { |
| 16931 | { |
| 16932 | -1, |
| 16933 | (gchar *) "state", |
| 16934 | (gchar *) "i", |
| 16935 | NULL |
| 16936 | }, |
| 16937 | FALSE |
| 16938 | }; |
| 16939 | |
| 16940 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] = |
| 16941 | { |
| 16942 | &_control_power_method_info_set_power_state_IN_ARG_state, |
| 16943 | NULL |
| 16944 | }; |
| 16945 | |
| 16946 | static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state = |
| 16947 | { |
| 16948 | { |
| 16949 | -1, |
| 16950 | (gchar *) "setPowerState", |
| 16951 | (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers, |
| 16952 | NULL, |
| 16953 | NULL |
| 16954 | }, |
| 16955 | "handle-set-power-state", |
| 16956 | FALSE |
| 16957 | }; |
| 16958 | |
| 16959 | static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state = |
| 16960 | { |
| 16961 | { |
| 16962 | -1, |
| 16963 | (gchar *) "state", |
| 16964 | (gchar *) "i", |
| 16965 | NULL |
| 16966 | }, |
| 16967 | FALSE |
| 16968 | }; |
| 16969 | |
| 16970 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] = |
| 16971 | { |
| 16972 | &_control_power_method_info_get_power_state_OUT_ARG_state, |
| 16973 | NULL |
| 16974 | }; |
| 16975 | |
| 16976 | static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state = |
| 16977 | { |
| 16978 | { |
| 16979 | -1, |
| 16980 | (gchar *) "getPowerState", |
| 16981 | NULL, |
| 16982 | (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers, |
| 16983 | NULL |
| 16984 | }, |
| 16985 | "handle-get-power-state", |
| 16986 | FALSE |
| 16987 | }; |
| 16988 | |
| 16989 | static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] = |
| 16990 | { |
| 16991 | &_control_power_method_info_set_power_state, |
| 16992 | &_control_power_method_info_get_power_state, |
| 16993 | NULL |
| 16994 | }; |
| 16995 | |
| 16996 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good = |
| 16997 | { |
| 16998 | { |
| 16999 | -1, |
| 17000 | (gchar *) "PowerGood", |
| 17001 | NULL, |
| 17002 | NULL |
| 17003 | }, |
| 17004 | "power-good" |
| 17005 | }; |
| 17006 | |
| 17007 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost = |
| 17008 | { |
| 17009 | { |
| 17010 | -1, |
| 17011 | (gchar *) "PowerLost", |
| 17012 | NULL, |
| 17013 | NULL |
| 17014 | }, |
| 17015 | "power-lost" |
| 17016 | }; |
| 17017 | |
| 17018 | static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] = |
| 17019 | { |
| 17020 | &_control_power_signal_info_power_good, |
| 17021 | &_control_power_signal_info_power_lost, |
| 17022 | NULL |
| 17023 | }; |
| 17024 | |
| 17025 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood = |
| 17026 | { |
| 17027 | { |
| 17028 | -1, |
| 17029 | (gchar *) "pgood", |
| 17030 | (gchar *) "i", |
| 17031 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 17032 | NULL |
| 17033 | }, |
| 17034 | "pgood", |
| 17035 | FALSE |
| 17036 | }; |
| 17037 | |
| 17038 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_state = |
| 17039 | { |
| 17040 | { |
| 17041 | -1, |
| 17042 | (gchar *) "state", |
| 17043 | (gchar *) "i", |
| 17044 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 17045 | NULL |
| 17046 | }, |
| 17047 | "state", |
| 17048 | FALSE |
| 17049 | }; |
| 17050 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17051 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout = |
| 17052 | { |
| 17053 | { |
| 17054 | -1, |
| 17055 | (gchar *) "pgood_timeout", |
| 17056 | (gchar *) "i", |
| 17057 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 17058 | NULL |
| 17059 | }, |
| 17060 | "pgood-timeout", |
| 17061 | FALSE |
| 17062 | }; |
| 17063 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17064 | static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] = |
| 17065 | { |
| 17066 | &_control_power_property_info_pgood, |
| 17067 | &_control_power_property_info_state, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17068 | &_control_power_property_info_pgood_timeout, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17069 | NULL |
| 17070 | }; |
| 17071 | |
| 17072 | static const _ExtendedGDBusInterfaceInfo _control_power_interface_info = |
| 17073 | { |
| 17074 | { |
| 17075 | -1, |
| 17076 | (gchar *) "org.openbmc.control.Power", |
| 17077 | (GDBusMethodInfo **) &_control_power_method_info_pointers, |
| 17078 | (GDBusSignalInfo **) &_control_power_signal_info_pointers, |
| 17079 | (GDBusPropertyInfo **) &_control_power_property_info_pointers, |
| 17080 | NULL |
| 17081 | }, |
| 17082 | "control-power", |
| 17083 | }; |
| 17084 | |
| 17085 | |
| 17086 | /** |
| 17087 | * control_power_interface_info: |
| 17088 | * |
| 17089 | * 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. |
| 17090 | * |
| 17091 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 17092 | */ |
| 17093 | GDBusInterfaceInfo * |
| 17094 | control_power_interface_info (void) |
| 17095 | { |
| 17096 | return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct; |
| 17097 | } |
| 17098 | |
| 17099 | /** |
| 17100 | * control_power_override_properties: |
| 17101 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 17102 | * @property_id_begin: The property id to assign to the first overridden property. |
| 17103 | * |
| 17104 | * Overrides all #GObject properties in the #ControlPower interface for a concrete class. |
| 17105 | * The properties are overridden in the order they are defined. |
| 17106 | * |
| 17107 | * Returns: The last property id. |
| 17108 | */ |
| 17109 | guint |
| 17110 | control_power_override_properties (GObjectClass *klass, guint property_id_begin) |
| 17111 | { |
| 17112 | g_object_class_override_property (klass, property_id_begin++, "pgood"); |
| 17113 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17114 | g_object_class_override_property (klass, property_id_begin++, "pgood-timeout"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17115 | return property_id_begin - 1; |
| 17116 | } |
| 17117 | |
| 17118 | |
| 17119 | |
| 17120 | /** |
| 17121 | * ControlPower: |
| 17122 | * |
| 17123 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 17124 | */ |
| 17125 | |
| 17126 | /** |
| 17127 | * ControlPowerIface: |
| 17128 | * @parent_iface: The parent interface. |
| 17129 | * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal. |
| 17130 | * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal. |
| 17131 | * @get_pgood: Getter for the #ControlPower:pgood property. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17132 | * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17133 | * @get_state: Getter for the #ControlPower:state property. |
| 17134 | * @power_good: Handler for the #ControlPower::power-good signal. |
| 17135 | * @power_lost: Handler for the #ControlPower::power-lost signal. |
| 17136 | * |
| 17137 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 17138 | */ |
| 17139 | |
| 17140 | typedef ControlPowerIface ControlPowerInterface; |
| 17141 | G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT); |
| 17142 | |
| 17143 | static void |
| 17144 | control_power_default_init (ControlPowerIface *iface) |
| 17145 | { |
| 17146 | /* GObject signals for incoming D-Bus method calls: */ |
| 17147 | /** |
| 17148 | * ControlPower::handle-set-power-state: |
| 17149 | * @object: A #ControlPower. |
| 17150 | * @invocation: A #GDBusMethodInvocation. |
| 17151 | * @arg_state: Argument passed by remote caller. |
| 17152 | * |
| 17153 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. |
| 17154 | * |
| 17155 | * 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. |
| 17156 | * |
| 17157 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17158 | */ |
| 17159 | g_signal_new ("handle-set-power-state", |
| 17160 | G_TYPE_FROM_INTERFACE (iface), |
| 17161 | G_SIGNAL_RUN_LAST, |
| 17162 | G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state), |
| 17163 | g_signal_accumulator_true_handled, |
| 17164 | NULL, |
| 17165 | g_cclosure_marshal_generic, |
| 17166 | G_TYPE_BOOLEAN, |
| 17167 | 2, |
| 17168 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 17169 | |
| 17170 | /** |
| 17171 | * ControlPower::handle-get-power-state: |
| 17172 | * @object: A #ControlPower. |
| 17173 | * @invocation: A #GDBusMethodInvocation. |
| 17174 | * |
| 17175 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. |
| 17176 | * |
| 17177 | * 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. |
| 17178 | * |
| 17179 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17180 | */ |
| 17181 | g_signal_new ("handle-get-power-state", |
| 17182 | G_TYPE_FROM_INTERFACE (iface), |
| 17183 | G_SIGNAL_RUN_LAST, |
| 17184 | G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state), |
| 17185 | g_signal_accumulator_true_handled, |
| 17186 | NULL, |
| 17187 | g_cclosure_marshal_generic, |
| 17188 | G_TYPE_BOOLEAN, |
| 17189 | 1, |
| 17190 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 17191 | |
| 17192 | /* GObject signals for received D-Bus signals: */ |
| 17193 | /** |
| 17194 | * ControlPower::power-good: |
| 17195 | * @object: A #ControlPower. |
| 17196 | * |
| 17197 | * 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. |
| 17198 | * |
| 17199 | * 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. |
| 17200 | */ |
| 17201 | g_signal_new ("power-good", |
| 17202 | G_TYPE_FROM_INTERFACE (iface), |
| 17203 | G_SIGNAL_RUN_LAST, |
| 17204 | G_STRUCT_OFFSET (ControlPowerIface, power_good), |
| 17205 | NULL, |
| 17206 | NULL, |
| 17207 | g_cclosure_marshal_generic, |
| 17208 | G_TYPE_NONE, |
| 17209 | 0); |
| 17210 | |
| 17211 | /** |
| 17212 | * ControlPower::power-lost: |
| 17213 | * @object: A #ControlPower. |
| 17214 | * |
| 17215 | * 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. |
| 17216 | * |
| 17217 | * 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. |
| 17218 | */ |
| 17219 | g_signal_new ("power-lost", |
| 17220 | G_TYPE_FROM_INTERFACE (iface), |
| 17221 | G_SIGNAL_RUN_LAST, |
| 17222 | G_STRUCT_OFFSET (ControlPowerIface, power_lost), |
| 17223 | NULL, |
| 17224 | NULL, |
| 17225 | g_cclosure_marshal_generic, |
| 17226 | G_TYPE_NONE, |
| 17227 | 0); |
| 17228 | |
| 17229 | /* GObject properties for D-Bus properties: */ |
| 17230 | /** |
| 17231 | * ControlPower:pgood: |
| 17232 | * |
| 17233 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>. |
| 17234 | * |
| 17235 | * 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. |
| 17236 | */ |
| 17237 | g_object_interface_install_property (iface, |
| 17238 | g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 17239 | /** |
| 17240 | * ControlPower:state: |
| 17241 | * |
| 17242 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>. |
| 17243 | * |
| 17244 | * 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. |
| 17245 | */ |
| 17246 | g_object_interface_install_property (iface, |
| 17247 | 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] | 17248 | /** |
| 17249 | * ControlPower:pgood-timeout: |
| 17250 | * |
| 17251 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>. |
| 17252 | * |
| 17253 | * 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. |
| 17254 | */ |
| 17255 | g_object_interface_install_property (iface, |
| 17256 | 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] | 17257 | } |
| 17258 | |
| 17259 | /** |
| 17260 | * control_power_get_pgood: (skip) |
| 17261 | * @object: A #ControlPower. |
| 17262 | * |
| 17263 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property. |
| 17264 | * |
| 17265 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 17266 | * |
| 17267 | * Returns: The property value. |
| 17268 | */ |
| 17269 | gint |
| 17270 | control_power_get_pgood (ControlPower *object) |
| 17271 | { |
| 17272 | return CONTROL_POWER_GET_IFACE (object)->get_pgood (object); |
| 17273 | } |
| 17274 | |
| 17275 | /** |
| 17276 | * control_power_set_pgood: (skip) |
| 17277 | * @object: A #ControlPower. |
| 17278 | * @value: The value to set. |
| 17279 | * |
| 17280 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value. |
| 17281 | * |
| 17282 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 17283 | */ |
| 17284 | void |
| 17285 | control_power_set_pgood (ControlPower *object, gint value) |
| 17286 | { |
| 17287 | g_object_set (G_OBJECT (object), "pgood", value, NULL); |
| 17288 | } |
| 17289 | |
| 17290 | /** |
| 17291 | * control_power_get_state: (skip) |
| 17292 | * @object: A #ControlPower. |
| 17293 | * |
| 17294 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property. |
| 17295 | * |
| 17296 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 17297 | * |
| 17298 | * Returns: The property value. |
| 17299 | */ |
| 17300 | gint |
| 17301 | control_power_get_state (ControlPower *object) |
| 17302 | { |
| 17303 | return CONTROL_POWER_GET_IFACE (object)->get_state (object); |
| 17304 | } |
| 17305 | |
| 17306 | /** |
| 17307 | * control_power_set_state: (skip) |
| 17308 | * @object: A #ControlPower. |
| 17309 | * @value: The value to set. |
| 17310 | * |
| 17311 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value. |
| 17312 | * |
| 17313 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 17314 | */ |
| 17315 | void |
| 17316 | control_power_set_state (ControlPower *object, gint value) |
| 17317 | { |
| 17318 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 17319 | } |
| 17320 | |
| 17321 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17322 | * control_power_get_pgood_timeout: (skip) |
| 17323 | * @object: A #ControlPower. |
| 17324 | * |
| 17325 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property. |
| 17326 | * |
| 17327 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17328 | * |
| 17329 | * Returns: The property value. |
| 17330 | */ |
| 17331 | gint |
| 17332 | control_power_get_pgood_timeout (ControlPower *object) |
| 17333 | { |
| 17334 | return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object); |
| 17335 | } |
| 17336 | |
| 17337 | /** |
| 17338 | * control_power_set_pgood_timeout: (skip) |
| 17339 | * @object: A #ControlPower. |
| 17340 | * @value: The value to set. |
| 17341 | * |
| 17342 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value. |
| 17343 | * |
| 17344 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17345 | */ |
| 17346 | void |
| 17347 | control_power_set_pgood_timeout (ControlPower *object, gint value) |
| 17348 | { |
| 17349 | g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL); |
| 17350 | } |
| 17351 | |
| 17352 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17353 | * control_power_emit_power_good: |
| 17354 | * @object: A #ControlPower. |
| 17355 | * |
| 17356 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal. |
| 17357 | */ |
| 17358 | void |
| 17359 | control_power_emit_power_good ( |
| 17360 | ControlPower *object) |
| 17361 | { |
| 17362 | g_signal_emit_by_name (object, "power-good"); |
| 17363 | } |
| 17364 | |
| 17365 | /** |
| 17366 | * control_power_emit_power_lost: |
| 17367 | * @object: A #ControlPower. |
| 17368 | * |
| 17369 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal. |
| 17370 | */ |
| 17371 | void |
| 17372 | control_power_emit_power_lost ( |
| 17373 | ControlPower *object) |
| 17374 | { |
| 17375 | g_signal_emit_by_name (object, "power-lost"); |
| 17376 | } |
| 17377 | |
| 17378 | /** |
| 17379 | * control_power_call_set_power_state: |
| 17380 | * @proxy: A #ControlPowerProxy. |
| 17381 | * @arg_state: Argument to pass with the method invocation. |
| 17382 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17383 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 17384 | * @user_data: User data to pass to @callback. |
| 17385 | * |
| 17386 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. |
| 17387 | * 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. |
| 17388 | * You can then call control_power_call_set_power_state_finish() to get the result of the operation. |
| 17389 | * |
| 17390 | * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method. |
| 17391 | */ |
| 17392 | void |
| 17393 | control_power_call_set_power_state ( |
| 17394 | ControlPower *proxy, |
| 17395 | gint arg_state, |
| 17396 | GCancellable *cancellable, |
| 17397 | GAsyncReadyCallback callback, |
| 17398 | gpointer user_data) |
| 17399 | { |
| 17400 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 17401 | "setPowerState", |
| 17402 | g_variant_new ("(i)", |
| 17403 | arg_state), |
| 17404 | G_DBUS_CALL_FLAGS_NONE, |
| 17405 | -1, |
| 17406 | cancellable, |
| 17407 | callback, |
| 17408 | user_data); |
| 17409 | } |
| 17410 | |
| 17411 | /** |
| 17412 | * control_power_call_set_power_state_finish: |
| 17413 | * @proxy: A #ControlPowerProxy. |
| 17414 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state(). |
| 17415 | * @error: Return location for error or %NULL. |
| 17416 | * |
| 17417 | * Finishes an operation started with control_power_call_set_power_state(). |
| 17418 | * |
| 17419 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17420 | */ |
| 17421 | gboolean |
| 17422 | control_power_call_set_power_state_finish ( |
| 17423 | ControlPower *proxy, |
| 17424 | GAsyncResult *res, |
| 17425 | GError **error) |
| 17426 | { |
| 17427 | GVariant *_ret; |
| 17428 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 17429 | if (_ret == NULL) |
| 17430 | goto _out; |
| 17431 | g_variant_get (_ret, |
| 17432 | "()"); |
| 17433 | g_variant_unref (_ret); |
| 17434 | _out: |
| 17435 | return _ret != NULL; |
| 17436 | } |
| 17437 | |
| 17438 | /** |
| 17439 | * control_power_call_set_power_state_sync: |
| 17440 | * @proxy: A #ControlPowerProxy. |
| 17441 | * @arg_state: Argument to pass with the method invocation. |
| 17442 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17443 | * @error: Return location for error or %NULL. |
| 17444 | * |
| 17445 | * 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. |
| 17446 | * |
| 17447 | * See control_power_call_set_power_state() for the asynchronous version of this method. |
| 17448 | * |
| 17449 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17450 | */ |
| 17451 | gboolean |
| 17452 | control_power_call_set_power_state_sync ( |
| 17453 | ControlPower *proxy, |
| 17454 | gint arg_state, |
| 17455 | GCancellable *cancellable, |
| 17456 | GError **error) |
| 17457 | { |
| 17458 | GVariant *_ret; |
| 17459 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 17460 | "setPowerState", |
| 17461 | g_variant_new ("(i)", |
| 17462 | arg_state), |
| 17463 | G_DBUS_CALL_FLAGS_NONE, |
| 17464 | -1, |
| 17465 | cancellable, |
| 17466 | error); |
| 17467 | if (_ret == NULL) |
| 17468 | goto _out; |
| 17469 | g_variant_get (_ret, |
| 17470 | "()"); |
| 17471 | g_variant_unref (_ret); |
| 17472 | _out: |
| 17473 | return _ret != NULL; |
| 17474 | } |
| 17475 | |
| 17476 | /** |
| 17477 | * control_power_call_get_power_state: |
| 17478 | * @proxy: A #ControlPowerProxy. |
| 17479 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17480 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 17481 | * @user_data: User data to pass to @callback. |
| 17482 | * |
| 17483 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. |
| 17484 | * 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. |
| 17485 | * You can then call control_power_call_get_power_state_finish() to get the result of the operation. |
| 17486 | * |
| 17487 | * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method. |
| 17488 | */ |
| 17489 | void |
| 17490 | control_power_call_get_power_state ( |
| 17491 | ControlPower *proxy, |
| 17492 | GCancellable *cancellable, |
| 17493 | GAsyncReadyCallback callback, |
| 17494 | gpointer user_data) |
| 17495 | { |
| 17496 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 17497 | "getPowerState", |
| 17498 | g_variant_new ("()"), |
| 17499 | G_DBUS_CALL_FLAGS_NONE, |
| 17500 | -1, |
| 17501 | cancellable, |
| 17502 | callback, |
| 17503 | user_data); |
| 17504 | } |
| 17505 | |
| 17506 | /** |
| 17507 | * control_power_call_get_power_state_finish: |
| 17508 | * @proxy: A #ControlPowerProxy. |
| 17509 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 17510 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state(). |
| 17511 | * @error: Return location for error or %NULL. |
| 17512 | * |
| 17513 | * Finishes an operation started with control_power_call_get_power_state(). |
| 17514 | * |
| 17515 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17516 | */ |
| 17517 | gboolean |
| 17518 | control_power_call_get_power_state_finish ( |
| 17519 | ControlPower *proxy, |
| 17520 | gint *out_state, |
| 17521 | GAsyncResult *res, |
| 17522 | GError **error) |
| 17523 | { |
| 17524 | GVariant *_ret; |
| 17525 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 17526 | if (_ret == NULL) |
| 17527 | goto _out; |
| 17528 | g_variant_get (_ret, |
| 17529 | "(i)", |
| 17530 | out_state); |
| 17531 | g_variant_unref (_ret); |
| 17532 | _out: |
| 17533 | return _ret != NULL; |
| 17534 | } |
| 17535 | |
| 17536 | /** |
| 17537 | * control_power_call_get_power_state_sync: |
| 17538 | * @proxy: A #ControlPowerProxy. |
| 17539 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 17540 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17541 | * @error: Return location for error or %NULL. |
| 17542 | * |
| 17543 | * 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. |
| 17544 | * |
| 17545 | * See control_power_call_get_power_state() for the asynchronous version of this method. |
| 17546 | * |
| 17547 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17548 | */ |
| 17549 | gboolean |
| 17550 | control_power_call_get_power_state_sync ( |
| 17551 | ControlPower *proxy, |
| 17552 | gint *out_state, |
| 17553 | GCancellable *cancellable, |
| 17554 | GError **error) |
| 17555 | { |
| 17556 | GVariant *_ret; |
| 17557 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 17558 | "getPowerState", |
| 17559 | g_variant_new ("()"), |
| 17560 | G_DBUS_CALL_FLAGS_NONE, |
| 17561 | -1, |
| 17562 | cancellable, |
| 17563 | error); |
| 17564 | if (_ret == NULL) |
| 17565 | goto _out; |
| 17566 | g_variant_get (_ret, |
| 17567 | "(i)", |
| 17568 | out_state); |
| 17569 | g_variant_unref (_ret); |
| 17570 | _out: |
| 17571 | return _ret != NULL; |
| 17572 | } |
| 17573 | |
| 17574 | /** |
| 17575 | * control_power_complete_set_power_state: |
| 17576 | * @object: A #ControlPower. |
| 17577 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 17578 | * |
| 17579 | * 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. |
| 17580 | * |
| 17581 | * This method will free @invocation, you cannot use it afterwards. |
| 17582 | */ |
| 17583 | void |
| 17584 | control_power_complete_set_power_state ( |
| 17585 | ControlPower *object, |
| 17586 | GDBusMethodInvocation *invocation) |
| 17587 | { |
| 17588 | g_dbus_method_invocation_return_value (invocation, |
| 17589 | g_variant_new ("()")); |
| 17590 | } |
| 17591 | |
| 17592 | /** |
| 17593 | * control_power_complete_get_power_state: |
| 17594 | * @object: A #ControlPower. |
| 17595 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 17596 | * @state: Parameter to return. |
| 17597 | * |
| 17598 | * 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. |
| 17599 | * |
| 17600 | * This method will free @invocation, you cannot use it afterwards. |
| 17601 | */ |
| 17602 | void |
| 17603 | control_power_complete_get_power_state ( |
| 17604 | ControlPower *object, |
| 17605 | GDBusMethodInvocation *invocation, |
| 17606 | gint state) |
| 17607 | { |
| 17608 | g_dbus_method_invocation_return_value (invocation, |
| 17609 | g_variant_new ("(i)", |
| 17610 | state)); |
| 17611 | } |
| 17612 | |
| 17613 | /* ------------------------------------------------------------------------ */ |
| 17614 | |
| 17615 | /** |
| 17616 | * ControlPowerProxy: |
| 17617 | * |
| 17618 | * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API. |
| 17619 | */ |
| 17620 | |
| 17621 | /** |
| 17622 | * ControlPowerProxyClass: |
| 17623 | * @parent_class: The parent class. |
| 17624 | * |
| 17625 | * Class structure for #ControlPowerProxy. |
| 17626 | */ |
| 17627 | |
| 17628 | struct _ControlPowerProxyPrivate |
| 17629 | { |
| 17630 | GData *qdata; |
| 17631 | }; |
| 17632 | |
| 17633 | static void control_power_proxy_iface_init (ControlPowerIface *iface); |
| 17634 | |
| 17635 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17636 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 17637 | G_ADD_PRIVATE (ControlPowerProxy) |
| 17638 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 17639 | |
| 17640 | #else |
| 17641 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 17642 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 17643 | |
| 17644 | #endif |
| 17645 | static void |
| 17646 | control_power_proxy_finalize (GObject *object) |
| 17647 | { |
| 17648 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 17649 | g_datalist_clear (&proxy->priv->qdata); |
| 17650 | G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object); |
| 17651 | } |
| 17652 | |
| 17653 | static void |
| 17654 | control_power_proxy_get_property (GObject *object, |
| 17655 | guint prop_id, |
| 17656 | GValue *value, |
| 17657 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17658 | { |
| 17659 | const _ExtendedGDBusPropertyInfo *info; |
| 17660 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17661 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17662 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 17663 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 17664 | if (info->use_gvariant) |
| 17665 | { |
| 17666 | g_value_set_variant (value, variant); |
| 17667 | } |
| 17668 | else |
| 17669 | { |
| 17670 | if (variant != NULL) |
| 17671 | g_dbus_gvariant_to_gvalue (variant, value); |
| 17672 | } |
| 17673 | if (variant != NULL) |
| 17674 | g_variant_unref (variant); |
| 17675 | } |
| 17676 | |
| 17677 | static void |
| 17678 | control_power_proxy_set_property_cb (GDBusProxy *proxy, |
| 17679 | GAsyncResult *res, |
| 17680 | gpointer user_data) |
| 17681 | { |
| 17682 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 17683 | GError *error; |
| 17684 | GVariant *_ret; |
| 17685 | error = NULL; |
| 17686 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 17687 | if (!_ret) |
| 17688 | { |
| 17689 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)", |
| 17690 | info->parent_struct.name, |
| 17691 | error->message, g_quark_to_string (error->domain), error->code); |
| 17692 | g_error_free (error); |
| 17693 | } |
| 17694 | else |
| 17695 | { |
| 17696 | g_variant_unref (_ret); |
| 17697 | } |
| 17698 | } |
| 17699 | |
| 17700 | static void |
| 17701 | control_power_proxy_set_property (GObject *object, |
| 17702 | guint prop_id, |
| 17703 | const GValue *value, |
| 17704 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17705 | { |
| 17706 | const _ExtendedGDBusPropertyInfo *info; |
| 17707 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17708 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17709 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 17710 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 17711 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 17712 | "org.freedesktop.DBus.Properties.Set", |
| 17713 | g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant), |
| 17714 | G_DBUS_CALL_FLAGS_NONE, |
| 17715 | -1, |
| 17716 | NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 17717 | g_variant_unref (variant); |
| 17718 | } |
| 17719 | |
| 17720 | static void |
| 17721 | control_power_proxy_g_signal (GDBusProxy *proxy, |
| 17722 | const gchar *sender_name G_GNUC_UNUSED, |
| 17723 | const gchar *signal_name, |
| 17724 | GVariant *parameters) |
| 17725 | { |
| 17726 | _ExtendedGDBusSignalInfo *info; |
| 17727 | GVariantIter iter; |
| 17728 | GVariant *child; |
| 17729 | GValue *paramv; |
| 17730 | guint num_params; |
| 17731 | guint n; |
| 17732 | guint signal_id; |
| 17733 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name); |
| 17734 | if (info == NULL) |
| 17735 | return; |
| 17736 | num_params = g_variant_n_children (parameters); |
| 17737 | paramv = g_new0 (GValue, num_params + 1); |
| 17738 | g_value_init (¶mv[0], TYPE_CONTROL_POWER); |
| 17739 | g_value_set_object (¶mv[0], proxy); |
| 17740 | g_variant_iter_init (&iter, parameters); |
| 17741 | n = 1; |
| 17742 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 17743 | { |
| 17744 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 17745 | if (arg_info->use_gvariant) |
| 17746 | { |
| 17747 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 17748 | g_value_set_variant (¶mv[n], child); |
| 17749 | n++; |
| 17750 | } |
| 17751 | else |
| 17752 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 17753 | g_variant_unref (child); |
| 17754 | } |
| 17755 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 17756 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 17757 | for (n = 0; n < num_params + 1; n++) |
| 17758 | g_value_unset (¶mv[n]); |
| 17759 | g_free (paramv); |
| 17760 | } |
| 17761 | |
| 17762 | static void |
| 17763 | control_power_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 17764 | GVariant *changed_properties, |
| 17765 | const gchar *const *invalidated_properties) |
| 17766 | { |
| 17767 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy); |
| 17768 | guint n; |
| 17769 | const gchar *key; |
| 17770 | GVariantIter *iter; |
| 17771 | _ExtendedGDBusPropertyInfo *info; |
| 17772 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 17773 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 17774 | { |
| 17775 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key); |
| 17776 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 17777 | if (info != NULL) |
| 17778 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17779 | } |
| 17780 | g_variant_iter_free (iter); |
| 17781 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 17782 | { |
| 17783 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]); |
| 17784 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 17785 | if (info != NULL) |
| 17786 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 17787 | } |
| 17788 | } |
| 17789 | |
| 17790 | static gint |
| 17791 | control_power_proxy_get_pgood (ControlPower *object) |
| 17792 | { |
| 17793 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 17794 | GVariant *variant; |
| 17795 | gint value = 0; |
| 17796 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood"); |
| 17797 | if (variant != NULL) |
| 17798 | { |
| 17799 | value = g_variant_get_int32 (variant); |
| 17800 | g_variant_unref (variant); |
| 17801 | } |
| 17802 | return value; |
| 17803 | } |
| 17804 | |
| 17805 | static gint |
| 17806 | control_power_proxy_get_state (ControlPower *object) |
| 17807 | { |
| 17808 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 17809 | GVariant *variant; |
| 17810 | gint value = 0; |
| 17811 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 17812 | if (variant != NULL) |
| 17813 | { |
| 17814 | value = g_variant_get_int32 (variant); |
| 17815 | g_variant_unref (variant); |
| 17816 | } |
| 17817 | return value; |
| 17818 | } |
| 17819 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17820 | static gint |
| 17821 | control_power_proxy_get_pgood_timeout (ControlPower *object) |
| 17822 | { |
| 17823 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 17824 | GVariant *variant; |
| 17825 | gint value = 0; |
| 17826 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout"); |
| 17827 | if (variant != NULL) |
| 17828 | { |
| 17829 | value = g_variant_get_int32 (variant); |
| 17830 | g_variant_unref (variant); |
| 17831 | } |
| 17832 | return value; |
| 17833 | } |
| 17834 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17835 | static void |
| 17836 | control_power_proxy_init (ControlPowerProxy *proxy) |
| 17837 | { |
| 17838 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17839 | proxy->priv = control_power_proxy_get_instance_private (proxy); |
| 17840 | #else |
| 17841 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate); |
| 17842 | #endif |
| 17843 | |
| 17844 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ()); |
| 17845 | } |
| 17846 | |
| 17847 | static void |
| 17848 | control_power_proxy_class_init (ControlPowerProxyClass *klass) |
| 17849 | { |
| 17850 | GObjectClass *gobject_class; |
| 17851 | GDBusProxyClass *proxy_class; |
| 17852 | |
| 17853 | gobject_class = G_OBJECT_CLASS (klass); |
| 17854 | gobject_class->finalize = control_power_proxy_finalize; |
| 17855 | gobject_class->get_property = control_power_proxy_get_property; |
| 17856 | gobject_class->set_property = control_power_proxy_set_property; |
| 17857 | |
| 17858 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 17859 | proxy_class->g_signal = control_power_proxy_g_signal; |
| 17860 | proxy_class->g_properties_changed = control_power_proxy_g_properties_changed; |
| 17861 | |
| 17862 | control_power_override_properties (gobject_class, 1); |
| 17863 | |
| 17864 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17865 | g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate)); |
| 17866 | #endif |
| 17867 | } |
| 17868 | |
| 17869 | static void |
| 17870 | control_power_proxy_iface_init (ControlPowerIface *iface) |
| 17871 | { |
| 17872 | iface->get_pgood = control_power_proxy_get_pgood; |
| 17873 | iface->get_state = control_power_proxy_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17874 | iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17875 | } |
| 17876 | |
| 17877 | /** |
| 17878 | * control_power_proxy_new: |
| 17879 | * @connection: A #GDBusConnection. |
| 17880 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17881 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17882 | * @object_path: An object path. |
| 17883 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17884 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17885 | * @user_data: User data to pass to @callback. |
| 17886 | * |
| 17887 | * 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. |
| 17888 | * |
| 17889 | * 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. |
| 17890 | * You can then call control_power_proxy_new_finish() to get the result of the operation. |
| 17891 | * |
| 17892 | * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 17893 | */ |
| 17894 | void |
| 17895 | control_power_proxy_new ( |
| 17896 | GDBusConnection *connection, |
| 17897 | GDBusProxyFlags flags, |
| 17898 | const gchar *name, |
| 17899 | const gchar *object_path, |
| 17900 | GCancellable *cancellable, |
| 17901 | GAsyncReadyCallback callback, |
| 17902 | gpointer user_data) |
| 17903 | { |
| 17904 | 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); |
| 17905 | } |
| 17906 | |
| 17907 | /** |
| 17908 | * control_power_proxy_new_finish: |
| 17909 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new(). |
| 17910 | * @error: Return location for error or %NULL |
| 17911 | * |
| 17912 | * Finishes an operation started with control_power_proxy_new(). |
| 17913 | * |
| 17914 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 17915 | */ |
| 17916 | ControlPower * |
| 17917 | control_power_proxy_new_finish ( |
| 17918 | GAsyncResult *res, |
| 17919 | GError **error) |
| 17920 | { |
| 17921 | GObject *ret; |
| 17922 | GObject *source_object; |
| 17923 | source_object = g_async_result_get_source_object (res); |
| 17924 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 17925 | g_object_unref (source_object); |
| 17926 | if (ret != NULL) |
| 17927 | return CONTROL_POWER (ret); |
| 17928 | else |
| 17929 | return NULL; |
| 17930 | } |
| 17931 | |
| 17932 | /** |
| 17933 | * control_power_proxy_new_sync: |
| 17934 | * @connection: A #GDBusConnection. |
| 17935 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17936 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 17937 | * @object_path: An object path. |
| 17938 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17939 | * @error: Return location for error or %NULL |
| 17940 | * |
| 17941 | * 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. |
| 17942 | * |
| 17943 | * The calling thread is blocked until a reply is received. |
| 17944 | * |
| 17945 | * See control_power_proxy_new() for the asynchronous version of this constructor. |
| 17946 | * |
| 17947 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 17948 | */ |
| 17949 | ControlPower * |
| 17950 | control_power_proxy_new_sync ( |
| 17951 | GDBusConnection *connection, |
| 17952 | GDBusProxyFlags flags, |
| 17953 | const gchar *name, |
| 17954 | const gchar *object_path, |
| 17955 | GCancellable *cancellable, |
| 17956 | GError **error) |
| 17957 | { |
| 17958 | GInitable *ret; |
| 17959 | 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); |
| 17960 | if (ret != NULL) |
| 17961 | return CONTROL_POWER (ret); |
| 17962 | else |
| 17963 | return NULL; |
| 17964 | } |
| 17965 | |
| 17966 | |
| 17967 | /** |
| 17968 | * control_power_proxy_new_for_bus: |
| 17969 | * @bus_type: A #GBusType. |
| 17970 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 17971 | * @name: A bus name (well-known or unique). |
| 17972 | * @object_path: An object path. |
| 17973 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17974 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 17975 | * @user_data: User data to pass to @callback. |
| 17976 | * |
| 17977 | * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 17978 | * |
| 17979 | * 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. |
| 17980 | * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation. |
| 17981 | * |
| 17982 | * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 17983 | */ |
| 17984 | void |
| 17985 | control_power_proxy_new_for_bus ( |
| 17986 | GBusType bus_type, |
| 17987 | GDBusProxyFlags flags, |
| 17988 | const gchar *name, |
| 17989 | const gchar *object_path, |
| 17990 | GCancellable *cancellable, |
| 17991 | GAsyncReadyCallback callback, |
| 17992 | gpointer user_data) |
| 17993 | { |
| 17994 | 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); |
| 17995 | } |
| 17996 | |
| 17997 | /** |
| 17998 | * control_power_proxy_new_for_bus_finish: |
| 17999 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus(). |
| 18000 | * @error: Return location for error or %NULL |
| 18001 | * |
| 18002 | * Finishes an operation started with control_power_proxy_new_for_bus(). |
| 18003 | * |
| 18004 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 18005 | */ |
| 18006 | ControlPower * |
| 18007 | control_power_proxy_new_for_bus_finish ( |
| 18008 | GAsyncResult *res, |
| 18009 | GError **error) |
| 18010 | { |
| 18011 | GObject *ret; |
| 18012 | GObject *source_object; |
| 18013 | source_object = g_async_result_get_source_object (res); |
| 18014 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18015 | g_object_unref (source_object); |
| 18016 | if (ret != NULL) |
| 18017 | return CONTROL_POWER (ret); |
| 18018 | else |
| 18019 | return NULL; |
| 18020 | } |
| 18021 | |
| 18022 | /** |
| 18023 | * control_power_proxy_new_for_bus_sync: |
| 18024 | * @bus_type: A #GBusType. |
| 18025 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18026 | * @name: A bus name (well-known or unique). |
| 18027 | * @object_path: An object path. |
| 18028 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18029 | * @error: Return location for error or %NULL |
| 18030 | * |
| 18031 | * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 18032 | * |
| 18033 | * The calling thread is blocked until a reply is received. |
| 18034 | * |
| 18035 | * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 18036 | * |
| 18037 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 18038 | */ |
| 18039 | ControlPower * |
| 18040 | control_power_proxy_new_for_bus_sync ( |
| 18041 | GBusType bus_type, |
| 18042 | GDBusProxyFlags flags, |
| 18043 | const gchar *name, |
| 18044 | const gchar *object_path, |
| 18045 | GCancellable *cancellable, |
| 18046 | GError **error) |
| 18047 | { |
| 18048 | GInitable *ret; |
| 18049 | 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); |
| 18050 | if (ret != NULL) |
| 18051 | return CONTROL_POWER (ret); |
| 18052 | else |
| 18053 | return NULL; |
| 18054 | } |
| 18055 | |
| 18056 | |
| 18057 | /* ------------------------------------------------------------------------ */ |
| 18058 | |
| 18059 | /** |
| 18060 | * ControlPowerSkeleton: |
| 18061 | * |
| 18062 | * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API. |
| 18063 | */ |
| 18064 | |
| 18065 | /** |
| 18066 | * ControlPowerSkeletonClass: |
| 18067 | * @parent_class: The parent class. |
| 18068 | * |
| 18069 | * Class structure for #ControlPowerSkeleton. |
| 18070 | */ |
| 18071 | |
| 18072 | struct _ControlPowerSkeletonPrivate |
| 18073 | { |
| 18074 | GValue *properties; |
| 18075 | GList *changed_properties; |
| 18076 | GSource *changed_properties_idle_source; |
| 18077 | GMainContext *context; |
| 18078 | GMutex lock; |
| 18079 | }; |
| 18080 | |
| 18081 | static void |
| 18082 | _control_power_skeleton_handle_method_call ( |
| 18083 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18084 | const gchar *sender G_GNUC_UNUSED, |
| 18085 | const gchar *object_path G_GNUC_UNUSED, |
| 18086 | const gchar *interface_name, |
| 18087 | const gchar *method_name, |
| 18088 | GVariant *parameters, |
| 18089 | GDBusMethodInvocation *invocation, |
| 18090 | gpointer user_data) |
| 18091 | { |
| 18092 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 18093 | _ExtendedGDBusMethodInfo *info; |
| 18094 | GVariantIter iter; |
| 18095 | GVariant *child; |
| 18096 | GValue *paramv; |
| 18097 | guint num_params; |
| 18098 | guint num_extra; |
| 18099 | guint n; |
| 18100 | guint signal_id; |
| 18101 | GValue return_value = G_VALUE_INIT; |
| 18102 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 18103 | g_assert (info != NULL); |
| 18104 | num_params = g_variant_n_children (parameters); |
| 18105 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 18106 | n = 0; |
| 18107 | g_value_init (¶mv[n], TYPE_CONTROL_POWER); |
| 18108 | g_value_set_object (¶mv[n++], skeleton); |
| 18109 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 18110 | g_value_set_object (¶mv[n++], invocation); |
| 18111 | if (info->pass_fdlist) |
| 18112 | { |
| 18113 | #ifdef G_OS_UNIX |
| 18114 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 18115 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 18116 | #else |
| 18117 | g_assert_not_reached (); |
| 18118 | #endif |
| 18119 | } |
| 18120 | g_variant_iter_init (&iter, parameters); |
| 18121 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18122 | { |
| 18123 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 18124 | if (arg_info->use_gvariant) |
| 18125 | { |
| 18126 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18127 | g_value_set_variant (¶mv[n], child); |
| 18128 | n++; |
| 18129 | } |
| 18130 | else |
| 18131 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18132 | g_variant_unref (child); |
| 18133 | } |
| 18134 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 18135 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 18136 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 18137 | if (!g_value_get_boolean (&return_value)) |
| 18138 | 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); |
| 18139 | g_value_unset (&return_value); |
| 18140 | for (n = 0; n < num_params + num_extra; n++) |
| 18141 | g_value_unset (¶mv[n]); |
| 18142 | g_free (paramv); |
| 18143 | } |
| 18144 | |
| 18145 | static GVariant * |
| 18146 | _control_power_skeleton_handle_get_property ( |
| 18147 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18148 | const gchar *sender G_GNUC_UNUSED, |
| 18149 | const gchar *object_path G_GNUC_UNUSED, |
| 18150 | const gchar *interface_name G_GNUC_UNUSED, |
| 18151 | const gchar *property_name, |
| 18152 | GError **error, |
| 18153 | gpointer user_data) |
| 18154 | { |
| 18155 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 18156 | GValue value = G_VALUE_INIT; |
| 18157 | GParamSpec *pspec; |
| 18158 | _ExtendedGDBusPropertyInfo *info; |
| 18159 | GVariant *ret; |
| 18160 | ret = NULL; |
| 18161 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 18162 | g_assert (info != NULL); |
| 18163 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18164 | if (pspec == NULL) |
| 18165 | { |
| 18166 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18167 | } |
| 18168 | else |
| 18169 | { |
| 18170 | g_value_init (&value, pspec->value_type); |
| 18171 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18172 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 18173 | g_value_unset (&value); |
| 18174 | } |
| 18175 | return ret; |
| 18176 | } |
| 18177 | |
| 18178 | static gboolean |
| 18179 | _control_power_skeleton_handle_set_property ( |
| 18180 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18181 | const gchar *sender G_GNUC_UNUSED, |
| 18182 | const gchar *object_path G_GNUC_UNUSED, |
| 18183 | const gchar *interface_name G_GNUC_UNUSED, |
| 18184 | const gchar *property_name, |
| 18185 | GVariant *variant, |
| 18186 | GError **error, |
| 18187 | gpointer user_data) |
| 18188 | { |
| 18189 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 18190 | GValue value = G_VALUE_INIT; |
| 18191 | GParamSpec *pspec; |
| 18192 | _ExtendedGDBusPropertyInfo *info; |
| 18193 | gboolean ret; |
| 18194 | ret = FALSE; |
| 18195 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 18196 | g_assert (info != NULL); |
| 18197 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18198 | if (pspec == NULL) |
| 18199 | { |
| 18200 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18201 | } |
| 18202 | else |
| 18203 | { |
| 18204 | if (info->use_gvariant) |
| 18205 | g_value_set_variant (&value, variant); |
| 18206 | else |
| 18207 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 18208 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18209 | g_value_unset (&value); |
| 18210 | ret = TRUE; |
| 18211 | } |
| 18212 | return ret; |
| 18213 | } |
| 18214 | |
| 18215 | static const GDBusInterfaceVTable _control_power_skeleton_vtable = |
| 18216 | { |
| 18217 | _control_power_skeleton_handle_method_call, |
| 18218 | _control_power_skeleton_handle_get_property, |
| 18219 | _control_power_skeleton_handle_set_property, |
| 18220 | {NULL} |
| 18221 | }; |
| 18222 | |
| 18223 | static GDBusInterfaceInfo * |
| 18224 | control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18225 | { |
| 18226 | return control_power_interface_info (); |
| 18227 | } |
| 18228 | |
| 18229 | static GDBusInterfaceVTable * |
| 18230 | control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18231 | { |
| 18232 | return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable; |
| 18233 | } |
| 18234 | |
| 18235 | static GVariant * |
| 18236 | control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 18237 | { |
| 18238 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 18239 | |
| 18240 | GVariantBuilder builder; |
| 18241 | guint n; |
| 18242 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18243 | if (_control_power_interface_info.parent_struct.properties == NULL) |
| 18244 | goto out; |
| 18245 | for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++) |
| 18246 | { |
| 18247 | GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n]; |
| 18248 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 18249 | { |
| 18250 | GVariant *value; |
| 18251 | 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); |
| 18252 | if (value != NULL) |
| 18253 | { |
| 18254 | g_variant_take_ref (value); |
| 18255 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 18256 | g_variant_unref (value); |
| 18257 | } |
| 18258 | } |
| 18259 | } |
| 18260 | out: |
| 18261 | return g_variant_builder_end (&builder); |
| 18262 | } |
| 18263 | |
| 18264 | static gboolean _control_power_emit_changed (gpointer user_data); |
| 18265 | |
| 18266 | static void |
| 18267 | control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 18268 | { |
| 18269 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 18270 | gboolean emit_changed = FALSE; |
| 18271 | |
| 18272 | g_mutex_lock (&skeleton->priv->lock); |
| 18273 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18274 | { |
| 18275 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18276 | skeleton->priv->changed_properties_idle_source = NULL; |
| 18277 | emit_changed = TRUE; |
| 18278 | } |
| 18279 | g_mutex_unlock (&skeleton->priv->lock); |
| 18280 | |
| 18281 | if (emit_changed) |
| 18282 | _control_power_emit_changed (skeleton); |
| 18283 | } |
| 18284 | |
| 18285 | static void |
| 18286 | _control_power_on_signal_power_good ( |
| 18287 | ControlPower *object) |
| 18288 | { |
| 18289 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18290 | |
| 18291 | GList *connections, *l; |
| 18292 | GVariant *signal_variant; |
| 18293 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18294 | |
| 18295 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 18296 | for (l = connections; l != NULL; l = l->next) |
| 18297 | { |
| 18298 | GDBusConnection *connection = l->data; |
| 18299 | g_dbus_connection_emit_signal (connection, |
| 18300 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood", |
| 18301 | signal_variant, NULL); |
| 18302 | } |
| 18303 | g_variant_unref (signal_variant); |
| 18304 | g_list_free_full (connections, g_object_unref); |
| 18305 | } |
| 18306 | |
| 18307 | static void |
| 18308 | _control_power_on_signal_power_lost ( |
| 18309 | ControlPower *object) |
| 18310 | { |
| 18311 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18312 | |
| 18313 | GList *connections, *l; |
| 18314 | GVariant *signal_variant; |
| 18315 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18316 | |
| 18317 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 18318 | for (l = connections; l != NULL; l = l->next) |
| 18319 | { |
| 18320 | GDBusConnection *connection = l->data; |
| 18321 | g_dbus_connection_emit_signal (connection, |
| 18322 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost", |
| 18323 | signal_variant, NULL); |
| 18324 | } |
| 18325 | g_variant_unref (signal_variant); |
| 18326 | g_list_free_full (connections, g_object_unref); |
| 18327 | } |
| 18328 | |
| 18329 | static void control_power_skeleton_iface_init (ControlPowerIface *iface); |
| 18330 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18331 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18332 | G_ADD_PRIVATE (ControlPowerSkeleton) |
| 18333 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 18334 | |
| 18335 | #else |
| 18336 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18337 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 18338 | |
| 18339 | #endif |
| 18340 | static void |
| 18341 | control_power_skeleton_finalize (GObject *object) |
| 18342 | { |
| 18343 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18344 | guint n; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18345 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18346 | g_value_unset (&skeleton->priv->properties[n]); |
| 18347 | g_free (skeleton->priv->properties); |
| 18348 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 18349 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18350 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18351 | g_main_context_unref (skeleton->priv->context); |
| 18352 | g_mutex_clear (&skeleton->priv->lock); |
| 18353 | G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object); |
| 18354 | } |
| 18355 | |
| 18356 | static void |
| 18357 | control_power_skeleton_get_property (GObject *object, |
| 18358 | guint prop_id, |
| 18359 | GValue *value, |
| 18360 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18361 | { |
| 18362 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18363 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18364 | g_mutex_lock (&skeleton->priv->lock); |
| 18365 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 18366 | g_mutex_unlock (&skeleton->priv->lock); |
| 18367 | } |
| 18368 | |
| 18369 | static gboolean |
| 18370 | _control_power_emit_changed (gpointer user_data) |
| 18371 | { |
| 18372 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 18373 | GList *l; |
| 18374 | GVariantBuilder builder; |
| 18375 | GVariantBuilder invalidated_builder; |
| 18376 | guint num_changes; |
| 18377 | |
| 18378 | g_mutex_lock (&skeleton->priv->lock); |
| 18379 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18380 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 18381 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 18382 | { |
| 18383 | ChangedProperty *cp = l->data; |
| 18384 | GVariant *variant; |
| 18385 | const GValue *cur_value; |
| 18386 | |
| 18387 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 18388 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 18389 | { |
| 18390 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 18391 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 18392 | g_variant_unref (variant); |
| 18393 | num_changes++; |
| 18394 | } |
| 18395 | } |
| 18396 | if (num_changes > 0) |
| 18397 | { |
| 18398 | GList *connections, *ll; |
| 18399 | GVariant *signal_variant; |
| 18400 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power", |
| 18401 | &builder, &invalidated_builder)); |
| 18402 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18403 | for (ll = connections; ll != NULL; ll = ll->next) |
| 18404 | { |
| 18405 | GDBusConnection *connection = ll->data; |
| 18406 | |
| 18407 | g_dbus_connection_emit_signal (connection, |
| 18408 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 18409 | "org.freedesktop.DBus.Properties", |
| 18410 | "PropertiesChanged", |
| 18411 | signal_variant, |
| 18412 | NULL); |
| 18413 | } |
| 18414 | g_variant_unref (signal_variant); |
| 18415 | g_list_free_full (connections, g_object_unref); |
| 18416 | } |
| 18417 | else |
| 18418 | { |
| 18419 | g_variant_builder_clear (&builder); |
| 18420 | g_variant_builder_clear (&invalidated_builder); |
| 18421 | } |
| 18422 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 18423 | skeleton->priv->changed_properties = NULL; |
| 18424 | skeleton->priv->changed_properties_idle_source = NULL; |
| 18425 | g_mutex_unlock (&skeleton->priv->lock); |
| 18426 | return FALSE; |
| 18427 | } |
| 18428 | |
| 18429 | static void |
| 18430 | _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 18431 | { |
| 18432 | ChangedProperty *cp; |
| 18433 | GList *l; |
| 18434 | cp = NULL; |
| 18435 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 18436 | { |
| 18437 | ChangedProperty *i_cp = l->data; |
| 18438 | if (i_cp->info == info) |
| 18439 | { |
| 18440 | cp = i_cp; |
| 18441 | break; |
| 18442 | } |
| 18443 | } |
| 18444 | if (cp == NULL) |
| 18445 | { |
| 18446 | cp = g_new0 (ChangedProperty, 1); |
| 18447 | cp->prop_id = prop_id; |
| 18448 | cp->info = info; |
| 18449 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 18450 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 18451 | g_value_copy (orig_value, &cp->orig_value); |
| 18452 | } |
| 18453 | } |
| 18454 | |
| 18455 | static void |
| 18456 | control_power_skeleton_notify (GObject *object, |
| 18457 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18458 | { |
| 18459 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18460 | g_mutex_lock (&skeleton->priv->lock); |
| 18461 | if (skeleton->priv->changed_properties != NULL && |
| 18462 | skeleton->priv->changed_properties_idle_source == NULL) |
| 18463 | { |
| 18464 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 18465 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 18466 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 18467 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 18468 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 18469 | } |
| 18470 | g_mutex_unlock (&skeleton->priv->lock); |
| 18471 | } |
| 18472 | |
| 18473 | static void |
| 18474 | control_power_skeleton_set_property (GObject *object, |
| 18475 | guint prop_id, |
| 18476 | const GValue *value, |
| 18477 | GParamSpec *pspec) |
| 18478 | { |
| 18479 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18480 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18481 | g_mutex_lock (&skeleton->priv->lock); |
| 18482 | g_object_freeze_notify (object); |
| 18483 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 18484 | { |
| 18485 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 18486 | _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 18487 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 18488 | g_object_notify_by_pspec (object, pspec); |
| 18489 | } |
| 18490 | g_mutex_unlock (&skeleton->priv->lock); |
| 18491 | g_object_thaw_notify (object); |
| 18492 | } |
| 18493 | |
| 18494 | static void |
| 18495 | control_power_skeleton_init (ControlPowerSkeleton *skeleton) |
| 18496 | { |
| 18497 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18498 | skeleton->priv = control_power_skeleton_get_instance_private (skeleton); |
| 18499 | #else |
| 18500 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate); |
| 18501 | #endif |
| 18502 | |
| 18503 | g_mutex_init (&skeleton->priv->lock); |
| 18504 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18505 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18506 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 18507 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18508 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18509 | } |
| 18510 | |
| 18511 | static gint |
| 18512 | control_power_skeleton_get_pgood (ControlPower *object) |
| 18513 | { |
| 18514 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18515 | gint value; |
| 18516 | g_mutex_lock (&skeleton->priv->lock); |
| 18517 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 18518 | g_mutex_unlock (&skeleton->priv->lock); |
| 18519 | return value; |
| 18520 | } |
| 18521 | |
| 18522 | static gint |
| 18523 | control_power_skeleton_get_state (ControlPower *object) |
| 18524 | { |
| 18525 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18526 | gint value; |
| 18527 | g_mutex_lock (&skeleton->priv->lock); |
| 18528 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 18529 | g_mutex_unlock (&skeleton->priv->lock); |
| 18530 | return value; |
| 18531 | } |
| 18532 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18533 | static gint |
| 18534 | control_power_skeleton_get_pgood_timeout (ControlPower *object) |
| 18535 | { |
| 18536 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 18537 | gint value; |
| 18538 | g_mutex_lock (&skeleton->priv->lock); |
| 18539 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 18540 | g_mutex_unlock (&skeleton->priv->lock); |
| 18541 | return value; |
| 18542 | } |
| 18543 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18544 | static void |
| 18545 | control_power_skeleton_class_init (ControlPowerSkeletonClass *klass) |
| 18546 | { |
| 18547 | GObjectClass *gobject_class; |
| 18548 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 18549 | |
| 18550 | gobject_class = G_OBJECT_CLASS (klass); |
| 18551 | gobject_class->finalize = control_power_skeleton_finalize; |
| 18552 | gobject_class->get_property = control_power_skeleton_get_property; |
| 18553 | gobject_class->set_property = control_power_skeleton_set_property; |
| 18554 | gobject_class->notify = control_power_skeleton_notify; |
| 18555 | |
| 18556 | |
| 18557 | control_power_override_properties (gobject_class, 1); |
| 18558 | |
| 18559 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 18560 | skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info; |
| 18561 | skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties; |
| 18562 | skeleton_class->flush = control_power_skeleton_dbus_interface_flush; |
| 18563 | skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable; |
| 18564 | |
| 18565 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 18566 | g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate)); |
| 18567 | #endif |
| 18568 | } |
| 18569 | |
| 18570 | static void |
| 18571 | control_power_skeleton_iface_init (ControlPowerIface *iface) |
| 18572 | { |
| 18573 | iface->power_good = _control_power_on_signal_power_good; |
| 18574 | iface->power_lost = _control_power_on_signal_power_lost; |
| 18575 | iface->get_pgood = control_power_skeleton_get_pgood; |
| 18576 | iface->get_state = control_power_skeleton_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 18577 | iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18578 | } |
| 18579 | |
| 18580 | /** |
| 18581 | * control_power_skeleton_new: |
| 18582 | * |
| 18583 | * 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>. |
| 18584 | * |
| 18585 | * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object. |
| 18586 | */ |
| 18587 | ControlPower * |
| 18588 | control_power_skeleton_new (void) |
| 18589 | { |
| 18590 | return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL)); |
| 18591 | } |
| 18592 | |
| 18593 | /* ------------------------------------------------------------------------ |
| 18594 | * Code for interface org.openbmc.Watchdog |
| 18595 | * ------------------------------------------------------------------------ |
| 18596 | */ |
| 18597 | |
| 18598 | /** |
| 18599 | * SECTION:Watchdog |
| 18600 | * @title: Watchdog |
| 18601 | * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface |
| 18602 | * |
| 18603 | * 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. |
| 18604 | */ |
| 18605 | |
| 18606 | /* ---- Introspection data for org.openbmc.Watchdog ---- */ |
| 18607 | |
| 18608 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = |
| 18609 | { |
| 18610 | { |
| 18611 | -1, |
| 18612 | (gchar *) "start", |
| 18613 | NULL, |
| 18614 | NULL, |
| 18615 | NULL |
| 18616 | }, |
| 18617 | "handle-start", |
| 18618 | FALSE |
| 18619 | }; |
| 18620 | |
| 18621 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = |
| 18622 | { |
| 18623 | { |
| 18624 | -1, |
| 18625 | (gchar *) "poke", |
| 18626 | NULL, |
| 18627 | NULL, |
| 18628 | NULL |
| 18629 | }, |
| 18630 | "handle-poke", |
| 18631 | FALSE |
| 18632 | }; |
| 18633 | |
| 18634 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = |
| 18635 | { |
| 18636 | { |
| 18637 | -1, |
| 18638 | (gchar *) "stop", |
| 18639 | NULL, |
| 18640 | NULL, |
| 18641 | NULL |
| 18642 | }, |
| 18643 | "handle-stop", |
| 18644 | FALSE |
| 18645 | }; |
| 18646 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18647 | static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval = |
| 18648 | { |
| 18649 | { |
| 18650 | -1, |
| 18651 | (gchar *) "interval", |
| 18652 | (gchar *) "i", |
| 18653 | NULL |
| 18654 | }, |
| 18655 | FALSE |
| 18656 | }; |
| 18657 | |
| 18658 | static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] = |
| 18659 | { |
| 18660 | &_watchdog_method_info_set_IN_ARG_interval, |
| 18661 | NULL |
| 18662 | }; |
| 18663 | |
| 18664 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_set = |
| 18665 | { |
| 18666 | { |
| 18667 | -1, |
| 18668 | (gchar *) "set", |
| 18669 | (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers, |
| 18670 | NULL, |
| 18671 | NULL |
| 18672 | }, |
| 18673 | "handle-set", |
| 18674 | FALSE |
| 18675 | }; |
| 18676 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18677 | static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = |
| 18678 | { |
| 18679 | &_watchdog_method_info_start, |
| 18680 | &_watchdog_method_info_poke, |
| 18681 | &_watchdog_method_info_stop, |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18682 | &_watchdog_method_info_set, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18683 | NULL |
| 18684 | }; |
| 18685 | |
| 18686 | static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = |
| 18687 | { |
| 18688 | { |
| 18689 | -1, |
| 18690 | (gchar *) "WatchdogError", |
| 18691 | NULL, |
| 18692 | NULL |
| 18693 | }, |
| 18694 | "watchdog-error" |
| 18695 | }; |
| 18696 | |
| 18697 | static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = |
| 18698 | { |
| 18699 | &_watchdog_signal_info_watchdog_error, |
| 18700 | NULL |
| 18701 | }; |
| 18702 | |
| 18703 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = |
| 18704 | { |
| 18705 | { |
| 18706 | -1, |
| 18707 | (gchar *) "watchdog", |
| 18708 | (gchar *) "i", |
| 18709 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 18710 | NULL |
| 18711 | }, |
| 18712 | "watchdog", |
| 18713 | FALSE |
| 18714 | }; |
| 18715 | |
| 18716 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = |
| 18717 | { |
| 18718 | { |
| 18719 | -1, |
| 18720 | (gchar *) "poll_interval", |
| 18721 | (gchar *) "i", |
| 18722 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 18723 | NULL |
| 18724 | }, |
| 18725 | "poll-interval", |
| 18726 | FALSE |
| 18727 | }; |
| 18728 | |
| 18729 | static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = |
| 18730 | { |
| 18731 | &_watchdog_property_info_watchdog, |
| 18732 | &_watchdog_property_info_poll_interval, |
| 18733 | NULL |
| 18734 | }; |
| 18735 | |
| 18736 | static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = |
| 18737 | { |
| 18738 | { |
| 18739 | -1, |
| 18740 | (gchar *) "org.openbmc.Watchdog", |
| 18741 | (GDBusMethodInfo **) &_watchdog_method_info_pointers, |
| 18742 | (GDBusSignalInfo **) &_watchdog_signal_info_pointers, |
| 18743 | (GDBusPropertyInfo **) &_watchdog_property_info_pointers, |
| 18744 | NULL |
| 18745 | }, |
| 18746 | "watchdog", |
| 18747 | }; |
| 18748 | |
| 18749 | |
| 18750 | /** |
| 18751 | * watchdog_interface_info: |
| 18752 | * |
| 18753 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. |
| 18754 | * |
| 18755 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 18756 | */ |
| 18757 | GDBusInterfaceInfo * |
| 18758 | watchdog_interface_info (void) |
| 18759 | { |
| 18760 | return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; |
| 18761 | } |
| 18762 | |
| 18763 | /** |
| 18764 | * watchdog_override_properties: |
| 18765 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 18766 | * @property_id_begin: The property id to assign to the first overridden property. |
| 18767 | * |
| 18768 | * Overrides all #GObject properties in the #Watchdog interface for a concrete class. |
| 18769 | * The properties are overridden in the order they are defined. |
| 18770 | * |
| 18771 | * Returns: The last property id. |
| 18772 | */ |
| 18773 | guint |
| 18774 | watchdog_override_properties (GObjectClass *klass, guint property_id_begin) |
| 18775 | { |
| 18776 | g_object_class_override_property (klass, property_id_begin++, "watchdog"); |
| 18777 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 18778 | return property_id_begin - 1; |
| 18779 | } |
| 18780 | |
| 18781 | |
| 18782 | |
| 18783 | /** |
| 18784 | * Watchdog: |
| 18785 | * |
| 18786 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 18787 | */ |
| 18788 | |
| 18789 | /** |
| 18790 | * WatchdogIface: |
| 18791 | * @parent_iface: The parent interface. |
| 18792 | * @handle_poke: Handler for the #Watchdog::handle-poke signal. |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18793 | * @handle_set: Handler for the #Watchdog::handle-set signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18794 | * @handle_start: Handler for the #Watchdog::handle-start signal. |
| 18795 | * @handle_stop: Handler for the #Watchdog::handle-stop signal. |
| 18796 | * @get_poll_interval: Getter for the #Watchdog:poll-interval property. |
| 18797 | * @get_watchdog: Getter for the #Watchdog:watchdog property. |
| 18798 | * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. |
| 18799 | * |
| 18800 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 18801 | */ |
| 18802 | |
| 18803 | typedef WatchdogIface WatchdogInterface; |
| 18804 | G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); |
| 18805 | |
| 18806 | static void |
| 18807 | watchdog_default_init (WatchdogIface *iface) |
| 18808 | { |
| 18809 | /* GObject signals for incoming D-Bus method calls: */ |
| 18810 | /** |
| 18811 | * Watchdog::handle-start: |
| 18812 | * @object: A #Watchdog. |
| 18813 | * @invocation: A #GDBusMethodInvocation. |
| 18814 | * |
| 18815 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. |
| 18816 | * |
| 18817 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_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. |
| 18818 | * |
| 18819 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18820 | */ |
| 18821 | g_signal_new ("handle-start", |
| 18822 | G_TYPE_FROM_INTERFACE (iface), |
| 18823 | G_SIGNAL_RUN_LAST, |
| 18824 | G_STRUCT_OFFSET (WatchdogIface, handle_start), |
| 18825 | g_signal_accumulator_true_handled, |
| 18826 | NULL, |
| 18827 | g_cclosure_marshal_generic, |
| 18828 | G_TYPE_BOOLEAN, |
| 18829 | 1, |
| 18830 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 18831 | |
| 18832 | /** |
| 18833 | * Watchdog::handle-poke: |
| 18834 | * @object: A #Watchdog. |
| 18835 | * @invocation: A #GDBusMethodInvocation. |
| 18836 | * |
| 18837 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. |
| 18838 | * |
| 18839 | * 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. |
| 18840 | * |
| 18841 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18842 | */ |
| 18843 | g_signal_new ("handle-poke", |
| 18844 | G_TYPE_FROM_INTERFACE (iface), |
| 18845 | G_SIGNAL_RUN_LAST, |
| 18846 | G_STRUCT_OFFSET (WatchdogIface, handle_poke), |
| 18847 | g_signal_accumulator_true_handled, |
| 18848 | NULL, |
| 18849 | g_cclosure_marshal_generic, |
| 18850 | G_TYPE_BOOLEAN, |
| 18851 | 1, |
| 18852 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 18853 | |
| 18854 | /** |
| 18855 | * Watchdog::handle-stop: |
| 18856 | * @object: A #Watchdog. |
| 18857 | * @invocation: A #GDBusMethodInvocation. |
| 18858 | * |
| 18859 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. |
| 18860 | * |
| 18861 | * 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. |
| 18862 | * |
| 18863 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18864 | */ |
| 18865 | g_signal_new ("handle-stop", |
| 18866 | G_TYPE_FROM_INTERFACE (iface), |
| 18867 | G_SIGNAL_RUN_LAST, |
| 18868 | G_STRUCT_OFFSET (WatchdogIface, handle_stop), |
| 18869 | g_signal_accumulator_true_handled, |
| 18870 | NULL, |
| 18871 | g_cclosure_marshal_generic, |
| 18872 | G_TYPE_BOOLEAN, |
| 18873 | 1, |
| 18874 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 18875 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18876 | /** |
| 18877 | * Watchdog::handle-set: |
| 18878 | * @object: A #Watchdog. |
| 18879 | * @invocation: A #GDBusMethodInvocation. |
| 18880 | * @arg_interval: Argument passed by remote caller. |
| 18881 | * |
| 18882 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. |
| 18883 | * |
| 18884 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 18885 | * |
| 18886 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 18887 | */ |
| 18888 | g_signal_new ("handle-set", |
| 18889 | G_TYPE_FROM_INTERFACE (iface), |
| 18890 | G_SIGNAL_RUN_LAST, |
| 18891 | G_STRUCT_OFFSET (WatchdogIface, handle_set), |
| 18892 | g_signal_accumulator_true_handled, |
| 18893 | NULL, |
| 18894 | g_cclosure_marshal_generic, |
| 18895 | G_TYPE_BOOLEAN, |
| 18896 | 2, |
| 18897 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 18898 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18899 | /* GObject signals for received D-Bus signals: */ |
| 18900 | /** |
| 18901 | * Watchdog::watchdog-error: |
| 18902 | * @object: A #Watchdog. |
| 18903 | * |
| 18904 | * 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. |
| 18905 | * |
| 18906 | * 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. |
| 18907 | */ |
| 18908 | g_signal_new ("watchdog-error", |
| 18909 | G_TYPE_FROM_INTERFACE (iface), |
| 18910 | G_SIGNAL_RUN_LAST, |
| 18911 | G_STRUCT_OFFSET (WatchdogIface, watchdog_error), |
| 18912 | NULL, |
| 18913 | NULL, |
| 18914 | g_cclosure_marshal_generic, |
| 18915 | G_TYPE_NONE, |
| 18916 | 0); |
| 18917 | |
| 18918 | /* GObject properties for D-Bus properties: */ |
| 18919 | /** |
| 18920 | * Watchdog:watchdog: |
| 18921 | * |
| 18922 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. |
| 18923 | * |
| 18924 | * 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. |
| 18925 | */ |
| 18926 | g_object_interface_install_property (iface, |
| 18927 | g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 18928 | /** |
| 18929 | * Watchdog:poll-interval: |
| 18930 | * |
| 18931 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. |
| 18932 | * |
| 18933 | * 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. |
| 18934 | */ |
| 18935 | g_object_interface_install_property (iface, |
| 18936 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 18937 | } |
| 18938 | |
| 18939 | /** |
| 18940 | * watchdog_get_watchdog: (skip) |
| 18941 | * @object: A #Watchdog. |
| 18942 | * |
| 18943 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. |
| 18944 | * |
| 18945 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 18946 | * |
| 18947 | * Returns: The property value. |
| 18948 | */ |
| 18949 | gint |
| 18950 | watchdog_get_watchdog (Watchdog *object) |
| 18951 | { |
| 18952 | return WATCHDOG_GET_IFACE (object)->get_watchdog (object); |
| 18953 | } |
| 18954 | |
| 18955 | /** |
| 18956 | * watchdog_set_watchdog: (skip) |
| 18957 | * @object: A #Watchdog. |
| 18958 | * @value: The value to set. |
| 18959 | * |
| 18960 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. |
| 18961 | * |
| 18962 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 18963 | */ |
| 18964 | void |
| 18965 | watchdog_set_watchdog (Watchdog *object, gint value) |
| 18966 | { |
| 18967 | g_object_set (G_OBJECT (object), "watchdog", value, NULL); |
| 18968 | } |
| 18969 | |
| 18970 | /** |
| 18971 | * watchdog_get_poll_interval: (skip) |
| 18972 | * @object: A #Watchdog. |
| 18973 | * |
| 18974 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. |
| 18975 | * |
| 18976 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 18977 | * |
| 18978 | * Returns: The property value. |
| 18979 | */ |
| 18980 | gint |
| 18981 | watchdog_get_poll_interval (Watchdog *object) |
| 18982 | { |
| 18983 | return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); |
| 18984 | } |
| 18985 | |
| 18986 | /** |
| 18987 | * watchdog_set_poll_interval: (skip) |
| 18988 | * @object: A #Watchdog. |
| 18989 | * @value: The value to set. |
| 18990 | * |
| 18991 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 18992 | * |
| 18993 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 18994 | */ |
| 18995 | void |
| 18996 | watchdog_set_poll_interval (Watchdog *object, gint value) |
| 18997 | { |
| 18998 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 18999 | } |
| 19000 | |
| 19001 | /** |
| 19002 | * watchdog_emit_watchdog_error: |
| 19003 | * @object: A #Watchdog. |
| 19004 | * |
| 19005 | * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. |
| 19006 | */ |
| 19007 | void |
| 19008 | watchdog_emit_watchdog_error ( |
| 19009 | Watchdog *object) |
| 19010 | { |
| 19011 | g_signal_emit_by_name (object, "watchdog-error"); |
| 19012 | } |
| 19013 | |
| 19014 | /** |
| 19015 | * watchdog_call_start: |
| 19016 | * @proxy: A #WatchdogProxy. |
| 19017 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19018 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19019 | * @user_data: User data to pass to @callback. |
| 19020 | * |
| 19021 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. |
| 19022 | * 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. |
| 19023 | * You can then call watchdog_call_start_finish() to get the result of the operation. |
| 19024 | * |
| 19025 | * See watchdog_call_start_sync() for the synchronous, blocking version of this method. |
| 19026 | */ |
| 19027 | void |
| 19028 | watchdog_call_start ( |
| 19029 | Watchdog *proxy, |
| 19030 | GCancellable *cancellable, |
| 19031 | GAsyncReadyCallback callback, |
| 19032 | gpointer user_data) |
| 19033 | { |
| 19034 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19035 | "start", |
| 19036 | g_variant_new ("()"), |
| 19037 | G_DBUS_CALL_FLAGS_NONE, |
| 19038 | -1, |
| 19039 | cancellable, |
| 19040 | callback, |
| 19041 | user_data); |
| 19042 | } |
| 19043 | |
| 19044 | /** |
| 19045 | * watchdog_call_start_finish: |
| 19046 | * @proxy: A #WatchdogProxy. |
| 19047 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). |
| 19048 | * @error: Return location for error or %NULL. |
| 19049 | * |
| 19050 | * Finishes an operation started with watchdog_call_start(). |
| 19051 | * |
| 19052 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19053 | */ |
| 19054 | gboolean |
| 19055 | watchdog_call_start_finish ( |
| 19056 | Watchdog *proxy, |
| 19057 | GAsyncResult *res, |
| 19058 | GError **error) |
| 19059 | { |
| 19060 | GVariant *_ret; |
| 19061 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19062 | if (_ret == NULL) |
| 19063 | goto _out; |
| 19064 | g_variant_get (_ret, |
| 19065 | "()"); |
| 19066 | g_variant_unref (_ret); |
| 19067 | _out: |
| 19068 | return _ret != NULL; |
| 19069 | } |
| 19070 | |
| 19071 | /** |
| 19072 | * watchdog_call_start_sync: |
| 19073 | * @proxy: A #WatchdogProxy. |
| 19074 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19075 | * @error: Return location for error or %NULL. |
| 19076 | * |
| 19077 | * 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. |
| 19078 | * |
| 19079 | * See watchdog_call_start() for the asynchronous version of this method. |
| 19080 | * |
| 19081 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19082 | */ |
| 19083 | gboolean |
| 19084 | watchdog_call_start_sync ( |
| 19085 | Watchdog *proxy, |
| 19086 | GCancellable *cancellable, |
| 19087 | GError **error) |
| 19088 | { |
| 19089 | GVariant *_ret; |
| 19090 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19091 | "start", |
| 19092 | g_variant_new ("()"), |
| 19093 | G_DBUS_CALL_FLAGS_NONE, |
| 19094 | -1, |
| 19095 | cancellable, |
| 19096 | error); |
| 19097 | if (_ret == NULL) |
| 19098 | goto _out; |
| 19099 | g_variant_get (_ret, |
| 19100 | "()"); |
| 19101 | g_variant_unref (_ret); |
| 19102 | _out: |
| 19103 | return _ret != NULL; |
| 19104 | } |
| 19105 | |
| 19106 | /** |
| 19107 | * watchdog_call_poke: |
| 19108 | * @proxy: A #WatchdogProxy. |
| 19109 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19110 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19111 | * @user_data: User data to pass to @callback. |
| 19112 | * |
| 19113 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. |
| 19114 | * 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. |
| 19115 | * You can then call watchdog_call_poke_finish() to get the result of the operation. |
| 19116 | * |
| 19117 | * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. |
| 19118 | */ |
| 19119 | void |
| 19120 | watchdog_call_poke ( |
| 19121 | Watchdog *proxy, |
| 19122 | GCancellable *cancellable, |
| 19123 | GAsyncReadyCallback callback, |
| 19124 | gpointer user_data) |
| 19125 | { |
| 19126 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19127 | "poke", |
| 19128 | g_variant_new ("()"), |
| 19129 | G_DBUS_CALL_FLAGS_NONE, |
| 19130 | -1, |
| 19131 | cancellable, |
| 19132 | callback, |
| 19133 | user_data); |
| 19134 | } |
| 19135 | |
| 19136 | /** |
| 19137 | * watchdog_call_poke_finish: |
| 19138 | * @proxy: A #WatchdogProxy. |
| 19139 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). |
| 19140 | * @error: Return location for error or %NULL. |
| 19141 | * |
| 19142 | * Finishes an operation started with watchdog_call_poke(). |
| 19143 | * |
| 19144 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19145 | */ |
| 19146 | gboolean |
| 19147 | watchdog_call_poke_finish ( |
| 19148 | Watchdog *proxy, |
| 19149 | GAsyncResult *res, |
| 19150 | GError **error) |
| 19151 | { |
| 19152 | GVariant *_ret; |
| 19153 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19154 | if (_ret == NULL) |
| 19155 | goto _out; |
| 19156 | g_variant_get (_ret, |
| 19157 | "()"); |
| 19158 | g_variant_unref (_ret); |
| 19159 | _out: |
| 19160 | return _ret != NULL; |
| 19161 | } |
| 19162 | |
| 19163 | /** |
| 19164 | * watchdog_call_poke_sync: |
| 19165 | * @proxy: A #WatchdogProxy. |
| 19166 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19167 | * @error: Return location for error or %NULL. |
| 19168 | * |
| 19169 | * 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. |
| 19170 | * |
| 19171 | * See watchdog_call_poke() for the asynchronous version of this method. |
| 19172 | * |
| 19173 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19174 | */ |
| 19175 | gboolean |
| 19176 | watchdog_call_poke_sync ( |
| 19177 | Watchdog *proxy, |
| 19178 | GCancellable *cancellable, |
| 19179 | GError **error) |
| 19180 | { |
| 19181 | GVariant *_ret; |
| 19182 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19183 | "poke", |
| 19184 | g_variant_new ("()"), |
| 19185 | G_DBUS_CALL_FLAGS_NONE, |
| 19186 | -1, |
| 19187 | cancellable, |
| 19188 | error); |
| 19189 | if (_ret == NULL) |
| 19190 | goto _out; |
| 19191 | g_variant_get (_ret, |
| 19192 | "()"); |
| 19193 | g_variant_unref (_ret); |
| 19194 | _out: |
| 19195 | return _ret != NULL; |
| 19196 | } |
| 19197 | |
| 19198 | /** |
| 19199 | * watchdog_call_stop: |
| 19200 | * @proxy: A #WatchdogProxy. |
| 19201 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19202 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19203 | * @user_data: User data to pass to @callback. |
| 19204 | * |
| 19205 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. |
| 19206 | * 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. |
| 19207 | * You can then call watchdog_call_stop_finish() to get the result of the operation. |
| 19208 | * |
| 19209 | * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. |
| 19210 | */ |
| 19211 | void |
| 19212 | watchdog_call_stop ( |
| 19213 | Watchdog *proxy, |
| 19214 | GCancellable *cancellable, |
| 19215 | GAsyncReadyCallback callback, |
| 19216 | gpointer user_data) |
| 19217 | { |
| 19218 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19219 | "stop", |
| 19220 | g_variant_new ("()"), |
| 19221 | G_DBUS_CALL_FLAGS_NONE, |
| 19222 | -1, |
| 19223 | cancellable, |
| 19224 | callback, |
| 19225 | user_data); |
| 19226 | } |
| 19227 | |
| 19228 | /** |
| 19229 | * watchdog_call_stop_finish: |
| 19230 | * @proxy: A #WatchdogProxy. |
| 19231 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). |
| 19232 | * @error: Return location for error or %NULL. |
| 19233 | * |
| 19234 | * Finishes an operation started with watchdog_call_stop(). |
| 19235 | * |
| 19236 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19237 | */ |
| 19238 | gboolean |
| 19239 | watchdog_call_stop_finish ( |
| 19240 | Watchdog *proxy, |
| 19241 | GAsyncResult *res, |
| 19242 | GError **error) |
| 19243 | { |
| 19244 | GVariant *_ret; |
| 19245 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19246 | if (_ret == NULL) |
| 19247 | goto _out; |
| 19248 | g_variant_get (_ret, |
| 19249 | "()"); |
| 19250 | g_variant_unref (_ret); |
| 19251 | _out: |
| 19252 | return _ret != NULL; |
| 19253 | } |
| 19254 | |
| 19255 | /** |
| 19256 | * watchdog_call_stop_sync: |
| 19257 | * @proxy: A #WatchdogProxy. |
| 19258 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19259 | * @error: Return location for error or %NULL. |
| 19260 | * |
| 19261 | * 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. |
| 19262 | * |
| 19263 | * See watchdog_call_stop() for the asynchronous version of this method. |
| 19264 | * |
| 19265 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19266 | */ |
| 19267 | gboolean |
| 19268 | watchdog_call_stop_sync ( |
| 19269 | Watchdog *proxy, |
| 19270 | GCancellable *cancellable, |
| 19271 | GError **error) |
| 19272 | { |
| 19273 | GVariant *_ret; |
| 19274 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19275 | "stop", |
| 19276 | g_variant_new ("()"), |
| 19277 | G_DBUS_CALL_FLAGS_NONE, |
| 19278 | -1, |
| 19279 | cancellable, |
| 19280 | error); |
| 19281 | if (_ret == NULL) |
| 19282 | goto _out; |
| 19283 | g_variant_get (_ret, |
| 19284 | "()"); |
| 19285 | g_variant_unref (_ret); |
| 19286 | _out: |
| 19287 | return _ret != NULL; |
| 19288 | } |
| 19289 | |
| 19290 | /** |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 19291 | * watchdog_call_set: |
| 19292 | * @proxy: A #WatchdogProxy. |
| 19293 | * @arg_interval: Argument to pass with the method invocation. |
| 19294 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19295 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19296 | * @user_data: User data to pass to @callback. |
| 19297 | * |
| 19298 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. |
| 19299 | * 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. |
| 19300 | * You can then call watchdog_call_set_finish() to get the result of the operation. |
| 19301 | * |
| 19302 | * See watchdog_call_set_sync() for the synchronous, blocking version of this method. |
| 19303 | */ |
| 19304 | void |
| 19305 | watchdog_call_set ( |
| 19306 | Watchdog *proxy, |
| 19307 | gint arg_interval, |
| 19308 | GCancellable *cancellable, |
| 19309 | GAsyncReadyCallback callback, |
| 19310 | gpointer user_data) |
| 19311 | { |
| 19312 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19313 | "set", |
| 19314 | g_variant_new ("(i)", |
| 19315 | arg_interval), |
| 19316 | G_DBUS_CALL_FLAGS_NONE, |
| 19317 | -1, |
| 19318 | cancellable, |
| 19319 | callback, |
| 19320 | user_data); |
| 19321 | } |
| 19322 | |
| 19323 | /** |
| 19324 | * watchdog_call_set_finish: |
| 19325 | * @proxy: A #WatchdogProxy. |
| 19326 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set(). |
| 19327 | * @error: Return location for error or %NULL. |
| 19328 | * |
| 19329 | * Finishes an operation started with watchdog_call_set(). |
| 19330 | * |
| 19331 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19332 | */ |
| 19333 | gboolean |
| 19334 | watchdog_call_set_finish ( |
| 19335 | Watchdog *proxy, |
| 19336 | GAsyncResult *res, |
| 19337 | GError **error) |
| 19338 | { |
| 19339 | GVariant *_ret; |
| 19340 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19341 | if (_ret == NULL) |
| 19342 | goto _out; |
| 19343 | g_variant_get (_ret, |
| 19344 | "()"); |
| 19345 | g_variant_unref (_ret); |
| 19346 | _out: |
| 19347 | return _ret != NULL; |
| 19348 | } |
| 19349 | |
| 19350 | /** |
| 19351 | * watchdog_call_set_sync: |
| 19352 | * @proxy: A #WatchdogProxy. |
| 19353 | * @arg_interval: Argument to pass with the method invocation. |
| 19354 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19355 | * @error: Return location for error or %NULL. |
| 19356 | * |
| 19357 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 19358 | * |
| 19359 | * See watchdog_call_set() for the asynchronous version of this method. |
| 19360 | * |
| 19361 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19362 | */ |
| 19363 | gboolean |
| 19364 | watchdog_call_set_sync ( |
| 19365 | Watchdog *proxy, |
| 19366 | gint arg_interval, |
| 19367 | GCancellable *cancellable, |
| 19368 | GError **error) |
| 19369 | { |
| 19370 | GVariant *_ret; |
| 19371 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19372 | "set", |
| 19373 | g_variant_new ("(i)", |
| 19374 | arg_interval), |
| 19375 | G_DBUS_CALL_FLAGS_NONE, |
| 19376 | -1, |
| 19377 | cancellable, |
| 19378 | error); |
| 19379 | if (_ret == NULL) |
| 19380 | goto _out; |
| 19381 | g_variant_get (_ret, |
| 19382 | "()"); |
| 19383 | g_variant_unref (_ret); |
| 19384 | _out: |
| 19385 | return _ret != NULL; |
| 19386 | } |
| 19387 | |
| 19388 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19389 | * watchdog_complete_start: |
| 19390 | * @object: A #Watchdog. |
| 19391 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19392 | * |
| 19393 | * 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. |
| 19394 | * |
| 19395 | * This method will free @invocation, you cannot use it afterwards. |
| 19396 | */ |
| 19397 | void |
| 19398 | watchdog_complete_start ( |
| 19399 | Watchdog *object, |
| 19400 | GDBusMethodInvocation *invocation) |
| 19401 | { |
| 19402 | g_dbus_method_invocation_return_value (invocation, |
| 19403 | g_variant_new ("()")); |
| 19404 | } |
| 19405 | |
| 19406 | /** |
| 19407 | * watchdog_complete_poke: |
| 19408 | * @object: A #Watchdog. |
| 19409 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19410 | * |
| 19411 | * 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. |
| 19412 | * |
| 19413 | * This method will free @invocation, you cannot use it afterwards. |
| 19414 | */ |
| 19415 | void |
| 19416 | watchdog_complete_poke ( |
| 19417 | Watchdog *object, |
| 19418 | GDBusMethodInvocation *invocation) |
| 19419 | { |
| 19420 | g_dbus_method_invocation_return_value (invocation, |
| 19421 | g_variant_new ("()")); |
| 19422 | } |
| 19423 | |
| 19424 | /** |
| 19425 | * watchdog_complete_stop: |
| 19426 | * @object: A #Watchdog. |
| 19427 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19428 | * |
| 19429 | * 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. |
| 19430 | * |
| 19431 | * This method will free @invocation, you cannot use it afterwards. |
| 19432 | */ |
| 19433 | void |
| 19434 | watchdog_complete_stop ( |
| 19435 | Watchdog *object, |
| 19436 | GDBusMethodInvocation *invocation) |
| 19437 | { |
| 19438 | g_dbus_method_invocation_return_value (invocation, |
| 19439 | g_variant_new ("()")); |
| 19440 | } |
| 19441 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 19442 | /** |
| 19443 | * watchdog_complete_set: |
| 19444 | * @object: A #Watchdog. |
| 19445 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19446 | * |
| 19447 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 19448 | * |
| 19449 | * This method will free @invocation, you cannot use it afterwards. |
| 19450 | */ |
| 19451 | void |
| 19452 | watchdog_complete_set ( |
| 19453 | Watchdog *object, |
| 19454 | GDBusMethodInvocation *invocation) |
| 19455 | { |
| 19456 | g_dbus_method_invocation_return_value (invocation, |
| 19457 | g_variant_new ("()")); |
| 19458 | } |
| 19459 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19460 | /* ------------------------------------------------------------------------ */ |
| 19461 | |
| 19462 | /** |
| 19463 | * WatchdogProxy: |
| 19464 | * |
| 19465 | * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. |
| 19466 | */ |
| 19467 | |
| 19468 | /** |
| 19469 | * WatchdogProxyClass: |
| 19470 | * @parent_class: The parent class. |
| 19471 | * |
| 19472 | * Class structure for #WatchdogProxy. |
| 19473 | */ |
| 19474 | |
| 19475 | struct _WatchdogProxyPrivate |
| 19476 | { |
| 19477 | GData *qdata; |
| 19478 | }; |
| 19479 | |
| 19480 | static void watchdog_proxy_iface_init (WatchdogIface *iface); |
| 19481 | |
| 19482 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19483 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 19484 | G_ADD_PRIVATE (WatchdogProxy) |
| 19485 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 19486 | |
| 19487 | #else |
| 19488 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 19489 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 19490 | |
| 19491 | #endif |
| 19492 | static void |
| 19493 | watchdog_proxy_finalize (GObject *object) |
| 19494 | { |
| 19495 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 19496 | g_datalist_clear (&proxy->priv->qdata); |
| 19497 | G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); |
| 19498 | } |
| 19499 | |
| 19500 | static void |
| 19501 | watchdog_proxy_get_property (GObject *object, |
| 19502 | guint prop_id, |
| 19503 | GValue *value, |
| 19504 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19505 | { |
| 19506 | const _ExtendedGDBusPropertyInfo *info; |
| 19507 | GVariant *variant; |
| 19508 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 19509 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 19510 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 19511 | if (info->use_gvariant) |
| 19512 | { |
| 19513 | g_value_set_variant (value, variant); |
| 19514 | } |
| 19515 | else |
| 19516 | { |
| 19517 | if (variant != NULL) |
| 19518 | g_dbus_gvariant_to_gvalue (variant, value); |
| 19519 | } |
| 19520 | if (variant != NULL) |
| 19521 | g_variant_unref (variant); |
| 19522 | } |
| 19523 | |
| 19524 | static void |
| 19525 | watchdog_proxy_set_property_cb (GDBusProxy *proxy, |
| 19526 | GAsyncResult *res, |
| 19527 | gpointer user_data) |
| 19528 | { |
| 19529 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 19530 | GError *error; |
| 19531 | GVariant *_ret; |
| 19532 | error = NULL; |
| 19533 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 19534 | if (!_ret) |
| 19535 | { |
| 19536 | g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", |
| 19537 | info->parent_struct.name, |
| 19538 | error->message, g_quark_to_string (error->domain), error->code); |
| 19539 | g_error_free (error); |
| 19540 | } |
| 19541 | else |
| 19542 | { |
| 19543 | g_variant_unref (_ret); |
| 19544 | } |
| 19545 | } |
| 19546 | |
| 19547 | static void |
| 19548 | watchdog_proxy_set_property (GObject *object, |
| 19549 | guint prop_id, |
| 19550 | const GValue *value, |
| 19551 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19552 | { |
| 19553 | const _ExtendedGDBusPropertyInfo *info; |
| 19554 | GVariant *variant; |
| 19555 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 19556 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 19557 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 19558 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 19559 | "org.freedesktop.DBus.Properties.Set", |
| 19560 | g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), |
| 19561 | G_DBUS_CALL_FLAGS_NONE, |
| 19562 | -1, |
| 19563 | NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 19564 | g_variant_unref (variant); |
| 19565 | } |
| 19566 | |
| 19567 | static void |
| 19568 | watchdog_proxy_g_signal (GDBusProxy *proxy, |
| 19569 | const gchar *sender_name G_GNUC_UNUSED, |
| 19570 | const gchar *signal_name, |
| 19571 | GVariant *parameters) |
| 19572 | { |
| 19573 | _ExtendedGDBusSignalInfo *info; |
| 19574 | GVariantIter iter; |
| 19575 | GVariant *child; |
| 19576 | GValue *paramv; |
| 19577 | guint num_params; |
| 19578 | guint n; |
| 19579 | guint signal_id; |
| 19580 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); |
| 19581 | if (info == NULL) |
| 19582 | return; |
| 19583 | num_params = g_variant_n_children (parameters); |
| 19584 | paramv = g_new0 (GValue, num_params + 1); |
| 19585 | g_value_init (¶mv[0], TYPE_WATCHDOG); |
| 19586 | g_value_set_object (¶mv[0], proxy); |
| 19587 | g_variant_iter_init (&iter, parameters); |
| 19588 | n = 1; |
| 19589 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19590 | { |
| 19591 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 19592 | if (arg_info->use_gvariant) |
| 19593 | { |
| 19594 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19595 | g_value_set_variant (¶mv[n], child); |
| 19596 | n++; |
| 19597 | } |
| 19598 | else |
| 19599 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19600 | g_variant_unref (child); |
| 19601 | } |
| 19602 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 19603 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 19604 | for (n = 0; n < num_params + 1; n++) |
| 19605 | g_value_unset (¶mv[n]); |
| 19606 | g_free (paramv); |
| 19607 | } |
| 19608 | |
| 19609 | static void |
| 19610 | watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 19611 | GVariant *changed_properties, |
| 19612 | const gchar *const *invalidated_properties) |
| 19613 | { |
| 19614 | WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); |
| 19615 | guint n; |
| 19616 | const gchar *key; |
| 19617 | GVariantIter *iter; |
| 19618 | _ExtendedGDBusPropertyInfo *info; |
| 19619 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 19620 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 19621 | { |
| 19622 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); |
| 19623 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 19624 | if (info != NULL) |
| 19625 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19626 | } |
| 19627 | g_variant_iter_free (iter); |
| 19628 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 19629 | { |
| 19630 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); |
| 19631 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 19632 | if (info != NULL) |
| 19633 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19634 | } |
| 19635 | } |
| 19636 | |
| 19637 | static gint |
| 19638 | watchdog_proxy_get_watchdog (Watchdog *object) |
| 19639 | { |
| 19640 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 19641 | GVariant *variant; |
| 19642 | gint value = 0; |
| 19643 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); |
| 19644 | if (variant != NULL) |
| 19645 | { |
| 19646 | value = g_variant_get_int32 (variant); |
| 19647 | g_variant_unref (variant); |
| 19648 | } |
| 19649 | return value; |
| 19650 | } |
| 19651 | |
| 19652 | static gint |
| 19653 | watchdog_proxy_get_poll_interval (Watchdog *object) |
| 19654 | { |
| 19655 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 19656 | GVariant *variant; |
| 19657 | gint value = 0; |
| 19658 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 19659 | if (variant != NULL) |
| 19660 | { |
| 19661 | value = g_variant_get_int32 (variant); |
| 19662 | g_variant_unref (variant); |
| 19663 | } |
| 19664 | return value; |
| 19665 | } |
| 19666 | |
| 19667 | static void |
| 19668 | watchdog_proxy_init (WatchdogProxy *proxy) |
| 19669 | { |
| 19670 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19671 | proxy->priv = watchdog_proxy_get_instance_private (proxy); |
| 19672 | #else |
| 19673 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); |
| 19674 | #endif |
| 19675 | |
| 19676 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); |
| 19677 | } |
| 19678 | |
| 19679 | static void |
| 19680 | watchdog_proxy_class_init (WatchdogProxyClass *klass) |
| 19681 | { |
| 19682 | GObjectClass *gobject_class; |
| 19683 | GDBusProxyClass *proxy_class; |
| 19684 | |
| 19685 | gobject_class = G_OBJECT_CLASS (klass); |
| 19686 | gobject_class->finalize = watchdog_proxy_finalize; |
| 19687 | gobject_class->get_property = watchdog_proxy_get_property; |
| 19688 | gobject_class->set_property = watchdog_proxy_set_property; |
| 19689 | |
| 19690 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 19691 | proxy_class->g_signal = watchdog_proxy_g_signal; |
| 19692 | proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; |
| 19693 | |
| 19694 | watchdog_override_properties (gobject_class, 1); |
| 19695 | |
| 19696 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 19697 | g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); |
| 19698 | #endif |
| 19699 | } |
| 19700 | |
| 19701 | static void |
| 19702 | watchdog_proxy_iface_init (WatchdogIface *iface) |
| 19703 | { |
| 19704 | iface->get_watchdog = watchdog_proxy_get_watchdog; |
| 19705 | iface->get_poll_interval = watchdog_proxy_get_poll_interval; |
| 19706 | } |
| 19707 | |
| 19708 | /** |
| 19709 | * watchdog_proxy_new: |
| 19710 | * @connection: A #GDBusConnection. |
| 19711 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19712 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19713 | * @object_path: An object path. |
| 19714 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19715 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19716 | * @user_data: User data to pass to @callback. |
| 19717 | * |
| 19718 | * 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. |
| 19719 | * |
| 19720 | * 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. |
| 19721 | * You can then call watchdog_proxy_new_finish() to get the result of the operation. |
| 19722 | * |
| 19723 | * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 19724 | */ |
| 19725 | void |
| 19726 | watchdog_proxy_new ( |
| 19727 | GDBusConnection *connection, |
| 19728 | GDBusProxyFlags flags, |
| 19729 | const gchar *name, |
| 19730 | const gchar *object_path, |
| 19731 | GCancellable *cancellable, |
| 19732 | GAsyncReadyCallback callback, |
| 19733 | gpointer user_data) |
| 19734 | { |
| 19735 | 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); |
| 19736 | } |
| 19737 | |
| 19738 | /** |
| 19739 | * watchdog_proxy_new_finish: |
| 19740 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). |
| 19741 | * @error: Return location for error or %NULL |
| 19742 | * |
| 19743 | * Finishes an operation started with watchdog_proxy_new(). |
| 19744 | * |
| 19745 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 19746 | */ |
| 19747 | Watchdog * |
| 19748 | watchdog_proxy_new_finish ( |
| 19749 | GAsyncResult *res, |
| 19750 | GError **error) |
| 19751 | { |
| 19752 | GObject *ret; |
| 19753 | GObject *source_object; |
| 19754 | source_object = g_async_result_get_source_object (res); |
| 19755 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19756 | g_object_unref (source_object); |
| 19757 | if (ret != NULL) |
| 19758 | return WATCHDOG (ret); |
| 19759 | else |
| 19760 | return NULL; |
| 19761 | } |
| 19762 | |
| 19763 | /** |
| 19764 | * watchdog_proxy_new_sync: |
| 19765 | * @connection: A #GDBusConnection. |
| 19766 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19767 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19768 | * @object_path: An object path. |
| 19769 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19770 | * @error: Return location for error or %NULL |
| 19771 | * |
| 19772 | * 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. |
| 19773 | * |
| 19774 | * The calling thread is blocked until a reply is received. |
| 19775 | * |
| 19776 | * See watchdog_proxy_new() for the asynchronous version of this constructor. |
| 19777 | * |
| 19778 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 19779 | */ |
| 19780 | Watchdog * |
| 19781 | watchdog_proxy_new_sync ( |
| 19782 | GDBusConnection *connection, |
| 19783 | GDBusProxyFlags flags, |
| 19784 | const gchar *name, |
| 19785 | const gchar *object_path, |
| 19786 | GCancellable *cancellable, |
| 19787 | GError **error) |
| 19788 | { |
| 19789 | GInitable *ret; |
| 19790 | 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); |
| 19791 | if (ret != NULL) |
| 19792 | return WATCHDOG (ret); |
| 19793 | else |
| 19794 | return NULL; |
| 19795 | } |
| 19796 | |
| 19797 | |
| 19798 | /** |
| 19799 | * watchdog_proxy_new_for_bus: |
| 19800 | * @bus_type: A #GBusType. |
| 19801 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19802 | * @name: A bus name (well-known or unique). |
| 19803 | * @object_path: An object path. |
| 19804 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19805 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19806 | * @user_data: User data to pass to @callback. |
| 19807 | * |
| 19808 | * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 19809 | * |
| 19810 | * 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. |
| 19811 | * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. |
| 19812 | * |
| 19813 | * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 19814 | */ |
| 19815 | void |
| 19816 | watchdog_proxy_new_for_bus ( |
| 19817 | GBusType bus_type, |
| 19818 | GDBusProxyFlags flags, |
| 19819 | const gchar *name, |
| 19820 | const gchar *object_path, |
| 19821 | GCancellable *cancellable, |
| 19822 | GAsyncReadyCallback callback, |
| 19823 | gpointer user_data) |
| 19824 | { |
| 19825 | 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); |
| 19826 | } |
| 19827 | |
| 19828 | /** |
| 19829 | * watchdog_proxy_new_for_bus_finish: |
| 19830 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). |
| 19831 | * @error: Return location for error or %NULL |
| 19832 | * |
| 19833 | * Finishes an operation started with watchdog_proxy_new_for_bus(). |
| 19834 | * |
| 19835 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 19836 | */ |
| 19837 | Watchdog * |
| 19838 | watchdog_proxy_new_for_bus_finish ( |
| 19839 | GAsyncResult *res, |
| 19840 | GError **error) |
| 19841 | { |
| 19842 | GObject *ret; |
| 19843 | GObject *source_object; |
| 19844 | source_object = g_async_result_get_source_object (res); |
| 19845 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19846 | g_object_unref (source_object); |
| 19847 | if (ret != NULL) |
| 19848 | return WATCHDOG (ret); |
| 19849 | else |
| 19850 | return NULL; |
| 19851 | } |
| 19852 | |
| 19853 | /** |
| 19854 | * watchdog_proxy_new_for_bus_sync: |
| 19855 | * @bus_type: A #GBusType. |
| 19856 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19857 | * @name: A bus name (well-known or unique). |
| 19858 | * @object_path: An object path. |
| 19859 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19860 | * @error: Return location for error or %NULL |
| 19861 | * |
| 19862 | * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 19863 | * |
| 19864 | * The calling thread is blocked until a reply is received. |
| 19865 | * |
| 19866 | * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 19867 | * |
| 19868 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 19869 | */ |
| 19870 | Watchdog * |
| 19871 | watchdog_proxy_new_for_bus_sync ( |
| 19872 | GBusType bus_type, |
| 19873 | GDBusProxyFlags flags, |
| 19874 | const gchar *name, |
| 19875 | const gchar *object_path, |
| 19876 | GCancellable *cancellable, |
| 19877 | GError **error) |
| 19878 | { |
| 19879 | GInitable *ret; |
| 19880 | 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); |
| 19881 | if (ret != NULL) |
| 19882 | return WATCHDOG (ret); |
| 19883 | else |
| 19884 | return NULL; |
| 19885 | } |
| 19886 | |
| 19887 | |
| 19888 | /* ------------------------------------------------------------------------ */ |
| 19889 | |
| 19890 | /** |
| 19891 | * WatchdogSkeleton: |
| 19892 | * |
| 19893 | * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 19894 | */ |
| 19895 | |
| 19896 | /** |
| 19897 | * WatchdogSkeletonClass: |
| 19898 | * @parent_class: The parent class. |
| 19899 | * |
| 19900 | * Class structure for #WatchdogSkeleton. |
| 19901 | */ |
| 19902 | |
| 19903 | struct _WatchdogSkeletonPrivate |
| 19904 | { |
| 19905 | GValue *properties; |
| 19906 | GList *changed_properties; |
| 19907 | GSource *changed_properties_idle_source; |
| 19908 | GMainContext *context; |
| 19909 | GMutex lock; |
| 19910 | }; |
| 19911 | |
| 19912 | static void |
| 19913 | _watchdog_skeleton_handle_method_call ( |
| 19914 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19915 | const gchar *sender G_GNUC_UNUSED, |
| 19916 | const gchar *object_path G_GNUC_UNUSED, |
| 19917 | const gchar *interface_name, |
| 19918 | const gchar *method_name, |
| 19919 | GVariant *parameters, |
| 19920 | GDBusMethodInvocation *invocation, |
| 19921 | gpointer user_data) |
| 19922 | { |
| 19923 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 19924 | _ExtendedGDBusMethodInfo *info; |
| 19925 | GVariantIter iter; |
| 19926 | GVariant *child; |
| 19927 | GValue *paramv; |
| 19928 | guint num_params; |
| 19929 | guint num_extra; |
| 19930 | guint n; |
| 19931 | guint signal_id; |
| 19932 | GValue return_value = G_VALUE_INIT; |
| 19933 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 19934 | g_assert (info != NULL); |
| 19935 | num_params = g_variant_n_children (parameters); |
| 19936 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 19937 | n = 0; |
| 19938 | g_value_init (¶mv[n], TYPE_WATCHDOG); |
| 19939 | g_value_set_object (¶mv[n++], skeleton); |
| 19940 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 19941 | g_value_set_object (¶mv[n++], invocation); |
| 19942 | if (info->pass_fdlist) |
| 19943 | { |
| 19944 | #ifdef G_OS_UNIX |
| 19945 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 19946 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 19947 | #else |
| 19948 | g_assert_not_reached (); |
| 19949 | #endif |
| 19950 | } |
| 19951 | g_variant_iter_init (&iter, parameters); |
| 19952 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19953 | { |
| 19954 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 19955 | if (arg_info->use_gvariant) |
| 19956 | { |
| 19957 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19958 | g_value_set_variant (¶mv[n], child); |
| 19959 | n++; |
| 19960 | } |
| 19961 | else |
| 19962 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19963 | g_variant_unref (child); |
| 19964 | } |
| 19965 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 19966 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 19967 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 19968 | if (!g_value_get_boolean (&return_value)) |
| 19969 | 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); |
| 19970 | g_value_unset (&return_value); |
| 19971 | for (n = 0; n < num_params + num_extra; n++) |
| 19972 | g_value_unset (¶mv[n]); |
| 19973 | g_free (paramv); |
| 19974 | } |
| 19975 | |
| 19976 | static GVariant * |
| 19977 | _watchdog_skeleton_handle_get_property ( |
| 19978 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19979 | const gchar *sender G_GNUC_UNUSED, |
| 19980 | const gchar *object_path G_GNUC_UNUSED, |
| 19981 | const gchar *interface_name G_GNUC_UNUSED, |
| 19982 | const gchar *property_name, |
| 19983 | GError **error, |
| 19984 | gpointer user_data) |
| 19985 | { |
| 19986 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 19987 | GValue value = G_VALUE_INIT; |
| 19988 | GParamSpec *pspec; |
| 19989 | _ExtendedGDBusPropertyInfo *info; |
| 19990 | GVariant *ret; |
| 19991 | ret = NULL; |
| 19992 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 19993 | g_assert (info != NULL); |
| 19994 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 19995 | if (pspec == NULL) |
| 19996 | { |
| 19997 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 19998 | } |
| 19999 | else |
| 20000 | { |
| 20001 | g_value_init (&value, pspec->value_type); |
| 20002 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 20003 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 20004 | g_value_unset (&value); |
| 20005 | } |
| 20006 | return ret; |
| 20007 | } |
| 20008 | |
| 20009 | static gboolean |
| 20010 | _watchdog_skeleton_handle_set_property ( |
| 20011 | GDBusConnection *connection G_GNUC_UNUSED, |
| 20012 | const gchar *sender G_GNUC_UNUSED, |
| 20013 | const gchar *object_path G_GNUC_UNUSED, |
| 20014 | const gchar *interface_name G_GNUC_UNUSED, |
| 20015 | const gchar *property_name, |
| 20016 | GVariant *variant, |
| 20017 | GError **error, |
| 20018 | gpointer user_data) |
| 20019 | { |
| 20020 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 20021 | GValue value = G_VALUE_INIT; |
| 20022 | GParamSpec *pspec; |
| 20023 | _ExtendedGDBusPropertyInfo *info; |
| 20024 | gboolean ret; |
| 20025 | ret = FALSE; |
| 20026 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 20027 | g_assert (info != NULL); |
| 20028 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 20029 | if (pspec == NULL) |
| 20030 | { |
| 20031 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 20032 | } |
| 20033 | else |
| 20034 | { |
| 20035 | if (info->use_gvariant) |
| 20036 | g_value_set_variant (&value, variant); |
| 20037 | else |
| 20038 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 20039 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 20040 | g_value_unset (&value); |
| 20041 | ret = TRUE; |
| 20042 | } |
| 20043 | return ret; |
| 20044 | } |
| 20045 | |
| 20046 | static const GDBusInterfaceVTable _watchdog_skeleton_vtable = |
| 20047 | { |
| 20048 | _watchdog_skeleton_handle_method_call, |
| 20049 | _watchdog_skeleton_handle_get_property, |
| 20050 | _watchdog_skeleton_handle_set_property, |
| 20051 | {NULL} |
| 20052 | }; |
| 20053 | |
| 20054 | static GDBusInterfaceInfo * |
| 20055 | watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20056 | { |
| 20057 | return watchdog_interface_info (); |
| 20058 | } |
| 20059 | |
| 20060 | static GDBusInterfaceVTable * |
| 20061 | watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20062 | { |
| 20063 | return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; |
| 20064 | } |
| 20065 | |
| 20066 | static GVariant * |
| 20067 | watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 20068 | { |
| 20069 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 20070 | |
| 20071 | GVariantBuilder builder; |
| 20072 | guint n; |
| 20073 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 20074 | if (_watchdog_interface_info.parent_struct.properties == NULL) |
| 20075 | goto out; |
| 20076 | for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) |
| 20077 | { |
| 20078 | GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; |
| 20079 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 20080 | { |
| 20081 | GVariant *value; |
| 20082 | 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); |
| 20083 | if (value != NULL) |
| 20084 | { |
| 20085 | g_variant_take_ref (value); |
| 20086 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 20087 | g_variant_unref (value); |
| 20088 | } |
| 20089 | } |
| 20090 | } |
| 20091 | out: |
| 20092 | return g_variant_builder_end (&builder); |
| 20093 | } |
| 20094 | |
| 20095 | static gboolean _watchdog_emit_changed (gpointer user_data); |
| 20096 | |
| 20097 | static void |
| 20098 | watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 20099 | { |
| 20100 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 20101 | gboolean emit_changed = FALSE; |
| 20102 | |
| 20103 | g_mutex_lock (&skeleton->priv->lock); |
| 20104 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 20105 | { |
| 20106 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 20107 | skeleton->priv->changed_properties_idle_source = NULL; |
| 20108 | emit_changed = TRUE; |
| 20109 | } |
| 20110 | g_mutex_unlock (&skeleton->priv->lock); |
| 20111 | |
| 20112 | if (emit_changed) |
| 20113 | _watchdog_emit_changed (skeleton); |
| 20114 | } |
| 20115 | |
| 20116 | static void |
| 20117 | _watchdog_on_signal_watchdog_error ( |
| 20118 | Watchdog *object) |
| 20119 | { |
| 20120 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20121 | |
| 20122 | GList *connections, *l; |
| 20123 | GVariant *signal_variant; |
| 20124 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20125 | |
| 20126 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 20127 | for (l = connections; l != NULL; l = l->next) |
| 20128 | { |
| 20129 | GDBusConnection *connection = l->data; |
| 20130 | g_dbus_connection_emit_signal (connection, |
| 20131 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", |
| 20132 | signal_variant, NULL); |
| 20133 | } |
| 20134 | g_variant_unref (signal_variant); |
| 20135 | g_list_free_full (connections, g_object_unref); |
| 20136 | } |
| 20137 | |
| 20138 | static void watchdog_skeleton_iface_init (WatchdogIface *iface); |
| 20139 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20140 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20141 | G_ADD_PRIVATE (WatchdogSkeleton) |
| 20142 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 20143 | |
| 20144 | #else |
| 20145 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20146 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 20147 | |
| 20148 | #endif |
| 20149 | static void |
| 20150 | watchdog_skeleton_finalize (GObject *object) |
| 20151 | { |
| 20152 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20153 | guint n; |
| 20154 | for (n = 0; n < 2; n++) |
| 20155 | g_value_unset (&skeleton->priv->properties[n]); |
| 20156 | g_free (skeleton->priv->properties); |
| 20157 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 20158 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 20159 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 20160 | g_main_context_unref (skeleton->priv->context); |
| 20161 | g_mutex_clear (&skeleton->priv->lock); |
| 20162 | G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); |
| 20163 | } |
| 20164 | |
| 20165 | static void |
| 20166 | watchdog_skeleton_get_property (GObject *object, |
| 20167 | guint prop_id, |
| 20168 | GValue *value, |
| 20169 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20170 | { |
| 20171 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20172 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 20173 | g_mutex_lock (&skeleton->priv->lock); |
| 20174 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 20175 | g_mutex_unlock (&skeleton->priv->lock); |
| 20176 | } |
| 20177 | |
| 20178 | static gboolean |
| 20179 | _watchdog_emit_changed (gpointer user_data) |
| 20180 | { |
| 20181 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 20182 | GList *l; |
| 20183 | GVariantBuilder builder; |
| 20184 | GVariantBuilder invalidated_builder; |
| 20185 | guint num_changes; |
| 20186 | |
| 20187 | g_mutex_lock (&skeleton->priv->lock); |
| 20188 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 20189 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 20190 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 20191 | { |
| 20192 | ChangedProperty *cp = l->data; |
| 20193 | GVariant *variant; |
| 20194 | const GValue *cur_value; |
| 20195 | |
| 20196 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 20197 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 20198 | { |
| 20199 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 20200 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 20201 | g_variant_unref (variant); |
| 20202 | num_changes++; |
| 20203 | } |
| 20204 | } |
| 20205 | if (num_changes > 0) |
| 20206 | { |
| 20207 | GList *connections, *ll; |
| 20208 | GVariant *signal_variant; |
| 20209 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", |
| 20210 | &builder, &invalidated_builder)); |
| 20211 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20212 | for (ll = connections; ll != NULL; ll = ll->next) |
| 20213 | { |
| 20214 | GDBusConnection *connection = ll->data; |
| 20215 | |
| 20216 | g_dbus_connection_emit_signal (connection, |
| 20217 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 20218 | "org.freedesktop.DBus.Properties", |
| 20219 | "PropertiesChanged", |
| 20220 | signal_variant, |
| 20221 | NULL); |
| 20222 | } |
| 20223 | g_variant_unref (signal_variant); |
| 20224 | g_list_free_full (connections, g_object_unref); |
| 20225 | } |
| 20226 | else |
| 20227 | { |
| 20228 | g_variant_builder_clear (&builder); |
| 20229 | g_variant_builder_clear (&invalidated_builder); |
| 20230 | } |
| 20231 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 20232 | skeleton->priv->changed_properties = NULL; |
| 20233 | skeleton->priv->changed_properties_idle_source = NULL; |
| 20234 | g_mutex_unlock (&skeleton->priv->lock); |
| 20235 | return FALSE; |
| 20236 | } |
| 20237 | |
| 20238 | static void |
| 20239 | _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 20240 | { |
| 20241 | ChangedProperty *cp; |
| 20242 | GList *l; |
| 20243 | cp = NULL; |
| 20244 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 20245 | { |
| 20246 | ChangedProperty *i_cp = l->data; |
| 20247 | if (i_cp->info == info) |
| 20248 | { |
| 20249 | cp = i_cp; |
| 20250 | break; |
| 20251 | } |
| 20252 | } |
| 20253 | if (cp == NULL) |
| 20254 | { |
| 20255 | cp = g_new0 (ChangedProperty, 1); |
| 20256 | cp->prop_id = prop_id; |
| 20257 | cp->info = info; |
| 20258 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 20259 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 20260 | g_value_copy (orig_value, &cp->orig_value); |
| 20261 | } |
| 20262 | } |
| 20263 | |
| 20264 | static void |
| 20265 | watchdog_skeleton_notify (GObject *object, |
| 20266 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20267 | { |
| 20268 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20269 | g_mutex_lock (&skeleton->priv->lock); |
| 20270 | if (skeleton->priv->changed_properties != NULL && |
| 20271 | skeleton->priv->changed_properties_idle_source == NULL) |
| 20272 | { |
| 20273 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 20274 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 20275 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 20276 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 20277 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 20278 | } |
| 20279 | g_mutex_unlock (&skeleton->priv->lock); |
| 20280 | } |
| 20281 | |
| 20282 | static void |
| 20283 | watchdog_skeleton_set_property (GObject *object, |
| 20284 | guint prop_id, |
| 20285 | const GValue *value, |
| 20286 | GParamSpec *pspec) |
| 20287 | { |
| 20288 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20289 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 20290 | g_mutex_lock (&skeleton->priv->lock); |
| 20291 | g_object_freeze_notify (object); |
| 20292 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 20293 | { |
| 20294 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 20295 | _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 20296 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 20297 | g_object_notify_by_pspec (object, pspec); |
| 20298 | } |
| 20299 | g_mutex_unlock (&skeleton->priv->lock); |
| 20300 | g_object_thaw_notify (object); |
| 20301 | } |
| 20302 | |
| 20303 | static void |
| 20304 | watchdog_skeleton_init (WatchdogSkeleton *skeleton) |
| 20305 | { |
| 20306 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20307 | skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); |
| 20308 | #else |
| 20309 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); |
| 20310 | #endif |
| 20311 | |
| 20312 | g_mutex_init (&skeleton->priv->lock); |
| 20313 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 20314 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 20315 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 20316 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 20317 | } |
| 20318 | |
| 20319 | static gint |
| 20320 | watchdog_skeleton_get_watchdog (Watchdog *object) |
| 20321 | { |
| 20322 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20323 | gint value; |
| 20324 | g_mutex_lock (&skeleton->priv->lock); |
| 20325 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 20326 | g_mutex_unlock (&skeleton->priv->lock); |
| 20327 | return value; |
| 20328 | } |
| 20329 | |
| 20330 | static gint |
| 20331 | watchdog_skeleton_get_poll_interval (Watchdog *object) |
| 20332 | { |
| 20333 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 20334 | gint value; |
| 20335 | g_mutex_lock (&skeleton->priv->lock); |
| 20336 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 20337 | g_mutex_unlock (&skeleton->priv->lock); |
| 20338 | return value; |
| 20339 | } |
| 20340 | |
| 20341 | static void |
| 20342 | watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) |
| 20343 | { |
| 20344 | GObjectClass *gobject_class; |
| 20345 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 20346 | |
| 20347 | gobject_class = G_OBJECT_CLASS (klass); |
| 20348 | gobject_class->finalize = watchdog_skeleton_finalize; |
| 20349 | gobject_class->get_property = watchdog_skeleton_get_property; |
| 20350 | gobject_class->set_property = watchdog_skeleton_set_property; |
| 20351 | gobject_class->notify = watchdog_skeleton_notify; |
| 20352 | |
| 20353 | |
| 20354 | watchdog_override_properties (gobject_class, 1); |
| 20355 | |
| 20356 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 20357 | skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; |
| 20358 | skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; |
| 20359 | skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; |
| 20360 | skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; |
| 20361 | |
| 20362 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20363 | g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); |
| 20364 | #endif |
| 20365 | } |
| 20366 | |
| 20367 | static void |
| 20368 | watchdog_skeleton_iface_init (WatchdogIface *iface) |
| 20369 | { |
| 20370 | iface->watchdog_error = _watchdog_on_signal_watchdog_error; |
| 20371 | iface->get_watchdog = watchdog_skeleton_get_watchdog; |
| 20372 | iface->get_poll_interval = watchdog_skeleton_get_poll_interval; |
| 20373 | } |
| 20374 | |
| 20375 | /** |
| 20376 | * watchdog_skeleton_new: |
| 20377 | * |
| 20378 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 20379 | * |
| 20380 | * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. |
| 20381 | */ |
| 20382 | Watchdog * |
| 20383 | watchdog_skeleton_new (void) |
| 20384 | { |
| 20385 | return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); |
| 20386 | } |
| 20387 | |
| 20388 | /* ------------------------------------------------------------------------ |
| 20389 | * Code for interface org.openbmc.EventLog |
| 20390 | * ------------------------------------------------------------------------ |
| 20391 | */ |
| 20392 | |
| 20393 | /** |
| 20394 | * SECTION:EventLog |
| 20395 | * @title: EventLog |
| 20396 | * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface |
| 20397 | * |
| 20398 | * 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. |
| 20399 | */ |
| 20400 | |
| 20401 | /* ---- Introspection data for org.openbmc.EventLog ---- */ |
| 20402 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 20403 | static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log = |
| 20404 | { |
| 20405 | { |
| 20406 | -1, |
| 20407 | (gchar *) "log", |
| 20408 | (gchar *) "a(s)", |
| 20409 | NULL |
| 20410 | }, |
| 20411 | FALSE |
| 20412 | }; |
| 20413 | |
| 20414 | static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] = |
| 20415 | { |
| 20416 | &_event_log_method_info_get_event_log_OUT_ARG_log, |
| 20417 | NULL |
| 20418 | }; |
| 20419 | |
| 20420 | static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log = |
| 20421 | { |
| 20422 | { |
| 20423 | -1, |
| 20424 | (gchar *) "getEventLog", |
| 20425 | NULL, |
| 20426 | (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers, |
| 20427 | NULL |
| 20428 | }, |
| 20429 | "handle-get-event-log", |
| 20430 | FALSE |
| 20431 | }; |
| 20432 | |
| 20433 | static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] = |
| 20434 | { |
| 20435 | &_event_log_method_info_get_event_log, |
| 20436 | NULL |
| 20437 | }; |
| 20438 | |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20439 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20440 | { |
| 20441 | { |
| 20442 | -1, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20443 | (gchar *) "priority", |
| 20444 | (gchar *) "i", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20445 | NULL |
| 20446 | }, |
| 20447 | FALSE |
| 20448 | }; |
| 20449 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20450 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message = |
| 20451 | { |
| 20452 | { |
| 20453 | -1, |
| 20454 | (gchar *) "message", |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 20455 | (gchar *) "s", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20456 | NULL |
| 20457 | }, |
| 20458 | FALSE |
| 20459 | }; |
| 20460 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20461 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc = |
| 20462 | { |
| 20463 | { |
| 20464 | -1, |
| 20465 | (gchar *) "rc", |
| 20466 | (gchar *) "i", |
| 20467 | NULL |
| 20468 | }, |
| 20469 | FALSE |
| 20470 | }; |
| 20471 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20472 | static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] = |
| 20473 | { |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20474 | &_event_log_signal_info_event_log_ARG_priority, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20475 | &_event_log_signal_info_event_log_ARG_message, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20476 | &_event_log_signal_info_event_log_ARG_rc, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20477 | NULL |
| 20478 | }; |
| 20479 | |
| 20480 | static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log = |
| 20481 | { |
| 20482 | { |
| 20483 | -1, |
| 20484 | (gchar *) "EventLog", |
| 20485 | (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers, |
| 20486 | NULL |
| 20487 | }, |
| 20488 | "event-log" |
| 20489 | }; |
| 20490 | |
| 20491 | static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] = |
| 20492 | { |
| 20493 | &_event_log_signal_info_event_log, |
| 20494 | NULL |
| 20495 | }; |
| 20496 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20497 | static const _ExtendedGDBusInterfaceInfo _event_log_interface_info = |
| 20498 | { |
| 20499 | { |
| 20500 | -1, |
| 20501 | (gchar *) "org.openbmc.EventLog", |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 20502 | (GDBusMethodInfo **) &_event_log_method_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20503 | (GDBusSignalInfo **) &_event_log_signal_info_pointers, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 20504 | NULL, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20505 | NULL |
| 20506 | }, |
| 20507 | "event-log", |
| 20508 | }; |
| 20509 | |
| 20510 | |
| 20511 | /** |
| 20512 | * event_log_interface_info: |
| 20513 | * |
| 20514 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface. |
| 20515 | * |
| 20516 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 20517 | */ |
| 20518 | GDBusInterfaceInfo * |
| 20519 | event_log_interface_info (void) |
| 20520 | { |
| 20521 | return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct; |
| 20522 | } |
| 20523 | |
| 20524 | /** |
| 20525 | * event_log_override_properties: |
| 20526 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 20527 | * @property_id_begin: The property id to assign to the first overridden property. |
| 20528 | * |
| 20529 | * Overrides all #GObject properties in the #EventLog interface for a concrete class. |
| 20530 | * The properties are overridden in the order they are defined. |
| 20531 | * |
| 20532 | * Returns: The last property id. |
| 20533 | */ |
| 20534 | guint |
| 20535 | event_log_override_properties (GObjectClass *klass, guint property_id_begin) |
| 20536 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20537 | return property_id_begin - 1; |
| 20538 | } |
| 20539 | |
| 20540 | |
| 20541 | |
| 20542 | /** |
| 20543 | * EventLog: |
| 20544 | * |
| 20545 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 20546 | */ |
| 20547 | |
| 20548 | /** |
| 20549 | * EventLogIface: |
| 20550 | * @parent_iface: The parent interface. |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 20551 | * @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] | 20552 | * @event_log: Handler for the #EventLog::event-log signal. |
| 20553 | * |
| 20554 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 20555 | */ |
| 20556 | |
| 20557 | typedef EventLogIface EventLogInterface; |
| 20558 | G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT); |
| 20559 | |
| 20560 | static void |
| 20561 | event_log_default_init (EventLogIface *iface) |
| 20562 | { |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 20563 | /* GObject signals for incoming D-Bus method calls: */ |
| 20564 | /** |
| 20565 | * EventLog::handle-get-event-log: |
| 20566 | * @object: A #EventLog. |
| 20567 | * @invocation: A #GDBusMethodInvocation. |
| 20568 | * |
| 20569 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. |
| 20570 | * |
| 20571 | * 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. |
| 20572 | * |
| 20573 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20574 | */ |
| 20575 | g_signal_new ("handle-get-event-log", |
| 20576 | G_TYPE_FROM_INTERFACE (iface), |
| 20577 | G_SIGNAL_RUN_LAST, |
| 20578 | G_STRUCT_OFFSET (EventLogIface, handle_get_event_log), |
| 20579 | g_signal_accumulator_true_handled, |
| 20580 | NULL, |
| 20581 | g_cclosure_marshal_generic, |
| 20582 | G_TYPE_BOOLEAN, |
| 20583 | 1, |
| 20584 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20585 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20586 | /* GObject signals for received D-Bus signals: */ |
| 20587 | /** |
| 20588 | * EventLog::event-log: |
| 20589 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20590 | * @arg_priority: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20591 | * @arg_message: Argument. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20592 | * @arg_rc: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20593 | * |
| 20594 | * 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. |
| 20595 | * |
| 20596 | * 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. |
| 20597 | */ |
| 20598 | g_signal_new ("event-log", |
| 20599 | G_TYPE_FROM_INTERFACE (iface), |
| 20600 | G_SIGNAL_RUN_LAST, |
| 20601 | G_STRUCT_OFFSET (EventLogIface, event_log), |
| 20602 | NULL, |
| 20603 | NULL, |
| 20604 | g_cclosure_marshal_generic, |
| 20605 | G_TYPE_NONE, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20606 | 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20607 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20608 | } |
| 20609 | |
| 20610 | /** |
| 20611 | * event_log_emit_event_log: |
| 20612 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20613 | * @arg_priority: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20614 | * @arg_message: Argument to pass with the signal. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20615 | * @arg_rc: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20616 | * |
| 20617 | * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal. |
| 20618 | */ |
| 20619 | void |
| 20620 | event_log_emit_event_log ( |
| 20621 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20622 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20623 | const gchar *arg_message, |
| 20624 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20625 | { |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20626 | 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] | 20627 | } |
| 20628 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 20629 | /** |
| 20630 | * event_log_call_get_event_log: |
| 20631 | * @proxy: A #EventLogProxy. |
| 20632 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20633 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 20634 | * @user_data: User data to pass to @callback. |
| 20635 | * |
| 20636 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. |
| 20637 | * 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. |
| 20638 | * You can then call event_log_call_get_event_log_finish() to get the result of the operation. |
| 20639 | * |
| 20640 | * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method. |
| 20641 | */ |
| 20642 | void |
| 20643 | event_log_call_get_event_log ( |
| 20644 | EventLog *proxy, |
| 20645 | GCancellable *cancellable, |
| 20646 | GAsyncReadyCallback callback, |
| 20647 | gpointer user_data) |
| 20648 | { |
| 20649 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 20650 | "getEventLog", |
| 20651 | g_variant_new ("()"), |
| 20652 | G_DBUS_CALL_FLAGS_NONE, |
| 20653 | -1, |
| 20654 | cancellable, |
| 20655 | callback, |
| 20656 | user_data); |
| 20657 | } |
| 20658 | |
| 20659 | /** |
| 20660 | * event_log_call_get_event_log_finish: |
| 20661 | * @proxy: A #EventLogProxy. |
| 20662 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 20663 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log(). |
| 20664 | * @error: Return location for error or %NULL. |
| 20665 | * |
| 20666 | * Finishes an operation started with event_log_call_get_event_log(). |
| 20667 | * |
| 20668 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20669 | */ |
| 20670 | gboolean |
| 20671 | event_log_call_get_event_log_finish ( |
| 20672 | EventLog *proxy, |
| 20673 | GVariant **out_log, |
| 20674 | GAsyncResult *res, |
| 20675 | GError **error) |
| 20676 | { |
| 20677 | GVariant *_ret; |
| 20678 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 20679 | if (_ret == NULL) |
| 20680 | goto _out; |
| 20681 | g_variant_get (_ret, |
| 20682 | "(@a(s))", |
| 20683 | out_log); |
| 20684 | g_variant_unref (_ret); |
| 20685 | _out: |
| 20686 | return _ret != NULL; |
| 20687 | } |
| 20688 | |
| 20689 | /** |
| 20690 | * event_log_call_get_event_log_sync: |
| 20691 | * @proxy: A #EventLogProxy. |
| 20692 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 20693 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20694 | * @error: Return location for error or %NULL. |
| 20695 | * |
| 20696 | * 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. |
| 20697 | * |
| 20698 | * See event_log_call_get_event_log() for the asynchronous version of this method. |
| 20699 | * |
| 20700 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 20701 | */ |
| 20702 | gboolean |
| 20703 | event_log_call_get_event_log_sync ( |
| 20704 | EventLog *proxy, |
| 20705 | GVariant **out_log, |
| 20706 | GCancellable *cancellable, |
| 20707 | GError **error) |
| 20708 | { |
| 20709 | GVariant *_ret; |
| 20710 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 20711 | "getEventLog", |
| 20712 | g_variant_new ("()"), |
| 20713 | G_DBUS_CALL_FLAGS_NONE, |
| 20714 | -1, |
| 20715 | cancellable, |
| 20716 | error); |
| 20717 | if (_ret == NULL) |
| 20718 | goto _out; |
| 20719 | g_variant_get (_ret, |
| 20720 | "(@a(s))", |
| 20721 | out_log); |
| 20722 | g_variant_unref (_ret); |
| 20723 | _out: |
| 20724 | return _ret != NULL; |
| 20725 | } |
| 20726 | |
| 20727 | /** |
| 20728 | * event_log_complete_get_event_log: |
| 20729 | * @object: A #EventLog. |
| 20730 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 20731 | * @log: Parameter to return. |
| 20732 | * |
| 20733 | * 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. |
| 20734 | * |
| 20735 | * This method will free @invocation, you cannot use it afterwards. |
| 20736 | */ |
| 20737 | void |
| 20738 | event_log_complete_get_event_log ( |
| 20739 | EventLog *object, |
| 20740 | GDBusMethodInvocation *invocation, |
| 20741 | GVariant *log) |
| 20742 | { |
| 20743 | g_dbus_method_invocation_return_value (invocation, |
| 20744 | g_variant_new ("(@a(s))", |
| 20745 | log)); |
| 20746 | } |
| 20747 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20748 | /* ------------------------------------------------------------------------ */ |
| 20749 | |
| 20750 | /** |
| 20751 | * EventLogProxy: |
| 20752 | * |
| 20753 | * The #EventLogProxy structure contains only private data and should only be accessed using the provided API. |
| 20754 | */ |
| 20755 | |
| 20756 | /** |
| 20757 | * EventLogProxyClass: |
| 20758 | * @parent_class: The parent class. |
| 20759 | * |
| 20760 | * Class structure for #EventLogProxy. |
| 20761 | */ |
| 20762 | |
| 20763 | struct _EventLogProxyPrivate |
| 20764 | { |
| 20765 | GData *qdata; |
| 20766 | }; |
| 20767 | |
| 20768 | static void event_log_proxy_iface_init (EventLogIface *iface); |
| 20769 | |
| 20770 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20771 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 20772 | G_ADD_PRIVATE (EventLogProxy) |
| 20773 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 20774 | |
| 20775 | #else |
| 20776 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 20777 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 20778 | |
| 20779 | #endif |
| 20780 | static void |
| 20781 | event_log_proxy_finalize (GObject *object) |
| 20782 | { |
| 20783 | EventLogProxy *proxy = EVENT_LOG_PROXY (object); |
| 20784 | g_datalist_clear (&proxy->priv->qdata); |
| 20785 | G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object); |
| 20786 | } |
| 20787 | |
| 20788 | static void |
| 20789 | event_log_proxy_get_property (GObject *object, |
| 20790 | guint prop_id, |
| 20791 | GValue *value, |
| 20792 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20793 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20794 | } |
| 20795 | |
| 20796 | static void |
| 20797 | event_log_proxy_set_property (GObject *object, |
| 20798 | guint prop_id, |
| 20799 | const GValue *value, |
| 20800 | GParamSpec *pspec G_GNUC_UNUSED) |
| 20801 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20802 | } |
| 20803 | |
| 20804 | static void |
| 20805 | event_log_proxy_g_signal (GDBusProxy *proxy, |
| 20806 | const gchar *sender_name G_GNUC_UNUSED, |
| 20807 | const gchar *signal_name, |
| 20808 | GVariant *parameters) |
| 20809 | { |
| 20810 | _ExtendedGDBusSignalInfo *info; |
| 20811 | GVariantIter iter; |
| 20812 | GVariant *child; |
| 20813 | GValue *paramv; |
| 20814 | guint num_params; |
| 20815 | guint n; |
| 20816 | guint signal_id; |
| 20817 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name); |
| 20818 | if (info == NULL) |
| 20819 | return; |
| 20820 | num_params = g_variant_n_children (parameters); |
| 20821 | paramv = g_new0 (GValue, num_params + 1); |
| 20822 | g_value_init (¶mv[0], TYPE_EVENT_LOG); |
| 20823 | g_value_set_object (¶mv[0], proxy); |
| 20824 | g_variant_iter_init (&iter, parameters); |
| 20825 | n = 1; |
| 20826 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 20827 | { |
| 20828 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 20829 | if (arg_info->use_gvariant) |
| 20830 | { |
| 20831 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 20832 | g_value_set_variant (¶mv[n], child); |
| 20833 | n++; |
| 20834 | } |
| 20835 | else |
| 20836 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 20837 | g_variant_unref (child); |
| 20838 | } |
| 20839 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 20840 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 20841 | for (n = 0; n < num_params + 1; n++) |
| 20842 | g_value_unset (¶mv[n]); |
| 20843 | g_free (paramv); |
| 20844 | } |
| 20845 | |
| 20846 | static void |
| 20847 | event_log_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 20848 | GVariant *changed_properties, |
| 20849 | const gchar *const *invalidated_properties) |
| 20850 | { |
| 20851 | EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy); |
| 20852 | guint n; |
| 20853 | const gchar *key; |
| 20854 | GVariantIter *iter; |
| 20855 | _ExtendedGDBusPropertyInfo *info; |
| 20856 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 20857 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 20858 | { |
| 20859 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key); |
| 20860 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 20861 | if (info != NULL) |
| 20862 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 20863 | } |
| 20864 | g_variant_iter_free (iter); |
| 20865 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 20866 | { |
| 20867 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]); |
| 20868 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 20869 | if (info != NULL) |
| 20870 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 20871 | } |
| 20872 | } |
| 20873 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20874 | static void |
| 20875 | event_log_proxy_init (EventLogProxy *proxy) |
| 20876 | { |
| 20877 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20878 | proxy->priv = event_log_proxy_get_instance_private (proxy); |
| 20879 | #else |
| 20880 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate); |
| 20881 | #endif |
| 20882 | |
| 20883 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ()); |
| 20884 | } |
| 20885 | |
| 20886 | static void |
| 20887 | event_log_proxy_class_init (EventLogProxyClass *klass) |
| 20888 | { |
| 20889 | GObjectClass *gobject_class; |
| 20890 | GDBusProxyClass *proxy_class; |
| 20891 | |
| 20892 | gobject_class = G_OBJECT_CLASS (klass); |
| 20893 | gobject_class->finalize = event_log_proxy_finalize; |
| 20894 | gobject_class->get_property = event_log_proxy_get_property; |
| 20895 | gobject_class->set_property = event_log_proxy_set_property; |
| 20896 | |
| 20897 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 20898 | proxy_class->g_signal = event_log_proxy_g_signal; |
| 20899 | proxy_class->g_properties_changed = event_log_proxy_g_properties_changed; |
| 20900 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20901 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20902 | g_type_class_add_private (klass, sizeof (EventLogProxyPrivate)); |
| 20903 | #endif |
| 20904 | } |
| 20905 | |
| 20906 | static void |
| 20907 | event_log_proxy_iface_init (EventLogIface *iface) |
| 20908 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20909 | } |
| 20910 | |
| 20911 | /** |
| 20912 | * event_log_proxy_new: |
| 20913 | * @connection: A #GDBusConnection. |
| 20914 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20915 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20916 | * @object_path: An object path. |
| 20917 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20918 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 20919 | * @user_data: User data to pass to @callback. |
| 20920 | * |
| 20921 | * 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. |
| 20922 | * |
| 20923 | * 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. |
| 20924 | * You can then call event_log_proxy_new_finish() to get the result of the operation. |
| 20925 | * |
| 20926 | * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 20927 | */ |
| 20928 | void |
| 20929 | event_log_proxy_new ( |
| 20930 | GDBusConnection *connection, |
| 20931 | GDBusProxyFlags flags, |
| 20932 | const gchar *name, |
| 20933 | const gchar *object_path, |
| 20934 | GCancellable *cancellable, |
| 20935 | GAsyncReadyCallback callback, |
| 20936 | gpointer user_data) |
| 20937 | { |
| 20938 | 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); |
| 20939 | } |
| 20940 | |
| 20941 | /** |
| 20942 | * event_log_proxy_new_finish: |
| 20943 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new(). |
| 20944 | * @error: Return location for error or %NULL |
| 20945 | * |
| 20946 | * Finishes an operation started with event_log_proxy_new(). |
| 20947 | * |
| 20948 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 20949 | */ |
| 20950 | EventLog * |
| 20951 | event_log_proxy_new_finish ( |
| 20952 | GAsyncResult *res, |
| 20953 | GError **error) |
| 20954 | { |
| 20955 | GObject *ret; |
| 20956 | GObject *source_object; |
| 20957 | source_object = g_async_result_get_source_object (res); |
| 20958 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 20959 | g_object_unref (source_object); |
| 20960 | if (ret != NULL) |
| 20961 | return EVENT_LOG (ret); |
| 20962 | else |
| 20963 | return NULL; |
| 20964 | } |
| 20965 | |
| 20966 | /** |
| 20967 | * event_log_proxy_new_sync: |
| 20968 | * @connection: A #GDBusConnection. |
| 20969 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 20970 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 20971 | * @object_path: An object path. |
| 20972 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 20973 | * @error: Return location for error or %NULL |
| 20974 | * |
| 20975 | * 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. |
| 20976 | * |
| 20977 | * The calling thread is blocked until a reply is received. |
| 20978 | * |
| 20979 | * See event_log_proxy_new() for the asynchronous version of this constructor. |
| 20980 | * |
| 20981 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 20982 | */ |
| 20983 | EventLog * |
| 20984 | event_log_proxy_new_sync ( |
| 20985 | GDBusConnection *connection, |
| 20986 | GDBusProxyFlags flags, |
| 20987 | const gchar *name, |
| 20988 | const gchar *object_path, |
| 20989 | GCancellable *cancellable, |
| 20990 | GError **error) |
| 20991 | { |
| 20992 | GInitable *ret; |
| 20993 | 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); |
| 20994 | if (ret != NULL) |
| 20995 | return EVENT_LOG (ret); |
| 20996 | else |
| 20997 | return NULL; |
| 20998 | } |
| 20999 | |
| 21000 | |
| 21001 | /** |
| 21002 | * event_log_proxy_new_for_bus: |
| 21003 | * @bus_type: A #GBusType. |
| 21004 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21005 | * @name: A bus name (well-known or unique). |
| 21006 | * @object_path: An object path. |
| 21007 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21008 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 21009 | * @user_data: User data to pass to @callback. |
| 21010 | * |
| 21011 | * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 21012 | * |
| 21013 | * 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. |
| 21014 | * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation. |
| 21015 | * |
| 21016 | * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 21017 | */ |
| 21018 | void |
| 21019 | event_log_proxy_new_for_bus ( |
| 21020 | GBusType bus_type, |
| 21021 | GDBusProxyFlags flags, |
| 21022 | const gchar *name, |
| 21023 | const gchar *object_path, |
| 21024 | GCancellable *cancellable, |
| 21025 | GAsyncReadyCallback callback, |
| 21026 | gpointer user_data) |
| 21027 | { |
| 21028 | 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); |
| 21029 | } |
| 21030 | |
| 21031 | /** |
| 21032 | * event_log_proxy_new_for_bus_finish: |
| 21033 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus(). |
| 21034 | * @error: Return location for error or %NULL |
| 21035 | * |
| 21036 | * Finishes an operation started with event_log_proxy_new_for_bus(). |
| 21037 | * |
| 21038 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 21039 | */ |
| 21040 | EventLog * |
| 21041 | event_log_proxy_new_for_bus_finish ( |
| 21042 | GAsyncResult *res, |
| 21043 | GError **error) |
| 21044 | { |
| 21045 | GObject *ret; |
| 21046 | GObject *source_object; |
| 21047 | source_object = g_async_result_get_source_object (res); |
| 21048 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 21049 | g_object_unref (source_object); |
| 21050 | if (ret != NULL) |
| 21051 | return EVENT_LOG (ret); |
| 21052 | else |
| 21053 | return NULL; |
| 21054 | } |
| 21055 | |
| 21056 | /** |
| 21057 | * event_log_proxy_new_for_bus_sync: |
| 21058 | * @bus_type: A #GBusType. |
| 21059 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21060 | * @name: A bus name (well-known or unique). |
| 21061 | * @object_path: An object path. |
| 21062 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21063 | * @error: Return location for error or %NULL |
| 21064 | * |
| 21065 | * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 21066 | * |
| 21067 | * The calling thread is blocked until a reply is received. |
| 21068 | * |
| 21069 | * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 21070 | * |
| 21071 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 21072 | */ |
| 21073 | EventLog * |
| 21074 | event_log_proxy_new_for_bus_sync ( |
| 21075 | GBusType bus_type, |
| 21076 | GDBusProxyFlags flags, |
| 21077 | const gchar *name, |
| 21078 | const gchar *object_path, |
| 21079 | GCancellable *cancellable, |
| 21080 | GError **error) |
| 21081 | { |
| 21082 | GInitable *ret; |
| 21083 | 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); |
| 21084 | if (ret != NULL) |
| 21085 | return EVENT_LOG (ret); |
| 21086 | else |
| 21087 | return NULL; |
| 21088 | } |
| 21089 | |
| 21090 | |
| 21091 | /* ------------------------------------------------------------------------ */ |
| 21092 | |
| 21093 | /** |
| 21094 | * EventLogSkeleton: |
| 21095 | * |
| 21096 | * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 21097 | */ |
| 21098 | |
| 21099 | /** |
| 21100 | * EventLogSkeletonClass: |
| 21101 | * @parent_class: The parent class. |
| 21102 | * |
| 21103 | * Class structure for #EventLogSkeleton. |
| 21104 | */ |
| 21105 | |
| 21106 | struct _EventLogSkeletonPrivate |
| 21107 | { |
| 21108 | GValue *properties; |
| 21109 | GList *changed_properties; |
| 21110 | GSource *changed_properties_idle_source; |
| 21111 | GMainContext *context; |
| 21112 | GMutex lock; |
| 21113 | }; |
| 21114 | |
| 21115 | static void |
| 21116 | _event_log_skeleton_handle_method_call ( |
| 21117 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21118 | const gchar *sender G_GNUC_UNUSED, |
| 21119 | const gchar *object_path G_GNUC_UNUSED, |
| 21120 | const gchar *interface_name, |
| 21121 | const gchar *method_name, |
| 21122 | GVariant *parameters, |
| 21123 | GDBusMethodInvocation *invocation, |
| 21124 | gpointer user_data) |
| 21125 | { |
| 21126 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 21127 | _ExtendedGDBusMethodInfo *info; |
| 21128 | GVariantIter iter; |
| 21129 | GVariant *child; |
| 21130 | GValue *paramv; |
| 21131 | guint num_params; |
| 21132 | guint num_extra; |
| 21133 | guint n; |
| 21134 | guint signal_id; |
| 21135 | GValue return_value = G_VALUE_INIT; |
| 21136 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 21137 | g_assert (info != NULL); |
| 21138 | num_params = g_variant_n_children (parameters); |
| 21139 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 21140 | n = 0; |
| 21141 | g_value_init (¶mv[n], TYPE_EVENT_LOG); |
| 21142 | g_value_set_object (¶mv[n++], skeleton); |
| 21143 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 21144 | g_value_set_object (¶mv[n++], invocation); |
| 21145 | if (info->pass_fdlist) |
| 21146 | { |
| 21147 | #ifdef G_OS_UNIX |
| 21148 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 21149 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 21150 | #else |
| 21151 | g_assert_not_reached (); |
| 21152 | #endif |
| 21153 | } |
| 21154 | g_variant_iter_init (&iter, parameters); |
| 21155 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 21156 | { |
| 21157 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 21158 | if (arg_info->use_gvariant) |
| 21159 | { |
| 21160 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 21161 | g_value_set_variant (¶mv[n], child); |
| 21162 | n++; |
| 21163 | } |
| 21164 | else |
| 21165 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 21166 | g_variant_unref (child); |
| 21167 | } |
| 21168 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 21169 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 21170 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 21171 | if (!g_value_get_boolean (&return_value)) |
| 21172 | 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); |
| 21173 | g_value_unset (&return_value); |
| 21174 | for (n = 0; n < num_params + num_extra; n++) |
| 21175 | g_value_unset (¶mv[n]); |
| 21176 | g_free (paramv); |
| 21177 | } |
| 21178 | |
| 21179 | static GVariant * |
| 21180 | _event_log_skeleton_handle_get_property ( |
| 21181 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21182 | const gchar *sender G_GNUC_UNUSED, |
| 21183 | const gchar *object_path G_GNUC_UNUSED, |
| 21184 | const gchar *interface_name G_GNUC_UNUSED, |
| 21185 | const gchar *property_name, |
| 21186 | GError **error, |
| 21187 | gpointer user_data) |
| 21188 | { |
| 21189 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 21190 | GValue value = G_VALUE_INIT; |
| 21191 | GParamSpec *pspec; |
| 21192 | _ExtendedGDBusPropertyInfo *info; |
| 21193 | GVariant *ret; |
| 21194 | ret = NULL; |
| 21195 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 21196 | g_assert (info != NULL); |
| 21197 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 21198 | if (pspec == NULL) |
| 21199 | { |
| 21200 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 21201 | } |
| 21202 | else |
| 21203 | { |
| 21204 | g_value_init (&value, pspec->value_type); |
| 21205 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 21206 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 21207 | g_value_unset (&value); |
| 21208 | } |
| 21209 | return ret; |
| 21210 | } |
| 21211 | |
| 21212 | static gboolean |
| 21213 | _event_log_skeleton_handle_set_property ( |
| 21214 | GDBusConnection *connection G_GNUC_UNUSED, |
| 21215 | const gchar *sender G_GNUC_UNUSED, |
| 21216 | const gchar *object_path G_GNUC_UNUSED, |
| 21217 | const gchar *interface_name G_GNUC_UNUSED, |
| 21218 | const gchar *property_name, |
| 21219 | GVariant *variant, |
| 21220 | GError **error, |
| 21221 | gpointer user_data) |
| 21222 | { |
| 21223 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 21224 | GValue value = G_VALUE_INIT; |
| 21225 | GParamSpec *pspec; |
| 21226 | _ExtendedGDBusPropertyInfo *info; |
| 21227 | gboolean ret; |
| 21228 | ret = FALSE; |
| 21229 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 21230 | g_assert (info != NULL); |
| 21231 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 21232 | if (pspec == NULL) |
| 21233 | { |
| 21234 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 21235 | } |
| 21236 | else |
| 21237 | { |
| 21238 | if (info->use_gvariant) |
| 21239 | g_value_set_variant (&value, variant); |
| 21240 | else |
| 21241 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 21242 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 21243 | g_value_unset (&value); |
| 21244 | ret = TRUE; |
| 21245 | } |
| 21246 | return ret; |
| 21247 | } |
| 21248 | |
| 21249 | static const GDBusInterfaceVTable _event_log_skeleton_vtable = |
| 21250 | { |
| 21251 | _event_log_skeleton_handle_method_call, |
| 21252 | _event_log_skeleton_handle_get_property, |
| 21253 | _event_log_skeleton_handle_set_property, |
| 21254 | {NULL} |
| 21255 | }; |
| 21256 | |
| 21257 | static GDBusInterfaceInfo * |
| 21258 | event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 21259 | { |
| 21260 | return event_log_interface_info (); |
| 21261 | } |
| 21262 | |
| 21263 | static GDBusInterfaceVTable * |
| 21264 | event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 21265 | { |
| 21266 | return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable; |
| 21267 | } |
| 21268 | |
| 21269 | static GVariant * |
| 21270 | event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 21271 | { |
| 21272 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton); |
| 21273 | |
| 21274 | GVariantBuilder builder; |
| 21275 | guint n; |
| 21276 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 21277 | if (_event_log_interface_info.parent_struct.properties == NULL) |
| 21278 | goto out; |
| 21279 | for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++) |
| 21280 | { |
| 21281 | GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n]; |
| 21282 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 21283 | { |
| 21284 | GVariant *value; |
| 21285 | 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); |
| 21286 | if (value != NULL) |
| 21287 | { |
| 21288 | g_variant_take_ref (value); |
| 21289 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 21290 | g_variant_unref (value); |
| 21291 | } |
| 21292 | } |
| 21293 | } |
| 21294 | out: |
| 21295 | return g_variant_builder_end (&builder); |
| 21296 | } |
| 21297 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21298 | static void |
| 21299 | event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 21300 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21301 | } |
| 21302 | |
| 21303 | static void |
| 21304 | _event_log_on_signal_event_log ( |
| 21305 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 21306 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 21307 | const gchar *arg_message, |
| 21308 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21309 | { |
| 21310 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
| 21311 | |
| 21312 | GList *connections, *l; |
| 21313 | GVariant *signal_variant; |
| 21314 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 21315 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 21316 | signal_variant = g_variant_ref_sink (g_variant_new ("(isi)", |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 21317 | arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 21318 | arg_message, |
| 21319 | arg_rc)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21320 | for (l = connections; l != NULL; l = l->next) |
| 21321 | { |
| 21322 | GDBusConnection *connection = l->data; |
| 21323 | g_dbus_connection_emit_signal (connection, |
| 21324 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog", |
| 21325 | signal_variant, NULL); |
| 21326 | } |
| 21327 | g_variant_unref (signal_variant); |
| 21328 | g_list_free_full (connections, g_object_unref); |
| 21329 | } |
| 21330 | |
| 21331 | static void event_log_skeleton_iface_init (EventLogIface *iface); |
| 21332 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21333 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 21334 | G_ADD_PRIVATE (EventLogSkeleton) |
| 21335 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 21336 | |
| 21337 | #else |
| 21338 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 21339 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 21340 | |
| 21341 | #endif |
| 21342 | static void |
| 21343 | event_log_skeleton_finalize (GObject *object) |
| 21344 | { |
| 21345 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21346 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 21347 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 21348 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 21349 | g_main_context_unref (skeleton->priv->context); |
| 21350 | g_mutex_clear (&skeleton->priv->lock); |
| 21351 | G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object); |
| 21352 | } |
| 21353 | |
| 21354 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21355 | event_log_skeleton_init (EventLogSkeleton *skeleton) |
| 21356 | { |
| 21357 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21358 | skeleton->priv = event_log_skeleton_get_instance_private (skeleton); |
| 21359 | #else |
| 21360 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate); |
| 21361 | #endif |
| 21362 | |
| 21363 | g_mutex_init (&skeleton->priv->lock); |
| 21364 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21365 | } |
| 21366 | |
| 21367 | static void |
| 21368 | event_log_skeleton_class_init (EventLogSkeletonClass *klass) |
| 21369 | { |
| 21370 | GObjectClass *gobject_class; |
| 21371 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 21372 | |
| 21373 | gobject_class = G_OBJECT_CLASS (klass); |
| 21374 | gobject_class->finalize = event_log_skeleton_finalize; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21375 | |
| 21376 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 21377 | skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info; |
| 21378 | skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties; |
| 21379 | skeleton_class->flush = event_log_skeleton_dbus_interface_flush; |
| 21380 | skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable; |
| 21381 | |
| 21382 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 21383 | g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate)); |
| 21384 | #endif |
| 21385 | } |
| 21386 | |
| 21387 | static void |
| 21388 | event_log_skeleton_iface_init (EventLogIface *iface) |
| 21389 | { |
| 21390 | iface->event_log = _event_log_on_signal_event_log; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21391 | } |
| 21392 | |
| 21393 | /** |
| 21394 | * event_log_skeleton_new: |
| 21395 | * |
| 21396 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 21397 | * |
| 21398 | * Returns: (transfer full) (type EventLogSkeleton): The skeleton object. |
| 21399 | */ |
| 21400 | EventLog * |
| 21401 | event_log_skeleton_new (void) |
| 21402 | { |
| 21403 | return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL)); |
| 21404 | } |
| 21405 | |
| 21406 | /* ------------------------------------------------------------------------ |
| 21407 | * Code for interface org.openbmc.Flash |
| 21408 | * ------------------------------------------------------------------------ |
| 21409 | */ |
| 21410 | |
| 21411 | /** |
| 21412 | * SECTION:Flash |
| 21413 | * @title: Flash |
| 21414 | * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface |
| 21415 | * |
| 21416 | * 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. |
| 21417 | */ |
| 21418 | |
| 21419 | /* ---- Introspection data for org.openbmc.Flash ---- */ |
| 21420 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21421 | static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21422 | { |
| 21423 | { |
| 21424 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21425 | (gchar *) "filename", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21426 | (gchar *) "s", |
| 21427 | NULL |
| 21428 | }, |
| 21429 | FALSE |
| 21430 | }; |
| 21431 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21432 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21433 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21434 | &_flash_method_info_update_IN_ARG_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21435 | NULL |
| 21436 | }; |
| 21437 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21438 | static const _ExtendedGDBusMethodInfo _flash_method_info_update = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21439 | { |
| 21440 | { |
| 21441 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21442 | (gchar *) "update", |
| 21443 | (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21444 | NULL, |
| 21445 | NULL |
| 21446 | }, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21447 | "handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21448 | FALSE |
| 21449 | }; |
| 21450 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21451 | static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message = |
| 21452 | { |
| 21453 | { |
| 21454 | -1, |
| 21455 | (gchar *) "message", |
| 21456 | (gchar *) "s", |
| 21457 | NULL |
| 21458 | }, |
| 21459 | FALSE |
| 21460 | }; |
| 21461 | |
| 21462 | static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] = |
| 21463 | { |
| 21464 | &_flash_method_info_error_IN_ARG_message, |
| 21465 | NULL |
| 21466 | }; |
| 21467 | |
| 21468 | static const _ExtendedGDBusMethodInfo _flash_method_info_error = |
| 21469 | { |
| 21470 | { |
| 21471 | -1, |
| 21472 | (gchar *) "error", |
| 21473 | (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers, |
| 21474 | NULL, |
| 21475 | NULL |
| 21476 | }, |
| 21477 | "handle-error", |
| 21478 | FALSE |
| 21479 | }; |
| 21480 | |
| 21481 | static const _ExtendedGDBusMethodInfo _flash_method_info_done = |
| 21482 | { |
| 21483 | { |
| 21484 | -1, |
| 21485 | (gchar *) "done", |
| 21486 | NULL, |
| 21487 | NULL, |
| 21488 | NULL |
| 21489 | }, |
| 21490 | "handle-done", |
| 21491 | FALSE |
| 21492 | }; |
| 21493 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21494 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url = |
| 21495 | { |
| 21496 | { |
| 21497 | -1, |
| 21498 | (gchar *) "url", |
| 21499 | (gchar *) "s", |
| 21500 | NULL |
| 21501 | }, |
| 21502 | FALSE |
| 21503 | }; |
| 21504 | |
| 21505 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename = |
| 21506 | { |
| 21507 | { |
| 21508 | -1, |
| 21509 | (gchar *) "filename", |
| 21510 | (gchar *) "s", |
| 21511 | NULL |
| 21512 | }, |
| 21513 | FALSE |
| 21514 | }; |
| 21515 | |
| 21516 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] = |
| 21517 | { |
| 21518 | &_flash_method_info_update_via_tftp_IN_ARG_url, |
| 21519 | &_flash_method_info_update_via_tftp_IN_ARG_filename, |
| 21520 | NULL |
| 21521 | }; |
| 21522 | |
| 21523 | static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp = |
| 21524 | { |
| 21525 | { |
| 21526 | -1, |
| 21527 | (gchar *) "updateViaTftp", |
| 21528 | (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers, |
| 21529 | NULL, |
| 21530 | NULL |
| 21531 | }, |
| 21532 | "handle-update-via-tftp", |
| 21533 | FALSE |
| 21534 | }; |
| 21535 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21536 | static const _ExtendedGDBusMethodInfo _flash_method_info_init = |
| 21537 | { |
| 21538 | { |
| 21539 | -1, |
| 21540 | (gchar *) "init", |
| 21541 | NULL, |
| 21542 | NULL, |
| 21543 | NULL |
| 21544 | }, |
| 21545 | "handle-init", |
| 21546 | FALSE |
| 21547 | }; |
| 21548 | |
| 21549 | static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] = |
| 21550 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21551 | &_flash_method_info_update, |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21552 | &_flash_method_info_error, |
| 21553 | &_flash_method_info_done, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21554 | &_flash_method_info_update_via_tftp, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21555 | &_flash_method_info_init, |
| 21556 | NULL |
| 21557 | }; |
| 21558 | |
| 21559 | static const _ExtendedGDBusSignalInfo _flash_signal_info_updated = |
| 21560 | { |
| 21561 | { |
| 21562 | -1, |
| 21563 | (gchar *) "Updated", |
| 21564 | NULL, |
| 21565 | NULL |
| 21566 | }, |
| 21567 | "updated" |
| 21568 | }; |
| 21569 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21570 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url = |
| 21571 | { |
| 21572 | { |
| 21573 | -1, |
| 21574 | (gchar *) "url", |
| 21575 | (gchar *) "s", |
| 21576 | NULL |
| 21577 | }, |
| 21578 | FALSE |
| 21579 | }; |
| 21580 | |
| 21581 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename = |
| 21582 | { |
| 21583 | { |
| 21584 | -1, |
| 21585 | (gchar *) "filename", |
| 21586 | (gchar *) "s", |
| 21587 | NULL |
| 21588 | }, |
| 21589 | FALSE |
| 21590 | }; |
| 21591 | |
| 21592 | static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] = |
| 21593 | { |
| 21594 | &_flash_signal_info_download_ARG_url, |
| 21595 | &_flash_signal_info_download_ARG_filename, |
| 21596 | NULL |
| 21597 | }; |
| 21598 | |
| 21599 | static const _ExtendedGDBusSignalInfo _flash_signal_info_download = |
| 21600 | { |
| 21601 | { |
| 21602 | -1, |
| 21603 | (gchar *) "Download", |
| 21604 | (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers, |
| 21605 | NULL |
| 21606 | }, |
| 21607 | "download" |
| 21608 | }; |
| 21609 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21610 | static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] = |
| 21611 | { |
| 21612 | &_flash_signal_info_updated, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21613 | &_flash_signal_info_download, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21614 | NULL |
| 21615 | }; |
| 21616 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21617 | static const _ExtendedGDBusPropertyInfo _flash_property_info_filename = |
| 21618 | { |
| 21619 | { |
| 21620 | -1, |
| 21621 | (gchar *) "filename", |
| 21622 | (gchar *) "s", |
| 21623 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21624 | NULL |
| 21625 | }, |
| 21626 | "filename", |
| 21627 | FALSE |
| 21628 | }; |
| 21629 | |
| 21630 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path = |
| 21631 | { |
| 21632 | { |
| 21633 | -1, |
| 21634 | (gchar *) "flasher_path", |
| 21635 | (gchar *) "s", |
| 21636 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21637 | NULL |
| 21638 | }, |
| 21639 | "flasher-path", |
| 21640 | FALSE |
| 21641 | }; |
| 21642 | |
| 21643 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name = |
| 21644 | { |
| 21645 | { |
| 21646 | -1, |
| 21647 | (gchar *) "flasher_name", |
| 21648 | (gchar *) "s", |
| 21649 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21650 | NULL |
| 21651 | }, |
| 21652 | "flasher-name", |
| 21653 | FALSE |
| 21654 | }; |
| 21655 | |
| 21656 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance = |
| 21657 | { |
| 21658 | { |
| 21659 | -1, |
| 21660 | (gchar *) "flasher_instance", |
| 21661 | (gchar *) "s", |
| 21662 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21663 | NULL |
| 21664 | }, |
| 21665 | "flasher-instance", |
| 21666 | FALSE |
| 21667 | }; |
| 21668 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21669 | static const _ExtendedGDBusPropertyInfo _flash_property_info_status = |
| 21670 | { |
| 21671 | { |
| 21672 | -1, |
| 21673 | (gchar *) "status", |
| 21674 | (gchar *) "s", |
| 21675 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 21676 | NULL |
| 21677 | }, |
| 21678 | "status", |
| 21679 | FALSE |
| 21680 | }; |
| 21681 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21682 | static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] = |
| 21683 | { |
| 21684 | &_flash_property_info_filename, |
| 21685 | &_flash_property_info_flasher_path, |
| 21686 | &_flash_property_info_flasher_name, |
| 21687 | &_flash_property_info_flasher_instance, |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21688 | &_flash_property_info_status, |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21689 | NULL |
| 21690 | }; |
| 21691 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21692 | static const _ExtendedGDBusInterfaceInfo _flash_interface_info = |
| 21693 | { |
| 21694 | { |
| 21695 | -1, |
| 21696 | (gchar *) "org.openbmc.Flash", |
| 21697 | (GDBusMethodInfo **) &_flash_method_info_pointers, |
| 21698 | (GDBusSignalInfo **) &_flash_signal_info_pointers, |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21699 | (GDBusPropertyInfo **) &_flash_property_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21700 | NULL |
| 21701 | }, |
| 21702 | "flash", |
| 21703 | }; |
| 21704 | |
| 21705 | |
| 21706 | /** |
| 21707 | * flash_interface_info: |
| 21708 | * |
| 21709 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface. |
| 21710 | * |
| 21711 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 21712 | */ |
| 21713 | GDBusInterfaceInfo * |
| 21714 | flash_interface_info (void) |
| 21715 | { |
| 21716 | return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct; |
| 21717 | } |
| 21718 | |
| 21719 | /** |
| 21720 | * flash_override_properties: |
| 21721 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 21722 | * @property_id_begin: The property id to assign to the first overridden property. |
| 21723 | * |
| 21724 | * Overrides all #GObject properties in the #Flash interface for a concrete class. |
| 21725 | * The properties are overridden in the order they are defined. |
| 21726 | * |
| 21727 | * Returns: The last property id. |
| 21728 | */ |
| 21729 | guint |
| 21730 | flash_override_properties (GObjectClass *klass, guint property_id_begin) |
| 21731 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21732 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 21733 | g_object_class_override_property (klass, property_id_begin++, "flasher-path"); |
| 21734 | g_object_class_override_property (klass, property_id_begin++, "flasher-name"); |
| 21735 | g_object_class_override_property (klass, property_id_begin++, "flasher-instance"); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21736 | g_object_class_override_property (klass, property_id_begin++, "status"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21737 | return property_id_begin - 1; |
| 21738 | } |
| 21739 | |
| 21740 | |
| 21741 | |
| 21742 | /** |
| 21743 | * Flash: |
| 21744 | * |
| 21745 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 21746 | */ |
| 21747 | |
| 21748 | /** |
| 21749 | * FlashIface: |
| 21750 | * @parent_iface: The parent interface. |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21751 | * @handle_done: Handler for the #Flash::handle-done signal. |
| 21752 | * @handle_error: Handler for the #Flash::handle-error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21753 | * @handle_init: Handler for the #Flash::handle-init signal. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21754 | * @handle_update: Handler for the #Flash::handle-update signal. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21755 | * @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] | 21756 | * @get_filename: Getter for the #Flash:filename property. |
| 21757 | * @get_flasher_instance: Getter for the #Flash:flasher-instance property. |
| 21758 | * @get_flasher_name: Getter for the #Flash:flasher-name property. |
| 21759 | * @get_flasher_path: Getter for the #Flash:flasher-path property. |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21760 | * @get_status: Getter for the #Flash:status property. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21761 | * @download: Handler for the #Flash::download signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21762 | * @updated: Handler for the #Flash::updated signal. |
| 21763 | * |
| 21764 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 21765 | */ |
| 21766 | |
| 21767 | typedef FlashIface FlashInterface; |
| 21768 | G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT); |
| 21769 | |
| 21770 | static void |
| 21771 | flash_default_init (FlashIface *iface) |
| 21772 | { |
| 21773 | /* GObject signals for incoming D-Bus method calls: */ |
| 21774 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21775 | * Flash::handle-update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21776 | * @object: A #Flash. |
| 21777 | * @invocation: A #GDBusMethodInvocation. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21778 | * @arg_filename: Argument passed by remote caller. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21779 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21780 | * 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] | 21781 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21782 | * 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] | 21783 | * |
| 21784 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21785 | */ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21786 | g_signal_new ("handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21787 | G_TYPE_FROM_INTERFACE (iface), |
| 21788 | G_SIGNAL_RUN_LAST, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21789 | G_STRUCT_OFFSET (FlashIface, handle_update), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21790 | g_signal_accumulator_true_handled, |
| 21791 | NULL, |
| 21792 | g_cclosure_marshal_generic, |
| 21793 | G_TYPE_BOOLEAN, |
| 21794 | 2, |
| 21795 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 21796 | |
| 21797 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21798 | * Flash::handle-error: |
| 21799 | * @object: A #Flash. |
| 21800 | * @invocation: A #GDBusMethodInvocation. |
| 21801 | * @arg_message: Argument passed by remote caller. |
| 21802 | * |
| 21803 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method. |
| 21804 | * |
| 21805 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_error() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 21806 | * |
| 21807 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21808 | */ |
| 21809 | g_signal_new ("handle-error", |
| 21810 | G_TYPE_FROM_INTERFACE (iface), |
| 21811 | G_SIGNAL_RUN_LAST, |
| 21812 | G_STRUCT_OFFSET (FlashIface, handle_error), |
| 21813 | g_signal_accumulator_true_handled, |
| 21814 | NULL, |
| 21815 | g_cclosure_marshal_generic, |
| 21816 | G_TYPE_BOOLEAN, |
| 21817 | 2, |
| 21818 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 21819 | |
| 21820 | /** |
| 21821 | * Flash::handle-done: |
| 21822 | * @object: A #Flash. |
| 21823 | * @invocation: A #GDBusMethodInvocation. |
| 21824 | * |
| 21825 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method. |
| 21826 | * |
| 21827 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_done() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 21828 | * |
| 21829 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21830 | */ |
| 21831 | g_signal_new ("handle-done", |
| 21832 | G_TYPE_FROM_INTERFACE (iface), |
| 21833 | G_SIGNAL_RUN_LAST, |
| 21834 | G_STRUCT_OFFSET (FlashIface, handle_done), |
| 21835 | g_signal_accumulator_true_handled, |
| 21836 | NULL, |
| 21837 | g_cclosure_marshal_generic, |
| 21838 | G_TYPE_BOOLEAN, |
| 21839 | 1, |
| 21840 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21841 | |
| 21842 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21843 | * Flash::handle-update-via-tftp: |
| 21844 | * @object: A #Flash. |
| 21845 | * @invocation: A #GDBusMethodInvocation. |
| 21846 | * @arg_url: Argument passed by remote caller. |
| 21847 | * @arg_filename: Argument passed by remote caller. |
| 21848 | * |
| 21849 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. |
| 21850 | * |
| 21851 | * 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. |
| 21852 | * |
| 21853 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21854 | */ |
| 21855 | g_signal_new ("handle-update-via-tftp", |
| 21856 | G_TYPE_FROM_INTERFACE (iface), |
| 21857 | G_SIGNAL_RUN_LAST, |
| 21858 | G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp), |
| 21859 | g_signal_accumulator_true_handled, |
| 21860 | NULL, |
| 21861 | g_cclosure_marshal_generic, |
| 21862 | G_TYPE_BOOLEAN, |
| 21863 | 3, |
| 21864 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 21865 | |
| 21866 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21867 | * Flash::handle-init: |
| 21868 | * @object: A #Flash. |
| 21869 | * @invocation: A #GDBusMethodInvocation. |
| 21870 | * |
| 21871 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. |
| 21872 | * |
| 21873 | * 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. |
| 21874 | * |
| 21875 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 21876 | */ |
| 21877 | g_signal_new ("handle-init", |
| 21878 | G_TYPE_FROM_INTERFACE (iface), |
| 21879 | G_SIGNAL_RUN_LAST, |
| 21880 | G_STRUCT_OFFSET (FlashIface, handle_init), |
| 21881 | g_signal_accumulator_true_handled, |
| 21882 | NULL, |
| 21883 | g_cclosure_marshal_generic, |
| 21884 | G_TYPE_BOOLEAN, |
| 21885 | 1, |
| 21886 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 21887 | |
| 21888 | /* GObject signals for received D-Bus signals: */ |
| 21889 | /** |
| 21890 | * Flash::updated: |
| 21891 | * @object: A #Flash. |
| 21892 | * |
| 21893 | * 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. |
| 21894 | * |
| 21895 | * 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. |
| 21896 | */ |
| 21897 | g_signal_new ("updated", |
| 21898 | G_TYPE_FROM_INTERFACE (iface), |
| 21899 | G_SIGNAL_RUN_LAST, |
| 21900 | G_STRUCT_OFFSET (FlashIface, updated), |
| 21901 | NULL, |
| 21902 | NULL, |
| 21903 | g_cclosure_marshal_generic, |
| 21904 | G_TYPE_NONE, |
| 21905 | 0); |
| 21906 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21907 | /** |
| 21908 | * Flash::download: |
| 21909 | * @object: A #Flash. |
| 21910 | * @arg_url: Argument. |
| 21911 | * @arg_filename: Argument. |
| 21912 | * |
| 21913 | * 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. |
| 21914 | * |
| 21915 | * 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. |
| 21916 | */ |
| 21917 | g_signal_new ("download", |
| 21918 | G_TYPE_FROM_INTERFACE (iface), |
| 21919 | G_SIGNAL_RUN_LAST, |
| 21920 | G_STRUCT_OFFSET (FlashIface, download), |
| 21921 | NULL, |
| 21922 | NULL, |
| 21923 | g_cclosure_marshal_generic, |
| 21924 | G_TYPE_NONE, |
| 21925 | 2, G_TYPE_STRING, G_TYPE_STRING); |
| 21926 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21927 | /* GObject properties for D-Bus properties: */ |
| 21928 | /** |
| 21929 | * Flash:filename: |
| 21930 | * |
| 21931 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>. |
| 21932 | * |
| 21933 | * 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. |
| 21934 | */ |
| 21935 | g_object_interface_install_property (iface, |
| 21936 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21937 | /** |
| 21938 | * Flash:flasher-path: |
| 21939 | * |
| 21940 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>. |
| 21941 | * |
| 21942 | * 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. |
| 21943 | */ |
| 21944 | g_object_interface_install_property (iface, |
| 21945 | g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21946 | /** |
| 21947 | * Flash:flasher-name: |
| 21948 | * |
| 21949 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>. |
| 21950 | * |
| 21951 | * 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. |
| 21952 | */ |
| 21953 | g_object_interface_install_property (iface, |
| 21954 | g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 21955 | /** |
| 21956 | * Flash:flasher-instance: |
| 21957 | * |
| 21958 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>. |
| 21959 | * |
| 21960 | * 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. |
| 21961 | */ |
| 21962 | g_object_interface_install_property (iface, |
| 21963 | g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21964 | /** |
| 21965 | * Flash:status: |
| 21966 | * |
| 21967 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>. |
| 21968 | * |
| 21969 | * 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. |
| 21970 | */ |
| 21971 | g_object_interface_install_property (iface, |
| 21972 | g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21973 | } |
| 21974 | |
| 21975 | /** |
| 21976 | * flash_get_filename: (skip) |
| 21977 | * @object: A #Flash. |
| 21978 | * |
| 21979 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 21980 | * |
| 21981 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 21982 | * |
| 21983 | * <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> |
| 21984 | * |
| 21985 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 21986 | */ |
| 21987 | const gchar * |
| 21988 | flash_get_filename (Flash *object) |
| 21989 | { |
| 21990 | return FLASH_GET_IFACE (object)->get_filename (object); |
| 21991 | } |
| 21992 | |
| 21993 | /** |
| 21994 | * flash_dup_filename: (skip) |
| 21995 | * @object: A #Flash. |
| 21996 | * |
| 21997 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 21998 | * |
| 21999 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22000 | * |
| 22001 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 22002 | */ |
| 22003 | gchar * |
| 22004 | flash_dup_filename (Flash *object) |
| 22005 | { |
| 22006 | gchar *value; |
| 22007 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 22008 | return value; |
| 22009 | } |
| 22010 | |
| 22011 | /** |
| 22012 | * flash_set_filename: (skip) |
| 22013 | * @object: A #Flash. |
| 22014 | * @value: The value to set. |
| 22015 | * |
| 22016 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value. |
| 22017 | * |
| 22018 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22019 | */ |
| 22020 | void |
| 22021 | flash_set_filename (Flash *object, const gchar *value) |
| 22022 | { |
| 22023 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 22024 | } |
| 22025 | |
| 22026 | /** |
| 22027 | * flash_get_flasher_path: (skip) |
| 22028 | * @object: A #Flash. |
| 22029 | * |
| 22030 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 22031 | * |
| 22032 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22033 | * |
| 22034 | * <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> |
| 22035 | * |
| 22036 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 22037 | */ |
| 22038 | const gchar * |
| 22039 | flash_get_flasher_path (Flash *object) |
| 22040 | { |
| 22041 | return FLASH_GET_IFACE (object)->get_flasher_path (object); |
| 22042 | } |
| 22043 | |
| 22044 | /** |
| 22045 | * flash_dup_flasher_path: (skip) |
| 22046 | * @object: A #Flash. |
| 22047 | * |
| 22048 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 22049 | * |
| 22050 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22051 | * |
| 22052 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 22053 | */ |
| 22054 | gchar * |
| 22055 | flash_dup_flasher_path (Flash *object) |
| 22056 | { |
| 22057 | gchar *value; |
| 22058 | g_object_get (G_OBJECT (object), "flasher-path", &value, NULL); |
| 22059 | return value; |
| 22060 | } |
| 22061 | |
| 22062 | /** |
| 22063 | * flash_set_flasher_path: (skip) |
| 22064 | * @object: A #Flash. |
| 22065 | * @value: The value to set. |
| 22066 | * |
| 22067 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value. |
| 22068 | * |
| 22069 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22070 | */ |
| 22071 | void |
| 22072 | flash_set_flasher_path (Flash *object, const gchar *value) |
| 22073 | { |
| 22074 | g_object_set (G_OBJECT (object), "flasher-path", value, NULL); |
| 22075 | } |
| 22076 | |
| 22077 | /** |
| 22078 | * flash_get_flasher_name: (skip) |
| 22079 | * @object: A #Flash. |
| 22080 | * |
| 22081 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 22082 | * |
| 22083 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22084 | * |
| 22085 | * <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> |
| 22086 | * |
| 22087 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 22088 | */ |
| 22089 | const gchar * |
| 22090 | flash_get_flasher_name (Flash *object) |
| 22091 | { |
| 22092 | return FLASH_GET_IFACE (object)->get_flasher_name (object); |
| 22093 | } |
| 22094 | |
| 22095 | /** |
| 22096 | * flash_dup_flasher_name: (skip) |
| 22097 | * @object: A #Flash. |
| 22098 | * |
| 22099 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 22100 | * |
| 22101 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22102 | * |
| 22103 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 22104 | */ |
| 22105 | gchar * |
| 22106 | flash_dup_flasher_name (Flash *object) |
| 22107 | { |
| 22108 | gchar *value; |
| 22109 | g_object_get (G_OBJECT (object), "flasher-name", &value, NULL); |
| 22110 | return value; |
| 22111 | } |
| 22112 | |
| 22113 | /** |
| 22114 | * flash_set_flasher_name: (skip) |
| 22115 | * @object: A #Flash. |
| 22116 | * @value: The value to set. |
| 22117 | * |
| 22118 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value. |
| 22119 | * |
| 22120 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22121 | */ |
| 22122 | void |
| 22123 | flash_set_flasher_name (Flash *object, const gchar *value) |
| 22124 | { |
| 22125 | g_object_set (G_OBJECT (object), "flasher-name", value, NULL); |
| 22126 | } |
| 22127 | |
| 22128 | /** |
| 22129 | * flash_get_flasher_instance: (skip) |
| 22130 | * @object: A #Flash. |
| 22131 | * |
| 22132 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 22133 | * |
| 22134 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22135 | * |
| 22136 | * <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> |
| 22137 | * |
| 22138 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 22139 | */ |
| 22140 | const gchar * |
| 22141 | flash_get_flasher_instance (Flash *object) |
| 22142 | { |
| 22143 | return FLASH_GET_IFACE (object)->get_flasher_instance (object); |
| 22144 | } |
| 22145 | |
| 22146 | /** |
| 22147 | * flash_dup_flasher_instance: (skip) |
| 22148 | * @object: A #Flash. |
| 22149 | * |
| 22150 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 22151 | * |
| 22152 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22153 | * |
| 22154 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 22155 | */ |
| 22156 | gchar * |
| 22157 | flash_dup_flasher_instance (Flash *object) |
| 22158 | { |
| 22159 | gchar *value; |
| 22160 | g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL); |
| 22161 | return value; |
| 22162 | } |
| 22163 | |
| 22164 | /** |
| 22165 | * flash_set_flasher_instance: (skip) |
| 22166 | * @object: A #Flash. |
| 22167 | * @value: The value to set. |
| 22168 | * |
| 22169 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value. |
| 22170 | * |
| 22171 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22172 | */ |
| 22173 | void |
| 22174 | flash_set_flasher_instance (Flash *object, const gchar *value) |
| 22175 | { |
| 22176 | g_object_set (G_OBJECT (object), "flasher-instance", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22177 | } |
| 22178 | |
| 22179 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22180 | * flash_get_status: (skip) |
| 22181 | * @object: A #Flash. |
| 22182 | * |
| 22183 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. |
| 22184 | * |
| 22185 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22186 | * |
| 22187 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_status() if on another thread.</warning> |
| 22188 | * |
| 22189 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 22190 | */ |
| 22191 | const gchar * |
| 22192 | flash_get_status (Flash *object) |
| 22193 | { |
| 22194 | return FLASH_GET_IFACE (object)->get_status (object); |
| 22195 | } |
| 22196 | |
| 22197 | /** |
| 22198 | * flash_dup_status: (skip) |
| 22199 | * @object: A #Flash. |
| 22200 | * |
| 22201 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. |
| 22202 | * |
| 22203 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 22204 | * |
| 22205 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 22206 | */ |
| 22207 | gchar * |
| 22208 | flash_dup_status (Flash *object) |
| 22209 | { |
| 22210 | gchar *value; |
| 22211 | g_object_get (G_OBJECT (object), "status", &value, NULL); |
| 22212 | return value; |
| 22213 | } |
| 22214 | |
| 22215 | /** |
| 22216 | * flash_set_status: (skip) |
| 22217 | * @object: A #Flash. |
| 22218 | * @value: The value to set. |
| 22219 | * |
| 22220 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value. |
| 22221 | * |
| 22222 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 22223 | */ |
| 22224 | void |
| 22225 | flash_set_status (Flash *object, const gchar *value) |
| 22226 | { |
| 22227 | g_object_set (G_OBJECT (object), "status", value, NULL); |
| 22228 | } |
| 22229 | |
| 22230 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22231 | * flash_emit_updated: |
| 22232 | * @object: A #Flash. |
| 22233 | * |
| 22234 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal. |
| 22235 | */ |
| 22236 | void |
| 22237 | flash_emit_updated ( |
| 22238 | Flash *object) |
| 22239 | { |
| 22240 | g_signal_emit_by_name (object, "updated"); |
| 22241 | } |
| 22242 | |
| 22243 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 22244 | * flash_emit_download: |
| 22245 | * @object: A #Flash. |
| 22246 | * @arg_url: Argument to pass with the signal. |
| 22247 | * @arg_filename: Argument to pass with the signal. |
| 22248 | * |
| 22249 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal. |
| 22250 | */ |
| 22251 | void |
| 22252 | flash_emit_download ( |
| 22253 | Flash *object, |
| 22254 | const gchar *arg_url, |
| 22255 | const gchar *arg_filename) |
| 22256 | { |
| 22257 | g_signal_emit_by_name (object, "download", arg_url, arg_filename); |
| 22258 | } |
| 22259 | |
| 22260 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22261 | * flash_call_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22262 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22263 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22264 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22265 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22266 | * @user_data: User data to pass to @callback. |
| 22267 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22268 | * 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] | 22269 | * 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] | 22270 | * 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] | 22271 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22272 | * 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] | 22273 | */ |
| 22274 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22275 | flash_call_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22276 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22277 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22278 | GCancellable *cancellable, |
| 22279 | GAsyncReadyCallback callback, |
| 22280 | gpointer user_data) |
| 22281 | { |
| 22282 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22283 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22284 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22285 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22286 | G_DBUS_CALL_FLAGS_NONE, |
| 22287 | -1, |
| 22288 | cancellable, |
| 22289 | callback, |
| 22290 | user_data); |
| 22291 | } |
| 22292 | |
| 22293 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22294 | * flash_call_update_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22295 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22296 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22297 | * @error: Return location for error or %NULL. |
| 22298 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22299 | * Finishes an operation started with flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22300 | * |
| 22301 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22302 | */ |
| 22303 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22304 | flash_call_update_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22305 | Flash *proxy, |
| 22306 | GAsyncResult *res, |
| 22307 | GError **error) |
| 22308 | { |
| 22309 | GVariant *_ret; |
| 22310 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22311 | if (_ret == NULL) |
| 22312 | goto _out; |
| 22313 | g_variant_get (_ret, |
| 22314 | "()"); |
| 22315 | g_variant_unref (_ret); |
| 22316 | _out: |
| 22317 | return _ret != NULL; |
| 22318 | } |
| 22319 | |
| 22320 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22321 | * flash_call_update_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22322 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22323 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22324 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22325 | * @error: Return location for error or %NULL. |
| 22326 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22327 | * 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] | 22328 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22329 | * See flash_call_update() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22330 | * |
| 22331 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22332 | */ |
| 22333 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22334 | flash_call_update_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22335 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22336 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22337 | GCancellable *cancellable, |
| 22338 | GError **error) |
| 22339 | { |
| 22340 | GVariant *_ret; |
| 22341 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22342 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22343 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22344 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22345 | G_DBUS_CALL_FLAGS_NONE, |
| 22346 | -1, |
| 22347 | cancellable, |
| 22348 | error); |
| 22349 | if (_ret == NULL) |
| 22350 | goto _out; |
| 22351 | g_variant_get (_ret, |
| 22352 | "()"); |
| 22353 | g_variant_unref (_ret); |
| 22354 | _out: |
| 22355 | return _ret != NULL; |
| 22356 | } |
| 22357 | |
| 22358 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22359 | * flash_call_error: |
| 22360 | * @proxy: A #FlashProxy. |
| 22361 | * @arg_message: Argument to pass with the method invocation. |
| 22362 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22363 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22364 | * @user_data: User data to pass to @callback. |
| 22365 | * |
| 22366 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. |
| 22367 | * 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. |
| 22368 | * You can then call flash_call_error_finish() to get the result of the operation. |
| 22369 | * |
| 22370 | * See flash_call_error_sync() for the synchronous, blocking version of this method. |
| 22371 | */ |
| 22372 | void |
| 22373 | flash_call_error ( |
| 22374 | Flash *proxy, |
| 22375 | const gchar *arg_message, |
| 22376 | GCancellable *cancellable, |
| 22377 | GAsyncReadyCallback callback, |
| 22378 | gpointer user_data) |
| 22379 | { |
| 22380 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22381 | "error", |
| 22382 | g_variant_new ("(s)", |
| 22383 | arg_message), |
| 22384 | G_DBUS_CALL_FLAGS_NONE, |
| 22385 | -1, |
| 22386 | cancellable, |
| 22387 | callback, |
| 22388 | user_data); |
| 22389 | } |
| 22390 | |
| 22391 | /** |
| 22392 | * flash_call_error_finish: |
| 22393 | * @proxy: A #FlashProxy. |
| 22394 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error(). |
| 22395 | * @error: Return location for error or %NULL. |
| 22396 | * |
| 22397 | * Finishes an operation started with flash_call_error(). |
| 22398 | * |
| 22399 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22400 | */ |
| 22401 | gboolean |
| 22402 | flash_call_error_finish ( |
| 22403 | Flash *proxy, |
| 22404 | GAsyncResult *res, |
| 22405 | GError **error) |
| 22406 | { |
| 22407 | GVariant *_ret; |
| 22408 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22409 | if (_ret == NULL) |
| 22410 | goto _out; |
| 22411 | g_variant_get (_ret, |
| 22412 | "()"); |
| 22413 | g_variant_unref (_ret); |
| 22414 | _out: |
| 22415 | return _ret != NULL; |
| 22416 | } |
| 22417 | |
| 22418 | /** |
| 22419 | * flash_call_error_sync: |
| 22420 | * @proxy: A #FlashProxy. |
| 22421 | * @arg_message: Argument to pass with the method invocation. |
| 22422 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22423 | * @error: Return location for error or %NULL. |
| 22424 | * |
| 22425 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 22426 | * |
| 22427 | * See flash_call_error() for the asynchronous version of this method. |
| 22428 | * |
| 22429 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22430 | */ |
| 22431 | gboolean |
| 22432 | flash_call_error_sync ( |
| 22433 | Flash *proxy, |
| 22434 | const gchar *arg_message, |
| 22435 | GCancellable *cancellable, |
| 22436 | GError **error) |
| 22437 | { |
| 22438 | GVariant *_ret; |
| 22439 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22440 | "error", |
| 22441 | g_variant_new ("(s)", |
| 22442 | arg_message), |
| 22443 | G_DBUS_CALL_FLAGS_NONE, |
| 22444 | -1, |
| 22445 | cancellable, |
| 22446 | error); |
| 22447 | if (_ret == NULL) |
| 22448 | goto _out; |
| 22449 | g_variant_get (_ret, |
| 22450 | "()"); |
| 22451 | g_variant_unref (_ret); |
| 22452 | _out: |
| 22453 | return _ret != NULL; |
| 22454 | } |
| 22455 | |
| 22456 | /** |
| 22457 | * flash_call_done: |
| 22458 | * @proxy: A #FlashProxy. |
| 22459 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22460 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22461 | * @user_data: User data to pass to @callback. |
| 22462 | * |
| 22463 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. |
| 22464 | * 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. |
| 22465 | * You can then call flash_call_done_finish() to get the result of the operation. |
| 22466 | * |
| 22467 | * See flash_call_done_sync() for the synchronous, blocking version of this method. |
| 22468 | */ |
| 22469 | void |
| 22470 | flash_call_done ( |
| 22471 | Flash *proxy, |
| 22472 | GCancellable *cancellable, |
| 22473 | GAsyncReadyCallback callback, |
| 22474 | gpointer user_data) |
| 22475 | { |
| 22476 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22477 | "done", |
| 22478 | g_variant_new ("()"), |
| 22479 | G_DBUS_CALL_FLAGS_NONE, |
| 22480 | -1, |
| 22481 | cancellable, |
| 22482 | callback, |
| 22483 | user_data); |
| 22484 | } |
| 22485 | |
| 22486 | /** |
| 22487 | * flash_call_done_finish: |
| 22488 | * @proxy: A #FlashProxy. |
| 22489 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done(). |
| 22490 | * @error: Return location for error or %NULL. |
| 22491 | * |
| 22492 | * Finishes an operation started with flash_call_done(). |
| 22493 | * |
| 22494 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22495 | */ |
| 22496 | gboolean |
| 22497 | flash_call_done_finish ( |
| 22498 | Flash *proxy, |
| 22499 | GAsyncResult *res, |
| 22500 | GError **error) |
| 22501 | { |
| 22502 | GVariant *_ret; |
| 22503 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22504 | if (_ret == NULL) |
| 22505 | goto _out; |
| 22506 | g_variant_get (_ret, |
| 22507 | "()"); |
| 22508 | g_variant_unref (_ret); |
| 22509 | _out: |
| 22510 | return _ret != NULL; |
| 22511 | } |
| 22512 | |
| 22513 | /** |
| 22514 | * flash_call_done_sync: |
| 22515 | * @proxy: A #FlashProxy. |
| 22516 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22517 | * @error: Return location for error or %NULL. |
| 22518 | * |
| 22519 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 22520 | * |
| 22521 | * See flash_call_done() for the asynchronous version of this method. |
| 22522 | * |
| 22523 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22524 | */ |
| 22525 | gboolean |
| 22526 | flash_call_done_sync ( |
| 22527 | Flash *proxy, |
| 22528 | GCancellable *cancellable, |
| 22529 | GError **error) |
| 22530 | { |
| 22531 | GVariant *_ret; |
| 22532 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22533 | "done", |
| 22534 | g_variant_new ("()"), |
| 22535 | G_DBUS_CALL_FLAGS_NONE, |
| 22536 | -1, |
| 22537 | cancellable, |
| 22538 | error); |
| 22539 | if (_ret == NULL) |
| 22540 | goto _out; |
| 22541 | g_variant_get (_ret, |
| 22542 | "()"); |
| 22543 | g_variant_unref (_ret); |
| 22544 | _out: |
| 22545 | return _ret != NULL; |
| 22546 | } |
| 22547 | |
| 22548 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 22549 | * flash_call_update_via_tftp: |
| 22550 | * @proxy: A #FlashProxy. |
| 22551 | * @arg_url: Argument to pass with the method invocation. |
| 22552 | * @arg_filename: Argument to pass with the method invocation. |
| 22553 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22554 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22555 | * @user_data: User data to pass to @callback. |
| 22556 | * |
| 22557 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. |
| 22558 | * 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. |
| 22559 | * You can then call flash_call_update_via_tftp_finish() to get the result of the operation. |
| 22560 | * |
| 22561 | * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method. |
| 22562 | */ |
| 22563 | void |
| 22564 | flash_call_update_via_tftp ( |
| 22565 | Flash *proxy, |
| 22566 | const gchar *arg_url, |
| 22567 | const gchar *arg_filename, |
| 22568 | GCancellable *cancellable, |
| 22569 | GAsyncReadyCallback callback, |
| 22570 | gpointer user_data) |
| 22571 | { |
| 22572 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22573 | "updateViaTftp", |
| 22574 | g_variant_new ("(ss)", |
| 22575 | arg_url, |
| 22576 | arg_filename), |
| 22577 | G_DBUS_CALL_FLAGS_NONE, |
| 22578 | -1, |
| 22579 | cancellable, |
| 22580 | callback, |
| 22581 | user_data); |
| 22582 | } |
| 22583 | |
| 22584 | /** |
| 22585 | * flash_call_update_via_tftp_finish: |
| 22586 | * @proxy: A #FlashProxy. |
| 22587 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp(). |
| 22588 | * @error: Return location for error or %NULL. |
| 22589 | * |
| 22590 | * Finishes an operation started with flash_call_update_via_tftp(). |
| 22591 | * |
| 22592 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22593 | */ |
| 22594 | gboolean |
| 22595 | flash_call_update_via_tftp_finish ( |
| 22596 | Flash *proxy, |
| 22597 | GAsyncResult *res, |
| 22598 | GError **error) |
| 22599 | { |
| 22600 | GVariant *_ret; |
| 22601 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22602 | if (_ret == NULL) |
| 22603 | goto _out; |
| 22604 | g_variant_get (_ret, |
| 22605 | "()"); |
| 22606 | g_variant_unref (_ret); |
| 22607 | _out: |
| 22608 | return _ret != NULL; |
| 22609 | } |
| 22610 | |
| 22611 | /** |
| 22612 | * flash_call_update_via_tftp_sync: |
| 22613 | * @proxy: A #FlashProxy. |
| 22614 | * @arg_url: Argument to pass with the method invocation. |
| 22615 | * @arg_filename: Argument to pass with the method invocation. |
| 22616 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22617 | * @error: Return location for error or %NULL. |
| 22618 | * |
| 22619 | * 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. |
| 22620 | * |
| 22621 | * See flash_call_update_via_tftp() for the asynchronous version of this method. |
| 22622 | * |
| 22623 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22624 | */ |
| 22625 | gboolean |
| 22626 | flash_call_update_via_tftp_sync ( |
| 22627 | Flash *proxy, |
| 22628 | const gchar *arg_url, |
| 22629 | const gchar *arg_filename, |
| 22630 | GCancellable *cancellable, |
| 22631 | GError **error) |
| 22632 | { |
| 22633 | GVariant *_ret; |
| 22634 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22635 | "updateViaTftp", |
| 22636 | g_variant_new ("(ss)", |
| 22637 | arg_url, |
| 22638 | arg_filename), |
| 22639 | G_DBUS_CALL_FLAGS_NONE, |
| 22640 | -1, |
| 22641 | cancellable, |
| 22642 | error); |
| 22643 | if (_ret == NULL) |
| 22644 | goto _out; |
| 22645 | g_variant_get (_ret, |
| 22646 | "()"); |
| 22647 | g_variant_unref (_ret); |
| 22648 | _out: |
| 22649 | return _ret != NULL; |
| 22650 | } |
| 22651 | |
| 22652 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22653 | * flash_call_init: |
| 22654 | * @proxy: A #FlashProxy. |
| 22655 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22656 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 22657 | * @user_data: User data to pass to @callback. |
| 22658 | * |
| 22659 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. |
| 22660 | * 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. |
| 22661 | * You can then call flash_call_init_finish() to get the result of the operation. |
| 22662 | * |
| 22663 | * See flash_call_init_sync() for the synchronous, blocking version of this method. |
| 22664 | */ |
| 22665 | void |
| 22666 | flash_call_init ( |
| 22667 | Flash *proxy, |
| 22668 | GCancellable *cancellable, |
| 22669 | GAsyncReadyCallback callback, |
| 22670 | gpointer user_data) |
| 22671 | { |
| 22672 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 22673 | "init", |
| 22674 | g_variant_new ("()"), |
| 22675 | G_DBUS_CALL_FLAGS_NONE, |
| 22676 | -1, |
| 22677 | cancellable, |
| 22678 | callback, |
| 22679 | user_data); |
| 22680 | } |
| 22681 | |
| 22682 | /** |
| 22683 | * flash_call_init_finish: |
| 22684 | * @proxy: A #FlashProxy. |
| 22685 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init(). |
| 22686 | * @error: Return location for error or %NULL. |
| 22687 | * |
| 22688 | * Finishes an operation started with flash_call_init(). |
| 22689 | * |
| 22690 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22691 | */ |
| 22692 | gboolean |
| 22693 | flash_call_init_finish ( |
| 22694 | Flash *proxy, |
| 22695 | GAsyncResult *res, |
| 22696 | GError **error) |
| 22697 | { |
| 22698 | GVariant *_ret; |
| 22699 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 22700 | if (_ret == NULL) |
| 22701 | goto _out; |
| 22702 | g_variant_get (_ret, |
| 22703 | "()"); |
| 22704 | g_variant_unref (_ret); |
| 22705 | _out: |
| 22706 | return _ret != NULL; |
| 22707 | } |
| 22708 | |
| 22709 | /** |
| 22710 | * flash_call_init_sync: |
| 22711 | * @proxy: A #FlashProxy. |
| 22712 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22713 | * @error: Return location for error or %NULL. |
| 22714 | * |
| 22715 | * 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. |
| 22716 | * |
| 22717 | * See flash_call_init() for the asynchronous version of this method. |
| 22718 | * |
| 22719 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 22720 | */ |
| 22721 | gboolean |
| 22722 | flash_call_init_sync ( |
| 22723 | Flash *proxy, |
| 22724 | GCancellable *cancellable, |
| 22725 | GError **error) |
| 22726 | { |
| 22727 | GVariant *_ret; |
| 22728 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 22729 | "init", |
| 22730 | g_variant_new ("()"), |
| 22731 | G_DBUS_CALL_FLAGS_NONE, |
| 22732 | -1, |
| 22733 | cancellable, |
| 22734 | error); |
| 22735 | if (_ret == NULL) |
| 22736 | goto _out; |
| 22737 | g_variant_get (_ret, |
| 22738 | "()"); |
| 22739 | g_variant_unref (_ret); |
| 22740 | _out: |
| 22741 | return _ret != NULL; |
| 22742 | } |
| 22743 | |
| 22744 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22745 | * flash_complete_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22746 | * @object: A #Flash. |
| 22747 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22748 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22749 | * 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] | 22750 | * |
| 22751 | * This method will free @invocation, you cannot use it afterwards. |
| 22752 | */ |
| 22753 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 22754 | flash_complete_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22755 | Flash *object, |
| 22756 | GDBusMethodInvocation *invocation) |
| 22757 | { |
| 22758 | g_dbus_method_invocation_return_value (invocation, |
| 22759 | g_variant_new ("()")); |
| 22760 | } |
| 22761 | |
| 22762 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22763 | * flash_complete_error: |
| 22764 | * @object: A #Flash. |
| 22765 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22766 | * |
| 22767 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 22768 | * |
| 22769 | * This method will free @invocation, you cannot use it afterwards. |
| 22770 | */ |
| 22771 | void |
| 22772 | flash_complete_error ( |
| 22773 | Flash *object, |
| 22774 | GDBusMethodInvocation *invocation) |
| 22775 | { |
| 22776 | g_dbus_method_invocation_return_value (invocation, |
| 22777 | g_variant_new ("()")); |
| 22778 | } |
| 22779 | |
| 22780 | /** |
| 22781 | * flash_complete_done: |
| 22782 | * @object: A #Flash. |
| 22783 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22784 | * |
| 22785 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 22786 | * |
| 22787 | * This method will free @invocation, you cannot use it afterwards. |
| 22788 | */ |
| 22789 | void |
| 22790 | flash_complete_done ( |
| 22791 | Flash *object, |
| 22792 | GDBusMethodInvocation *invocation) |
| 22793 | { |
| 22794 | g_dbus_method_invocation_return_value (invocation, |
| 22795 | g_variant_new ("()")); |
| 22796 | } |
| 22797 | |
| 22798 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 22799 | * flash_complete_update_via_tftp: |
| 22800 | * @object: A #Flash. |
| 22801 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22802 | * |
| 22803 | * 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. |
| 22804 | * |
| 22805 | * This method will free @invocation, you cannot use it afterwards. |
| 22806 | */ |
| 22807 | void |
| 22808 | flash_complete_update_via_tftp ( |
| 22809 | Flash *object, |
| 22810 | GDBusMethodInvocation *invocation) |
| 22811 | { |
| 22812 | g_dbus_method_invocation_return_value (invocation, |
| 22813 | g_variant_new ("()")); |
| 22814 | } |
| 22815 | |
| 22816 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22817 | * flash_complete_init: |
| 22818 | * @object: A #Flash. |
| 22819 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 22820 | * |
| 22821 | * 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. |
| 22822 | * |
| 22823 | * This method will free @invocation, you cannot use it afterwards. |
| 22824 | */ |
| 22825 | void |
| 22826 | flash_complete_init ( |
| 22827 | Flash *object, |
| 22828 | GDBusMethodInvocation *invocation) |
| 22829 | { |
| 22830 | g_dbus_method_invocation_return_value (invocation, |
| 22831 | g_variant_new ("()")); |
| 22832 | } |
| 22833 | |
| 22834 | /* ------------------------------------------------------------------------ */ |
| 22835 | |
| 22836 | /** |
| 22837 | * FlashProxy: |
| 22838 | * |
| 22839 | * The #FlashProxy structure contains only private data and should only be accessed using the provided API. |
| 22840 | */ |
| 22841 | |
| 22842 | /** |
| 22843 | * FlashProxyClass: |
| 22844 | * @parent_class: The parent class. |
| 22845 | * |
| 22846 | * Class structure for #FlashProxy. |
| 22847 | */ |
| 22848 | |
| 22849 | struct _FlashProxyPrivate |
| 22850 | { |
| 22851 | GData *qdata; |
| 22852 | }; |
| 22853 | |
| 22854 | static void flash_proxy_iface_init (FlashIface *iface); |
| 22855 | |
| 22856 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22857 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 22858 | G_ADD_PRIVATE (FlashProxy) |
| 22859 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 22860 | |
| 22861 | #else |
| 22862 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 22863 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 22864 | |
| 22865 | #endif |
| 22866 | static void |
| 22867 | flash_proxy_finalize (GObject *object) |
| 22868 | { |
| 22869 | FlashProxy *proxy = FLASH_PROXY (object); |
| 22870 | g_datalist_clear (&proxy->priv->qdata); |
| 22871 | G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object); |
| 22872 | } |
| 22873 | |
| 22874 | static void |
| 22875 | flash_proxy_get_property (GObject *object, |
| 22876 | guint prop_id, |
| 22877 | GValue *value, |
| 22878 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22879 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22880 | const _ExtendedGDBusPropertyInfo *info; |
| 22881 | GVariant *variant; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22882 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22883 | info = _flash_property_info_pointers[prop_id - 1]; |
| 22884 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 22885 | if (info->use_gvariant) |
| 22886 | { |
| 22887 | g_value_set_variant (value, variant); |
| 22888 | } |
| 22889 | else |
| 22890 | { |
| 22891 | if (variant != NULL) |
| 22892 | g_dbus_gvariant_to_gvalue (variant, value); |
| 22893 | } |
| 22894 | if (variant != NULL) |
| 22895 | g_variant_unref (variant); |
| 22896 | } |
| 22897 | |
| 22898 | static void |
| 22899 | flash_proxy_set_property_cb (GDBusProxy *proxy, |
| 22900 | GAsyncResult *res, |
| 22901 | gpointer user_data) |
| 22902 | { |
| 22903 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 22904 | GError *error; |
| 22905 | GVariant *_ret; |
| 22906 | error = NULL; |
| 22907 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 22908 | if (!_ret) |
| 22909 | { |
| 22910 | g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)", |
| 22911 | info->parent_struct.name, |
| 22912 | error->message, g_quark_to_string (error->domain), error->code); |
| 22913 | g_error_free (error); |
| 22914 | } |
| 22915 | else |
| 22916 | { |
| 22917 | g_variant_unref (_ret); |
| 22918 | } |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22919 | } |
| 22920 | |
| 22921 | static void |
| 22922 | flash_proxy_set_property (GObject *object, |
| 22923 | guint prop_id, |
| 22924 | const GValue *value, |
| 22925 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22926 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22927 | const _ExtendedGDBusPropertyInfo *info; |
| 22928 | GVariant *variant; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22929 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22930 | info = _flash_property_info_pointers[prop_id - 1]; |
| 22931 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 22932 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 22933 | "org.freedesktop.DBus.Properties.Set", |
| 22934 | g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant), |
| 22935 | G_DBUS_CALL_FLAGS_NONE, |
| 22936 | -1, |
| 22937 | NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 22938 | g_variant_unref (variant); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22939 | } |
| 22940 | |
| 22941 | static void |
| 22942 | flash_proxy_g_signal (GDBusProxy *proxy, |
| 22943 | const gchar *sender_name G_GNUC_UNUSED, |
| 22944 | const gchar *signal_name, |
| 22945 | GVariant *parameters) |
| 22946 | { |
| 22947 | _ExtendedGDBusSignalInfo *info; |
| 22948 | GVariantIter iter; |
| 22949 | GVariant *child; |
| 22950 | GValue *paramv; |
| 22951 | guint num_params; |
| 22952 | guint n; |
| 22953 | guint signal_id; |
| 22954 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name); |
| 22955 | if (info == NULL) |
| 22956 | return; |
| 22957 | num_params = g_variant_n_children (parameters); |
| 22958 | paramv = g_new0 (GValue, num_params + 1); |
| 22959 | g_value_init (¶mv[0], TYPE_FLASH); |
| 22960 | g_value_set_object (¶mv[0], proxy); |
| 22961 | g_variant_iter_init (&iter, parameters); |
| 22962 | n = 1; |
| 22963 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 22964 | { |
| 22965 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 22966 | if (arg_info->use_gvariant) |
| 22967 | { |
| 22968 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 22969 | g_value_set_variant (¶mv[n], child); |
| 22970 | n++; |
| 22971 | } |
| 22972 | else |
| 22973 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 22974 | g_variant_unref (child); |
| 22975 | } |
| 22976 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 22977 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 22978 | for (n = 0; n < num_params + 1; n++) |
| 22979 | g_value_unset (¶mv[n]); |
| 22980 | g_free (paramv); |
| 22981 | } |
| 22982 | |
| 22983 | static void |
| 22984 | flash_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 22985 | GVariant *changed_properties, |
| 22986 | const gchar *const *invalidated_properties) |
| 22987 | { |
| 22988 | FlashProxy *proxy = FLASH_PROXY (_proxy); |
| 22989 | guint n; |
| 22990 | const gchar *key; |
| 22991 | GVariantIter *iter; |
| 22992 | _ExtendedGDBusPropertyInfo *info; |
| 22993 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 22994 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 22995 | { |
| 22996 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key); |
| 22997 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 22998 | if (info != NULL) |
| 22999 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23000 | } |
| 23001 | g_variant_iter_free (iter); |
| 23002 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 23003 | { |
| 23004 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]); |
| 23005 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 23006 | if (info != NULL) |
| 23007 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23008 | } |
| 23009 | } |
| 23010 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23011 | static const gchar * |
| 23012 | flash_proxy_get_filename (Flash *object) |
| 23013 | { |
| 23014 | FlashProxy *proxy = FLASH_PROXY (object); |
| 23015 | GVariant *variant; |
| 23016 | const gchar *value = NULL; |
| 23017 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 23018 | if (variant != NULL) |
| 23019 | { |
| 23020 | value = g_variant_get_string (variant, NULL); |
| 23021 | g_variant_unref (variant); |
| 23022 | } |
| 23023 | return value; |
| 23024 | } |
| 23025 | |
| 23026 | static const gchar * |
| 23027 | flash_proxy_get_flasher_path (Flash *object) |
| 23028 | { |
| 23029 | FlashProxy *proxy = FLASH_PROXY (object); |
| 23030 | GVariant *variant; |
| 23031 | const gchar *value = NULL; |
| 23032 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path"); |
| 23033 | if (variant != NULL) |
| 23034 | { |
| 23035 | value = g_variant_get_string (variant, NULL); |
| 23036 | g_variant_unref (variant); |
| 23037 | } |
| 23038 | return value; |
| 23039 | } |
| 23040 | |
| 23041 | static const gchar * |
| 23042 | flash_proxy_get_flasher_name (Flash *object) |
| 23043 | { |
| 23044 | FlashProxy *proxy = FLASH_PROXY (object); |
| 23045 | GVariant *variant; |
| 23046 | const gchar *value = NULL; |
| 23047 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name"); |
| 23048 | if (variant != NULL) |
| 23049 | { |
| 23050 | value = g_variant_get_string (variant, NULL); |
| 23051 | g_variant_unref (variant); |
| 23052 | } |
| 23053 | return value; |
| 23054 | } |
| 23055 | |
| 23056 | static const gchar * |
| 23057 | flash_proxy_get_flasher_instance (Flash *object) |
| 23058 | { |
| 23059 | FlashProxy *proxy = FLASH_PROXY (object); |
| 23060 | GVariant *variant; |
| 23061 | const gchar *value = NULL; |
| 23062 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance"); |
| 23063 | if (variant != NULL) |
| 23064 | { |
| 23065 | value = g_variant_get_string (variant, NULL); |
| 23066 | g_variant_unref (variant); |
| 23067 | } |
| 23068 | return value; |
| 23069 | } |
| 23070 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23071 | static const gchar * |
| 23072 | flash_proxy_get_status (Flash *object) |
| 23073 | { |
| 23074 | FlashProxy *proxy = FLASH_PROXY (object); |
| 23075 | GVariant *variant; |
| 23076 | const gchar *value = NULL; |
| 23077 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status"); |
| 23078 | if (variant != NULL) |
| 23079 | { |
| 23080 | value = g_variant_get_string (variant, NULL); |
| 23081 | g_variant_unref (variant); |
| 23082 | } |
| 23083 | return value; |
| 23084 | } |
| 23085 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23086 | static void |
| 23087 | flash_proxy_init (FlashProxy *proxy) |
| 23088 | { |
| 23089 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23090 | proxy->priv = flash_proxy_get_instance_private (proxy); |
| 23091 | #else |
| 23092 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate); |
| 23093 | #endif |
| 23094 | |
| 23095 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ()); |
| 23096 | } |
| 23097 | |
| 23098 | static void |
| 23099 | flash_proxy_class_init (FlashProxyClass *klass) |
| 23100 | { |
| 23101 | GObjectClass *gobject_class; |
| 23102 | GDBusProxyClass *proxy_class; |
| 23103 | |
| 23104 | gobject_class = G_OBJECT_CLASS (klass); |
| 23105 | gobject_class->finalize = flash_proxy_finalize; |
| 23106 | gobject_class->get_property = flash_proxy_get_property; |
| 23107 | gobject_class->set_property = flash_proxy_set_property; |
| 23108 | |
| 23109 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 23110 | proxy_class->g_signal = flash_proxy_g_signal; |
| 23111 | proxy_class->g_properties_changed = flash_proxy_g_properties_changed; |
| 23112 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23113 | flash_override_properties (gobject_class, 1); |
| 23114 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23115 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 23116 | g_type_class_add_private (klass, sizeof (FlashProxyPrivate)); |
| 23117 | #endif |
| 23118 | } |
| 23119 | |
| 23120 | static void |
| 23121 | flash_proxy_iface_init (FlashIface *iface) |
| 23122 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23123 | iface->get_filename = flash_proxy_get_filename; |
| 23124 | iface->get_flasher_path = flash_proxy_get_flasher_path; |
| 23125 | iface->get_flasher_name = flash_proxy_get_flasher_name; |
| 23126 | iface->get_flasher_instance = flash_proxy_get_flasher_instance; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23127 | iface->get_status = flash_proxy_get_status; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23128 | } |
| 23129 | |
| 23130 | /** |
| 23131 | * flash_proxy_new: |
| 23132 | * @connection: A #GDBusConnection. |
| 23133 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23134 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23135 | * @object_path: An object path. |
| 23136 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23137 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23138 | * @user_data: User data to pass to @callback. |
| 23139 | * |
| 23140 | * 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. |
| 23141 | * |
| 23142 | * 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. |
| 23143 | * You can then call flash_proxy_new_finish() to get the result of the operation. |
| 23144 | * |
| 23145 | * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 23146 | */ |
| 23147 | void |
| 23148 | flash_proxy_new ( |
| 23149 | GDBusConnection *connection, |
| 23150 | GDBusProxyFlags flags, |
| 23151 | const gchar *name, |
| 23152 | const gchar *object_path, |
| 23153 | GCancellable *cancellable, |
| 23154 | GAsyncReadyCallback callback, |
| 23155 | gpointer user_data) |
| 23156 | { |
| 23157 | 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); |
| 23158 | } |
| 23159 | |
| 23160 | /** |
| 23161 | * flash_proxy_new_finish: |
| 23162 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new(). |
| 23163 | * @error: Return location for error or %NULL |
| 23164 | * |
| 23165 | * Finishes an operation started with flash_proxy_new(). |
| 23166 | * |
| 23167 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 23168 | */ |
| 23169 | Flash * |
| 23170 | flash_proxy_new_finish ( |
| 23171 | GAsyncResult *res, |
| 23172 | GError **error) |
| 23173 | { |
| 23174 | GObject *ret; |
| 23175 | GObject *source_object; |
| 23176 | source_object = g_async_result_get_source_object (res); |
| 23177 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23178 | g_object_unref (source_object); |
| 23179 | if (ret != NULL) |
| 23180 | return FLASH (ret); |
| 23181 | else |
| 23182 | return NULL; |
| 23183 | } |
| 23184 | |
| 23185 | /** |
| 23186 | * flash_proxy_new_sync: |
| 23187 | * @connection: A #GDBusConnection. |
| 23188 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23189 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23190 | * @object_path: An object path. |
| 23191 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23192 | * @error: Return location for error or %NULL |
| 23193 | * |
| 23194 | * 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. |
| 23195 | * |
| 23196 | * The calling thread is blocked until a reply is received. |
| 23197 | * |
| 23198 | * See flash_proxy_new() for the asynchronous version of this constructor. |
| 23199 | * |
| 23200 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 23201 | */ |
| 23202 | Flash * |
| 23203 | flash_proxy_new_sync ( |
| 23204 | GDBusConnection *connection, |
| 23205 | GDBusProxyFlags flags, |
| 23206 | const gchar *name, |
| 23207 | const gchar *object_path, |
| 23208 | GCancellable *cancellable, |
| 23209 | GError **error) |
| 23210 | { |
| 23211 | GInitable *ret; |
| 23212 | 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); |
| 23213 | if (ret != NULL) |
| 23214 | return FLASH (ret); |
| 23215 | else |
| 23216 | return NULL; |
| 23217 | } |
| 23218 | |
| 23219 | |
| 23220 | /** |
| 23221 | * flash_proxy_new_for_bus: |
| 23222 | * @bus_type: A #GBusType. |
| 23223 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23224 | * @name: A bus name (well-known or unique). |
| 23225 | * @object_path: An object path. |
| 23226 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23227 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23228 | * @user_data: User data to pass to @callback. |
| 23229 | * |
| 23230 | * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 23231 | * |
| 23232 | * 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. |
| 23233 | * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation. |
| 23234 | * |
| 23235 | * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 23236 | */ |
| 23237 | void |
| 23238 | flash_proxy_new_for_bus ( |
| 23239 | GBusType bus_type, |
| 23240 | GDBusProxyFlags flags, |
| 23241 | const gchar *name, |
| 23242 | const gchar *object_path, |
| 23243 | GCancellable *cancellable, |
| 23244 | GAsyncReadyCallback callback, |
| 23245 | gpointer user_data) |
| 23246 | { |
| 23247 | 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); |
| 23248 | } |
| 23249 | |
| 23250 | /** |
| 23251 | * flash_proxy_new_for_bus_finish: |
| 23252 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus(). |
| 23253 | * @error: Return location for error or %NULL |
| 23254 | * |
| 23255 | * Finishes an operation started with flash_proxy_new_for_bus(). |
| 23256 | * |
| 23257 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 23258 | */ |
| 23259 | Flash * |
| 23260 | flash_proxy_new_for_bus_finish ( |
| 23261 | GAsyncResult *res, |
| 23262 | GError **error) |
| 23263 | { |
| 23264 | GObject *ret; |
| 23265 | GObject *source_object; |
| 23266 | source_object = g_async_result_get_source_object (res); |
| 23267 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23268 | g_object_unref (source_object); |
| 23269 | if (ret != NULL) |
| 23270 | return FLASH (ret); |
| 23271 | else |
| 23272 | return NULL; |
| 23273 | } |
| 23274 | |
| 23275 | /** |
| 23276 | * flash_proxy_new_for_bus_sync: |
| 23277 | * @bus_type: A #GBusType. |
| 23278 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23279 | * @name: A bus name (well-known or unique). |
| 23280 | * @object_path: An object path. |
| 23281 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23282 | * @error: Return location for error or %NULL |
| 23283 | * |
| 23284 | * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 23285 | * |
| 23286 | * The calling thread is blocked until a reply is received. |
| 23287 | * |
| 23288 | * See flash_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 23289 | * |
| 23290 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 23291 | */ |
| 23292 | Flash * |
| 23293 | flash_proxy_new_for_bus_sync ( |
| 23294 | GBusType bus_type, |
| 23295 | GDBusProxyFlags flags, |
| 23296 | const gchar *name, |
| 23297 | const gchar *object_path, |
| 23298 | GCancellable *cancellable, |
| 23299 | GError **error) |
| 23300 | { |
| 23301 | GInitable *ret; |
| 23302 | 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); |
| 23303 | if (ret != NULL) |
| 23304 | return FLASH (ret); |
| 23305 | else |
| 23306 | return NULL; |
| 23307 | } |
| 23308 | |
| 23309 | |
| 23310 | /* ------------------------------------------------------------------------ */ |
| 23311 | |
| 23312 | /** |
| 23313 | * FlashSkeleton: |
| 23314 | * |
| 23315 | * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API. |
| 23316 | */ |
| 23317 | |
| 23318 | /** |
| 23319 | * FlashSkeletonClass: |
| 23320 | * @parent_class: The parent class. |
| 23321 | * |
| 23322 | * Class structure for #FlashSkeleton. |
| 23323 | */ |
| 23324 | |
| 23325 | struct _FlashSkeletonPrivate |
| 23326 | { |
| 23327 | GValue *properties; |
| 23328 | GList *changed_properties; |
| 23329 | GSource *changed_properties_idle_source; |
| 23330 | GMainContext *context; |
| 23331 | GMutex lock; |
| 23332 | }; |
| 23333 | |
| 23334 | static void |
| 23335 | _flash_skeleton_handle_method_call ( |
| 23336 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23337 | const gchar *sender G_GNUC_UNUSED, |
| 23338 | const gchar *object_path G_GNUC_UNUSED, |
| 23339 | const gchar *interface_name, |
| 23340 | const gchar *method_name, |
| 23341 | GVariant *parameters, |
| 23342 | GDBusMethodInvocation *invocation, |
| 23343 | gpointer user_data) |
| 23344 | { |
| 23345 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 23346 | _ExtendedGDBusMethodInfo *info; |
| 23347 | GVariantIter iter; |
| 23348 | GVariant *child; |
| 23349 | GValue *paramv; |
| 23350 | guint num_params; |
| 23351 | guint num_extra; |
| 23352 | guint n; |
| 23353 | guint signal_id; |
| 23354 | GValue return_value = G_VALUE_INIT; |
| 23355 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 23356 | g_assert (info != NULL); |
| 23357 | num_params = g_variant_n_children (parameters); |
| 23358 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 23359 | n = 0; |
| 23360 | g_value_init (¶mv[n], TYPE_FLASH); |
| 23361 | g_value_set_object (¶mv[n++], skeleton); |
| 23362 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 23363 | g_value_set_object (¶mv[n++], invocation); |
| 23364 | if (info->pass_fdlist) |
| 23365 | { |
| 23366 | #ifdef G_OS_UNIX |
| 23367 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 23368 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 23369 | #else |
| 23370 | g_assert_not_reached (); |
| 23371 | #endif |
| 23372 | } |
| 23373 | g_variant_iter_init (&iter, parameters); |
| 23374 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 23375 | { |
| 23376 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 23377 | if (arg_info->use_gvariant) |
| 23378 | { |
| 23379 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 23380 | g_value_set_variant (¶mv[n], child); |
| 23381 | n++; |
| 23382 | } |
| 23383 | else |
| 23384 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 23385 | g_variant_unref (child); |
| 23386 | } |
| 23387 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 23388 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 23389 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 23390 | if (!g_value_get_boolean (&return_value)) |
| 23391 | 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); |
| 23392 | g_value_unset (&return_value); |
| 23393 | for (n = 0; n < num_params + num_extra; n++) |
| 23394 | g_value_unset (¶mv[n]); |
| 23395 | g_free (paramv); |
| 23396 | } |
| 23397 | |
| 23398 | static GVariant * |
| 23399 | _flash_skeleton_handle_get_property ( |
| 23400 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23401 | const gchar *sender G_GNUC_UNUSED, |
| 23402 | const gchar *object_path G_GNUC_UNUSED, |
| 23403 | const gchar *interface_name G_GNUC_UNUSED, |
| 23404 | const gchar *property_name, |
| 23405 | GError **error, |
| 23406 | gpointer user_data) |
| 23407 | { |
| 23408 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 23409 | GValue value = G_VALUE_INIT; |
| 23410 | GParamSpec *pspec; |
| 23411 | _ExtendedGDBusPropertyInfo *info; |
| 23412 | GVariant *ret; |
| 23413 | ret = NULL; |
| 23414 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 23415 | g_assert (info != NULL); |
| 23416 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23417 | if (pspec == NULL) |
| 23418 | { |
| 23419 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23420 | } |
| 23421 | else |
| 23422 | { |
| 23423 | g_value_init (&value, pspec->value_type); |
| 23424 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23425 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 23426 | g_value_unset (&value); |
| 23427 | } |
| 23428 | return ret; |
| 23429 | } |
| 23430 | |
| 23431 | static gboolean |
| 23432 | _flash_skeleton_handle_set_property ( |
| 23433 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23434 | const gchar *sender G_GNUC_UNUSED, |
| 23435 | const gchar *object_path G_GNUC_UNUSED, |
| 23436 | const gchar *interface_name G_GNUC_UNUSED, |
| 23437 | const gchar *property_name, |
| 23438 | GVariant *variant, |
| 23439 | GError **error, |
| 23440 | gpointer user_data) |
| 23441 | { |
| 23442 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 23443 | GValue value = G_VALUE_INIT; |
| 23444 | GParamSpec *pspec; |
| 23445 | _ExtendedGDBusPropertyInfo *info; |
| 23446 | gboolean ret; |
| 23447 | ret = FALSE; |
| 23448 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 23449 | g_assert (info != NULL); |
| 23450 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23451 | if (pspec == NULL) |
| 23452 | { |
| 23453 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23454 | } |
| 23455 | else |
| 23456 | { |
| 23457 | if (info->use_gvariant) |
| 23458 | g_value_set_variant (&value, variant); |
| 23459 | else |
| 23460 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 23461 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23462 | g_value_unset (&value); |
| 23463 | ret = TRUE; |
| 23464 | } |
| 23465 | return ret; |
| 23466 | } |
| 23467 | |
| 23468 | static const GDBusInterfaceVTable _flash_skeleton_vtable = |
| 23469 | { |
| 23470 | _flash_skeleton_handle_method_call, |
| 23471 | _flash_skeleton_handle_get_property, |
| 23472 | _flash_skeleton_handle_set_property, |
| 23473 | {NULL} |
| 23474 | }; |
| 23475 | |
| 23476 | static GDBusInterfaceInfo * |
| 23477 | flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23478 | { |
| 23479 | return flash_interface_info (); |
| 23480 | } |
| 23481 | |
| 23482 | static GDBusInterfaceVTable * |
| 23483 | flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23484 | { |
| 23485 | return (GDBusInterfaceVTable *) &_flash_skeleton_vtable; |
| 23486 | } |
| 23487 | |
| 23488 | static GVariant * |
| 23489 | flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 23490 | { |
| 23491 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 23492 | |
| 23493 | GVariantBuilder builder; |
| 23494 | guint n; |
| 23495 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23496 | if (_flash_interface_info.parent_struct.properties == NULL) |
| 23497 | goto out; |
| 23498 | for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++) |
| 23499 | { |
| 23500 | GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n]; |
| 23501 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 23502 | { |
| 23503 | GVariant *value; |
| 23504 | 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); |
| 23505 | if (value != NULL) |
| 23506 | { |
| 23507 | g_variant_take_ref (value); |
| 23508 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 23509 | g_variant_unref (value); |
| 23510 | } |
| 23511 | } |
| 23512 | } |
| 23513 | out: |
| 23514 | return g_variant_builder_end (&builder); |
| 23515 | } |
| 23516 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23517 | static gboolean _flash_emit_changed (gpointer user_data); |
| 23518 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23519 | static void |
| 23520 | flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 23521 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23522 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 23523 | gboolean emit_changed = FALSE; |
| 23524 | |
| 23525 | g_mutex_lock (&skeleton->priv->lock); |
| 23526 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23527 | { |
| 23528 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23529 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23530 | emit_changed = TRUE; |
| 23531 | } |
| 23532 | g_mutex_unlock (&skeleton->priv->lock); |
| 23533 | |
| 23534 | if (emit_changed) |
| 23535 | _flash_emit_changed (skeleton); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23536 | } |
| 23537 | |
| 23538 | static void |
| 23539 | _flash_on_signal_updated ( |
| 23540 | Flash *object) |
| 23541 | { |
| 23542 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23543 | |
| 23544 | GList *connections, *l; |
| 23545 | GVariant *signal_variant; |
| 23546 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23547 | |
| 23548 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 23549 | for (l = connections; l != NULL; l = l->next) |
| 23550 | { |
| 23551 | GDBusConnection *connection = l->data; |
| 23552 | g_dbus_connection_emit_signal (connection, |
| 23553 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated", |
| 23554 | signal_variant, NULL); |
| 23555 | } |
| 23556 | g_variant_unref (signal_variant); |
| 23557 | g_list_free_full (connections, g_object_unref); |
| 23558 | } |
| 23559 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 23560 | static void |
| 23561 | _flash_on_signal_download ( |
| 23562 | Flash *object, |
| 23563 | const gchar *arg_url, |
| 23564 | const gchar *arg_filename) |
| 23565 | { |
| 23566 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23567 | |
| 23568 | GList *connections, *l; |
| 23569 | GVariant *signal_variant; |
| 23570 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23571 | |
| 23572 | signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", |
| 23573 | arg_url, |
| 23574 | arg_filename)); |
| 23575 | for (l = connections; l != NULL; l = l->next) |
| 23576 | { |
| 23577 | GDBusConnection *connection = l->data; |
| 23578 | g_dbus_connection_emit_signal (connection, |
| 23579 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download", |
| 23580 | signal_variant, NULL); |
| 23581 | } |
| 23582 | g_variant_unref (signal_variant); |
| 23583 | g_list_free_full (connections, g_object_unref); |
| 23584 | } |
| 23585 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23586 | static void flash_skeleton_iface_init (FlashIface *iface); |
| 23587 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23588 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23589 | G_ADD_PRIVATE (FlashSkeleton) |
| 23590 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 23591 | |
| 23592 | #else |
| 23593 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 23594 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 23595 | |
| 23596 | #endif |
| 23597 | static void |
| 23598 | flash_skeleton_finalize (GObject *object) |
| 23599 | { |
| 23600 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23601 | guint n; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23602 | for (n = 0; n < 5; n++) |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23603 | g_value_unset (&skeleton->priv->properties[n]); |
| 23604 | g_free (skeleton->priv->properties); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23605 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 23606 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23607 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23608 | g_main_context_unref (skeleton->priv->context); |
| 23609 | g_mutex_clear (&skeleton->priv->lock); |
| 23610 | G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object); |
| 23611 | } |
| 23612 | |
| 23613 | static void |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23614 | flash_skeleton_get_property (GObject *object, |
| 23615 | guint prop_id, |
| 23616 | GValue *value, |
| 23617 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23618 | { |
| 23619 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23620 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23621 | g_mutex_lock (&skeleton->priv->lock); |
| 23622 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 23623 | g_mutex_unlock (&skeleton->priv->lock); |
| 23624 | } |
| 23625 | |
| 23626 | static gboolean |
| 23627 | _flash_emit_changed (gpointer user_data) |
| 23628 | { |
| 23629 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 23630 | GList *l; |
| 23631 | GVariantBuilder builder; |
| 23632 | GVariantBuilder invalidated_builder; |
| 23633 | guint num_changes; |
| 23634 | |
| 23635 | g_mutex_lock (&skeleton->priv->lock); |
| 23636 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23637 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 23638 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 23639 | { |
| 23640 | ChangedProperty *cp = l->data; |
| 23641 | GVariant *variant; |
| 23642 | const GValue *cur_value; |
| 23643 | |
| 23644 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 23645 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 23646 | { |
| 23647 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 23648 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 23649 | g_variant_unref (variant); |
| 23650 | num_changes++; |
| 23651 | } |
| 23652 | } |
| 23653 | if (num_changes > 0) |
| 23654 | { |
| 23655 | GList *connections, *ll; |
| 23656 | GVariant *signal_variant; |
| 23657 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash", |
| 23658 | &builder, &invalidated_builder)); |
| 23659 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23660 | for (ll = connections; ll != NULL; ll = ll->next) |
| 23661 | { |
| 23662 | GDBusConnection *connection = ll->data; |
| 23663 | |
| 23664 | g_dbus_connection_emit_signal (connection, |
| 23665 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 23666 | "org.freedesktop.DBus.Properties", |
| 23667 | "PropertiesChanged", |
| 23668 | signal_variant, |
| 23669 | NULL); |
| 23670 | } |
| 23671 | g_variant_unref (signal_variant); |
| 23672 | g_list_free_full (connections, g_object_unref); |
| 23673 | } |
| 23674 | else |
| 23675 | { |
| 23676 | g_variant_builder_clear (&builder); |
| 23677 | g_variant_builder_clear (&invalidated_builder); |
| 23678 | } |
| 23679 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 23680 | skeleton->priv->changed_properties = NULL; |
| 23681 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23682 | g_mutex_unlock (&skeleton->priv->lock); |
| 23683 | return FALSE; |
| 23684 | } |
| 23685 | |
| 23686 | static void |
| 23687 | _flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 23688 | { |
| 23689 | ChangedProperty *cp; |
| 23690 | GList *l; |
| 23691 | cp = NULL; |
| 23692 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 23693 | { |
| 23694 | ChangedProperty *i_cp = l->data; |
| 23695 | if (i_cp->info == info) |
| 23696 | { |
| 23697 | cp = i_cp; |
| 23698 | break; |
| 23699 | } |
| 23700 | } |
| 23701 | if (cp == NULL) |
| 23702 | { |
| 23703 | cp = g_new0 (ChangedProperty, 1); |
| 23704 | cp->prop_id = prop_id; |
| 23705 | cp->info = info; |
| 23706 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 23707 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 23708 | g_value_copy (orig_value, &cp->orig_value); |
| 23709 | } |
| 23710 | } |
| 23711 | |
| 23712 | static void |
| 23713 | flash_skeleton_notify (GObject *object, |
| 23714 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23715 | { |
| 23716 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23717 | g_mutex_lock (&skeleton->priv->lock); |
| 23718 | if (skeleton->priv->changed_properties != NULL && |
| 23719 | skeleton->priv->changed_properties_idle_source == NULL) |
| 23720 | { |
| 23721 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 23722 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 23723 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 23724 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 23725 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 23726 | } |
| 23727 | g_mutex_unlock (&skeleton->priv->lock); |
| 23728 | } |
| 23729 | |
| 23730 | static void |
| 23731 | flash_skeleton_set_property (GObject *object, |
| 23732 | guint prop_id, |
| 23733 | const GValue *value, |
| 23734 | GParamSpec *pspec) |
| 23735 | { |
| 23736 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23737 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23738 | g_mutex_lock (&skeleton->priv->lock); |
| 23739 | g_object_freeze_notify (object); |
| 23740 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 23741 | { |
| 23742 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 23743 | _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 23744 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 23745 | g_object_notify_by_pspec (object, pspec); |
| 23746 | } |
| 23747 | g_mutex_unlock (&skeleton->priv->lock); |
| 23748 | g_object_thaw_notify (object); |
| 23749 | } |
| 23750 | |
| 23751 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23752 | flash_skeleton_init (FlashSkeleton *skeleton) |
| 23753 | { |
| 23754 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23755 | skeleton->priv = flash_skeleton_get_instance_private (skeleton); |
| 23756 | #else |
| 23757 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate); |
| 23758 | #endif |
| 23759 | |
| 23760 | g_mutex_init (&skeleton->priv->lock); |
| 23761 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23762 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23763 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 23764 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 23765 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
| 23766 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23767 | g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23768 | } |
| 23769 | |
| 23770 | static const gchar * |
| 23771 | flash_skeleton_get_filename (Flash *object) |
| 23772 | { |
| 23773 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23774 | const gchar *value; |
| 23775 | g_mutex_lock (&skeleton->priv->lock); |
| 23776 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 23777 | g_mutex_unlock (&skeleton->priv->lock); |
| 23778 | return value; |
| 23779 | } |
| 23780 | |
| 23781 | static const gchar * |
| 23782 | flash_skeleton_get_flasher_path (Flash *object) |
| 23783 | { |
| 23784 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23785 | const gchar *value; |
| 23786 | g_mutex_lock (&skeleton->priv->lock); |
| 23787 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 23788 | g_mutex_unlock (&skeleton->priv->lock); |
| 23789 | return value; |
| 23790 | } |
| 23791 | |
| 23792 | static const gchar * |
| 23793 | flash_skeleton_get_flasher_name (Flash *object) |
| 23794 | { |
| 23795 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23796 | const gchar *value; |
| 23797 | g_mutex_lock (&skeleton->priv->lock); |
| 23798 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
| 23799 | g_mutex_unlock (&skeleton->priv->lock); |
| 23800 | return value; |
| 23801 | } |
| 23802 | |
| 23803 | static const gchar * |
| 23804 | flash_skeleton_get_flasher_instance (Flash *object) |
| 23805 | { |
| 23806 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23807 | const gchar *value; |
| 23808 | g_mutex_lock (&skeleton->priv->lock); |
| 23809 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
| 23810 | g_mutex_unlock (&skeleton->priv->lock); |
| 23811 | return value; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23812 | } |
| 23813 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23814 | static const gchar * |
| 23815 | flash_skeleton_get_status (Flash *object) |
| 23816 | { |
| 23817 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 23818 | const gchar *value; |
| 23819 | g_mutex_lock (&skeleton->priv->lock); |
| 23820 | value = g_value_get_string (&(skeleton->priv->properties[4])); |
| 23821 | g_mutex_unlock (&skeleton->priv->lock); |
| 23822 | return value; |
| 23823 | } |
| 23824 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23825 | static void |
| 23826 | flash_skeleton_class_init (FlashSkeletonClass *klass) |
| 23827 | { |
| 23828 | GObjectClass *gobject_class; |
| 23829 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 23830 | |
| 23831 | gobject_class = G_OBJECT_CLASS (klass); |
| 23832 | gobject_class->finalize = flash_skeleton_finalize; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23833 | gobject_class->get_property = flash_skeleton_get_property; |
| 23834 | gobject_class->set_property = flash_skeleton_set_property; |
| 23835 | gobject_class->notify = flash_skeleton_notify; |
| 23836 | |
| 23837 | |
| 23838 | flash_override_properties (gobject_class, 1); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23839 | |
| 23840 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 23841 | skeleton_class->get_info = flash_skeleton_dbus_interface_get_info; |
| 23842 | skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties; |
| 23843 | skeleton_class->flush = flash_skeleton_dbus_interface_flush; |
| 23844 | skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable; |
| 23845 | |
| 23846 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 23847 | g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate)); |
| 23848 | #endif |
| 23849 | } |
| 23850 | |
| 23851 | static void |
| 23852 | flash_skeleton_iface_init (FlashIface *iface) |
| 23853 | { |
| 23854 | iface->updated = _flash_on_signal_updated; |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 23855 | iface->download = _flash_on_signal_download; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23856 | iface->get_filename = flash_skeleton_get_filename; |
| 23857 | iface->get_flasher_path = flash_skeleton_get_flasher_path; |
| 23858 | iface->get_flasher_name = flash_skeleton_get_flasher_name; |
| 23859 | iface->get_flasher_instance = flash_skeleton_get_flasher_instance; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 23860 | iface->get_status = flash_skeleton_get_status; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 23861 | } |
| 23862 | |
| 23863 | /** |
| 23864 | * flash_skeleton_new: |
| 23865 | * |
| 23866 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 23867 | * |
| 23868 | * Returns: (transfer full) (type FlashSkeleton): The skeleton object. |
| 23869 | */ |
| 23870 | Flash * |
| 23871 | flash_skeleton_new (void) |
| 23872 | { |
| 23873 | return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL)); |
| 23874 | } |
| 23875 | |
| 23876 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 23877 | * Code for interface org.openbmc.FlashControl |
| 23878 | * ------------------------------------------------------------------------ |
| 23879 | */ |
| 23880 | |
| 23881 | /** |
| 23882 | * SECTION:FlashControl |
| 23883 | * @title: FlashControl |
| 23884 | * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface |
| 23885 | * |
| 23886 | * 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. |
| 23887 | */ |
| 23888 | |
| 23889 | /* ---- Introspection data for org.openbmc.FlashControl ---- */ |
| 23890 | |
| 23891 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type = |
| 23892 | { |
| 23893 | { |
| 23894 | -1, |
| 23895 | (gchar *) "type", |
| 23896 | (gchar *) "s", |
| 23897 | NULL |
| 23898 | }, |
| 23899 | FALSE |
| 23900 | }; |
| 23901 | |
| 23902 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename = |
| 23903 | { |
| 23904 | { |
| 23905 | -1, |
| 23906 | (gchar *) "filename", |
| 23907 | (gchar *) "s", |
| 23908 | NULL |
| 23909 | }, |
| 23910 | FALSE |
| 23911 | }; |
| 23912 | |
| 23913 | static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] = |
| 23914 | { |
| 23915 | &_flash_control_method_info_flash_IN_ARG_type, |
| 23916 | &_flash_control_method_info_flash_IN_ARG_filename, |
| 23917 | NULL |
| 23918 | }; |
| 23919 | |
| 23920 | static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash = |
| 23921 | { |
| 23922 | { |
| 23923 | -1, |
| 23924 | (gchar *) "flash", |
| 23925 | (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers, |
| 23926 | NULL, |
| 23927 | NULL |
| 23928 | }, |
| 23929 | "handle-flash", |
| 23930 | FALSE |
| 23931 | }; |
| 23932 | |
| 23933 | static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] = |
| 23934 | { |
| 23935 | &_flash_control_method_info_flash, |
| 23936 | NULL |
| 23937 | }; |
| 23938 | |
| 23939 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename = |
| 23940 | { |
| 23941 | { |
| 23942 | -1, |
| 23943 | (gchar *) "filename", |
| 23944 | (gchar *) "s", |
| 23945 | NULL |
| 23946 | }, |
| 23947 | FALSE |
| 23948 | }; |
| 23949 | |
| 23950 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] = |
| 23951 | { |
| 23952 | &_flash_control_signal_info_done_ARG_filename, |
| 23953 | NULL |
| 23954 | }; |
| 23955 | |
| 23956 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done = |
| 23957 | { |
| 23958 | { |
| 23959 | -1, |
| 23960 | (gchar *) "Done", |
| 23961 | (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers, |
| 23962 | NULL |
| 23963 | }, |
| 23964 | "done" |
| 23965 | }; |
| 23966 | |
| 23967 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename = |
| 23968 | { |
| 23969 | { |
| 23970 | -1, |
| 23971 | (gchar *) "filename", |
| 23972 | (gchar *) "s", |
| 23973 | NULL |
| 23974 | }, |
| 23975 | FALSE |
| 23976 | }; |
| 23977 | |
| 23978 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] = |
| 23979 | { |
| 23980 | &_flash_control_signal_info_error_ARG_filename, |
| 23981 | NULL |
| 23982 | }; |
| 23983 | |
| 23984 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error = |
| 23985 | { |
| 23986 | { |
| 23987 | -1, |
| 23988 | (gchar *) "Error", |
| 23989 | (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers, |
| 23990 | NULL |
| 23991 | }, |
| 23992 | "error" |
| 23993 | }; |
| 23994 | |
| 23995 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename = |
| 23996 | { |
| 23997 | { |
| 23998 | -1, |
| 23999 | (gchar *) "filename", |
| 24000 | (gchar *) "s", |
| 24001 | NULL |
| 24002 | }, |
| 24003 | FALSE |
| 24004 | }; |
| 24005 | |
| 24006 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress = |
| 24007 | { |
| 24008 | { |
| 24009 | -1, |
| 24010 | (gchar *) "progress", |
| 24011 | (gchar *) "y", |
| 24012 | NULL |
| 24013 | }, |
| 24014 | FALSE |
| 24015 | }; |
| 24016 | |
| 24017 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] = |
| 24018 | { |
| 24019 | &_flash_control_signal_info_progress_ARG_filename, |
| 24020 | &_flash_control_signal_info_progress_ARG_progress, |
| 24021 | NULL |
| 24022 | }; |
| 24023 | |
| 24024 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress = |
| 24025 | { |
| 24026 | { |
| 24027 | -1, |
| 24028 | (gchar *) "Progress", |
| 24029 | (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers, |
| 24030 | NULL |
| 24031 | }, |
| 24032 | "progress" |
| 24033 | }; |
| 24034 | |
| 24035 | static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] = |
| 24036 | { |
| 24037 | &_flash_control_signal_info_done, |
| 24038 | &_flash_control_signal_info_error, |
| 24039 | &_flash_control_signal_info_progress, |
| 24040 | NULL |
| 24041 | }; |
| 24042 | |
| 24043 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename = |
| 24044 | { |
| 24045 | { |
| 24046 | -1, |
| 24047 | (gchar *) "filename", |
| 24048 | (gchar *) "s", |
| 24049 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24050 | NULL |
| 24051 | }, |
| 24052 | "filename", |
| 24053 | FALSE |
| 24054 | }; |
| 24055 | |
| 24056 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ = |
| 24057 | { |
| 24058 | { |
| 24059 | -1, |
| 24060 | (gchar *) "type", |
| 24061 | (gchar *) "s", |
| 24062 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24063 | NULL |
| 24064 | }, |
| 24065 | "type", |
| 24066 | FALSE |
| 24067 | }; |
| 24068 | |
| 24069 | static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] = |
| 24070 | { |
| 24071 | &_flash_control_property_info_filename, |
| 24072 | &_flash_control_property_info_type_, |
| 24073 | NULL |
| 24074 | }; |
| 24075 | |
| 24076 | static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info = |
| 24077 | { |
| 24078 | { |
| 24079 | -1, |
| 24080 | (gchar *) "org.openbmc.FlashControl", |
| 24081 | (GDBusMethodInfo **) &_flash_control_method_info_pointers, |
| 24082 | (GDBusSignalInfo **) &_flash_control_signal_info_pointers, |
| 24083 | (GDBusPropertyInfo **) &_flash_control_property_info_pointers, |
| 24084 | NULL |
| 24085 | }, |
| 24086 | "flash-control", |
| 24087 | }; |
| 24088 | |
| 24089 | |
| 24090 | /** |
| 24091 | * flash_control_interface_info: |
| 24092 | * |
| 24093 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface. |
| 24094 | * |
| 24095 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 24096 | */ |
| 24097 | GDBusInterfaceInfo * |
| 24098 | flash_control_interface_info (void) |
| 24099 | { |
| 24100 | return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct; |
| 24101 | } |
| 24102 | |
| 24103 | /** |
| 24104 | * flash_control_override_properties: |
| 24105 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 24106 | * @property_id_begin: The property id to assign to the first overridden property. |
| 24107 | * |
| 24108 | * Overrides all #GObject properties in the #FlashControl interface for a concrete class. |
| 24109 | * The properties are overridden in the order they are defined. |
| 24110 | * |
| 24111 | * Returns: The last property id. |
| 24112 | */ |
| 24113 | guint |
| 24114 | flash_control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 24115 | { |
| 24116 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 24117 | g_object_class_override_property (klass, property_id_begin++, "type"); |
| 24118 | return property_id_begin - 1; |
| 24119 | } |
| 24120 | |
| 24121 | |
| 24122 | |
| 24123 | /** |
| 24124 | * FlashControl: |
| 24125 | * |
| 24126 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 24127 | */ |
| 24128 | |
| 24129 | /** |
| 24130 | * FlashControlIface: |
| 24131 | * @parent_iface: The parent interface. |
| 24132 | * @handle_flash: Handler for the #FlashControl::handle-flash signal. |
| 24133 | * @get_filename: Getter for the #FlashControl:filename property. |
| 24134 | * @get_type_: Getter for the #FlashControl:type property. |
| 24135 | * @done: Handler for the #FlashControl::done signal. |
| 24136 | * @error: Handler for the #FlashControl::error signal. |
| 24137 | * @progress: Handler for the #FlashControl::progress signal. |
| 24138 | * |
| 24139 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 24140 | */ |
| 24141 | |
| 24142 | typedef FlashControlIface FlashControlInterface; |
| 24143 | G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT); |
| 24144 | |
| 24145 | static void |
| 24146 | flash_control_default_init (FlashControlIface *iface) |
| 24147 | { |
| 24148 | /* GObject signals for incoming D-Bus method calls: */ |
| 24149 | /** |
| 24150 | * FlashControl::handle-flash: |
| 24151 | * @object: A #FlashControl. |
| 24152 | * @invocation: A #GDBusMethodInvocation. |
| 24153 | * @arg_type: Argument passed by remote caller. |
| 24154 | * @arg_filename: Argument passed by remote caller. |
| 24155 | * |
| 24156 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. |
| 24157 | * |
| 24158 | * 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. |
| 24159 | * |
| 24160 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24161 | */ |
| 24162 | g_signal_new ("handle-flash", |
| 24163 | G_TYPE_FROM_INTERFACE (iface), |
| 24164 | G_SIGNAL_RUN_LAST, |
| 24165 | G_STRUCT_OFFSET (FlashControlIface, handle_flash), |
| 24166 | g_signal_accumulator_true_handled, |
| 24167 | NULL, |
| 24168 | g_cclosure_marshal_generic, |
| 24169 | G_TYPE_BOOLEAN, |
| 24170 | 3, |
| 24171 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 24172 | |
| 24173 | /* GObject signals for received D-Bus signals: */ |
| 24174 | /** |
| 24175 | * FlashControl::done: |
| 24176 | * @object: A #FlashControl. |
| 24177 | * @arg_filename: Argument. |
| 24178 | * |
| 24179 | * 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. |
| 24180 | * |
| 24181 | * 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. |
| 24182 | */ |
| 24183 | g_signal_new ("done", |
| 24184 | G_TYPE_FROM_INTERFACE (iface), |
| 24185 | G_SIGNAL_RUN_LAST, |
| 24186 | G_STRUCT_OFFSET (FlashControlIface, done), |
| 24187 | NULL, |
| 24188 | NULL, |
| 24189 | g_cclosure_marshal_generic, |
| 24190 | G_TYPE_NONE, |
| 24191 | 1, G_TYPE_STRING); |
| 24192 | |
| 24193 | /** |
| 24194 | * FlashControl::error: |
| 24195 | * @object: A #FlashControl. |
| 24196 | * @arg_filename: Argument. |
| 24197 | * |
| 24198 | * 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. |
| 24199 | * |
| 24200 | * 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. |
| 24201 | */ |
| 24202 | g_signal_new ("error", |
| 24203 | G_TYPE_FROM_INTERFACE (iface), |
| 24204 | G_SIGNAL_RUN_LAST, |
| 24205 | G_STRUCT_OFFSET (FlashControlIface, error), |
| 24206 | NULL, |
| 24207 | NULL, |
| 24208 | g_cclosure_marshal_generic, |
| 24209 | G_TYPE_NONE, |
| 24210 | 1, G_TYPE_STRING); |
| 24211 | |
| 24212 | /** |
| 24213 | * FlashControl::progress: |
| 24214 | * @object: A #FlashControl. |
| 24215 | * @arg_filename: Argument. |
| 24216 | * @arg_progress: Argument. |
| 24217 | * |
| 24218 | * 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. |
| 24219 | * |
| 24220 | * 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. |
| 24221 | */ |
| 24222 | g_signal_new ("progress", |
| 24223 | G_TYPE_FROM_INTERFACE (iface), |
| 24224 | G_SIGNAL_RUN_LAST, |
| 24225 | G_STRUCT_OFFSET (FlashControlIface, progress), |
| 24226 | NULL, |
| 24227 | NULL, |
| 24228 | g_cclosure_marshal_generic, |
| 24229 | G_TYPE_NONE, |
| 24230 | 2, G_TYPE_STRING, G_TYPE_UCHAR); |
| 24231 | |
| 24232 | /* GObject properties for D-Bus properties: */ |
| 24233 | /** |
| 24234 | * FlashControl:filename: |
| 24235 | * |
| 24236 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>. |
| 24237 | * |
| 24238 | * 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. |
| 24239 | */ |
| 24240 | g_object_interface_install_property (iface, |
| 24241 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 24242 | /** |
| 24243 | * FlashControl:type: |
| 24244 | * |
| 24245 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>. |
| 24246 | * |
| 24247 | * 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. |
| 24248 | */ |
| 24249 | g_object_interface_install_property (iface, |
| 24250 | g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 24251 | } |
| 24252 | |
| 24253 | /** |
| 24254 | * flash_control_get_filename: (skip) |
| 24255 | * @object: A #FlashControl. |
| 24256 | * |
| 24257 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 24258 | * |
| 24259 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24260 | * |
| 24261 | * <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> |
| 24262 | * |
| 24263 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 24264 | */ |
| 24265 | const gchar * |
| 24266 | flash_control_get_filename (FlashControl *object) |
| 24267 | { |
| 24268 | return FLASH_CONTROL_GET_IFACE (object)->get_filename (object); |
| 24269 | } |
| 24270 | |
| 24271 | /** |
| 24272 | * flash_control_dup_filename: (skip) |
| 24273 | * @object: A #FlashControl. |
| 24274 | * |
| 24275 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 24276 | * |
| 24277 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24278 | * |
| 24279 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 24280 | */ |
| 24281 | gchar * |
| 24282 | flash_control_dup_filename (FlashControl *object) |
| 24283 | { |
| 24284 | gchar *value; |
| 24285 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 24286 | return value; |
| 24287 | } |
| 24288 | |
| 24289 | /** |
| 24290 | * flash_control_set_filename: (skip) |
| 24291 | * @object: A #FlashControl. |
| 24292 | * @value: The value to set. |
| 24293 | * |
| 24294 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value. |
| 24295 | * |
| 24296 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 24297 | */ |
| 24298 | void |
| 24299 | flash_control_set_filename (FlashControl *object, const gchar *value) |
| 24300 | { |
| 24301 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 24302 | } |
| 24303 | |
| 24304 | /** |
| 24305 | * flash_control_get_type_: (skip) |
| 24306 | * @object: A #FlashControl. |
| 24307 | * |
| 24308 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 24309 | * |
| 24310 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24311 | * |
| 24312 | * <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> |
| 24313 | * |
| 24314 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 24315 | */ |
| 24316 | const gchar * |
| 24317 | flash_control_get_type_ (FlashControl *object) |
| 24318 | { |
| 24319 | return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object); |
| 24320 | } |
| 24321 | |
| 24322 | /** |
| 24323 | * flash_control_dup_type_: (skip) |
| 24324 | * @object: A #FlashControl. |
| 24325 | * |
| 24326 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 24327 | * |
| 24328 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24329 | * |
| 24330 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 24331 | */ |
| 24332 | gchar * |
| 24333 | flash_control_dup_type_ (FlashControl *object) |
| 24334 | { |
| 24335 | gchar *value; |
| 24336 | g_object_get (G_OBJECT (object), "type", &value, NULL); |
| 24337 | return value; |
| 24338 | } |
| 24339 | |
| 24340 | /** |
| 24341 | * flash_control_set_type_: (skip) |
| 24342 | * @object: A #FlashControl. |
| 24343 | * @value: The value to set. |
| 24344 | * |
| 24345 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value. |
| 24346 | * |
| 24347 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 24348 | */ |
| 24349 | void |
| 24350 | flash_control_set_type_ (FlashControl *object, const gchar *value) |
| 24351 | { |
| 24352 | g_object_set (G_OBJECT (object), "type", value, NULL); |
| 24353 | } |
| 24354 | |
| 24355 | /** |
| 24356 | * flash_control_emit_done: |
| 24357 | * @object: A #FlashControl. |
| 24358 | * @arg_filename: Argument to pass with the signal. |
| 24359 | * |
| 24360 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal. |
| 24361 | */ |
| 24362 | void |
| 24363 | flash_control_emit_done ( |
| 24364 | FlashControl *object, |
| 24365 | const gchar *arg_filename) |
| 24366 | { |
| 24367 | g_signal_emit_by_name (object, "done", arg_filename); |
| 24368 | } |
| 24369 | |
| 24370 | /** |
| 24371 | * flash_control_emit_error: |
| 24372 | * @object: A #FlashControl. |
| 24373 | * @arg_filename: Argument to pass with the signal. |
| 24374 | * |
| 24375 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal. |
| 24376 | */ |
| 24377 | void |
| 24378 | flash_control_emit_error ( |
| 24379 | FlashControl *object, |
| 24380 | const gchar *arg_filename) |
| 24381 | { |
| 24382 | g_signal_emit_by_name (object, "error", arg_filename); |
| 24383 | } |
| 24384 | |
| 24385 | /** |
| 24386 | * flash_control_emit_progress: |
| 24387 | * @object: A #FlashControl. |
| 24388 | * @arg_filename: Argument to pass with the signal. |
| 24389 | * @arg_progress: Argument to pass with the signal. |
| 24390 | * |
| 24391 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal. |
| 24392 | */ |
| 24393 | void |
| 24394 | flash_control_emit_progress ( |
| 24395 | FlashControl *object, |
| 24396 | const gchar *arg_filename, |
| 24397 | guchar arg_progress) |
| 24398 | { |
| 24399 | g_signal_emit_by_name (object, "progress", arg_filename, arg_progress); |
| 24400 | } |
| 24401 | |
| 24402 | /** |
| 24403 | * flash_control_call_flash: |
| 24404 | * @proxy: A #FlashControlProxy. |
| 24405 | * @arg_type: Argument to pass with the method invocation. |
| 24406 | * @arg_filename: Argument to pass with the method invocation. |
| 24407 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24408 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24409 | * @user_data: User data to pass to @callback. |
| 24410 | * |
| 24411 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. |
| 24412 | * 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. |
| 24413 | * You can then call flash_control_call_flash_finish() to get the result of the operation. |
| 24414 | * |
| 24415 | * See flash_control_call_flash_sync() for the synchronous, blocking version of this method. |
| 24416 | */ |
| 24417 | void |
| 24418 | flash_control_call_flash ( |
| 24419 | FlashControl *proxy, |
| 24420 | const gchar *arg_type, |
| 24421 | const gchar *arg_filename, |
| 24422 | GCancellable *cancellable, |
| 24423 | GAsyncReadyCallback callback, |
| 24424 | gpointer user_data) |
| 24425 | { |
| 24426 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24427 | "flash", |
| 24428 | g_variant_new ("(ss)", |
| 24429 | arg_type, |
| 24430 | arg_filename), |
| 24431 | G_DBUS_CALL_FLAGS_NONE, |
| 24432 | -1, |
| 24433 | cancellable, |
| 24434 | callback, |
| 24435 | user_data); |
| 24436 | } |
| 24437 | |
| 24438 | /** |
| 24439 | * flash_control_call_flash_finish: |
| 24440 | * @proxy: A #FlashControlProxy. |
| 24441 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash(). |
| 24442 | * @error: Return location for error or %NULL. |
| 24443 | * |
| 24444 | * Finishes an operation started with flash_control_call_flash(). |
| 24445 | * |
| 24446 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24447 | */ |
| 24448 | gboolean |
| 24449 | flash_control_call_flash_finish ( |
| 24450 | FlashControl *proxy, |
| 24451 | GAsyncResult *res, |
| 24452 | GError **error) |
| 24453 | { |
| 24454 | GVariant *_ret; |
| 24455 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24456 | if (_ret == NULL) |
| 24457 | goto _out; |
| 24458 | g_variant_get (_ret, |
| 24459 | "()"); |
| 24460 | g_variant_unref (_ret); |
| 24461 | _out: |
| 24462 | return _ret != NULL; |
| 24463 | } |
| 24464 | |
| 24465 | /** |
| 24466 | * flash_control_call_flash_sync: |
| 24467 | * @proxy: A #FlashControlProxy. |
| 24468 | * @arg_type: Argument to pass with the method invocation. |
| 24469 | * @arg_filename: Argument to pass with the method invocation. |
| 24470 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24471 | * @error: Return location for error or %NULL. |
| 24472 | * |
| 24473 | * 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. |
| 24474 | * |
| 24475 | * See flash_control_call_flash() for the asynchronous version of this method. |
| 24476 | * |
| 24477 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24478 | */ |
| 24479 | gboolean |
| 24480 | flash_control_call_flash_sync ( |
| 24481 | FlashControl *proxy, |
| 24482 | const gchar *arg_type, |
| 24483 | const gchar *arg_filename, |
| 24484 | GCancellable *cancellable, |
| 24485 | GError **error) |
| 24486 | { |
| 24487 | GVariant *_ret; |
| 24488 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24489 | "flash", |
| 24490 | g_variant_new ("(ss)", |
| 24491 | arg_type, |
| 24492 | arg_filename), |
| 24493 | G_DBUS_CALL_FLAGS_NONE, |
| 24494 | -1, |
| 24495 | cancellable, |
| 24496 | error); |
| 24497 | if (_ret == NULL) |
| 24498 | goto _out; |
| 24499 | g_variant_get (_ret, |
| 24500 | "()"); |
| 24501 | g_variant_unref (_ret); |
| 24502 | _out: |
| 24503 | return _ret != NULL; |
| 24504 | } |
| 24505 | |
| 24506 | /** |
| 24507 | * flash_control_complete_flash: |
| 24508 | * @object: A #FlashControl. |
| 24509 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 24510 | * |
| 24511 | * 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. |
| 24512 | * |
| 24513 | * This method will free @invocation, you cannot use it afterwards. |
| 24514 | */ |
| 24515 | void |
| 24516 | flash_control_complete_flash ( |
| 24517 | FlashControl *object, |
| 24518 | GDBusMethodInvocation *invocation) |
| 24519 | { |
| 24520 | g_dbus_method_invocation_return_value (invocation, |
| 24521 | g_variant_new ("()")); |
| 24522 | } |
| 24523 | |
| 24524 | /* ------------------------------------------------------------------------ */ |
| 24525 | |
| 24526 | /** |
| 24527 | * FlashControlProxy: |
| 24528 | * |
| 24529 | * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API. |
| 24530 | */ |
| 24531 | |
| 24532 | /** |
| 24533 | * FlashControlProxyClass: |
| 24534 | * @parent_class: The parent class. |
| 24535 | * |
| 24536 | * Class structure for #FlashControlProxy. |
| 24537 | */ |
| 24538 | |
| 24539 | struct _FlashControlProxyPrivate |
| 24540 | { |
| 24541 | GData *qdata; |
| 24542 | }; |
| 24543 | |
| 24544 | static void flash_control_proxy_iface_init (FlashControlIface *iface); |
| 24545 | |
| 24546 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 24547 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 24548 | G_ADD_PRIVATE (FlashControlProxy) |
| 24549 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 24550 | |
| 24551 | #else |
| 24552 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 24553 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 24554 | |
| 24555 | #endif |
| 24556 | static void |
| 24557 | flash_control_proxy_finalize (GObject *object) |
| 24558 | { |
| 24559 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 24560 | g_datalist_clear (&proxy->priv->qdata); |
| 24561 | G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object); |
| 24562 | } |
| 24563 | |
| 24564 | static void |
| 24565 | flash_control_proxy_get_property (GObject *object, |
| 24566 | guint prop_id, |
| 24567 | GValue *value, |
| 24568 | GParamSpec *pspec G_GNUC_UNUSED) |
| 24569 | { |
| 24570 | const _ExtendedGDBusPropertyInfo *info; |
| 24571 | GVariant *variant; |
| 24572 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 24573 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 24574 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 24575 | if (info->use_gvariant) |
| 24576 | { |
| 24577 | g_value_set_variant (value, variant); |
| 24578 | } |
| 24579 | else |
| 24580 | { |
| 24581 | if (variant != NULL) |
| 24582 | g_dbus_gvariant_to_gvalue (variant, value); |
| 24583 | } |
| 24584 | if (variant != NULL) |
| 24585 | g_variant_unref (variant); |
| 24586 | } |
| 24587 | |
| 24588 | static void |
| 24589 | flash_control_proxy_set_property_cb (GDBusProxy *proxy, |
| 24590 | GAsyncResult *res, |
| 24591 | gpointer user_data) |
| 24592 | { |
| 24593 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 24594 | GError *error; |
| 24595 | GVariant *_ret; |
| 24596 | error = NULL; |
| 24597 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 24598 | if (!_ret) |
| 24599 | { |
| 24600 | g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)", |
| 24601 | info->parent_struct.name, |
| 24602 | error->message, g_quark_to_string (error->domain), error->code); |
| 24603 | g_error_free (error); |
| 24604 | } |
| 24605 | else |
| 24606 | { |
| 24607 | g_variant_unref (_ret); |
| 24608 | } |
| 24609 | } |
| 24610 | |
| 24611 | static void |
| 24612 | flash_control_proxy_set_property (GObject *object, |
| 24613 | guint prop_id, |
| 24614 | const GValue *value, |
| 24615 | GParamSpec *pspec G_GNUC_UNUSED) |
| 24616 | { |
| 24617 | const _ExtendedGDBusPropertyInfo *info; |
| 24618 | GVariant *variant; |
| 24619 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 24620 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 24621 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 24622 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 24623 | "org.freedesktop.DBus.Properties.Set", |
| 24624 | g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant), |
| 24625 | G_DBUS_CALL_FLAGS_NONE, |
| 24626 | -1, |
| 24627 | NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 24628 | g_variant_unref (variant); |
| 24629 | } |
| 24630 | |
| 24631 | static void |
| 24632 | flash_control_proxy_g_signal (GDBusProxy *proxy, |
| 24633 | const gchar *sender_name G_GNUC_UNUSED, |
| 24634 | const gchar *signal_name, |
| 24635 | GVariant *parameters) |
| 24636 | { |
| 24637 | _ExtendedGDBusSignalInfo *info; |
| 24638 | GVariantIter iter; |
| 24639 | GVariant *child; |
| 24640 | GValue *paramv; |
| 24641 | guint num_params; |
| 24642 | guint n; |
| 24643 | guint signal_id; |
| 24644 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name); |
| 24645 | if (info == NULL) |
| 24646 | return; |
| 24647 | num_params = g_variant_n_children (parameters); |
| 24648 | paramv = g_new0 (GValue, num_params + 1); |
| 24649 | g_value_init (¶mv[0], TYPE_FLASH_CONTROL); |
| 24650 | g_value_set_object (¶mv[0], proxy); |
| 24651 | g_variant_iter_init (&iter, parameters); |
| 24652 | n = 1; |
| 24653 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 24654 | { |
| 24655 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 24656 | if (arg_info->use_gvariant) |
| 24657 | { |
| 24658 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 24659 | g_value_set_variant (¶mv[n], child); |
| 24660 | n++; |
| 24661 | } |
| 24662 | else |
| 24663 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 24664 | g_variant_unref (child); |
| 24665 | } |
| 24666 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 24667 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 24668 | for (n = 0; n < num_params + 1; n++) |
| 24669 | g_value_unset (¶mv[n]); |
| 24670 | g_free (paramv); |
| 24671 | } |
| 24672 | |
| 24673 | static void |
| 24674 | flash_control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 24675 | GVariant *changed_properties, |
| 24676 | const gchar *const *invalidated_properties) |
| 24677 | { |
| 24678 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy); |
| 24679 | guint n; |
| 24680 | const gchar *key; |
| 24681 | GVariantIter *iter; |
| 24682 | _ExtendedGDBusPropertyInfo *info; |
| 24683 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 24684 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 24685 | { |
| 24686 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key); |
| 24687 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 24688 | if (info != NULL) |
| 24689 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 24690 | } |
| 24691 | g_variant_iter_free (iter); |
| 24692 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 24693 | { |
| 24694 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]); |
| 24695 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 24696 | if (info != NULL) |
| 24697 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 24698 | } |
| 24699 | } |
| 24700 | |
| 24701 | static const gchar * |
| 24702 | flash_control_proxy_get_filename (FlashControl *object) |
| 24703 | { |
| 24704 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 24705 | GVariant *variant; |
| 24706 | const gchar *value = NULL; |
| 24707 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 24708 | if (variant != NULL) |
| 24709 | { |
| 24710 | value = g_variant_get_string (variant, NULL); |
| 24711 | g_variant_unref (variant); |
| 24712 | } |
| 24713 | return value; |
| 24714 | } |
| 24715 | |
| 24716 | static const gchar * |
| 24717 | flash_control_proxy_get_type_ (FlashControl *object) |
| 24718 | { |
| 24719 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 24720 | GVariant *variant; |
| 24721 | const gchar *value = NULL; |
| 24722 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type"); |
| 24723 | if (variant != NULL) |
| 24724 | { |
| 24725 | value = g_variant_get_string (variant, NULL); |
| 24726 | g_variant_unref (variant); |
| 24727 | } |
| 24728 | return value; |
| 24729 | } |
| 24730 | |
| 24731 | static void |
| 24732 | flash_control_proxy_init (FlashControlProxy *proxy) |
| 24733 | { |
| 24734 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 24735 | proxy->priv = flash_control_proxy_get_instance_private (proxy); |
| 24736 | #else |
| 24737 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate); |
| 24738 | #endif |
| 24739 | |
| 24740 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ()); |
| 24741 | } |
| 24742 | |
| 24743 | static void |
| 24744 | flash_control_proxy_class_init (FlashControlProxyClass *klass) |
| 24745 | { |
| 24746 | GObjectClass *gobject_class; |
| 24747 | GDBusProxyClass *proxy_class; |
| 24748 | |
| 24749 | gobject_class = G_OBJECT_CLASS (klass); |
| 24750 | gobject_class->finalize = flash_control_proxy_finalize; |
| 24751 | gobject_class->get_property = flash_control_proxy_get_property; |
| 24752 | gobject_class->set_property = flash_control_proxy_set_property; |
| 24753 | |
| 24754 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 24755 | proxy_class->g_signal = flash_control_proxy_g_signal; |
| 24756 | proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed; |
| 24757 | |
| 24758 | flash_control_override_properties (gobject_class, 1); |
| 24759 | |
| 24760 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 24761 | g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate)); |
| 24762 | #endif |
| 24763 | } |
| 24764 | |
| 24765 | static void |
| 24766 | flash_control_proxy_iface_init (FlashControlIface *iface) |
| 24767 | { |
| 24768 | iface->get_filename = flash_control_proxy_get_filename; |
| 24769 | iface->get_type_ = flash_control_proxy_get_type_; |
| 24770 | } |
| 24771 | |
| 24772 | /** |
| 24773 | * flash_control_proxy_new: |
| 24774 | * @connection: A #GDBusConnection. |
| 24775 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 24776 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 24777 | * @object_path: An object path. |
| 24778 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24779 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 24780 | * @user_data: User data to pass to @callback. |
| 24781 | * |
| 24782 | * 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. |
| 24783 | * |
| 24784 | * 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. |
| 24785 | * You can then call flash_control_proxy_new_finish() to get the result of the operation. |
| 24786 | * |
| 24787 | * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 24788 | */ |
| 24789 | void |
| 24790 | flash_control_proxy_new ( |
| 24791 | GDBusConnection *connection, |
| 24792 | GDBusProxyFlags flags, |
| 24793 | const gchar *name, |
| 24794 | const gchar *object_path, |
| 24795 | GCancellable *cancellable, |
| 24796 | GAsyncReadyCallback callback, |
| 24797 | gpointer user_data) |
| 24798 | { |
| 24799 | 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); |
| 24800 | } |
| 24801 | |
| 24802 | /** |
| 24803 | * flash_control_proxy_new_finish: |
| 24804 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new(). |
| 24805 | * @error: Return location for error or %NULL |
| 24806 | * |
| 24807 | * Finishes an operation started with flash_control_proxy_new(). |
| 24808 | * |
| 24809 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 24810 | */ |
| 24811 | FlashControl * |
| 24812 | flash_control_proxy_new_finish ( |
| 24813 | GAsyncResult *res, |
| 24814 | GError **error) |
| 24815 | { |
| 24816 | GObject *ret; |
| 24817 | GObject *source_object; |
| 24818 | source_object = g_async_result_get_source_object (res); |
| 24819 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 24820 | g_object_unref (source_object); |
| 24821 | if (ret != NULL) |
| 24822 | return FLASH_CONTROL (ret); |
| 24823 | else |
| 24824 | return NULL; |
| 24825 | } |
| 24826 | |
| 24827 | /** |
| 24828 | * flash_control_proxy_new_sync: |
| 24829 | * @connection: A #GDBusConnection. |
| 24830 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 24831 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 24832 | * @object_path: An object path. |
| 24833 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24834 | * @error: Return location for error or %NULL |
| 24835 | * |
| 24836 | * 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. |
| 24837 | * |
| 24838 | * The calling thread is blocked until a reply is received. |
| 24839 | * |
| 24840 | * See flash_control_proxy_new() for the asynchronous version of this constructor. |
| 24841 | * |
| 24842 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 24843 | */ |
| 24844 | FlashControl * |
| 24845 | flash_control_proxy_new_sync ( |
| 24846 | GDBusConnection *connection, |
| 24847 | GDBusProxyFlags flags, |
| 24848 | const gchar *name, |
| 24849 | const gchar *object_path, |
| 24850 | GCancellable *cancellable, |
| 24851 | GError **error) |
| 24852 | { |
| 24853 | GInitable *ret; |
| 24854 | 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); |
| 24855 | if (ret != NULL) |
| 24856 | return FLASH_CONTROL (ret); |
| 24857 | else |
| 24858 | return NULL; |
| 24859 | } |
| 24860 | |
| 24861 | |
| 24862 | /** |
| 24863 | * flash_control_proxy_new_for_bus: |
| 24864 | * @bus_type: A #GBusType. |
| 24865 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 24866 | * @name: A bus name (well-known or unique). |
| 24867 | * @object_path: An object path. |
| 24868 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24869 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 24870 | * @user_data: User data to pass to @callback. |
| 24871 | * |
| 24872 | * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 24873 | * |
| 24874 | * 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. |
| 24875 | * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation. |
| 24876 | * |
| 24877 | * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 24878 | */ |
| 24879 | void |
| 24880 | flash_control_proxy_new_for_bus ( |
| 24881 | GBusType bus_type, |
| 24882 | GDBusProxyFlags flags, |
| 24883 | const gchar *name, |
| 24884 | const gchar *object_path, |
| 24885 | GCancellable *cancellable, |
| 24886 | GAsyncReadyCallback callback, |
| 24887 | gpointer user_data) |
| 24888 | { |
| 24889 | 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); |
| 24890 | } |
| 24891 | |
| 24892 | /** |
| 24893 | * flash_control_proxy_new_for_bus_finish: |
| 24894 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus(). |
| 24895 | * @error: Return location for error or %NULL |
| 24896 | * |
| 24897 | * Finishes an operation started with flash_control_proxy_new_for_bus(). |
| 24898 | * |
| 24899 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 24900 | */ |
| 24901 | FlashControl * |
| 24902 | flash_control_proxy_new_for_bus_finish ( |
| 24903 | GAsyncResult *res, |
| 24904 | GError **error) |
| 24905 | { |
| 24906 | GObject *ret; |
| 24907 | GObject *source_object; |
| 24908 | source_object = g_async_result_get_source_object (res); |
| 24909 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 24910 | g_object_unref (source_object); |
| 24911 | if (ret != NULL) |
| 24912 | return FLASH_CONTROL (ret); |
| 24913 | else |
| 24914 | return NULL; |
| 24915 | } |
| 24916 | |
| 24917 | /** |
| 24918 | * flash_control_proxy_new_for_bus_sync: |
| 24919 | * @bus_type: A #GBusType. |
| 24920 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 24921 | * @name: A bus name (well-known or unique). |
| 24922 | * @object_path: An object path. |
| 24923 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24924 | * @error: Return location for error or %NULL |
| 24925 | * |
| 24926 | * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 24927 | * |
| 24928 | * The calling thread is blocked until a reply is received. |
| 24929 | * |
| 24930 | * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 24931 | * |
| 24932 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 24933 | */ |
| 24934 | FlashControl * |
| 24935 | flash_control_proxy_new_for_bus_sync ( |
| 24936 | GBusType bus_type, |
| 24937 | GDBusProxyFlags flags, |
| 24938 | const gchar *name, |
| 24939 | const gchar *object_path, |
| 24940 | GCancellable *cancellable, |
| 24941 | GError **error) |
| 24942 | { |
| 24943 | GInitable *ret; |
| 24944 | 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); |
| 24945 | if (ret != NULL) |
| 24946 | return FLASH_CONTROL (ret); |
| 24947 | else |
| 24948 | return NULL; |
| 24949 | } |
| 24950 | |
| 24951 | |
| 24952 | /* ------------------------------------------------------------------------ */ |
| 24953 | |
| 24954 | /** |
| 24955 | * FlashControlSkeleton: |
| 24956 | * |
| 24957 | * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 24958 | */ |
| 24959 | |
| 24960 | /** |
| 24961 | * FlashControlSkeletonClass: |
| 24962 | * @parent_class: The parent class. |
| 24963 | * |
| 24964 | * Class structure for #FlashControlSkeleton. |
| 24965 | */ |
| 24966 | |
| 24967 | struct _FlashControlSkeletonPrivate |
| 24968 | { |
| 24969 | GValue *properties; |
| 24970 | GList *changed_properties; |
| 24971 | GSource *changed_properties_idle_source; |
| 24972 | GMainContext *context; |
| 24973 | GMutex lock; |
| 24974 | }; |
| 24975 | |
| 24976 | static void |
| 24977 | _flash_control_skeleton_handle_method_call ( |
| 24978 | GDBusConnection *connection G_GNUC_UNUSED, |
| 24979 | const gchar *sender G_GNUC_UNUSED, |
| 24980 | const gchar *object_path G_GNUC_UNUSED, |
| 24981 | const gchar *interface_name, |
| 24982 | const gchar *method_name, |
| 24983 | GVariant *parameters, |
| 24984 | GDBusMethodInvocation *invocation, |
| 24985 | gpointer user_data) |
| 24986 | { |
| 24987 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 24988 | _ExtendedGDBusMethodInfo *info; |
| 24989 | GVariantIter iter; |
| 24990 | GVariant *child; |
| 24991 | GValue *paramv; |
| 24992 | guint num_params; |
| 24993 | guint num_extra; |
| 24994 | guint n; |
| 24995 | guint signal_id; |
| 24996 | GValue return_value = G_VALUE_INIT; |
| 24997 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 24998 | g_assert (info != NULL); |
| 24999 | num_params = g_variant_n_children (parameters); |
| 25000 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 25001 | n = 0; |
| 25002 | g_value_init (¶mv[n], TYPE_FLASH_CONTROL); |
| 25003 | g_value_set_object (¶mv[n++], skeleton); |
| 25004 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 25005 | g_value_set_object (¶mv[n++], invocation); |
| 25006 | if (info->pass_fdlist) |
| 25007 | { |
| 25008 | #ifdef G_OS_UNIX |
| 25009 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 25010 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 25011 | #else |
| 25012 | g_assert_not_reached (); |
| 25013 | #endif |
| 25014 | } |
| 25015 | g_variant_iter_init (&iter, parameters); |
| 25016 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 25017 | { |
| 25018 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 25019 | if (arg_info->use_gvariant) |
| 25020 | { |
| 25021 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 25022 | g_value_set_variant (¶mv[n], child); |
| 25023 | n++; |
| 25024 | } |
| 25025 | else |
| 25026 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 25027 | g_variant_unref (child); |
| 25028 | } |
| 25029 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 25030 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 25031 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 25032 | if (!g_value_get_boolean (&return_value)) |
| 25033 | 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); |
| 25034 | g_value_unset (&return_value); |
| 25035 | for (n = 0; n < num_params + num_extra; n++) |
| 25036 | g_value_unset (¶mv[n]); |
| 25037 | g_free (paramv); |
| 25038 | } |
| 25039 | |
| 25040 | static GVariant * |
| 25041 | _flash_control_skeleton_handle_get_property ( |
| 25042 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25043 | const gchar *sender G_GNUC_UNUSED, |
| 25044 | const gchar *object_path G_GNUC_UNUSED, |
| 25045 | const gchar *interface_name G_GNUC_UNUSED, |
| 25046 | const gchar *property_name, |
| 25047 | GError **error, |
| 25048 | gpointer user_data) |
| 25049 | { |
| 25050 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 25051 | GValue value = G_VALUE_INIT; |
| 25052 | GParamSpec *pspec; |
| 25053 | _ExtendedGDBusPropertyInfo *info; |
| 25054 | GVariant *ret; |
| 25055 | ret = NULL; |
| 25056 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 25057 | g_assert (info != NULL); |
| 25058 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25059 | if (pspec == NULL) |
| 25060 | { |
| 25061 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25062 | } |
| 25063 | else |
| 25064 | { |
| 25065 | g_value_init (&value, pspec->value_type); |
| 25066 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25067 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 25068 | g_value_unset (&value); |
| 25069 | } |
| 25070 | return ret; |
| 25071 | } |
| 25072 | |
| 25073 | static gboolean |
| 25074 | _flash_control_skeleton_handle_set_property ( |
| 25075 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25076 | const gchar *sender G_GNUC_UNUSED, |
| 25077 | const gchar *object_path G_GNUC_UNUSED, |
| 25078 | const gchar *interface_name G_GNUC_UNUSED, |
| 25079 | const gchar *property_name, |
| 25080 | GVariant *variant, |
| 25081 | GError **error, |
| 25082 | gpointer user_data) |
| 25083 | { |
| 25084 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 25085 | GValue value = G_VALUE_INIT; |
| 25086 | GParamSpec *pspec; |
| 25087 | _ExtendedGDBusPropertyInfo *info; |
| 25088 | gboolean ret; |
| 25089 | ret = FALSE; |
| 25090 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 25091 | g_assert (info != NULL); |
| 25092 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25093 | if (pspec == NULL) |
| 25094 | { |
| 25095 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25096 | } |
| 25097 | else |
| 25098 | { |
| 25099 | if (info->use_gvariant) |
| 25100 | g_value_set_variant (&value, variant); |
| 25101 | else |
| 25102 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 25103 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25104 | g_value_unset (&value); |
| 25105 | ret = TRUE; |
| 25106 | } |
| 25107 | return ret; |
| 25108 | } |
| 25109 | |
| 25110 | static const GDBusInterfaceVTable _flash_control_skeleton_vtable = |
| 25111 | { |
| 25112 | _flash_control_skeleton_handle_method_call, |
| 25113 | _flash_control_skeleton_handle_get_property, |
| 25114 | _flash_control_skeleton_handle_set_property, |
| 25115 | {NULL} |
| 25116 | }; |
| 25117 | |
| 25118 | static GDBusInterfaceInfo * |
| 25119 | flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25120 | { |
| 25121 | return flash_control_interface_info (); |
| 25122 | } |
| 25123 | |
| 25124 | static GDBusInterfaceVTable * |
| 25125 | flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25126 | { |
| 25127 | return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable; |
| 25128 | } |
| 25129 | |
| 25130 | static GVariant * |
| 25131 | flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 25132 | { |
| 25133 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 25134 | |
| 25135 | GVariantBuilder builder; |
| 25136 | guint n; |
| 25137 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25138 | if (_flash_control_interface_info.parent_struct.properties == NULL) |
| 25139 | goto out; |
| 25140 | for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 25141 | { |
| 25142 | GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n]; |
| 25143 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 25144 | { |
| 25145 | GVariant *value; |
| 25146 | 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); |
| 25147 | if (value != NULL) |
| 25148 | { |
| 25149 | g_variant_take_ref (value); |
| 25150 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 25151 | g_variant_unref (value); |
| 25152 | } |
| 25153 | } |
| 25154 | } |
| 25155 | out: |
| 25156 | return g_variant_builder_end (&builder); |
| 25157 | } |
| 25158 | |
| 25159 | static gboolean _flash_control_emit_changed (gpointer user_data); |
| 25160 | |
| 25161 | static void |
| 25162 | flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 25163 | { |
| 25164 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 25165 | gboolean emit_changed = FALSE; |
| 25166 | |
| 25167 | g_mutex_lock (&skeleton->priv->lock); |
| 25168 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25169 | { |
| 25170 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25171 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25172 | emit_changed = TRUE; |
| 25173 | } |
| 25174 | g_mutex_unlock (&skeleton->priv->lock); |
| 25175 | |
| 25176 | if (emit_changed) |
| 25177 | _flash_control_emit_changed (skeleton); |
| 25178 | } |
| 25179 | |
| 25180 | static void |
| 25181 | _flash_control_on_signal_done ( |
| 25182 | FlashControl *object, |
| 25183 | const gchar *arg_filename) |
| 25184 | { |
| 25185 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25186 | |
| 25187 | GList *connections, *l; |
| 25188 | GVariant *signal_variant; |
| 25189 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25190 | |
| 25191 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 25192 | arg_filename)); |
| 25193 | for (l = connections; l != NULL; l = l->next) |
| 25194 | { |
| 25195 | GDBusConnection *connection = l->data; |
| 25196 | g_dbus_connection_emit_signal (connection, |
| 25197 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done", |
| 25198 | signal_variant, NULL); |
| 25199 | } |
| 25200 | g_variant_unref (signal_variant); |
| 25201 | g_list_free_full (connections, g_object_unref); |
| 25202 | } |
| 25203 | |
| 25204 | static void |
| 25205 | _flash_control_on_signal_error ( |
| 25206 | FlashControl *object, |
| 25207 | const gchar *arg_filename) |
| 25208 | { |
| 25209 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25210 | |
| 25211 | GList *connections, *l; |
| 25212 | GVariant *signal_variant; |
| 25213 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25214 | |
| 25215 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 25216 | arg_filename)); |
| 25217 | for (l = connections; l != NULL; l = l->next) |
| 25218 | { |
| 25219 | GDBusConnection *connection = l->data; |
| 25220 | g_dbus_connection_emit_signal (connection, |
| 25221 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error", |
| 25222 | signal_variant, NULL); |
| 25223 | } |
| 25224 | g_variant_unref (signal_variant); |
| 25225 | g_list_free_full (connections, g_object_unref); |
| 25226 | } |
| 25227 | |
| 25228 | static void |
| 25229 | _flash_control_on_signal_progress ( |
| 25230 | FlashControl *object, |
| 25231 | const gchar *arg_filename, |
| 25232 | guchar arg_progress) |
| 25233 | { |
| 25234 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25235 | |
| 25236 | GList *connections, *l; |
| 25237 | GVariant *signal_variant; |
| 25238 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25239 | |
| 25240 | signal_variant = g_variant_ref_sink (g_variant_new ("(sy)", |
| 25241 | arg_filename, |
| 25242 | arg_progress)); |
| 25243 | for (l = connections; l != NULL; l = l->next) |
| 25244 | { |
| 25245 | GDBusConnection *connection = l->data; |
| 25246 | g_dbus_connection_emit_signal (connection, |
| 25247 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress", |
| 25248 | signal_variant, NULL); |
| 25249 | } |
| 25250 | g_variant_unref (signal_variant); |
| 25251 | g_list_free_full (connections, g_object_unref); |
| 25252 | } |
| 25253 | |
| 25254 | static void flash_control_skeleton_iface_init (FlashControlIface *iface); |
| 25255 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25256 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25257 | G_ADD_PRIVATE (FlashControlSkeleton) |
| 25258 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 25259 | |
| 25260 | #else |
| 25261 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25262 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 25263 | |
| 25264 | #endif |
| 25265 | static void |
| 25266 | flash_control_skeleton_finalize (GObject *object) |
| 25267 | { |
| 25268 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25269 | guint n; |
| 25270 | for (n = 0; n < 2; n++) |
| 25271 | g_value_unset (&skeleton->priv->properties[n]); |
| 25272 | g_free (skeleton->priv->properties); |
| 25273 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25274 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25275 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25276 | g_main_context_unref (skeleton->priv->context); |
| 25277 | g_mutex_clear (&skeleton->priv->lock); |
| 25278 | G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object); |
| 25279 | } |
| 25280 | |
| 25281 | static void |
| 25282 | flash_control_skeleton_get_property (GObject *object, |
| 25283 | guint prop_id, |
| 25284 | GValue *value, |
| 25285 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25286 | { |
| 25287 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25288 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25289 | g_mutex_lock (&skeleton->priv->lock); |
| 25290 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 25291 | g_mutex_unlock (&skeleton->priv->lock); |
| 25292 | } |
| 25293 | |
| 25294 | static gboolean |
| 25295 | _flash_control_emit_changed (gpointer user_data) |
| 25296 | { |
| 25297 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 25298 | GList *l; |
| 25299 | GVariantBuilder builder; |
| 25300 | GVariantBuilder invalidated_builder; |
| 25301 | guint num_changes; |
| 25302 | |
| 25303 | g_mutex_lock (&skeleton->priv->lock); |
| 25304 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25305 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 25306 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 25307 | { |
| 25308 | ChangedProperty *cp = l->data; |
| 25309 | GVariant *variant; |
| 25310 | const GValue *cur_value; |
| 25311 | |
| 25312 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 25313 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 25314 | { |
| 25315 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 25316 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 25317 | g_variant_unref (variant); |
| 25318 | num_changes++; |
| 25319 | } |
| 25320 | } |
| 25321 | if (num_changes > 0) |
| 25322 | { |
| 25323 | GList *connections, *ll; |
| 25324 | GVariant *signal_variant; |
| 25325 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl", |
| 25326 | &builder, &invalidated_builder)); |
| 25327 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25328 | for (ll = connections; ll != NULL; ll = ll->next) |
| 25329 | { |
| 25330 | GDBusConnection *connection = ll->data; |
| 25331 | |
| 25332 | g_dbus_connection_emit_signal (connection, |
| 25333 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 25334 | "org.freedesktop.DBus.Properties", |
| 25335 | "PropertiesChanged", |
| 25336 | signal_variant, |
| 25337 | NULL); |
| 25338 | } |
| 25339 | g_variant_unref (signal_variant); |
| 25340 | g_list_free_full (connections, g_object_unref); |
| 25341 | } |
| 25342 | else |
| 25343 | { |
| 25344 | g_variant_builder_clear (&builder); |
| 25345 | g_variant_builder_clear (&invalidated_builder); |
| 25346 | } |
| 25347 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25348 | skeleton->priv->changed_properties = NULL; |
| 25349 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25350 | g_mutex_unlock (&skeleton->priv->lock); |
| 25351 | return FALSE; |
| 25352 | } |
| 25353 | |
| 25354 | static void |
| 25355 | _flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 25356 | { |
| 25357 | ChangedProperty *cp; |
| 25358 | GList *l; |
| 25359 | cp = NULL; |
| 25360 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 25361 | { |
| 25362 | ChangedProperty *i_cp = l->data; |
| 25363 | if (i_cp->info == info) |
| 25364 | { |
| 25365 | cp = i_cp; |
| 25366 | break; |
| 25367 | } |
| 25368 | } |
| 25369 | if (cp == NULL) |
| 25370 | { |
| 25371 | cp = g_new0 (ChangedProperty, 1); |
| 25372 | cp->prop_id = prop_id; |
| 25373 | cp->info = info; |
| 25374 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 25375 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 25376 | g_value_copy (orig_value, &cp->orig_value); |
| 25377 | } |
| 25378 | } |
| 25379 | |
| 25380 | static void |
| 25381 | flash_control_skeleton_notify (GObject *object, |
| 25382 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25383 | { |
| 25384 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25385 | g_mutex_lock (&skeleton->priv->lock); |
| 25386 | if (skeleton->priv->changed_properties != NULL && |
| 25387 | skeleton->priv->changed_properties_idle_source == NULL) |
| 25388 | { |
| 25389 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 25390 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 25391 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 25392 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 25393 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 25394 | } |
| 25395 | g_mutex_unlock (&skeleton->priv->lock); |
| 25396 | } |
| 25397 | |
| 25398 | static void |
| 25399 | flash_control_skeleton_set_property (GObject *object, |
| 25400 | guint prop_id, |
| 25401 | const GValue *value, |
| 25402 | GParamSpec *pspec) |
| 25403 | { |
| 25404 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25405 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 25406 | g_mutex_lock (&skeleton->priv->lock); |
| 25407 | g_object_freeze_notify (object); |
| 25408 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 25409 | { |
| 25410 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 25411 | _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 25412 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 25413 | g_object_notify_by_pspec (object, pspec); |
| 25414 | } |
| 25415 | g_mutex_unlock (&skeleton->priv->lock); |
| 25416 | g_object_thaw_notify (object); |
| 25417 | } |
| 25418 | |
| 25419 | static void |
| 25420 | flash_control_skeleton_init (FlashControlSkeleton *skeleton) |
| 25421 | { |
| 25422 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25423 | skeleton->priv = flash_control_skeleton_get_instance_private (skeleton); |
| 25424 | #else |
| 25425 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate); |
| 25426 | #endif |
| 25427 | |
| 25428 | g_mutex_init (&skeleton->priv->lock); |
| 25429 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 25430 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 25431 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 25432 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 25433 | } |
| 25434 | |
| 25435 | static const gchar * |
| 25436 | flash_control_skeleton_get_filename (FlashControl *object) |
| 25437 | { |
| 25438 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25439 | const gchar *value; |
| 25440 | g_mutex_lock (&skeleton->priv->lock); |
| 25441 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 25442 | g_mutex_unlock (&skeleton->priv->lock); |
| 25443 | return value; |
| 25444 | } |
| 25445 | |
| 25446 | static const gchar * |
| 25447 | flash_control_skeleton_get_type_ (FlashControl *object) |
| 25448 | { |
| 25449 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 25450 | const gchar *value; |
| 25451 | g_mutex_lock (&skeleton->priv->lock); |
| 25452 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 25453 | g_mutex_unlock (&skeleton->priv->lock); |
| 25454 | return value; |
| 25455 | } |
| 25456 | |
| 25457 | static void |
| 25458 | flash_control_skeleton_class_init (FlashControlSkeletonClass *klass) |
| 25459 | { |
| 25460 | GObjectClass *gobject_class; |
| 25461 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 25462 | |
| 25463 | gobject_class = G_OBJECT_CLASS (klass); |
| 25464 | gobject_class->finalize = flash_control_skeleton_finalize; |
| 25465 | gobject_class->get_property = flash_control_skeleton_get_property; |
| 25466 | gobject_class->set_property = flash_control_skeleton_set_property; |
| 25467 | gobject_class->notify = flash_control_skeleton_notify; |
| 25468 | |
| 25469 | |
| 25470 | flash_control_override_properties (gobject_class, 1); |
| 25471 | |
| 25472 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 25473 | skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info; |
| 25474 | skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties; |
| 25475 | skeleton_class->flush = flash_control_skeleton_dbus_interface_flush; |
| 25476 | skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable; |
| 25477 | |
| 25478 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 25479 | g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate)); |
| 25480 | #endif |
| 25481 | } |
| 25482 | |
| 25483 | static void |
| 25484 | flash_control_skeleton_iface_init (FlashControlIface *iface) |
| 25485 | { |
| 25486 | iface->done = _flash_control_on_signal_done; |
| 25487 | iface->error = _flash_control_on_signal_error; |
| 25488 | iface->progress = _flash_control_on_signal_progress; |
| 25489 | iface->get_filename = flash_control_skeleton_get_filename; |
| 25490 | iface->get_type_ = flash_control_skeleton_get_type_; |
| 25491 | } |
| 25492 | |
| 25493 | /** |
| 25494 | * flash_control_skeleton_new: |
| 25495 | * |
| 25496 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 25497 | * |
| 25498 | * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object. |
| 25499 | */ |
| 25500 | FlashControl * |
| 25501 | flash_control_skeleton_new (void) |
| 25502 | { |
| 25503 | return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL)); |
| 25504 | } |
| 25505 | |
| 25506 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25507 | * Code for interface org.openbmc.Button |
| 25508 | * ------------------------------------------------------------------------ |
| 25509 | */ |
| 25510 | |
| 25511 | /** |
| 25512 | * SECTION:Button |
| 25513 | * @title: Button |
| 25514 | * @short_description: Generated C code for the org.openbmc.Button D-Bus interface |
| 25515 | * |
| 25516 | * 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. |
| 25517 | */ |
| 25518 | |
| 25519 | /* ---- Introspection data for org.openbmc.Button ---- */ |
| 25520 | |
| 25521 | static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state = |
| 25522 | { |
| 25523 | { |
| 25524 | -1, |
| 25525 | (gchar *) "state", |
| 25526 | (gchar *) "b", |
| 25527 | NULL |
| 25528 | }, |
| 25529 | FALSE |
| 25530 | }; |
| 25531 | |
| 25532 | static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] = |
| 25533 | { |
| 25534 | &_button_method_info_is_on_OUT_ARG_state, |
| 25535 | NULL |
| 25536 | }; |
| 25537 | |
| 25538 | static const _ExtendedGDBusMethodInfo _button_method_info_is_on = |
| 25539 | { |
| 25540 | { |
| 25541 | -1, |
| 25542 | (gchar *) "isOn", |
| 25543 | NULL, |
| 25544 | (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers, |
| 25545 | NULL |
| 25546 | }, |
| 25547 | "handle-is-on", |
| 25548 | FALSE |
| 25549 | }; |
| 25550 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25551 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_press = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25552 | { |
| 25553 | { |
| 25554 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25555 | (gchar *) "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25556 | NULL, |
| 25557 | NULL, |
| 25558 | NULL |
| 25559 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25560 | "handle-sim-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25561 | FALSE |
| 25562 | }; |
| 25563 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25564 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25565 | { |
| 25566 | { |
| 25567 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25568 | (gchar *) "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25569 | NULL, |
| 25570 | NULL, |
| 25571 | NULL |
| 25572 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25573 | "handle-sim-long-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25574 | FALSE |
| 25575 | }; |
| 25576 | |
| 25577 | static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] = |
| 25578 | { |
| 25579 | &_button_method_info_is_on, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25580 | &_button_method_info_sim_press, |
| 25581 | &_button_method_info_sim_long_press, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25582 | NULL |
| 25583 | }; |
| 25584 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25585 | static const _ExtendedGDBusSignalInfo _button_signal_info_released = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25586 | { |
| 25587 | { |
| 25588 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25589 | (gchar *) "Released", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25590 | NULL, |
| 25591 | NULL |
| 25592 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25593 | "released" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25594 | }; |
| 25595 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25596 | static const _ExtendedGDBusSignalInfo _button_signal_info_pressed = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25597 | { |
| 25598 | { |
| 25599 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25600 | (gchar *) "Pressed", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25601 | NULL, |
| 25602 | NULL |
| 25603 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25604 | "pressed" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25605 | }; |
| 25606 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25607 | static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25608 | { |
| 25609 | { |
| 25610 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25611 | (gchar *) "PressedLong", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25612 | NULL, |
| 25613 | NULL |
| 25614 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25615 | "pressed-long" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25616 | }; |
| 25617 | |
| 25618 | static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] = |
| 25619 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25620 | &_button_signal_info_released, |
| 25621 | &_button_signal_info_pressed, |
| 25622 | &_button_signal_info_pressed_long, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25623 | NULL |
| 25624 | }; |
| 25625 | |
| 25626 | static const _ExtendedGDBusPropertyInfo _button_property_info_state = |
| 25627 | { |
| 25628 | { |
| 25629 | -1, |
| 25630 | (gchar *) "state", |
| 25631 | (gchar *) "b", |
| 25632 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 25633 | NULL |
| 25634 | }, |
| 25635 | "state", |
| 25636 | FALSE |
| 25637 | }; |
| 25638 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25639 | static const _ExtendedGDBusPropertyInfo _button_property_info_timer = |
| 25640 | { |
| 25641 | { |
| 25642 | -1, |
| 25643 | (gchar *) "timer", |
| 25644 | (gchar *) "t", |
| 25645 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 25646 | NULL |
| 25647 | }, |
| 25648 | "timer", |
| 25649 | FALSE |
| 25650 | }; |
| 25651 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25652 | static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] = |
| 25653 | { |
| 25654 | &_button_property_info_state, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25655 | &_button_property_info_timer, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25656 | NULL |
| 25657 | }; |
| 25658 | |
| 25659 | static const _ExtendedGDBusInterfaceInfo _button_interface_info = |
| 25660 | { |
| 25661 | { |
| 25662 | -1, |
| 25663 | (gchar *) "org.openbmc.Button", |
| 25664 | (GDBusMethodInfo **) &_button_method_info_pointers, |
| 25665 | (GDBusSignalInfo **) &_button_signal_info_pointers, |
| 25666 | (GDBusPropertyInfo **) &_button_property_info_pointers, |
| 25667 | NULL |
| 25668 | }, |
| 25669 | "button", |
| 25670 | }; |
| 25671 | |
| 25672 | |
| 25673 | /** |
| 25674 | * button_interface_info: |
| 25675 | * |
| 25676 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface. |
| 25677 | * |
| 25678 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 25679 | */ |
| 25680 | GDBusInterfaceInfo * |
| 25681 | button_interface_info (void) |
| 25682 | { |
| 25683 | return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct; |
| 25684 | } |
| 25685 | |
| 25686 | /** |
| 25687 | * button_override_properties: |
| 25688 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 25689 | * @property_id_begin: The property id to assign to the first overridden property. |
| 25690 | * |
| 25691 | * Overrides all #GObject properties in the #Button interface for a concrete class. |
| 25692 | * The properties are overridden in the order they are defined. |
| 25693 | * |
| 25694 | * Returns: The last property id. |
| 25695 | */ |
| 25696 | guint |
| 25697 | button_override_properties (GObjectClass *klass, guint property_id_begin) |
| 25698 | { |
| 25699 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25700 | g_object_class_override_property (klass, property_id_begin++, "timer"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25701 | return property_id_begin - 1; |
| 25702 | } |
| 25703 | |
| 25704 | |
| 25705 | |
| 25706 | /** |
| 25707 | * Button: |
| 25708 | * |
| 25709 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 25710 | */ |
| 25711 | |
| 25712 | /** |
| 25713 | * ButtonIface: |
| 25714 | * @parent_iface: The parent interface. |
| 25715 | * @handle_is_on: Handler for the #Button::handle-is-on signal. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25716 | * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal. |
| 25717 | * @handle_sim_press: Handler for the #Button::handle-sim-press signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25718 | * @get_state: Getter for the #Button:state property. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25719 | * @get_timer: Getter for the #Button:timer property. |
| 25720 | * @pressed: Handler for the #Button::pressed signal. |
| 25721 | * @pressed_long: Handler for the #Button::pressed-long signal. |
| 25722 | * @released: Handler for the #Button::released signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25723 | * |
| 25724 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 25725 | */ |
| 25726 | |
| 25727 | typedef ButtonIface ButtonInterface; |
| 25728 | G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT); |
| 25729 | |
| 25730 | static void |
| 25731 | button_default_init (ButtonIface *iface) |
| 25732 | { |
| 25733 | /* GObject signals for incoming D-Bus method calls: */ |
| 25734 | /** |
| 25735 | * Button::handle-is-on: |
| 25736 | * @object: A #Button. |
| 25737 | * @invocation: A #GDBusMethodInvocation. |
| 25738 | * |
| 25739 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. |
| 25740 | * |
| 25741 | * 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. |
| 25742 | * |
| 25743 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 25744 | */ |
| 25745 | g_signal_new ("handle-is-on", |
| 25746 | G_TYPE_FROM_INTERFACE (iface), |
| 25747 | G_SIGNAL_RUN_LAST, |
| 25748 | G_STRUCT_OFFSET (ButtonIface, handle_is_on), |
| 25749 | g_signal_accumulator_true_handled, |
| 25750 | NULL, |
| 25751 | g_cclosure_marshal_generic, |
| 25752 | G_TYPE_BOOLEAN, |
| 25753 | 1, |
| 25754 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 25755 | |
| 25756 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25757 | * Button::handle-sim-press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25758 | * @object: A #Button. |
| 25759 | * @invocation: A #GDBusMethodInvocation. |
| 25760 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25761 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25762 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25763 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25764 | * |
| 25765 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 25766 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25767 | g_signal_new ("handle-sim-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25768 | G_TYPE_FROM_INTERFACE (iface), |
| 25769 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25770 | G_STRUCT_OFFSET (ButtonIface, handle_sim_press), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25771 | g_signal_accumulator_true_handled, |
| 25772 | NULL, |
| 25773 | g_cclosure_marshal_generic, |
| 25774 | G_TYPE_BOOLEAN, |
| 25775 | 1, |
| 25776 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 25777 | |
| 25778 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25779 | * Button::handle-sim-long-press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25780 | * @object: A #Button. |
| 25781 | * @invocation: A #GDBusMethodInvocation. |
| 25782 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25783 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25784 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25785 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25786 | * |
| 25787 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 25788 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25789 | g_signal_new ("handle-sim-long-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25790 | G_TYPE_FROM_INTERFACE (iface), |
| 25791 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25792 | G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25793 | g_signal_accumulator_true_handled, |
| 25794 | NULL, |
| 25795 | g_cclosure_marshal_generic, |
| 25796 | G_TYPE_BOOLEAN, |
| 25797 | 1, |
| 25798 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 25799 | |
| 25800 | /* GObject signals for received D-Bus signals: */ |
| 25801 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25802 | * Button::released: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25803 | * @object: A #Button. |
| 25804 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25805 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25806 | * |
| 25807 | * 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. |
| 25808 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25809 | g_signal_new ("released", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25810 | G_TYPE_FROM_INTERFACE (iface), |
| 25811 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25812 | G_STRUCT_OFFSET (ButtonIface, released), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25813 | NULL, |
| 25814 | NULL, |
| 25815 | g_cclosure_marshal_generic, |
| 25816 | G_TYPE_NONE, |
| 25817 | 0); |
| 25818 | |
| 25819 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25820 | * Button::pressed: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25821 | * @object: A #Button. |
| 25822 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25823 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25824 | * |
| 25825 | * 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. |
| 25826 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25827 | g_signal_new ("pressed", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25828 | G_TYPE_FROM_INTERFACE (iface), |
| 25829 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25830 | G_STRUCT_OFFSET (ButtonIface, pressed), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25831 | NULL, |
| 25832 | NULL, |
| 25833 | g_cclosure_marshal_generic, |
| 25834 | G_TYPE_NONE, |
| 25835 | 0); |
| 25836 | |
| 25837 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25838 | * Button::pressed-long: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25839 | * @object: A #Button. |
| 25840 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25841 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25842 | * |
| 25843 | * 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. |
| 25844 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25845 | g_signal_new ("pressed-long", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25846 | G_TYPE_FROM_INTERFACE (iface), |
| 25847 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25848 | G_STRUCT_OFFSET (ButtonIface, pressed_long), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25849 | NULL, |
| 25850 | NULL, |
| 25851 | g_cclosure_marshal_generic, |
| 25852 | G_TYPE_NONE, |
| 25853 | 0); |
| 25854 | |
| 25855 | /* GObject properties for D-Bus properties: */ |
| 25856 | /** |
| 25857 | * Button:state: |
| 25858 | * |
| 25859 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>. |
| 25860 | * |
| 25861 | * 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. |
| 25862 | */ |
| 25863 | g_object_interface_install_property (iface, |
| 25864 | g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25865 | /** |
| 25866 | * Button:timer: |
| 25867 | * |
| 25868 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>. |
| 25869 | * |
| 25870 | * 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. |
| 25871 | */ |
| 25872 | g_object_interface_install_property (iface, |
| 25873 | g_param_spec_uint64 ("timer", "timer", "timer", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25874 | } |
| 25875 | |
| 25876 | /** |
| 25877 | * button_get_state: (skip) |
| 25878 | * @object: A #Button. |
| 25879 | * |
| 25880 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property. |
| 25881 | * |
| 25882 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 25883 | * |
| 25884 | * Returns: The property value. |
| 25885 | */ |
| 25886 | gboolean |
| 25887 | button_get_state (Button *object) |
| 25888 | { |
| 25889 | return BUTTON_GET_IFACE (object)->get_state (object); |
| 25890 | } |
| 25891 | |
| 25892 | /** |
| 25893 | * button_set_state: (skip) |
| 25894 | * @object: A #Button. |
| 25895 | * @value: The value to set. |
| 25896 | * |
| 25897 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value. |
| 25898 | * |
| 25899 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 25900 | */ |
| 25901 | void |
| 25902 | button_set_state (Button *object, gboolean value) |
| 25903 | { |
| 25904 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 25905 | } |
| 25906 | |
| 25907 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25908 | * button_get_timer: (skip) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25909 | * @object: A #Button. |
| 25910 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25911 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property. |
| 25912 | * |
| 25913 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 25914 | * |
| 25915 | * Returns: The property value. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25916 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25917 | guint64 |
| 25918 | button_get_timer (Button *object) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25919 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25920 | return BUTTON_GET_IFACE (object)->get_timer (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25921 | } |
| 25922 | |
| 25923 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25924 | * button_set_timer: (skip) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25925 | * @object: A #Button. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25926 | * @value: The value to set. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25927 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25928 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value. |
| 25929 | * |
| 25930 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25931 | */ |
| 25932 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25933 | button_set_timer (Button *object, guint64 value) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25934 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25935 | g_object_set (G_OBJECT (object), "timer", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25936 | } |
| 25937 | |
| 25938 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25939 | * button_emit_released: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25940 | * @object: A #Button. |
| 25941 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25942 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25943 | */ |
| 25944 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25945 | button_emit_released ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25946 | Button *object) |
| 25947 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25948 | g_signal_emit_by_name (object, "released"); |
| 25949 | } |
| 25950 | |
| 25951 | /** |
| 25952 | * button_emit_pressed: |
| 25953 | * @object: A #Button. |
| 25954 | * |
| 25955 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal. |
| 25956 | */ |
| 25957 | void |
| 25958 | button_emit_pressed ( |
| 25959 | Button *object) |
| 25960 | { |
| 25961 | g_signal_emit_by_name (object, "pressed"); |
| 25962 | } |
| 25963 | |
| 25964 | /** |
| 25965 | * button_emit_pressed_long: |
| 25966 | * @object: A #Button. |
| 25967 | * |
| 25968 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal. |
| 25969 | */ |
| 25970 | void |
| 25971 | button_emit_pressed_long ( |
| 25972 | Button *object) |
| 25973 | { |
| 25974 | g_signal_emit_by_name (object, "pressed-long"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25975 | } |
| 25976 | |
| 25977 | /** |
| 25978 | * button_call_is_on: |
| 25979 | * @proxy: A #ButtonProxy. |
| 25980 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25981 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 25982 | * @user_data: User data to pass to @callback. |
| 25983 | * |
| 25984 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. |
| 25985 | * 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. |
| 25986 | * You can then call button_call_is_on_finish() to get the result of the operation. |
| 25987 | * |
| 25988 | * See button_call_is_on_sync() for the synchronous, blocking version of this method. |
| 25989 | */ |
| 25990 | void |
| 25991 | button_call_is_on ( |
| 25992 | Button *proxy, |
| 25993 | GCancellable *cancellable, |
| 25994 | GAsyncReadyCallback callback, |
| 25995 | gpointer user_data) |
| 25996 | { |
| 25997 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 25998 | "isOn", |
| 25999 | g_variant_new ("()"), |
| 26000 | G_DBUS_CALL_FLAGS_NONE, |
| 26001 | -1, |
| 26002 | cancellable, |
| 26003 | callback, |
| 26004 | user_data); |
| 26005 | } |
| 26006 | |
| 26007 | /** |
| 26008 | * button_call_is_on_finish: |
| 26009 | * @proxy: A #ButtonProxy. |
| 26010 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 26011 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on(). |
| 26012 | * @error: Return location for error or %NULL. |
| 26013 | * |
| 26014 | * Finishes an operation started with button_call_is_on(). |
| 26015 | * |
| 26016 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26017 | */ |
| 26018 | gboolean |
| 26019 | button_call_is_on_finish ( |
| 26020 | Button *proxy, |
| 26021 | gboolean *out_state, |
| 26022 | GAsyncResult *res, |
| 26023 | GError **error) |
| 26024 | { |
| 26025 | GVariant *_ret; |
| 26026 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26027 | if (_ret == NULL) |
| 26028 | goto _out; |
| 26029 | g_variant_get (_ret, |
| 26030 | "(b)", |
| 26031 | out_state); |
| 26032 | g_variant_unref (_ret); |
| 26033 | _out: |
| 26034 | return _ret != NULL; |
| 26035 | } |
| 26036 | |
| 26037 | /** |
| 26038 | * button_call_is_on_sync: |
| 26039 | * @proxy: A #ButtonProxy. |
| 26040 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 26041 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26042 | * @error: Return location for error or %NULL. |
| 26043 | * |
| 26044 | * 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. |
| 26045 | * |
| 26046 | * See button_call_is_on() for the asynchronous version of this method. |
| 26047 | * |
| 26048 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26049 | */ |
| 26050 | gboolean |
| 26051 | button_call_is_on_sync ( |
| 26052 | Button *proxy, |
| 26053 | gboolean *out_state, |
| 26054 | GCancellable *cancellable, |
| 26055 | GError **error) |
| 26056 | { |
| 26057 | GVariant *_ret; |
| 26058 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26059 | "isOn", |
| 26060 | g_variant_new ("()"), |
| 26061 | G_DBUS_CALL_FLAGS_NONE, |
| 26062 | -1, |
| 26063 | cancellable, |
| 26064 | error); |
| 26065 | if (_ret == NULL) |
| 26066 | goto _out; |
| 26067 | g_variant_get (_ret, |
| 26068 | "(b)", |
| 26069 | out_state); |
| 26070 | g_variant_unref (_ret); |
| 26071 | _out: |
| 26072 | return _ret != NULL; |
| 26073 | } |
| 26074 | |
| 26075 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26076 | * button_call_sim_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26077 | * @proxy: A #ButtonProxy. |
| 26078 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26079 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26080 | * @user_data: User data to pass to @callback. |
| 26081 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26082 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26083 | * 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 | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26084 | * You can then call button_call_sim_press_finish() to get the result of the operation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26085 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26086 | * See button_call_sim_press_sync() for the synchronous, blocking version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26087 | */ |
| 26088 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26089 | button_call_sim_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26090 | Button *proxy, |
| 26091 | GCancellable *cancellable, |
| 26092 | GAsyncReadyCallback callback, |
| 26093 | gpointer user_data) |
| 26094 | { |
| 26095 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26096 | "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26097 | g_variant_new ("()"), |
| 26098 | G_DBUS_CALL_FLAGS_NONE, |
| 26099 | -1, |
| 26100 | cancellable, |
| 26101 | callback, |
| 26102 | user_data); |
| 26103 | } |
| 26104 | |
| 26105 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26106 | * button_call_sim_press_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26107 | * @proxy: A #ButtonProxy. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26108 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26109 | * @error: Return location for error or %NULL. |
| 26110 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26111 | * Finishes an operation started with button_call_sim_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26112 | * |
| 26113 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26114 | */ |
| 26115 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26116 | button_call_sim_press_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26117 | Button *proxy, |
| 26118 | GAsyncResult *res, |
| 26119 | GError **error) |
| 26120 | { |
| 26121 | GVariant *_ret; |
| 26122 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26123 | if (_ret == NULL) |
| 26124 | goto _out; |
| 26125 | g_variant_get (_ret, |
| 26126 | "()"); |
| 26127 | g_variant_unref (_ret); |
| 26128 | _out: |
| 26129 | return _ret != NULL; |
| 26130 | } |
| 26131 | |
| 26132 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26133 | * button_call_sim_press_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26134 | * @proxy: A #ButtonProxy. |
| 26135 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26136 | * @error: Return location for error or %NULL. |
| 26137 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26138 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26139 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26140 | * See button_call_sim_press() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26141 | * |
| 26142 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26143 | */ |
| 26144 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26145 | button_call_sim_press_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26146 | Button *proxy, |
| 26147 | GCancellable *cancellable, |
| 26148 | GError **error) |
| 26149 | { |
| 26150 | GVariant *_ret; |
| 26151 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26152 | "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26153 | g_variant_new ("()"), |
| 26154 | G_DBUS_CALL_FLAGS_NONE, |
| 26155 | -1, |
| 26156 | cancellable, |
| 26157 | error); |
| 26158 | if (_ret == NULL) |
| 26159 | goto _out; |
| 26160 | g_variant_get (_ret, |
| 26161 | "()"); |
| 26162 | g_variant_unref (_ret); |
| 26163 | _out: |
| 26164 | return _ret != NULL; |
| 26165 | } |
| 26166 | |
| 26167 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26168 | * button_call_sim_long_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26169 | * @proxy: A #ButtonProxy. |
| 26170 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26171 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26172 | * @user_data: User data to pass to @callback. |
| 26173 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26174 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26175 | * 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 | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26176 | * You can then call button_call_sim_long_press_finish() to get the result of the operation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26177 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26178 | * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26179 | */ |
| 26180 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26181 | button_call_sim_long_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26182 | Button *proxy, |
| 26183 | GCancellable *cancellable, |
| 26184 | GAsyncReadyCallback callback, |
| 26185 | gpointer user_data) |
| 26186 | { |
| 26187 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26188 | "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26189 | g_variant_new ("()"), |
| 26190 | G_DBUS_CALL_FLAGS_NONE, |
| 26191 | -1, |
| 26192 | cancellable, |
| 26193 | callback, |
| 26194 | user_data); |
| 26195 | } |
| 26196 | |
| 26197 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26198 | * button_call_sim_long_press_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26199 | * @proxy: A #ButtonProxy. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26200 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26201 | * @error: Return location for error or %NULL. |
| 26202 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26203 | * Finishes an operation started with button_call_sim_long_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26204 | * |
| 26205 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26206 | */ |
| 26207 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26208 | button_call_sim_long_press_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26209 | Button *proxy, |
| 26210 | GAsyncResult *res, |
| 26211 | GError **error) |
| 26212 | { |
| 26213 | GVariant *_ret; |
| 26214 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26215 | if (_ret == NULL) |
| 26216 | goto _out; |
| 26217 | g_variant_get (_ret, |
| 26218 | "()"); |
| 26219 | g_variant_unref (_ret); |
| 26220 | _out: |
| 26221 | return _ret != NULL; |
| 26222 | } |
| 26223 | |
| 26224 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26225 | * button_call_sim_long_press_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26226 | * @proxy: A #ButtonProxy. |
| 26227 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26228 | * @error: Return location for error or %NULL. |
| 26229 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26230 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26231 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26232 | * See button_call_sim_long_press() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26233 | * |
| 26234 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26235 | */ |
| 26236 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26237 | button_call_sim_long_press_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26238 | Button *proxy, |
| 26239 | GCancellable *cancellable, |
| 26240 | GError **error) |
| 26241 | { |
| 26242 | GVariant *_ret; |
| 26243 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26244 | "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26245 | g_variant_new ("()"), |
| 26246 | G_DBUS_CALL_FLAGS_NONE, |
| 26247 | -1, |
| 26248 | cancellable, |
| 26249 | error); |
| 26250 | if (_ret == NULL) |
| 26251 | goto _out; |
| 26252 | g_variant_get (_ret, |
| 26253 | "()"); |
| 26254 | g_variant_unref (_ret); |
| 26255 | _out: |
| 26256 | return _ret != NULL; |
| 26257 | } |
| 26258 | |
| 26259 | /** |
| 26260 | * button_complete_is_on: |
| 26261 | * @object: A #Button. |
| 26262 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26263 | * @state: Parameter to return. |
| 26264 | * |
| 26265 | * 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. |
| 26266 | * |
| 26267 | * This method will free @invocation, you cannot use it afterwards. |
| 26268 | */ |
| 26269 | void |
| 26270 | button_complete_is_on ( |
| 26271 | Button *object, |
| 26272 | GDBusMethodInvocation *invocation, |
| 26273 | gboolean state) |
| 26274 | { |
| 26275 | g_dbus_method_invocation_return_value (invocation, |
| 26276 | g_variant_new ("(b)", |
| 26277 | state)); |
| 26278 | } |
| 26279 | |
| 26280 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26281 | * button_complete_sim_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26282 | * @object: A #Button. |
| 26283 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26284 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26285 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26286 | * |
| 26287 | * This method will free @invocation, you cannot use it afterwards. |
| 26288 | */ |
| 26289 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26290 | button_complete_sim_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26291 | Button *object, |
| 26292 | GDBusMethodInvocation *invocation) |
| 26293 | { |
| 26294 | g_dbus_method_invocation_return_value (invocation, |
| 26295 | g_variant_new ("()")); |
| 26296 | } |
| 26297 | |
| 26298 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26299 | * button_complete_sim_long_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26300 | * @object: A #Button. |
| 26301 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26302 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26303 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26304 | * |
| 26305 | * This method will free @invocation, you cannot use it afterwards. |
| 26306 | */ |
| 26307 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26308 | button_complete_sim_long_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26309 | Button *object, |
| 26310 | GDBusMethodInvocation *invocation) |
| 26311 | { |
| 26312 | g_dbus_method_invocation_return_value (invocation, |
| 26313 | g_variant_new ("()")); |
| 26314 | } |
| 26315 | |
| 26316 | /* ------------------------------------------------------------------------ */ |
| 26317 | |
| 26318 | /** |
| 26319 | * ButtonProxy: |
| 26320 | * |
| 26321 | * The #ButtonProxy structure contains only private data and should only be accessed using the provided API. |
| 26322 | */ |
| 26323 | |
| 26324 | /** |
| 26325 | * ButtonProxyClass: |
| 26326 | * @parent_class: The parent class. |
| 26327 | * |
| 26328 | * Class structure for #ButtonProxy. |
| 26329 | */ |
| 26330 | |
| 26331 | struct _ButtonProxyPrivate |
| 26332 | { |
| 26333 | GData *qdata; |
| 26334 | }; |
| 26335 | |
| 26336 | static void button_proxy_iface_init (ButtonIface *iface); |
| 26337 | |
| 26338 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26339 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 26340 | G_ADD_PRIVATE (ButtonProxy) |
| 26341 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 26342 | |
| 26343 | #else |
| 26344 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 26345 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 26346 | |
| 26347 | #endif |
| 26348 | static void |
| 26349 | button_proxy_finalize (GObject *object) |
| 26350 | { |
| 26351 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 26352 | g_datalist_clear (&proxy->priv->qdata); |
| 26353 | G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object); |
| 26354 | } |
| 26355 | |
| 26356 | static void |
| 26357 | button_proxy_get_property (GObject *object, |
| 26358 | guint prop_id, |
| 26359 | GValue *value, |
| 26360 | GParamSpec *pspec G_GNUC_UNUSED) |
| 26361 | { |
| 26362 | const _ExtendedGDBusPropertyInfo *info; |
| 26363 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26364 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26365 | info = _button_property_info_pointers[prop_id - 1]; |
| 26366 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 26367 | if (info->use_gvariant) |
| 26368 | { |
| 26369 | g_value_set_variant (value, variant); |
| 26370 | } |
| 26371 | else |
| 26372 | { |
| 26373 | if (variant != NULL) |
| 26374 | g_dbus_gvariant_to_gvalue (variant, value); |
| 26375 | } |
| 26376 | if (variant != NULL) |
| 26377 | g_variant_unref (variant); |
| 26378 | } |
| 26379 | |
| 26380 | static void |
| 26381 | button_proxy_set_property_cb (GDBusProxy *proxy, |
| 26382 | GAsyncResult *res, |
| 26383 | gpointer user_data) |
| 26384 | { |
| 26385 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 26386 | GError *error; |
| 26387 | GVariant *_ret; |
| 26388 | error = NULL; |
| 26389 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 26390 | if (!_ret) |
| 26391 | { |
| 26392 | g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)", |
| 26393 | info->parent_struct.name, |
| 26394 | error->message, g_quark_to_string (error->domain), error->code); |
| 26395 | g_error_free (error); |
| 26396 | } |
| 26397 | else |
| 26398 | { |
| 26399 | g_variant_unref (_ret); |
| 26400 | } |
| 26401 | } |
| 26402 | |
| 26403 | static void |
| 26404 | button_proxy_set_property (GObject *object, |
| 26405 | guint prop_id, |
| 26406 | const GValue *value, |
| 26407 | GParamSpec *pspec G_GNUC_UNUSED) |
| 26408 | { |
| 26409 | const _ExtendedGDBusPropertyInfo *info; |
| 26410 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26411 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26412 | info = _button_property_info_pointers[prop_id - 1]; |
| 26413 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 26414 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 26415 | "org.freedesktop.DBus.Properties.Set", |
| 26416 | g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant), |
| 26417 | G_DBUS_CALL_FLAGS_NONE, |
| 26418 | -1, |
| 26419 | NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 26420 | g_variant_unref (variant); |
| 26421 | } |
| 26422 | |
| 26423 | static void |
| 26424 | button_proxy_g_signal (GDBusProxy *proxy, |
| 26425 | const gchar *sender_name G_GNUC_UNUSED, |
| 26426 | const gchar *signal_name, |
| 26427 | GVariant *parameters) |
| 26428 | { |
| 26429 | _ExtendedGDBusSignalInfo *info; |
| 26430 | GVariantIter iter; |
| 26431 | GVariant *child; |
| 26432 | GValue *paramv; |
| 26433 | guint num_params; |
| 26434 | guint n; |
| 26435 | guint signal_id; |
| 26436 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name); |
| 26437 | if (info == NULL) |
| 26438 | return; |
| 26439 | num_params = g_variant_n_children (parameters); |
| 26440 | paramv = g_new0 (GValue, num_params + 1); |
| 26441 | g_value_init (¶mv[0], TYPE_BUTTON); |
| 26442 | g_value_set_object (¶mv[0], proxy); |
| 26443 | g_variant_iter_init (&iter, parameters); |
| 26444 | n = 1; |
| 26445 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 26446 | { |
| 26447 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 26448 | if (arg_info->use_gvariant) |
| 26449 | { |
| 26450 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 26451 | g_value_set_variant (¶mv[n], child); |
| 26452 | n++; |
| 26453 | } |
| 26454 | else |
| 26455 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 26456 | g_variant_unref (child); |
| 26457 | } |
| 26458 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 26459 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 26460 | for (n = 0; n < num_params + 1; n++) |
| 26461 | g_value_unset (¶mv[n]); |
| 26462 | g_free (paramv); |
| 26463 | } |
| 26464 | |
| 26465 | static void |
| 26466 | button_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 26467 | GVariant *changed_properties, |
| 26468 | const gchar *const *invalidated_properties) |
| 26469 | { |
| 26470 | ButtonProxy *proxy = BUTTON_PROXY (_proxy); |
| 26471 | guint n; |
| 26472 | const gchar *key; |
| 26473 | GVariantIter *iter; |
| 26474 | _ExtendedGDBusPropertyInfo *info; |
| 26475 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 26476 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 26477 | { |
| 26478 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key); |
| 26479 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 26480 | if (info != NULL) |
| 26481 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 26482 | } |
| 26483 | g_variant_iter_free (iter); |
| 26484 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 26485 | { |
| 26486 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]); |
| 26487 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 26488 | if (info != NULL) |
| 26489 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 26490 | } |
| 26491 | } |
| 26492 | |
| 26493 | static gboolean |
| 26494 | button_proxy_get_state (Button *object) |
| 26495 | { |
| 26496 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 26497 | GVariant *variant; |
| 26498 | gboolean value = 0; |
| 26499 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 26500 | if (variant != NULL) |
| 26501 | { |
| 26502 | value = g_variant_get_boolean (variant); |
| 26503 | g_variant_unref (variant); |
| 26504 | } |
| 26505 | return value; |
| 26506 | } |
| 26507 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26508 | static guint64 |
| 26509 | button_proxy_get_timer (Button *object) |
| 26510 | { |
| 26511 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 26512 | GVariant *variant; |
| 26513 | guint64 value = 0; |
| 26514 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer"); |
| 26515 | if (variant != NULL) |
| 26516 | { |
| 26517 | value = g_variant_get_uint64 (variant); |
| 26518 | g_variant_unref (variant); |
| 26519 | } |
| 26520 | return value; |
| 26521 | } |
| 26522 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26523 | static void |
| 26524 | button_proxy_init (ButtonProxy *proxy) |
| 26525 | { |
| 26526 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26527 | proxy->priv = button_proxy_get_instance_private (proxy); |
| 26528 | #else |
| 26529 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate); |
| 26530 | #endif |
| 26531 | |
| 26532 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ()); |
| 26533 | } |
| 26534 | |
| 26535 | static void |
| 26536 | button_proxy_class_init (ButtonProxyClass *klass) |
| 26537 | { |
| 26538 | GObjectClass *gobject_class; |
| 26539 | GDBusProxyClass *proxy_class; |
| 26540 | |
| 26541 | gobject_class = G_OBJECT_CLASS (klass); |
| 26542 | gobject_class->finalize = button_proxy_finalize; |
| 26543 | gobject_class->get_property = button_proxy_get_property; |
| 26544 | gobject_class->set_property = button_proxy_set_property; |
| 26545 | |
| 26546 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 26547 | proxy_class->g_signal = button_proxy_g_signal; |
| 26548 | proxy_class->g_properties_changed = button_proxy_g_properties_changed; |
| 26549 | |
| 26550 | button_override_properties (gobject_class, 1); |
| 26551 | |
| 26552 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 26553 | g_type_class_add_private (klass, sizeof (ButtonProxyPrivate)); |
| 26554 | #endif |
| 26555 | } |
| 26556 | |
| 26557 | static void |
| 26558 | button_proxy_iface_init (ButtonIface *iface) |
| 26559 | { |
| 26560 | iface->get_state = button_proxy_get_state; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26561 | iface->get_timer = button_proxy_get_timer; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26562 | } |
| 26563 | |
| 26564 | /** |
| 26565 | * button_proxy_new: |
| 26566 | * @connection: A #GDBusConnection. |
| 26567 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26568 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 26569 | * @object_path: An object path. |
| 26570 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26571 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 26572 | * @user_data: User data to pass to @callback. |
| 26573 | * |
| 26574 | * 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. |
| 26575 | * |
| 26576 | * 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. |
| 26577 | * You can then call button_proxy_new_finish() to get the result of the operation. |
| 26578 | * |
| 26579 | * See button_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 26580 | */ |
| 26581 | void |
| 26582 | button_proxy_new ( |
| 26583 | GDBusConnection *connection, |
| 26584 | GDBusProxyFlags flags, |
| 26585 | const gchar *name, |
| 26586 | const gchar *object_path, |
| 26587 | GCancellable *cancellable, |
| 26588 | GAsyncReadyCallback callback, |
| 26589 | gpointer user_data) |
| 26590 | { |
| 26591 | 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); |
| 26592 | } |
| 26593 | |
| 26594 | /** |
| 26595 | * button_proxy_new_finish: |
| 26596 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new(). |
| 26597 | * @error: Return location for error or %NULL |
| 26598 | * |
| 26599 | * Finishes an operation started with button_proxy_new(). |
| 26600 | * |
| 26601 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 26602 | */ |
| 26603 | Button * |
| 26604 | button_proxy_new_finish ( |
| 26605 | GAsyncResult *res, |
| 26606 | GError **error) |
| 26607 | { |
| 26608 | GObject *ret; |
| 26609 | GObject *source_object; |
| 26610 | source_object = g_async_result_get_source_object (res); |
| 26611 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 26612 | g_object_unref (source_object); |
| 26613 | if (ret != NULL) |
| 26614 | return BUTTON (ret); |
| 26615 | else |
| 26616 | return NULL; |
| 26617 | } |
| 26618 | |
| 26619 | /** |
| 26620 | * button_proxy_new_sync: |
| 26621 | * @connection: A #GDBusConnection. |
| 26622 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26623 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 26624 | * @object_path: An object path. |
| 26625 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26626 | * @error: Return location for error or %NULL |
| 26627 | * |
| 26628 | * 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. |
| 26629 | * |
| 26630 | * The calling thread is blocked until a reply is received. |
| 26631 | * |
| 26632 | * See button_proxy_new() for the asynchronous version of this constructor. |
| 26633 | * |
| 26634 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 26635 | */ |
| 26636 | Button * |
| 26637 | button_proxy_new_sync ( |
| 26638 | GDBusConnection *connection, |
| 26639 | GDBusProxyFlags flags, |
| 26640 | const gchar *name, |
| 26641 | const gchar *object_path, |
| 26642 | GCancellable *cancellable, |
| 26643 | GError **error) |
| 26644 | { |
| 26645 | GInitable *ret; |
| 26646 | 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); |
| 26647 | if (ret != NULL) |
| 26648 | return BUTTON (ret); |
| 26649 | else |
| 26650 | return NULL; |
| 26651 | } |
| 26652 | |
| 26653 | |
| 26654 | /** |
| 26655 | * button_proxy_new_for_bus: |
| 26656 | * @bus_type: A #GBusType. |
| 26657 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26658 | * @name: A bus name (well-known or unique). |
| 26659 | * @object_path: An object path. |
| 26660 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26661 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 26662 | * @user_data: User data to pass to @callback. |
| 26663 | * |
| 26664 | * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 26665 | * |
| 26666 | * 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. |
| 26667 | * You can then call button_proxy_new_for_bus_finish() to get the result of the operation. |
| 26668 | * |
| 26669 | * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 26670 | */ |
| 26671 | void |
| 26672 | button_proxy_new_for_bus ( |
| 26673 | GBusType bus_type, |
| 26674 | GDBusProxyFlags flags, |
| 26675 | const gchar *name, |
| 26676 | const gchar *object_path, |
| 26677 | GCancellable *cancellable, |
| 26678 | GAsyncReadyCallback callback, |
| 26679 | gpointer user_data) |
| 26680 | { |
| 26681 | 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); |
| 26682 | } |
| 26683 | |
| 26684 | /** |
| 26685 | * button_proxy_new_for_bus_finish: |
| 26686 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus(). |
| 26687 | * @error: Return location for error or %NULL |
| 26688 | * |
| 26689 | * Finishes an operation started with button_proxy_new_for_bus(). |
| 26690 | * |
| 26691 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 26692 | */ |
| 26693 | Button * |
| 26694 | button_proxy_new_for_bus_finish ( |
| 26695 | GAsyncResult *res, |
| 26696 | GError **error) |
| 26697 | { |
| 26698 | GObject *ret; |
| 26699 | GObject *source_object; |
| 26700 | source_object = g_async_result_get_source_object (res); |
| 26701 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 26702 | g_object_unref (source_object); |
| 26703 | if (ret != NULL) |
| 26704 | return BUTTON (ret); |
| 26705 | else |
| 26706 | return NULL; |
| 26707 | } |
| 26708 | |
| 26709 | /** |
| 26710 | * button_proxy_new_for_bus_sync: |
| 26711 | * @bus_type: A #GBusType. |
| 26712 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 26713 | * @name: A bus name (well-known or unique). |
| 26714 | * @object_path: An object path. |
| 26715 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26716 | * @error: Return location for error or %NULL |
| 26717 | * |
| 26718 | * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 26719 | * |
| 26720 | * The calling thread is blocked until a reply is received. |
| 26721 | * |
| 26722 | * See button_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 26723 | * |
| 26724 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 26725 | */ |
| 26726 | Button * |
| 26727 | button_proxy_new_for_bus_sync ( |
| 26728 | GBusType bus_type, |
| 26729 | GDBusProxyFlags flags, |
| 26730 | const gchar *name, |
| 26731 | const gchar *object_path, |
| 26732 | GCancellable *cancellable, |
| 26733 | GError **error) |
| 26734 | { |
| 26735 | GInitable *ret; |
| 26736 | 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); |
| 26737 | if (ret != NULL) |
| 26738 | return BUTTON (ret); |
| 26739 | else |
| 26740 | return NULL; |
| 26741 | } |
| 26742 | |
| 26743 | |
| 26744 | /* ------------------------------------------------------------------------ */ |
| 26745 | |
| 26746 | /** |
| 26747 | * ButtonSkeleton: |
| 26748 | * |
| 26749 | * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API. |
| 26750 | */ |
| 26751 | |
| 26752 | /** |
| 26753 | * ButtonSkeletonClass: |
| 26754 | * @parent_class: The parent class. |
| 26755 | * |
| 26756 | * Class structure for #ButtonSkeleton. |
| 26757 | */ |
| 26758 | |
| 26759 | struct _ButtonSkeletonPrivate |
| 26760 | { |
| 26761 | GValue *properties; |
| 26762 | GList *changed_properties; |
| 26763 | GSource *changed_properties_idle_source; |
| 26764 | GMainContext *context; |
| 26765 | GMutex lock; |
| 26766 | }; |
| 26767 | |
| 26768 | static void |
| 26769 | _button_skeleton_handle_method_call ( |
| 26770 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26771 | const gchar *sender G_GNUC_UNUSED, |
| 26772 | const gchar *object_path G_GNUC_UNUSED, |
| 26773 | const gchar *interface_name, |
| 26774 | const gchar *method_name, |
| 26775 | GVariant *parameters, |
| 26776 | GDBusMethodInvocation *invocation, |
| 26777 | gpointer user_data) |
| 26778 | { |
| 26779 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 26780 | _ExtendedGDBusMethodInfo *info; |
| 26781 | GVariantIter iter; |
| 26782 | GVariant *child; |
| 26783 | GValue *paramv; |
| 26784 | guint num_params; |
| 26785 | guint num_extra; |
| 26786 | guint n; |
| 26787 | guint signal_id; |
| 26788 | GValue return_value = G_VALUE_INIT; |
| 26789 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 26790 | g_assert (info != NULL); |
| 26791 | num_params = g_variant_n_children (parameters); |
| 26792 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 26793 | n = 0; |
| 26794 | g_value_init (¶mv[n], TYPE_BUTTON); |
| 26795 | g_value_set_object (¶mv[n++], skeleton); |
| 26796 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 26797 | g_value_set_object (¶mv[n++], invocation); |
| 26798 | if (info->pass_fdlist) |
| 26799 | { |
| 26800 | #ifdef G_OS_UNIX |
| 26801 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 26802 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 26803 | #else |
| 26804 | g_assert_not_reached (); |
| 26805 | #endif |
| 26806 | } |
| 26807 | g_variant_iter_init (&iter, parameters); |
| 26808 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 26809 | { |
| 26810 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 26811 | if (arg_info->use_gvariant) |
| 26812 | { |
| 26813 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 26814 | g_value_set_variant (¶mv[n], child); |
| 26815 | n++; |
| 26816 | } |
| 26817 | else |
| 26818 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 26819 | g_variant_unref (child); |
| 26820 | } |
| 26821 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 26822 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 26823 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 26824 | if (!g_value_get_boolean (&return_value)) |
| 26825 | 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); |
| 26826 | g_value_unset (&return_value); |
| 26827 | for (n = 0; n < num_params + num_extra; n++) |
| 26828 | g_value_unset (¶mv[n]); |
| 26829 | g_free (paramv); |
| 26830 | } |
| 26831 | |
| 26832 | static GVariant * |
| 26833 | _button_skeleton_handle_get_property ( |
| 26834 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26835 | const gchar *sender G_GNUC_UNUSED, |
| 26836 | const gchar *object_path G_GNUC_UNUSED, |
| 26837 | const gchar *interface_name G_GNUC_UNUSED, |
| 26838 | const gchar *property_name, |
| 26839 | GError **error, |
| 26840 | gpointer user_data) |
| 26841 | { |
| 26842 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 26843 | GValue value = G_VALUE_INIT; |
| 26844 | GParamSpec *pspec; |
| 26845 | _ExtendedGDBusPropertyInfo *info; |
| 26846 | GVariant *ret; |
| 26847 | ret = NULL; |
| 26848 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 26849 | g_assert (info != NULL); |
| 26850 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 26851 | if (pspec == NULL) |
| 26852 | { |
| 26853 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 26854 | } |
| 26855 | else |
| 26856 | { |
| 26857 | g_value_init (&value, pspec->value_type); |
| 26858 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 26859 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 26860 | g_value_unset (&value); |
| 26861 | } |
| 26862 | return ret; |
| 26863 | } |
| 26864 | |
| 26865 | static gboolean |
| 26866 | _button_skeleton_handle_set_property ( |
| 26867 | GDBusConnection *connection G_GNUC_UNUSED, |
| 26868 | const gchar *sender G_GNUC_UNUSED, |
| 26869 | const gchar *object_path G_GNUC_UNUSED, |
| 26870 | const gchar *interface_name G_GNUC_UNUSED, |
| 26871 | const gchar *property_name, |
| 26872 | GVariant *variant, |
| 26873 | GError **error, |
| 26874 | gpointer user_data) |
| 26875 | { |
| 26876 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 26877 | GValue value = G_VALUE_INIT; |
| 26878 | GParamSpec *pspec; |
| 26879 | _ExtendedGDBusPropertyInfo *info; |
| 26880 | gboolean ret; |
| 26881 | ret = FALSE; |
| 26882 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 26883 | g_assert (info != NULL); |
| 26884 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 26885 | if (pspec == NULL) |
| 26886 | { |
| 26887 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 26888 | } |
| 26889 | else |
| 26890 | { |
| 26891 | if (info->use_gvariant) |
| 26892 | g_value_set_variant (&value, variant); |
| 26893 | else |
| 26894 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 26895 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 26896 | g_value_unset (&value); |
| 26897 | ret = TRUE; |
| 26898 | } |
| 26899 | return ret; |
| 26900 | } |
| 26901 | |
| 26902 | static const GDBusInterfaceVTable _button_skeleton_vtable = |
| 26903 | { |
| 26904 | _button_skeleton_handle_method_call, |
| 26905 | _button_skeleton_handle_get_property, |
| 26906 | _button_skeleton_handle_set_property, |
| 26907 | {NULL} |
| 26908 | }; |
| 26909 | |
| 26910 | static GDBusInterfaceInfo * |
| 26911 | button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 26912 | { |
| 26913 | return button_interface_info (); |
| 26914 | } |
| 26915 | |
| 26916 | static GDBusInterfaceVTable * |
| 26917 | button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 26918 | { |
| 26919 | return (GDBusInterfaceVTable *) &_button_skeleton_vtable; |
| 26920 | } |
| 26921 | |
| 26922 | static GVariant * |
| 26923 | button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 26924 | { |
| 26925 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 26926 | |
| 26927 | GVariantBuilder builder; |
| 26928 | guint n; |
| 26929 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 26930 | if (_button_interface_info.parent_struct.properties == NULL) |
| 26931 | goto out; |
| 26932 | for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++) |
| 26933 | { |
| 26934 | GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n]; |
| 26935 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 26936 | { |
| 26937 | GVariant *value; |
| 26938 | 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); |
| 26939 | if (value != NULL) |
| 26940 | { |
| 26941 | g_variant_take_ref (value); |
| 26942 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 26943 | g_variant_unref (value); |
| 26944 | } |
| 26945 | } |
| 26946 | } |
| 26947 | out: |
| 26948 | return g_variant_builder_end (&builder); |
| 26949 | } |
| 26950 | |
| 26951 | static gboolean _button_emit_changed (gpointer user_data); |
| 26952 | |
| 26953 | static void |
| 26954 | button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 26955 | { |
| 26956 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 26957 | gboolean emit_changed = FALSE; |
| 26958 | |
| 26959 | g_mutex_lock (&skeleton->priv->lock); |
| 26960 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 26961 | { |
| 26962 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 26963 | skeleton->priv->changed_properties_idle_source = NULL; |
| 26964 | emit_changed = TRUE; |
| 26965 | } |
| 26966 | g_mutex_unlock (&skeleton->priv->lock); |
| 26967 | |
| 26968 | if (emit_changed) |
| 26969 | _button_emit_changed (skeleton); |
| 26970 | } |
| 26971 | |
| 26972 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26973 | _button_on_signal_released ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26974 | Button *object) |
| 26975 | { |
| 26976 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 26977 | |
| 26978 | GList *connections, *l; |
| 26979 | GVariant *signal_variant; |
| 26980 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 26981 | |
| 26982 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 26983 | for (l = connections; l != NULL; l = l->next) |
| 26984 | { |
| 26985 | GDBusConnection *connection = l->data; |
| 26986 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26987 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26988 | signal_variant, NULL); |
| 26989 | } |
| 26990 | g_variant_unref (signal_variant); |
| 26991 | g_list_free_full (connections, g_object_unref); |
| 26992 | } |
| 26993 | |
| 26994 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26995 | _button_on_signal_pressed ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26996 | Button *object) |
| 26997 | { |
| 26998 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 26999 | |
| 27000 | GList *connections, *l; |
| 27001 | GVariant *signal_variant; |
| 27002 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 27003 | |
| 27004 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 27005 | for (l = connections; l != NULL; l = l->next) |
| 27006 | { |
| 27007 | GDBusConnection *connection = l->data; |
| 27008 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27009 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27010 | signal_variant, NULL); |
| 27011 | } |
| 27012 | g_variant_unref (signal_variant); |
| 27013 | g_list_free_full (connections, g_object_unref); |
| 27014 | } |
| 27015 | |
| 27016 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27017 | _button_on_signal_pressed_long ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27018 | Button *object) |
| 27019 | { |
| 27020 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 27021 | |
| 27022 | GList *connections, *l; |
| 27023 | GVariant *signal_variant; |
| 27024 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 27025 | |
| 27026 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 27027 | for (l = connections; l != NULL; l = l->next) |
| 27028 | { |
| 27029 | GDBusConnection *connection = l->data; |
| 27030 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27031 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27032 | signal_variant, NULL); |
| 27033 | } |
| 27034 | g_variant_unref (signal_variant); |
| 27035 | g_list_free_full (connections, g_object_unref); |
| 27036 | } |
| 27037 | |
| 27038 | static void button_skeleton_iface_init (ButtonIface *iface); |
| 27039 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 27040 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 27041 | G_ADD_PRIVATE (ButtonSkeleton) |
| 27042 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 27043 | |
| 27044 | #else |
| 27045 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 27046 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 27047 | |
| 27048 | #endif |
| 27049 | static void |
| 27050 | button_skeleton_finalize (GObject *object) |
| 27051 | { |
| 27052 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 27053 | guint n; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27054 | for (n = 0; n < 2; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27055 | g_value_unset (&skeleton->priv->properties[n]); |
| 27056 | g_free (skeleton->priv->properties); |
| 27057 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 27058 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 27059 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 27060 | g_main_context_unref (skeleton->priv->context); |
| 27061 | g_mutex_clear (&skeleton->priv->lock); |
| 27062 | G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object); |
| 27063 | } |
| 27064 | |
| 27065 | static void |
| 27066 | button_skeleton_get_property (GObject *object, |
| 27067 | guint prop_id, |
| 27068 | GValue *value, |
| 27069 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27070 | { |
| 27071 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27072 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27073 | g_mutex_lock (&skeleton->priv->lock); |
| 27074 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 27075 | g_mutex_unlock (&skeleton->priv->lock); |
| 27076 | } |
| 27077 | |
| 27078 | static gboolean |
| 27079 | _button_emit_changed (gpointer user_data) |
| 27080 | { |
| 27081 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 27082 | GList *l; |
| 27083 | GVariantBuilder builder; |
| 27084 | GVariantBuilder invalidated_builder; |
| 27085 | guint num_changes; |
| 27086 | |
| 27087 | g_mutex_lock (&skeleton->priv->lock); |
| 27088 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 27089 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 27090 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 27091 | { |
| 27092 | ChangedProperty *cp = l->data; |
| 27093 | GVariant *variant; |
| 27094 | const GValue *cur_value; |
| 27095 | |
| 27096 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 27097 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 27098 | { |
| 27099 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 27100 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 27101 | g_variant_unref (variant); |
| 27102 | num_changes++; |
| 27103 | } |
| 27104 | } |
| 27105 | if (num_changes > 0) |
| 27106 | { |
| 27107 | GList *connections, *ll; |
| 27108 | GVariant *signal_variant; |
| 27109 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button", |
| 27110 | &builder, &invalidated_builder)); |
| 27111 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 27112 | for (ll = connections; ll != NULL; ll = ll->next) |
| 27113 | { |
| 27114 | GDBusConnection *connection = ll->data; |
| 27115 | |
| 27116 | g_dbus_connection_emit_signal (connection, |
| 27117 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 27118 | "org.freedesktop.DBus.Properties", |
| 27119 | "PropertiesChanged", |
| 27120 | signal_variant, |
| 27121 | NULL); |
| 27122 | } |
| 27123 | g_variant_unref (signal_variant); |
| 27124 | g_list_free_full (connections, g_object_unref); |
| 27125 | } |
| 27126 | else |
| 27127 | { |
| 27128 | g_variant_builder_clear (&builder); |
| 27129 | g_variant_builder_clear (&invalidated_builder); |
| 27130 | } |
| 27131 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 27132 | skeleton->priv->changed_properties = NULL; |
| 27133 | skeleton->priv->changed_properties_idle_source = NULL; |
| 27134 | g_mutex_unlock (&skeleton->priv->lock); |
| 27135 | return FALSE; |
| 27136 | } |
| 27137 | |
| 27138 | static void |
| 27139 | _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 27140 | { |
| 27141 | ChangedProperty *cp; |
| 27142 | GList *l; |
| 27143 | cp = NULL; |
| 27144 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 27145 | { |
| 27146 | ChangedProperty *i_cp = l->data; |
| 27147 | if (i_cp->info == info) |
| 27148 | { |
| 27149 | cp = i_cp; |
| 27150 | break; |
| 27151 | } |
| 27152 | } |
| 27153 | if (cp == NULL) |
| 27154 | { |
| 27155 | cp = g_new0 (ChangedProperty, 1); |
| 27156 | cp->prop_id = prop_id; |
| 27157 | cp->info = info; |
| 27158 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 27159 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 27160 | g_value_copy (orig_value, &cp->orig_value); |
| 27161 | } |
| 27162 | } |
| 27163 | |
| 27164 | static void |
| 27165 | button_skeleton_notify (GObject *object, |
| 27166 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27167 | { |
| 27168 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 27169 | g_mutex_lock (&skeleton->priv->lock); |
| 27170 | if (skeleton->priv->changed_properties != NULL && |
| 27171 | skeleton->priv->changed_properties_idle_source == NULL) |
| 27172 | { |
| 27173 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 27174 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 27175 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 27176 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 27177 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 27178 | } |
| 27179 | g_mutex_unlock (&skeleton->priv->lock); |
| 27180 | } |
| 27181 | |
| 27182 | static void |
| 27183 | button_skeleton_set_property (GObject *object, |
| 27184 | guint prop_id, |
| 27185 | const GValue *value, |
| 27186 | GParamSpec *pspec) |
| 27187 | { |
| 27188 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27189 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27190 | g_mutex_lock (&skeleton->priv->lock); |
| 27191 | g_object_freeze_notify (object); |
| 27192 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 27193 | { |
| 27194 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 27195 | _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 27196 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 27197 | g_object_notify_by_pspec (object, pspec); |
| 27198 | } |
| 27199 | g_mutex_unlock (&skeleton->priv->lock); |
| 27200 | g_object_thaw_notify (object); |
| 27201 | } |
| 27202 | |
| 27203 | static void |
| 27204 | button_skeleton_init (ButtonSkeleton *skeleton) |
| 27205 | { |
| 27206 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 27207 | skeleton->priv = button_skeleton_get_instance_private (skeleton); |
| 27208 | #else |
| 27209 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate); |
| 27210 | #endif |
| 27211 | |
| 27212 | g_mutex_init (&skeleton->priv->lock); |
| 27213 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27214 | skeleton->priv->properties = g_new0 (GValue, 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27215 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27216 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27217 | } |
| 27218 | |
| 27219 | static gboolean |
| 27220 | button_skeleton_get_state (Button *object) |
| 27221 | { |
| 27222 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 27223 | gboolean value; |
| 27224 | g_mutex_lock (&skeleton->priv->lock); |
| 27225 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 27226 | g_mutex_unlock (&skeleton->priv->lock); |
| 27227 | return value; |
| 27228 | } |
| 27229 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27230 | static guint64 |
| 27231 | button_skeleton_get_timer (Button *object) |
| 27232 | { |
| 27233 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 27234 | guint64 value; |
| 27235 | g_mutex_lock (&skeleton->priv->lock); |
| 27236 | value = g_value_get_uint64 (&(skeleton->priv->properties[1])); |
| 27237 | g_mutex_unlock (&skeleton->priv->lock); |
| 27238 | return value; |
| 27239 | } |
| 27240 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27241 | static void |
| 27242 | button_skeleton_class_init (ButtonSkeletonClass *klass) |
| 27243 | { |
| 27244 | GObjectClass *gobject_class; |
| 27245 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 27246 | |
| 27247 | gobject_class = G_OBJECT_CLASS (klass); |
| 27248 | gobject_class->finalize = button_skeleton_finalize; |
| 27249 | gobject_class->get_property = button_skeleton_get_property; |
| 27250 | gobject_class->set_property = button_skeleton_set_property; |
| 27251 | gobject_class->notify = button_skeleton_notify; |
| 27252 | |
| 27253 | |
| 27254 | button_override_properties (gobject_class, 1); |
| 27255 | |
| 27256 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 27257 | skeleton_class->get_info = button_skeleton_dbus_interface_get_info; |
| 27258 | skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties; |
| 27259 | skeleton_class->flush = button_skeleton_dbus_interface_flush; |
| 27260 | skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable; |
| 27261 | |
| 27262 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 27263 | g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate)); |
| 27264 | #endif |
| 27265 | } |
| 27266 | |
| 27267 | static void |
| 27268 | button_skeleton_iface_init (ButtonIface *iface) |
| 27269 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27270 | iface->released = _button_on_signal_released; |
| 27271 | iface->pressed = _button_on_signal_pressed; |
| 27272 | iface->pressed_long = _button_on_signal_pressed_long; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27273 | iface->get_state = button_skeleton_get_state; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27274 | iface->get_timer = button_skeleton_get_timer; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27275 | } |
| 27276 | |
| 27277 | /** |
| 27278 | * button_skeleton_new: |
| 27279 | * |
| 27280 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 27281 | * |
| 27282 | * Returns: (transfer full) (type ButtonSkeleton): The skeleton object. |
| 27283 | */ |
| 27284 | Button * |
| 27285 | button_skeleton_new (void) |
| 27286 | { |
| 27287 | return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL)); |
| 27288 | } |
| 27289 | |
| 27290 | /* ------------------------------------------------------------------------ |
| 27291 | * Code for interface org.openbmc.Led |
| 27292 | * ------------------------------------------------------------------------ |
| 27293 | */ |
| 27294 | |
| 27295 | /** |
| 27296 | * SECTION:Led |
| 27297 | * @title: Led |
| 27298 | * @short_description: Generated C code for the org.openbmc.Led D-Bus interface |
| 27299 | * |
| 27300 | * 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. |
| 27301 | */ |
| 27302 | |
| 27303 | /* ---- Introspection data for org.openbmc.Led ---- */ |
| 27304 | |
| 27305 | static const _ExtendedGDBusMethodInfo _led_method_info_set_on = |
| 27306 | { |
| 27307 | { |
| 27308 | -1, |
| 27309 | (gchar *) "setOn", |
| 27310 | NULL, |
| 27311 | NULL, |
| 27312 | NULL |
| 27313 | }, |
| 27314 | "handle-set-on", |
| 27315 | FALSE |
| 27316 | }; |
| 27317 | |
| 27318 | static const _ExtendedGDBusMethodInfo _led_method_info_set_off = |
| 27319 | { |
| 27320 | { |
| 27321 | -1, |
| 27322 | (gchar *) "setOff", |
| 27323 | NULL, |
| 27324 | NULL, |
| 27325 | NULL |
| 27326 | }, |
| 27327 | "handle-set-off", |
| 27328 | FALSE |
| 27329 | }; |
| 27330 | |
| 27331 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow = |
| 27332 | { |
| 27333 | { |
| 27334 | -1, |
| 27335 | (gchar *) "setBlinkSlow", |
| 27336 | NULL, |
| 27337 | NULL, |
| 27338 | NULL |
| 27339 | }, |
| 27340 | "handle-set-blink-slow", |
| 27341 | FALSE |
| 27342 | }; |
| 27343 | |
| 27344 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast = |
| 27345 | { |
| 27346 | { |
| 27347 | -1, |
| 27348 | (gchar *) "setBlinkFast", |
| 27349 | NULL, |
| 27350 | NULL, |
| 27351 | NULL |
| 27352 | }, |
| 27353 | "handle-set-blink-fast", |
| 27354 | FALSE |
| 27355 | }; |
| 27356 | |
| 27357 | static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] = |
| 27358 | { |
| 27359 | &_led_method_info_set_on, |
| 27360 | &_led_method_info_set_off, |
| 27361 | &_led_method_info_set_blink_slow, |
| 27362 | &_led_method_info_set_blink_fast, |
| 27363 | NULL |
| 27364 | }; |
| 27365 | |
| 27366 | static const _ExtendedGDBusPropertyInfo _led_property_info_color = |
| 27367 | { |
| 27368 | { |
| 27369 | -1, |
| 27370 | (gchar *) "color", |
| 27371 | (gchar *) "i", |
| 27372 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 27373 | NULL |
| 27374 | }, |
| 27375 | "color", |
| 27376 | FALSE |
| 27377 | }; |
| 27378 | |
| 27379 | static const _ExtendedGDBusPropertyInfo _led_property_info_function = |
| 27380 | { |
| 27381 | { |
| 27382 | -1, |
| 27383 | (gchar *) "function", |
| 27384 | (gchar *) "s", |
| 27385 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 27386 | NULL |
| 27387 | }, |
| 27388 | "function", |
| 27389 | FALSE |
| 27390 | }; |
| 27391 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27392 | static const _ExtendedGDBusPropertyInfo _led_property_info_state = |
| 27393 | { |
| 27394 | { |
| 27395 | -1, |
| 27396 | (gchar *) "state", |
| 27397 | (gchar *) "s", |
| 27398 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 27399 | NULL |
| 27400 | }, |
| 27401 | "state", |
| 27402 | FALSE |
| 27403 | }; |
| 27404 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27405 | static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] = |
| 27406 | { |
| 27407 | &_led_property_info_color, |
| 27408 | &_led_property_info_function, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27409 | &_led_property_info_state, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27410 | NULL |
| 27411 | }; |
| 27412 | |
| 27413 | static const _ExtendedGDBusInterfaceInfo _led_interface_info = |
| 27414 | { |
| 27415 | { |
| 27416 | -1, |
| 27417 | (gchar *) "org.openbmc.Led", |
| 27418 | (GDBusMethodInfo **) &_led_method_info_pointers, |
| 27419 | NULL, |
| 27420 | (GDBusPropertyInfo **) &_led_property_info_pointers, |
| 27421 | NULL |
| 27422 | }, |
| 27423 | "led", |
| 27424 | }; |
| 27425 | |
| 27426 | |
| 27427 | /** |
| 27428 | * led_interface_info: |
| 27429 | * |
| 27430 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface. |
| 27431 | * |
| 27432 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 27433 | */ |
| 27434 | GDBusInterfaceInfo * |
| 27435 | led_interface_info (void) |
| 27436 | { |
| 27437 | return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct; |
| 27438 | } |
| 27439 | |
| 27440 | /** |
| 27441 | * led_override_properties: |
| 27442 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 27443 | * @property_id_begin: The property id to assign to the first overridden property. |
| 27444 | * |
| 27445 | * Overrides all #GObject properties in the #Led interface for a concrete class. |
| 27446 | * The properties are overridden in the order they are defined. |
| 27447 | * |
| 27448 | * Returns: The last property id. |
| 27449 | */ |
| 27450 | guint |
| 27451 | led_override_properties (GObjectClass *klass, guint property_id_begin) |
| 27452 | { |
| 27453 | g_object_class_override_property (klass, property_id_begin++, "color"); |
| 27454 | g_object_class_override_property (klass, property_id_begin++, "function"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27455 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27456 | return property_id_begin - 1; |
| 27457 | } |
| 27458 | |
| 27459 | |
| 27460 | |
| 27461 | /** |
| 27462 | * Led: |
| 27463 | * |
| 27464 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 27465 | */ |
| 27466 | |
| 27467 | /** |
| 27468 | * LedIface: |
| 27469 | * @parent_iface: The parent interface. |
| 27470 | * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal. |
| 27471 | * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal. |
| 27472 | * @handle_set_off: Handler for the #Led::handle-set-off signal. |
| 27473 | * @handle_set_on: Handler for the #Led::handle-set-on signal. |
| 27474 | * @get_color: Getter for the #Led:color property. |
| 27475 | * @get_function: Getter for the #Led:function property. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27476 | * @get_state: Getter for the #Led:state property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27477 | * |
| 27478 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 27479 | */ |
| 27480 | |
| 27481 | typedef LedIface LedInterface; |
| 27482 | G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT); |
| 27483 | |
| 27484 | static void |
| 27485 | led_default_init (LedIface *iface) |
| 27486 | { |
| 27487 | /* GObject signals for incoming D-Bus method calls: */ |
| 27488 | /** |
| 27489 | * Led::handle-set-on: |
| 27490 | * @object: A #Led. |
| 27491 | * @invocation: A #GDBusMethodInvocation. |
| 27492 | * |
| 27493 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. |
| 27494 | * |
| 27495 | * 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. |
| 27496 | * |
| 27497 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 27498 | */ |
| 27499 | g_signal_new ("handle-set-on", |
| 27500 | G_TYPE_FROM_INTERFACE (iface), |
| 27501 | G_SIGNAL_RUN_LAST, |
| 27502 | G_STRUCT_OFFSET (LedIface, handle_set_on), |
| 27503 | g_signal_accumulator_true_handled, |
| 27504 | NULL, |
| 27505 | g_cclosure_marshal_generic, |
| 27506 | G_TYPE_BOOLEAN, |
| 27507 | 1, |
| 27508 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 27509 | |
| 27510 | /** |
| 27511 | * Led::handle-set-off: |
| 27512 | * @object: A #Led. |
| 27513 | * @invocation: A #GDBusMethodInvocation. |
| 27514 | * |
| 27515 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. |
| 27516 | * |
| 27517 | * 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. |
| 27518 | * |
| 27519 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 27520 | */ |
| 27521 | g_signal_new ("handle-set-off", |
| 27522 | G_TYPE_FROM_INTERFACE (iface), |
| 27523 | G_SIGNAL_RUN_LAST, |
| 27524 | G_STRUCT_OFFSET (LedIface, handle_set_off), |
| 27525 | g_signal_accumulator_true_handled, |
| 27526 | NULL, |
| 27527 | g_cclosure_marshal_generic, |
| 27528 | G_TYPE_BOOLEAN, |
| 27529 | 1, |
| 27530 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 27531 | |
| 27532 | /** |
| 27533 | * Led::handle-set-blink-slow: |
| 27534 | * @object: A #Led. |
| 27535 | * @invocation: A #GDBusMethodInvocation. |
| 27536 | * |
| 27537 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. |
| 27538 | * |
| 27539 | * 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. |
| 27540 | * |
| 27541 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 27542 | */ |
| 27543 | g_signal_new ("handle-set-blink-slow", |
| 27544 | G_TYPE_FROM_INTERFACE (iface), |
| 27545 | G_SIGNAL_RUN_LAST, |
| 27546 | G_STRUCT_OFFSET (LedIface, handle_set_blink_slow), |
| 27547 | g_signal_accumulator_true_handled, |
| 27548 | NULL, |
| 27549 | g_cclosure_marshal_generic, |
| 27550 | G_TYPE_BOOLEAN, |
| 27551 | 1, |
| 27552 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 27553 | |
| 27554 | /** |
| 27555 | * Led::handle-set-blink-fast: |
| 27556 | * @object: A #Led. |
| 27557 | * @invocation: A #GDBusMethodInvocation. |
| 27558 | * |
| 27559 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. |
| 27560 | * |
| 27561 | * 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. |
| 27562 | * |
| 27563 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 27564 | */ |
| 27565 | g_signal_new ("handle-set-blink-fast", |
| 27566 | G_TYPE_FROM_INTERFACE (iface), |
| 27567 | G_SIGNAL_RUN_LAST, |
| 27568 | G_STRUCT_OFFSET (LedIface, handle_set_blink_fast), |
| 27569 | g_signal_accumulator_true_handled, |
| 27570 | NULL, |
| 27571 | g_cclosure_marshal_generic, |
| 27572 | G_TYPE_BOOLEAN, |
| 27573 | 1, |
| 27574 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 27575 | |
| 27576 | /* GObject properties for D-Bus properties: */ |
| 27577 | /** |
| 27578 | * Led:color: |
| 27579 | * |
| 27580 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>. |
| 27581 | * |
| 27582 | * 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. |
| 27583 | */ |
| 27584 | g_object_interface_install_property (iface, |
| 27585 | g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 27586 | /** |
| 27587 | * Led:function: |
| 27588 | * |
| 27589 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>. |
| 27590 | * |
| 27591 | * 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. |
| 27592 | */ |
| 27593 | g_object_interface_install_property (iface, |
| 27594 | g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27595 | /** |
| 27596 | * Led:state: |
| 27597 | * |
| 27598 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>. |
| 27599 | * |
| 27600 | * 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. |
| 27601 | */ |
| 27602 | g_object_interface_install_property (iface, |
| 27603 | g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27604 | } |
| 27605 | |
| 27606 | /** |
| 27607 | * led_get_color: (skip) |
| 27608 | * @object: A #Led. |
| 27609 | * |
| 27610 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property. |
| 27611 | * |
| 27612 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 27613 | * |
| 27614 | * Returns: The property value. |
| 27615 | */ |
| 27616 | gint |
| 27617 | led_get_color (Led *object) |
| 27618 | { |
| 27619 | return LED_GET_IFACE (object)->get_color (object); |
| 27620 | } |
| 27621 | |
| 27622 | /** |
| 27623 | * led_set_color: (skip) |
| 27624 | * @object: A #Led. |
| 27625 | * @value: The value to set. |
| 27626 | * |
| 27627 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value. |
| 27628 | * |
| 27629 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 27630 | */ |
| 27631 | void |
| 27632 | led_set_color (Led *object, gint value) |
| 27633 | { |
| 27634 | g_object_set (G_OBJECT (object), "color", value, NULL); |
| 27635 | } |
| 27636 | |
| 27637 | /** |
| 27638 | * led_get_function: (skip) |
| 27639 | * @object: A #Led. |
| 27640 | * |
| 27641 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 27642 | * |
| 27643 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 27644 | * |
| 27645 | * <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> |
| 27646 | * |
| 27647 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 27648 | */ |
| 27649 | const gchar * |
| 27650 | led_get_function (Led *object) |
| 27651 | { |
| 27652 | return LED_GET_IFACE (object)->get_function (object); |
| 27653 | } |
| 27654 | |
| 27655 | /** |
| 27656 | * led_dup_function: (skip) |
| 27657 | * @object: A #Led. |
| 27658 | * |
| 27659 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 27660 | * |
| 27661 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 27662 | * |
| 27663 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 27664 | */ |
| 27665 | gchar * |
| 27666 | led_dup_function (Led *object) |
| 27667 | { |
| 27668 | gchar *value; |
| 27669 | g_object_get (G_OBJECT (object), "function", &value, NULL); |
| 27670 | return value; |
| 27671 | } |
| 27672 | |
| 27673 | /** |
| 27674 | * led_set_function: (skip) |
| 27675 | * @object: A #Led. |
| 27676 | * @value: The value to set. |
| 27677 | * |
| 27678 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value. |
| 27679 | * |
| 27680 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 27681 | */ |
| 27682 | void |
| 27683 | led_set_function (Led *object, const gchar *value) |
| 27684 | { |
| 27685 | g_object_set (G_OBJECT (object), "function", value, NULL); |
| 27686 | } |
| 27687 | |
| 27688 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27689 | * led_get_state: (skip) |
| 27690 | * @object: A #Led. |
| 27691 | * |
| 27692 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. |
| 27693 | * |
| 27694 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 27695 | * |
| 27696 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_state() if on another thread.</warning> |
| 27697 | * |
| 27698 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 27699 | */ |
| 27700 | const gchar * |
| 27701 | led_get_state (Led *object) |
| 27702 | { |
| 27703 | return LED_GET_IFACE (object)->get_state (object); |
| 27704 | } |
| 27705 | |
| 27706 | /** |
| 27707 | * led_dup_state: (skip) |
| 27708 | * @object: A #Led. |
| 27709 | * |
| 27710 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. |
| 27711 | * |
| 27712 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 27713 | * |
| 27714 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 27715 | */ |
| 27716 | gchar * |
| 27717 | led_dup_state (Led *object) |
| 27718 | { |
| 27719 | gchar *value; |
| 27720 | g_object_get (G_OBJECT (object), "state", &value, NULL); |
| 27721 | return value; |
| 27722 | } |
| 27723 | |
| 27724 | /** |
| 27725 | * led_set_state: (skip) |
| 27726 | * @object: A #Led. |
| 27727 | * @value: The value to set. |
| 27728 | * |
| 27729 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value. |
| 27730 | * |
| 27731 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 27732 | */ |
| 27733 | void |
| 27734 | led_set_state (Led *object, const gchar *value) |
| 27735 | { |
| 27736 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 27737 | } |
| 27738 | |
| 27739 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27740 | * led_call_set_on: |
| 27741 | * @proxy: A #LedProxy. |
| 27742 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27743 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 27744 | * @user_data: User data to pass to @callback. |
| 27745 | * |
| 27746 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. |
| 27747 | * 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. |
| 27748 | * You can then call led_call_set_on_finish() to get the result of the operation. |
| 27749 | * |
| 27750 | * See led_call_set_on_sync() for the synchronous, blocking version of this method. |
| 27751 | */ |
| 27752 | void |
| 27753 | led_call_set_on ( |
| 27754 | Led *proxy, |
| 27755 | GCancellable *cancellable, |
| 27756 | GAsyncReadyCallback callback, |
| 27757 | gpointer user_data) |
| 27758 | { |
| 27759 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 27760 | "setOn", |
| 27761 | g_variant_new ("()"), |
| 27762 | G_DBUS_CALL_FLAGS_NONE, |
| 27763 | -1, |
| 27764 | cancellable, |
| 27765 | callback, |
| 27766 | user_data); |
| 27767 | } |
| 27768 | |
| 27769 | /** |
| 27770 | * led_call_set_on_finish: |
| 27771 | * @proxy: A #LedProxy. |
| 27772 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on(). |
| 27773 | * @error: Return location for error or %NULL. |
| 27774 | * |
| 27775 | * Finishes an operation started with led_call_set_on(). |
| 27776 | * |
| 27777 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27778 | */ |
| 27779 | gboolean |
| 27780 | led_call_set_on_finish ( |
| 27781 | Led *proxy, |
| 27782 | GAsyncResult *res, |
| 27783 | GError **error) |
| 27784 | { |
| 27785 | GVariant *_ret; |
| 27786 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 27787 | if (_ret == NULL) |
| 27788 | goto _out; |
| 27789 | g_variant_get (_ret, |
| 27790 | "()"); |
| 27791 | g_variant_unref (_ret); |
| 27792 | _out: |
| 27793 | return _ret != NULL; |
| 27794 | } |
| 27795 | |
| 27796 | /** |
| 27797 | * led_call_set_on_sync: |
| 27798 | * @proxy: A #LedProxy. |
| 27799 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27800 | * @error: Return location for error or %NULL. |
| 27801 | * |
| 27802 | * 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. |
| 27803 | * |
| 27804 | * See led_call_set_on() for the asynchronous version of this method. |
| 27805 | * |
| 27806 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27807 | */ |
| 27808 | gboolean |
| 27809 | led_call_set_on_sync ( |
| 27810 | Led *proxy, |
| 27811 | GCancellable *cancellable, |
| 27812 | GError **error) |
| 27813 | { |
| 27814 | GVariant *_ret; |
| 27815 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 27816 | "setOn", |
| 27817 | g_variant_new ("()"), |
| 27818 | G_DBUS_CALL_FLAGS_NONE, |
| 27819 | -1, |
| 27820 | cancellable, |
| 27821 | error); |
| 27822 | if (_ret == NULL) |
| 27823 | goto _out; |
| 27824 | g_variant_get (_ret, |
| 27825 | "()"); |
| 27826 | g_variant_unref (_ret); |
| 27827 | _out: |
| 27828 | return _ret != NULL; |
| 27829 | } |
| 27830 | |
| 27831 | /** |
| 27832 | * led_call_set_off: |
| 27833 | * @proxy: A #LedProxy. |
| 27834 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27835 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 27836 | * @user_data: User data to pass to @callback. |
| 27837 | * |
| 27838 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. |
| 27839 | * 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. |
| 27840 | * You can then call led_call_set_off_finish() to get the result of the operation. |
| 27841 | * |
| 27842 | * See led_call_set_off_sync() for the synchronous, blocking version of this method. |
| 27843 | */ |
| 27844 | void |
| 27845 | led_call_set_off ( |
| 27846 | Led *proxy, |
| 27847 | GCancellable *cancellable, |
| 27848 | GAsyncReadyCallback callback, |
| 27849 | gpointer user_data) |
| 27850 | { |
| 27851 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 27852 | "setOff", |
| 27853 | g_variant_new ("()"), |
| 27854 | G_DBUS_CALL_FLAGS_NONE, |
| 27855 | -1, |
| 27856 | cancellable, |
| 27857 | callback, |
| 27858 | user_data); |
| 27859 | } |
| 27860 | |
| 27861 | /** |
| 27862 | * led_call_set_off_finish: |
| 27863 | * @proxy: A #LedProxy. |
| 27864 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off(). |
| 27865 | * @error: Return location for error or %NULL. |
| 27866 | * |
| 27867 | * Finishes an operation started with led_call_set_off(). |
| 27868 | * |
| 27869 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27870 | */ |
| 27871 | gboolean |
| 27872 | led_call_set_off_finish ( |
| 27873 | Led *proxy, |
| 27874 | GAsyncResult *res, |
| 27875 | GError **error) |
| 27876 | { |
| 27877 | GVariant *_ret; |
| 27878 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 27879 | if (_ret == NULL) |
| 27880 | goto _out; |
| 27881 | g_variant_get (_ret, |
| 27882 | "()"); |
| 27883 | g_variant_unref (_ret); |
| 27884 | _out: |
| 27885 | return _ret != NULL; |
| 27886 | } |
| 27887 | |
| 27888 | /** |
| 27889 | * led_call_set_off_sync: |
| 27890 | * @proxy: A #LedProxy. |
| 27891 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27892 | * @error: Return location for error or %NULL. |
| 27893 | * |
| 27894 | * 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. |
| 27895 | * |
| 27896 | * See led_call_set_off() for the asynchronous version of this method. |
| 27897 | * |
| 27898 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27899 | */ |
| 27900 | gboolean |
| 27901 | led_call_set_off_sync ( |
| 27902 | Led *proxy, |
| 27903 | GCancellable *cancellable, |
| 27904 | GError **error) |
| 27905 | { |
| 27906 | GVariant *_ret; |
| 27907 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 27908 | "setOff", |
| 27909 | g_variant_new ("()"), |
| 27910 | G_DBUS_CALL_FLAGS_NONE, |
| 27911 | -1, |
| 27912 | cancellable, |
| 27913 | error); |
| 27914 | if (_ret == NULL) |
| 27915 | goto _out; |
| 27916 | g_variant_get (_ret, |
| 27917 | "()"); |
| 27918 | g_variant_unref (_ret); |
| 27919 | _out: |
| 27920 | return _ret != NULL; |
| 27921 | } |
| 27922 | |
| 27923 | /** |
| 27924 | * led_call_set_blink_slow: |
| 27925 | * @proxy: A #LedProxy. |
| 27926 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27927 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 27928 | * @user_data: User data to pass to @callback. |
| 27929 | * |
| 27930 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. |
| 27931 | * 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. |
| 27932 | * You can then call led_call_set_blink_slow_finish() to get the result of the operation. |
| 27933 | * |
| 27934 | * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method. |
| 27935 | */ |
| 27936 | void |
| 27937 | led_call_set_blink_slow ( |
| 27938 | Led *proxy, |
| 27939 | GCancellable *cancellable, |
| 27940 | GAsyncReadyCallback callback, |
| 27941 | gpointer user_data) |
| 27942 | { |
| 27943 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 27944 | "setBlinkSlow", |
| 27945 | g_variant_new ("()"), |
| 27946 | G_DBUS_CALL_FLAGS_NONE, |
| 27947 | -1, |
| 27948 | cancellable, |
| 27949 | callback, |
| 27950 | user_data); |
| 27951 | } |
| 27952 | |
| 27953 | /** |
| 27954 | * led_call_set_blink_slow_finish: |
| 27955 | * @proxy: A #LedProxy. |
| 27956 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow(). |
| 27957 | * @error: Return location for error or %NULL. |
| 27958 | * |
| 27959 | * Finishes an operation started with led_call_set_blink_slow(). |
| 27960 | * |
| 27961 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27962 | */ |
| 27963 | gboolean |
| 27964 | led_call_set_blink_slow_finish ( |
| 27965 | Led *proxy, |
| 27966 | GAsyncResult *res, |
| 27967 | GError **error) |
| 27968 | { |
| 27969 | GVariant *_ret; |
| 27970 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 27971 | if (_ret == NULL) |
| 27972 | goto _out; |
| 27973 | g_variant_get (_ret, |
| 27974 | "()"); |
| 27975 | g_variant_unref (_ret); |
| 27976 | _out: |
| 27977 | return _ret != NULL; |
| 27978 | } |
| 27979 | |
| 27980 | /** |
| 27981 | * led_call_set_blink_slow_sync: |
| 27982 | * @proxy: A #LedProxy. |
| 27983 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27984 | * @error: Return location for error or %NULL. |
| 27985 | * |
| 27986 | * 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. |
| 27987 | * |
| 27988 | * See led_call_set_blink_slow() for the asynchronous version of this method. |
| 27989 | * |
| 27990 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 27991 | */ |
| 27992 | gboolean |
| 27993 | led_call_set_blink_slow_sync ( |
| 27994 | Led *proxy, |
| 27995 | GCancellable *cancellable, |
| 27996 | GError **error) |
| 27997 | { |
| 27998 | GVariant *_ret; |
| 27999 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 28000 | "setBlinkSlow", |
| 28001 | g_variant_new ("()"), |
| 28002 | G_DBUS_CALL_FLAGS_NONE, |
| 28003 | -1, |
| 28004 | cancellable, |
| 28005 | error); |
| 28006 | if (_ret == NULL) |
| 28007 | goto _out; |
| 28008 | g_variant_get (_ret, |
| 28009 | "()"); |
| 28010 | g_variant_unref (_ret); |
| 28011 | _out: |
| 28012 | return _ret != NULL; |
| 28013 | } |
| 28014 | |
| 28015 | /** |
| 28016 | * led_call_set_blink_fast: |
| 28017 | * @proxy: A #LedProxy. |
| 28018 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28019 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 28020 | * @user_data: User data to pass to @callback. |
| 28021 | * |
| 28022 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. |
| 28023 | * 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. |
| 28024 | * You can then call led_call_set_blink_fast_finish() to get the result of the operation. |
| 28025 | * |
| 28026 | * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method. |
| 28027 | */ |
| 28028 | void |
| 28029 | led_call_set_blink_fast ( |
| 28030 | Led *proxy, |
| 28031 | GCancellable *cancellable, |
| 28032 | GAsyncReadyCallback callback, |
| 28033 | gpointer user_data) |
| 28034 | { |
| 28035 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 28036 | "setBlinkFast", |
| 28037 | g_variant_new ("()"), |
| 28038 | G_DBUS_CALL_FLAGS_NONE, |
| 28039 | -1, |
| 28040 | cancellable, |
| 28041 | callback, |
| 28042 | user_data); |
| 28043 | } |
| 28044 | |
| 28045 | /** |
| 28046 | * led_call_set_blink_fast_finish: |
| 28047 | * @proxy: A #LedProxy. |
| 28048 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast(). |
| 28049 | * @error: Return location for error or %NULL. |
| 28050 | * |
| 28051 | * Finishes an operation started with led_call_set_blink_fast(). |
| 28052 | * |
| 28053 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 28054 | */ |
| 28055 | gboolean |
| 28056 | led_call_set_blink_fast_finish ( |
| 28057 | Led *proxy, |
| 28058 | GAsyncResult *res, |
| 28059 | GError **error) |
| 28060 | { |
| 28061 | GVariant *_ret; |
| 28062 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 28063 | if (_ret == NULL) |
| 28064 | goto _out; |
| 28065 | g_variant_get (_ret, |
| 28066 | "()"); |
| 28067 | g_variant_unref (_ret); |
| 28068 | _out: |
| 28069 | return _ret != NULL; |
| 28070 | } |
| 28071 | |
| 28072 | /** |
| 28073 | * led_call_set_blink_fast_sync: |
| 28074 | * @proxy: A #LedProxy. |
| 28075 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28076 | * @error: Return location for error or %NULL. |
| 28077 | * |
| 28078 | * 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. |
| 28079 | * |
| 28080 | * See led_call_set_blink_fast() for the asynchronous version of this method. |
| 28081 | * |
| 28082 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 28083 | */ |
| 28084 | gboolean |
| 28085 | led_call_set_blink_fast_sync ( |
| 28086 | Led *proxy, |
| 28087 | GCancellable *cancellable, |
| 28088 | GError **error) |
| 28089 | { |
| 28090 | GVariant *_ret; |
| 28091 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 28092 | "setBlinkFast", |
| 28093 | g_variant_new ("()"), |
| 28094 | G_DBUS_CALL_FLAGS_NONE, |
| 28095 | -1, |
| 28096 | cancellable, |
| 28097 | error); |
| 28098 | if (_ret == NULL) |
| 28099 | goto _out; |
| 28100 | g_variant_get (_ret, |
| 28101 | "()"); |
| 28102 | g_variant_unref (_ret); |
| 28103 | _out: |
| 28104 | return _ret != NULL; |
| 28105 | } |
| 28106 | |
| 28107 | /** |
| 28108 | * led_complete_set_on: |
| 28109 | * @object: A #Led. |
| 28110 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 28111 | * |
| 28112 | * 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. |
| 28113 | * |
| 28114 | * This method will free @invocation, you cannot use it afterwards. |
| 28115 | */ |
| 28116 | void |
| 28117 | led_complete_set_on ( |
| 28118 | Led *object, |
| 28119 | GDBusMethodInvocation *invocation) |
| 28120 | { |
| 28121 | g_dbus_method_invocation_return_value (invocation, |
| 28122 | g_variant_new ("()")); |
| 28123 | } |
| 28124 | |
| 28125 | /** |
| 28126 | * led_complete_set_off: |
| 28127 | * @object: A #Led. |
| 28128 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 28129 | * |
| 28130 | * 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. |
| 28131 | * |
| 28132 | * This method will free @invocation, you cannot use it afterwards. |
| 28133 | */ |
| 28134 | void |
| 28135 | led_complete_set_off ( |
| 28136 | Led *object, |
| 28137 | GDBusMethodInvocation *invocation) |
| 28138 | { |
| 28139 | g_dbus_method_invocation_return_value (invocation, |
| 28140 | g_variant_new ("()")); |
| 28141 | } |
| 28142 | |
| 28143 | /** |
| 28144 | * led_complete_set_blink_slow: |
| 28145 | * @object: A #Led. |
| 28146 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 28147 | * |
| 28148 | * 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. |
| 28149 | * |
| 28150 | * This method will free @invocation, you cannot use it afterwards. |
| 28151 | */ |
| 28152 | void |
| 28153 | led_complete_set_blink_slow ( |
| 28154 | Led *object, |
| 28155 | GDBusMethodInvocation *invocation) |
| 28156 | { |
| 28157 | g_dbus_method_invocation_return_value (invocation, |
| 28158 | g_variant_new ("()")); |
| 28159 | } |
| 28160 | |
| 28161 | /** |
| 28162 | * led_complete_set_blink_fast: |
| 28163 | * @object: A #Led. |
| 28164 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 28165 | * |
| 28166 | * 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. |
| 28167 | * |
| 28168 | * This method will free @invocation, you cannot use it afterwards. |
| 28169 | */ |
| 28170 | void |
| 28171 | led_complete_set_blink_fast ( |
| 28172 | Led *object, |
| 28173 | GDBusMethodInvocation *invocation) |
| 28174 | { |
| 28175 | g_dbus_method_invocation_return_value (invocation, |
| 28176 | g_variant_new ("()")); |
| 28177 | } |
| 28178 | |
| 28179 | /* ------------------------------------------------------------------------ */ |
| 28180 | |
| 28181 | /** |
| 28182 | * LedProxy: |
| 28183 | * |
| 28184 | * The #LedProxy structure contains only private data and should only be accessed using the provided API. |
| 28185 | */ |
| 28186 | |
| 28187 | /** |
| 28188 | * LedProxyClass: |
| 28189 | * @parent_class: The parent class. |
| 28190 | * |
| 28191 | * Class structure for #LedProxy. |
| 28192 | */ |
| 28193 | |
| 28194 | struct _LedProxyPrivate |
| 28195 | { |
| 28196 | GData *qdata; |
| 28197 | }; |
| 28198 | |
| 28199 | static void led_proxy_iface_init (LedIface *iface); |
| 28200 | |
| 28201 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28202 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 28203 | G_ADD_PRIVATE (LedProxy) |
| 28204 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 28205 | |
| 28206 | #else |
| 28207 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 28208 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 28209 | |
| 28210 | #endif |
| 28211 | static void |
| 28212 | led_proxy_finalize (GObject *object) |
| 28213 | { |
| 28214 | LedProxy *proxy = LED_PROXY (object); |
| 28215 | g_datalist_clear (&proxy->priv->qdata); |
| 28216 | G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object); |
| 28217 | } |
| 28218 | |
| 28219 | static void |
| 28220 | led_proxy_get_property (GObject *object, |
| 28221 | guint prop_id, |
| 28222 | GValue *value, |
| 28223 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28224 | { |
| 28225 | const _ExtendedGDBusPropertyInfo *info; |
| 28226 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28227 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28228 | info = _led_property_info_pointers[prop_id - 1]; |
| 28229 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 28230 | if (info->use_gvariant) |
| 28231 | { |
| 28232 | g_value_set_variant (value, variant); |
| 28233 | } |
| 28234 | else |
| 28235 | { |
| 28236 | if (variant != NULL) |
| 28237 | g_dbus_gvariant_to_gvalue (variant, value); |
| 28238 | } |
| 28239 | if (variant != NULL) |
| 28240 | g_variant_unref (variant); |
| 28241 | } |
| 28242 | |
| 28243 | static void |
| 28244 | led_proxy_set_property_cb (GDBusProxy *proxy, |
| 28245 | GAsyncResult *res, |
| 28246 | gpointer user_data) |
| 28247 | { |
| 28248 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 28249 | GError *error; |
| 28250 | GVariant *_ret; |
| 28251 | error = NULL; |
| 28252 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 28253 | if (!_ret) |
| 28254 | { |
| 28255 | g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)", |
| 28256 | info->parent_struct.name, |
| 28257 | error->message, g_quark_to_string (error->domain), error->code); |
| 28258 | g_error_free (error); |
| 28259 | } |
| 28260 | else |
| 28261 | { |
| 28262 | g_variant_unref (_ret); |
| 28263 | } |
| 28264 | } |
| 28265 | |
| 28266 | static void |
| 28267 | led_proxy_set_property (GObject *object, |
| 28268 | guint prop_id, |
| 28269 | const GValue *value, |
| 28270 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28271 | { |
| 28272 | const _ExtendedGDBusPropertyInfo *info; |
| 28273 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28274 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28275 | info = _led_property_info_pointers[prop_id - 1]; |
| 28276 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 28277 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 28278 | "org.freedesktop.DBus.Properties.Set", |
| 28279 | g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant), |
| 28280 | G_DBUS_CALL_FLAGS_NONE, |
| 28281 | -1, |
| 28282 | NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 28283 | g_variant_unref (variant); |
| 28284 | } |
| 28285 | |
| 28286 | static void |
| 28287 | led_proxy_g_signal (GDBusProxy *proxy, |
| 28288 | const gchar *sender_name G_GNUC_UNUSED, |
| 28289 | const gchar *signal_name, |
| 28290 | GVariant *parameters) |
| 28291 | { |
| 28292 | _ExtendedGDBusSignalInfo *info; |
| 28293 | GVariantIter iter; |
| 28294 | GVariant *child; |
| 28295 | GValue *paramv; |
| 28296 | guint num_params; |
| 28297 | guint n; |
| 28298 | guint signal_id; |
| 28299 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name); |
| 28300 | if (info == NULL) |
| 28301 | return; |
| 28302 | num_params = g_variant_n_children (parameters); |
| 28303 | paramv = g_new0 (GValue, num_params + 1); |
| 28304 | g_value_init (¶mv[0], TYPE_LED); |
| 28305 | g_value_set_object (¶mv[0], proxy); |
| 28306 | g_variant_iter_init (&iter, parameters); |
| 28307 | n = 1; |
| 28308 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 28309 | { |
| 28310 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 28311 | if (arg_info->use_gvariant) |
| 28312 | { |
| 28313 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 28314 | g_value_set_variant (¶mv[n], child); |
| 28315 | n++; |
| 28316 | } |
| 28317 | else |
| 28318 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 28319 | g_variant_unref (child); |
| 28320 | } |
| 28321 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 28322 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 28323 | for (n = 0; n < num_params + 1; n++) |
| 28324 | g_value_unset (¶mv[n]); |
| 28325 | g_free (paramv); |
| 28326 | } |
| 28327 | |
| 28328 | static void |
| 28329 | led_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 28330 | GVariant *changed_properties, |
| 28331 | const gchar *const *invalidated_properties) |
| 28332 | { |
| 28333 | LedProxy *proxy = LED_PROXY (_proxy); |
| 28334 | guint n; |
| 28335 | const gchar *key; |
| 28336 | GVariantIter *iter; |
| 28337 | _ExtendedGDBusPropertyInfo *info; |
| 28338 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 28339 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 28340 | { |
| 28341 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key); |
| 28342 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 28343 | if (info != NULL) |
| 28344 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 28345 | } |
| 28346 | g_variant_iter_free (iter); |
| 28347 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 28348 | { |
| 28349 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]); |
| 28350 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 28351 | if (info != NULL) |
| 28352 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 28353 | } |
| 28354 | } |
| 28355 | |
| 28356 | static gint |
| 28357 | led_proxy_get_color (Led *object) |
| 28358 | { |
| 28359 | LedProxy *proxy = LED_PROXY (object); |
| 28360 | GVariant *variant; |
| 28361 | gint value = 0; |
| 28362 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color"); |
| 28363 | if (variant != NULL) |
| 28364 | { |
| 28365 | value = g_variant_get_int32 (variant); |
| 28366 | g_variant_unref (variant); |
| 28367 | } |
| 28368 | return value; |
| 28369 | } |
| 28370 | |
| 28371 | static const gchar * |
| 28372 | led_proxy_get_function (Led *object) |
| 28373 | { |
| 28374 | LedProxy *proxy = LED_PROXY (object); |
| 28375 | GVariant *variant; |
| 28376 | const gchar *value = NULL; |
| 28377 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function"); |
| 28378 | if (variant != NULL) |
| 28379 | { |
| 28380 | value = g_variant_get_string (variant, NULL); |
| 28381 | g_variant_unref (variant); |
| 28382 | } |
| 28383 | return value; |
| 28384 | } |
| 28385 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28386 | static const gchar * |
| 28387 | led_proxy_get_state (Led *object) |
| 28388 | { |
| 28389 | LedProxy *proxy = LED_PROXY (object); |
| 28390 | GVariant *variant; |
| 28391 | const gchar *value = NULL; |
| 28392 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 28393 | if (variant != NULL) |
| 28394 | { |
| 28395 | value = g_variant_get_string (variant, NULL); |
| 28396 | g_variant_unref (variant); |
| 28397 | } |
| 28398 | return value; |
| 28399 | } |
| 28400 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28401 | static void |
| 28402 | led_proxy_init (LedProxy *proxy) |
| 28403 | { |
| 28404 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28405 | proxy->priv = led_proxy_get_instance_private (proxy); |
| 28406 | #else |
| 28407 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate); |
| 28408 | #endif |
| 28409 | |
| 28410 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ()); |
| 28411 | } |
| 28412 | |
| 28413 | static void |
| 28414 | led_proxy_class_init (LedProxyClass *klass) |
| 28415 | { |
| 28416 | GObjectClass *gobject_class; |
| 28417 | GDBusProxyClass *proxy_class; |
| 28418 | |
| 28419 | gobject_class = G_OBJECT_CLASS (klass); |
| 28420 | gobject_class->finalize = led_proxy_finalize; |
| 28421 | gobject_class->get_property = led_proxy_get_property; |
| 28422 | gobject_class->set_property = led_proxy_set_property; |
| 28423 | |
| 28424 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 28425 | proxy_class->g_signal = led_proxy_g_signal; |
| 28426 | proxy_class->g_properties_changed = led_proxy_g_properties_changed; |
| 28427 | |
| 28428 | led_override_properties (gobject_class, 1); |
| 28429 | |
| 28430 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 28431 | g_type_class_add_private (klass, sizeof (LedProxyPrivate)); |
| 28432 | #endif |
| 28433 | } |
| 28434 | |
| 28435 | static void |
| 28436 | led_proxy_iface_init (LedIface *iface) |
| 28437 | { |
| 28438 | iface->get_color = led_proxy_get_color; |
| 28439 | iface->get_function = led_proxy_get_function; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28440 | iface->get_state = led_proxy_get_state; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28441 | } |
| 28442 | |
| 28443 | /** |
| 28444 | * led_proxy_new: |
| 28445 | * @connection: A #GDBusConnection. |
| 28446 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28447 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28448 | * @object_path: An object path. |
| 28449 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28450 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28451 | * @user_data: User data to pass to @callback. |
| 28452 | * |
| 28453 | * 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. |
| 28454 | * |
| 28455 | * 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. |
| 28456 | * You can then call led_proxy_new_finish() to get the result of the operation. |
| 28457 | * |
| 28458 | * See led_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 28459 | */ |
| 28460 | void |
| 28461 | led_proxy_new ( |
| 28462 | GDBusConnection *connection, |
| 28463 | GDBusProxyFlags flags, |
| 28464 | const gchar *name, |
| 28465 | const gchar *object_path, |
| 28466 | GCancellable *cancellable, |
| 28467 | GAsyncReadyCallback callback, |
| 28468 | gpointer user_data) |
| 28469 | { |
| 28470 | 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); |
| 28471 | } |
| 28472 | |
| 28473 | /** |
| 28474 | * led_proxy_new_finish: |
| 28475 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new(). |
| 28476 | * @error: Return location for error or %NULL |
| 28477 | * |
| 28478 | * Finishes an operation started with led_proxy_new(). |
| 28479 | * |
| 28480 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 28481 | */ |
| 28482 | Led * |
| 28483 | led_proxy_new_finish ( |
| 28484 | GAsyncResult *res, |
| 28485 | GError **error) |
| 28486 | { |
| 28487 | GObject *ret; |
| 28488 | GObject *source_object; |
| 28489 | source_object = g_async_result_get_source_object (res); |
| 28490 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28491 | g_object_unref (source_object); |
| 28492 | if (ret != NULL) |
| 28493 | return LED (ret); |
| 28494 | else |
| 28495 | return NULL; |
| 28496 | } |
| 28497 | |
| 28498 | /** |
| 28499 | * led_proxy_new_sync: |
| 28500 | * @connection: A #GDBusConnection. |
| 28501 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28502 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28503 | * @object_path: An object path. |
| 28504 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28505 | * @error: Return location for error or %NULL |
| 28506 | * |
| 28507 | * 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. |
| 28508 | * |
| 28509 | * The calling thread is blocked until a reply is received. |
| 28510 | * |
| 28511 | * See led_proxy_new() for the asynchronous version of this constructor. |
| 28512 | * |
| 28513 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 28514 | */ |
| 28515 | Led * |
| 28516 | led_proxy_new_sync ( |
| 28517 | GDBusConnection *connection, |
| 28518 | GDBusProxyFlags flags, |
| 28519 | const gchar *name, |
| 28520 | const gchar *object_path, |
| 28521 | GCancellable *cancellable, |
| 28522 | GError **error) |
| 28523 | { |
| 28524 | GInitable *ret; |
| 28525 | 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); |
| 28526 | if (ret != NULL) |
| 28527 | return LED (ret); |
| 28528 | else |
| 28529 | return NULL; |
| 28530 | } |
| 28531 | |
| 28532 | |
| 28533 | /** |
| 28534 | * led_proxy_new_for_bus: |
| 28535 | * @bus_type: A #GBusType. |
| 28536 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28537 | * @name: A bus name (well-known or unique). |
| 28538 | * @object_path: An object path. |
| 28539 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28540 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28541 | * @user_data: User data to pass to @callback. |
| 28542 | * |
| 28543 | * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 28544 | * |
| 28545 | * 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. |
| 28546 | * You can then call led_proxy_new_for_bus_finish() to get the result of the operation. |
| 28547 | * |
| 28548 | * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 28549 | */ |
| 28550 | void |
| 28551 | led_proxy_new_for_bus ( |
| 28552 | GBusType bus_type, |
| 28553 | GDBusProxyFlags flags, |
| 28554 | const gchar *name, |
| 28555 | const gchar *object_path, |
| 28556 | GCancellable *cancellable, |
| 28557 | GAsyncReadyCallback callback, |
| 28558 | gpointer user_data) |
| 28559 | { |
| 28560 | 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); |
| 28561 | } |
| 28562 | |
| 28563 | /** |
| 28564 | * led_proxy_new_for_bus_finish: |
| 28565 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus(). |
| 28566 | * @error: Return location for error or %NULL |
| 28567 | * |
| 28568 | * Finishes an operation started with led_proxy_new_for_bus(). |
| 28569 | * |
| 28570 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 28571 | */ |
| 28572 | Led * |
| 28573 | led_proxy_new_for_bus_finish ( |
| 28574 | GAsyncResult *res, |
| 28575 | GError **error) |
| 28576 | { |
| 28577 | GObject *ret; |
| 28578 | GObject *source_object; |
| 28579 | source_object = g_async_result_get_source_object (res); |
| 28580 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28581 | g_object_unref (source_object); |
| 28582 | if (ret != NULL) |
| 28583 | return LED (ret); |
| 28584 | else |
| 28585 | return NULL; |
| 28586 | } |
| 28587 | |
| 28588 | /** |
| 28589 | * led_proxy_new_for_bus_sync: |
| 28590 | * @bus_type: A #GBusType. |
| 28591 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28592 | * @name: A bus name (well-known or unique). |
| 28593 | * @object_path: An object path. |
| 28594 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28595 | * @error: Return location for error or %NULL |
| 28596 | * |
| 28597 | * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 28598 | * |
| 28599 | * The calling thread is blocked until a reply is received. |
| 28600 | * |
| 28601 | * See led_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 28602 | * |
| 28603 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 28604 | */ |
| 28605 | Led * |
| 28606 | led_proxy_new_for_bus_sync ( |
| 28607 | GBusType bus_type, |
| 28608 | GDBusProxyFlags flags, |
| 28609 | const gchar *name, |
| 28610 | const gchar *object_path, |
| 28611 | GCancellable *cancellable, |
| 28612 | GError **error) |
| 28613 | { |
| 28614 | GInitable *ret; |
| 28615 | 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); |
| 28616 | if (ret != NULL) |
| 28617 | return LED (ret); |
| 28618 | else |
| 28619 | return NULL; |
| 28620 | } |
| 28621 | |
| 28622 | |
| 28623 | /* ------------------------------------------------------------------------ */ |
| 28624 | |
| 28625 | /** |
| 28626 | * LedSkeleton: |
| 28627 | * |
| 28628 | * The #LedSkeleton structure contains only private data and should only be accessed using the provided API. |
| 28629 | */ |
| 28630 | |
| 28631 | /** |
| 28632 | * LedSkeletonClass: |
| 28633 | * @parent_class: The parent class. |
| 28634 | * |
| 28635 | * Class structure for #LedSkeleton. |
| 28636 | */ |
| 28637 | |
| 28638 | struct _LedSkeletonPrivate |
| 28639 | { |
| 28640 | GValue *properties; |
| 28641 | GList *changed_properties; |
| 28642 | GSource *changed_properties_idle_source; |
| 28643 | GMainContext *context; |
| 28644 | GMutex lock; |
| 28645 | }; |
| 28646 | |
| 28647 | static void |
| 28648 | _led_skeleton_handle_method_call ( |
| 28649 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28650 | const gchar *sender G_GNUC_UNUSED, |
| 28651 | const gchar *object_path G_GNUC_UNUSED, |
| 28652 | const gchar *interface_name, |
| 28653 | const gchar *method_name, |
| 28654 | GVariant *parameters, |
| 28655 | GDBusMethodInvocation *invocation, |
| 28656 | gpointer user_data) |
| 28657 | { |
| 28658 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 28659 | _ExtendedGDBusMethodInfo *info; |
| 28660 | GVariantIter iter; |
| 28661 | GVariant *child; |
| 28662 | GValue *paramv; |
| 28663 | guint num_params; |
| 28664 | guint num_extra; |
| 28665 | guint n; |
| 28666 | guint signal_id; |
| 28667 | GValue return_value = G_VALUE_INIT; |
| 28668 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 28669 | g_assert (info != NULL); |
| 28670 | num_params = g_variant_n_children (parameters); |
| 28671 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 28672 | n = 0; |
| 28673 | g_value_init (¶mv[n], TYPE_LED); |
| 28674 | g_value_set_object (¶mv[n++], skeleton); |
| 28675 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 28676 | g_value_set_object (¶mv[n++], invocation); |
| 28677 | if (info->pass_fdlist) |
| 28678 | { |
| 28679 | #ifdef G_OS_UNIX |
| 28680 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 28681 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 28682 | #else |
| 28683 | g_assert_not_reached (); |
| 28684 | #endif |
| 28685 | } |
| 28686 | g_variant_iter_init (&iter, parameters); |
| 28687 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 28688 | { |
| 28689 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 28690 | if (arg_info->use_gvariant) |
| 28691 | { |
| 28692 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 28693 | g_value_set_variant (¶mv[n], child); |
| 28694 | n++; |
| 28695 | } |
| 28696 | else |
| 28697 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 28698 | g_variant_unref (child); |
| 28699 | } |
| 28700 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 28701 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 28702 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 28703 | if (!g_value_get_boolean (&return_value)) |
| 28704 | 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); |
| 28705 | g_value_unset (&return_value); |
| 28706 | for (n = 0; n < num_params + num_extra; n++) |
| 28707 | g_value_unset (¶mv[n]); |
| 28708 | g_free (paramv); |
| 28709 | } |
| 28710 | |
| 28711 | static GVariant * |
| 28712 | _led_skeleton_handle_get_property ( |
| 28713 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28714 | const gchar *sender G_GNUC_UNUSED, |
| 28715 | const gchar *object_path G_GNUC_UNUSED, |
| 28716 | const gchar *interface_name G_GNUC_UNUSED, |
| 28717 | const gchar *property_name, |
| 28718 | GError **error, |
| 28719 | gpointer user_data) |
| 28720 | { |
| 28721 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 28722 | GValue value = G_VALUE_INIT; |
| 28723 | GParamSpec *pspec; |
| 28724 | _ExtendedGDBusPropertyInfo *info; |
| 28725 | GVariant *ret; |
| 28726 | ret = NULL; |
| 28727 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 28728 | g_assert (info != NULL); |
| 28729 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 28730 | if (pspec == NULL) |
| 28731 | { |
| 28732 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 28733 | } |
| 28734 | else |
| 28735 | { |
| 28736 | g_value_init (&value, pspec->value_type); |
| 28737 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 28738 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 28739 | g_value_unset (&value); |
| 28740 | } |
| 28741 | return ret; |
| 28742 | } |
| 28743 | |
| 28744 | static gboolean |
| 28745 | _led_skeleton_handle_set_property ( |
| 28746 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28747 | const gchar *sender G_GNUC_UNUSED, |
| 28748 | const gchar *object_path G_GNUC_UNUSED, |
| 28749 | const gchar *interface_name G_GNUC_UNUSED, |
| 28750 | const gchar *property_name, |
| 28751 | GVariant *variant, |
| 28752 | GError **error, |
| 28753 | gpointer user_data) |
| 28754 | { |
| 28755 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 28756 | GValue value = G_VALUE_INIT; |
| 28757 | GParamSpec *pspec; |
| 28758 | _ExtendedGDBusPropertyInfo *info; |
| 28759 | gboolean ret; |
| 28760 | ret = FALSE; |
| 28761 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 28762 | g_assert (info != NULL); |
| 28763 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 28764 | if (pspec == NULL) |
| 28765 | { |
| 28766 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 28767 | } |
| 28768 | else |
| 28769 | { |
| 28770 | if (info->use_gvariant) |
| 28771 | g_value_set_variant (&value, variant); |
| 28772 | else |
| 28773 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 28774 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 28775 | g_value_unset (&value); |
| 28776 | ret = TRUE; |
| 28777 | } |
| 28778 | return ret; |
| 28779 | } |
| 28780 | |
| 28781 | static const GDBusInterfaceVTable _led_skeleton_vtable = |
| 28782 | { |
| 28783 | _led_skeleton_handle_method_call, |
| 28784 | _led_skeleton_handle_get_property, |
| 28785 | _led_skeleton_handle_set_property, |
| 28786 | {NULL} |
| 28787 | }; |
| 28788 | |
| 28789 | static GDBusInterfaceInfo * |
| 28790 | led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 28791 | { |
| 28792 | return led_interface_info (); |
| 28793 | } |
| 28794 | |
| 28795 | static GDBusInterfaceVTable * |
| 28796 | led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 28797 | { |
| 28798 | return (GDBusInterfaceVTable *) &_led_skeleton_vtable; |
| 28799 | } |
| 28800 | |
| 28801 | static GVariant * |
| 28802 | led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 28803 | { |
| 28804 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 28805 | |
| 28806 | GVariantBuilder builder; |
| 28807 | guint n; |
| 28808 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 28809 | if (_led_interface_info.parent_struct.properties == NULL) |
| 28810 | goto out; |
| 28811 | for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++) |
| 28812 | { |
| 28813 | GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n]; |
| 28814 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 28815 | { |
| 28816 | GVariant *value; |
| 28817 | 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); |
| 28818 | if (value != NULL) |
| 28819 | { |
| 28820 | g_variant_take_ref (value); |
| 28821 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 28822 | g_variant_unref (value); |
| 28823 | } |
| 28824 | } |
| 28825 | } |
| 28826 | out: |
| 28827 | return g_variant_builder_end (&builder); |
| 28828 | } |
| 28829 | |
| 28830 | static gboolean _led_emit_changed (gpointer user_data); |
| 28831 | |
| 28832 | static void |
| 28833 | led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 28834 | { |
| 28835 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 28836 | gboolean emit_changed = FALSE; |
| 28837 | |
| 28838 | g_mutex_lock (&skeleton->priv->lock); |
| 28839 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 28840 | { |
| 28841 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 28842 | skeleton->priv->changed_properties_idle_source = NULL; |
| 28843 | emit_changed = TRUE; |
| 28844 | } |
| 28845 | g_mutex_unlock (&skeleton->priv->lock); |
| 28846 | |
| 28847 | if (emit_changed) |
| 28848 | _led_emit_changed (skeleton); |
| 28849 | } |
| 28850 | |
| 28851 | static void led_skeleton_iface_init (LedIface *iface); |
| 28852 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28853 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 28854 | G_ADD_PRIVATE (LedSkeleton) |
| 28855 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 28856 | |
| 28857 | #else |
| 28858 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 28859 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 28860 | |
| 28861 | #endif |
| 28862 | static void |
| 28863 | led_skeleton_finalize (GObject *object) |
| 28864 | { |
| 28865 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 28866 | guint n; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28867 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28868 | g_value_unset (&skeleton->priv->properties[n]); |
| 28869 | g_free (skeleton->priv->properties); |
| 28870 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 28871 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 28872 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 28873 | g_main_context_unref (skeleton->priv->context); |
| 28874 | g_mutex_clear (&skeleton->priv->lock); |
| 28875 | G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object); |
| 28876 | } |
| 28877 | |
| 28878 | static void |
| 28879 | led_skeleton_get_property (GObject *object, |
| 28880 | guint prop_id, |
| 28881 | GValue *value, |
| 28882 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28883 | { |
| 28884 | LedSkeleton *skeleton = LED_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 28885 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 28886 | g_mutex_lock (&skeleton->priv->lock); |
| 28887 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 28888 | g_mutex_unlock (&skeleton->priv->lock); |
| 28889 | } |
| 28890 | |
| 28891 | static gboolean |
| 28892 | _led_emit_changed (gpointer user_data) |
| 28893 | { |
| 28894 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 28895 | GList *l; |
| 28896 | GVariantBuilder builder; |
| 28897 | GVariantBuilder invalidated_builder; |
| 28898 | guint num_changes; |
| 28899 | |
| 28900 | g_mutex_lock (&skeleton->priv->lock); |
| 28901 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 28902 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 28903 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 28904 | { |
| 28905 | ChangedProperty *cp = l->data; |
| 28906 | GVariant *variant; |
| 28907 | const GValue *cur_value; |
| 28908 | |
| 28909 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 28910 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 28911 | { |
| 28912 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 28913 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 28914 | g_variant_unref (variant); |
| 28915 | num_changes++; |
| 28916 | } |
| 28917 | } |
| 28918 | if (num_changes > 0) |
| 28919 | { |
| 28920 | GList *connections, *ll; |
| 28921 | GVariant *signal_variant; |
| 28922 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led", |
| 28923 | &builder, &invalidated_builder)); |
| 28924 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 28925 | for (ll = connections; ll != NULL; ll = ll->next) |
| 28926 | { |
| 28927 | GDBusConnection *connection = ll->data; |
| 28928 | |
| 28929 | g_dbus_connection_emit_signal (connection, |
| 28930 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 28931 | "org.freedesktop.DBus.Properties", |
| 28932 | "PropertiesChanged", |
| 28933 | signal_variant, |
| 28934 | NULL); |
| 28935 | } |
| 28936 | g_variant_unref (signal_variant); |
| 28937 | g_list_free_full (connections, g_object_unref); |
| 28938 | } |
| 28939 | else |
| 28940 | { |
| 28941 | g_variant_builder_clear (&builder); |
| 28942 | g_variant_builder_clear (&invalidated_builder); |
| 28943 | } |
| 28944 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 28945 | skeleton->priv->changed_properties = NULL; |
| 28946 | skeleton->priv->changed_properties_idle_source = NULL; |
| 28947 | g_mutex_unlock (&skeleton->priv->lock); |
| 28948 | return FALSE; |
| 28949 | } |
| 28950 | |
| 28951 | static void |
| 28952 | _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 28953 | { |
| 28954 | ChangedProperty *cp; |
| 28955 | GList *l; |
| 28956 | cp = NULL; |
| 28957 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 28958 | { |
| 28959 | ChangedProperty *i_cp = l->data; |
| 28960 | if (i_cp->info == info) |
| 28961 | { |
| 28962 | cp = i_cp; |
| 28963 | break; |
| 28964 | } |
| 28965 | } |
| 28966 | if (cp == NULL) |
| 28967 | { |
| 28968 | cp = g_new0 (ChangedProperty, 1); |
| 28969 | cp->prop_id = prop_id; |
| 28970 | cp->info = info; |
| 28971 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 28972 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 28973 | g_value_copy (orig_value, &cp->orig_value); |
| 28974 | } |
| 28975 | } |
| 28976 | |
| 28977 | static void |
| 28978 | led_skeleton_notify (GObject *object, |
| 28979 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28980 | { |
| 28981 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 28982 | g_mutex_lock (&skeleton->priv->lock); |
| 28983 | if (skeleton->priv->changed_properties != NULL && |
| 28984 | skeleton->priv->changed_properties_idle_source == NULL) |
| 28985 | { |
| 28986 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 28987 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 28988 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 28989 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 28990 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 28991 | } |
| 28992 | g_mutex_unlock (&skeleton->priv->lock); |
| 28993 | } |
| 28994 | |
| 28995 | static void |
| 28996 | led_skeleton_set_property (GObject *object, |
| 28997 | guint prop_id, |
| 28998 | const GValue *value, |
| 28999 | GParamSpec *pspec) |
| 29000 | { |
| 29001 | LedSkeleton *skeleton = LED_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29002 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29003 | g_mutex_lock (&skeleton->priv->lock); |
| 29004 | g_object_freeze_notify (object); |
| 29005 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 29006 | { |
| 29007 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 29008 | _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 29009 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 29010 | g_object_notify_by_pspec (object, pspec); |
| 29011 | } |
| 29012 | g_mutex_unlock (&skeleton->priv->lock); |
| 29013 | g_object_thaw_notify (object); |
| 29014 | } |
| 29015 | |
| 29016 | static void |
| 29017 | led_skeleton_init (LedSkeleton *skeleton) |
| 29018 | { |
| 29019 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 29020 | skeleton->priv = led_skeleton_get_instance_private (skeleton); |
| 29021 | #else |
| 29022 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate); |
| 29023 | #endif |
| 29024 | |
| 29025 | g_mutex_init (&skeleton->priv->lock); |
| 29026 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29027 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29028 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 29029 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29030 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29031 | } |
| 29032 | |
| 29033 | static gint |
| 29034 | led_skeleton_get_color (Led *object) |
| 29035 | { |
| 29036 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 29037 | gint value; |
| 29038 | g_mutex_lock (&skeleton->priv->lock); |
| 29039 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 29040 | g_mutex_unlock (&skeleton->priv->lock); |
| 29041 | return value; |
| 29042 | } |
| 29043 | |
| 29044 | static const gchar * |
| 29045 | led_skeleton_get_function (Led *object) |
| 29046 | { |
| 29047 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 29048 | const gchar *value; |
| 29049 | g_mutex_lock (&skeleton->priv->lock); |
| 29050 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 29051 | g_mutex_unlock (&skeleton->priv->lock); |
| 29052 | return value; |
| 29053 | } |
| 29054 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29055 | static const gchar * |
| 29056 | led_skeleton_get_state (Led *object) |
| 29057 | { |
| 29058 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 29059 | const gchar *value; |
| 29060 | g_mutex_lock (&skeleton->priv->lock); |
| 29061 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
| 29062 | g_mutex_unlock (&skeleton->priv->lock); |
| 29063 | return value; |
| 29064 | } |
| 29065 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29066 | static void |
| 29067 | led_skeleton_class_init (LedSkeletonClass *klass) |
| 29068 | { |
| 29069 | GObjectClass *gobject_class; |
| 29070 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 29071 | |
| 29072 | gobject_class = G_OBJECT_CLASS (klass); |
| 29073 | gobject_class->finalize = led_skeleton_finalize; |
| 29074 | gobject_class->get_property = led_skeleton_get_property; |
| 29075 | gobject_class->set_property = led_skeleton_set_property; |
| 29076 | gobject_class->notify = led_skeleton_notify; |
| 29077 | |
| 29078 | |
| 29079 | led_override_properties (gobject_class, 1); |
| 29080 | |
| 29081 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 29082 | skeleton_class->get_info = led_skeleton_dbus_interface_get_info; |
| 29083 | skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties; |
| 29084 | skeleton_class->flush = led_skeleton_dbus_interface_flush; |
| 29085 | skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable; |
| 29086 | |
| 29087 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 29088 | g_type_class_add_private (klass, sizeof (LedSkeletonPrivate)); |
| 29089 | #endif |
| 29090 | } |
| 29091 | |
| 29092 | static void |
| 29093 | led_skeleton_iface_init (LedIface *iface) |
| 29094 | { |
| 29095 | iface->get_color = led_skeleton_get_color; |
| 29096 | iface->get_function = led_skeleton_get_function; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29097 | iface->get_state = led_skeleton_get_state; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29098 | } |
| 29099 | |
| 29100 | /** |
| 29101 | * led_skeleton_new: |
| 29102 | * |
| 29103 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 29104 | * |
| 29105 | * Returns: (transfer full) (type LedSkeleton): The skeleton object. |
| 29106 | */ |
| 29107 | Led * |
| 29108 | led_skeleton_new (void) |
| 29109 | { |
| 29110 | return LED (g_object_new (TYPE_LED_SKELETON, NULL)); |
| 29111 | } |
| 29112 | |
| 29113 | /* ------------------------------------------------------------------------ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 29114 | * Code for interface org.openbmc.HostIpmi |
| 29115 | * ------------------------------------------------------------------------ |
| 29116 | */ |
| 29117 | |
| 29118 | /** |
| 29119 | * SECTION:HostIpmi |
| 29120 | * @title: HostIpmi |
| 29121 | * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface |
| 29122 | * |
| 29123 | * 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. |
| 29124 | */ |
| 29125 | |
| 29126 | /* ---- Introspection data for org.openbmc.HostIpmi ---- */ |
| 29127 | |
| 29128 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq = |
| 29129 | { |
| 29130 | { |
| 29131 | -1, |
| 29132 | (gchar *) "seq", |
| 29133 | (gchar *) "y", |
| 29134 | NULL |
| 29135 | }, |
| 29136 | FALSE |
| 29137 | }; |
| 29138 | |
| 29139 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn = |
| 29140 | { |
| 29141 | { |
| 29142 | -1, |
| 29143 | (gchar *) "netfn", |
| 29144 | (gchar *) "y", |
| 29145 | NULL |
| 29146 | }, |
| 29147 | FALSE |
| 29148 | }; |
| 29149 | |
| 29150 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd = |
| 29151 | { |
| 29152 | { |
| 29153 | -1, |
| 29154 | (gchar *) "cmd", |
| 29155 | (gchar *) "y", |
| 29156 | NULL |
| 29157 | }, |
| 29158 | FALSE |
| 29159 | }; |
| 29160 | |
| 29161 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data = |
| 29162 | { |
| 29163 | { |
| 29164 | -1, |
| 29165 | (gchar *) "data", |
| 29166 | (gchar *) "ay", |
| 29167 | NULL |
| 29168 | }, |
| 29169 | FALSE |
| 29170 | }; |
| 29171 | |
| 29172 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] = |
| 29173 | { |
| 29174 | &_host_ipmi_method_info_send_message_IN_ARG_seq, |
| 29175 | &_host_ipmi_method_info_send_message_IN_ARG_netfn, |
| 29176 | &_host_ipmi_method_info_send_message_IN_ARG_cmd, |
| 29177 | &_host_ipmi_method_info_send_message_IN_ARG_data, |
| 29178 | NULL |
| 29179 | }; |
| 29180 | |
| 29181 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 = |
| 29182 | { |
| 29183 | { |
| 29184 | -1, |
| 29185 | (gchar *) "unnamed_arg4", |
| 29186 | (gchar *) "x", |
| 29187 | NULL |
| 29188 | }, |
| 29189 | FALSE |
| 29190 | }; |
| 29191 | |
| 29192 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] = |
| 29193 | { |
| 29194 | &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4, |
| 29195 | NULL |
| 29196 | }; |
| 29197 | |
| 29198 | static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message = |
| 29199 | { |
| 29200 | { |
| 29201 | -1, |
| 29202 | (gchar *) "sendMessage", |
| 29203 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers, |
| 29204 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers, |
| 29205 | NULL |
| 29206 | }, |
| 29207 | "handle-send-message", |
| 29208 | FALSE |
| 29209 | }; |
| 29210 | |
| 29211 | static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] = |
| 29212 | { |
| 29213 | &_host_ipmi_method_info_send_message, |
| 29214 | NULL |
| 29215 | }; |
| 29216 | |
| 29217 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq = |
| 29218 | { |
| 29219 | { |
| 29220 | -1, |
| 29221 | (gchar *) "seq", |
| 29222 | (gchar *) "y", |
| 29223 | NULL |
| 29224 | }, |
| 29225 | FALSE |
| 29226 | }; |
| 29227 | |
| 29228 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn = |
| 29229 | { |
| 29230 | { |
| 29231 | -1, |
| 29232 | (gchar *) "netfn", |
| 29233 | (gchar *) "y", |
| 29234 | NULL |
| 29235 | }, |
| 29236 | FALSE |
| 29237 | }; |
| 29238 | |
| 29239 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd = |
| 29240 | { |
| 29241 | { |
| 29242 | -1, |
| 29243 | (gchar *) "cmd", |
| 29244 | (gchar *) "y", |
| 29245 | NULL |
| 29246 | }, |
| 29247 | FALSE |
| 29248 | }; |
| 29249 | |
| 29250 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data = |
| 29251 | { |
| 29252 | { |
| 29253 | -1, |
| 29254 | (gchar *) "data", |
| 29255 | (gchar *) "ay", |
| 29256 | NULL |
| 29257 | }, |
| 29258 | FALSE |
| 29259 | }; |
| 29260 | |
| 29261 | static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] = |
| 29262 | { |
| 29263 | &_host_ipmi_signal_info_received_message_ARG_seq, |
| 29264 | &_host_ipmi_signal_info_received_message_ARG_netfn, |
| 29265 | &_host_ipmi_signal_info_received_message_ARG_cmd, |
| 29266 | &_host_ipmi_signal_info_received_message_ARG_data, |
| 29267 | NULL |
| 29268 | }; |
| 29269 | |
| 29270 | static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message = |
| 29271 | { |
| 29272 | { |
| 29273 | -1, |
| 29274 | (gchar *) "ReceivedMessage", |
| 29275 | (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers, |
| 29276 | NULL |
| 29277 | }, |
| 29278 | "received-message" |
| 29279 | }; |
| 29280 | |
| 29281 | static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] = |
| 29282 | { |
| 29283 | &_host_ipmi_signal_info_received_message, |
| 29284 | NULL |
| 29285 | }; |
| 29286 | |
| 29287 | static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info = |
| 29288 | { |
| 29289 | { |
| 29290 | -1, |
| 29291 | (gchar *) "org.openbmc.HostIpmi", |
| 29292 | (GDBusMethodInfo **) &_host_ipmi_method_info_pointers, |
| 29293 | (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers, |
| 29294 | NULL, |
| 29295 | NULL |
| 29296 | }, |
| 29297 | "host-ipmi", |
| 29298 | }; |
| 29299 | |
| 29300 | |
| 29301 | /** |
| 29302 | * host_ipmi_interface_info: |
| 29303 | * |
| 29304 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface. |
| 29305 | * |
| 29306 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 29307 | */ |
| 29308 | GDBusInterfaceInfo * |
| 29309 | host_ipmi_interface_info (void) |
| 29310 | { |
| 29311 | return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct; |
| 29312 | } |
| 29313 | |
| 29314 | /** |
| 29315 | * host_ipmi_override_properties: |
| 29316 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 29317 | * @property_id_begin: The property id to assign to the first overridden property. |
| 29318 | * |
| 29319 | * Overrides all #GObject properties in the #HostIpmi interface for a concrete class. |
| 29320 | * The properties are overridden in the order they are defined. |
| 29321 | * |
| 29322 | * Returns: The last property id. |
| 29323 | */ |
| 29324 | guint |
| 29325 | host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin) |
| 29326 | { |
| 29327 | return property_id_begin - 1; |
| 29328 | } |
| 29329 | |
| 29330 | |
| 29331 | |
| 29332 | /** |
| 29333 | * HostIpmi: |
| 29334 | * |
| 29335 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 29336 | */ |
| 29337 | |
| 29338 | /** |
| 29339 | * HostIpmiIface: |
| 29340 | * @parent_iface: The parent interface. |
| 29341 | * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal. |
| 29342 | * @received_message: Handler for the #HostIpmi::received-message signal. |
| 29343 | * |
| 29344 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 29345 | */ |
| 29346 | |
| 29347 | typedef HostIpmiIface HostIpmiInterface; |
| 29348 | G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT); |
| 29349 | |
| 29350 | static void |
| 29351 | host_ipmi_default_init (HostIpmiIface *iface) |
| 29352 | { |
| 29353 | /* GObject signals for incoming D-Bus method calls: */ |
| 29354 | /** |
| 29355 | * HostIpmi::handle-send-message: |
| 29356 | * @object: A #HostIpmi. |
| 29357 | * @invocation: A #GDBusMethodInvocation. |
| 29358 | * @arg_seq: Argument passed by remote caller. |
| 29359 | * @arg_netfn: Argument passed by remote caller. |
| 29360 | * @arg_cmd: Argument passed by remote caller. |
| 29361 | * @arg_data: Argument passed by remote caller. |
| 29362 | * |
| 29363 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. |
| 29364 | * |
| 29365 | * 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. |
| 29366 | * |
| 29367 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 29368 | */ |
| 29369 | g_signal_new ("handle-send-message", |
| 29370 | G_TYPE_FROM_INTERFACE (iface), |
| 29371 | G_SIGNAL_RUN_LAST, |
| 29372 | G_STRUCT_OFFSET (HostIpmiIface, handle_send_message), |
| 29373 | g_signal_accumulator_true_handled, |
| 29374 | NULL, |
| 29375 | g_cclosure_marshal_generic, |
| 29376 | G_TYPE_BOOLEAN, |
| 29377 | 5, |
| 29378 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 29379 | |
| 29380 | /* GObject signals for received D-Bus signals: */ |
| 29381 | /** |
| 29382 | * HostIpmi::received-message: |
| 29383 | * @object: A #HostIpmi. |
| 29384 | * @arg_seq: Argument. |
| 29385 | * @arg_netfn: Argument. |
| 29386 | * @arg_cmd: Argument. |
| 29387 | * @arg_data: Argument. |
| 29388 | * |
| 29389 | * 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. |
| 29390 | * |
| 29391 | * 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. |
| 29392 | */ |
| 29393 | g_signal_new ("received-message", |
| 29394 | G_TYPE_FROM_INTERFACE (iface), |
| 29395 | G_SIGNAL_RUN_LAST, |
| 29396 | G_STRUCT_OFFSET (HostIpmiIface, received_message), |
| 29397 | NULL, |
| 29398 | NULL, |
| 29399 | g_cclosure_marshal_generic, |
| 29400 | G_TYPE_NONE, |
| 29401 | 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 29402 | |
| 29403 | } |
| 29404 | |
| 29405 | /** |
| 29406 | * host_ipmi_emit_received_message: |
| 29407 | * @object: A #HostIpmi. |
| 29408 | * @arg_seq: Argument to pass with the signal. |
| 29409 | * @arg_netfn: Argument to pass with the signal. |
| 29410 | * @arg_cmd: Argument to pass with the signal. |
| 29411 | * @arg_data: Argument to pass with the signal. |
| 29412 | * |
| 29413 | * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal. |
| 29414 | */ |
| 29415 | void |
| 29416 | host_ipmi_emit_received_message ( |
| 29417 | HostIpmi *object, |
| 29418 | guchar arg_seq, |
| 29419 | guchar arg_netfn, |
| 29420 | guchar arg_cmd, |
| 29421 | const gchar *arg_data) |
| 29422 | { |
| 29423 | g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data); |
| 29424 | } |
| 29425 | |
| 29426 | /** |
| 29427 | * host_ipmi_call_send_message: |
| 29428 | * @proxy: A #HostIpmiProxy. |
| 29429 | * @arg_seq: Argument to pass with the method invocation. |
| 29430 | * @arg_netfn: Argument to pass with the method invocation. |
| 29431 | * @arg_cmd: Argument to pass with the method invocation. |
| 29432 | * @arg_data: Argument to pass with the method invocation. |
| 29433 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29434 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 29435 | * @user_data: User data to pass to @callback. |
| 29436 | * |
| 29437 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. |
| 29438 | * 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. |
| 29439 | * You can then call host_ipmi_call_send_message_finish() to get the result of the operation. |
| 29440 | * |
| 29441 | * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method. |
| 29442 | */ |
| 29443 | void |
| 29444 | host_ipmi_call_send_message ( |
| 29445 | HostIpmi *proxy, |
| 29446 | guchar arg_seq, |
| 29447 | guchar arg_netfn, |
| 29448 | guchar arg_cmd, |
| 29449 | const gchar *arg_data, |
| 29450 | GCancellable *cancellable, |
| 29451 | GAsyncReadyCallback callback, |
| 29452 | gpointer user_data) |
| 29453 | { |
| 29454 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 29455 | "sendMessage", |
| 29456 | g_variant_new ("(yyy^ay)", |
| 29457 | arg_seq, |
| 29458 | arg_netfn, |
| 29459 | arg_cmd, |
| 29460 | arg_data), |
| 29461 | G_DBUS_CALL_FLAGS_NONE, |
| 29462 | -1, |
| 29463 | cancellable, |
| 29464 | callback, |
| 29465 | user_data); |
| 29466 | } |
| 29467 | |
| 29468 | /** |
| 29469 | * host_ipmi_call_send_message_finish: |
| 29470 | * @proxy: A #HostIpmiProxy. |
| 29471 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 29472 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message(). |
| 29473 | * @error: Return location for error or %NULL. |
| 29474 | * |
| 29475 | * Finishes an operation started with host_ipmi_call_send_message(). |
| 29476 | * |
| 29477 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 29478 | */ |
| 29479 | gboolean |
| 29480 | host_ipmi_call_send_message_finish ( |
| 29481 | HostIpmi *proxy, |
| 29482 | gint64 *out_unnamed_arg4, |
| 29483 | GAsyncResult *res, |
| 29484 | GError **error) |
| 29485 | { |
| 29486 | GVariant *_ret; |
| 29487 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 29488 | if (_ret == NULL) |
| 29489 | goto _out; |
| 29490 | g_variant_get (_ret, |
| 29491 | "(x)", |
| 29492 | out_unnamed_arg4); |
| 29493 | g_variant_unref (_ret); |
| 29494 | _out: |
| 29495 | return _ret != NULL; |
| 29496 | } |
| 29497 | |
| 29498 | /** |
| 29499 | * host_ipmi_call_send_message_sync: |
| 29500 | * @proxy: A #HostIpmiProxy. |
| 29501 | * @arg_seq: Argument to pass with the method invocation. |
| 29502 | * @arg_netfn: Argument to pass with the method invocation. |
| 29503 | * @arg_cmd: Argument to pass with the method invocation. |
| 29504 | * @arg_data: Argument to pass with the method invocation. |
| 29505 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 29506 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29507 | * @error: Return location for error or %NULL. |
| 29508 | * |
| 29509 | * 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. |
| 29510 | * |
| 29511 | * See host_ipmi_call_send_message() for the asynchronous version of this method. |
| 29512 | * |
| 29513 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 29514 | */ |
| 29515 | gboolean |
| 29516 | host_ipmi_call_send_message_sync ( |
| 29517 | HostIpmi *proxy, |
| 29518 | guchar arg_seq, |
| 29519 | guchar arg_netfn, |
| 29520 | guchar arg_cmd, |
| 29521 | const gchar *arg_data, |
| 29522 | gint64 *out_unnamed_arg4, |
| 29523 | GCancellable *cancellable, |
| 29524 | GError **error) |
| 29525 | { |
| 29526 | GVariant *_ret; |
| 29527 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 29528 | "sendMessage", |
| 29529 | g_variant_new ("(yyy^ay)", |
| 29530 | arg_seq, |
| 29531 | arg_netfn, |
| 29532 | arg_cmd, |
| 29533 | arg_data), |
| 29534 | G_DBUS_CALL_FLAGS_NONE, |
| 29535 | -1, |
| 29536 | cancellable, |
| 29537 | error); |
| 29538 | if (_ret == NULL) |
| 29539 | goto _out; |
| 29540 | g_variant_get (_ret, |
| 29541 | "(x)", |
| 29542 | out_unnamed_arg4); |
| 29543 | g_variant_unref (_ret); |
| 29544 | _out: |
| 29545 | return _ret != NULL; |
| 29546 | } |
| 29547 | |
| 29548 | /** |
| 29549 | * host_ipmi_complete_send_message: |
| 29550 | * @object: A #HostIpmi. |
| 29551 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 29552 | * @unnamed_arg4: Parameter to return. |
| 29553 | * |
| 29554 | * 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. |
| 29555 | * |
| 29556 | * This method will free @invocation, you cannot use it afterwards. |
| 29557 | */ |
| 29558 | void |
| 29559 | host_ipmi_complete_send_message ( |
| 29560 | HostIpmi *object, |
| 29561 | GDBusMethodInvocation *invocation, |
| 29562 | gint64 unnamed_arg4) |
| 29563 | { |
| 29564 | g_dbus_method_invocation_return_value (invocation, |
| 29565 | g_variant_new ("(x)", |
| 29566 | unnamed_arg4)); |
| 29567 | } |
| 29568 | |
| 29569 | /* ------------------------------------------------------------------------ */ |
| 29570 | |
| 29571 | /** |
| 29572 | * HostIpmiProxy: |
| 29573 | * |
| 29574 | * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API. |
| 29575 | */ |
| 29576 | |
| 29577 | /** |
| 29578 | * HostIpmiProxyClass: |
| 29579 | * @parent_class: The parent class. |
| 29580 | * |
| 29581 | * Class structure for #HostIpmiProxy. |
| 29582 | */ |
| 29583 | |
| 29584 | struct _HostIpmiProxyPrivate |
| 29585 | { |
| 29586 | GData *qdata; |
| 29587 | }; |
| 29588 | |
| 29589 | static void host_ipmi_proxy_iface_init (HostIpmiIface *iface); |
| 29590 | |
| 29591 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 29592 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 29593 | G_ADD_PRIVATE (HostIpmiProxy) |
| 29594 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 29595 | |
| 29596 | #else |
| 29597 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 29598 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 29599 | |
| 29600 | #endif |
| 29601 | static void |
| 29602 | host_ipmi_proxy_finalize (GObject *object) |
| 29603 | { |
| 29604 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (object); |
| 29605 | g_datalist_clear (&proxy->priv->qdata); |
| 29606 | G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object); |
| 29607 | } |
| 29608 | |
| 29609 | static void |
| 29610 | host_ipmi_proxy_get_property (GObject *object, |
| 29611 | guint prop_id, |
| 29612 | GValue *value, |
| 29613 | GParamSpec *pspec G_GNUC_UNUSED) |
| 29614 | { |
| 29615 | } |
| 29616 | |
| 29617 | static void |
| 29618 | host_ipmi_proxy_set_property (GObject *object, |
| 29619 | guint prop_id, |
| 29620 | const GValue *value, |
| 29621 | GParamSpec *pspec G_GNUC_UNUSED) |
| 29622 | { |
| 29623 | } |
| 29624 | |
| 29625 | static void |
| 29626 | host_ipmi_proxy_g_signal (GDBusProxy *proxy, |
| 29627 | const gchar *sender_name G_GNUC_UNUSED, |
| 29628 | const gchar *signal_name, |
| 29629 | GVariant *parameters) |
| 29630 | { |
| 29631 | _ExtendedGDBusSignalInfo *info; |
| 29632 | GVariantIter iter; |
| 29633 | GVariant *child; |
| 29634 | GValue *paramv; |
| 29635 | guint num_params; |
| 29636 | guint n; |
| 29637 | guint signal_id; |
| 29638 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name); |
| 29639 | if (info == NULL) |
| 29640 | return; |
| 29641 | num_params = g_variant_n_children (parameters); |
| 29642 | paramv = g_new0 (GValue, num_params + 1); |
| 29643 | g_value_init (¶mv[0], TYPE_HOST_IPMI); |
| 29644 | g_value_set_object (¶mv[0], proxy); |
| 29645 | g_variant_iter_init (&iter, parameters); |
| 29646 | n = 1; |
| 29647 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 29648 | { |
| 29649 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 29650 | if (arg_info->use_gvariant) |
| 29651 | { |
| 29652 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 29653 | g_value_set_variant (¶mv[n], child); |
| 29654 | n++; |
| 29655 | } |
| 29656 | else |
| 29657 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 29658 | g_variant_unref (child); |
| 29659 | } |
| 29660 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 29661 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 29662 | for (n = 0; n < num_params + 1; n++) |
| 29663 | g_value_unset (¶mv[n]); |
| 29664 | g_free (paramv); |
| 29665 | } |
| 29666 | |
| 29667 | static void |
| 29668 | host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 29669 | GVariant *changed_properties, |
| 29670 | const gchar *const *invalidated_properties) |
| 29671 | { |
| 29672 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy); |
| 29673 | guint n; |
| 29674 | const gchar *key; |
| 29675 | GVariantIter *iter; |
| 29676 | _ExtendedGDBusPropertyInfo *info; |
| 29677 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 29678 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 29679 | { |
| 29680 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key); |
| 29681 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 29682 | if (info != NULL) |
| 29683 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 29684 | } |
| 29685 | g_variant_iter_free (iter); |
| 29686 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 29687 | { |
| 29688 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]); |
| 29689 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 29690 | if (info != NULL) |
| 29691 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 29692 | } |
| 29693 | } |
| 29694 | |
| 29695 | static void |
| 29696 | host_ipmi_proxy_init (HostIpmiProxy *proxy) |
| 29697 | { |
| 29698 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 29699 | proxy->priv = host_ipmi_proxy_get_instance_private (proxy); |
| 29700 | #else |
| 29701 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate); |
| 29702 | #endif |
| 29703 | |
| 29704 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ()); |
| 29705 | } |
| 29706 | |
| 29707 | static void |
| 29708 | host_ipmi_proxy_class_init (HostIpmiProxyClass *klass) |
| 29709 | { |
| 29710 | GObjectClass *gobject_class; |
| 29711 | GDBusProxyClass *proxy_class; |
| 29712 | |
| 29713 | gobject_class = G_OBJECT_CLASS (klass); |
| 29714 | gobject_class->finalize = host_ipmi_proxy_finalize; |
| 29715 | gobject_class->get_property = host_ipmi_proxy_get_property; |
| 29716 | gobject_class->set_property = host_ipmi_proxy_set_property; |
| 29717 | |
| 29718 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 29719 | proxy_class->g_signal = host_ipmi_proxy_g_signal; |
| 29720 | proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed; |
| 29721 | |
| 29722 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 29723 | g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate)); |
| 29724 | #endif |
| 29725 | } |
| 29726 | |
| 29727 | static void |
| 29728 | host_ipmi_proxy_iface_init (HostIpmiIface *iface) |
| 29729 | { |
| 29730 | } |
| 29731 | |
| 29732 | /** |
| 29733 | * host_ipmi_proxy_new: |
| 29734 | * @connection: A #GDBusConnection. |
| 29735 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 29736 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 29737 | * @object_path: An object path. |
| 29738 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29739 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 29740 | * @user_data: User data to pass to @callback. |
| 29741 | * |
| 29742 | * 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. |
| 29743 | * |
| 29744 | * 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. |
| 29745 | * You can then call host_ipmi_proxy_new_finish() to get the result of the operation. |
| 29746 | * |
| 29747 | * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 29748 | */ |
| 29749 | void |
| 29750 | host_ipmi_proxy_new ( |
| 29751 | GDBusConnection *connection, |
| 29752 | GDBusProxyFlags flags, |
| 29753 | const gchar *name, |
| 29754 | const gchar *object_path, |
| 29755 | GCancellable *cancellable, |
| 29756 | GAsyncReadyCallback callback, |
| 29757 | gpointer user_data) |
| 29758 | { |
| 29759 | 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); |
| 29760 | } |
| 29761 | |
| 29762 | /** |
| 29763 | * host_ipmi_proxy_new_finish: |
| 29764 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new(). |
| 29765 | * @error: Return location for error or %NULL |
| 29766 | * |
| 29767 | * Finishes an operation started with host_ipmi_proxy_new(). |
| 29768 | * |
| 29769 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 29770 | */ |
| 29771 | HostIpmi * |
| 29772 | host_ipmi_proxy_new_finish ( |
| 29773 | GAsyncResult *res, |
| 29774 | GError **error) |
| 29775 | { |
| 29776 | GObject *ret; |
| 29777 | GObject *source_object; |
| 29778 | source_object = g_async_result_get_source_object (res); |
| 29779 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 29780 | g_object_unref (source_object); |
| 29781 | if (ret != NULL) |
| 29782 | return HOST_IPMI (ret); |
| 29783 | else |
| 29784 | return NULL; |
| 29785 | } |
| 29786 | |
| 29787 | /** |
| 29788 | * host_ipmi_proxy_new_sync: |
| 29789 | * @connection: A #GDBusConnection. |
| 29790 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 29791 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 29792 | * @object_path: An object path. |
| 29793 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29794 | * @error: Return location for error or %NULL |
| 29795 | * |
| 29796 | * 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. |
| 29797 | * |
| 29798 | * The calling thread is blocked until a reply is received. |
| 29799 | * |
| 29800 | * See host_ipmi_proxy_new() for the asynchronous version of this constructor. |
| 29801 | * |
| 29802 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 29803 | */ |
| 29804 | HostIpmi * |
| 29805 | host_ipmi_proxy_new_sync ( |
| 29806 | GDBusConnection *connection, |
| 29807 | GDBusProxyFlags flags, |
| 29808 | const gchar *name, |
| 29809 | const gchar *object_path, |
| 29810 | GCancellable *cancellable, |
| 29811 | GError **error) |
| 29812 | { |
| 29813 | GInitable *ret; |
| 29814 | 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); |
| 29815 | if (ret != NULL) |
| 29816 | return HOST_IPMI (ret); |
| 29817 | else |
| 29818 | return NULL; |
| 29819 | } |
| 29820 | |
| 29821 | |
| 29822 | /** |
| 29823 | * host_ipmi_proxy_new_for_bus: |
| 29824 | * @bus_type: A #GBusType. |
| 29825 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 29826 | * @name: A bus name (well-known or unique). |
| 29827 | * @object_path: An object path. |
| 29828 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29829 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 29830 | * @user_data: User data to pass to @callback. |
| 29831 | * |
| 29832 | * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 29833 | * |
| 29834 | * 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. |
| 29835 | * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation. |
| 29836 | * |
| 29837 | * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 29838 | */ |
| 29839 | void |
| 29840 | host_ipmi_proxy_new_for_bus ( |
| 29841 | GBusType bus_type, |
| 29842 | GDBusProxyFlags flags, |
| 29843 | const gchar *name, |
| 29844 | const gchar *object_path, |
| 29845 | GCancellable *cancellable, |
| 29846 | GAsyncReadyCallback callback, |
| 29847 | gpointer user_data) |
| 29848 | { |
| 29849 | 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); |
| 29850 | } |
| 29851 | |
| 29852 | /** |
| 29853 | * host_ipmi_proxy_new_for_bus_finish: |
| 29854 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus(). |
| 29855 | * @error: Return location for error or %NULL |
| 29856 | * |
| 29857 | * Finishes an operation started with host_ipmi_proxy_new_for_bus(). |
| 29858 | * |
| 29859 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 29860 | */ |
| 29861 | HostIpmi * |
| 29862 | host_ipmi_proxy_new_for_bus_finish ( |
| 29863 | GAsyncResult *res, |
| 29864 | GError **error) |
| 29865 | { |
| 29866 | GObject *ret; |
| 29867 | GObject *source_object; |
| 29868 | source_object = g_async_result_get_source_object (res); |
| 29869 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 29870 | g_object_unref (source_object); |
| 29871 | if (ret != NULL) |
| 29872 | return HOST_IPMI (ret); |
| 29873 | else |
| 29874 | return NULL; |
| 29875 | } |
| 29876 | |
| 29877 | /** |
| 29878 | * host_ipmi_proxy_new_for_bus_sync: |
| 29879 | * @bus_type: A #GBusType. |
| 29880 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 29881 | * @name: A bus name (well-known or unique). |
| 29882 | * @object_path: An object path. |
| 29883 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 29884 | * @error: Return location for error or %NULL |
| 29885 | * |
| 29886 | * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 29887 | * |
| 29888 | * The calling thread is blocked until a reply is received. |
| 29889 | * |
| 29890 | * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 29891 | * |
| 29892 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 29893 | */ |
| 29894 | HostIpmi * |
| 29895 | host_ipmi_proxy_new_for_bus_sync ( |
| 29896 | GBusType bus_type, |
| 29897 | GDBusProxyFlags flags, |
| 29898 | const gchar *name, |
| 29899 | const gchar *object_path, |
| 29900 | GCancellable *cancellable, |
| 29901 | GError **error) |
| 29902 | { |
| 29903 | GInitable *ret; |
| 29904 | 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); |
| 29905 | if (ret != NULL) |
| 29906 | return HOST_IPMI (ret); |
| 29907 | else |
| 29908 | return NULL; |
| 29909 | } |
| 29910 | |
| 29911 | |
| 29912 | /* ------------------------------------------------------------------------ */ |
| 29913 | |
| 29914 | /** |
| 29915 | * HostIpmiSkeleton: |
| 29916 | * |
| 29917 | * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API. |
| 29918 | */ |
| 29919 | |
| 29920 | /** |
| 29921 | * HostIpmiSkeletonClass: |
| 29922 | * @parent_class: The parent class. |
| 29923 | * |
| 29924 | * Class structure for #HostIpmiSkeleton. |
| 29925 | */ |
| 29926 | |
| 29927 | struct _HostIpmiSkeletonPrivate |
| 29928 | { |
| 29929 | GValue *properties; |
| 29930 | GList *changed_properties; |
| 29931 | GSource *changed_properties_idle_source; |
| 29932 | GMainContext *context; |
| 29933 | GMutex lock; |
| 29934 | }; |
| 29935 | |
| 29936 | static void |
| 29937 | _host_ipmi_skeleton_handle_method_call ( |
| 29938 | GDBusConnection *connection G_GNUC_UNUSED, |
| 29939 | const gchar *sender G_GNUC_UNUSED, |
| 29940 | const gchar *object_path G_GNUC_UNUSED, |
| 29941 | const gchar *interface_name, |
| 29942 | const gchar *method_name, |
| 29943 | GVariant *parameters, |
| 29944 | GDBusMethodInvocation *invocation, |
| 29945 | gpointer user_data) |
| 29946 | { |
| 29947 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 29948 | _ExtendedGDBusMethodInfo *info; |
| 29949 | GVariantIter iter; |
| 29950 | GVariant *child; |
| 29951 | GValue *paramv; |
| 29952 | guint num_params; |
| 29953 | guint num_extra; |
| 29954 | guint n; |
| 29955 | guint signal_id; |
| 29956 | GValue return_value = G_VALUE_INIT; |
| 29957 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 29958 | g_assert (info != NULL); |
| 29959 | num_params = g_variant_n_children (parameters); |
| 29960 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 29961 | n = 0; |
| 29962 | g_value_init (¶mv[n], TYPE_HOST_IPMI); |
| 29963 | g_value_set_object (¶mv[n++], skeleton); |
| 29964 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 29965 | g_value_set_object (¶mv[n++], invocation); |
| 29966 | if (info->pass_fdlist) |
| 29967 | { |
| 29968 | #ifdef G_OS_UNIX |
| 29969 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 29970 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 29971 | #else |
| 29972 | g_assert_not_reached (); |
| 29973 | #endif |
| 29974 | } |
| 29975 | g_variant_iter_init (&iter, parameters); |
| 29976 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 29977 | { |
| 29978 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 29979 | if (arg_info->use_gvariant) |
| 29980 | { |
| 29981 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 29982 | g_value_set_variant (¶mv[n], child); |
| 29983 | n++; |
| 29984 | } |
| 29985 | else |
| 29986 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 29987 | g_variant_unref (child); |
| 29988 | } |
| 29989 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 29990 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 29991 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 29992 | if (!g_value_get_boolean (&return_value)) |
| 29993 | 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); |
| 29994 | g_value_unset (&return_value); |
| 29995 | for (n = 0; n < num_params + num_extra; n++) |
| 29996 | g_value_unset (¶mv[n]); |
| 29997 | g_free (paramv); |
| 29998 | } |
| 29999 | |
| 30000 | static GVariant * |
| 30001 | _host_ipmi_skeleton_handle_get_property ( |
| 30002 | GDBusConnection *connection G_GNUC_UNUSED, |
| 30003 | const gchar *sender G_GNUC_UNUSED, |
| 30004 | const gchar *object_path G_GNUC_UNUSED, |
| 30005 | const gchar *interface_name G_GNUC_UNUSED, |
| 30006 | const gchar *property_name, |
| 30007 | GError **error, |
| 30008 | gpointer user_data) |
| 30009 | { |
| 30010 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 30011 | GValue value = G_VALUE_INIT; |
| 30012 | GParamSpec *pspec; |
| 30013 | _ExtendedGDBusPropertyInfo *info; |
| 30014 | GVariant *ret; |
| 30015 | ret = NULL; |
| 30016 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 30017 | g_assert (info != NULL); |
| 30018 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 30019 | if (pspec == NULL) |
| 30020 | { |
| 30021 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 30022 | } |
| 30023 | else |
| 30024 | { |
| 30025 | g_value_init (&value, pspec->value_type); |
| 30026 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 30027 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 30028 | g_value_unset (&value); |
| 30029 | } |
| 30030 | return ret; |
| 30031 | } |
| 30032 | |
| 30033 | static gboolean |
| 30034 | _host_ipmi_skeleton_handle_set_property ( |
| 30035 | GDBusConnection *connection G_GNUC_UNUSED, |
| 30036 | const gchar *sender G_GNUC_UNUSED, |
| 30037 | const gchar *object_path G_GNUC_UNUSED, |
| 30038 | const gchar *interface_name G_GNUC_UNUSED, |
| 30039 | const gchar *property_name, |
| 30040 | GVariant *variant, |
| 30041 | GError **error, |
| 30042 | gpointer user_data) |
| 30043 | { |
| 30044 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 30045 | GValue value = G_VALUE_INIT; |
| 30046 | GParamSpec *pspec; |
| 30047 | _ExtendedGDBusPropertyInfo *info; |
| 30048 | gboolean ret; |
| 30049 | ret = FALSE; |
| 30050 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 30051 | g_assert (info != NULL); |
| 30052 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 30053 | if (pspec == NULL) |
| 30054 | { |
| 30055 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 30056 | } |
| 30057 | else |
| 30058 | { |
| 30059 | if (info->use_gvariant) |
| 30060 | g_value_set_variant (&value, variant); |
| 30061 | else |
| 30062 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 30063 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 30064 | g_value_unset (&value); |
| 30065 | ret = TRUE; |
| 30066 | } |
| 30067 | return ret; |
| 30068 | } |
| 30069 | |
| 30070 | static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable = |
| 30071 | { |
| 30072 | _host_ipmi_skeleton_handle_method_call, |
| 30073 | _host_ipmi_skeleton_handle_get_property, |
| 30074 | _host_ipmi_skeleton_handle_set_property, |
| 30075 | {NULL} |
| 30076 | }; |
| 30077 | |
| 30078 | static GDBusInterfaceInfo * |
| 30079 | host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 30080 | { |
| 30081 | return host_ipmi_interface_info (); |
| 30082 | } |
| 30083 | |
| 30084 | static GDBusInterfaceVTable * |
| 30085 | host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 30086 | { |
| 30087 | return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable; |
| 30088 | } |
| 30089 | |
| 30090 | static GVariant * |
| 30091 | host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 30092 | { |
| 30093 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton); |
| 30094 | |
| 30095 | GVariantBuilder builder; |
| 30096 | guint n; |
| 30097 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 30098 | if (_host_ipmi_interface_info.parent_struct.properties == NULL) |
| 30099 | goto out; |
| 30100 | for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++) |
| 30101 | { |
| 30102 | GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n]; |
| 30103 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 30104 | { |
| 30105 | GVariant *value; |
| 30106 | 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); |
| 30107 | if (value != NULL) |
| 30108 | { |
| 30109 | g_variant_take_ref (value); |
| 30110 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 30111 | g_variant_unref (value); |
| 30112 | } |
| 30113 | } |
| 30114 | } |
| 30115 | out: |
| 30116 | return g_variant_builder_end (&builder); |
| 30117 | } |
| 30118 | |
| 30119 | static void |
| 30120 | host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 30121 | { |
| 30122 | } |
| 30123 | |
| 30124 | static void |
| 30125 | _host_ipmi_on_signal_received_message ( |
| 30126 | HostIpmi *object, |
| 30127 | guchar arg_seq, |
| 30128 | guchar arg_netfn, |
| 30129 | guchar arg_cmd, |
| 30130 | const gchar *arg_data) |
| 30131 | { |
| 30132 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 30133 | |
| 30134 | GList *connections, *l; |
| 30135 | GVariant *signal_variant; |
| 30136 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 30137 | |
| 30138 | signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)", |
| 30139 | arg_seq, |
| 30140 | arg_netfn, |
| 30141 | arg_cmd, |
| 30142 | arg_data)); |
| 30143 | for (l = connections; l != NULL; l = l->next) |
| 30144 | { |
| 30145 | GDBusConnection *connection = l->data; |
| 30146 | g_dbus_connection_emit_signal (connection, |
| 30147 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage", |
| 30148 | signal_variant, NULL); |
| 30149 | } |
| 30150 | g_variant_unref (signal_variant); |
| 30151 | g_list_free_full (connections, g_object_unref); |
| 30152 | } |
| 30153 | |
| 30154 | static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface); |
| 30155 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 30156 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 30157 | G_ADD_PRIVATE (HostIpmiSkeleton) |
| 30158 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 30159 | |
| 30160 | #else |
| 30161 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 30162 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 30163 | |
| 30164 | #endif |
| 30165 | static void |
| 30166 | host_ipmi_skeleton_finalize (GObject *object) |
| 30167 | { |
| 30168 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 30169 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 30170 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 30171 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 30172 | g_main_context_unref (skeleton->priv->context); |
| 30173 | g_mutex_clear (&skeleton->priv->lock); |
| 30174 | G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object); |
| 30175 | } |
| 30176 | |
| 30177 | static void |
| 30178 | host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton) |
| 30179 | { |
| 30180 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 30181 | skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton); |
| 30182 | #else |
| 30183 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate); |
| 30184 | #endif |
| 30185 | |
| 30186 | g_mutex_init (&skeleton->priv->lock); |
| 30187 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 30188 | } |
| 30189 | |
| 30190 | static void |
| 30191 | host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass) |
| 30192 | { |
| 30193 | GObjectClass *gobject_class; |
| 30194 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 30195 | |
| 30196 | gobject_class = G_OBJECT_CLASS (klass); |
| 30197 | gobject_class->finalize = host_ipmi_skeleton_finalize; |
| 30198 | |
| 30199 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 30200 | skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info; |
| 30201 | skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties; |
| 30202 | skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush; |
| 30203 | skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable; |
| 30204 | |
| 30205 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 30206 | g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate)); |
| 30207 | #endif |
| 30208 | } |
| 30209 | |
| 30210 | static void |
| 30211 | host_ipmi_skeleton_iface_init (HostIpmiIface *iface) |
| 30212 | { |
| 30213 | iface->received_message = _host_ipmi_on_signal_received_message; |
| 30214 | } |
| 30215 | |
| 30216 | /** |
| 30217 | * host_ipmi_skeleton_new: |
| 30218 | * |
| 30219 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 30220 | * |
| 30221 | * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object. |
| 30222 | */ |
| 30223 | HostIpmi * |
| 30224 | host_ipmi_skeleton_new (void) |
| 30225 | { |
| 30226 | return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL)); |
| 30227 | } |
| 30228 | |
| 30229 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30230 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 30231 | * ------------------------------------------------------------------------ |
| 30232 | */ |
| 30233 | |
| 30234 | /** |
| 30235 | * SECTION:Object |
| 30236 | * @title: Object |
| 30237 | * @short_description: Specialized GDBusObject types |
| 30238 | * |
| 30239 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 30240 | */ |
| 30241 | |
| 30242 | /** |
| 30243 | * Object: |
| 30244 | * |
| 30245 | * The #Object type is a specialized container of interfaces. |
| 30246 | */ |
| 30247 | |
| 30248 | /** |
| 30249 | * ObjectIface: |
| 30250 | * @parent_iface: The parent interface. |
| 30251 | * |
| 30252 | * Virtual table for the #Object interface. |
| 30253 | */ |
| 30254 | |
| 30255 | typedef ObjectIface ObjectInterface; |
| 30256 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 30257 | |
| 30258 | static void |
| 30259 | object_default_init (ObjectIface *iface) |
| 30260 | { |
| 30261 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30262 | * Object:object-mapper: |
| 30263 | * |
| 30264 | * The #ObjectMapper instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>, if any. |
| 30265 | * |
| 30266 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30267 | */ |
| 30268 | g_object_interface_install_property (iface, g_param_spec_object ("object-mapper", "object-mapper", "object-mapper", TYPE_OBJECT_MAPPER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30269 | |
| 30270 | /** |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 30271 | * Object:hwmon: |
| 30272 | * |
| 30273 | * The #Hwmon instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>, if any. |
| 30274 | * |
| 30275 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30276 | */ |
| 30277 | g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30278 | |
| 30279 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30280 | * Object:fan: |
| 30281 | * |
| 30282 | * 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. |
| 30283 | * |
| 30284 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30285 | */ |
| 30286 | g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30287 | |
| 30288 | /** |
| 30289 | * Object:sensor-value: |
| 30290 | * |
| 30291 | * 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. |
| 30292 | * |
| 30293 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30294 | */ |
| 30295 | 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)); |
| 30296 | |
| 30297 | /** |
| 30298 | * Object:sensor-threshold: |
| 30299 | * |
| 30300 | * 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. |
| 30301 | * |
| 30302 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30303 | */ |
| 30304 | 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)); |
| 30305 | |
| 30306 | /** |
| 30307 | * Object:sensor-i2c: |
| 30308 | * |
| 30309 | * 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. |
| 30310 | * |
| 30311 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30312 | */ |
| 30313 | 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)); |
| 30314 | |
| 30315 | /** |
| 30316 | * Object:sensor-match: |
| 30317 | * |
| 30318 | * 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. |
| 30319 | * |
| 30320 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30321 | */ |
| 30322 | 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)); |
| 30323 | |
| 30324 | /** |
| 30325 | * Object:process: |
| 30326 | * |
| 30327 | * 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. |
| 30328 | * |
| 30329 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30330 | */ |
| 30331 | g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30332 | |
| 30333 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30334 | * Object:shared-resource: |
| 30335 | * |
| 30336 | * 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. |
| 30337 | * |
| 30338 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30339 | */ |
| 30340 | 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)); |
| 30341 | |
| 30342 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30343 | * Object:control: |
| 30344 | * |
| 30345 | * 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. |
| 30346 | * |
| 30347 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30348 | */ |
| 30349 | g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30350 | |
| 30351 | /** |
| 30352 | * Object:control-bmc: |
| 30353 | * |
| 30354 | * 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. |
| 30355 | * |
| 30356 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30357 | */ |
| 30358 | 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)); |
| 30359 | |
| 30360 | /** |
| 30361 | * Object:control-host: |
| 30362 | * |
| 30363 | * 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. |
| 30364 | * |
| 30365 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30366 | */ |
| 30367 | 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)); |
| 30368 | |
| 30369 | /** |
| 30370 | * Object:control-power: |
| 30371 | * |
| 30372 | * 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. |
| 30373 | * |
| 30374 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30375 | */ |
| 30376 | 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)); |
| 30377 | |
| 30378 | /** |
| 30379 | * Object:watchdog: |
| 30380 | * |
| 30381 | * 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. |
| 30382 | * |
| 30383 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30384 | */ |
| 30385 | g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30386 | |
| 30387 | /** |
| 30388 | * Object:event-log: |
| 30389 | * |
| 30390 | * 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. |
| 30391 | * |
| 30392 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30393 | */ |
| 30394 | 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)); |
| 30395 | |
| 30396 | /** |
| 30397 | * Object:flash: |
| 30398 | * |
| 30399 | * 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. |
| 30400 | * |
| 30401 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30402 | */ |
| 30403 | g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30404 | |
| 30405 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30406 | * Object:flash-control: |
| 30407 | * |
| 30408 | * 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. |
| 30409 | * |
| 30410 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30411 | */ |
| 30412 | 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)); |
| 30413 | |
| 30414 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30415 | * Object:button: |
| 30416 | * |
| 30417 | * 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. |
| 30418 | * |
| 30419 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30420 | */ |
| 30421 | g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30422 | |
| 30423 | /** |
| 30424 | * Object:led: |
| 30425 | * |
| 30426 | * 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. |
| 30427 | * |
| 30428 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30429 | */ |
| 30430 | g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 30431 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30432 | /** |
| 30433 | * Object:host-ipmi: |
| 30434 | * |
| 30435 | * 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. |
| 30436 | * |
| 30437 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 30438 | */ |
| 30439 | 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)); |
| 30440 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30441 | } |
| 30442 | |
| 30443 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30444 | * object_get_object_mapper: |
| 30445 | * @object: A #Object. |
| 30446 | * |
| 30447 | * Gets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object, if any. |
| 30448 | * |
| 30449 | * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30450 | */ |
| 30451 | ObjectMapper *object_get_object_mapper (Object *object) |
| 30452 | { |
| 30453 | GDBusInterface *ret; |
| 30454 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
| 30455 | if (ret == NULL) |
| 30456 | return NULL; |
| 30457 | return OBJECT_MAPPER (ret); |
| 30458 | } |
| 30459 | |
| 30460 | /** |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 30461 | * object_get_hwmon: |
| 30462 | * @object: A #Object. |
| 30463 | * |
| 30464 | * Gets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object, if any. |
| 30465 | * |
| 30466 | * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30467 | */ |
| 30468 | Hwmon *object_get_hwmon (Object *object) |
| 30469 | { |
| 30470 | GDBusInterface *ret; |
| 30471 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); |
| 30472 | if (ret == NULL) |
| 30473 | return NULL; |
| 30474 | return HWMON (ret); |
| 30475 | } |
| 30476 | |
| 30477 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30478 | * object_get_fan: |
| 30479 | * @object: A #Object. |
| 30480 | * |
| 30481 | * 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. |
| 30482 | * |
| 30483 | * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30484 | */ |
| 30485 | Fan *object_get_fan (Object *object) |
| 30486 | { |
| 30487 | GDBusInterface *ret; |
| 30488 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 30489 | if (ret == NULL) |
| 30490 | return NULL; |
| 30491 | return FAN (ret); |
| 30492 | } |
| 30493 | |
| 30494 | /** |
| 30495 | * object_get_sensor_value: |
| 30496 | * @object: A #Object. |
| 30497 | * |
| 30498 | * 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. |
| 30499 | * |
| 30500 | * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30501 | */ |
| 30502 | SensorValue *object_get_sensor_value (Object *object) |
| 30503 | { |
| 30504 | GDBusInterface *ret; |
| 30505 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 30506 | if (ret == NULL) |
| 30507 | return NULL; |
| 30508 | return SENSOR_VALUE (ret); |
| 30509 | } |
| 30510 | |
| 30511 | /** |
| 30512 | * object_get_sensor_threshold: |
| 30513 | * @object: A #Object. |
| 30514 | * |
| 30515 | * 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. |
| 30516 | * |
| 30517 | * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30518 | */ |
| 30519 | SensorThreshold *object_get_sensor_threshold (Object *object) |
| 30520 | { |
| 30521 | GDBusInterface *ret; |
| 30522 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 30523 | if (ret == NULL) |
| 30524 | return NULL; |
| 30525 | return SENSOR_THRESHOLD (ret); |
| 30526 | } |
| 30527 | |
| 30528 | /** |
| 30529 | * object_get_sensor_i2c: |
| 30530 | * @object: A #Object. |
| 30531 | * |
| 30532 | * 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. |
| 30533 | * |
| 30534 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30535 | */ |
| 30536 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 30537 | { |
| 30538 | GDBusInterface *ret; |
| 30539 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 30540 | if (ret == NULL) |
| 30541 | return NULL; |
| 30542 | return SENSOR_I2C (ret); |
| 30543 | } |
| 30544 | |
| 30545 | /** |
| 30546 | * object_get_sensor_match: |
| 30547 | * @object: A #Object. |
| 30548 | * |
| 30549 | * 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. |
| 30550 | * |
| 30551 | * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30552 | */ |
| 30553 | SensorMatch *object_get_sensor_match (Object *object) |
| 30554 | { |
| 30555 | GDBusInterface *ret; |
| 30556 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 30557 | if (ret == NULL) |
| 30558 | return NULL; |
| 30559 | return SENSOR_MATCH (ret); |
| 30560 | } |
| 30561 | |
| 30562 | /** |
| 30563 | * object_get_process: |
| 30564 | * @object: A #Object. |
| 30565 | * |
| 30566 | * 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. |
| 30567 | * |
| 30568 | * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30569 | */ |
| 30570 | Process *object_get_process (Object *object) |
| 30571 | { |
| 30572 | GDBusInterface *ret; |
| 30573 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 30574 | if (ret == NULL) |
| 30575 | return NULL; |
| 30576 | return PROCESS (ret); |
| 30577 | } |
| 30578 | |
| 30579 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30580 | * object_get_shared_resource: |
| 30581 | * @object: A #Object. |
| 30582 | * |
| 30583 | * 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. |
| 30584 | * |
| 30585 | * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30586 | */ |
| 30587 | SharedResource *object_get_shared_resource (Object *object) |
| 30588 | { |
| 30589 | GDBusInterface *ret; |
| 30590 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 30591 | if (ret == NULL) |
| 30592 | return NULL; |
| 30593 | return SHARED_RESOURCE (ret); |
| 30594 | } |
| 30595 | |
| 30596 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30597 | * object_get_control: |
| 30598 | * @object: A #Object. |
| 30599 | * |
| 30600 | * 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. |
| 30601 | * |
| 30602 | * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30603 | */ |
| 30604 | Control *object_get_control (Object *object) |
| 30605 | { |
| 30606 | GDBusInterface *ret; |
| 30607 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 30608 | if (ret == NULL) |
| 30609 | return NULL; |
| 30610 | return CONTROL (ret); |
| 30611 | } |
| 30612 | |
| 30613 | /** |
| 30614 | * object_get_control_bmc: |
| 30615 | * @object: A #Object. |
| 30616 | * |
| 30617 | * 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. |
| 30618 | * |
| 30619 | * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30620 | */ |
| 30621 | ControlBmc *object_get_control_bmc (Object *object) |
| 30622 | { |
| 30623 | GDBusInterface *ret; |
| 30624 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 30625 | if (ret == NULL) |
| 30626 | return NULL; |
| 30627 | return CONTROL_BMC (ret); |
| 30628 | } |
| 30629 | |
| 30630 | /** |
| 30631 | * object_get_control_host: |
| 30632 | * @object: A #Object. |
| 30633 | * |
| 30634 | * 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. |
| 30635 | * |
| 30636 | * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30637 | */ |
| 30638 | ControlHost *object_get_control_host (Object *object) |
| 30639 | { |
| 30640 | GDBusInterface *ret; |
| 30641 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 30642 | if (ret == NULL) |
| 30643 | return NULL; |
| 30644 | return CONTROL_HOST (ret); |
| 30645 | } |
| 30646 | |
| 30647 | /** |
| 30648 | * object_get_control_power: |
| 30649 | * @object: A #Object. |
| 30650 | * |
| 30651 | * 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. |
| 30652 | * |
| 30653 | * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30654 | */ |
| 30655 | ControlPower *object_get_control_power (Object *object) |
| 30656 | { |
| 30657 | GDBusInterface *ret; |
| 30658 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 30659 | if (ret == NULL) |
| 30660 | return NULL; |
| 30661 | return CONTROL_POWER (ret); |
| 30662 | } |
| 30663 | |
| 30664 | /** |
| 30665 | * object_get_watchdog: |
| 30666 | * @object: A #Object. |
| 30667 | * |
| 30668 | * 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. |
| 30669 | * |
| 30670 | * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30671 | */ |
| 30672 | Watchdog *object_get_watchdog (Object *object) |
| 30673 | { |
| 30674 | GDBusInterface *ret; |
| 30675 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 30676 | if (ret == NULL) |
| 30677 | return NULL; |
| 30678 | return WATCHDOG (ret); |
| 30679 | } |
| 30680 | |
| 30681 | /** |
| 30682 | * object_get_event_log: |
| 30683 | * @object: A #Object. |
| 30684 | * |
| 30685 | * 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. |
| 30686 | * |
| 30687 | * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30688 | */ |
| 30689 | EventLog *object_get_event_log (Object *object) |
| 30690 | { |
| 30691 | GDBusInterface *ret; |
| 30692 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 30693 | if (ret == NULL) |
| 30694 | return NULL; |
| 30695 | return EVENT_LOG (ret); |
| 30696 | } |
| 30697 | |
| 30698 | /** |
| 30699 | * object_get_flash: |
| 30700 | * @object: A #Object. |
| 30701 | * |
| 30702 | * 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. |
| 30703 | * |
| 30704 | * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30705 | */ |
| 30706 | Flash *object_get_flash (Object *object) |
| 30707 | { |
| 30708 | GDBusInterface *ret; |
| 30709 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 30710 | if (ret == NULL) |
| 30711 | return NULL; |
| 30712 | return FLASH (ret); |
| 30713 | } |
| 30714 | |
| 30715 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30716 | * object_get_flash_control: |
| 30717 | * @object: A #Object. |
| 30718 | * |
| 30719 | * 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. |
| 30720 | * |
| 30721 | * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30722 | */ |
| 30723 | FlashControl *object_get_flash_control (Object *object) |
| 30724 | { |
| 30725 | GDBusInterface *ret; |
| 30726 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 30727 | if (ret == NULL) |
| 30728 | return NULL; |
| 30729 | return FLASH_CONTROL (ret); |
| 30730 | } |
| 30731 | |
| 30732 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30733 | * object_get_button: |
| 30734 | * @object: A #Object. |
| 30735 | * |
| 30736 | * 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. |
| 30737 | * |
| 30738 | * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30739 | */ |
| 30740 | Button *object_get_button (Object *object) |
| 30741 | { |
| 30742 | GDBusInterface *ret; |
| 30743 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 30744 | if (ret == NULL) |
| 30745 | return NULL; |
| 30746 | return BUTTON (ret); |
| 30747 | } |
| 30748 | |
| 30749 | /** |
| 30750 | * object_get_led: |
| 30751 | * @object: A #Object. |
| 30752 | * |
| 30753 | * 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. |
| 30754 | * |
| 30755 | * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30756 | */ |
| 30757 | Led *object_get_led (Object *object) |
| 30758 | { |
| 30759 | GDBusInterface *ret; |
| 30760 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 30761 | if (ret == NULL) |
| 30762 | return NULL; |
| 30763 | return LED (ret); |
| 30764 | } |
| 30765 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30766 | /** |
| 30767 | * object_get_host_ipmi: |
| 30768 | * @object: A #Object. |
| 30769 | * |
| 30770 | * 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. |
| 30771 | * |
| 30772 | * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 30773 | */ |
| 30774 | HostIpmi *object_get_host_ipmi (Object *object) |
| 30775 | { |
| 30776 | GDBusInterface *ret; |
| 30777 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 30778 | if (ret == NULL) |
| 30779 | return NULL; |
| 30780 | return HOST_IPMI (ret); |
| 30781 | } |
| 30782 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30783 | |
| 30784 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30785 | * object_peek_object_mapper: (skip) |
| 30786 | * @object: A #Object. |
| 30787 | * |
| 30788 | * Like object_get_object_mapper() but doesn't increase the reference count on the returned object. |
| 30789 | * |
| 30790 | * <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> |
| 30791 | * |
| 30792 | * Returns: (transfer none): A #ObjectMapper or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 30793 | */ |
| 30794 | ObjectMapper *object_peek_object_mapper (Object *object) |
| 30795 | { |
| 30796 | GDBusInterface *ret; |
| 30797 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
| 30798 | if (ret == NULL) |
| 30799 | return NULL; |
| 30800 | g_object_unref (ret); |
| 30801 | return OBJECT_MAPPER (ret); |
| 30802 | } |
| 30803 | |
| 30804 | /** |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 30805 | * object_peek_hwmon: (skip) |
| 30806 | * @object: A #Object. |
| 30807 | * |
| 30808 | * Like object_get_hwmon() but doesn't increase the reference count on the returned object. |
| 30809 | * |
| 30810 | * <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> |
| 30811 | * |
| 30812 | * Returns: (transfer none): A #Hwmon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 30813 | */ |
| 30814 | Hwmon *object_peek_hwmon (Object *object) |
| 30815 | { |
| 30816 | GDBusInterface *ret; |
| 30817 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); |
| 30818 | if (ret == NULL) |
| 30819 | return NULL; |
| 30820 | g_object_unref (ret); |
| 30821 | return HWMON (ret); |
| 30822 | } |
| 30823 | |
| 30824 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30825 | * object_peek_fan: (skip) |
| 30826 | * @object: A #Object. |
| 30827 | * |
| 30828 | * Like object_get_fan() but doesn't increase the reference count on the returned object. |
| 30829 | * |
| 30830 | * <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> |
| 30831 | * |
| 30832 | * 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. |
| 30833 | */ |
| 30834 | Fan *object_peek_fan (Object *object) |
| 30835 | { |
| 30836 | GDBusInterface *ret; |
| 30837 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 30838 | if (ret == NULL) |
| 30839 | return NULL; |
| 30840 | g_object_unref (ret); |
| 30841 | return FAN (ret); |
| 30842 | } |
| 30843 | |
| 30844 | /** |
| 30845 | * object_peek_sensor_value: (skip) |
| 30846 | * @object: A #Object. |
| 30847 | * |
| 30848 | * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. |
| 30849 | * |
| 30850 | * <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> |
| 30851 | * |
| 30852 | * 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. |
| 30853 | */ |
| 30854 | SensorValue *object_peek_sensor_value (Object *object) |
| 30855 | { |
| 30856 | GDBusInterface *ret; |
| 30857 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 30858 | if (ret == NULL) |
| 30859 | return NULL; |
| 30860 | g_object_unref (ret); |
| 30861 | return SENSOR_VALUE (ret); |
| 30862 | } |
| 30863 | |
| 30864 | /** |
| 30865 | * object_peek_sensor_threshold: (skip) |
| 30866 | * @object: A #Object. |
| 30867 | * |
| 30868 | * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. |
| 30869 | * |
| 30870 | * <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> |
| 30871 | * |
| 30872 | * 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. |
| 30873 | */ |
| 30874 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
| 30875 | { |
| 30876 | GDBusInterface *ret; |
| 30877 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 30878 | if (ret == NULL) |
| 30879 | return NULL; |
| 30880 | g_object_unref (ret); |
| 30881 | return SENSOR_THRESHOLD (ret); |
| 30882 | } |
| 30883 | |
| 30884 | /** |
| 30885 | * object_peek_sensor_i2c: (skip) |
| 30886 | * @object: A #Object. |
| 30887 | * |
| 30888 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 30889 | * |
| 30890 | * <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> |
| 30891 | * |
| 30892 | * 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. |
| 30893 | */ |
| 30894 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 30895 | { |
| 30896 | GDBusInterface *ret; |
| 30897 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 30898 | if (ret == NULL) |
| 30899 | return NULL; |
| 30900 | g_object_unref (ret); |
| 30901 | return SENSOR_I2C (ret); |
| 30902 | } |
| 30903 | |
| 30904 | /** |
| 30905 | * object_peek_sensor_match: (skip) |
| 30906 | * @object: A #Object. |
| 30907 | * |
| 30908 | * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. |
| 30909 | * |
| 30910 | * <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> |
| 30911 | * |
| 30912 | * 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. |
| 30913 | */ |
| 30914 | SensorMatch *object_peek_sensor_match (Object *object) |
| 30915 | { |
| 30916 | GDBusInterface *ret; |
| 30917 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 30918 | if (ret == NULL) |
| 30919 | return NULL; |
| 30920 | g_object_unref (ret); |
| 30921 | return SENSOR_MATCH (ret); |
| 30922 | } |
| 30923 | |
| 30924 | /** |
| 30925 | * object_peek_process: (skip) |
| 30926 | * @object: A #Object. |
| 30927 | * |
| 30928 | * Like object_get_process() but doesn't increase the reference count on the returned object. |
| 30929 | * |
| 30930 | * <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> |
| 30931 | * |
| 30932 | * 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. |
| 30933 | */ |
| 30934 | Process *object_peek_process (Object *object) |
| 30935 | { |
| 30936 | GDBusInterface *ret; |
| 30937 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 30938 | if (ret == NULL) |
| 30939 | return NULL; |
| 30940 | g_object_unref (ret); |
| 30941 | return PROCESS (ret); |
| 30942 | } |
| 30943 | |
| 30944 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30945 | * object_peek_shared_resource: (skip) |
| 30946 | * @object: A #Object. |
| 30947 | * |
| 30948 | * Like object_get_shared_resource() but doesn't increase the reference count on the returned object. |
| 30949 | * |
| 30950 | * <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> |
| 30951 | * |
| 30952 | * 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. |
| 30953 | */ |
| 30954 | SharedResource *object_peek_shared_resource (Object *object) |
| 30955 | { |
| 30956 | GDBusInterface *ret; |
| 30957 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 30958 | if (ret == NULL) |
| 30959 | return NULL; |
| 30960 | g_object_unref (ret); |
| 30961 | return SHARED_RESOURCE (ret); |
| 30962 | } |
| 30963 | |
| 30964 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30965 | * object_peek_control: (skip) |
| 30966 | * @object: A #Object. |
| 30967 | * |
| 30968 | * Like object_get_control() but doesn't increase the reference count on the returned object. |
| 30969 | * |
| 30970 | * <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> |
| 30971 | * |
| 30972 | * 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. |
| 30973 | */ |
| 30974 | Control *object_peek_control (Object *object) |
| 30975 | { |
| 30976 | GDBusInterface *ret; |
| 30977 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 30978 | if (ret == NULL) |
| 30979 | return NULL; |
| 30980 | g_object_unref (ret); |
| 30981 | return CONTROL (ret); |
| 30982 | } |
| 30983 | |
| 30984 | /** |
| 30985 | * object_peek_control_bmc: (skip) |
| 30986 | * @object: A #Object. |
| 30987 | * |
| 30988 | * Like object_get_control_bmc() but doesn't increase the reference count on the returned object. |
| 30989 | * |
| 30990 | * <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> |
| 30991 | * |
| 30992 | * 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. |
| 30993 | */ |
| 30994 | ControlBmc *object_peek_control_bmc (Object *object) |
| 30995 | { |
| 30996 | GDBusInterface *ret; |
| 30997 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 30998 | if (ret == NULL) |
| 30999 | return NULL; |
| 31000 | g_object_unref (ret); |
| 31001 | return CONTROL_BMC (ret); |
| 31002 | } |
| 31003 | |
| 31004 | /** |
| 31005 | * object_peek_control_host: (skip) |
| 31006 | * @object: A #Object. |
| 31007 | * |
| 31008 | * Like object_get_control_host() but doesn't increase the reference count on the returned object. |
| 31009 | * |
| 31010 | * <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> |
| 31011 | * |
| 31012 | * 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. |
| 31013 | */ |
| 31014 | ControlHost *object_peek_control_host (Object *object) |
| 31015 | { |
| 31016 | GDBusInterface *ret; |
| 31017 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 31018 | if (ret == NULL) |
| 31019 | return NULL; |
| 31020 | g_object_unref (ret); |
| 31021 | return CONTROL_HOST (ret); |
| 31022 | } |
| 31023 | |
| 31024 | /** |
| 31025 | * object_peek_control_power: (skip) |
| 31026 | * @object: A #Object. |
| 31027 | * |
| 31028 | * Like object_get_control_power() but doesn't increase the reference count on the returned object. |
| 31029 | * |
| 31030 | * <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> |
| 31031 | * |
| 31032 | * 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. |
| 31033 | */ |
| 31034 | ControlPower *object_peek_control_power (Object *object) |
| 31035 | { |
| 31036 | GDBusInterface *ret; |
| 31037 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 31038 | if (ret == NULL) |
| 31039 | return NULL; |
| 31040 | g_object_unref (ret); |
| 31041 | return CONTROL_POWER (ret); |
| 31042 | } |
| 31043 | |
| 31044 | /** |
| 31045 | * object_peek_watchdog: (skip) |
| 31046 | * @object: A #Object. |
| 31047 | * |
| 31048 | * Like object_get_watchdog() but doesn't increase the reference count on the returned object. |
| 31049 | * |
| 31050 | * <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> |
| 31051 | * |
| 31052 | * 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. |
| 31053 | */ |
| 31054 | Watchdog *object_peek_watchdog (Object *object) |
| 31055 | { |
| 31056 | GDBusInterface *ret; |
| 31057 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 31058 | if (ret == NULL) |
| 31059 | return NULL; |
| 31060 | g_object_unref (ret); |
| 31061 | return WATCHDOG (ret); |
| 31062 | } |
| 31063 | |
| 31064 | /** |
| 31065 | * object_peek_event_log: (skip) |
| 31066 | * @object: A #Object. |
| 31067 | * |
| 31068 | * Like object_get_event_log() but doesn't increase the reference count on the returned object. |
| 31069 | * |
| 31070 | * <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> |
| 31071 | * |
| 31072 | * 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. |
| 31073 | */ |
| 31074 | EventLog *object_peek_event_log (Object *object) |
| 31075 | { |
| 31076 | GDBusInterface *ret; |
| 31077 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 31078 | if (ret == NULL) |
| 31079 | return NULL; |
| 31080 | g_object_unref (ret); |
| 31081 | return EVENT_LOG (ret); |
| 31082 | } |
| 31083 | |
| 31084 | /** |
| 31085 | * object_peek_flash: (skip) |
| 31086 | * @object: A #Object. |
| 31087 | * |
| 31088 | * Like object_get_flash() but doesn't increase the reference count on the returned object. |
| 31089 | * |
| 31090 | * <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> |
| 31091 | * |
| 31092 | * 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. |
| 31093 | */ |
| 31094 | Flash *object_peek_flash (Object *object) |
| 31095 | { |
| 31096 | GDBusInterface *ret; |
| 31097 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 31098 | if (ret == NULL) |
| 31099 | return NULL; |
| 31100 | g_object_unref (ret); |
| 31101 | return FLASH (ret); |
| 31102 | } |
| 31103 | |
| 31104 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31105 | * object_peek_flash_control: (skip) |
| 31106 | * @object: A #Object. |
| 31107 | * |
| 31108 | * Like object_get_flash_control() but doesn't increase the reference count on the returned object. |
| 31109 | * |
| 31110 | * <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> |
| 31111 | * |
| 31112 | * 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. |
| 31113 | */ |
| 31114 | FlashControl *object_peek_flash_control (Object *object) |
| 31115 | { |
| 31116 | GDBusInterface *ret; |
| 31117 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 31118 | if (ret == NULL) |
| 31119 | return NULL; |
| 31120 | g_object_unref (ret); |
| 31121 | return FLASH_CONTROL (ret); |
| 31122 | } |
| 31123 | |
| 31124 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31125 | * object_peek_button: (skip) |
| 31126 | * @object: A #Object. |
| 31127 | * |
| 31128 | * Like object_get_button() but doesn't increase the reference count on the returned object. |
| 31129 | * |
| 31130 | * <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> |
| 31131 | * |
| 31132 | * 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. |
| 31133 | */ |
| 31134 | Button *object_peek_button (Object *object) |
| 31135 | { |
| 31136 | GDBusInterface *ret; |
| 31137 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 31138 | if (ret == NULL) |
| 31139 | return NULL; |
| 31140 | g_object_unref (ret); |
| 31141 | return BUTTON (ret); |
| 31142 | } |
| 31143 | |
| 31144 | /** |
| 31145 | * object_peek_led: (skip) |
| 31146 | * @object: A #Object. |
| 31147 | * |
| 31148 | * Like object_get_led() but doesn't increase the reference count on the returned object. |
| 31149 | * |
| 31150 | * <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> |
| 31151 | * |
| 31152 | * 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. |
| 31153 | */ |
| 31154 | Led *object_peek_led (Object *object) |
| 31155 | { |
| 31156 | GDBusInterface *ret; |
| 31157 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 31158 | if (ret == NULL) |
| 31159 | return NULL; |
| 31160 | g_object_unref (ret); |
| 31161 | return LED (ret); |
| 31162 | } |
| 31163 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 31164 | /** |
| 31165 | * object_peek_host_ipmi: (skip) |
| 31166 | * @object: A #Object. |
| 31167 | * |
| 31168 | * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object. |
| 31169 | * |
| 31170 | * <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> |
| 31171 | * |
| 31172 | * 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. |
| 31173 | */ |
| 31174 | HostIpmi *object_peek_host_ipmi (Object *object) |
| 31175 | { |
| 31176 | GDBusInterface *ret; |
| 31177 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 31178 | if (ret == NULL) |
| 31179 | return NULL; |
| 31180 | g_object_unref (ret); |
| 31181 | return HOST_IPMI (ret); |
| 31182 | } |
| 31183 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31184 | |
| 31185 | static void |
| 31186 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 31187 | { |
| 31188 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 31189 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 31190 | * anything about, for example old generated code in this process talking to |
| 31191 | * newer generated code in the other process. */ |
| 31192 | if (info != NULL) |
| 31193 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 31194 | } |
| 31195 | |
| 31196 | /** |
| 31197 | * ObjectProxy: |
| 31198 | * |
| 31199 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 31200 | */ |
| 31201 | |
| 31202 | /** |
| 31203 | * ObjectProxyClass: |
| 31204 | * @parent_class: The parent class. |
| 31205 | * |
| 31206 | * Class structure for #ObjectProxy. |
| 31207 | */ |
| 31208 | |
| 31209 | static void |
| 31210 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 31211 | { |
| 31212 | } |
| 31213 | |
| 31214 | static void |
| 31215 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 31216 | { |
| 31217 | iface->interface_added = object_notify; |
| 31218 | iface->interface_removed = object_notify; |
| 31219 | } |
| 31220 | |
| 31221 | |
| 31222 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 31223 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 31224 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 31225 | |
| 31226 | static void |
| 31227 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 31228 | { |
| 31229 | } |
| 31230 | |
| 31231 | static void |
| 31232 | object_proxy_set_property (GObject *gobject, |
| 31233 | guint prop_id, |
| 31234 | const GValue *value G_GNUC_UNUSED, |
| 31235 | GParamSpec *pspec) |
| 31236 | { |
| 31237 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 31238 | } |
| 31239 | |
| 31240 | static void |
| 31241 | object_proxy_get_property (GObject *gobject, |
| 31242 | guint prop_id, |
| 31243 | GValue *value, |
| 31244 | GParamSpec *pspec) |
| 31245 | { |
| 31246 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 31247 | GDBusInterface *interface; |
| 31248 | |
| 31249 | switch (prop_id) |
| 31250 | { |
| 31251 | case 1: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31252 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31253 | g_value_take_object (value, interface); |
| 31254 | break; |
| 31255 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31256 | case 2: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31257 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31258 | g_value_take_object (value, interface); |
| 31259 | break; |
| 31260 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31261 | case 3: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31262 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31263 | g_value_take_object (value, interface); |
| 31264 | break; |
| 31265 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31266 | case 4: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31267 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31268 | g_value_take_object (value, interface); |
| 31269 | break; |
| 31270 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31271 | case 5: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31272 | 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] | 31273 | g_value_take_object (value, interface); |
| 31274 | break; |
| 31275 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31276 | case 6: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31277 | 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] | 31278 | g_value_take_object (value, interface); |
| 31279 | break; |
| 31280 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31281 | case 7: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31282 | 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] | 31283 | g_value_take_object (value, interface); |
| 31284 | break; |
| 31285 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31286 | case 8: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31287 | 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] | 31288 | g_value_take_object (value, interface); |
| 31289 | break; |
| 31290 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31291 | case 9: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31292 | 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] | 31293 | g_value_take_object (value, interface); |
| 31294 | break; |
| 31295 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31296 | case 10: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31297 | 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] | 31298 | g_value_take_object (value, interface); |
| 31299 | break; |
| 31300 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31301 | case 11: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31302 | 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] | 31303 | g_value_take_object (value, interface); |
| 31304 | break; |
| 31305 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31306 | case 12: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31307 | 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] | 31308 | g_value_take_object (value, interface); |
| 31309 | break; |
| 31310 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31311 | case 13: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31312 | 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] | 31313 | g_value_take_object (value, interface); |
| 31314 | break; |
| 31315 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31316 | case 14: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31317 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 31318 | g_value_take_object (value, interface); |
| 31319 | break; |
| 31320 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31321 | case 15: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31322 | 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] | 31323 | g_value_take_object (value, interface); |
| 31324 | break; |
| 31325 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31326 | case 16: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31327 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31328 | g_value_take_object (value, interface); |
| 31329 | break; |
| 31330 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31331 | case 17: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31332 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31333 | g_value_take_object (value, interface); |
| 31334 | break; |
| 31335 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31336 | case 18: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31337 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31338 | g_value_take_object (value, interface); |
| 31339 | break; |
| 31340 | |
| 31341 | case 19: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31342 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 31343 | g_value_take_object (value, interface); |
| 31344 | break; |
| 31345 | |
| 31346 | case 20: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 31347 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 31348 | g_value_take_object (value, interface); |
| 31349 | break; |
| 31350 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31351 | default: |
| 31352 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 31353 | break; |
| 31354 | } |
| 31355 | } |
| 31356 | |
| 31357 | static void |
| 31358 | object_proxy_class_init (ObjectProxyClass *klass) |
| 31359 | { |
| 31360 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 31361 | |
| 31362 | gobject_class->set_property = object_proxy_set_property; |
| 31363 | gobject_class->get_property = object_proxy_get_property; |
| 31364 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31365 | g_object_class_override_property (gobject_class, 1, "object-mapper"); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31366 | g_object_class_override_property (gobject_class, 2, "hwmon"); |
| 31367 | g_object_class_override_property (gobject_class, 3, "fan"); |
| 31368 | g_object_class_override_property (gobject_class, 4, "sensor-value"); |
| 31369 | g_object_class_override_property (gobject_class, 5, "sensor-threshold"); |
| 31370 | g_object_class_override_property (gobject_class, 6, "sensor-i2c"); |
| 31371 | g_object_class_override_property (gobject_class, 7, "sensor-match"); |
| 31372 | g_object_class_override_property (gobject_class, 8, "process"); |
| 31373 | g_object_class_override_property (gobject_class, 9, "shared-resource"); |
| 31374 | g_object_class_override_property (gobject_class, 10, "control"); |
| 31375 | g_object_class_override_property (gobject_class, 11, "control-bmc"); |
| 31376 | g_object_class_override_property (gobject_class, 12, "control-host"); |
| 31377 | g_object_class_override_property (gobject_class, 13, "control-power"); |
| 31378 | g_object_class_override_property (gobject_class, 14, "watchdog"); |
| 31379 | g_object_class_override_property (gobject_class, 15, "event-log"); |
| 31380 | g_object_class_override_property (gobject_class, 16, "flash"); |
| 31381 | g_object_class_override_property (gobject_class, 17, "flash-control"); |
| 31382 | g_object_class_override_property (gobject_class, 18, "button"); |
| 31383 | g_object_class_override_property (gobject_class, 19, "led"); |
| 31384 | g_object_class_override_property (gobject_class, 20, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31385 | } |
| 31386 | |
| 31387 | /** |
| 31388 | * object_proxy_new: |
| 31389 | * @connection: A #GDBusConnection. |
| 31390 | * @object_path: An object path. |
| 31391 | * |
| 31392 | * Creates a new proxy object. |
| 31393 | * |
| 31394 | * Returns: (transfer full): The proxy object. |
| 31395 | */ |
| 31396 | ObjectProxy * |
| 31397 | object_proxy_new (GDBusConnection *connection, |
| 31398 | const gchar *object_path) |
| 31399 | { |
| 31400 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 31401 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 31402 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 31403 | } |
| 31404 | |
| 31405 | /** |
| 31406 | * ObjectSkeleton: |
| 31407 | * |
| 31408 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 31409 | */ |
| 31410 | |
| 31411 | /** |
| 31412 | * ObjectSkeletonClass: |
| 31413 | * @parent_class: The parent class. |
| 31414 | * |
| 31415 | * Class structure for #ObjectSkeleton. |
| 31416 | */ |
| 31417 | |
| 31418 | static void |
| 31419 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 31420 | { |
| 31421 | } |
| 31422 | |
| 31423 | |
| 31424 | static void |
| 31425 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 31426 | { |
| 31427 | iface->interface_added = object_notify; |
| 31428 | iface->interface_removed = object_notify; |
| 31429 | } |
| 31430 | |
| 31431 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 31432 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 31433 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 31434 | |
| 31435 | static void |
| 31436 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 31437 | { |
| 31438 | } |
| 31439 | |
| 31440 | static void |
| 31441 | object_skeleton_set_property (GObject *gobject, |
| 31442 | guint prop_id, |
| 31443 | const GValue *value, |
| 31444 | GParamSpec *pspec) |
| 31445 | { |
| 31446 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 31447 | GDBusInterfaceSkeleton *interface; |
| 31448 | |
| 31449 | switch (prop_id) |
| 31450 | { |
| 31451 | case 1: |
| 31452 | interface = g_value_get_object (value); |
| 31453 | if (interface != NULL) |
| 31454 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31455 | g_warn_if_fail (IS_OBJECT_MAPPER (interface)); |
| 31456 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31457 | } |
| 31458 | else |
| 31459 | { |
| 31460 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper"); |
| 31461 | } |
| 31462 | break; |
| 31463 | |
| 31464 | case 2: |
| 31465 | interface = g_value_get_object (value); |
| 31466 | if (interface != NULL) |
| 31467 | { |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31468 | g_warn_if_fail (IS_HWMON (interface)); |
| 31469 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31470 | } |
| 31471 | else |
| 31472 | { |
| 31473 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon"); |
| 31474 | } |
| 31475 | break; |
| 31476 | |
| 31477 | case 3: |
| 31478 | interface = g_value_get_object (value); |
| 31479 | if (interface != NULL) |
| 31480 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31481 | g_warn_if_fail (IS_FAN (interface)); |
| 31482 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31483 | } |
| 31484 | else |
| 31485 | { |
| 31486 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan"); |
| 31487 | } |
| 31488 | break; |
| 31489 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31490 | case 4: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31491 | interface = g_value_get_object (value); |
| 31492 | if (interface != NULL) |
| 31493 | { |
| 31494 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
| 31495 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31496 | } |
| 31497 | else |
| 31498 | { |
| 31499 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); |
| 31500 | } |
| 31501 | break; |
| 31502 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31503 | case 5: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31504 | interface = g_value_get_object (value); |
| 31505 | if (interface != NULL) |
| 31506 | { |
| 31507 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
| 31508 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31509 | } |
| 31510 | else |
| 31511 | { |
| 31512 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); |
| 31513 | } |
| 31514 | break; |
| 31515 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31516 | case 6: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31517 | interface = g_value_get_object (value); |
| 31518 | if (interface != NULL) |
| 31519 | { |
| 31520 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
| 31521 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31522 | } |
| 31523 | else |
| 31524 | { |
| 31525 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); |
| 31526 | } |
| 31527 | break; |
| 31528 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31529 | case 7: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31530 | interface = g_value_get_object (value); |
| 31531 | if (interface != NULL) |
| 31532 | { |
| 31533 | g_warn_if_fail (IS_SENSOR_MATCH (interface)); |
| 31534 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31535 | } |
| 31536 | else |
| 31537 | { |
| 31538 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); |
| 31539 | } |
| 31540 | break; |
| 31541 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31542 | case 8: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31543 | interface = g_value_get_object (value); |
| 31544 | if (interface != NULL) |
| 31545 | { |
| 31546 | g_warn_if_fail (IS_PROCESS (interface)); |
| 31547 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31548 | } |
| 31549 | else |
| 31550 | { |
| 31551 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process"); |
| 31552 | } |
| 31553 | break; |
| 31554 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31555 | case 9: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31556 | interface = g_value_get_object (value); |
| 31557 | if (interface != NULL) |
| 31558 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31559 | g_warn_if_fail (IS_SHARED_RESOURCE (interface)); |
| 31560 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31561 | } |
| 31562 | else |
| 31563 | { |
| 31564 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource"); |
| 31565 | } |
| 31566 | break; |
| 31567 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31568 | case 10: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31569 | interface = g_value_get_object (value); |
| 31570 | if (interface != NULL) |
| 31571 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31572 | g_warn_if_fail (IS_CONTROL (interface)); |
| 31573 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31574 | } |
| 31575 | else |
| 31576 | { |
| 31577 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control"); |
| 31578 | } |
| 31579 | break; |
| 31580 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31581 | case 11: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31582 | interface = g_value_get_object (value); |
| 31583 | if (interface != NULL) |
| 31584 | { |
| 31585 | g_warn_if_fail (IS_CONTROL_BMC (interface)); |
| 31586 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31587 | } |
| 31588 | else |
| 31589 | { |
| 31590 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc"); |
| 31591 | } |
| 31592 | break; |
| 31593 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31594 | case 12: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31595 | interface = g_value_get_object (value); |
| 31596 | if (interface != NULL) |
| 31597 | { |
| 31598 | g_warn_if_fail (IS_CONTROL_HOST (interface)); |
| 31599 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31600 | } |
| 31601 | else |
| 31602 | { |
| 31603 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host"); |
| 31604 | } |
| 31605 | break; |
| 31606 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31607 | case 13: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31608 | interface = g_value_get_object (value); |
| 31609 | if (interface != NULL) |
| 31610 | { |
| 31611 | g_warn_if_fail (IS_CONTROL_POWER (interface)); |
| 31612 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31613 | } |
| 31614 | else |
| 31615 | { |
| 31616 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power"); |
| 31617 | } |
| 31618 | break; |
| 31619 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31620 | case 14: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31621 | interface = g_value_get_object (value); |
| 31622 | if (interface != NULL) |
| 31623 | { |
| 31624 | g_warn_if_fail (IS_WATCHDOG (interface)); |
| 31625 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31626 | } |
| 31627 | else |
| 31628 | { |
| 31629 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); |
| 31630 | } |
| 31631 | break; |
| 31632 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31633 | case 15: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31634 | interface = g_value_get_object (value); |
| 31635 | if (interface != NULL) |
| 31636 | { |
| 31637 | g_warn_if_fail (IS_EVENT_LOG (interface)); |
| 31638 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31639 | } |
| 31640 | else |
| 31641 | { |
| 31642 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog"); |
| 31643 | } |
| 31644 | break; |
| 31645 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31646 | case 16: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31647 | interface = g_value_get_object (value); |
| 31648 | if (interface != NULL) |
| 31649 | { |
| 31650 | g_warn_if_fail (IS_FLASH (interface)); |
| 31651 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31652 | } |
| 31653 | else |
| 31654 | { |
| 31655 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash"); |
| 31656 | } |
| 31657 | break; |
| 31658 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31659 | case 17: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31660 | interface = g_value_get_object (value); |
| 31661 | if (interface != NULL) |
| 31662 | { |
| 31663 | g_warn_if_fail (IS_FLASH_CONTROL (interface)); |
| 31664 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31665 | } |
| 31666 | else |
| 31667 | { |
| 31668 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl"); |
| 31669 | } |
| 31670 | break; |
| 31671 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31672 | case 18: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31673 | interface = g_value_get_object (value); |
| 31674 | if (interface != NULL) |
| 31675 | { |
| 31676 | g_warn_if_fail (IS_BUTTON (interface)); |
| 31677 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31678 | } |
| 31679 | else |
| 31680 | { |
| 31681 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button"); |
| 31682 | } |
| 31683 | break; |
| 31684 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31685 | case 19: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31686 | interface = g_value_get_object (value); |
| 31687 | if (interface != NULL) |
| 31688 | { |
| 31689 | g_warn_if_fail (IS_LED (interface)); |
| 31690 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31691 | } |
| 31692 | else |
| 31693 | { |
| 31694 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led"); |
| 31695 | } |
| 31696 | break; |
| 31697 | |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31698 | case 20: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 31699 | interface = g_value_get_object (value); |
| 31700 | if (interface != NULL) |
| 31701 | { |
| 31702 | g_warn_if_fail (IS_HOST_IPMI (interface)); |
| 31703 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 31704 | } |
| 31705 | else |
| 31706 | { |
| 31707 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi"); |
| 31708 | } |
| 31709 | break; |
| 31710 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31711 | default: |
| 31712 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 31713 | break; |
| 31714 | } |
| 31715 | } |
| 31716 | |
| 31717 | static void |
| 31718 | object_skeleton_get_property (GObject *gobject, |
| 31719 | guint prop_id, |
| 31720 | GValue *value, |
| 31721 | GParamSpec *pspec) |
| 31722 | { |
| 31723 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 31724 | GDBusInterface *interface; |
| 31725 | |
| 31726 | switch (prop_id) |
| 31727 | { |
| 31728 | case 1: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31729 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31730 | g_value_take_object (value, interface); |
| 31731 | break; |
| 31732 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31733 | case 2: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31734 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31735 | g_value_take_object (value, interface); |
| 31736 | break; |
| 31737 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31738 | case 3: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31739 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31740 | g_value_take_object (value, interface); |
| 31741 | break; |
| 31742 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31743 | case 4: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31744 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31745 | g_value_take_object (value, interface); |
| 31746 | break; |
| 31747 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31748 | case 5: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31749 | 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] | 31750 | g_value_take_object (value, interface); |
| 31751 | break; |
| 31752 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31753 | case 6: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31754 | 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] | 31755 | g_value_take_object (value, interface); |
| 31756 | break; |
| 31757 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31758 | case 7: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31759 | 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] | 31760 | g_value_take_object (value, interface); |
| 31761 | break; |
| 31762 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31763 | case 8: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31764 | 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] | 31765 | g_value_take_object (value, interface); |
| 31766 | break; |
| 31767 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31768 | case 9: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31769 | 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] | 31770 | g_value_take_object (value, interface); |
| 31771 | break; |
| 31772 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31773 | case 10: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31774 | 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] | 31775 | g_value_take_object (value, interface); |
| 31776 | break; |
| 31777 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31778 | case 11: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31779 | 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] | 31780 | g_value_take_object (value, interface); |
| 31781 | break; |
| 31782 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31783 | case 12: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31784 | 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] | 31785 | g_value_take_object (value, interface); |
| 31786 | break; |
| 31787 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31788 | case 13: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31789 | 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] | 31790 | g_value_take_object (value, interface); |
| 31791 | break; |
| 31792 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31793 | case 14: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31794 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 31795 | g_value_take_object (value, interface); |
| 31796 | break; |
| 31797 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31798 | case 15: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31799 | 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] | 31800 | g_value_take_object (value, interface); |
| 31801 | break; |
| 31802 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31803 | case 16: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31804 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31805 | g_value_take_object (value, interface); |
| 31806 | break; |
| 31807 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31808 | case 17: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31809 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31810 | g_value_take_object (value, interface); |
| 31811 | break; |
| 31812 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 31813 | case 18: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31814 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31815 | g_value_take_object (value, interface); |
| 31816 | break; |
| 31817 | |
| 31818 | case 19: |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31819 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 31820 | g_value_take_object (value, interface); |
| 31821 | break; |
| 31822 | |
| 31823 | case 20: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 31824 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 31825 | g_value_take_object (value, interface); |
| 31826 | break; |
| 31827 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31828 | default: |
| 31829 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 31830 | break; |
| 31831 | } |
| 31832 | } |
| 31833 | |
| 31834 | static void |
| 31835 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 31836 | { |
| 31837 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 31838 | |
| 31839 | gobject_class->set_property = object_skeleton_set_property; |
| 31840 | gobject_class->get_property = object_skeleton_get_property; |
| 31841 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31842 | g_object_class_override_property (gobject_class, 1, "object-mapper"); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31843 | g_object_class_override_property (gobject_class, 2, "hwmon"); |
| 31844 | g_object_class_override_property (gobject_class, 3, "fan"); |
| 31845 | g_object_class_override_property (gobject_class, 4, "sensor-value"); |
| 31846 | g_object_class_override_property (gobject_class, 5, "sensor-threshold"); |
| 31847 | g_object_class_override_property (gobject_class, 6, "sensor-i2c"); |
| 31848 | g_object_class_override_property (gobject_class, 7, "sensor-match"); |
| 31849 | g_object_class_override_property (gobject_class, 8, "process"); |
| 31850 | g_object_class_override_property (gobject_class, 9, "shared-resource"); |
| 31851 | g_object_class_override_property (gobject_class, 10, "control"); |
| 31852 | g_object_class_override_property (gobject_class, 11, "control-bmc"); |
| 31853 | g_object_class_override_property (gobject_class, 12, "control-host"); |
| 31854 | g_object_class_override_property (gobject_class, 13, "control-power"); |
| 31855 | g_object_class_override_property (gobject_class, 14, "watchdog"); |
| 31856 | g_object_class_override_property (gobject_class, 15, "event-log"); |
| 31857 | g_object_class_override_property (gobject_class, 16, "flash"); |
| 31858 | g_object_class_override_property (gobject_class, 17, "flash-control"); |
| 31859 | g_object_class_override_property (gobject_class, 18, "button"); |
| 31860 | g_object_class_override_property (gobject_class, 19, "led"); |
| 31861 | g_object_class_override_property (gobject_class, 20, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31862 | } |
| 31863 | |
| 31864 | /** |
| 31865 | * object_skeleton_new: |
| 31866 | * @object_path: An object path. |
| 31867 | * |
| 31868 | * Creates a new skeleton object. |
| 31869 | * |
| 31870 | * Returns: (transfer full): The skeleton object. |
| 31871 | */ |
| 31872 | ObjectSkeleton * |
| 31873 | object_skeleton_new (const gchar *object_path) |
| 31874 | { |
| 31875 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 31876 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 31877 | } |
| 31878 | |
| 31879 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 31880 | * object_skeleton_set_object_mapper: |
| 31881 | * @object: A #ObjectSkeleton. |
| 31882 | * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface. |
| 31883 | * |
| 31884 | * Sets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object. |
| 31885 | */ |
| 31886 | void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_) |
| 31887 | { |
| 31888 | g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL); |
| 31889 | } |
| 31890 | |
| 31891 | /** |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 31892 | * object_skeleton_set_hwmon: |
| 31893 | * @object: A #ObjectSkeleton. |
| 31894 | * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface. |
| 31895 | * |
| 31896 | * Sets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object. |
| 31897 | */ |
| 31898 | void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_) |
| 31899 | { |
| 31900 | g_object_set (G_OBJECT (object), "hwmon", interface_, NULL); |
| 31901 | } |
| 31902 | |
| 31903 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31904 | * object_skeleton_set_fan: |
| 31905 | * @object: A #ObjectSkeleton. |
| 31906 | * @interface_: (allow-none): A #Fan or %NULL to clear the interface. |
| 31907 | * |
| 31908 | * 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. |
| 31909 | */ |
| 31910 | void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_) |
| 31911 | { |
| 31912 | g_object_set (G_OBJECT (object), "fan", interface_, NULL); |
| 31913 | } |
| 31914 | |
| 31915 | /** |
| 31916 | * object_skeleton_set_sensor_value: |
| 31917 | * @object: A #ObjectSkeleton. |
| 31918 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
| 31919 | * |
| 31920 | * 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. |
| 31921 | */ |
| 31922 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
| 31923 | { |
| 31924 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
| 31925 | } |
| 31926 | |
| 31927 | /** |
| 31928 | * object_skeleton_set_sensor_threshold: |
| 31929 | * @object: A #ObjectSkeleton. |
| 31930 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
| 31931 | * |
| 31932 | * 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. |
| 31933 | */ |
| 31934 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
| 31935 | { |
| 31936 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
| 31937 | } |
| 31938 | |
| 31939 | /** |
| 31940 | * object_skeleton_set_sensor_i2c: |
| 31941 | * @object: A #ObjectSkeleton. |
| 31942 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 31943 | * |
| 31944 | * 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. |
| 31945 | */ |
| 31946 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 31947 | { |
| 31948 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 31949 | } |
| 31950 | |
| 31951 | /** |
| 31952 | * object_skeleton_set_sensor_match: |
| 31953 | * @object: A #ObjectSkeleton. |
| 31954 | * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. |
| 31955 | * |
| 31956 | * 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. |
| 31957 | */ |
| 31958 | void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) |
| 31959 | { |
| 31960 | g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); |
| 31961 | } |
| 31962 | |
| 31963 | /** |
| 31964 | * object_skeleton_set_process: |
| 31965 | * @object: A #ObjectSkeleton. |
| 31966 | * @interface_: (allow-none): A #Process or %NULL to clear the interface. |
| 31967 | * |
| 31968 | * 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. |
| 31969 | */ |
| 31970 | void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_) |
| 31971 | { |
| 31972 | g_object_set (G_OBJECT (object), "process", interface_, NULL); |
| 31973 | } |
| 31974 | |
| 31975 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 31976 | * object_skeleton_set_shared_resource: |
| 31977 | * @object: A #ObjectSkeleton. |
| 31978 | * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface. |
| 31979 | * |
| 31980 | * 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. |
| 31981 | */ |
| 31982 | void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_) |
| 31983 | { |
| 31984 | g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL); |
| 31985 | } |
| 31986 | |
| 31987 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 31988 | * object_skeleton_set_control: |
| 31989 | * @object: A #ObjectSkeleton. |
| 31990 | * @interface_: (allow-none): A #Control or %NULL to clear the interface. |
| 31991 | * |
| 31992 | * 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. |
| 31993 | */ |
| 31994 | void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_) |
| 31995 | { |
| 31996 | g_object_set (G_OBJECT (object), "control", interface_, NULL); |
| 31997 | } |
| 31998 | |
| 31999 | /** |
| 32000 | * object_skeleton_set_control_bmc: |
| 32001 | * @object: A #ObjectSkeleton. |
| 32002 | * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface. |
| 32003 | * |
| 32004 | * 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. |
| 32005 | */ |
| 32006 | void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_) |
| 32007 | { |
| 32008 | g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL); |
| 32009 | } |
| 32010 | |
| 32011 | /** |
| 32012 | * object_skeleton_set_control_host: |
| 32013 | * @object: A #ObjectSkeleton. |
| 32014 | * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface. |
| 32015 | * |
| 32016 | * 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. |
| 32017 | */ |
| 32018 | void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_) |
| 32019 | { |
| 32020 | g_object_set (G_OBJECT (object), "control-host", interface_, NULL); |
| 32021 | } |
| 32022 | |
| 32023 | /** |
| 32024 | * object_skeleton_set_control_power: |
| 32025 | * @object: A #ObjectSkeleton. |
| 32026 | * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface. |
| 32027 | * |
| 32028 | * 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. |
| 32029 | */ |
| 32030 | void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_) |
| 32031 | { |
| 32032 | g_object_set (G_OBJECT (object), "control-power", interface_, NULL); |
| 32033 | } |
| 32034 | |
| 32035 | /** |
| 32036 | * object_skeleton_set_watchdog: |
| 32037 | * @object: A #ObjectSkeleton. |
| 32038 | * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. |
| 32039 | * |
| 32040 | * 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. |
| 32041 | */ |
| 32042 | void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) |
| 32043 | { |
| 32044 | g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); |
| 32045 | } |
| 32046 | |
| 32047 | /** |
| 32048 | * object_skeleton_set_event_log: |
| 32049 | * @object: A #ObjectSkeleton. |
| 32050 | * @interface_: (allow-none): A #EventLog or %NULL to clear the interface. |
| 32051 | * |
| 32052 | * 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. |
| 32053 | */ |
| 32054 | void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_) |
| 32055 | { |
| 32056 | g_object_set (G_OBJECT (object), "event-log", interface_, NULL); |
| 32057 | } |
| 32058 | |
| 32059 | /** |
| 32060 | * object_skeleton_set_flash: |
| 32061 | * @object: A #ObjectSkeleton. |
| 32062 | * @interface_: (allow-none): A #Flash or %NULL to clear the interface. |
| 32063 | * |
| 32064 | * 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. |
| 32065 | */ |
| 32066 | void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_) |
| 32067 | { |
| 32068 | g_object_set (G_OBJECT (object), "flash", interface_, NULL); |
| 32069 | } |
| 32070 | |
| 32071 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 32072 | * object_skeleton_set_flash_control: |
| 32073 | * @object: A #ObjectSkeleton. |
| 32074 | * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface. |
| 32075 | * |
| 32076 | * 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. |
| 32077 | */ |
| 32078 | void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_) |
| 32079 | { |
| 32080 | g_object_set (G_OBJECT (object), "flash-control", interface_, NULL); |
| 32081 | } |
| 32082 | |
| 32083 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 32084 | * object_skeleton_set_button: |
| 32085 | * @object: A #ObjectSkeleton. |
| 32086 | * @interface_: (allow-none): A #Button or %NULL to clear the interface. |
| 32087 | * |
| 32088 | * 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. |
| 32089 | */ |
| 32090 | void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_) |
| 32091 | { |
| 32092 | g_object_set (G_OBJECT (object), "button", interface_, NULL); |
| 32093 | } |
| 32094 | |
| 32095 | /** |
| 32096 | * object_skeleton_set_led: |
| 32097 | * @object: A #ObjectSkeleton. |
| 32098 | * @interface_: (allow-none): A #Led or %NULL to clear the interface. |
| 32099 | * |
| 32100 | * 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. |
| 32101 | */ |
| 32102 | void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_) |
| 32103 | { |
| 32104 | g_object_set (G_OBJECT (object), "led", interface_, NULL); |
| 32105 | } |
| 32106 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 32107 | /** |
| 32108 | * object_skeleton_set_host_ipmi: |
| 32109 | * @object: A #ObjectSkeleton. |
| 32110 | * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface. |
| 32111 | * |
| 32112 | * 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. |
| 32113 | */ |
| 32114 | void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_) |
| 32115 | { |
| 32116 | g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL); |
| 32117 | } |
| 32118 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 32119 | |
| 32120 | /* ------------------------------------------------------------------------ |
| 32121 | * Code for ObjectManager client |
| 32122 | * ------------------------------------------------------------------------ |
| 32123 | */ |
| 32124 | |
| 32125 | /** |
| 32126 | * SECTION:ObjectManagerClient |
| 32127 | * @title: ObjectManagerClient |
| 32128 | * @short_description: Generated GDBusObjectManagerClient type |
| 32129 | * |
| 32130 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 32131 | */ |
| 32132 | |
| 32133 | /** |
| 32134 | * ObjectManagerClient: |
| 32135 | * |
| 32136 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 32137 | */ |
| 32138 | |
| 32139 | /** |
| 32140 | * ObjectManagerClientClass: |
| 32141 | * @parent_class: The parent class. |
| 32142 | * |
| 32143 | * Class structure for #ObjectManagerClient. |
| 32144 | */ |
| 32145 | |
| 32146 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 32147 | |
| 32148 | static void |
| 32149 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 32150 | { |
| 32151 | } |
| 32152 | |
| 32153 | static void |
| 32154 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 32155 | { |
| 32156 | } |
| 32157 | |
| 32158 | /** |
| 32159 | * object_manager_client_get_proxy_type: |
| 32160 | * @manager: A #GDBusObjectManagerClient. |
| 32161 | * @object_path: The object path of the remote object (unused). |
| 32162 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 32163 | * @user_data: User data (unused). |
| 32164 | * |
| 32165 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 32166 | * |
| 32167 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 32168 | */ |
| 32169 | GType |
| 32170 | 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) |
| 32171 | { |
| 32172 | static gsize once_init_value = 0; |
| 32173 | static GHashTable *lookup_hash; |
| 32174 | GType ret; |
| 32175 | |
| 32176 | if (interface_name == NULL) |
| 32177 | return TYPE_OBJECT_PROXY; |
| 32178 | if (g_once_init_enter (&once_init_value)) |
| 32179 | { |
| 32180 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 32181 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Object.Mapper", GSIZE_TO_POINTER (TYPE_OBJECT_MAPPER_PROXY)); |
Norman James | 5236a8f | 2015-11-05 20:39:31 -0600 | [diff] [blame] | 32182 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 32183 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY)); |
| 32184 | 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] | 32185 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); |
| 32186 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
| 32187 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); |
| 32188 | 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] | 32189 | 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] | 32190 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY)); |
| 32191 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY)); |
| 32192 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY)); |
| 32193 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY)); |
| 32194 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); |
| 32195 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY)); |
| 32196 | 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] | 32197 | 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] | 32198 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY)); |
| 32199 | 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] | 32200 | 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] | 32201 | g_once_init_leave (&once_init_value, 1); |
| 32202 | } |
| 32203 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 32204 | if (ret == (GType) 0) |
| 32205 | ret = G_TYPE_DBUS_PROXY; |
| 32206 | return ret; |
| 32207 | } |
| 32208 | |
| 32209 | /** |
| 32210 | * object_manager_client_new: |
| 32211 | * @connection: A #GDBusConnection. |
| 32212 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 32213 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 32214 | * @object_path: An object path. |
| 32215 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 32216 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 32217 | * @user_data: User data to pass to @callback. |
| 32218 | * |
| 32219 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 32220 | * |
| 32221 | * 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. |
| 32222 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 32223 | * |
| 32224 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 32225 | */ |
| 32226 | void |
| 32227 | object_manager_client_new ( |
| 32228 | GDBusConnection *connection, |
| 32229 | GDBusObjectManagerClientFlags flags, |
| 32230 | const gchar *name, |
| 32231 | const gchar *object_path, |
| 32232 | GCancellable *cancellable, |
| 32233 | GAsyncReadyCallback callback, |
| 32234 | gpointer user_data) |
| 32235 | { |
| 32236 | 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); |
| 32237 | } |
| 32238 | |
| 32239 | /** |
| 32240 | * object_manager_client_new_finish: |
| 32241 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 32242 | * @error: Return location for error or %NULL |
| 32243 | * |
| 32244 | * Finishes an operation started with object_manager_client_new(). |
| 32245 | * |
| 32246 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 32247 | */ |
| 32248 | GDBusObjectManager * |
| 32249 | object_manager_client_new_finish ( |
| 32250 | GAsyncResult *res, |
| 32251 | GError **error) |
| 32252 | { |
| 32253 | GObject *ret; |
| 32254 | GObject *source_object; |
| 32255 | source_object = g_async_result_get_source_object (res); |
| 32256 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 32257 | g_object_unref (source_object); |
| 32258 | if (ret != NULL) |
| 32259 | return G_DBUS_OBJECT_MANAGER (ret); |
| 32260 | else |
| 32261 | return NULL; |
| 32262 | } |
| 32263 | |
| 32264 | /** |
| 32265 | * object_manager_client_new_sync: |
| 32266 | * @connection: A #GDBusConnection. |
| 32267 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 32268 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 32269 | * @object_path: An object path. |
| 32270 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 32271 | * @error: Return location for error or %NULL |
| 32272 | * |
| 32273 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 32274 | * |
| 32275 | * The calling thread is blocked until a reply is received. |
| 32276 | * |
| 32277 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 32278 | * |
| 32279 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 32280 | */ |
| 32281 | GDBusObjectManager * |
| 32282 | object_manager_client_new_sync ( |
| 32283 | GDBusConnection *connection, |
| 32284 | GDBusObjectManagerClientFlags flags, |
| 32285 | const gchar *name, |
| 32286 | const gchar *object_path, |
| 32287 | GCancellable *cancellable, |
| 32288 | GError **error) |
| 32289 | { |
| 32290 | GInitable *ret; |
| 32291 | 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); |
| 32292 | if (ret != NULL) |
| 32293 | return G_DBUS_OBJECT_MANAGER (ret); |
| 32294 | else |
| 32295 | return NULL; |
| 32296 | } |
| 32297 | |
| 32298 | |
| 32299 | /** |
| 32300 | * object_manager_client_new_for_bus: |
| 32301 | * @bus_type: A #GBusType. |
| 32302 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 32303 | * @name: A bus name (well-known or unique). |
| 32304 | * @object_path: An object path. |
| 32305 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 32306 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 32307 | * @user_data: User data to pass to @callback. |
| 32308 | * |
| 32309 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 32310 | * |
| 32311 | * 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. |
| 32312 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 32313 | * |
| 32314 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 32315 | */ |
| 32316 | void |
| 32317 | object_manager_client_new_for_bus ( |
| 32318 | GBusType bus_type, |
| 32319 | GDBusObjectManagerClientFlags flags, |
| 32320 | const gchar *name, |
| 32321 | const gchar *object_path, |
| 32322 | GCancellable *cancellable, |
| 32323 | GAsyncReadyCallback callback, |
| 32324 | gpointer user_data) |
| 32325 | { |
| 32326 | 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); |
| 32327 | } |
| 32328 | |
| 32329 | /** |
| 32330 | * object_manager_client_new_for_bus_finish: |
| 32331 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 32332 | * @error: Return location for error or %NULL |
| 32333 | * |
| 32334 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 32335 | * |
| 32336 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 32337 | */ |
| 32338 | GDBusObjectManager * |
| 32339 | object_manager_client_new_for_bus_finish ( |
| 32340 | GAsyncResult *res, |
| 32341 | GError **error) |
| 32342 | { |
| 32343 | GObject *ret; |
| 32344 | GObject *source_object; |
| 32345 | source_object = g_async_result_get_source_object (res); |
| 32346 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 32347 | g_object_unref (source_object); |
| 32348 | if (ret != NULL) |
| 32349 | return G_DBUS_OBJECT_MANAGER (ret); |
| 32350 | else |
| 32351 | return NULL; |
| 32352 | } |
| 32353 | |
| 32354 | /** |
| 32355 | * object_manager_client_new_for_bus_sync: |
| 32356 | * @bus_type: A #GBusType. |
| 32357 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 32358 | * @name: A bus name (well-known or unique). |
| 32359 | * @object_path: An object path. |
| 32360 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 32361 | * @error: Return location for error or %NULL |
| 32362 | * |
| 32363 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 32364 | * |
| 32365 | * The calling thread is blocked until a reply is received. |
| 32366 | * |
| 32367 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 32368 | * |
| 32369 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 32370 | */ |
| 32371 | GDBusObjectManager * |
| 32372 | object_manager_client_new_for_bus_sync ( |
| 32373 | GBusType bus_type, |
| 32374 | GDBusObjectManagerClientFlags flags, |
| 32375 | const gchar *name, |
| 32376 | const gchar *object_path, |
| 32377 | GCancellable *cancellable, |
| 32378 | GError **error) |
| 32379 | { |
| 32380 | GInitable *ret; |
| 32381 | 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); |
| 32382 | if (ret != NULL) |
| 32383 | return G_DBUS_OBJECT_MANAGER (ret); |
| 32384 | else |
| 32385 | return NULL; |
| 32386 | } |
| 32387 | |
| 32388 | |