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 | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 974 | * Code for interface org.openbmc.Fan |
| 975 | * ------------------------------------------------------------------------ |
| 976 | */ |
| 977 | |
| 978 | /** |
| 979 | * SECTION:Fan |
| 980 | * @title: Fan |
| 981 | * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface |
| 982 | * |
| 983 | * 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. |
| 984 | */ |
| 985 | |
| 986 | /* ---- Introspection data for org.openbmc.Fan ---- */ |
| 987 | |
| 988 | static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone = |
| 989 | { |
| 990 | { |
| 991 | -1, |
| 992 | (gchar *) "cooling_zone", |
| 993 | (gchar *) "i", |
| 994 | NULL |
| 995 | }, |
| 996 | FALSE |
| 997 | }; |
| 998 | |
| 999 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] = |
| 1000 | { |
| 1001 | &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone, |
| 1002 | NULL |
| 1003 | }; |
| 1004 | |
| 1005 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone = |
| 1006 | { |
| 1007 | { |
| 1008 | -1, |
| 1009 | (gchar *) "setCoolingZone", |
| 1010 | (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers, |
| 1011 | NULL, |
| 1012 | NULL |
| 1013 | }, |
| 1014 | "handle-set-cooling-zone", |
| 1015 | FALSE |
| 1016 | }; |
| 1017 | |
| 1018 | static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed = |
| 1019 | { |
| 1020 | { |
| 1021 | -1, |
| 1022 | (gchar *) "speed", |
| 1023 | (gchar *) "i", |
| 1024 | NULL |
| 1025 | }, |
| 1026 | FALSE |
| 1027 | }; |
| 1028 | |
| 1029 | static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] = |
| 1030 | { |
| 1031 | &_fan_method_info_get_speed_OUT_ARG_speed, |
| 1032 | NULL |
| 1033 | }; |
| 1034 | |
| 1035 | static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed = |
| 1036 | { |
| 1037 | { |
| 1038 | -1, |
| 1039 | (gchar *) "getSpeed", |
| 1040 | NULL, |
| 1041 | (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers, |
| 1042 | NULL |
| 1043 | }, |
| 1044 | "handle-get-speed", |
| 1045 | FALSE |
| 1046 | }; |
| 1047 | |
| 1048 | static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed = |
| 1049 | { |
| 1050 | { |
| 1051 | -1, |
| 1052 | (gchar *) "speed", |
| 1053 | (gchar *) "i", |
| 1054 | NULL |
| 1055 | }, |
| 1056 | FALSE |
| 1057 | }; |
| 1058 | |
| 1059 | static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] = |
| 1060 | { |
| 1061 | &_fan_method_info_set_speed_IN_ARG_speed, |
| 1062 | NULL |
| 1063 | }; |
| 1064 | |
| 1065 | static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed = |
| 1066 | { |
| 1067 | { |
| 1068 | -1, |
| 1069 | (gchar *) "setSpeed", |
| 1070 | (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers, |
| 1071 | NULL, |
| 1072 | NULL |
| 1073 | }, |
| 1074 | "handle-set-speed", |
| 1075 | FALSE |
| 1076 | }; |
| 1077 | |
| 1078 | static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] = |
| 1079 | { |
| 1080 | &_fan_method_info_set_cooling_zone, |
| 1081 | &_fan_method_info_get_speed, |
| 1082 | &_fan_method_info_set_speed, |
| 1083 | NULL |
| 1084 | }; |
| 1085 | |
| 1086 | static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed = |
| 1087 | { |
| 1088 | { |
| 1089 | -1, |
| 1090 | (gchar *) "speed", |
| 1091 | (gchar *) "i", |
| 1092 | NULL |
| 1093 | }, |
| 1094 | FALSE |
| 1095 | }; |
| 1096 | |
| 1097 | static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] = |
| 1098 | { |
| 1099 | &_fan_signal_info_speed_changed_ARG_speed, |
| 1100 | NULL |
| 1101 | }; |
| 1102 | |
| 1103 | static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed = |
| 1104 | { |
| 1105 | { |
| 1106 | -1, |
| 1107 | (gchar *) "SpeedChanged", |
| 1108 | (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers, |
| 1109 | NULL |
| 1110 | }, |
| 1111 | "speed-changed" |
| 1112 | }; |
| 1113 | |
| 1114 | static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error = |
| 1115 | { |
| 1116 | { |
| 1117 | -1, |
| 1118 | (gchar *) "TachError", |
| 1119 | NULL, |
| 1120 | NULL |
| 1121 | }, |
| 1122 | "tach-error" |
| 1123 | }; |
| 1124 | |
| 1125 | static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] = |
| 1126 | { |
| 1127 | &_fan_signal_info_speed_changed, |
| 1128 | &_fan_signal_info_tach_error, |
| 1129 | NULL |
| 1130 | }; |
| 1131 | |
| 1132 | static const _ExtendedGDBusPropertyInfo _fan_property_info_speed = |
| 1133 | { |
| 1134 | { |
| 1135 | -1, |
| 1136 | (gchar *) "speed", |
| 1137 | (gchar *) "i", |
| 1138 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1139 | NULL |
| 1140 | }, |
| 1141 | "speed", |
| 1142 | FALSE |
| 1143 | }; |
| 1144 | |
| 1145 | static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone = |
| 1146 | { |
| 1147 | { |
| 1148 | -1, |
| 1149 | (gchar *) "cooling_zone", |
| 1150 | (gchar *) "i", |
| 1151 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1152 | NULL |
| 1153 | }, |
| 1154 | "cooling-zone", |
| 1155 | FALSE |
| 1156 | }; |
| 1157 | |
| 1158 | static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num = |
| 1159 | { |
| 1160 | { |
| 1161 | -1, |
| 1162 | (gchar *) "pwm_num", |
| 1163 | (gchar *) "i", |
| 1164 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 1165 | NULL |
| 1166 | }, |
| 1167 | "pwm-num", |
| 1168 | FALSE |
| 1169 | }; |
| 1170 | |
| 1171 | static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] = |
| 1172 | { |
| 1173 | &_fan_property_info_speed, |
| 1174 | &_fan_property_info_cooling_zone, |
| 1175 | &_fan_property_info_pwm_num, |
| 1176 | NULL |
| 1177 | }; |
| 1178 | |
| 1179 | static const _ExtendedGDBusInterfaceInfo _fan_interface_info = |
| 1180 | { |
| 1181 | { |
| 1182 | -1, |
| 1183 | (gchar *) "org.openbmc.Fan", |
| 1184 | (GDBusMethodInfo **) &_fan_method_info_pointers, |
| 1185 | (GDBusSignalInfo **) &_fan_signal_info_pointers, |
| 1186 | (GDBusPropertyInfo **) &_fan_property_info_pointers, |
| 1187 | NULL |
| 1188 | }, |
| 1189 | "fan", |
| 1190 | }; |
| 1191 | |
| 1192 | |
| 1193 | /** |
| 1194 | * fan_interface_info: |
| 1195 | * |
| 1196 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface. |
| 1197 | * |
| 1198 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 1199 | */ |
| 1200 | GDBusInterfaceInfo * |
| 1201 | fan_interface_info (void) |
| 1202 | { |
| 1203 | return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct; |
| 1204 | } |
| 1205 | |
| 1206 | /** |
| 1207 | * fan_override_properties: |
| 1208 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 1209 | * @property_id_begin: The property id to assign to the first overridden property. |
| 1210 | * |
| 1211 | * Overrides all #GObject properties in the #Fan interface for a concrete class. |
| 1212 | * The properties are overridden in the order they are defined. |
| 1213 | * |
| 1214 | * Returns: The last property id. |
| 1215 | */ |
| 1216 | guint |
| 1217 | fan_override_properties (GObjectClass *klass, guint property_id_begin) |
| 1218 | { |
| 1219 | g_object_class_override_property (klass, property_id_begin++, "speed"); |
| 1220 | g_object_class_override_property (klass, property_id_begin++, "cooling-zone"); |
| 1221 | g_object_class_override_property (klass, property_id_begin++, "pwm-num"); |
| 1222 | return property_id_begin - 1; |
| 1223 | } |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | /** |
| 1228 | * Fan: |
| 1229 | * |
| 1230 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 1231 | */ |
| 1232 | |
| 1233 | /** |
| 1234 | * FanIface: |
| 1235 | * @parent_iface: The parent interface. |
| 1236 | * @handle_get_speed: Handler for the #Fan::handle-get-speed signal. |
| 1237 | * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal. |
| 1238 | * @handle_set_speed: Handler for the #Fan::handle-set-speed signal. |
| 1239 | * @get_cooling_zone: Getter for the #Fan:cooling-zone property. |
| 1240 | * @get_pwm_num: Getter for the #Fan:pwm-num property. |
| 1241 | * @get_speed: Getter for the #Fan:speed property. |
| 1242 | * @speed_changed: Handler for the #Fan::speed-changed signal. |
| 1243 | * @tach_error: Handler for the #Fan::tach-error signal. |
| 1244 | * |
| 1245 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 1246 | */ |
| 1247 | |
| 1248 | typedef FanIface FanInterface; |
| 1249 | G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT); |
| 1250 | |
| 1251 | static void |
| 1252 | fan_default_init (FanIface *iface) |
| 1253 | { |
| 1254 | /* GObject signals for incoming D-Bus method calls: */ |
| 1255 | /** |
| 1256 | * Fan::handle-set-cooling-zone: |
| 1257 | * @object: A #Fan. |
| 1258 | * @invocation: A #GDBusMethodInvocation. |
| 1259 | * @arg_cooling_zone: Argument passed by remote caller. |
| 1260 | * |
| 1261 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. |
| 1262 | * |
| 1263 | * 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. |
| 1264 | * |
| 1265 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1266 | */ |
| 1267 | g_signal_new ("handle-set-cooling-zone", |
| 1268 | G_TYPE_FROM_INTERFACE (iface), |
| 1269 | G_SIGNAL_RUN_LAST, |
| 1270 | G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone), |
| 1271 | g_signal_accumulator_true_handled, |
| 1272 | NULL, |
| 1273 | g_cclosure_marshal_generic, |
| 1274 | G_TYPE_BOOLEAN, |
| 1275 | 2, |
| 1276 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 1277 | |
| 1278 | /** |
| 1279 | * Fan::handle-get-speed: |
| 1280 | * @object: A #Fan. |
| 1281 | * @invocation: A #GDBusMethodInvocation. |
| 1282 | * |
| 1283 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. |
| 1284 | * |
| 1285 | * 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. |
| 1286 | * |
| 1287 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1288 | */ |
| 1289 | g_signal_new ("handle-get-speed", |
| 1290 | G_TYPE_FROM_INTERFACE (iface), |
| 1291 | G_SIGNAL_RUN_LAST, |
| 1292 | G_STRUCT_OFFSET (FanIface, handle_get_speed), |
| 1293 | g_signal_accumulator_true_handled, |
| 1294 | NULL, |
| 1295 | g_cclosure_marshal_generic, |
| 1296 | G_TYPE_BOOLEAN, |
| 1297 | 1, |
| 1298 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 1299 | |
| 1300 | /** |
| 1301 | * Fan::handle-set-speed: |
| 1302 | * @object: A #Fan. |
| 1303 | * @invocation: A #GDBusMethodInvocation. |
| 1304 | * @arg_speed: Argument passed by remote caller. |
| 1305 | * |
| 1306 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. |
| 1307 | * |
| 1308 | * 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. |
| 1309 | * |
| 1310 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 1311 | */ |
| 1312 | g_signal_new ("handle-set-speed", |
| 1313 | G_TYPE_FROM_INTERFACE (iface), |
| 1314 | G_SIGNAL_RUN_LAST, |
| 1315 | G_STRUCT_OFFSET (FanIface, handle_set_speed), |
| 1316 | g_signal_accumulator_true_handled, |
| 1317 | NULL, |
| 1318 | g_cclosure_marshal_generic, |
| 1319 | G_TYPE_BOOLEAN, |
| 1320 | 2, |
| 1321 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 1322 | |
| 1323 | /* GObject signals for received D-Bus signals: */ |
| 1324 | /** |
| 1325 | * Fan::speed-changed: |
| 1326 | * @object: A #Fan. |
| 1327 | * @arg_speed: Argument. |
| 1328 | * |
| 1329 | * 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. |
| 1330 | * |
| 1331 | * 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. |
| 1332 | */ |
| 1333 | g_signal_new ("speed-changed", |
| 1334 | G_TYPE_FROM_INTERFACE (iface), |
| 1335 | G_SIGNAL_RUN_LAST, |
| 1336 | G_STRUCT_OFFSET (FanIface, speed_changed), |
| 1337 | NULL, |
| 1338 | NULL, |
| 1339 | g_cclosure_marshal_generic, |
| 1340 | G_TYPE_NONE, |
| 1341 | 1, G_TYPE_INT); |
| 1342 | |
| 1343 | /** |
| 1344 | * Fan::tach-error: |
| 1345 | * @object: A #Fan. |
| 1346 | * |
| 1347 | * 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. |
| 1348 | * |
| 1349 | * 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. |
| 1350 | */ |
| 1351 | g_signal_new ("tach-error", |
| 1352 | G_TYPE_FROM_INTERFACE (iface), |
| 1353 | G_SIGNAL_RUN_LAST, |
| 1354 | G_STRUCT_OFFSET (FanIface, tach_error), |
| 1355 | NULL, |
| 1356 | NULL, |
| 1357 | g_cclosure_marshal_generic, |
| 1358 | G_TYPE_NONE, |
| 1359 | 0); |
| 1360 | |
| 1361 | /* GObject properties for D-Bus properties: */ |
| 1362 | /** |
| 1363 | * Fan:speed: |
| 1364 | * |
| 1365 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>. |
| 1366 | * |
| 1367 | * 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. |
| 1368 | */ |
| 1369 | g_object_interface_install_property (iface, |
| 1370 | g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1371 | /** |
| 1372 | * Fan:cooling-zone: |
| 1373 | * |
| 1374 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>. |
| 1375 | * |
| 1376 | * 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. |
| 1377 | */ |
| 1378 | g_object_interface_install_property (iface, |
| 1379 | g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1380 | /** |
| 1381 | * Fan:pwm-num: |
| 1382 | * |
| 1383 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>. |
| 1384 | * |
| 1385 | * 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. |
| 1386 | */ |
| 1387 | g_object_interface_install_property (iface, |
| 1388 | g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 1389 | } |
| 1390 | |
| 1391 | /** |
| 1392 | * fan_get_speed: (skip) |
| 1393 | * @object: A #Fan. |
| 1394 | * |
| 1395 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property. |
| 1396 | * |
| 1397 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1398 | * |
| 1399 | * Returns: The property value. |
| 1400 | */ |
| 1401 | gint |
| 1402 | fan_get_speed (Fan *object) |
| 1403 | { |
| 1404 | return FAN_GET_IFACE (object)->get_speed (object); |
| 1405 | } |
| 1406 | |
| 1407 | /** |
| 1408 | * fan_set_speed: (skip) |
| 1409 | * @object: A #Fan. |
| 1410 | * @value: The value to set. |
| 1411 | * |
| 1412 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value. |
| 1413 | * |
| 1414 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1415 | */ |
| 1416 | void |
| 1417 | fan_set_speed (Fan *object, gint value) |
| 1418 | { |
| 1419 | g_object_set (G_OBJECT (object), "speed", value, NULL); |
| 1420 | } |
| 1421 | |
| 1422 | /** |
| 1423 | * fan_get_cooling_zone: (skip) |
| 1424 | * @object: A #Fan. |
| 1425 | * |
| 1426 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property. |
| 1427 | * |
| 1428 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1429 | * |
| 1430 | * Returns: The property value. |
| 1431 | */ |
| 1432 | gint |
| 1433 | fan_get_cooling_zone (Fan *object) |
| 1434 | { |
| 1435 | return FAN_GET_IFACE (object)->get_cooling_zone (object); |
| 1436 | } |
| 1437 | |
| 1438 | /** |
| 1439 | * fan_set_cooling_zone: (skip) |
| 1440 | * @object: A #Fan. |
| 1441 | * @value: The value to set. |
| 1442 | * |
| 1443 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value. |
| 1444 | * |
| 1445 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1446 | */ |
| 1447 | void |
| 1448 | fan_set_cooling_zone (Fan *object, gint value) |
| 1449 | { |
| 1450 | g_object_set (G_OBJECT (object), "cooling-zone", value, NULL); |
| 1451 | } |
| 1452 | |
| 1453 | /** |
| 1454 | * fan_get_pwm_num: (skip) |
| 1455 | * @object: A #Fan. |
| 1456 | * |
| 1457 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property. |
| 1458 | * |
| 1459 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1460 | * |
| 1461 | * Returns: The property value. |
| 1462 | */ |
| 1463 | gint |
| 1464 | fan_get_pwm_num (Fan *object) |
| 1465 | { |
| 1466 | return FAN_GET_IFACE (object)->get_pwm_num (object); |
| 1467 | } |
| 1468 | |
| 1469 | /** |
| 1470 | * fan_set_pwm_num: (skip) |
| 1471 | * @object: A #Fan. |
| 1472 | * @value: The value to set. |
| 1473 | * |
| 1474 | * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value. |
| 1475 | * |
| 1476 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 1477 | */ |
| 1478 | void |
| 1479 | fan_set_pwm_num (Fan *object, gint value) |
| 1480 | { |
| 1481 | g_object_set (G_OBJECT (object), "pwm-num", value, NULL); |
| 1482 | } |
| 1483 | |
| 1484 | /** |
| 1485 | * fan_emit_speed_changed: |
| 1486 | * @object: A #Fan. |
| 1487 | * @arg_speed: Argument to pass with the signal. |
| 1488 | * |
| 1489 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal. |
| 1490 | */ |
| 1491 | void |
| 1492 | fan_emit_speed_changed ( |
| 1493 | Fan *object, |
| 1494 | gint arg_speed) |
| 1495 | { |
| 1496 | g_signal_emit_by_name (object, "speed-changed", arg_speed); |
| 1497 | } |
| 1498 | |
| 1499 | /** |
| 1500 | * fan_emit_tach_error: |
| 1501 | * @object: A #Fan. |
| 1502 | * |
| 1503 | * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal. |
| 1504 | */ |
| 1505 | void |
| 1506 | fan_emit_tach_error ( |
| 1507 | Fan *object) |
| 1508 | { |
| 1509 | g_signal_emit_by_name (object, "tach-error"); |
| 1510 | } |
| 1511 | |
| 1512 | /** |
| 1513 | * fan_call_set_cooling_zone: |
| 1514 | * @proxy: A #FanProxy. |
| 1515 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 1516 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1517 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1518 | * @user_data: User data to pass to @callback. |
| 1519 | * |
| 1520 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. |
| 1521 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1522 | * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation. |
| 1523 | * |
| 1524 | * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method. |
| 1525 | */ |
| 1526 | void |
| 1527 | fan_call_set_cooling_zone ( |
| 1528 | Fan *proxy, |
| 1529 | gint arg_cooling_zone, |
| 1530 | GCancellable *cancellable, |
| 1531 | GAsyncReadyCallback callback, |
| 1532 | gpointer user_data) |
| 1533 | { |
| 1534 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1535 | "setCoolingZone", |
| 1536 | g_variant_new ("(i)", |
| 1537 | arg_cooling_zone), |
| 1538 | G_DBUS_CALL_FLAGS_NONE, |
| 1539 | -1, |
| 1540 | cancellable, |
| 1541 | callback, |
| 1542 | user_data); |
| 1543 | } |
| 1544 | |
| 1545 | /** |
| 1546 | * fan_call_set_cooling_zone_finish: |
| 1547 | * @proxy: A #FanProxy. |
| 1548 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone(). |
| 1549 | * @error: Return location for error or %NULL. |
| 1550 | * |
| 1551 | * Finishes an operation started with fan_call_set_cooling_zone(). |
| 1552 | * |
| 1553 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1554 | */ |
| 1555 | gboolean |
| 1556 | fan_call_set_cooling_zone_finish ( |
| 1557 | Fan *proxy, |
| 1558 | GAsyncResult *res, |
| 1559 | GError **error) |
| 1560 | { |
| 1561 | GVariant *_ret; |
| 1562 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1563 | if (_ret == NULL) |
| 1564 | goto _out; |
| 1565 | g_variant_get (_ret, |
| 1566 | "()"); |
| 1567 | g_variant_unref (_ret); |
| 1568 | _out: |
| 1569 | return _ret != NULL; |
| 1570 | } |
| 1571 | |
| 1572 | /** |
| 1573 | * fan_call_set_cooling_zone_sync: |
| 1574 | * @proxy: A #FanProxy. |
| 1575 | * @arg_cooling_zone: Argument to pass with the method invocation. |
| 1576 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1577 | * @error: Return location for error or %NULL. |
| 1578 | * |
| 1579 | * 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. |
| 1580 | * |
| 1581 | * See fan_call_set_cooling_zone() for the asynchronous version of this method. |
| 1582 | * |
| 1583 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1584 | */ |
| 1585 | gboolean |
| 1586 | fan_call_set_cooling_zone_sync ( |
| 1587 | Fan *proxy, |
| 1588 | gint arg_cooling_zone, |
| 1589 | GCancellable *cancellable, |
| 1590 | GError **error) |
| 1591 | { |
| 1592 | GVariant *_ret; |
| 1593 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1594 | "setCoolingZone", |
| 1595 | g_variant_new ("(i)", |
| 1596 | arg_cooling_zone), |
| 1597 | G_DBUS_CALL_FLAGS_NONE, |
| 1598 | -1, |
| 1599 | cancellable, |
| 1600 | error); |
| 1601 | if (_ret == NULL) |
| 1602 | goto _out; |
| 1603 | g_variant_get (_ret, |
| 1604 | "()"); |
| 1605 | g_variant_unref (_ret); |
| 1606 | _out: |
| 1607 | return _ret != NULL; |
| 1608 | } |
| 1609 | |
| 1610 | /** |
| 1611 | * fan_call_get_speed: |
| 1612 | * @proxy: A #FanProxy. |
| 1613 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1614 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1615 | * @user_data: User data to pass to @callback. |
| 1616 | * |
| 1617 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. |
| 1618 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1619 | * You can then call fan_call_get_speed_finish() to get the result of the operation. |
| 1620 | * |
| 1621 | * See fan_call_get_speed_sync() for the synchronous, blocking version of this method. |
| 1622 | */ |
| 1623 | void |
| 1624 | fan_call_get_speed ( |
| 1625 | Fan *proxy, |
| 1626 | GCancellable *cancellable, |
| 1627 | GAsyncReadyCallback callback, |
| 1628 | gpointer user_data) |
| 1629 | { |
| 1630 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1631 | "getSpeed", |
| 1632 | g_variant_new ("()"), |
| 1633 | G_DBUS_CALL_FLAGS_NONE, |
| 1634 | -1, |
| 1635 | cancellable, |
| 1636 | callback, |
| 1637 | user_data); |
| 1638 | } |
| 1639 | |
| 1640 | /** |
| 1641 | * fan_call_get_speed_finish: |
| 1642 | * @proxy: A #FanProxy. |
| 1643 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 1644 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed(). |
| 1645 | * @error: Return location for error or %NULL. |
| 1646 | * |
| 1647 | * Finishes an operation started with fan_call_get_speed(). |
| 1648 | * |
| 1649 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1650 | */ |
| 1651 | gboolean |
| 1652 | fan_call_get_speed_finish ( |
| 1653 | Fan *proxy, |
| 1654 | gint *out_speed, |
| 1655 | GAsyncResult *res, |
| 1656 | GError **error) |
| 1657 | { |
| 1658 | GVariant *_ret; |
| 1659 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1660 | if (_ret == NULL) |
| 1661 | goto _out; |
| 1662 | g_variant_get (_ret, |
| 1663 | "(i)", |
| 1664 | out_speed); |
| 1665 | g_variant_unref (_ret); |
| 1666 | _out: |
| 1667 | return _ret != NULL; |
| 1668 | } |
| 1669 | |
| 1670 | /** |
| 1671 | * fan_call_get_speed_sync: |
| 1672 | * @proxy: A #FanProxy. |
| 1673 | * @out_speed: (out): Return location for return parameter or %NULL to ignore. |
| 1674 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1675 | * @error: Return location for error or %NULL. |
| 1676 | * |
| 1677 | * 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. |
| 1678 | * |
| 1679 | * See fan_call_get_speed() for the asynchronous version of this method. |
| 1680 | * |
| 1681 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1682 | */ |
| 1683 | gboolean |
| 1684 | fan_call_get_speed_sync ( |
| 1685 | Fan *proxy, |
| 1686 | gint *out_speed, |
| 1687 | GCancellable *cancellable, |
| 1688 | GError **error) |
| 1689 | { |
| 1690 | GVariant *_ret; |
| 1691 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1692 | "getSpeed", |
| 1693 | g_variant_new ("()"), |
| 1694 | G_DBUS_CALL_FLAGS_NONE, |
| 1695 | -1, |
| 1696 | cancellable, |
| 1697 | error); |
| 1698 | if (_ret == NULL) |
| 1699 | goto _out; |
| 1700 | g_variant_get (_ret, |
| 1701 | "(i)", |
| 1702 | out_speed); |
| 1703 | g_variant_unref (_ret); |
| 1704 | _out: |
| 1705 | return _ret != NULL; |
| 1706 | } |
| 1707 | |
| 1708 | /** |
| 1709 | * fan_call_set_speed: |
| 1710 | * @proxy: A #FanProxy. |
| 1711 | * @arg_speed: Argument to pass with the method invocation. |
| 1712 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1713 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1714 | * @user_data: User data to pass to @callback. |
| 1715 | * |
| 1716 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. |
| 1717 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1718 | * You can then call fan_call_set_speed_finish() to get the result of the operation. |
| 1719 | * |
| 1720 | * See fan_call_set_speed_sync() for the synchronous, blocking version of this method. |
| 1721 | */ |
| 1722 | void |
| 1723 | fan_call_set_speed ( |
| 1724 | Fan *proxy, |
| 1725 | gint arg_speed, |
| 1726 | GCancellable *cancellable, |
| 1727 | GAsyncReadyCallback callback, |
| 1728 | gpointer user_data) |
| 1729 | { |
| 1730 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1731 | "setSpeed", |
| 1732 | g_variant_new ("(i)", |
| 1733 | arg_speed), |
| 1734 | G_DBUS_CALL_FLAGS_NONE, |
| 1735 | -1, |
| 1736 | cancellable, |
| 1737 | callback, |
| 1738 | user_data); |
| 1739 | } |
| 1740 | |
| 1741 | /** |
| 1742 | * fan_call_set_speed_finish: |
| 1743 | * @proxy: A #FanProxy. |
| 1744 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed(). |
| 1745 | * @error: Return location for error or %NULL. |
| 1746 | * |
| 1747 | * Finishes an operation started with fan_call_set_speed(). |
| 1748 | * |
| 1749 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1750 | */ |
| 1751 | gboolean |
| 1752 | fan_call_set_speed_finish ( |
| 1753 | Fan *proxy, |
| 1754 | GAsyncResult *res, |
| 1755 | GError **error) |
| 1756 | { |
| 1757 | GVariant *_ret; |
| 1758 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1759 | if (_ret == NULL) |
| 1760 | goto _out; |
| 1761 | g_variant_get (_ret, |
| 1762 | "()"); |
| 1763 | g_variant_unref (_ret); |
| 1764 | _out: |
| 1765 | return _ret != NULL; |
| 1766 | } |
| 1767 | |
| 1768 | /** |
| 1769 | * fan_call_set_speed_sync: |
| 1770 | * @proxy: A #FanProxy. |
| 1771 | * @arg_speed: Argument to pass with the method invocation. |
| 1772 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1773 | * @error: Return location for error or %NULL. |
| 1774 | * |
| 1775 | * 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. |
| 1776 | * |
| 1777 | * See fan_call_set_speed() for the asynchronous version of this method. |
| 1778 | * |
| 1779 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1780 | */ |
| 1781 | gboolean |
| 1782 | fan_call_set_speed_sync ( |
| 1783 | Fan *proxy, |
| 1784 | gint arg_speed, |
| 1785 | GCancellable *cancellable, |
| 1786 | GError **error) |
| 1787 | { |
| 1788 | GVariant *_ret; |
| 1789 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1790 | "setSpeed", |
| 1791 | g_variant_new ("(i)", |
| 1792 | arg_speed), |
| 1793 | G_DBUS_CALL_FLAGS_NONE, |
| 1794 | -1, |
| 1795 | cancellable, |
| 1796 | error); |
| 1797 | if (_ret == NULL) |
| 1798 | goto _out; |
| 1799 | g_variant_get (_ret, |
| 1800 | "()"); |
| 1801 | g_variant_unref (_ret); |
| 1802 | _out: |
| 1803 | return _ret != NULL; |
| 1804 | } |
| 1805 | |
| 1806 | /** |
| 1807 | * fan_complete_set_cooling_zone: |
| 1808 | * @object: A #Fan. |
| 1809 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1810 | * |
| 1811 | * 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. |
| 1812 | * |
| 1813 | * This method will free @invocation, you cannot use it afterwards. |
| 1814 | */ |
| 1815 | void |
| 1816 | fan_complete_set_cooling_zone ( |
| 1817 | Fan *object, |
| 1818 | GDBusMethodInvocation *invocation) |
| 1819 | { |
| 1820 | g_dbus_method_invocation_return_value (invocation, |
| 1821 | g_variant_new ("()")); |
| 1822 | } |
| 1823 | |
| 1824 | /** |
| 1825 | * fan_complete_get_speed: |
| 1826 | * @object: A #Fan. |
| 1827 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1828 | * @speed: Parameter to return. |
| 1829 | * |
| 1830 | * 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. |
| 1831 | * |
| 1832 | * This method will free @invocation, you cannot use it afterwards. |
| 1833 | */ |
| 1834 | void |
| 1835 | fan_complete_get_speed ( |
| 1836 | Fan *object, |
| 1837 | GDBusMethodInvocation *invocation, |
| 1838 | gint speed) |
| 1839 | { |
| 1840 | g_dbus_method_invocation_return_value (invocation, |
| 1841 | g_variant_new ("(i)", |
| 1842 | speed)); |
| 1843 | } |
| 1844 | |
| 1845 | /** |
| 1846 | * fan_complete_set_speed: |
| 1847 | * @object: A #Fan. |
| 1848 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1849 | * |
| 1850 | * 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. |
| 1851 | * |
| 1852 | * This method will free @invocation, you cannot use it afterwards. |
| 1853 | */ |
| 1854 | void |
| 1855 | fan_complete_set_speed ( |
| 1856 | Fan *object, |
| 1857 | GDBusMethodInvocation *invocation) |
| 1858 | { |
| 1859 | g_dbus_method_invocation_return_value (invocation, |
| 1860 | g_variant_new ("()")); |
| 1861 | } |
| 1862 | |
| 1863 | /* ------------------------------------------------------------------------ */ |
| 1864 | |
| 1865 | /** |
| 1866 | * FanProxy: |
| 1867 | * |
| 1868 | * The #FanProxy structure contains only private data and should only be accessed using the provided API. |
| 1869 | */ |
| 1870 | |
| 1871 | /** |
| 1872 | * FanProxyClass: |
| 1873 | * @parent_class: The parent class. |
| 1874 | * |
| 1875 | * Class structure for #FanProxy. |
| 1876 | */ |
| 1877 | |
| 1878 | struct _FanProxyPrivate |
| 1879 | { |
| 1880 | GData *qdata; |
| 1881 | }; |
| 1882 | |
| 1883 | static void fan_proxy_iface_init (FanIface *iface); |
| 1884 | |
| 1885 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1886 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 1887 | G_ADD_PRIVATE (FanProxy) |
| 1888 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 1889 | |
| 1890 | #else |
| 1891 | G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, |
| 1892 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); |
| 1893 | |
| 1894 | #endif |
| 1895 | static void |
| 1896 | fan_proxy_finalize (GObject *object) |
| 1897 | { |
| 1898 | FanProxy *proxy = FAN_PROXY (object); |
| 1899 | g_datalist_clear (&proxy->priv->qdata); |
| 1900 | G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object); |
| 1901 | } |
| 1902 | |
| 1903 | static void |
| 1904 | fan_proxy_get_property (GObject *object, |
| 1905 | guint prop_id, |
| 1906 | GValue *value, |
| 1907 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1908 | { |
| 1909 | const _ExtendedGDBusPropertyInfo *info; |
| 1910 | GVariant *variant; |
| 1911 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1912 | info = _fan_property_info_pointers[prop_id - 1]; |
| 1913 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1914 | if (info->use_gvariant) |
| 1915 | { |
| 1916 | g_value_set_variant (value, variant); |
| 1917 | } |
| 1918 | else |
| 1919 | { |
| 1920 | if (variant != NULL) |
| 1921 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1922 | } |
| 1923 | if (variant != NULL) |
| 1924 | g_variant_unref (variant); |
| 1925 | } |
| 1926 | |
| 1927 | static void |
| 1928 | fan_proxy_set_property_cb (GDBusProxy *proxy, |
| 1929 | GAsyncResult *res, |
| 1930 | gpointer user_data) |
| 1931 | { |
| 1932 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1933 | GError *error; |
| 1934 | GVariant *_ret; |
| 1935 | error = NULL; |
| 1936 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1937 | if (!_ret) |
| 1938 | { |
| 1939 | g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)", |
| 1940 | info->parent_struct.name, |
| 1941 | error->message, g_quark_to_string (error->domain), error->code); |
| 1942 | g_error_free (error); |
| 1943 | } |
| 1944 | else |
| 1945 | { |
| 1946 | g_variant_unref (_ret); |
| 1947 | } |
| 1948 | } |
| 1949 | |
| 1950 | static void |
| 1951 | fan_proxy_set_property (GObject *object, |
| 1952 | guint prop_id, |
| 1953 | const GValue *value, |
| 1954 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1955 | { |
| 1956 | const _ExtendedGDBusPropertyInfo *info; |
| 1957 | GVariant *variant; |
| 1958 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 1959 | info = _fan_property_info_pointers[prop_id - 1]; |
| 1960 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1961 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1962 | "org.freedesktop.DBus.Properties.Set", |
| 1963 | g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant), |
| 1964 | G_DBUS_CALL_FLAGS_NONE, |
| 1965 | -1, |
| 1966 | NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 1967 | g_variant_unref (variant); |
| 1968 | } |
| 1969 | |
| 1970 | static void |
| 1971 | fan_proxy_g_signal (GDBusProxy *proxy, |
| 1972 | const gchar *sender_name G_GNUC_UNUSED, |
| 1973 | const gchar *signal_name, |
| 1974 | GVariant *parameters) |
| 1975 | { |
| 1976 | _ExtendedGDBusSignalInfo *info; |
| 1977 | GVariantIter iter; |
| 1978 | GVariant *child; |
| 1979 | GValue *paramv; |
| 1980 | guint num_params; |
| 1981 | guint n; |
| 1982 | guint signal_id; |
| 1983 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name); |
| 1984 | if (info == NULL) |
| 1985 | return; |
| 1986 | num_params = g_variant_n_children (parameters); |
| 1987 | paramv = g_new0 (GValue, num_params + 1); |
| 1988 | g_value_init (¶mv[0], TYPE_FAN); |
| 1989 | g_value_set_object (¶mv[0], proxy); |
| 1990 | g_variant_iter_init (&iter, parameters); |
| 1991 | n = 1; |
| 1992 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1993 | { |
| 1994 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1995 | if (arg_info->use_gvariant) |
| 1996 | { |
| 1997 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1998 | g_value_set_variant (¶mv[n], child); |
| 1999 | n++; |
| 2000 | } |
| 2001 | else |
| 2002 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2003 | g_variant_unref (child); |
| 2004 | } |
| 2005 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 2006 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 2007 | for (n = 0; n < num_params + 1; n++) |
| 2008 | g_value_unset (¶mv[n]); |
| 2009 | g_free (paramv); |
| 2010 | } |
| 2011 | |
| 2012 | static void |
| 2013 | fan_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 2014 | GVariant *changed_properties, |
| 2015 | const gchar *const *invalidated_properties) |
| 2016 | { |
| 2017 | FanProxy *proxy = FAN_PROXY (_proxy); |
| 2018 | guint n; |
| 2019 | const gchar *key; |
| 2020 | GVariantIter *iter; |
| 2021 | _ExtendedGDBusPropertyInfo *info; |
| 2022 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 2023 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 2024 | { |
| 2025 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key); |
| 2026 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 2027 | if (info != NULL) |
| 2028 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2029 | } |
| 2030 | g_variant_iter_free (iter); |
| 2031 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 2032 | { |
| 2033 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]); |
| 2034 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 2035 | if (info != NULL) |
| 2036 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2037 | } |
| 2038 | } |
| 2039 | |
| 2040 | static gint |
| 2041 | fan_proxy_get_speed (Fan *object) |
| 2042 | { |
| 2043 | FanProxy *proxy = FAN_PROXY (object); |
| 2044 | GVariant *variant; |
| 2045 | gint value = 0; |
| 2046 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed"); |
| 2047 | if (variant != NULL) |
| 2048 | { |
| 2049 | value = g_variant_get_int32 (variant); |
| 2050 | g_variant_unref (variant); |
| 2051 | } |
| 2052 | return value; |
| 2053 | } |
| 2054 | |
| 2055 | static gint |
| 2056 | fan_proxy_get_cooling_zone (Fan *object) |
| 2057 | { |
| 2058 | FanProxy *proxy = FAN_PROXY (object); |
| 2059 | GVariant *variant; |
| 2060 | gint value = 0; |
| 2061 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone"); |
| 2062 | if (variant != NULL) |
| 2063 | { |
| 2064 | value = g_variant_get_int32 (variant); |
| 2065 | g_variant_unref (variant); |
| 2066 | } |
| 2067 | return value; |
| 2068 | } |
| 2069 | |
| 2070 | static gint |
| 2071 | fan_proxy_get_pwm_num (Fan *object) |
| 2072 | { |
| 2073 | FanProxy *proxy = FAN_PROXY (object); |
| 2074 | GVariant *variant; |
| 2075 | gint value = 0; |
| 2076 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num"); |
| 2077 | if (variant != NULL) |
| 2078 | { |
| 2079 | value = g_variant_get_int32 (variant); |
| 2080 | g_variant_unref (variant); |
| 2081 | } |
| 2082 | return value; |
| 2083 | } |
| 2084 | |
| 2085 | static void |
| 2086 | fan_proxy_init (FanProxy *proxy) |
| 2087 | { |
| 2088 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2089 | proxy->priv = fan_proxy_get_instance_private (proxy); |
| 2090 | #else |
| 2091 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate); |
| 2092 | #endif |
| 2093 | |
| 2094 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ()); |
| 2095 | } |
| 2096 | |
| 2097 | static void |
| 2098 | fan_proxy_class_init (FanProxyClass *klass) |
| 2099 | { |
| 2100 | GObjectClass *gobject_class; |
| 2101 | GDBusProxyClass *proxy_class; |
| 2102 | |
| 2103 | gobject_class = G_OBJECT_CLASS (klass); |
| 2104 | gobject_class->finalize = fan_proxy_finalize; |
| 2105 | gobject_class->get_property = fan_proxy_get_property; |
| 2106 | gobject_class->set_property = fan_proxy_set_property; |
| 2107 | |
| 2108 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 2109 | proxy_class->g_signal = fan_proxy_g_signal; |
| 2110 | proxy_class->g_properties_changed = fan_proxy_g_properties_changed; |
| 2111 | |
| 2112 | fan_override_properties (gobject_class, 1); |
| 2113 | |
| 2114 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 2115 | g_type_class_add_private (klass, sizeof (FanProxyPrivate)); |
| 2116 | #endif |
| 2117 | } |
| 2118 | |
| 2119 | static void |
| 2120 | fan_proxy_iface_init (FanIface *iface) |
| 2121 | { |
| 2122 | iface->get_speed = fan_proxy_get_speed; |
| 2123 | iface->get_cooling_zone = fan_proxy_get_cooling_zone; |
| 2124 | iface->get_pwm_num = fan_proxy_get_pwm_num; |
| 2125 | } |
| 2126 | |
| 2127 | /** |
| 2128 | * fan_proxy_new: |
| 2129 | * @connection: A #GDBusConnection. |
| 2130 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2131 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2132 | * @object_path: An object path. |
| 2133 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2134 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2135 | * @user_data: User data to pass to @callback. |
| 2136 | * |
| 2137 | * 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. |
| 2138 | * |
| 2139 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2140 | * You can then call fan_proxy_new_finish() to get the result of the operation. |
| 2141 | * |
| 2142 | * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 2143 | */ |
| 2144 | void |
| 2145 | fan_proxy_new ( |
| 2146 | GDBusConnection *connection, |
| 2147 | GDBusProxyFlags flags, |
| 2148 | const gchar *name, |
| 2149 | const gchar *object_path, |
| 2150 | GCancellable *cancellable, |
| 2151 | GAsyncReadyCallback callback, |
| 2152 | gpointer user_data) |
| 2153 | { |
| 2154 | 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); |
| 2155 | } |
| 2156 | |
| 2157 | /** |
| 2158 | * fan_proxy_new_finish: |
| 2159 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new(). |
| 2160 | * @error: Return location for error or %NULL |
| 2161 | * |
| 2162 | * Finishes an operation started with fan_proxy_new(). |
| 2163 | * |
| 2164 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2165 | */ |
| 2166 | Fan * |
| 2167 | fan_proxy_new_finish ( |
| 2168 | GAsyncResult *res, |
| 2169 | GError **error) |
| 2170 | { |
| 2171 | GObject *ret; |
| 2172 | GObject *source_object; |
| 2173 | source_object = g_async_result_get_source_object (res); |
| 2174 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2175 | g_object_unref (source_object); |
| 2176 | if (ret != NULL) |
| 2177 | return FAN (ret); |
| 2178 | else |
| 2179 | return NULL; |
| 2180 | } |
| 2181 | |
| 2182 | /** |
| 2183 | * fan_proxy_new_sync: |
| 2184 | * @connection: A #GDBusConnection. |
| 2185 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2186 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2187 | * @object_path: An object path. |
| 2188 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2189 | * @error: Return location for error or %NULL |
| 2190 | * |
| 2191 | * 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. |
| 2192 | * |
| 2193 | * The calling thread is blocked until a reply is received. |
| 2194 | * |
| 2195 | * See fan_proxy_new() for the asynchronous version of this constructor. |
| 2196 | * |
| 2197 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2198 | */ |
| 2199 | Fan * |
| 2200 | fan_proxy_new_sync ( |
| 2201 | GDBusConnection *connection, |
| 2202 | GDBusProxyFlags flags, |
| 2203 | const gchar *name, |
| 2204 | const gchar *object_path, |
| 2205 | GCancellable *cancellable, |
| 2206 | GError **error) |
| 2207 | { |
| 2208 | GInitable *ret; |
| 2209 | 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); |
| 2210 | if (ret != NULL) |
| 2211 | return FAN (ret); |
| 2212 | else |
| 2213 | return NULL; |
| 2214 | } |
| 2215 | |
| 2216 | |
| 2217 | /** |
| 2218 | * fan_proxy_new_for_bus: |
| 2219 | * @bus_type: A #GBusType. |
| 2220 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2221 | * @name: A bus name (well-known or unique). |
| 2222 | * @object_path: An object path. |
| 2223 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2224 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2225 | * @user_data: User data to pass to @callback. |
| 2226 | * |
| 2227 | * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 2228 | * |
| 2229 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2230 | * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation. |
| 2231 | * |
| 2232 | * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 2233 | */ |
| 2234 | void |
| 2235 | fan_proxy_new_for_bus ( |
| 2236 | GBusType bus_type, |
| 2237 | GDBusProxyFlags flags, |
| 2238 | const gchar *name, |
| 2239 | const gchar *object_path, |
| 2240 | GCancellable *cancellable, |
| 2241 | GAsyncReadyCallback callback, |
| 2242 | gpointer user_data) |
| 2243 | { |
| 2244 | 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); |
| 2245 | } |
| 2246 | |
| 2247 | /** |
| 2248 | * fan_proxy_new_for_bus_finish: |
| 2249 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus(). |
| 2250 | * @error: Return location for error or %NULL |
| 2251 | * |
| 2252 | * Finishes an operation started with fan_proxy_new_for_bus(). |
| 2253 | * |
| 2254 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2255 | */ |
| 2256 | Fan * |
| 2257 | fan_proxy_new_for_bus_finish ( |
| 2258 | GAsyncResult *res, |
| 2259 | GError **error) |
| 2260 | { |
| 2261 | GObject *ret; |
| 2262 | GObject *source_object; |
| 2263 | source_object = g_async_result_get_source_object (res); |
| 2264 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2265 | g_object_unref (source_object); |
| 2266 | if (ret != NULL) |
| 2267 | return FAN (ret); |
| 2268 | else |
| 2269 | return NULL; |
| 2270 | } |
| 2271 | |
| 2272 | /** |
| 2273 | * fan_proxy_new_for_bus_sync: |
| 2274 | * @bus_type: A #GBusType. |
| 2275 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2276 | * @name: A bus name (well-known or unique). |
| 2277 | * @object_path: An object path. |
| 2278 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2279 | * @error: Return location for error or %NULL |
| 2280 | * |
| 2281 | * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 2282 | * |
| 2283 | * The calling thread is blocked until a reply is received. |
| 2284 | * |
| 2285 | * See fan_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 2286 | * |
| 2287 | * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. |
| 2288 | */ |
| 2289 | Fan * |
| 2290 | fan_proxy_new_for_bus_sync ( |
| 2291 | GBusType bus_type, |
| 2292 | GDBusProxyFlags flags, |
| 2293 | const gchar *name, |
| 2294 | const gchar *object_path, |
| 2295 | GCancellable *cancellable, |
| 2296 | GError **error) |
| 2297 | { |
| 2298 | GInitable *ret; |
| 2299 | 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); |
| 2300 | if (ret != NULL) |
| 2301 | return FAN (ret); |
| 2302 | else |
| 2303 | return NULL; |
| 2304 | } |
| 2305 | |
| 2306 | |
| 2307 | /* ------------------------------------------------------------------------ */ |
| 2308 | |
| 2309 | /** |
| 2310 | * FanSkeleton: |
| 2311 | * |
| 2312 | * The #FanSkeleton structure contains only private data and should only be accessed using the provided API. |
| 2313 | */ |
| 2314 | |
| 2315 | /** |
| 2316 | * FanSkeletonClass: |
| 2317 | * @parent_class: The parent class. |
| 2318 | * |
| 2319 | * Class structure for #FanSkeleton. |
| 2320 | */ |
| 2321 | |
| 2322 | struct _FanSkeletonPrivate |
| 2323 | { |
| 2324 | GValue *properties; |
| 2325 | GList *changed_properties; |
| 2326 | GSource *changed_properties_idle_source; |
| 2327 | GMainContext *context; |
| 2328 | GMutex lock; |
| 2329 | }; |
| 2330 | |
| 2331 | static void |
| 2332 | _fan_skeleton_handle_method_call ( |
| 2333 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2334 | const gchar *sender G_GNUC_UNUSED, |
| 2335 | const gchar *object_path G_GNUC_UNUSED, |
| 2336 | const gchar *interface_name, |
| 2337 | const gchar *method_name, |
| 2338 | GVariant *parameters, |
| 2339 | GDBusMethodInvocation *invocation, |
| 2340 | gpointer user_data) |
| 2341 | { |
| 2342 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 2343 | _ExtendedGDBusMethodInfo *info; |
| 2344 | GVariantIter iter; |
| 2345 | GVariant *child; |
| 2346 | GValue *paramv; |
| 2347 | guint num_params; |
| 2348 | guint num_extra; |
| 2349 | guint n; |
| 2350 | guint signal_id; |
| 2351 | GValue return_value = G_VALUE_INIT; |
| 2352 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 2353 | g_assert (info != NULL); |
| 2354 | num_params = g_variant_n_children (parameters); |
| 2355 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 2356 | n = 0; |
| 2357 | g_value_init (¶mv[n], TYPE_FAN); |
| 2358 | g_value_set_object (¶mv[n++], skeleton); |
| 2359 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 2360 | g_value_set_object (¶mv[n++], invocation); |
| 2361 | if (info->pass_fdlist) |
| 2362 | { |
| 2363 | #ifdef G_OS_UNIX |
| 2364 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 2365 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 2366 | #else |
| 2367 | g_assert_not_reached (); |
| 2368 | #endif |
| 2369 | } |
| 2370 | g_variant_iter_init (&iter, parameters); |
| 2371 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 2372 | { |
| 2373 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 2374 | if (arg_info->use_gvariant) |
| 2375 | { |
| 2376 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 2377 | g_value_set_variant (¶mv[n], child); |
| 2378 | n++; |
| 2379 | } |
| 2380 | else |
| 2381 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2382 | g_variant_unref (child); |
| 2383 | } |
| 2384 | signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); |
| 2385 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 2386 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 2387 | if (!g_value_get_boolean (&return_value)) |
| 2388 | 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); |
| 2389 | g_value_unset (&return_value); |
| 2390 | for (n = 0; n < num_params + num_extra; n++) |
| 2391 | g_value_unset (¶mv[n]); |
| 2392 | g_free (paramv); |
| 2393 | } |
| 2394 | |
| 2395 | static GVariant * |
| 2396 | _fan_skeleton_handle_get_property ( |
| 2397 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2398 | const gchar *sender G_GNUC_UNUSED, |
| 2399 | const gchar *object_path G_GNUC_UNUSED, |
| 2400 | const gchar *interface_name G_GNUC_UNUSED, |
| 2401 | const gchar *property_name, |
| 2402 | GError **error, |
| 2403 | gpointer user_data) |
| 2404 | { |
| 2405 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 2406 | GValue value = G_VALUE_INIT; |
| 2407 | GParamSpec *pspec; |
| 2408 | _ExtendedGDBusPropertyInfo *info; |
| 2409 | GVariant *ret; |
| 2410 | ret = NULL; |
| 2411 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 2412 | g_assert (info != NULL); |
| 2413 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 2414 | if (pspec == NULL) |
| 2415 | { |
| 2416 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 2417 | } |
| 2418 | else |
| 2419 | { |
| 2420 | g_value_init (&value, pspec->value_type); |
| 2421 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 2422 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 2423 | g_value_unset (&value); |
| 2424 | } |
| 2425 | return ret; |
| 2426 | } |
| 2427 | |
| 2428 | static gboolean |
| 2429 | _fan_skeleton_handle_set_property ( |
| 2430 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2431 | const gchar *sender G_GNUC_UNUSED, |
| 2432 | const gchar *object_path G_GNUC_UNUSED, |
| 2433 | const gchar *interface_name G_GNUC_UNUSED, |
| 2434 | const gchar *property_name, |
| 2435 | GVariant *variant, |
| 2436 | GError **error, |
| 2437 | gpointer user_data) |
| 2438 | { |
| 2439 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 2440 | GValue value = G_VALUE_INIT; |
| 2441 | GParamSpec *pspec; |
| 2442 | _ExtendedGDBusPropertyInfo *info; |
| 2443 | gboolean ret; |
| 2444 | ret = FALSE; |
| 2445 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); |
| 2446 | g_assert (info != NULL); |
| 2447 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 2448 | if (pspec == NULL) |
| 2449 | { |
| 2450 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 2451 | } |
| 2452 | else |
| 2453 | { |
| 2454 | if (info->use_gvariant) |
| 2455 | g_value_set_variant (&value, variant); |
| 2456 | else |
| 2457 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 2458 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 2459 | g_value_unset (&value); |
| 2460 | ret = TRUE; |
| 2461 | } |
| 2462 | return ret; |
| 2463 | } |
| 2464 | |
| 2465 | static const GDBusInterfaceVTable _fan_skeleton_vtable = |
| 2466 | { |
| 2467 | _fan_skeleton_handle_method_call, |
| 2468 | _fan_skeleton_handle_get_property, |
| 2469 | _fan_skeleton_handle_set_property, |
| 2470 | {NULL} |
| 2471 | }; |
| 2472 | |
| 2473 | static GDBusInterfaceInfo * |
| 2474 | fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 2475 | { |
| 2476 | return fan_interface_info (); |
| 2477 | } |
| 2478 | |
| 2479 | static GDBusInterfaceVTable * |
| 2480 | fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 2481 | { |
| 2482 | return (GDBusInterfaceVTable *) &_fan_skeleton_vtable; |
| 2483 | } |
| 2484 | |
| 2485 | static GVariant * |
| 2486 | fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 2487 | { |
| 2488 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 2489 | |
| 2490 | GVariantBuilder builder; |
| 2491 | guint n; |
| 2492 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 2493 | if (_fan_interface_info.parent_struct.properties == NULL) |
| 2494 | goto out; |
| 2495 | for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++) |
| 2496 | { |
| 2497 | GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n]; |
| 2498 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 2499 | { |
| 2500 | GVariant *value; |
| 2501 | 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); |
| 2502 | if (value != NULL) |
| 2503 | { |
| 2504 | g_variant_take_ref (value); |
| 2505 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 2506 | g_variant_unref (value); |
| 2507 | } |
| 2508 | } |
| 2509 | } |
| 2510 | out: |
| 2511 | return g_variant_builder_end (&builder); |
| 2512 | } |
| 2513 | |
| 2514 | static gboolean _fan_emit_changed (gpointer user_data); |
| 2515 | |
| 2516 | static void |
| 2517 | fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 2518 | { |
| 2519 | FanSkeleton *skeleton = FAN_SKELETON (_skeleton); |
| 2520 | gboolean emit_changed = FALSE; |
| 2521 | |
| 2522 | g_mutex_lock (&skeleton->priv->lock); |
| 2523 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 2524 | { |
| 2525 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 2526 | skeleton->priv->changed_properties_idle_source = NULL; |
| 2527 | emit_changed = TRUE; |
| 2528 | } |
| 2529 | g_mutex_unlock (&skeleton->priv->lock); |
| 2530 | |
| 2531 | if (emit_changed) |
| 2532 | _fan_emit_changed (skeleton); |
| 2533 | } |
| 2534 | |
| 2535 | static void |
| 2536 | _fan_on_signal_speed_changed ( |
| 2537 | Fan *object, |
| 2538 | gint arg_speed) |
| 2539 | { |
| 2540 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2541 | |
| 2542 | GList *connections, *l; |
| 2543 | GVariant *signal_variant; |
| 2544 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2545 | |
| 2546 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 2547 | arg_speed)); |
| 2548 | for (l = connections; l != NULL; l = l->next) |
| 2549 | { |
| 2550 | GDBusConnection *connection = l->data; |
| 2551 | g_dbus_connection_emit_signal (connection, |
| 2552 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged", |
| 2553 | signal_variant, NULL); |
| 2554 | } |
| 2555 | g_variant_unref (signal_variant); |
| 2556 | g_list_free_full (connections, g_object_unref); |
| 2557 | } |
| 2558 | |
| 2559 | static void |
| 2560 | _fan_on_signal_tach_error ( |
| 2561 | Fan *object) |
| 2562 | { |
| 2563 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2564 | |
| 2565 | GList *connections, *l; |
| 2566 | GVariant *signal_variant; |
| 2567 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2568 | |
| 2569 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 2570 | for (l = connections; l != NULL; l = l->next) |
| 2571 | { |
| 2572 | GDBusConnection *connection = l->data; |
| 2573 | g_dbus_connection_emit_signal (connection, |
| 2574 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError", |
| 2575 | signal_variant, NULL); |
| 2576 | } |
| 2577 | g_variant_unref (signal_variant); |
| 2578 | g_list_free_full (connections, g_object_unref); |
| 2579 | } |
| 2580 | |
| 2581 | static void fan_skeleton_iface_init (FanIface *iface); |
| 2582 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2583 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 2584 | G_ADD_PRIVATE (FanSkeleton) |
| 2585 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 2586 | |
| 2587 | #else |
| 2588 | G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 2589 | G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); |
| 2590 | |
| 2591 | #endif |
| 2592 | static void |
| 2593 | fan_skeleton_finalize (GObject *object) |
| 2594 | { |
| 2595 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2596 | guint n; |
| 2597 | for (n = 0; n < 3; n++) |
| 2598 | g_value_unset (&skeleton->priv->properties[n]); |
| 2599 | g_free (skeleton->priv->properties); |
| 2600 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 2601 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 2602 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 2603 | g_main_context_unref (skeleton->priv->context); |
| 2604 | g_mutex_clear (&skeleton->priv->lock); |
| 2605 | G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object); |
| 2606 | } |
| 2607 | |
| 2608 | static void |
| 2609 | fan_skeleton_get_property (GObject *object, |
| 2610 | guint prop_id, |
| 2611 | GValue *value, |
| 2612 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2613 | { |
| 2614 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2615 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 2616 | g_mutex_lock (&skeleton->priv->lock); |
| 2617 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 2618 | g_mutex_unlock (&skeleton->priv->lock); |
| 2619 | } |
| 2620 | |
| 2621 | static gboolean |
| 2622 | _fan_emit_changed (gpointer user_data) |
| 2623 | { |
| 2624 | FanSkeleton *skeleton = FAN_SKELETON (user_data); |
| 2625 | GList *l; |
| 2626 | GVariantBuilder builder; |
| 2627 | GVariantBuilder invalidated_builder; |
| 2628 | guint num_changes; |
| 2629 | |
| 2630 | g_mutex_lock (&skeleton->priv->lock); |
| 2631 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 2632 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 2633 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 2634 | { |
| 2635 | ChangedProperty *cp = l->data; |
| 2636 | GVariant *variant; |
| 2637 | const GValue *cur_value; |
| 2638 | |
| 2639 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 2640 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 2641 | { |
| 2642 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 2643 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 2644 | g_variant_unref (variant); |
| 2645 | num_changes++; |
| 2646 | } |
| 2647 | } |
| 2648 | if (num_changes > 0) |
| 2649 | { |
| 2650 | GList *connections, *ll; |
| 2651 | GVariant *signal_variant; |
| 2652 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan", |
| 2653 | &builder, &invalidated_builder)); |
| 2654 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2655 | for (ll = connections; ll != NULL; ll = ll->next) |
| 2656 | { |
| 2657 | GDBusConnection *connection = ll->data; |
| 2658 | |
| 2659 | g_dbus_connection_emit_signal (connection, |
| 2660 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 2661 | "org.freedesktop.DBus.Properties", |
| 2662 | "PropertiesChanged", |
| 2663 | signal_variant, |
| 2664 | NULL); |
| 2665 | } |
| 2666 | g_variant_unref (signal_variant); |
| 2667 | g_list_free_full (connections, g_object_unref); |
| 2668 | } |
| 2669 | else |
| 2670 | { |
| 2671 | g_variant_builder_clear (&builder); |
| 2672 | g_variant_builder_clear (&invalidated_builder); |
| 2673 | } |
| 2674 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 2675 | skeleton->priv->changed_properties = NULL; |
| 2676 | skeleton->priv->changed_properties_idle_source = NULL; |
| 2677 | g_mutex_unlock (&skeleton->priv->lock); |
| 2678 | return FALSE; |
| 2679 | } |
| 2680 | |
| 2681 | static void |
| 2682 | _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 2683 | { |
| 2684 | ChangedProperty *cp; |
| 2685 | GList *l; |
| 2686 | cp = NULL; |
| 2687 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 2688 | { |
| 2689 | ChangedProperty *i_cp = l->data; |
| 2690 | if (i_cp->info == info) |
| 2691 | { |
| 2692 | cp = i_cp; |
| 2693 | break; |
| 2694 | } |
| 2695 | } |
| 2696 | if (cp == NULL) |
| 2697 | { |
| 2698 | cp = g_new0 (ChangedProperty, 1); |
| 2699 | cp->prop_id = prop_id; |
| 2700 | cp->info = info; |
| 2701 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 2702 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 2703 | g_value_copy (orig_value, &cp->orig_value); |
| 2704 | } |
| 2705 | } |
| 2706 | |
| 2707 | static void |
| 2708 | fan_skeleton_notify (GObject *object, |
| 2709 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2710 | { |
| 2711 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2712 | g_mutex_lock (&skeleton->priv->lock); |
| 2713 | if (skeleton->priv->changed_properties != NULL && |
| 2714 | skeleton->priv->changed_properties_idle_source == NULL) |
| 2715 | { |
| 2716 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 2717 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 2718 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 2719 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 2720 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 2721 | } |
| 2722 | g_mutex_unlock (&skeleton->priv->lock); |
| 2723 | } |
| 2724 | |
| 2725 | static void |
| 2726 | fan_skeleton_set_property (GObject *object, |
| 2727 | guint prop_id, |
| 2728 | const GValue *value, |
| 2729 | GParamSpec *pspec) |
| 2730 | { |
| 2731 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2732 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
| 2733 | g_mutex_lock (&skeleton->priv->lock); |
| 2734 | g_object_freeze_notify (object); |
| 2735 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 2736 | { |
| 2737 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 2738 | _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 2739 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 2740 | g_object_notify_by_pspec (object, pspec); |
| 2741 | } |
| 2742 | g_mutex_unlock (&skeleton->priv->lock); |
| 2743 | g_object_thaw_notify (object); |
| 2744 | } |
| 2745 | |
| 2746 | static void |
| 2747 | fan_skeleton_init (FanSkeleton *skeleton) |
| 2748 | { |
| 2749 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2750 | skeleton->priv = fan_skeleton_get_instance_private (skeleton); |
| 2751 | #else |
| 2752 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate); |
| 2753 | #endif |
| 2754 | |
| 2755 | g_mutex_init (&skeleton->priv->lock); |
| 2756 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 2757 | skeleton->priv->properties = g_new0 (GValue, 3); |
| 2758 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 2759 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 2760 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 2761 | } |
| 2762 | |
| 2763 | static gint |
| 2764 | fan_skeleton_get_speed (Fan *object) |
| 2765 | { |
| 2766 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2767 | gint value; |
| 2768 | g_mutex_lock (&skeleton->priv->lock); |
| 2769 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 2770 | g_mutex_unlock (&skeleton->priv->lock); |
| 2771 | return value; |
| 2772 | } |
| 2773 | |
| 2774 | static gint |
| 2775 | fan_skeleton_get_cooling_zone (Fan *object) |
| 2776 | { |
| 2777 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2778 | gint value; |
| 2779 | g_mutex_lock (&skeleton->priv->lock); |
| 2780 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 2781 | g_mutex_unlock (&skeleton->priv->lock); |
| 2782 | return value; |
| 2783 | } |
| 2784 | |
| 2785 | static gint |
| 2786 | fan_skeleton_get_pwm_num (Fan *object) |
| 2787 | { |
| 2788 | FanSkeleton *skeleton = FAN_SKELETON (object); |
| 2789 | gint value; |
| 2790 | g_mutex_lock (&skeleton->priv->lock); |
| 2791 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 2792 | g_mutex_unlock (&skeleton->priv->lock); |
| 2793 | return value; |
| 2794 | } |
| 2795 | |
| 2796 | static void |
| 2797 | fan_skeleton_class_init (FanSkeletonClass *klass) |
| 2798 | { |
| 2799 | GObjectClass *gobject_class; |
| 2800 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 2801 | |
| 2802 | gobject_class = G_OBJECT_CLASS (klass); |
| 2803 | gobject_class->finalize = fan_skeleton_finalize; |
| 2804 | gobject_class->get_property = fan_skeleton_get_property; |
| 2805 | gobject_class->set_property = fan_skeleton_set_property; |
| 2806 | gobject_class->notify = fan_skeleton_notify; |
| 2807 | |
| 2808 | |
| 2809 | fan_override_properties (gobject_class, 1); |
| 2810 | |
| 2811 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 2812 | skeleton_class->get_info = fan_skeleton_dbus_interface_get_info; |
| 2813 | skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties; |
| 2814 | skeleton_class->flush = fan_skeleton_dbus_interface_flush; |
| 2815 | skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable; |
| 2816 | |
| 2817 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 2818 | g_type_class_add_private (klass, sizeof (FanSkeletonPrivate)); |
| 2819 | #endif |
| 2820 | } |
| 2821 | |
| 2822 | static void |
| 2823 | fan_skeleton_iface_init (FanIface *iface) |
| 2824 | { |
| 2825 | iface->speed_changed = _fan_on_signal_speed_changed; |
| 2826 | iface->tach_error = _fan_on_signal_tach_error; |
| 2827 | iface->get_speed = fan_skeleton_get_speed; |
| 2828 | iface->get_cooling_zone = fan_skeleton_get_cooling_zone; |
| 2829 | iface->get_pwm_num = fan_skeleton_get_pwm_num; |
| 2830 | } |
| 2831 | |
| 2832 | /** |
| 2833 | * fan_skeleton_new: |
| 2834 | * |
| 2835 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. |
| 2836 | * |
| 2837 | * Returns: (transfer full) (type FanSkeleton): The skeleton object. |
| 2838 | */ |
| 2839 | Fan * |
| 2840 | fan_skeleton_new (void) |
| 2841 | { |
| 2842 | return FAN (g_object_new (TYPE_FAN_SKELETON, NULL)); |
| 2843 | } |
| 2844 | |
| 2845 | /* ------------------------------------------------------------------------ |
| 2846 | * Code for interface org.openbmc.SensorValue |
| 2847 | * ------------------------------------------------------------------------ |
| 2848 | */ |
| 2849 | |
| 2850 | /** |
| 2851 | * SECTION:SensorValue |
| 2852 | * @title: SensorValue |
| 2853 | * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface |
| 2854 | * |
| 2855 | * 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. |
| 2856 | */ |
| 2857 | |
| 2858 | /* ---- Introspection data for org.openbmc.SensorValue ---- */ |
| 2859 | |
| 2860 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = |
| 2861 | { |
| 2862 | { |
| 2863 | -1, |
| 2864 | (gchar *) "init", |
| 2865 | NULL, |
| 2866 | NULL, |
| 2867 | NULL |
| 2868 | }, |
| 2869 | "handle-init", |
| 2870 | FALSE |
| 2871 | }; |
| 2872 | |
| 2873 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = |
| 2874 | { |
| 2875 | { |
| 2876 | -1, |
| 2877 | (gchar *) "value", |
| 2878 | (gchar *) "v", |
| 2879 | NULL |
| 2880 | }, |
| 2881 | FALSE |
| 2882 | }; |
| 2883 | |
| 2884 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = |
| 2885 | { |
| 2886 | &_sensor_value_method_info_get_value_OUT_ARG_value, |
| 2887 | NULL |
| 2888 | }; |
| 2889 | |
| 2890 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = |
| 2891 | { |
| 2892 | { |
| 2893 | -1, |
| 2894 | (gchar *) "getValue", |
| 2895 | NULL, |
| 2896 | (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, |
| 2897 | NULL |
| 2898 | }, |
| 2899 | "handle-get-value", |
| 2900 | FALSE |
| 2901 | }; |
| 2902 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2903 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = |
| 2904 | { |
| 2905 | { |
| 2906 | -1, |
| 2907 | (gchar *) "value", |
| 2908 | (gchar *) "v", |
| 2909 | NULL |
| 2910 | }, |
| 2911 | FALSE |
| 2912 | }; |
| 2913 | |
| 2914 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = |
| 2915 | { |
| 2916 | &_sensor_value_method_info_set_value_IN_ARG_value, |
| 2917 | NULL |
| 2918 | }; |
| 2919 | |
| 2920 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = |
| 2921 | { |
| 2922 | { |
| 2923 | -1, |
| 2924 | (gchar *) "setValue", |
| 2925 | (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, |
| 2926 | NULL, |
| 2927 | NULL |
| 2928 | }, |
| 2929 | "handle-set-value", |
| 2930 | FALSE |
| 2931 | }; |
| 2932 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2933 | static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = |
| 2934 | { |
| 2935 | &_sensor_value_method_info_init, |
| 2936 | &_sensor_value_method_info_get_value, |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 2937 | &_sensor_value_method_info_set_value, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2938 | NULL |
| 2939 | }; |
| 2940 | |
| 2941 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = |
| 2942 | { |
| 2943 | { |
| 2944 | -1, |
| 2945 | (gchar *) "value", |
| 2946 | (gchar *) "v", |
| 2947 | NULL |
| 2948 | }, |
| 2949 | FALSE |
| 2950 | }; |
| 2951 | |
| 2952 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = |
| 2953 | { |
| 2954 | { |
| 2955 | -1, |
| 2956 | (gchar *) "units", |
| 2957 | (gchar *) "s", |
| 2958 | NULL |
| 2959 | }, |
| 2960 | FALSE |
| 2961 | }; |
| 2962 | |
| 2963 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = |
| 2964 | { |
| 2965 | &_sensor_value_signal_info_changed_ARG_value, |
| 2966 | &_sensor_value_signal_info_changed_ARG_units, |
| 2967 | NULL |
| 2968 | }; |
| 2969 | |
| 2970 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = |
| 2971 | { |
| 2972 | { |
| 2973 | -1, |
| 2974 | (gchar *) "Changed", |
| 2975 | (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, |
| 2976 | NULL |
| 2977 | }, |
| 2978 | "changed" |
| 2979 | }; |
| 2980 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 2981 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error = |
| 2982 | { |
| 2983 | { |
| 2984 | -1, |
| 2985 | (gchar *) "Error", |
| 2986 | NULL, |
| 2987 | NULL |
| 2988 | }, |
| 2989 | "error" |
| 2990 | }; |
| 2991 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 2992 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = |
| 2993 | { |
| 2994 | { |
| 2995 | -1, |
| 2996 | (gchar *) "bus_name", |
| 2997 | (gchar *) "s", |
| 2998 | NULL |
| 2999 | }, |
| 3000 | FALSE |
| 3001 | }; |
| 3002 | |
| 3003 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = |
| 3004 | { |
| 3005 | &_sensor_value_signal_info_heartbeat_ARG_bus_name, |
| 3006 | NULL |
| 3007 | }; |
| 3008 | |
| 3009 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = |
| 3010 | { |
| 3011 | { |
| 3012 | -1, |
| 3013 | (gchar *) "Heartbeat", |
| 3014 | (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, |
| 3015 | NULL |
| 3016 | }, |
| 3017 | "heartbeat" |
| 3018 | }; |
| 3019 | |
| 3020 | static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = |
| 3021 | { |
| 3022 | &_sensor_value_signal_info_changed, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3023 | &_sensor_value_signal_info_error, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3024 | &_sensor_value_signal_info_heartbeat, |
| 3025 | NULL |
| 3026 | }; |
| 3027 | |
| 3028 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = |
| 3029 | { |
| 3030 | { |
| 3031 | -1, |
| 3032 | (gchar *) "value", |
| 3033 | (gchar *) "v", |
| 3034 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3035 | NULL |
| 3036 | }, |
| 3037 | "value", |
| 3038 | FALSE |
| 3039 | }; |
| 3040 | |
| 3041 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = |
| 3042 | { |
| 3043 | { |
| 3044 | -1, |
| 3045 | (gchar *) "units", |
| 3046 | (gchar *) "s", |
| 3047 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3048 | NULL |
| 3049 | }, |
| 3050 | "units", |
| 3051 | FALSE |
| 3052 | }; |
| 3053 | |
| 3054 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = |
| 3055 | { |
| 3056 | { |
| 3057 | -1, |
| 3058 | (gchar *) "poll_interval", |
| 3059 | (gchar *) "i", |
| 3060 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 3061 | NULL |
| 3062 | }, |
| 3063 | "poll-interval", |
| 3064 | FALSE |
| 3065 | }; |
| 3066 | |
| 3067 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = |
| 3068 | { |
| 3069 | { |
| 3070 | -1, |
| 3071 | (gchar *) "heatbeat", |
| 3072 | (gchar *) "i", |
| 3073 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3074 | NULL |
| 3075 | }, |
| 3076 | "heatbeat", |
| 3077 | FALSE |
| 3078 | }; |
| 3079 | |
| 3080 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = |
| 3081 | { |
| 3082 | { |
| 3083 | -1, |
| 3084 | (gchar *) "settable", |
| 3085 | (gchar *) "b", |
| 3086 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3087 | NULL |
| 3088 | }, |
| 3089 | "settable", |
| 3090 | FALSE |
| 3091 | }; |
| 3092 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3093 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
| 3094 | { |
| 3095 | &_sensor_value_property_info_value, |
| 3096 | &_sensor_value_property_info_units, |
| 3097 | &_sensor_value_property_info_poll_interval, |
| 3098 | &_sensor_value_property_info_heatbeat, |
| 3099 | &_sensor_value_property_info_settable, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3100 | NULL |
| 3101 | }; |
| 3102 | |
| 3103 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
| 3104 | { |
| 3105 | { |
| 3106 | -1, |
| 3107 | (gchar *) "org.openbmc.SensorValue", |
| 3108 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 3109 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 3110 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
| 3111 | NULL |
| 3112 | }, |
| 3113 | "sensor-value", |
| 3114 | }; |
| 3115 | |
| 3116 | |
| 3117 | /** |
| 3118 | * sensor_value_interface_info: |
| 3119 | * |
| 3120 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. |
| 3121 | * |
| 3122 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 3123 | */ |
| 3124 | GDBusInterfaceInfo * |
| 3125 | sensor_value_interface_info (void) |
| 3126 | { |
| 3127 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
| 3128 | } |
| 3129 | |
| 3130 | /** |
| 3131 | * sensor_value_override_properties: |
| 3132 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 3133 | * @property_id_begin: The property id to assign to the first overridden property. |
| 3134 | * |
| 3135 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
| 3136 | * The properties are overridden in the order they are defined. |
| 3137 | * |
| 3138 | * Returns: The last property id. |
| 3139 | */ |
| 3140 | guint |
| 3141 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
| 3142 | { |
| 3143 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 3144 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 3145 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 3146 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 3147 | g_object_class_override_property (klass, property_id_begin++, "settable"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3148 | return property_id_begin - 1; |
| 3149 | } |
| 3150 | |
| 3151 | |
| 3152 | |
| 3153 | /** |
| 3154 | * SensorValue: |
| 3155 | * |
| 3156 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 3157 | */ |
| 3158 | |
| 3159 | /** |
| 3160 | * SensorValueIface: |
| 3161 | * @parent_iface: The parent interface. |
| 3162 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 3163 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 3164 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3165 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3166 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
| 3167 | * @get_settable: Getter for the #SensorValue:settable property. |
| 3168 | * @get_units: Getter for the #SensorValue:units property. |
| 3169 | * @get_value: Getter for the #SensorValue:value property. |
| 3170 | * @changed: Handler for the #SensorValue::changed signal. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3171 | * @error: Handler for the #SensorValue::error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3172 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
| 3173 | * |
| 3174 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 3175 | */ |
| 3176 | |
| 3177 | typedef SensorValueIface SensorValueInterface; |
| 3178 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
| 3179 | |
| 3180 | static void |
| 3181 | sensor_value_default_init (SensorValueIface *iface) |
| 3182 | { |
| 3183 | /* GObject signals for incoming D-Bus method calls: */ |
| 3184 | /** |
| 3185 | * SensorValue::handle-init: |
| 3186 | * @object: A #SensorValue. |
| 3187 | * @invocation: A #GDBusMethodInvocation. |
| 3188 | * |
| 3189 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. |
| 3190 | * |
| 3191 | * 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. |
| 3192 | * |
| 3193 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3194 | */ |
| 3195 | g_signal_new ("handle-init", |
| 3196 | G_TYPE_FROM_INTERFACE (iface), |
| 3197 | G_SIGNAL_RUN_LAST, |
| 3198 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
| 3199 | g_signal_accumulator_true_handled, |
| 3200 | NULL, |
| 3201 | g_cclosure_marshal_generic, |
| 3202 | G_TYPE_BOOLEAN, |
| 3203 | 1, |
| 3204 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3205 | |
| 3206 | /** |
| 3207 | * SensorValue::handle-get-value: |
| 3208 | * @object: A #SensorValue. |
| 3209 | * @invocation: A #GDBusMethodInvocation. |
| 3210 | * |
| 3211 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. |
| 3212 | * |
| 3213 | * 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. |
| 3214 | * |
| 3215 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3216 | */ |
| 3217 | g_signal_new ("handle-get-value", |
| 3218 | G_TYPE_FROM_INTERFACE (iface), |
| 3219 | G_SIGNAL_RUN_LAST, |
| 3220 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
| 3221 | g_signal_accumulator_true_handled, |
| 3222 | NULL, |
| 3223 | g_cclosure_marshal_generic, |
| 3224 | G_TYPE_BOOLEAN, |
| 3225 | 1, |
| 3226 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3227 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 3228 | /** |
| 3229 | * SensorValue::handle-set-value: |
| 3230 | * @object: A #SensorValue. |
| 3231 | * @invocation: A #GDBusMethodInvocation. |
| 3232 | * @arg_value: Argument passed by remote caller. |
| 3233 | * |
| 3234 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. |
| 3235 | * |
| 3236 | * 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. |
| 3237 | * |
| 3238 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3239 | */ |
| 3240 | g_signal_new ("handle-set-value", |
| 3241 | G_TYPE_FROM_INTERFACE (iface), |
| 3242 | G_SIGNAL_RUN_LAST, |
| 3243 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
| 3244 | g_signal_accumulator_true_handled, |
| 3245 | NULL, |
| 3246 | g_cclosure_marshal_generic, |
| 3247 | G_TYPE_BOOLEAN, |
| 3248 | 2, |
| 3249 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 3250 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3251 | /* GObject signals for received D-Bus signals: */ |
| 3252 | /** |
| 3253 | * SensorValue::changed: |
| 3254 | * @object: A #SensorValue. |
| 3255 | * @arg_value: Argument. |
| 3256 | * @arg_units: Argument. |
| 3257 | * |
| 3258 | * 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. |
| 3259 | * |
| 3260 | * 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. |
| 3261 | */ |
| 3262 | g_signal_new ("changed", |
| 3263 | G_TYPE_FROM_INTERFACE (iface), |
| 3264 | G_SIGNAL_RUN_LAST, |
| 3265 | G_STRUCT_OFFSET (SensorValueIface, changed), |
| 3266 | NULL, |
| 3267 | NULL, |
| 3268 | g_cclosure_marshal_generic, |
| 3269 | G_TYPE_NONE, |
| 3270 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
| 3271 | |
| 3272 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3273 | * SensorValue::error: |
| 3274 | * @object: A #SensorValue. |
| 3275 | * |
| 3276 | * 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. |
| 3277 | * |
| 3278 | * 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. |
| 3279 | */ |
| 3280 | g_signal_new ("error", |
| 3281 | G_TYPE_FROM_INTERFACE (iface), |
| 3282 | G_SIGNAL_RUN_LAST, |
| 3283 | G_STRUCT_OFFSET (SensorValueIface, error), |
| 3284 | NULL, |
| 3285 | NULL, |
| 3286 | g_cclosure_marshal_generic, |
| 3287 | G_TYPE_NONE, |
| 3288 | 0); |
| 3289 | |
| 3290 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3291 | * SensorValue::heartbeat: |
| 3292 | * @object: A #SensorValue. |
| 3293 | * @arg_bus_name: Argument. |
| 3294 | * |
| 3295 | * 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. |
| 3296 | * |
| 3297 | * 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. |
| 3298 | */ |
| 3299 | g_signal_new ("heartbeat", |
| 3300 | G_TYPE_FROM_INTERFACE (iface), |
| 3301 | G_SIGNAL_RUN_LAST, |
| 3302 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
| 3303 | NULL, |
| 3304 | NULL, |
| 3305 | g_cclosure_marshal_generic, |
| 3306 | G_TYPE_NONE, |
| 3307 | 1, G_TYPE_STRING); |
| 3308 | |
| 3309 | /* GObject properties for D-Bus properties: */ |
| 3310 | /** |
| 3311 | * SensorValue:value: |
| 3312 | * |
| 3313 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. |
| 3314 | * |
| 3315 | * 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. |
| 3316 | */ |
| 3317 | g_object_interface_install_property (iface, |
| 3318 | g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3319 | /** |
| 3320 | * SensorValue:units: |
| 3321 | * |
| 3322 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. |
| 3323 | * |
| 3324 | * 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. |
| 3325 | */ |
| 3326 | g_object_interface_install_property (iface, |
| 3327 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3328 | /** |
| 3329 | * SensorValue:poll-interval: |
| 3330 | * |
| 3331 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. |
| 3332 | * |
| 3333 | * 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. |
| 3334 | */ |
| 3335 | g_object_interface_install_property (iface, |
| 3336 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3337 | /** |
| 3338 | * SensorValue:heatbeat: |
| 3339 | * |
| 3340 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. |
| 3341 | * |
| 3342 | * 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. |
| 3343 | */ |
| 3344 | g_object_interface_install_property (iface, |
| 3345 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3346 | /** |
| 3347 | * SensorValue:settable: |
| 3348 | * |
| 3349 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. |
| 3350 | * |
| 3351 | * 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. |
| 3352 | */ |
| 3353 | g_object_interface_install_property (iface, |
| 3354 | 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] | 3355 | } |
| 3356 | |
| 3357 | /** |
| 3358 | * sensor_value_get_value: (skip) |
| 3359 | * @object: A #SensorValue. |
| 3360 | * |
| 3361 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 3362 | * |
| 3363 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3364 | * |
| 3365 | * <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> |
| 3366 | * |
| 3367 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 3368 | */ |
| 3369 | GVariant * |
| 3370 | sensor_value_get_value (SensorValue *object) |
| 3371 | { |
| 3372 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
| 3373 | } |
| 3374 | |
| 3375 | /** |
| 3376 | * sensor_value_dup_value: (skip) |
| 3377 | * @object: A #SensorValue. |
| 3378 | * |
| 3379 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 3380 | * |
| 3381 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3382 | * |
| 3383 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 3384 | */ |
| 3385 | GVariant * |
| 3386 | sensor_value_dup_value (SensorValue *object) |
| 3387 | { |
| 3388 | GVariant *value; |
| 3389 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 3390 | return value; |
| 3391 | } |
| 3392 | |
| 3393 | /** |
| 3394 | * sensor_value_set_value: (skip) |
| 3395 | * @object: A #SensorValue. |
| 3396 | * @value: The value to set. |
| 3397 | * |
| 3398 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. |
| 3399 | * |
| 3400 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3401 | */ |
| 3402 | void |
| 3403 | sensor_value_set_value (SensorValue *object, GVariant *value) |
| 3404 | { |
| 3405 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 3406 | } |
| 3407 | |
| 3408 | /** |
| 3409 | * sensor_value_get_units: (skip) |
| 3410 | * @object: A #SensorValue. |
| 3411 | * |
| 3412 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 3413 | * |
| 3414 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3415 | * |
| 3416 | * <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> |
| 3417 | * |
| 3418 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 3419 | */ |
| 3420 | const gchar * |
| 3421 | sensor_value_get_units (SensorValue *object) |
| 3422 | { |
| 3423 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
| 3424 | } |
| 3425 | |
| 3426 | /** |
| 3427 | * sensor_value_dup_units: (skip) |
| 3428 | * @object: A #SensorValue. |
| 3429 | * |
| 3430 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
| 3431 | * |
| 3432 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3433 | * |
| 3434 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 3435 | */ |
| 3436 | gchar * |
| 3437 | sensor_value_dup_units (SensorValue *object) |
| 3438 | { |
| 3439 | gchar *value; |
| 3440 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 3441 | return value; |
| 3442 | } |
| 3443 | |
| 3444 | /** |
| 3445 | * sensor_value_set_units: (skip) |
| 3446 | * @object: A #SensorValue. |
| 3447 | * @value: The value to set. |
| 3448 | * |
| 3449 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. |
| 3450 | * |
| 3451 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3452 | */ |
| 3453 | void |
| 3454 | sensor_value_set_units (SensorValue *object, const gchar *value) |
| 3455 | { |
| 3456 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 3457 | } |
| 3458 | |
| 3459 | /** |
| 3460 | * sensor_value_get_poll_interval: (skip) |
| 3461 | * @object: A #SensorValue. |
| 3462 | * |
| 3463 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. |
| 3464 | * |
| 3465 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 3466 | * |
| 3467 | * Returns: The property value. |
| 3468 | */ |
| 3469 | gint |
| 3470 | sensor_value_get_poll_interval (SensorValue *object) |
| 3471 | { |
| 3472 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
| 3473 | } |
| 3474 | |
| 3475 | /** |
| 3476 | * sensor_value_set_poll_interval: (skip) |
| 3477 | * @object: A #SensorValue. |
| 3478 | * @value: The value to set. |
| 3479 | * |
| 3480 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 3481 | * |
| 3482 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 3483 | */ |
| 3484 | void |
| 3485 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
| 3486 | { |
| 3487 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 3488 | } |
| 3489 | |
| 3490 | /** |
| 3491 | * sensor_value_get_heatbeat: (skip) |
| 3492 | * @object: A #SensorValue. |
| 3493 | * |
| 3494 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. |
| 3495 | * |
| 3496 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3497 | * |
| 3498 | * Returns: The property value. |
| 3499 | */ |
| 3500 | gint |
| 3501 | sensor_value_get_heatbeat (SensorValue *object) |
| 3502 | { |
| 3503 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
| 3504 | } |
| 3505 | |
| 3506 | /** |
| 3507 | * sensor_value_set_heatbeat: (skip) |
| 3508 | * @object: A #SensorValue. |
| 3509 | * @value: The value to set. |
| 3510 | * |
| 3511 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 3512 | * |
| 3513 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3514 | */ |
| 3515 | void |
| 3516 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
| 3517 | { |
| 3518 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 3519 | } |
| 3520 | |
| 3521 | /** |
| 3522 | * sensor_value_get_settable: (skip) |
| 3523 | * @object: A #SensorValue. |
| 3524 | * |
| 3525 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. |
| 3526 | * |
| 3527 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3528 | * |
| 3529 | * Returns: The property value. |
| 3530 | */ |
| 3531 | gboolean |
| 3532 | sensor_value_get_settable (SensorValue *object) |
| 3533 | { |
| 3534 | return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); |
| 3535 | } |
| 3536 | |
| 3537 | /** |
| 3538 | * sensor_value_set_settable: (skip) |
| 3539 | * @object: A #SensorValue. |
| 3540 | * @value: The value to set. |
| 3541 | * |
| 3542 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. |
| 3543 | * |
| 3544 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3545 | */ |
| 3546 | void |
| 3547 | sensor_value_set_settable (SensorValue *object, gboolean value) |
| 3548 | { |
| 3549 | g_object_set (G_OBJECT (object), "settable", value, NULL); |
| 3550 | } |
| 3551 | |
| 3552 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3553 | * sensor_value_emit_changed: |
| 3554 | * @object: A #SensorValue. |
| 3555 | * @arg_value: Argument to pass with the signal. |
| 3556 | * @arg_units: Argument to pass with the signal. |
| 3557 | * |
| 3558 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. |
| 3559 | */ |
| 3560 | void |
| 3561 | sensor_value_emit_changed ( |
| 3562 | SensorValue *object, |
| 3563 | GVariant *arg_value, |
| 3564 | const gchar *arg_units) |
| 3565 | { |
| 3566 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
| 3567 | } |
| 3568 | |
| 3569 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 3570 | * sensor_value_emit_error: |
| 3571 | * @object: A #SensorValue. |
| 3572 | * |
| 3573 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal. |
| 3574 | */ |
| 3575 | void |
| 3576 | sensor_value_emit_error ( |
| 3577 | SensorValue *object) |
| 3578 | { |
| 3579 | g_signal_emit_by_name (object, "error"); |
| 3580 | } |
| 3581 | |
| 3582 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3583 | * sensor_value_emit_heartbeat: |
| 3584 | * @object: A #SensorValue. |
| 3585 | * @arg_bus_name: Argument to pass with the signal. |
| 3586 | * |
| 3587 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 3588 | */ |
| 3589 | void |
| 3590 | sensor_value_emit_heartbeat ( |
| 3591 | SensorValue *object, |
| 3592 | const gchar *arg_bus_name) |
| 3593 | { |
| 3594 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 3595 | } |
| 3596 | |
| 3597 | /** |
| 3598 | * sensor_value_call_init: |
| 3599 | * @proxy: A #SensorValueProxy. |
| 3600 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3601 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 3602 | * @user_data: User data to pass to @callback. |
| 3603 | * |
| 3604 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. |
| 3605 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 3606 | * You can then call sensor_value_call_init_finish() to get the result of the operation. |
| 3607 | * |
| 3608 | * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. |
| 3609 | */ |
| 3610 | void |
| 3611 | sensor_value_call_init ( |
| 3612 | SensorValue *proxy, |
| 3613 | GCancellable *cancellable, |
| 3614 | GAsyncReadyCallback callback, |
| 3615 | gpointer user_data) |
| 3616 | { |
| 3617 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 3618 | "init", |
| 3619 | g_variant_new ("()"), |
| 3620 | G_DBUS_CALL_FLAGS_NONE, |
| 3621 | -1, |
| 3622 | cancellable, |
| 3623 | callback, |
| 3624 | user_data); |
| 3625 | } |
| 3626 | |
| 3627 | /** |
| 3628 | * sensor_value_call_init_finish: |
| 3629 | * @proxy: A #SensorValueProxy. |
| 3630 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). |
| 3631 | * @error: Return location for error or %NULL. |
| 3632 | * |
| 3633 | * Finishes an operation started with sensor_value_call_init(). |
| 3634 | * |
| 3635 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3636 | */ |
| 3637 | gboolean |
| 3638 | sensor_value_call_init_finish ( |
| 3639 | SensorValue *proxy, |
| 3640 | GAsyncResult *res, |
| 3641 | GError **error) |
| 3642 | { |
| 3643 | GVariant *_ret; |
| 3644 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3645 | if (_ret == NULL) |
| 3646 | goto _out; |
| 3647 | g_variant_get (_ret, |
| 3648 | "()"); |
| 3649 | g_variant_unref (_ret); |
| 3650 | _out: |
| 3651 | return _ret != NULL; |
| 3652 | } |
| 3653 | |
| 3654 | /** |
| 3655 | * sensor_value_call_init_sync: |
| 3656 | * @proxy: A #SensorValueProxy. |
| 3657 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3658 | * @error: Return location for error or %NULL. |
| 3659 | * |
| 3660 | * 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. |
| 3661 | * |
| 3662 | * See sensor_value_call_init() for the asynchronous version of this method. |
| 3663 | * |
| 3664 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3665 | */ |
| 3666 | gboolean |
| 3667 | sensor_value_call_init_sync ( |
| 3668 | SensorValue *proxy, |
| 3669 | GCancellable *cancellable, |
| 3670 | GError **error) |
| 3671 | { |
| 3672 | GVariant *_ret; |
| 3673 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3674 | "init", |
| 3675 | g_variant_new ("()"), |
| 3676 | G_DBUS_CALL_FLAGS_NONE, |
| 3677 | -1, |
| 3678 | cancellable, |
| 3679 | error); |
| 3680 | if (_ret == NULL) |
| 3681 | goto _out; |
| 3682 | g_variant_get (_ret, |
| 3683 | "()"); |
| 3684 | g_variant_unref (_ret); |
| 3685 | _out: |
| 3686 | return _ret != NULL; |
| 3687 | } |
| 3688 | |
| 3689 | /** |
| 3690 | * sensor_value_call_get_value: |
| 3691 | * @proxy: A #SensorValueProxy. |
| 3692 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3693 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 3694 | * @user_data: User data to pass to @callback. |
| 3695 | * |
| 3696 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. |
| 3697 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 3698 | * You can then call sensor_value_call_get_value_finish() to get the result of the operation. |
| 3699 | * |
| 3700 | * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. |
| 3701 | */ |
| 3702 | void |
| 3703 | sensor_value_call_get_value ( |
| 3704 | SensorValue *proxy, |
| 3705 | GCancellable *cancellable, |
| 3706 | GAsyncReadyCallback callback, |
| 3707 | gpointer user_data) |
| 3708 | { |
| 3709 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 3710 | "getValue", |
| 3711 | g_variant_new ("()"), |
| 3712 | G_DBUS_CALL_FLAGS_NONE, |
| 3713 | -1, |
| 3714 | cancellable, |
| 3715 | callback, |
| 3716 | user_data); |
| 3717 | } |
| 3718 | |
| 3719 | /** |
| 3720 | * sensor_value_call_get_value_finish: |
| 3721 | * @proxy: A #SensorValueProxy. |
| 3722 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 3723 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). |
| 3724 | * @error: Return location for error or %NULL. |
| 3725 | * |
| 3726 | * Finishes an operation started with sensor_value_call_get_value(). |
| 3727 | * |
| 3728 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3729 | */ |
| 3730 | gboolean |
| 3731 | sensor_value_call_get_value_finish ( |
| 3732 | SensorValue *proxy, |
| 3733 | GVariant **out_value, |
| 3734 | GAsyncResult *res, |
| 3735 | GError **error) |
| 3736 | { |
| 3737 | GVariant *_ret; |
| 3738 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3739 | if (_ret == NULL) |
| 3740 | goto _out; |
| 3741 | g_variant_get (_ret, |
| 3742 | "(@v)", |
| 3743 | out_value); |
| 3744 | g_variant_unref (_ret); |
| 3745 | _out: |
| 3746 | return _ret != NULL; |
| 3747 | } |
| 3748 | |
| 3749 | /** |
| 3750 | * sensor_value_call_get_value_sync: |
| 3751 | * @proxy: A #SensorValueProxy. |
| 3752 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 3753 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3754 | * @error: Return location for error or %NULL. |
| 3755 | * |
| 3756 | * 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. |
| 3757 | * |
| 3758 | * See sensor_value_call_get_value() for the asynchronous version of this method. |
| 3759 | * |
| 3760 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3761 | */ |
| 3762 | gboolean |
| 3763 | sensor_value_call_get_value_sync ( |
| 3764 | SensorValue *proxy, |
| 3765 | GVariant **out_value, |
| 3766 | GCancellable *cancellable, |
| 3767 | GError **error) |
| 3768 | { |
| 3769 | GVariant *_ret; |
| 3770 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3771 | "getValue", |
| 3772 | g_variant_new ("()"), |
| 3773 | G_DBUS_CALL_FLAGS_NONE, |
| 3774 | -1, |
| 3775 | cancellable, |
| 3776 | error); |
| 3777 | if (_ret == NULL) |
| 3778 | goto _out; |
| 3779 | g_variant_get (_ret, |
| 3780 | "(@v)", |
| 3781 | out_value); |
| 3782 | g_variant_unref (_ret); |
| 3783 | _out: |
| 3784 | return _ret != NULL; |
| 3785 | } |
| 3786 | |
| 3787 | /** |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 3788 | * sensor_value_call_set_value: |
| 3789 | * @proxy: A #SensorValueProxy. |
| 3790 | * @arg_value: Argument to pass with the method invocation. |
| 3791 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3792 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 3793 | * @user_data: User data to pass to @callback. |
| 3794 | * |
| 3795 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. |
| 3796 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 3797 | * You can then call sensor_value_call_set_value_finish() to get the result of the operation. |
| 3798 | * |
| 3799 | * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. |
| 3800 | */ |
| 3801 | void |
| 3802 | sensor_value_call_set_value ( |
| 3803 | SensorValue *proxy, |
| 3804 | GVariant *arg_value, |
| 3805 | GCancellable *cancellable, |
| 3806 | GAsyncReadyCallback callback, |
| 3807 | gpointer user_data) |
| 3808 | { |
| 3809 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 3810 | "setValue", |
| 3811 | g_variant_new ("(@v)", |
| 3812 | arg_value), |
| 3813 | G_DBUS_CALL_FLAGS_NONE, |
| 3814 | -1, |
| 3815 | cancellable, |
| 3816 | callback, |
| 3817 | user_data); |
| 3818 | } |
| 3819 | |
| 3820 | /** |
| 3821 | * sensor_value_call_set_value_finish: |
| 3822 | * @proxy: A #SensorValueProxy. |
| 3823 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). |
| 3824 | * @error: Return location for error or %NULL. |
| 3825 | * |
| 3826 | * Finishes an operation started with sensor_value_call_set_value(). |
| 3827 | * |
| 3828 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3829 | */ |
| 3830 | gboolean |
| 3831 | sensor_value_call_set_value_finish ( |
| 3832 | SensorValue *proxy, |
| 3833 | GAsyncResult *res, |
| 3834 | GError **error) |
| 3835 | { |
| 3836 | GVariant *_ret; |
| 3837 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3838 | if (_ret == NULL) |
| 3839 | goto _out; |
| 3840 | g_variant_get (_ret, |
| 3841 | "()"); |
| 3842 | g_variant_unref (_ret); |
| 3843 | _out: |
| 3844 | return _ret != NULL; |
| 3845 | } |
| 3846 | |
| 3847 | /** |
| 3848 | * sensor_value_call_set_value_sync: |
| 3849 | * @proxy: A #SensorValueProxy. |
| 3850 | * @arg_value: Argument to pass with the method invocation. |
| 3851 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3852 | * @error: Return location for error or %NULL. |
| 3853 | * |
| 3854 | * 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. |
| 3855 | * |
| 3856 | * See sensor_value_call_set_value() for the asynchronous version of this method. |
| 3857 | * |
| 3858 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3859 | */ |
| 3860 | gboolean |
| 3861 | sensor_value_call_set_value_sync ( |
| 3862 | SensorValue *proxy, |
| 3863 | GVariant *arg_value, |
| 3864 | GCancellable *cancellable, |
| 3865 | GError **error) |
| 3866 | { |
| 3867 | GVariant *_ret; |
| 3868 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3869 | "setValue", |
| 3870 | g_variant_new ("(@v)", |
| 3871 | arg_value), |
| 3872 | G_DBUS_CALL_FLAGS_NONE, |
| 3873 | -1, |
| 3874 | cancellable, |
| 3875 | error); |
| 3876 | if (_ret == NULL) |
| 3877 | goto _out; |
| 3878 | g_variant_get (_ret, |
| 3879 | "()"); |
| 3880 | g_variant_unref (_ret); |
| 3881 | _out: |
| 3882 | return _ret != NULL; |
| 3883 | } |
| 3884 | |
| 3885 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3886 | * sensor_value_complete_init: |
| 3887 | * @object: A #SensorValue. |
| 3888 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3889 | * |
| 3890 | * 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. |
| 3891 | * |
| 3892 | * This method will free @invocation, you cannot use it afterwards. |
| 3893 | */ |
| 3894 | void |
| 3895 | sensor_value_complete_init ( |
| 3896 | SensorValue *object, |
| 3897 | GDBusMethodInvocation *invocation) |
| 3898 | { |
| 3899 | g_dbus_method_invocation_return_value (invocation, |
| 3900 | g_variant_new ("()")); |
| 3901 | } |
| 3902 | |
| 3903 | /** |
| 3904 | * sensor_value_complete_get_value: |
| 3905 | * @object: A #SensorValue. |
| 3906 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3907 | * @value: Parameter to return. |
| 3908 | * |
| 3909 | * 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. |
| 3910 | * |
| 3911 | * This method will free @invocation, you cannot use it afterwards. |
| 3912 | */ |
| 3913 | void |
| 3914 | sensor_value_complete_get_value ( |
| 3915 | SensorValue *object, |
| 3916 | GDBusMethodInvocation *invocation, |
| 3917 | GVariant *value) |
| 3918 | { |
| 3919 | g_dbus_method_invocation_return_value (invocation, |
| 3920 | g_variant_new ("(@v)", |
| 3921 | value)); |
| 3922 | } |
| 3923 | |
Norman James | 19e4591 | 2015-10-04 20:19:41 -0500 | [diff] [blame] | 3924 | /** |
| 3925 | * sensor_value_complete_set_value: |
| 3926 | * @object: A #SensorValue. |
| 3927 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3928 | * |
| 3929 | * 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. |
| 3930 | * |
| 3931 | * This method will free @invocation, you cannot use it afterwards. |
| 3932 | */ |
| 3933 | void |
| 3934 | sensor_value_complete_set_value ( |
| 3935 | SensorValue *object, |
| 3936 | GDBusMethodInvocation *invocation) |
| 3937 | { |
| 3938 | g_dbus_method_invocation_return_value (invocation, |
| 3939 | g_variant_new ("()")); |
| 3940 | } |
| 3941 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3942 | /* ------------------------------------------------------------------------ */ |
| 3943 | |
| 3944 | /** |
| 3945 | * SensorValueProxy: |
| 3946 | * |
| 3947 | * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. |
| 3948 | */ |
| 3949 | |
| 3950 | /** |
| 3951 | * SensorValueProxyClass: |
| 3952 | * @parent_class: The parent class. |
| 3953 | * |
| 3954 | * Class structure for #SensorValueProxy. |
| 3955 | */ |
| 3956 | |
| 3957 | struct _SensorValueProxyPrivate |
| 3958 | { |
| 3959 | GData *qdata; |
| 3960 | }; |
| 3961 | |
| 3962 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
| 3963 | |
| 3964 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3965 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 3966 | G_ADD_PRIVATE (SensorValueProxy) |
| 3967 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 3968 | |
| 3969 | #else |
| 3970 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 3971 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
| 3972 | |
| 3973 | #endif |
| 3974 | static void |
| 3975 | sensor_value_proxy_finalize (GObject *object) |
| 3976 | { |
| 3977 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 3978 | g_datalist_clear (&proxy->priv->qdata); |
| 3979 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
| 3980 | } |
| 3981 | |
| 3982 | static void |
| 3983 | sensor_value_proxy_get_property (GObject *object, |
| 3984 | guint prop_id, |
| 3985 | GValue *value, |
| 3986 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3987 | { |
| 3988 | const _ExtendedGDBusPropertyInfo *info; |
| 3989 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 3990 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 3991 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 3992 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3993 | if (info->use_gvariant) |
| 3994 | { |
| 3995 | g_value_set_variant (value, variant); |
| 3996 | } |
| 3997 | else |
| 3998 | { |
| 3999 | if (variant != NULL) |
| 4000 | g_dbus_gvariant_to_gvalue (variant, value); |
| 4001 | } |
| 4002 | if (variant != NULL) |
| 4003 | g_variant_unref (variant); |
| 4004 | } |
| 4005 | |
| 4006 | static void |
| 4007 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
| 4008 | GAsyncResult *res, |
| 4009 | gpointer user_data) |
| 4010 | { |
| 4011 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 4012 | GError *error; |
| 4013 | GVariant *_ret; |
| 4014 | error = NULL; |
| 4015 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 4016 | if (!_ret) |
| 4017 | { |
| 4018 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", |
| 4019 | info->parent_struct.name, |
| 4020 | error->message, g_quark_to_string (error->domain), error->code); |
| 4021 | g_error_free (error); |
| 4022 | } |
| 4023 | else |
| 4024 | { |
| 4025 | g_variant_unref (_ret); |
| 4026 | } |
| 4027 | } |
| 4028 | |
| 4029 | static void |
| 4030 | sensor_value_proxy_set_property (GObject *object, |
| 4031 | guint prop_id, |
| 4032 | const GValue *value, |
| 4033 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4034 | { |
| 4035 | const _ExtendedGDBusPropertyInfo *info; |
| 4036 | GVariant *variant; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4037 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4038 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
| 4039 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4040 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 4041 | "org.freedesktop.DBus.Properties.Set", |
| 4042 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
| 4043 | G_DBUS_CALL_FLAGS_NONE, |
| 4044 | -1, |
| 4045 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 4046 | g_variant_unref (variant); |
| 4047 | } |
| 4048 | |
| 4049 | static void |
| 4050 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
| 4051 | const gchar *sender_name G_GNUC_UNUSED, |
| 4052 | const gchar *signal_name, |
| 4053 | GVariant *parameters) |
| 4054 | { |
| 4055 | _ExtendedGDBusSignalInfo *info; |
| 4056 | GVariantIter iter; |
| 4057 | GVariant *child; |
| 4058 | GValue *paramv; |
| 4059 | guint num_params; |
| 4060 | guint n; |
| 4061 | guint signal_id; |
| 4062 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); |
| 4063 | if (info == NULL) |
| 4064 | return; |
| 4065 | num_params = g_variant_n_children (parameters); |
| 4066 | paramv = g_new0 (GValue, num_params + 1); |
| 4067 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
| 4068 | g_value_set_object (¶mv[0], proxy); |
| 4069 | g_variant_iter_init (&iter, parameters); |
| 4070 | n = 1; |
| 4071 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4072 | { |
| 4073 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 4074 | if (arg_info->use_gvariant) |
| 4075 | { |
| 4076 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4077 | g_value_set_variant (¶mv[n], child); |
| 4078 | n++; |
| 4079 | } |
| 4080 | else |
| 4081 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4082 | g_variant_unref (child); |
| 4083 | } |
| 4084 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 4085 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 4086 | for (n = 0; n < num_params + 1; n++) |
| 4087 | g_value_unset (¶mv[n]); |
| 4088 | g_free (paramv); |
| 4089 | } |
| 4090 | |
| 4091 | static void |
| 4092 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 4093 | GVariant *changed_properties, |
| 4094 | const gchar *const *invalidated_properties) |
| 4095 | { |
| 4096 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
| 4097 | guint n; |
| 4098 | const gchar *key; |
| 4099 | GVariantIter *iter; |
| 4100 | _ExtendedGDBusPropertyInfo *info; |
| 4101 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 4102 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 4103 | { |
| 4104 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); |
| 4105 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 4106 | if (info != NULL) |
| 4107 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4108 | } |
| 4109 | g_variant_iter_free (iter); |
| 4110 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 4111 | { |
| 4112 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); |
| 4113 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 4114 | if (info != NULL) |
| 4115 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4116 | } |
| 4117 | } |
| 4118 | |
| 4119 | static GVariant * |
| 4120 | sensor_value_proxy_get_value (SensorValue *object) |
| 4121 | { |
| 4122 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4123 | GVariant *variant; |
| 4124 | GVariant *value = NULL; |
| 4125 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 4126 | value = variant; |
| 4127 | if (variant != NULL) |
| 4128 | g_variant_unref (variant); |
| 4129 | return value; |
| 4130 | } |
| 4131 | |
| 4132 | static const gchar * |
| 4133 | sensor_value_proxy_get_units (SensorValue *object) |
| 4134 | { |
| 4135 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4136 | GVariant *variant; |
| 4137 | const gchar *value = NULL; |
| 4138 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 4139 | if (variant != NULL) |
| 4140 | { |
| 4141 | value = g_variant_get_string (variant, NULL); |
| 4142 | g_variant_unref (variant); |
| 4143 | } |
| 4144 | return value; |
| 4145 | } |
| 4146 | |
| 4147 | static gint |
| 4148 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
| 4149 | { |
| 4150 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4151 | GVariant *variant; |
| 4152 | gint value = 0; |
| 4153 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 4154 | if (variant != NULL) |
| 4155 | { |
| 4156 | value = g_variant_get_int32 (variant); |
| 4157 | g_variant_unref (variant); |
| 4158 | } |
| 4159 | return value; |
| 4160 | } |
| 4161 | |
| 4162 | static gint |
| 4163 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
| 4164 | { |
| 4165 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4166 | GVariant *variant; |
| 4167 | gint value = 0; |
| 4168 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 4169 | if (variant != NULL) |
| 4170 | { |
| 4171 | value = g_variant_get_int32 (variant); |
| 4172 | g_variant_unref (variant); |
| 4173 | } |
| 4174 | return value; |
| 4175 | } |
| 4176 | |
| 4177 | static gboolean |
| 4178 | sensor_value_proxy_get_settable (SensorValue *object) |
| 4179 | { |
| 4180 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 4181 | GVariant *variant; |
| 4182 | gboolean value = 0; |
| 4183 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); |
| 4184 | if (variant != NULL) |
| 4185 | { |
| 4186 | value = g_variant_get_boolean (variant); |
| 4187 | g_variant_unref (variant); |
| 4188 | } |
| 4189 | return value; |
| 4190 | } |
| 4191 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4192 | static void |
| 4193 | sensor_value_proxy_init (SensorValueProxy *proxy) |
| 4194 | { |
| 4195 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4196 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
| 4197 | #else |
| 4198 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); |
| 4199 | #endif |
| 4200 | |
| 4201 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); |
| 4202 | } |
| 4203 | |
| 4204 | static void |
| 4205 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
| 4206 | { |
| 4207 | GObjectClass *gobject_class; |
| 4208 | GDBusProxyClass *proxy_class; |
| 4209 | |
| 4210 | gobject_class = G_OBJECT_CLASS (klass); |
| 4211 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 4212 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 4213 | gobject_class->set_property = sensor_value_proxy_set_property; |
| 4214 | |
| 4215 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 4216 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 4217 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
| 4218 | |
| 4219 | sensor_value_override_properties (gobject_class, 1); |
| 4220 | |
| 4221 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4222 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
| 4223 | #endif |
| 4224 | } |
| 4225 | |
| 4226 | static void |
| 4227 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
| 4228 | { |
| 4229 | iface->get_value = sensor_value_proxy_get_value; |
| 4230 | iface->get_units = sensor_value_proxy_get_units; |
| 4231 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 4232 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
| 4233 | iface->get_settable = sensor_value_proxy_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4234 | } |
| 4235 | |
| 4236 | /** |
| 4237 | * sensor_value_proxy_new: |
| 4238 | * @connection: A #GDBusConnection. |
| 4239 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4240 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4241 | * @object_path: An object path. |
| 4242 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4243 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4244 | * @user_data: User data to pass to @callback. |
| 4245 | * |
| 4246 | * 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. |
| 4247 | * |
| 4248 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4249 | * You can then call sensor_value_proxy_new_finish() to get the result of the operation. |
| 4250 | * |
| 4251 | * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 4252 | */ |
| 4253 | void |
| 4254 | sensor_value_proxy_new ( |
| 4255 | GDBusConnection *connection, |
| 4256 | GDBusProxyFlags flags, |
| 4257 | const gchar *name, |
| 4258 | const gchar *object_path, |
| 4259 | GCancellable *cancellable, |
| 4260 | GAsyncReadyCallback callback, |
| 4261 | gpointer user_data) |
| 4262 | { |
| 4263 | 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); |
| 4264 | } |
| 4265 | |
| 4266 | /** |
| 4267 | * sensor_value_proxy_new_finish: |
| 4268 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). |
| 4269 | * @error: Return location for error or %NULL |
| 4270 | * |
| 4271 | * Finishes an operation started with sensor_value_proxy_new(). |
| 4272 | * |
| 4273 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 4274 | */ |
| 4275 | SensorValue * |
| 4276 | sensor_value_proxy_new_finish ( |
| 4277 | GAsyncResult *res, |
| 4278 | GError **error) |
| 4279 | { |
| 4280 | GObject *ret; |
| 4281 | GObject *source_object; |
| 4282 | source_object = g_async_result_get_source_object (res); |
| 4283 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4284 | g_object_unref (source_object); |
| 4285 | if (ret != NULL) |
| 4286 | return SENSOR_VALUE (ret); |
| 4287 | else |
| 4288 | return NULL; |
| 4289 | } |
| 4290 | |
| 4291 | /** |
| 4292 | * sensor_value_proxy_new_sync: |
| 4293 | * @connection: A #GDBusConnection. |
| 4294 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4295 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4296 | * @object_path: An object path. |
| 4297 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4298 | * @error: Return location for error or %NULL |
| 4299 | * |
| 4300 | * 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. |
| 4301 | * |
| 4302 | * The calling thread is blocked until a reply is received. |
| 4303 | * |
| 4304 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
| 4305 | * |
| 4306 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 4307 | */ |
| 4308 | SensorValue * |
| 4309 | sensor_value_proxy_new_sync ( |
| 4310 | GDBusConnection *connection, |
| 4311 | GDBusProxyFlags flags, |
| 4312 | const gchar *name, |
| 4313 | const gchar *object_path, |
| 4314 | GCancellable *cancellable, |
| 4315 | GError **error) |
| 4316 | { |
| 4317 | GInitable *ret; |
| 4318 | 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); |
| 4319 | if (ret != NULL) |
| 4320 | return SENSOR_VALUE (ret); |
| 4321 | else |
| 4322 | return NULL; |
| 4323 | } |
| 4324 | |
| 4325 | |
| 4326 | /** |
| 4327 | * sensor_value_proxy_new_for_bus: |
| 4328 | * @bus_type: A #GBusType. |
| 4329 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4330 | * @name: A bus name (well-known or unique). |
| 4331 | * @object_path: An object path. |
| 4332 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4333 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4334 | * @user_data: User data to pass to @callback. |
| 4335 | * |
| 4336 | * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 4337 | * |
| 4338 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4339 | * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. |
| 4340 | * |
| 4341 | * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 4342 | */ |
| 4343 | void |
| 4344 | sensor_value_proxy_new_for_bus ( |
| 4345 | GBusType bus_type, |
| 4346 | GDBusProxyFlags flags, |
| 4347 | const gchar *name, |
| 4348 | const gchar *object_path, |
| 4349 | GCancellable *cancellable, |
| 4350 | GAsyncReadyCallback callback, |
| 4351 | gpointer user_data) |
| 4352 | { |
| 4353 | 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); |
| 4354 | } |
| 4355 | |
| 4356 | /** |
| 4357 | * sensor_value_proxy_new_for_bus_finish: |
| 4358 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). |
| 4359 | * @error: Return location for error or %NULL |
| 4360 | * |
| 4361 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
| 4362 | * |
| 4363 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 4364 | */ |
| 4365 | SensorValue * |
| 4366 | sensor_value_proxy_new_for_bus_finish ( |
| 4367 | GAsyncResult *res, |
| 4368 | GError **error) |
| 4369 | { |
| 4370 | GObject *ret; |
| 4371 | GObject *source_object; |
| 4372 | source_object = g_async_result_get_source_object (res); |
| 4373 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4374 | g_object_unref (source_object); |
| 4375 | if (ret != NULL) |
| 4376 | return SENSOR_VALUE (ret); |
| 4377 | else |
| 4378 | return NULL; |
| 4379 | } |
| 4380 | |
| 4381 | /** |
| 4382 | * sensor_value_proxy_new_for_bus_sync: |
| 4383 | * @bus_type: A #GBusType. |
| 4384 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4385 | * @name: A bus name (well-known or unique). |
| 4386 | * @object_path: An object path. |
| 4387 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4388 | * @error: Return location for error or %NULL |
| 4389 | * |
| 4390 | * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 4391 | * |
| 4392 | * The calling thread is blocked until a reply is received. |
| 4393 | * |
| 4394 | * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 4395 | * |
| 4396 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
| 4397 | */ |
| 4398 | SensorValue * |
| 4399 | sensor_value_proxy_new_for_bus_sync ( |
| 4400 | GBusType bus_type, |
| 4401 | GDBusProxyFlags flags, |
| 4402 | const gchar *name, |
| 4403 | const gchar *object_path, |
| 4404 | GCancellable *cancellable, |
| 4405 | GError **error) |
| 4406 | { |
| 4407 | GInitable *ret; |
| 4408 | 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); |
| 4409 | if (ret != NULL) |
| 4410 | return SENSOR_VALUE (ret); |
| 4411 | else |
| 4412 | return NULL; |
| 4413 | } |
| 4414 | |
| 4415 | |
| 4416 | /* ------------------------------------------------------------------------ */ |
| 4417 | |
| 4418 | /** |
| 4419 | * SensorValueSkeleton: |
| 4420 | * |
| 4421 | * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. |
| 4422 | */ |
| 4423 | |
| 4424 | /** |
| 4425 | * SensorValueSkeletonClass: |
| 4426 | * @parent_class: The parent class. |
| 4427 | * |
| 4428 | * Class structure for #SensorValueSkeleton. |
| 4429 | */ |
| 4430 | |
| 4431 | struct _SensorValueSkeletonPrivate |
| 4432 | { |
| 4433 | GValue *properties; |
| 4434 | GList *changed_properties; |
| 4435 | GSource *changed_properties_idle_source; |
| 4436 | GMainContext *context; |
| 4437 | GMutex lock; |
| 4438 | }; |
| 4439 | |
| 4440 | static void |
| 4441 | _sensor_value_skeleton_handle_method_call ( |
| 4442 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4443 | const gchar *sender G_GNUC_UNUSED, |
| 4444 | const gchar *object_path G_GNUC_UNUSED, |
| 4445 | const gchar *interface_name, |
| 4446 | const gchar *method_name, |
| 4447 | GVariant *parameters, |
| 4448 | GDBusMethodInvocation *invocation, |
| 4449 | gpointer user_data) |
| 4450 | { |
| 4451 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 4452 | _ExtendedGDBusMethodInfo *info; |
| 4453 | GVariantIter iter; |
| 4454 | GVariant *child; |
| 4455 | GValue *paramv; |
| 4456 | guint num_params; |
| 4457 | guint num_extra; |
| 4458 | guint n; |
| 4459 | guint signal_id; |
| 4460 | GValue return_value = G_VALUE_INIT; |
| 4461 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 4462 | g_assert (info != NULL); |
| 4463 | num_params = g_variant_n_children (parameters); |
| 4464 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 4465 | n = 0; |
| 4466 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
| 4467 | g_value_set_object (¶mv[n++], skeleton); |
| 4468 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 4469 | g_value_set_object (¶mv[n++], invocation); |
| 4470 | if (info->pass_fdlist) |
| 4471 | { |
| 4472 | #ifdef G_OS_UNIX |
| 4473 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 4474 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 4475 | #else |
| 4476 | g_assert_not_reached (); |
| 4477 | #endif |
| 4478 | } |
| 4479 | g_variant_iter_init (&iter, parameters); |
| 4480 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4481 | { |
| 4482 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 4483 | if (arg_info->use_gvariant) |
| 4484 | { |
| 4485 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4486 | g_value_set_variant (¶mv[n], child); |
| 4487 | n++; |
| 4488 | } |
| 4489 | else |
| 4490 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4491 | g_variant_unref (child); |
| 4492 | } |
| 4493 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
| 4494 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 4495 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 4496 | if (!g_value_get_boolean (&return_value)) |
| 4497 | 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); |
| 4498 | g_value_unset (&return_value); |
| 4499 | for (n = 0; n < num_params + num_extra; n++) |
| 4500 | g_value_unset (¶mv[n]); |
| 4501 | g_free (paramv); |
| 4502 | } |
| 4503 | |
| 4504 | static GVariant * |
| 4505 | _sensor_value_skeleton_handle_get_property ( |
| 4506 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4507 | const gchar *sender G_GNUC_UNUSED, |
| 4508 | const gchar *object_path G_GNUC_UNUSED, |
| 4509 | const gchar *interface_name G_GNUC_UNUSED, |
| 4510 | const gchar *property_name, |
| 4511 | GError **error, |
| 4512 | gpointer user_data) |
| 4513 | { |
| 4514 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 4515 | GValue value = G_VALUE_INIT; |
| 4516 | GParamSpec *pspec; |
| 4517 | _ExtendedGDBusPropertyInfo *info; |
| 4518 | GVariant *ret; |
| 4519 | ret = NULL; |
| 4520 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 4521 | g_assert (info != NULL); |
| 4522 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4523 | if (pspec == NULL) |
| 4524 | { |
| 4525 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4526 | } |
| 4527 | else |
| 4528 | { |
| 4529 | g_value_init (&value, pspec->value_type); |
| 4530 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4531 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4532 | g_value_unset (&value); |
| 4533 | } |
| 4534 | return ret; |
| 4535 | } |
| 4536 | |
| 4537 | static gboolean |
| 4538 | _sensor_value_skeleton_handle_set_property ( |
| 4539 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4540 | const gchar *sender G_GNUC_UNUSED, |
| 4541 | const gchar *object_path G_GNUC_UNUSED, |
| 4542 | const gchar *interface_name G_GNUC_UNUSED, |
| 4543 | const gchar *property_name, |
| 4544 | GVariant *variant, |
| 4545 | GError **error, |
| 4546 | gpointer user_data) |
| 4547 | { |
| 4548 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 4549 | GValue value = G_VALUE_INIT; |
| 4550 | GParamSpec *pspec; |
| 4551 | _ExtendedGDBusPropertyInfo *info; |
| 4552 | gboolean ret; |
| 4553 | ret = FALSE; |
| 4554 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
| 4555 | g_assert (info != NULL); |
| 4556 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4557 | if (pspec == NULL) |
| 4558 | { |
| 4559 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4560 | } |
| 4561 | else |
| 4562 | { |
| 4563 | if (info->use_gvariant) |
| 4564 | g_value_set_variant (&value, variant); |
| 4565 | else |
| 4566 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 4567 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4568 | g_value_unset (&value); |
| 4569 | ret = TRUE; |
| 4570 | } |
| 4571 | return ret; |
| 4572 | } |
| 4573 | |
| 4574 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
| 4575 | { |
| 4576 | _sensor_value_skeleton_handle_method_call, |
| 4577 | _sensor_value_skeleton_handle_get_property, |
| 4578 | _sensor_value_skeleton_handle_set_property, |
| 4579 | {NULL} |
| 4580 | }; |
| 4581 | |
| 4582 | static GDBusInterfaceInfo * |
| 4583 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4584 | { |
| 4585 | return sensor_value_interface_info (); |
| 4586 | } |
| 4587 | |
| 4588 | static GDBusInterfaceVTable * |
| 4589 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4590 | { |
| 4591 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
| 4592 | } |
| 4593 | |
| 4594 | static GVariant * |
| 4595 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 4596 | { |
| 4597 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 4598 | |
| 4599 | GVariantBuilder builder; |
| 4600 | guint n; |
| 4601 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4602 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
| 4603 | goto out; |
| 4604 | for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) |
| 4605 | { |
| 4606 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
| 4607 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 4608 | { |
| 4609 | GVariant *value; |
| 4610 | 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); |
| 4611 | if (value != NULL) |
| 4612 | { |
| 4613 | g_variant_take_ref (value); |
| 4614 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 4615 | g_variant_unref (value); |
| 4616 | } |
| 4617 | } |
| 4618 | } |
| 4619 | out: |
| 4620 | return g_variant_builder_end (&builder); |
| 4621 | } |
| 4622 | |
| 4623 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
| 4624 | |
| 4625 | static void |
| 4626 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 4627 | { |
| 4628 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
| 4629 | gboolean emit_changed = FALSE; |
| 4630 | |
| 4631 | g_mutex_lock (&skeleton->priv->lock); |
| 4632 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4633 | { |
| 4634 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4635 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4636 | emit_changed = TRUE; |
| 4637 | } |
| 4638 | g_mutex_unlock (&skeleton->priv->lock); |
| 4639 | |
| 4640 | if (emit_changed) |
| 4641 | _sensor_value_emit_changed (skeleton); |
| 4642 | } |
| 4643 | |
| 4644 | static void |
| 4645 | _sensor_value_on_signal_changed ( |
| 4646 | SensorValue *object, |
| 4647 | GVariant *arg_value, |
| 4648 | const gchar *arg_units) |
| 4649 | { |
| 4650 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4651 | |
| 4652 | GList *connections, *l; |
| 4653 | GVariant *signal_variant; |
| 4654 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4655 | |
| 4656 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
| 4657 | arg_value, |
| 4658 | arg_units)); |
| 4659 | for (l = connections; l != NULL; l = l->next) |
| 4660 | { |
| 4661 | GDBusConnection *connection = l->data; |
| 4662 | g_dbus_connection_emit_signal (connection, |
| 4663 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", |
| 4664 | signal_variant, NULL); |
| 4665 | } |
| 4666 | g_variant_unref (signal_variant); |
| 4667 | g_list_free_full (connections, g_object_unref); |
| 4668 | } |
| 4669 | |
| 4670 | static void |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4671 | _sensor_value_on_signal_error ( |
| 4672 | SensorValue *object) |
| 4673 | { |
| 4674 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4675 | |
| 4676 | GList *connections, *l; |
| 4677 | GVariant *signal_variant; |
| 4678 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4679 | |
| 4680 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 4681 | for (l = connections; l != NULL; l = l->next) |
| 4682 | { |
| 4683 | GDBusConnection *connection = l->data; |
| 4684 | g_dbus_connection_emit_signal (connection, |
| 4685 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error", |
| 4686 | signal_variant, NULL); |
| 4687 | } |
| 4688 | g_variant_unref (signal_variant); |
| 4689 | g_list_free_full (connections, g_object_unref); |
| 4690 | } |
| 4691 | |
| 4692 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4693 | _sensor_value_on_signal_heartbeat ( |
| 4694 | SensorValue *object, |
| 4695 | const gchar *arg_bus_name) |
| 4696 | { |
| 4697 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4698 | |
| 4699 | GList *connections, *l; |
| 4700 | GVariant *signal_variant; |
| 4701 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4702 | |
| 4703 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 4704 | arg_bus_name)); |
| 4705 | for (l = connections; l != NULL; l = l->next) |
| 4706 | { |
| 4707 | GDBusConnection *connection = l->data; |
| 4708 | g_dbus_connection_emit_signal (connection, |
| 4709 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", |
| 4710 | signal_variant, NULL); |
| 4711 | } |
| 4712 | g_variant_unref (signal_variant); |
| 4713 | g_list_free_full (connections, g_object_unref); |
| 4714 | } |
| 4715 | |
| 4716 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
| 4717 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4718 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4719 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 4720 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 4721 | |
| 4722 | #else |
| 4723 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4724 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
| 4725 | |
| 4726 | #endif |
| 4727 | static void |
| 4728 | sensor_value_skeleton_finalize (GObject *object) |
| 4729 | { |
| 4730 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4731 | guint n; |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4732 | for (n = 0; n < 5; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4733 | g_value_unset (&skeleton->priv->properties[n]); |
| 4734 | g_free (skeleton->priv->properties); |
| 4735 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4736 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4737 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4738 | g_main_context_unref (skeleton->priv->context); |
| 4739 | g_mutex_clear (&skeleton->priv->lock); |
| 4740 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
| 4741 | } |
| 4742 | |
| 4743 | static void |
| 4744 | sensor_value_skeleton_get_property (GObject *object, |
| 4745 | guint prop_id, |
| 4746 | GValue *value, |
| 4747 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4748 | { |
| 4749 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4750 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4751 | g_mutex_lock (&skeleton->priv->lock); |
| 4752 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 4753 | g_mutex_unlock (&skeleton->priv->lock); |
| 4754 | } |
| 4755 | |
| 4756 | static gboolean |
| 4757 | _sensor_value_emit_changed (gpointer user_data) |
| 4758 | { |
| 4759 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
| 4760 | GList *l; |
| 4761 | GVariantBuilder builder; |
| 4762 | GVariantBuilder invalidated_builder; |
| 4763 | guint num_changes; |
| 4764 | |
| 4765 | g_mutex_lock (&skeleton->priv->lock); |
| 4766 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4767 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 4768 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 4769 | { |
| 4770 | ChangedProperty *cp = l->data; |
| 4771 | GVariant *variant; |
| 4772 | const GValue *cur_value; |
| 4773 | |
| 4774 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 4775 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 4776 | { |
| 4777 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 4778 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 4779 | g_variant_unref (variant); |
| 4780 | num_changes++; |
| 4781 | } |
| 4782 | } |
| 4783 | if (num_changes > 0) |
| 4784 | { |
| 4785 | GList *connections, *ll; |
| 4786 | GVariant *signal_variant; |
| 4787 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", |
| 4788 | &builder, &invalidated_builder)); |
| 4789 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4790 | for (ll = connections; ll != NULL; ll = ll->next) |
| 4791 | { |
| 4792 | GDBusConnection *connection = ll->data; |
| 4793 | |
| 4794 | g_dbus_connection_emit_signal (connection, |
| 4795 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 4796 | "org.freedesktop.DBus.Properties", |
| 4797 | "PropertiesChanged", |
| 4798 | signal_variant, |
| 4799 | NULL); |
| 4800 | } |
| 4801 | g_variant_unref (signal_variant); |
| 4802 | g_list_free_full (connections, g_object_unref); |
| 4803 | } |
| 4804 | else |
| 4805 | { |
| 4806 | g_variant_builder_clear (&builder); |
| 4807 | g_variant_builder_clear (&invalidated_builder); |
| 4808 | } |
| 4809 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4810 | skeleton->priv->changed_properties = NULL; |
| 4811 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4812 | g_mutex_unlock (&skeleton->priv->lock); |
| 4813 | return FALSE; |
| 4814 | } |
| 4815 | |
| 4816 | static void |
| 4817 | _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 4818 | { |
| 4819 | ChangedProperty *cp; |
| 4820 | GList *l; |
| 4821 | cp = NULL; |
| 4822 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 4823 | { |
| 4824 | ChangedProperty *i_cp = l->data; |
| 4825 | if (i_cp->info == info) |
| 4826 | { |
| 4827 | cp = i_cp; |
| 4828 | break; |
| 4829 | } |
| 4830 | } |
| 4831 | if (cp == NULL) |
| 4832 | { |
| 4833 | cp = g_new0 (ChangedProperty, 1); |
| 4834 | cp->prop_id = prop_id; |
| 4835 | cp->info = info; |
| 4836 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 4837 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 4838 | g_value_copy (orig_value, &cp->orig_value); |
| 4839 | } |
| 4840 | } |
| 4841 | |
| 4842 | static void |
| 4843 | sensor_value_skeleton_notify (GObject *object, |
| 4844 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4845 | { |
| 4846 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4847 | g_mutex_lock (&skeleton->priv->lock); |
| 4848 | if (skeleton->priv->changed_properties != NULL && |
| 4849 | skeleton->priv->changed_properties_idle_source == NULL) |
| 4850 | { |
| 4851 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 4852 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 4853 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 4854 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 4855 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 4856 | } |
| 4857 | g_mutex_unlock (&skeleton->priv->lock); |
| 4858 | } |
| 4859 | |
| 4860 | static void |
| 4861 | sensor_value_skeleton_set_property (GObject *object, |
| 4862 | guint prop_id, |
| 4863 | const GValue *value, |
| 4864 | GParamSpec *pspec) |
| 4865 | { |
| 4866 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4867 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4868 | g_mutex_lock (&skeleton->priv->lock); |
| 4869 | g_object_freeze_notify (object); |
| 4870 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 4871 | { |
| 4872 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 4873 | _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 4874 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 4875 | g_object_notify_by_pspec (object, pspec); |
| 4876 | } |
| 4877 | g_mutex_unlock (&skeleton->priv->lock); |
| 4878 | g_object_thaw_notify (object); |
| 4879 | } |
| 4880 | |
| 4881 | static void |
| 4882 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
| 4883 | { |
| 4884 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4885 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
| 4886 | #else |
| 4887 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); |
| 4888 | #endif |
| 4889 | |
| 4890 | g_mutex_init (&skeleton->priv->lock); |
| 4891 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 4892 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4893 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 4894 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 4895 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 4896 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 4897 | g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4898 | } |
| 4899 | |
| 4900 | static GVariant * |
| 4901 | sensor_value_skeleton_get_value (SensorValue *object) |
| 4902 | { |
| 4903 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4904 | GVariant *value; |
| 4905 | g_mutex_lock (&skeleton->priv->lock); |
| 4906 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 4907 | g_mutex_unlock (&skeleton->priv->lock); |
| 4908 | return value; |
| 4909 | } |
| 4910 | |
| 4911 | static const gchar * |
| 4912 | sensor_value_skeleton_get_units (SensorValue *object) |
| 4913 | { |
| 4914 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4915 | const gchar *value; |
| 4916 | g_mutex_lock (&skeleton->priv->lock); |
| 4917 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 4918 | g_mutex_unlock (&skeleton->priv->lock); |
| 4919 | return value; |
| 4920 | } |
| 4921 | |
| 4922 | static gint |
| 4923 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
| 4924 | { |
| 4925 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4926 | gint value; |
| 4927 | g_mutex_lock (&skeleton->priv->lock); |
| 4928 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 4929 | g_mutex_unlock (&skeleton->priv->lock); |
| 4930 | return value; |
| 4931 | } |
| 4932 | |
| 4933 | static gint |
| 4934 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
| 4935 | { |
| 4936 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4937 | gint value; |
| 4938 | g_mutex_lock (&skeleton->priv->lock); |
| 4939 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 4940 | g_mutex_unlock (&skeleton->priv->lock); |
| 4941 | return value; |
| 4942 | } |
| 4943 | |
| 4944 | static gboolean |
| 4945 | sensor_value_skeleton_get_settable (SensorValue *object) |
| 4946 | { |
| 4947 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 4948 | gboolean value; |
| 4949 | g_mutex_lock (&skeleton->priv->lock); |
| 4950 | value = g_value_get_boolean (&(skeleton->priv->properties[4])); |
| 4951 | g_mutex_unlock (&skeleton->priv->lock); |
| 4952 | return value; |
| 4953 | } |
| 4954 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4955 | static void |
| 4956 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
| 4957 | { |
| 4958 | GObjectClass *gobject_class; |
| 4959 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 4960 | |
| 4961 | gobject_class = G_OBJECT_CLASS (klass); |
| 4962 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 4963 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 4964 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 4965 | gobject_class->notify = sensor_value_skeleton_notify; |
| 4966 | |
| 4967 | |
| 4968 | sensor_value_override_properties (gobject_class, 1); |
| 4969 | |
| 4970 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 4971 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 4972 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 4973 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 4974 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
| 4975 | |
| 4976 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4977 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
| 4978 | #endif |
| 4979 | } |
| 4980 | |
| 4981 | static void |
| 4982 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
| 4983 | { |
| 4984 | iface->changed = _sensor_value_on_signal_changed; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 4985 | iface->error = _sensor_value_on_signal_error; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4986 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 4987 | iface->get_value = sensor_value_skeleton_get_value; |
| 4988 | iface->get_units = sensor_value_skeleton_get_units; |
| 4989 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 4990 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
| 4991 | iface->get_settable = sensor_value_skeleton_get_settable; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 4992 | } |
| 4993 | |
| 4994 | /** |
| 4995 | * sensor_value_skeleton_new: |
| 4996 | * |
| 4997 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
| 4998 | * |
| 4999 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
| 5000 | */ |
| 5001 | SensorValue * |
| 5002 | sensor_value_skeleton_new (void) |
| 5003 | { |
| 5004 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
| 5005 | } |
| 5006 | |
| 5007 | /* ------------------------------------------------------------------------ |
| 5008 | * Code for interface org.openbmc.SensorThreshold |
| 5009 | * ------------------------------------------------------------------------ |
| 5010 | */ |
| 5011 | |
| 5012 | /** |
| 5013 | * SECTION:SensorThreshold |
| 5014 | * @title: SensorThreshold |
| 5015 | * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface |
| 5016 | * |
| 5017 | * 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. |
| 5018 | */ |
| 5019 | |
| 5020 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
| 5021 | |
| 5022 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
| 5023 | { |
| 5024 | { |
| 5025 | -1, |
| 5026 | (gchar *) "state", |
| 5027 | (gchar *) "y", |
| 5028 | NULL |
| 5029 | }, |
| 5030 | FALSE |
| 5031 | }; |
| 5032 | |
| 5033 | static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = |
| 5034 | { |
| 5035 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
| 5036 | NULL |
| 5037 | }; |
| 5038 | |
| 5039 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
| 5040 | { |
| 5041 | { |
| 5042 | -1, |
| 5043 | (gchar *) "getState", |
| 5044 | NULL, |
| 5045 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
| 5046 | NULL |
| 5047 | }, |
| 5048 | "handle-get-state", |
| 5049 | FALSE |
| 5050 | }; |
| 5051 | |
| 5052 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
| 5053 | { |
| 5054 | &_sensor_threshold_method_info_get_state, |
| 5055 | NULL |
| 5056 | }; |
| 5057 | |
| 5058 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
| 5059 | { |
| 5060 | { |
| 5061 | -1, |
| 5062 | (gchar *) "Warning", |
| 5063 | NULL, |
| 5064 | NULL |
| 5065 | }, |
| 5066 | "warning" |
| 5067 | }; |
| 5068 | |
| 5069 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
| 5070 | { |
| 5071 | { |
| 5072 | -1, |
| 5073 | (gchar *) "Critical", |
| 5074 | NULL, |
| 5075 | NULL |
| 5076 | }, |
| 5077 | "critical" |
| 5078 | }; |
| 5079 | |
| 5080 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
| 5081 | { |
| 5082 | { |
| 5083 | -1, |
| 5084 | (gchar *) "Normal", |
| 5085 | NULL, |
| 5086 | NULL |
| 5087 | }, |
| 5088 | "normal" |
| 5089 | }; |
| 5090 | |
| 5091 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
| 5092 | { |
| 5093 | &_sensor_threshold_signal_info_warning, |
| 5094 | &_sensor_threshold_signal_info_critical, |
| 5095 | &_sensor_threshold_signal_info_normal, |
| 5096 | NULL |
| 5097 | }; |
| 5098 | |
| 5099 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
| 5100 | { |
| 5101 | { |
| 5102 | -1, |
| 5103 | (gchar *) "lower_critical", |
| 5104 | (gchar *) "v", |
| 5105 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5106 | NULL |
| 5107 | }, |
| 5108 | "lower-critical", |
| 5109 | FALSE |
| 5110 | }; |
| 5111 | |
| 5112 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
| 5113 | { |
| 5114 | { |
| 5115 | -1, |
| 5116 | (gchar *) "lower_warning", |
| 5117 | (gchar *) "v", |
| 5118 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5119 | NULL |
| 5120 | }, |
| 5121 | "lower-warning", |
| 5122 | FALSE |
| 5123 | }; |
| 5124 | |
| 5125 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
| 5126 | { |
| 5127 | { |
| 5128 | -1, |
| 5129 | (gchar *) "upper_warning", |
| 5130 | (gchar *) "v", |
| 5131 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5132 | NULL |
| 5133 | }, |
| 5134 | "upper-warning", |
| 5135 | FALSE |
| 5136 | }; |
| 5137 | |
| 5138 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
| 5139 | { |
| 5140 | { |
| 5141 | -1, |
| 5142 | (gchar *) "upper_critical", |
| 5143 | (gchar *) "v", |
| 5144 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 5145 | NULL |
| 5146 | }, |
| 5147 | "upper-critical", |
| 5148 | FALSE |
| 5149 | }; |
| 5150 | |
| 5151 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
| 5152 | { |
| 5153 | { |
| 5154 | -1, |
| 5155 | (gchar *) "state", |
| 5156 | (gchar *) "y", |
| 5157 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5158 | NULL |
| 5159 | }, |
| 5160 | "state", |
| 5161 | FALSE |
| 5162 | }; |
| 5163 | |
| 5164 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
| 5165 | { |
| 5166 | &_sensor_threshold_property_info_lower_critical, |
| 5167 | &_sensor_threshold_property_info_lower_warning, |
| 5168 | &_sensor_threshold_property_info_upper_warning, |
| 5169 | &_sensor_threshold_property_info_upper_critical, |
| 5170 | &_sensor_threshold_property_info_state, |
| 5171 | NULL |
| 5172 | }; |
| 5173 | |
| 5174 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
| 5175 | { |
| 5176 | { |
| 5177 | -1, |
| 5178 | (gchar *) "org.openbmc.SensorThreshold", |
| 5179 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 5180 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 5181 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
| 5182 | NULL |
| 5183 | }, |
| 5184 | "sensor-threshold", |
| 5185 | }; |
| 5186 | |
| 5187 | |
| 5188 | /** |
| 5189 | * sensor_threshold_interface_info: |
| 5190 | * |
| 5191 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. |
| 5192 | * |
| 5193 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 5194 | */ |
| 5195 | GDBusInterfaceInfo * |
| 5196 | sensor_threshold_interface_info (void) |
| 5197 | { |
| 5198 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
| 5199 | } |
| 5200 | |
| 5201 | /** |
| 5202 | * sensor_threshold_override_properties: |
| 5203 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 5204 | * @property_id_begin: The property id to assign to the first overridden property. |
| 5205 | * |
| 5206 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
| 5207 | * The properties are overridden in the order they are defined. |
| 5208 | * |
| 5209 | * Returns: The last property id. |
| 5210 | */ |
| 5211 | guint |
| 5212 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 5213 | { |
| 5214 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 5215 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 5216 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 5217 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 5218 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 5219 | return property_id_begin - 1; |
| 5220 | } |
| 5221 | |
| 5222 | |
| 5223 | |
| 5224 | /** |
| 5225 | * SensorThreshold: |
| 5226 | * |
| 5227 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 5228 | */ |
| 5229 | |
| 5230 | /** |
| 5231 | * SensorThresholdIface: |
| 5232 | * @parent_iface: The parent interface. |
| 5233 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 5234 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 5235 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 5236 | * @get_state: Getter for the #SensorThreshold:state property. |
| 5237 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 5238 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 5239 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 5240 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 5241 | * @warning: Handler for the #SensorThreshold::warning signal. |
| 5242 | * |
| 5243 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 5244 | */ |
| 5245 | |
| 5246 | typedef SensorThresholdIface SensorThresholdInterface; |
| 5247 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
| 5248 | |
| 5249 | static void |
| 5250 | sensor_threshold_default_init (SensorThresholdIface *iface) |
| 5251 | { |
| 5252 | /* GObject signals for incoming D-Bus method calls: */ |
| 5253 | /** |
| 5254 | * SensorThreshold::handle-get-state: |
| 5255 | * @object: A #SensorThreshold. |
| 5256 | * @invocation: A #GDBusMethodInvocation. |
| 5257 | * |
| 5258 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. |
| 5259 | * |
| 5260 | * 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. |
| 5261 | * |
| 5262 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 5263 | */ |
| 5264 | g_signal_new ("handle-get-state", |
| 5265 | G_TYPE_FROM_INTERFACE (iface), |
| 5266 | G_SIGNAL_RUN_LAST, |
| 5267 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
| 5268 | g_signal_accumulator_true_handled, |
| 5269 | NULL, |
| 5270 | g_cclosure_marshal_generic, |
| 5271 | G_TYPE_BOOLEAN, |
| 5272 | 1, |
| 5273 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 5274 | |
| 5275 | /* GObject signals for received D-Bus signals: */ |
| 5276 | /** |
| 5277 | * SensorThreshold::warning: |
| 5278 | * @object: A #SensorThreshold. |
| 5279 | * |
| 5280 | * 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. |
| 5281 | * |
| 5282 | * 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. |
| 5283 | */ |
| 5284 | g_signal_new ("warning", |
| 5285 | G_TYPE_FROM_INTERFACE (iface), |
| 5286 | G_SIGNAL_RUN_LAST, |
| 5287 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
| 5288 | NULL, |
| 5289 | NULL, |
| 5290 | g_cclosure_marshal_generic, |
| 5291 | G_TYPE_NONE, |
| 5292 | 0); |
| 5293 | |
| 5294 | /** |
| 5295 | * SensorThreshold::critical: |
| 5296 | * @object: A #SensorThreshold. |
| 5297 | * |
| 5298 | * 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. |
| 5299 | * |
| 5300 | * 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. |
| 5301 | */ |
| 5302 | g_signal_new ("critical", |
| 5303 | G_TYPE_FROM_INTERFACE (iface), |
| 5304 | G_SIGNAL_RUN_LAST, |
| 5305 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
| 5306 | NULL, |
| 5307 | NULL, |
| 5308 | g_cclosure_marshal_generic, |
| 5309 | G_TYPE_NONE, |
| 5310 | 0); |
| 5311 | |
| 5312 | /** |
| 5313 | * SensorThreshold::normal: |
| 5314 | * @object: A #SensorThreshold. |
| 5315 | * |
| 5316 | * 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. |
| 5317 | * |
| 5318 | * 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. |
| 5319 | */ |
| 5320 | g_signal_new ("normal", |
| 5321 | G_TYPE_FROM_INTERFACE (iface), |
| 5322 | G_SIGNAL_RUN_LAST, |
| 5323 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
| 5324 | NULL, |
| 5325 | NULL, |
| 5326 | g_cclosure_marshal_generic, |
| 5327 | G_TYPE_NONE, |
| 5328 | 0); |
| 5329 | |
| 5330 | /* GObject properties for D-Bus properties: */ |
| 5331 | /** |
| 5332 | * SensorThreshold:lower-critical: |
| 5333 | * |
| 5334 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. |
| 5335 | * |
| 5336 | * 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. |
| 5337 | */ |
| 5338 | g_object_interface_install_property (iface, |
| 5339 | g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5340 | /** |
| 5341 | * SensorThreshold:lower-warning: |
| 5342 | * |
| 5343 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. |
| 5344 | * |
| 5345 | * 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. |
| 5346 | */ |
| 5347 | g_object_interface_install_property (iface, |
| 5348 | g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5349 | /** |
| 5350 | * SensorThreshold:upper-warning: |
| 5351 | * |
| 5352 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. |
| 5353 | * |
| 5354 | * 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. |
| 5355 | */ |
| 5356 | g_object_interface_install_property (iface, |
| 5357 | g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5358 | /** |
| 5359 | * SensorThreshold:upper-critical: |
| 5360 | * |
| 5361 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. |
| 5362 | * |
| 5363 | * 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. |
| 5364 | */ |
| 5365 | g_object_interface_install_property (iface, |
| 5366 | g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5367 | /** |
| 5368 | * SensorThreshold:state: |
| 5369 | * |
| 5370 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. |
| 5371 | * |
| 5372 | * 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. |
| 5373 | */ |
| 5374 | g_object_interface_install_property (iface, |
| 5375 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5376 | } |
| 5377 | |
| 5378 | /** |
| 5379 | * sensor_threshold_get_lower_critical: (skip) |
| 5380 | * @object: A #SensorThreshold. |
| 5381 | * |
| 5382 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 5383 | * |
| 5384 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5385 | * |
| 5386 | * <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> |
| 5387 | * |
| 5388 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5389 | */ |
| 5390 | GVariant * |
| 5391 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
| 5392 | { |
| 5393 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
| 5394 | } |
| 5395 | |
| 5396 | /** |
| 5397 | * sensor_threshold_dup_lower_critical: (skip) |
| 5398 | * @object: A #SensorThreshold. |
| 5399 | * |
| 5400 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 5401 | * |
| 5402 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5403 | * |
| 5404 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 5405 | */ |
| 5406 | GVariant * |
| 5407 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 5408 | { |
| 5409 | GVariant *value; |
| 5410 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 5411 | return value; |
| 5412 | } |
| 5413 | |
| 5414 | /** |
| 5415 | * sensor_threshold_set_lower_critical: (skip) |
| 5416 | * @object: A #SensorThreshold. |
| 5417 | * @value: The value to set. |
| 5418 | * |
| 5419 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. |
| 5420 | * |
| 5421 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5422 | */ |
| 5423 | void |
| 5424 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
| 5425 | { |
| 5426 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 5427 | } |
| 5428 | |
| 5429 | /** |
| 5430 | * sensor_threshold_get_lower_warning: (skip) |
| 5431 | * @object: A #SensorThreshold. |
| 5432 | * |
| 5433 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 5434 | * |
| 5435 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5436 | * |
| 5437 | * <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> |
| 5438 | * |
| 5439 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5440 | */ |
| 5441 | GVariant * |
| 5442 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
| 5443 | { |
| 5444 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
| 5445 | } |
| 5446 | |
| 5447 | /** |
| 5448 | * sensor_threshold_dup_lower_warning: (skip) |
| 5449 | * @object: A #SensorThreshold. |
| 5450 | * |
| 5451 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 5452 | * |
| 5453 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5454 | * |
| 5455 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 5456 | */ |
| 5457 | GVariant * |
| 5458 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 5459 | { |
| 5460 | GVariant *value; |
| 5461 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 5462 | return value; |
| 5463 | } |
| 5464 | |
| 5465 | /** |
| 5466 | * sensor_threshold_set_lower_warning: (skip) |
| 5467 | * @object: A #SensorThreshold. |
| 5468 | * @value: The value to set. |
| 5469 | * |
| 5470 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. |
| 5471 | * |
| 5472 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5473 | */ |
| 5474 | void |
| 5475 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
| 5476 | { |
| 5477 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 5478 | } |
| 5479 | |
| 5480 | /** |
| 5481 | * sensor_threshold_get_upper_warning: (skip) |
| 5482 | * @object: A #SensorThreshold. |
| 5483 | * |
| 5484 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 5485 | * |
| 5486 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5487 | * |
| 5488 | * <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> |
| 5489 | * |
| 5490 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5491 | */ |
| 5492 | GVariant * |
| 5493 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
| 5494 | { |
| 5495 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
| 5496 | } |
| 5497 | |
| 5498 | /** |
| 5499 | * sensor_threshold_dup_upper_warning: (skip) |
| 5500 | * @object: A #SensorThreshold. |
| 5501 | * |
| 5502 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 5503 | * |
| 5504 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5505 | * |
| 5506 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 5507 | */ |
| 5508 | GVariant * |
| 5509 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 5510 | { |
| 5511 | GVariant *value; |
| 5512 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 5513 | return value; |
| 5514 | } |
| 5515 | |
| 5516 | /** |
| 5517 | * sensor_threshold_set_upper_warning: (skip) |
| 5518 | * @object: A #SensorThreshold. |
| 5519 | * @value: The value to set. |
| 5520 | * |
| 5521 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. |
| 5522 | * |
| 5523 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5524 | */ |
| 5525 | void |
| 5526 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
| 5527 | { |
| 5528 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 5529 | } |
| 5530 | |
| 5531 | /** |
| 5532 | * sensor_threshold_get_upper_critical: (skip) |
| 5533 | * @object: A #SensorThreshold. |
| 5534 | * |
| 5535 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 5536 | * |
| 5537 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5538 | * |
| 5539 | * <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> |
| 5540 | * |
| 5541 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5542 | */ |
| 5543 | GVariant * |
| 5544 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
| 5545 | { |
| 5546 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
| 5547 | } |
| 5548 | |
| 5549 | /** |
| 5550 | * sensor_threshold_dup_upper_critical: (skip) |
| 5551 | * @object: A #SensorThreshold. |
| 5552 | * |
| 5553 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 5554 | * |
| 5555 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5556 | * |
| 5557 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 5558 | */ |
| 5559 | GVariant * |
| 5560 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 5561 | { |
| 5562 | GVariant *value; |
| 5563 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 5564 | return value; |
| 5565 | } |
| 5566 | |
| 5567 | /** |
| 5568 | * sensor_threshold_set_upper_critical: (skip) |
| 5569 | * @object: A #SensorThreshold. |
| 5570 | * @value: The value to set. |
| 5571 | * |
| 5572 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. |
| 5573 | * |
| 5574 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 5575 | */ |
| 5576 | void |
| 5577 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
| 5578 | { |
| 5579 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 5580 | } |
| 5581 | |
| 5582 | /** |
| 5583 | * sensor_threshold_get_state: (skip) |
| 5584 | * @object: A #SensorThreshold. |
| 5585 | * |
| 5586 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. |
| 5587 | * |
| 5588 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5589 | * |
| 5590 | * Returns: The property value. |
| 5591 | */ |
| 5592 | guchar |
| 5593 | sensor_threshold_get_state (SensorThreshold *object) |
| 5594 | { |
| 5595 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
| 5596 | } |
| 5597 | |
| 5598 | /** |
| 5599 | * sensor_threshold_set_state: (skip) |
| 5600 | * @object: A #SensorThreshold. |
| 5601 | * @value: The value to set. |
| 5602 | * |
| 5603 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. |
| 5604 | * |
| 5605 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 5606 | */ |
| 5607 | void |
| 5608 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
| 5609 | { |
| 5610 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 5611 | } |
| 5612 | |
| 5613 | /** |
| 5614 | * sensor_threshold_emit_warning: |
| 5615 | * @object: A #SensorThreshold. |
| 5616 | * |
| 5617 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. |
| 5618 | */ |
| 5619 | void |
| 5620 | sensor_threshold_emit_warning ( |
| 5621 | SensorThreshold *object) |
| 5622 | { |
| 5623 | g_signal_emit_by_name (object, "warning"); |
| 5624 | } |
| 5625 | |
| 5626 | /** |
| 5627 | * sensor_threshold_emit_critical: |
| 5628 | * @object: A #SensorThreshold. |
| 5629 | * |
| 5630 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. |
| 5631 | */ |
| 5632 | void |
| 5633 | sensor_threshold_emit_critical ( |
| 5634 | SensorThreshold *object) |
| 5635 | { |
| 5636 | g_signal_emit_by_name (object, "critical"); |
| 5637 | } |
| 5638 | |
| 5639 | /** |
| 5640 | * sensor_threshold_emit_normal: |
| 5641 | * @object: A #SensorThreshold. |
| 5642 | * |
| 5643 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. |
| 5644 | */ |
| 5645 | void |
| 5646 | sensor_threshold_emit_normal ( |
| 5647 | SensorThreshold *object) |
| 5648 | { |
| 5649 | g_signal_emit_by_name (object, "normal"); |
| 5650 | } |
| 5651 | |
| 5652 | /** |
| 5653 | * sensor_threshold_call_get_state: |
| 5654 | * @proxy: A #SensorThresholdProxy. |
| 5655 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5656 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 5657 | * @user_data: User data to pass to @callback. |
| 5658 | * |
| 5659 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. |
| 5660 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5661 | * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. |
| 5662 | * |
| 5663 | * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. |
| 5664 | */ |
| 5665 | void |
| 5666 | sensor_threshold_call_get_state ( |
| 5667 | SensorThreshold *proxy, |
| 5668 | GCancellable *cancellable, |
| 5669 | GAsyncReadyCallback callback, |
| 5670 | gpointer user_data) |
| 5671 | { |
| 5672 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5673 | "getState", |
| 5674 | g_variant_new ("()"), |
| 5675 | G_DBUS_CALL_FLAGS_NONE, |
| 5676 | -1, |
| 5677 | cancellable, |
| 5678 | callback, |
| 5679 | user_data); |
| 5680 | } |
| 5681 | |
| 5682 | /** |
| 5683 | * sensor_threshold_call_get_state_finish: |
| 5684 | * @proxy: A #SensorThresholdProxy. |
| 5685 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 5686 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). |
| 5687 | * @error: Return location for error or %NULL. |
| 5688 | * |
| 5689 | * Finishes an operation started with sensor_threshold_call_get_state(). |
| 5690 | * |
| 5691 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5692 | */ |
| 5693 | gboolean |
| 5694 | sensor_threshold_call_get_state_finish ( |
| 5695 | SensorThreshold *proxy, |
| 5696 | guchar *out_state, |
| 5697 | GAsyncResult *res, |
| 5698 | GError **error) |
| 5699 | { |
| 5700 | GVariant *_ret; |
| 5701 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5702 | if (_ret == NULL) |
| 5703 | goto _out; |
| 5704 | g_variant_get (_ret, |
| 5705 | "(y)", |
| 5706 | out_state); |
| 5707 | g_variant_unref (_ret); |
| 5708 | _out: |
| 5709 | return _ret != NULL; |
| 5710 | } |
| 5711 | |
| 5712 | /** |
| 5713 | * sensor_threshold_call_get_state_sync: |
| 5714 | * @proxy: A #SensorThresholdProxy. |
| 5715 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 5716 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5717 | * @error: Return location for error or %NULL. |
| 5718 | * |
| 5719 | * 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. |
| 5720 | * |
| 5721 | * See sensor_threshold_call_get_state() for the asynchronous version of this method. |
| 5722 | * |
| 5723 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5724 | */ |
| 5725 | gboolean |
| 5726 | sensor_threshold_call_get_state_sync ( |
| 5727 | SensorThreshold *proxy, |
| 5728 | guchar *out_state, |
| 5729 | GCancellable *cancellable, |
| 5730 | GError **error) |
| 5731 | { |
| 5732 | GVariant *_ret; |
| 5733 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5734 | "getState", |
| 5735 | g_variant_new ("()"), |
| 5736 | G_DBUS_CALL_FLAGS_NONE, |
| 5737 | -1, |
| 5738 | cancellable, |
| 5739 | error); |
| 5740 | if (_ret == NULL) |
| 5741 | goto _out; |
| 5742 | g_variant_get (_ret, |
| 5743 | "(y)", |
| 5744 | out_state); |
| 5745 | g_variant_unref (_ret); |
| 5746 | _out: |
| 5747 | return _ret != NULL; |
| 5748 | } |
| 5749 | |
| 5750 | /** |
| 5751 | * sensor_threshold_complete_get_state: |
| 5752 | * @object: A #SensorThreshold. |
| 5753 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5754 | * @state: Parameter to return. |
| 5755 | * |
| 5756 | * 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. |
| 5757 | * |
| 5758 | * This method will free @invocation, you cannot use it afterwards. |
| 5759 | */ |
| 5760 | void |
| 5761 | sensor_threshold_complete_get_state ( |
| 5762 | SensorThreshold *object, |
| 5763 | GDBusMethodInvocation *invocation, |
| 5764 | guchar state) |
| 5765 | { |
| 5766 | g_dbus_method_invocation_return_value (invocation, |
| 5767 | g_variant_new ("(y)", |
| 5768 | state)); |
| 5769 | } |
| 5770 | |
| 5771 | /* ------------------------------------------------------------------------ */ |
| 5772 | |
| 5773 | /** |
| 5774 | * SensorThresholdProxy: |
| 5775 | * |
| 5776 | * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 5777 | */ |
| 5778 | |
| 5779 | /** |
| 5780 | * SensorThresholdProxyClass: |
| 5781 | * @parent_class: The parent class. |
| 5782 | * |
| 5783 | * Class structure for #SensorThresholdProxy. |
| 5784 | */ |
| 5785 | |
| 5786 | struct _SensorThresholdProxyPrivate |
| 5787 | { |
| 5788 | GData *qdata; |
| 5789 | }; |
| 5790 | |
| 5791 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
| 5792 | |
| 5793 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5794 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 5795 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 5796 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 5797 | |
| 5798 | #else |
| 5799 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 5800 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
| 5801 | |
| 5802 | #endif |
| 5803 | static void |
| 5804 | sensor_threshold_proxy_finalize (GObject *object) |
| 5805 | { |
| 5806 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5807 | g_datalist_clear (&proxy->priv->qdata); |
| 5808 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
| 5809 | } |
| 5810 | |
| 5811 | static void |
| 5812 | sensor_threshold_proxy_get_property (GObject *object, |
| 5813 | guint prop_id, |
| 5814 | GValue *value, |
| 5815 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5816 | { |
| 5817 | const _ExtendedGDBusPropertyInfo *info; |
| 5818 | GVariant *variant; |
| 5819 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 5820 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 5821 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5822 | if (info->use_gvariant) |
| 5823 | { |
| 5824 | g_value_set_variant (value, variant); |
| 5825 | } |
| 5826 | else |
| 5827 | { |
| 5828 | if (variant != NULL) |
| 5829 | g_dbus_gvariant_to_gvalue (variant, value); |
| 5830 | } |
| 5831 | if (variant != NULL) |
| 5832 | g_variant_unref (variant); |
| 5833 | } |
| 5834 | |
| 5835 | static void |
| 5836 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 5837 | GAsyncResult *res, |
| 5838 | gpointer user_data) |
| 5839 | { |
| 5840 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5841 | GError *error; |
| 5842 | GVariant *_ret; |
| 5843 | error = NULL; |
| 5844 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5845 | if (!_ret) |
| 5846 | { |
| 5847 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", |
| 5848 | info->parent_struct.name, |
| 5849 | error->message, g_quark_to_string (error->domain), error->code); |
| 5850 | g_error_free (error); |
| 5851 | } |
| 5852 | else |
| 5853 | { |
| 5854 | g_variant_unref (_ret); |
| 5855 | } |
| 5856 | } |
| 5857 | |
| 5858 | static void |
| 5859 | sensor_threshold_proxy_set_property (GObject *object, |
| 5860 | guint prop_id, |
| 5861 | const GValue *value, |
| 5862 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5863 | { |
| 5864 | const _ExtendedGDBusPropertyInfo *info; |
| 5865 | GVariant *variant; |
| 5866 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 5867 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
| 5868 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5869 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5870 | "org.freedesktop.DBus.Properties.Set", |
| 5871 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
| 5872 | G_DBUS_CALL_FLAGS_NONE, |
| 5873 | -1, |
| 5874 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5875 | g_variant_unref (variant); |
| 5876 | } |
| 5877 | |
| 5878 | static void |
| 5879 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 5880 | const gchar *sender_name G_GNUC_UNUSED, |
| 5881 | const gchar *signal_name, |
| 5882 | GVariant *parameters) |
| 5883 | { |
| 5884 | _ExtendedGDBusSignalInfo *info; |
| 5885 | GVariantIter iter; |
| 5886 | GVariant *child; |
| 5887 | GValue *paramv; |
| 5888 | guint num_params; |
| 5889 | guint n; |
| 5890 | guint signal_id; |
| 5891 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); |
| 5892 | if (info == NULL) |
| 5893 | return; |
| 5894 | num_params = g_variant_n_children (parameters); |
| 5895 | paramv = g_new0 (GValue, num_params + 1); |
| 5896 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
| 5897 | g_value_set_object (¶mv[0], proxy); |
| 5898 | g_variant_iter_init (&iter, parameters); |
| 5899 | n = 1; |
| 5900 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5901 | { |
| 5902 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5903 | if (arg_info->use_gvariant) |
| 5904 | { |
| 5905 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5906 | g_value_set_variant (¶mv[n], child); |
| 5907 | n++; |
| 5908 | } |
| 5909 | else |
| 5910 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5911 | g_variant_unref (child); |
| 5912 | } |
| 5913 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 5914 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5915 | for (n = 0; n < num_params + 1; n++) |
| 5916 | g_value_unset (¶mv[n]); |
| 5917 | g_free (paramv); |
| 5918 | } |
| 5919 | |
| 5920 | static void |
| 5921 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5922 | GVariant *changed_properties, |
| 5923 | const gchar *const *invalidated_properties) |
| 5924 | { |
| 5925 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
| 5926 | guint n; |
| 5927 | const gchar *key; |
| 5928 | GVariantIter *iter; |
| 5929 | _ExtendedGDBusPropertyInfo *info; |
| 5930 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 5931 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5932 | { |
| 5933 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); |
| 5934 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5935 | if (info != NULL) |
| 5936 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5937 | } |
| 5938 | g_variant_iter_free (iter); |
| 5939 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5940 | { |
| 5941 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 5942 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5943 | if (info != NULL) |
| 5944 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5945 | } |
| 5946 | } |
| 5947 | |
| 5948 | static GVariant * |
| 5949 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
| 5950 | { |
| 5951 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5952 | GVariant *variant; |
| 5953 | GVariant *value = NULL; |
| 5954 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); |
| 5955 | value = variant; |
| 5956 | if (variant != NULL) |
| 5957 | g_variant_unref (variant); |
| 5958 | return value; |
| 5959 | } |
| 5960 | |
| 5961 | static GVariant * |
| 5962 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
| 5963 | { |
| 5964 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5965 | GVariant *variant; |
| 5966 | GVariant *value = NULL; |
| 5967 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); |
| 5968 | value = variant; |
| 5969 | if (variant != NULL) |
| 5970 | g_variant_unref (variant); |
| 5971 | return value; |
| 5972 | } |
| 5973 | |
| 5974 | static GVariant * |
| 5975 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
| 5976 | { |
| 5977 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5978 | GVariant *variant; |
| 5979 | GVariant *value = NULL; |
| 5980 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); |
| 5981 | value = variant; |
| 5982 | if (variant != NULL) |
| 5983 | g_variant_unref (variant); |
| 5984 | return value; |
| 5985 | } |
| 5986 | |
| 5987 | static GVariant * |
| 5988 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
| 5989 | { |
| 5990 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 5991 | GVariant *variant; |
| 5992 | GVariant *value = NULL; |
| 5993 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); |
| 5994 | value = variant; |
| 5995 | if (variant != NULL) |
| 5996 | g_variant_unref (variant); |
| 5997 | return value; |
| 5998 | } |
| 5999 | |
| 6000 | static guchar |
| 6001 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
| 6002 | { |
| 6003 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
| 6004 | GVariant *variant; |
| 6005 | guchar value = 0; |
| 6006 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 6007 | if (variant != NULL) |
| 6008 | { |
| 6009 | value = g_variant_get_byte (variant); |
| 6010 | g_variant_unref (variant); |
| 6011 | } |
| 6012 | return value; |
| 6013 | } |
| 6014 | |
| 6015 | static void |
| 6016 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
| 6017 | { |
| 6018 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6019 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
| 6020 | #else |
| 6021 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); |
| 6022 | #endif |
| 6023 | |
| 6024 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); |
| 6025 | } |
| 6026 | |
| 6027 | static void |
| 6028 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
| 6029 | { |
| 6030 | GObjectClass *gobject_class; |
| 6031 | GDBusProxyClass *proxy_class; |
| 6032 | |
| 6033 | gobject_class = G_OBJECT_CLASS (klass); |
| 6034 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 6035 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 6036 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
| 6037 | |
| 6038 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 6039 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 6040 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
| 6041 | |
| 6042 | sensor_threshold_override_properties (gobject_class, 1); |
| 6043 | |
| 6044 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6045 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
| 6046 | #endif |
| 6047 | } |
| 6048 | |
| 6049 | static void |
| 6050 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
| 6051 | { |
| 6052 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 6053 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 6054 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 6055 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 6056 | iface->get_state = sensor_threshold_proxy_get_state; |
| 6057 | } |
| 6058 | |
| 6059 | /** |
| 6060 | * sensor_threshold_proxy_new: |
| 6061 | * @connection: A #GDBusConnection. |
| 6062 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6063 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6064 | * @object_path: An object path. |
| 6065 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6066 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6067 | * @user_data: User data to pass to @callback. |
| 6068 | * |
| 6069 | * 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. |
| 6070 | * |
| 6071 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 6072 | * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. |
| 6073 | * |
| 6074 | * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 6075 | */ |
| 6076 | void |
| 6077 | sensor_threshold_proxy_new ( |
| 6078 | GDBusConnection *connection, |
| 6079 | GDBusProxyFlags flags, |
| 6080 | const gchar *name, |
| 6081 | const gchar *object_path, |
| 6082 | GCancellable *cancellable, |
| 6083 | GAsyncReadyCallback callback, |
| 6084 | gpointer user_data) |
| 6085 | { |
| 6086 | 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); |
| 6087 | } |
| 6088 | |
| 6089 | /** |
| 6090 | * sensor_threshold_proxy_new_finish: |
| 6091 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). |
| 6092 | * @error: Return location for error or %NULL |
| 6093 | * |
| 6094 | * Finishes an operation started with sensor_threshold_proxy_new(). |
| 6095 | * |
| 6096 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6097 | */ |
| 6098 | SensorThreshold * |
| 6099 | sensor_threshold_proxy_new_finish ( |
| 6100 | GAsyncResult *res, |
| 6101 | GError **error) |
| 6102 | { |
| 6103 | GObject *ret; |
| 6104 | GObject *source_object; |
| 6105 | source_object = g_async_result_get_source_object (res); |
| 6106 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6107 | g_object_unref (source_object); |
| 6108 | if (ret != NULL) |
| 6109 | return SENSOR_THRESHOLD (ret); |
| 6110 | else |
| 6111 | return NULL; |
| 6112 | } |
| 6113 | |
| 6114 | /** |
| 6115 | * sensor_threshold_proxy_new_sync: |
| 6116 | * @connection: A #GDBusConnection. |
| 6117 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6118 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 6119 | * @object_path: An object path. |
| 6120 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6121 | * @error: Return location for error or %NULL |
| 6122 | * |
| 6123 | * 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. |
| 6124 | * |
| 6125 | * The calling thread is blocked until a reply is received. |
| 6126 | * |
| 6127 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
| 6128 | * |
| 6129 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6130 | */ |
| 6131 | SensorThreshold * |
| 6132 | sensor_threshold_proxy_new_sync ( |
| 6133 | GDBusConnection *connection, |
| 6134 | GDBusProxyFlags flags, |
| 6135 | const gchar *name, |
| 6136 | const gchar *object_path, |
| 6137 | GCancellable *cancellable, |
| 6138 | GError **error) |
| 6139 | { |
| 6140 | GInitable *ret; |
| 6141 | 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); |
| 6142 | if (ret != NULL) |
| 6143 | return SENSOR_THRESHOLD (ret); |
| 6144 | else |
| 6145 | return NULL; |
| 6146 | } |
| 6147 | |
| 6148 | |
| 6149 | /** |
| 6150 | * sensor_threshold_proxy_new_for_bus: |
| 6151 | * @bus_type: A #GBusType. |
| 6152 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6153 | * @name: A bus name (well-known or unique). |
| 6154 | * @object_path: An object path. |
| 6155 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6156 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6157 | * @user_data: User data to pass to @callback. |
| 6158 | * |
| 6159 | * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 6160 | * |
| 6161 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 6162 | * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 6163 | * |
| 6164 | * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 6165 | */ |
| 6166 | void |
| 6167 | sensor_threshold_proxy_new_for_bus ( |
| 6168 | GBusType bus_type, |
| 6169 | GDBusProxyFlags flags, |
| 6170 | const gchar *name, |
| 6171 | const gchar *object_path, |
| 6172 | GCancellable *cancellable, |
| 6173 | GAsyncReadyCallback callback, |
| 6174 | gpointer user_data) |
| 6175 | { |
| 6176 | 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); |
| 6177 | } |
| 6178 | |
| 6179 | /** |
| 6180 | * sensor_threshold_proxy_new_for_bus_finish: |
| 6181 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). |
| 6182 | * @error: Return location for error or %NULL |
| 6183 | * |
| 6184 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
| 6185 | * |
| 6186 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6187 | */ |
| 6188 | SensorThreshold * |
| 6189 | sensor_threshold_proxy_new_for_bus_finish ( |
| 6190 | GAsyncResult *res, |
| 6191 | GError **error) |
| 6192 | { |
| 6193 | GObject *ret; |
| 6194 | GObject *source_object; |
| 6195 | source_object = g_async_result_get_source_object (res); |
| 6196 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6197 | g_object_unref (source_object); |
| 6198 | if (ret != NULL) |
| 6199 | return SENSOR_THRESHOLD (ret); |
| 6200 | else |
| 6201 | return NULL; |
| 6202 | } |
| 6203 | |
| 6204 | /** |
| 6205 | * sensor_threshold_proxy_new_for_bus_sync: |
| 6206 | * @bus_type: A #GBusType. |
| 6207 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6208 | * @name: A bus name (well-known or unique). |
| 6209 | * @object_path: An object path. |
| 6210 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6211 | * @error: Return location for error or %NULL |
| 6212 | * |
| 6213 | * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 6214 | * |
| 6215 | * The calling thread is blocked until a reply is received. |
| 6216 | * |
| 6217 | * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 6218 | * |
| 6219 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 6220 | */ |
| 6221 | SensorThreshold * |
| 6222 | sensor_threshold_proxy_new_for_bus_sync ( |
| 6223 | GBusType bus_type, |
| 6224 | GDBusProxyFlags flags, |
| 6225 | const gchar *name, |
| 6226 | const gchar *object_path, |
| 6227 | GCancellable *cancellable, |
| 6228 | GError **error) |
| 6229 | { |
| 6230 | GInitable *ret; |
| 6231 | 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); |
| 6232 | if (ret != NULL) |
| 6233 | return SENSOR_THRESHOLD (ret); |
| 6234 | else |
| 6235 | return NULL; |
| 6236 | } |
| 6237 | |
| 6238 | |
| 6239 | /* ------------------------------------------------------------------------ */ |
| 6240 | |
| 6241 | /** |
| 6242 | * SensorThresholdSkeleton: |
| 6243 | * |
| 6244 | * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 6245 | */ |
| 6246 | |
| 6247 | /** |
| 6248 | * SensorThresholdSkeletonClass: |
| 6249 | * @parent_class: The parent class. |
| 6250 | * |
| 6251 | * Class structure for #SensorThresholdSkeleton. |
| 6252 | */ |
| 6253 | |
| 6254 | struct _SensorThresholdSkeletonPrivate |
| 6255 | { |
| 6256 | GValue *properties; |
| 6257 | GList *changed_properties; |
| 6258 | GSource *changed_properties_idle_source; |
| 6259 | GMainContext *context; |
| 6260 | GMutex lock; |
| 6261 | }; |
| 6262 | |
| 6263 | static void |
| 6264 | _sensor_threshold_skeleton_handle_method_call ( |
| 6265 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6266 | const gchar *sender G_GNUC_UNUSED, |
| 6267 | const gchar *object_path G_GNUC_UNUSED, |
| 6268 | const gchar *interface_name, |
| 6269 | const gchar *method_name, |
| 6270 | GVariant *parameters, |
| 6271 | GDBusMethodInvocation *invocation, |
| 6272 | gpointer user_data) |
| 6273 | { |
| 6274 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 6275 | _ExtendedGDBusMethodInfo *info; |
| 6276 | GVariantIter iter; |
| 6277 | GVariant *child; |
| 6278 | GValue *paramv; |
| 6279 | guint num_params; |
| 6280 | guint num_extra; |
| 6281 | guint n; |
| 6282 | guint signal_id; |
| 6283 | GValue return_value = G_VALUE_INIT; |
| 6284 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 6285 | g_assert (info != NULL); |
| 6286 | num_params = g_variant_n_children (parameters); |
| 6287 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 6288 | n = 0; |
| 6289 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
| 6290 | g_value_set_object (¶mv[n++], skeleton); |
| 6291 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 6292 | g_value_set_object (¶mv[n++], invocation); |
| 6293 | if (info->pass_fdlist) |
| 6294 | { |
| 6295 | #ifdef G_OS_UNIX |
| 6296 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 6297 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 6298 | #else |
| 6299 | g_assert_not_reached (); |
| 6300 | #endif |
| 6301 | } |
| 6302 | g_variant_iter_init (&iter, parameters); |
| 6303 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 6304 | { |
| 6305 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 6306 | if (arg_info->use_gvariant) |
| 6307 | { |
| 6308 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 6309 | g_value_set_variant (¶mv[n], child); |
| 6310 | n++; |
| 6311 | } |
| 6312 | else |
| 6313 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 6314 | g_variant_unref (child); |
| 6315 | } |
| 6316 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
| 6317 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 6318 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 6319 | if (!g_value_get_boolean (&return_value)) |
| 6320 | 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); |
| 6321 | g_value_unset (&return_value); |
| 6322 | for (n = 0; n < num_params + num_extra; n++) |
| 6323 | g_value_unset (¶mv[n]); |
| 6324 | g_free (paramv); |
| 6325 | } |
| 6326 | |
| 6327 | static GVariant * |
| 6328 | _sensor_threshold_skeleton_handle_get_property ( |
| 6329 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6330 | const gchar *sender G_GNUC_UNUSED, |
| 6331 | const gchar *object_path G_GNUC_UNUSED, |
| 6332 | const gchar *interface_name G_GNUC_UNUSED, |
| 6333 | const gchar *property_name, |
| 6334 | GError **error, |
| 6335 | gpointer user_data) |
| 6336 | { |
| 6337 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 6338 | GValue value = G_VALUE_INIT; |
| 6339 | GParamSpec *pspec; |
| 6340 | _ExtendedGDBusPropertyInfo *info; |
| 6341 | GVariant *ret; |
| 6342 | ret = NULL; |
| 6343 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 6344 | g_assert (info != NULL); |
| 6345 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6346 | if (pspec == NULL) |
| 6347 | { |
| 6348 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6349 | } |
| 6350 | else |
| 6351 | { |
| 6352 | g_value_init (&value, pspec->value_type); |
| 6353 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6354 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6355 | g_value_unset (&value); |
| 6356 | } |
| 6357 | return ret; |
| 6358 | } |
| 6359 | |
| 6360 | static gboolean |
| 6361 | _sensor_threshold_skeleton_handle_set_property ( |
| 6362 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6363 | const gchar *sender G_GNUC_UNUSED, |
| 6364 | const gchar *object_path G_GNUC_UNUSED, |
| 6365 | const gchar *interface_name G_GNUC_UNUSED, |
| 6366 | const gchar *property_name, |
| 6367 | GVariant *variant, |
| 6368 | GError **error, |
| 6369 | gpointer user_data) |
| 6370 | { |
| 6371 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 6372 | GValue value = G_VALUE_INIT; |
| 6373 | GParamSpec *pspec; |
| 6374 | _ExtendedGDBusPropertyInfo *info; |
| 6375 | gboolean ret; |
| 6376 | ret = FALSE; |
| 6377 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
| 6378 | g_assert (info != NULL); |
| 6379 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6380 | if (pspec == NULL) |
| 6381 | { |
| 6382 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6383 | } |
| 6384 | else |
| 6385 | { |
| 6386 | if (info->use_gvariant) |
| 6387 | g_value_set_variant (&value, variant); |
| 6388 | else |
| 6389 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 6390 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6391 | g_value_unset (&value); |
| 6392 | ret = TRUE; |
| 6393 | } |
| 6394 | return ret; |
| 6395 | } |
| 6396 | |
| 6397 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
| 6398 | { |
| 6399 | _sensor_threshold_skeleton_handle_method_call, |
| 6400 | _sensor_threshold_skeleton_handle_get_property, |
| 6401 | _sensor_threshold_skeleton_handle_set_property, |
| 6402 | {NULL} |
| 6403 | }; |
| 6404 | |
| 6405 | static GDBusInterfaceInfo * |
| 6406 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6407 | { |
| 6408 | return sensor_threshold_interface_info (); |
| 6409 | } |
| 6410 | |
| 6411 | static GDBusInterfaceVTable * |
| 6412 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6413 | { |
| 6414 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
| 6415 | } |
| 6416 | |
| 6417 | static GVariant * |
| 6418 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 6419 | { |
| 6420 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 6421 | |
| 6422 | GVariantBuilder builder; |
| 6423 | guint n; |
| 6424 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6425 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
| 6426 | goto out; |
| 6427 | for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 6428 | { |
| 6429 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
| 6430 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 6431 | { |
| 6432 | GVariant *value; |
| 6433 | 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); |
| 6434 | if (value != NULL) |
| 6435 | { |
| 6436 | g_variant_take_ref (value); |
| 6437 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 6438 | g_variant_unref (value); |
| 6439 | } |
| 6440 | } |
| 6441 | } |
| 6442 | out: |
| 6443 | return g_variant_builder_end (&builder); |
| 6444 | } |
| 6445 | |
| 6446 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
| 6447 | |
| 6448 | static void |
| 6449 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 6450 | { |
| 6451 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
| 6452 | gboolean emit_changed = FALSE; |
| 6453 | |
| 6454 | g_mutex_lock (&skeleton->priv->lock); |
| 6455 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6456 | { |
| 6457 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6458 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6459 | emit_changed = TRUE; |
| 6460 | } |
| 6461 | g_mutex_unlock (&skeleton->priv->lock); |
| 6462 | |
| 6463 | if (emit_changed) |
| 6464 | _sensor_threshold_emit_changed (skeleton); |
| 6465 | } |
| 6466 | |
| 6467 | static void |
| 6468 | _sensor_threshold_on_signal_warning ( |
| 6469 | SensorThreshold *object) |
| 6470 | { |
| 6471 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6472 | |
| 6473 | GList *connections, *l; |
| 6474 | GVariant *signal_variant; |
| 6475 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6476 | |
| 6477 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 6478 | for (l = connections; l != NULL; l = l->next) |
| 6479 | { |
| 6480 | GDBusConnection *connection = l->data; |
| 6481 | g_dbus_connection_emit_signal (connection, |
| 6482 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", |
| 6483 | signal_variant, NULL); |
| 6484 | } |
| 6485 | g_variant_unref (signal_variant); |
| 6486 | g_list_free_full (connections, g_object_unref); |
| 6487 | } |
| 6488 | |
| 6489 | static void |
| 6490 | _sensor_threshold_on_signal_critical ( |
| 6491 | SensorThreshold *object) |
| 6492 | { |
| 6493 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6494 | |
| 6495 | GList *connections, *l; |
| 6496 | GVariant *signal_variant; |
| 6497 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6498 | |
| 6499 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 6500 | for (l = connections; l != NULL; l = l->next) |
| 6501 | { |
| 6502 | GDBusConnection *connection = l->data; |
| 6503 | g_dbus_connection_emit_signal (connection, |
| 6504 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", |
| 6505 | signal_variant, NULL); |
| 6506 | } |
| 6507 | g_variant_unref (signal_variant); |
| 6508 | g_list_free_full (connections, g_object_unref); |
| 6509 | } |
| 6510 | |
| 6511 | static void |
| 6512 | _sensor_threshold_on_signal_normal ( |
| 6513 | SensorThreshold *object) |
| 6514 | { |
| 6515 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6516 | |
| 6517 | GList *connections, *l; |
| 6518 | GVariant *signal_variant; |
| 6519 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6520 | |
| 6521 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 6522 | for (l = connections; l != NULL; l = l->next) |
| 6523 | { |
| 6524 | GDBusConnection *connection = l->data; |
| 6525 | g_dbus_connection_emit_signal (connection, |
| 6526 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", |
| 6527 | signal_variant, NULL); |
| 6528 | } |
| 6529 | g_variant_unref (signal_variant); |
| 6530 | g_list_free_full (connections, g_object_unref); |
| 6531 | } |
| 6532 | |
| 6533 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
| 6534 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6535 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6536 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 6537 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 6538 | |
| 6539 | #else |
| 6540 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6541 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
| 6542 | |
| 6543 | #endif |
| 6544 | static void |
| 6545 | sensor_threshold_skeleton_finalize (GObject *object) |
| 6546 | { |
| 6547 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6548 | guint n; |
| 6549 | for (n = 0; n < 5; n++) |
| 6550 | g_value_unset (&skeleton->priv->properties[n]); |
| 6551 | g_free (skeleton->priv->properties); |
| 6552 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6553 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6554 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6555 | g_main_context_unref (skeleton->priv->context); |
| 6556 | g_mutex_clear (&skeleton->priv->lock); |
| 6557 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
| 6558 | } |
| 6559 | |
| 6560 | static void |
| 6561 | sensor_threshold_skeleton_get_property (GObject *object, |
| 6562 | guint prop_id, |
| 6563 | GValue *value, |
| 6564 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6565 | { |
| 6566 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6567 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 6568 | g_mutex_lock (&skeleton->priv->lock); |
| 6569 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 6570 | g_mutex_unlock (&skeleton->priv->lock); |
| 6571 | } |
| 6572 | |
| 6573 | static gboolean |
| 6574 | _sensor_threshold_emit_changed (gpointer user_data) |
| 6575 | { |
| 6576 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
| 6577 | GList *l; |
| 6578 | GVariantBuilder builder; |
| 6579 | GVariantBuilder invalidated_builder; |
| 6580 | guint num_changes; |
| 6581 | |
| 6582 | g_mutex_lock (&skeleton->priv->lock); |
| 6583 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6584 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6585 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 6586 | { |
| 6587 | ChangedProperty *cp = l->data; |
| 6588 | GVariant *variant; |
| 6589 | const GValue *cur_value; |
| 6590 | |
| 6591 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 6592 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 6593 | { |
| 6594 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 6595 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 6596 | g_variant_unref (variant); |
| 6597 | num_changes++; |
| 6598 | } |
| 6599 | } |
| 6600 | if (num_changes > 0) |
| 6601 | { |
| 6602 | GList *connections, *ll; |
| 6603 | GVariant *signal_variant; |
| 6604 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", |
| 6605 | &builder, &invalidated_builder)); |
| 6606 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6607 | for (ll = connections; ll != NULL; ll = ll->next) |
| 6608 | { |
| 6609 | GDBusConnection *connection = ll->data; |
| 6610 | |
| 6611 | g_dbus_connection_emit_signal (connection, |
| 6612 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6613 | "org.freedesktop.DBus.Properties", |
| 6614 | "PropertiesChanged", |
| 6615 | signal_variant, |
| 6616 | NULL); |
| 6617 | } |
| 6618 | g_variant_unref (signal_variant); |
| 6619 | g_list_free_full (connections, g_object_unref); |
| 6620 | } |
| 6621 | else |
| 6622 | { |
| 6623 | g_variant_builder_clear (&builder); |
| 6624 | g_variant_builder_clear (&invalidated_builder); |
| 6625 | } |
| 6626 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6627 | skeleton->priv->changed_properties = NULL; |
| 6628 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6629 | g_mutex_unlock (&skeleton->priv->lock); |
| 6630 | return FALSE; |
| 6631 | } |
| 6632 | |
| 6633 | static void |
| 6634 | _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6635 | { |
| 6636 | ChangedProperty *cp; |
| 6637 | GList *l; |
| 6638 | cp = NULL; |
| 6639 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 6640 | { |
| 6641 | ChangedProperty *i_cp = l->data; |
| 6642 | if (i_cp->info == info) |
| 6643 | { |
| 6644 | cp = i_cp; |
| 6645 | break; |
| 6646 | } |
| 6647 | } |
| 6648 | if (cp == NULL) |
| 6649 | { |
| 6650 | cp = g_new0 (ChangedProperty, 1); |
| 6651 | cp->prop_id = prop_id; |
| 6652 | cp->info = info; |
| 6653 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 6654 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 6655 | g_value_copy (orig_value, &cp->orig_value); |
| 6656 | } |
| 6657 | } |
| 6658 | |
| 6659 | static void |
| 6660 | sensor_threshold_skeleton_notify (GObject *object, |
| 6661 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6662 | { |
| 6663 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6664 | g_mutex_lock (&skeleton->priv->lock); |
| 6665 | if (skeleton->priv->changed_properties != NULL && |
| 6666 | skeleton->priv->changed_properties_idle_source == NULL) |
| 6667 | { |
| 6668 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 6669 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 6670 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 6671 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 6672 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 6673 | } |
| 6674 | g_mutex_unlock (&skeleton->priv->lock); |
| 6675 | } |
| 6676 | |
| 6677 | static void |
| 6678 | sensor_threshold_skeleton_set_property (GObject *object, |
| 6679 | guint prop_id, |
| 6680 | const GValue *value, |
| 6681 | GParamSpec *pspec) |
| 6682 | { |
| 6683 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6684 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
| 6685 | g_mutex_lock (&skeleton->priv->lock); |
| 6686 | g_object_freeze_notify (object); |
| 6687 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 6688 | { |
| 6689 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 6690 | _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 6691 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 6692 | g_object_notify_by_pspec (object, pspec); |
| 6693 | } |
| 6694 | g_mutex_unlock (&skeleton->priv->lock); |
| 6695 | g_object_thaw_notify (object); |
| 6696 | } |
| 6697 | |
| 6698 | static void |
| 6699 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
| 6700 | { |
| 6701 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6702 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
| 6703 | #else |
| 6704 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); |
| 6705 | #endif |
| 6706 | |
| 6707 | g_mutex_init (&skeleton->priv->lock); |
| 6708 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 6709 | skeleton->priv->properties = g_new0 (GValue, 5); |
| 6710 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 6711 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 6712 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 6713 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 6714 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
| 6715 | } |
| 6716 | |
| 6717 | static GVariant * |
| 6718 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
| 6719 | { |
| 6720 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6721 | GVariant *value; |
| 6722 | g_mutex_lock (&skeleton->priv->lock); |
| 6723 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 6724 | g_mutex_unlock (&skeleton->priv->lock); |
| 6725 | return value; |
| 6726 | } |
| 6727 | |
| 6728 | static GVariant * |
| 6729 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
| 6730 | { |
| 6731 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6732 | GVariant *value; |
| 6733 | g_mutex_lock (&skeleton->priv->lock); |
| 6734 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
| 6735 | g_mutex_unlock (&skeleton->priv->lock); |
| 6736 | return value; |
| 6737 | } |
| 6738 | |
| 6739 | static GVariant * |
| 6740 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
| 6741 | { |
| 6742 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6743 | GVariant *value; |
| 6744 | g_mutex_lock (&skeleton->priv->lock); |
| 6745 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
| 6746 | g_mutex_unlock (&skeleton->priv->lock); |
| 6747 | return value; |
| 6748 | } |
| 6749 | |
| 6750 | static GVariant * |
| 6751 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
| 6752 | { |
| 6753 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6754 | GVariant *value; |
| 6755 | g_mutex_lock (&skeleton->priv->lock); |
| 6756 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
| 6757 | g_mutex_unlock (&skeleton->priv->lock); |
| 6758 | return value; |
| 6759 | } |
| 6760 | |
| 6761 | static guchar |
| 6762 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
| 6763 | { |
| 6764 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 6765 | guchar value; |
| 6766 | g_mutex_lock (&skeleton->priv->lock); |
| 6767 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
| 6768 | g_mutex_unlock (&skeleton->priv->lock); |
| 6769 | return value; |
| 6770 | } |
| 6771 | |
| 6772 | static void |
| 6773 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
| 6774 | { |
| 6775 | GObjectClass *gobject_class; |
| 6776 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 6777 | |
| 6778 | gobject_class = G_OBJECT_CLASS (klass); |
| 6779 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 6780 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 6781 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 6782 | gobject_class->notify = sensor_threshold_skeleton_notify; |
| 6783 | |
| 6784 | |
| 6785 | sensor_threshold_override_properties (gobject_class, 1); |
| 6786 | |
| 6787 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 6788 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 6789 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 6790 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 6791 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
| 6792 | |
| 6793 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6794 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
| 6795 | #endif |
| 6796 | } |
| 6797 | |
| 6798 | static void |
| 6799 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
| 6800 | { |
| 6801 | iface->warning = _sensor_threshold_on_signal_warning; |
| 6802 | iface->critical = _sensor_threshold_on_signal_critical; |
| 6803 | iface->normal = _sensor_threshold_on_signal_normal; |
| 6804 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 6805 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 6806 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 6807 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 6808 | iface->get_state = sensor_threshold_skeleton_get_state; |
| 6809 | } |
| 6810 | |
| 6811 | /** |
| 6812 | * sensor_threshold_skeleton_new: |
| 6813 | * |
| 6814 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
| 6815 | * |
| 6816 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
| 6817 | */ |
| 6818 | SensorThreshold * |
| 6819 | sensor_threshold_skeleton_new (void) |
| 6820 | { |
| 6821 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
| 6822 | } |
| 6823 | |
| 6824 | /* ------------------------------------------------------------------------ |
| 6825 | * Code for interface org.openbmc.SensorI2c |
| 6826 | * ------------------------------------------------------------------------ |
| 6827 | */ |
| 6828 | |
| 6829 | /** |
| 6830 | * SECTION:SensorI2c |
| 6831 | * @title: SensorI2c |
| 6832 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 6833 | * |
| 6834 | * 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. |
| 6835 | */ |
| 6836 | |
| 6837 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 6838 | |
| 6839 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 6840 | { |
| 6841 | { |
| 6842 | -1, |
| 6843 | (gchar *) "dev_path", |
| 6844 | (gchar *) "s", |
| 6845 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6846 | NULL |
| 6847 | }, |
| 6848 | "dev-path", |
| 6849 | FALSE |
| 6850 | }; |
| 6851 | |
| 6852 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 6853 | { |
| 6854 | { |
| 6855 | -1, |
| 6856 | (gchar *) "address", |
| 6857 | (gchar *) "s", |
| 6858 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 6859 | NULL |
| 6860 | }, |
| 6861 | "address", |
| 6862 | FALSE |
| 6863 | }; |
| 6864 | |
| 6865 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 6866 | { |
| 6867 | &_sensor_i2c_property_info_dev_path, |
| 6868 | &_sensor_i2c_property_info_address, |
| 6869 | NULL |
| 6870 | }; |
| 6871 | |
| 6872 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 6873 | { |
| 6874 | { |
| 6875 | -1, |
| 6876 | (gchar *) "org.openbmc.SensorI2c", |
| 6877 | NULL, |
| 6878 | NULL, |
| 6879 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 6880 | NULL |
| 6881 | }, |
| 6882 | "sensor-i2c", |
| 6883 | }; |
| 6884 | |
| 6885 | |
| 6886 | /** |
| 6887 | * sensor_i2c_interface_info: |
| 6888 | * |
| 6889 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 6890 | * |
| 6891 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 6892 | */ |
| 6893 | GDBusInterfaceInfo * |
| 6894 | sensor_i2c_interface_info (void) |
| 6895 | { |
| 6896 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 6897 | } |
| 6898 | |
| 6899 | /** |
| 6900 | * sensor_i2c_override_properties: |
| 6901 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 6902 | * @property_id_begin: The property id to assign to the first overridden property. |
| 6903 | * |
| 6904 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 6905 | * The properties are overridden in the order they are defined. |
| 6906 | * |
| 6907 | * Returns: The last property id. |
| 6908 | */ |
| 6909 | guint |
| 6910 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 6911 | { |
| 6912 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 6913 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 6914 | return property_id_begin - 1; |
| 6915 | } |
| 6916 | |
| 6917 | |
| 6918 | |
| 6919 | /** |
| 6920 | * SensorI2c: |
| 6921 | * |
| 6922 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 6923 | */ |
| 6924 | |
| 6925 | /** |
| 6926 | * SensorI2cIface: |
| 6927 | * @parent_iface: The parent interface. |
| 6928 | * @get_address: Getter for the #SensorI2c:address property. |
| 6929 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 6930 | * |
| 6931 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 6932 | */ |
| 6933 | |
| 6934 | typedef SensorI2cIface SensorI2cInterface; |
| 6935 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 6936 | |
| 6937 | static void |
| 6938 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 6939 | { |
| 6940 | /* GObject properties for D-Bus properties: */ |
| 6941 | /** |
| 6942 | * SensorI2c:dev-path: |
| 6943 | * |
| 6944 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 6945 | * |
| 6946 | * 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. |
| 6947 | */ |
| 6948 | g_object_interface_install_property (iface, |
| 6949 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6950 | /** |
| 6951 | * SensorI2c:address: |
| 6952 | * |
| 6953 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 6954 | * |
| 6955 | * 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. |
| 6956 | */ |
| 6957 | g_object_interface_install_property (iface, |
| 6958 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6959 | } |
| 6960 | |
| 6961 | /** |
| 6962 | * sensor_i2c_get_dev_path: (skip) |
| 6963 | * @object: A #SensorI2c. |
| 6964 | * |
| 6965 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 6966 | * |
| 6967 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6968 | * |
| 6969 | * <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> |
| 6970 | * |
| 6971 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 6972 | */ |
| 6973 | const gchar * |
| 6974 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 6975 | { |
| 6976 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 6977 | } |
| 6978 | |
| 6979 | /** |
| 6980 | * sensor_i2c_dup_dev_path: (skip) |
| 6981 | * @object: A #SensorI2c. |
| 6982 | * |
| 6983 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 6984 | * |
| 6985 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 6986 | * |
| 6987 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 6988 | */ |
| 6989 | gchar * |
| 6990 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 6991 | { |
| 6992 | gchar *value; |
| 6993 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 6994 | return value; |
| 6995 | } |
| 6996 | |
| 6997 | /** |
| 6998 | * sensor_i2c_set_dev_path: (skip) |
| 6999 | * @object: A #SensorI2c. |
| 7000 | * @value: The value to set. |
| 7001 | * |
| 7002 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 7003 | * |
| 7004 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7005 | */ |
| 7006 | void |
| 7007 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 7008 | { |
| 7009 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 7010 | } |
| 7011 | |
| 7012 | /** |
| 7013 | * sensor_i2c_get_address: (skip) |
| 7014 | * @object: A #SensorI2c. |
| 7015 | * |
| 7016 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 7017 | * |
| 7018 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7019 | * |
| 7020 | * <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> |
| 7021 | * |
| 7022 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 7023 | */ |
| 7024 | const gchar * |
| 7025 | sensor_i2c_get_address (SensorI2c *object) |
| 7026 | { |
| 7027 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 7028 | } |
| 7029 | |
| 7030 | /** |
| 7031 | * sensor_i2c_dup_address: (skip) |
| 7032 | * @object: A #SensorI2c. |
| 7033 | * |
| 7034 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 7035 | * |
| 7036 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7037 | * |
| 7038 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 7039 | */ |
| 7040 | gchar * |
| 7041 | sensor_i2c_dup_address (SensorI2c *object) |
| 7042 | { |
| 7043 | gchar *value; |
| 7044 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 7045 | return value; |
| 7046 | } |
| 7047 | |
| 7048 | /** |
| 7049 | * sensor_i2c_set_address: (skip) |
| 7050 | * @object: A #SensorI2c. |
| 7051 | * @value: The value to set. |
| 7052 | * |
| 7053 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 7054 | * |
| 7055 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 7056 | */ |
| 7057 | void |
| 7058 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 7059 | { |
| 7060 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 7061 | } |
| 7062 | |
| 7063 | /* ------------------------------------------------------------------------ */ |
| 7064 | |
| 7065 | /** |
| 7066 | * SensorI2cProxy: |
| 7067 | * |
| 7068 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 7069 | */ |
| 7070 | |
| 7071 | /** |
| 7072 | * SensorI2cProxyClass: |
| 7073 | * @parent_class: The parent class. |
| 7074 | * |
| 7075 | * Class structure for #SensorI2cProxy. |
| 7076 | */ |
| 7077 | |
| 7078 | struct _SensorI2cProxyPrivate |
| 7079 | { |
| 7080 | GData *qdata; |
| 7081 | }; |
| 7082 | |
| 7083 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 7084 | |
| 7085 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7086 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 7087 | G_ADD_PRIVATE (SensorI2cProxy) |
| 7088 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 7089 | |
| 7090 | #else |
| 7091 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 7092 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 7093 | |
| 7094 | #endif |
| 7095 | static void |
| 7096 | sensor_i2c_proxy_finalize (GObject *object) |
| 7097 | { |
| 7098 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 7099 | g_datalist_clear (&proxy->priv->qdata); |
| 7100 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 7101 | } |
| 7102 | |
| 7103 | static void |
| 7104 | sensor_i2c_proxy_get_property (GObject *object, |
| 7105 | guint prop_id, |
| 7106 | GValue *value, |
| 7107 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7108 | { |
| 7109 | const _ExtendedGDBusPropertyInfo *info; |
| 7110 | GVariant *variant; |
| 7111 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7112 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 7113 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 7114 | if (info->use_gvariant) |
| 7115 | { |
| 7116 | g_value_set_variant (value, variant); |
| 7117 | } |
| 7118 | else |
| 7119 | { |
| 7120 | if (variant != NULL) |
| 7121 | g_dbus_gvariant_to_gvalue (variant, value); |
| 7122 | } |
| 7123 | if (variant != NULL) |
| 7124 | g_variant_unref (variant); |
| 7125 | } |
| 7126 | |
| 7127 | static void |
| 7128 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 7129 | GAsyncResult *res, |
| 7130 | gpointer user_data) |
| 7131 | { |
| 7132 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 7133 | GError *error; |
| 7134 | GVariant *_ret; |
| 7135 | error = NULL; |
| 7136 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 7137 | if (!_ret) |
| 7138 | { |
| 7139 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 7140 | info->parent_struct.name, |
| 7141 | error->message, g_quark_to_string (error->domain), error->code); |
| 7142 | g_error_free (error); |
| 7143 | } |
| 7144 | else |
| 7145 | { |
| 7146 | g_variant_unref (_ret); |
| 7147 | } |
| 7148 | } |
| 7149 | |
| 7150 | static void |
| 7151 | sensor_i2c_proxy_set_property (GObject *object, |
| 7152 | guint prop_id, |
| 7153 | const GValue *value, |
| 7154 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7155 | { |
| 7156 | const _ExtendedGDBusPropertyInfo *info; |
| 7157 | GVariant *variant; |
| 7158 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7159 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 7160 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7161 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 7162 | "org.freedesktop.DBus.Properties.Set", |
| 7163 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 7164 | G_DBUS_CALL_FLAGS_NONE, |
| 7165 | -1, |
| 7166 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 7167 | g_variant_unref (variant); |
| 7168 | } |
| 7169 | |
| 7170 | static void |
| 7171 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 7172 | const gchar *sender_name G_GNUC_UNUSED, |
| 7173 | const gchar *signal_name, |
| 7174 | GVariant *parameters) |
| 7175 | { |
| 7176 | _ExtendedGDBusSignalInfo *info; |
| 7177 | GVariantIter iter; |
| 7178 | GVariant *child; |
| 7179 | GValue *paramv; |
| 7180 | guint num_params; |
| 7181 | guint n; |
| 7182 | guint signal_id; |
| 7183 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 7184 | if (info == NULL) |
| 7185 | return; |
| 7186 | num_params = g_variant_n_children (parameters); |
| 7187 | paramv = g_new0 (GValue, num_params + 1); |
| 7188 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 7189 | g_value_set_object (¶mv[0], proxy); |
| 7190 | g_variant_iter_init (&iter, parameters); |
| 7191 | n = 1; |
| 7192 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7193 | { |
| 7194 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 7195 | if (arg_info->use_gvariant) |
| 7196 | { |
| 7197 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7198 | g_value_set_variant (¶mv[n], child); |
| 7199 | n++; |
| 7200 | } |
| 7201 | else |
| 7202 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7203 | g_variant_unref (child); |
| 7204 | } |
| 7205 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 7206 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 7207 | for (n = 0; n < num_params + 1; n++) |
| 7208 | g_value_unset (¶mv[n]); |
| 7209 | g_free (paramv); |
| 7210 | } |
| 7211 | |
| 7212 | static void |
| 7213 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 7214 | GVariant *changed_properties, |
| 7215 | const gchar *const *invalidated_properties) |
| 7216 | { |
| 7217 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 7218 | guint n; |
| 7219 | const gchar *key; |
| 7220 | GVariantIter *iter; |
| 7221 | _ExtendedGDBusPropertyInfo *info; |
| 7222 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 7223 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 7224 | { |
| 7225 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 7226 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 7227 | if (info != NULL) |
| 7228 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7229 | } |
| 7230 | g_variant_iter_free (iter); |
| 7231 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 7232 | { |
| 7233 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 7234 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 7235 | if (info != NULL) |
| 7236 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7237 | } |
| 7238 | } |
| 7239 | |
| 7240 | static const gchar * |
| 7241 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 7242 | { |
| 7243 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 7244 | GVariant *variant; |
| 7245 | const gchar *value = NULL; |
| 7246 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 7247 | if (variant != NULL) |
| 7248 | { |
| 7249 | value = g_variant_get_string (variant, NULL); |
| 7250 | g_variant_unref (variant); |
| 7251 | } |
| 7252 | return value; |
| 7253 | } |
| 7254 | |
| 7255 | static const gchar * |
| 7256 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 7257 | { |
| 7258 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 7259 | GVariant *variant; |
| 7260 | const gchar *value = NULL; |
| 7261 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 7262 | if (variant != NULL) |
| 7263 | { |
| 7264 | value = g_variant_get_string (variant, NULL); |
| 7265 | g_variant_unref (variant); |
| 7266 | } |
| 7267 | return value; |
| 7268 | } |
| 7269 | |
| 7270 | static void |
| 7271 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 7272 | { |
| 7273 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7274 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 7275 | #else |
| 7276 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 7277 | #endif |
| 7278 | |
| 7279 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 7280 | } |
| 7281 | |
| 7282 | static void |
| 7283 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 7284 | { |
| 7285 | GObjectClass *gobject_class; |
| 7286 | GDBusProxyClass *proxy_class; |
| 7287 | |
| 7288 | gobject_class = G_OBJECT_CLASS (klass); |
| 7289 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 7290 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 7291 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 7292 | |
| 7293 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 7294 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 7295 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 7296 | |
| 7297 | sensor_i2c_override_properties (gobject_class, 1); |
| 7298 | |
| 7299 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7300 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 7301 | #endif |
| 7302 | } |
| 7303 | |
| 7304 | static void |
| 7305 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 7306 | { |
| 7307 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 7308 | iface->get_address = sensor_i2c_proxy_get_address; |
| 7309 | } |
| 7310 | |
| 7311 | /** |
| 7312 | * sensor_i2c_proxy_new: |
| 7313 | * @connection: A #GDBusConnection. |
| 7314 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7315 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7316 | * @object_path: An object path. |
| 7317 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7318 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7319 | * @user_data: User data to pass to @callback. |
| 7320 | * |
| 7321 | * 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. |
| 7322 | * |
| 7323 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7324 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 7325 | * |
| 7326 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 7327 | */ |
| 7328 | void |
| 7329 | sensor_i2c_proxy_new ( |
| 7330 | GDBusConnection *connection, |
| 7331 | GDBusProxyFlags flags, |
| 7332 | const gchar *name, |
| 7333 | const gchar *object_path, |
| 7334 | GCancellable *cancellable, |
| 7335 | GAsyncReadyCallback callback, |
| 7336 | gpointer user_data) |
| 7337 | { |
| 7338 | 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); |
| 7339 | } |
| 7340 | |
| 7341 | /** |
| 7342 | * sensor_i2c_proxy_new_finish: |
| 7343 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 7344 | * @error: Return location for error or %NULL |
| 7345 | * |
| 7346 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 7347 | * |
| 7348 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 7349 | */ |
| 7350 | SensorI2c * |
| 7351 | sensor_i2c_proxy_new_finish ( |
| 7352 | GAsyncResult *res, |
| 7353 | GError **error) |
| 7354 | { |
| 7355 | GObject *ret; |
| 7356 | GObject *source_object; |
| 7357 | source_object = g_async_result_get_source_object (res); |
| 7358 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7359 | g_object_unref (source_object); |
| 7360 | if (ret != NULL) |
| 7361 | return SENSOR_I2C (ret); |
| 7362 | else |
| 7363 | return NULL; |
| 7364 | } |
| 7365 | |
| 7366 | /** |
| 7367 | * sensor_i2c_proxy_new_sync: |
| 7368 | * @connection: A #GDBusConnection. |
| 7369 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7370 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7371 | * @object_path: An object path. |
| 7372 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7373 | * @error: Return location for error or %NULL |
| 7374 | * |
| 7375 | * 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. |
| 7376 | * |
| 7377 | * The calling thread is blocked until a reply is received. |
| 7378 | * |
| 7379 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 7380 | * |
| 7381 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 7382 | */ |
| 7383 | SensorI2c * |
| 7384 | sensor_i2c_proxy_new_sync ( |
| 7385 | GDBusConnection *connection, |
| 7386 | GDBusProxyFlags flags, |
| 7387 | const gchar *name, |
| 7388 | const gchar *object_path, |
| 7389 | GCancellable *cancellable, |
| 7390 | GError **error) |
| 7391 | { |
| 7392 | GInitable *ret; |
| 7393 | 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); |
| 7394 | if (ret != NULL) |
| 7395 | return SENSOR_I2C (ret); |
| 7396 | else |
| 7397 | return NULL; |
| 7398 | } |
| 7399 | |
| 7400 | |
| 7401 | /** |
| 7402 | * sensor_i2c_proxy_new_for_bus: |
| 7403 | * @bus_type: A #GBusType. |
| 7404 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7405 | * @name: A bus name (well-known or unique). |
| 7406 | * @object_path: An object path. |
| 7407 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7408 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7409 | * @user_data: User data to pass to @callback. |
| 7410 | * |
| 7411 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 7412 | * |
| 7413 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7414 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 7415 | * |
| 7416 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 7417 | */ |
| 7418 | void |
| 7419 | sensor_i2c_proxy_new_for_bus ( |
| 7420 | GBusType bus_type, |
| 7421 | GDBusProxyFlags flags, |
| 7422 | const gchar *name, |
| 7423 | const gchar *object_path, |
| 7424 | GCancellable *cancellable, |
| 7425 | GAsyncReadyCallback callback, |
| 7426 | gpointer user_data) |
| 7427 | { |
| 7428 | 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); |
| 7429 | } |
| 7430 | |
| 7431 | /** |
| 7432 | * sensor_i2c_proxy_new_for_bus_finish: |
| 7433 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 7434 | * @error: Return location for error or %NULL |
| 7435 | * |
| 7436 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 7437 | * |
| 7438 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 7439 | */ |
| 7440 | SensorI2c * |
| 7441 | sensor_i2c_proxy_new_for_bus_finish ( |
| 7442 | GAsyncResult *res, |
| 7443 | GError **error) |
| 7444 | { |
| 7445 | GObject *ret; |
| 7446 | GObject *source_object; |
| 7447 | source_object = g_async_result_get_source_object (res); |
| 7448 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7449 | g_object_unref (source_object); |
| 7450 | if (ret != NULL) |
| 7451 | return SENSOR_I2C (ret); |
| 7452 | else |
| 7453 | return NULL; |
| 7454 | } |
| 7455 | |
| 7456 | /** |
| 7457 | * sensor_i2c_proxy_new_for_bus_sync: |
| 7458 | * @bus_type: A #GBusType. |
| 7459 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7460 | * @name: A bus name (well-known or unique). |
| 7461 | * @object_path: An object path. |
| 7462 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7463 | * @error: Return location for error or %NULL |
| 7464 | * |
| 7465 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 7466 | * |
| 7467 | * The calling thread is blocked until a reply is received. |
| 7468 | * |
| 7469 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 7470 | * |
| 7471 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 7472 | */ |
| 7473 | SensorI2c * |
| 7474 | sensor_i2c_proxy_new_for_bus_sync ( |
| 7475 | GBusType bus_type, |
| 7476 | GDBusProxyFlags flags, |
| 7477 | const gchar *name, |
| 7478 | const gchar *object_path, |
| 7479 | GCancellable *cancellable, |
| 7480 | GError **error) |
| 7481 | { |
| 7482 | GInitable *ret; |
| 7483 | 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); |
| 7484 | if (ret != NULL) |
| 7485 | return SENSOR_I2C (ret); |
| 7486 | else |
| 7487 | return NULL; |
| 7488 | } |
| 7489 | |
| 7490 | |
| 7491 | /* ------------------------------------------------------------------------ */ |
| 7492 | |
| 7493 | /** |
| 7494 | * SensorI2cSkeleton: |
| 7495 | * |
| 7496 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 7497 | */ |
| 7498 | |
| 7499 | /** |
| 7500 | * SensorI2cSkeletonClass: |
| 7501 | * @parent_class: The parent class. |
| 7502 | * |
| 7503 | * Class structure for #SensorI2cSkeleton. |
| 7504 | */ |
| 7505 | |
| 7506 | struct _SensorI2cSkeletonPrivate |
| 7507 | { |
| 7508 | GValue *properties; |
| 7509 | GList *changed_properties; |
| 7510 | GSource *changed_properties_idle_source; |
| 7511 | GMainContext *context; |
| 7512 | GMutex lock; |
| 7513 | }; |
| 7514 | |
| 7515 | static void |
| 7516 | _sensor_i2c_skeleton_handle_method_call ( |
| 7517 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7518 | const gchar *sender G_GNUC_UNUSED, |
| 7519 | const gchar *object_path G_GNUC_UNUSED, |
| 7520 | const gchar *interface_name, |
| 7521 | const gchar *method_name, |
| 7522 | GVariant *parameters, |
| 7523 | GDBusMethodInvocation *invocation, |
| 7524 | gpointer user_data) |
| 7525 | { |
| 7526 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 7527 | _ExtendedGDBusMethodInfo *info; |
| 7528 | GVariantIter iter; |
| 7529 | GVariant *child; |
| 7530 | GValue *paramv; |
| 7531 | guint num_params; |
| 7532 | guint num_extra; |
| 7533 | guint n; |
| 7534 | guint signal_id; |
| 7535 | GValue return_value = G_VALUE_INIT; |
| 7536 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 7537 | g_assert (info != NULL); |
| 7538 | num_params = g_variant_n_children (parameters); |
| 7539 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 7540 | n = 0; |
| 7541 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 7542 | g_value_set_object (¶mv[n++], skeleton); |
| 7543 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 7544 | g_value_set_object (¶mv[n++], invocation); |
| 7545 | if (info->pass_fdlist) |
| 7546 | { |
| 7547 | #ifdef G_OS_UNIX |
| 7548 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 7549 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 7550 | #else |
| 7551 | g_assert_not_reached (); |
| 7552 | #endif |
| 7553 | } |
| 7554 | g_variant_iter_init (&iter, parameters); |
| 7555 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7556 | { |
| 7557 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 7558 | if (arg_info->use_gvariant) |
| 7559 | { |
| 7560 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7561 | g_value_set_variant (¶mv[n], child); |
| 7562 | n++; |
| 7563 | } |
| 7564 | else |
| 7565 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7566 | g_variant_unref (child); |
| 7567 | } |
| 7568 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 7569 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 7570 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 7571 | if (!g_value_get_boolean (&return_value)) |
| 7572 | 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); |
| 7573 | g_value_unset (&return_value); |
| 7574 | for (n = 0; n < num_params + num_extra; n++) |
| 7575 | g_value_unset (¶mv[n]); |
| 7576 | g_free (paramv); |
| 7577 | } |
| 7578 | |
| 7579 | static GVariant * |
| 7580 | _sensor_i2c_skeleton_handle_get_property ( |
| 7581 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7582 | const gchar *sender G_GNUC_UNUSED, |
| 7583 | const gchar *object_path G_GNUC_UNUSED, |
| 7584 | const gchar *interface_name G_GNUC_UNUSED, |
| 7585 | const gchar *property_name, |
| 7586 | GError **error, |
| 7587 | gpointer user_data) |
| 7588 | { |
| 7589 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 7590 | GValue value = G_VALUE_INIT; |
| 7591 | GParamSpec *pspec; |
| 7592 | _ExtendedGDBusPropertyInfo *info; |
| 7593 | GVariant *ret; |
| 7594 | ret = NULL; |
| 7595 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 7596 | g_assert (info != NULL); |
| 7597 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7598 | if (pspec == NULL) |
| 7599 | { |
| 7600 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7601 | } |
| 7602 | else |
| 7603 | { |
| 7604 | g_value_init (&value, pspec->value_type); |
| 7605 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7606 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7607 | g_value_unset (&value); |
| 7608 | } |
| 7609 | return ret; |
| 7610 | } |
| 7611 | |
| 7612 | static gboolean |
| 7613 | _sensor_i2c_skeleton_handle_set_property ( |
| 7614 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7615 | const gchar *sender G_GNUC_UNUSED, |
| 7616 | const gchar *object_path G_GNUC_UNUSED, |
| 7617 | const gchar *interface_name G_GNUC_UNUSED, |
| 7618 | const gchar *property_name, |
| 7619 | GVariant *variant, |
| 7620 | GError **error, |
| 7621 | gpointer user_data) |
| 7622 | { |
| 7623 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 7624 | GValue value = G_VALUE_INIT; |
| 7625 | GParamSpec *pspec; |
| 7626 | _ExtendedGDBusPropertyInfo *info; |
| 7627 | gboolean ret; |
| 7628 | ret = FALSE; |
| 7629 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 7630 | g_assert (info != NULL); |
| 7631 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 7632 | if (pspec == NULL) |
| 7633 | { |
| 7634 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 7635 | } |
| 7636 | else |
| 7637 | { |
| 7638 | if (info->use_gvariant) |
| 7639 | g_value_set_variant (&value, variant); |
| 7640 | else |
| 7641 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 7642 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 7643 | g_value_unset (&value); |
| 7644 | ret = TRUE; |
| 7645 | } |
| 7646 | return ret; |
| 7647 | } |
| 7648 | |
| 7649 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 7650 | { |
| 7651 | _sensor_i2c_skeleton_handle_method_call, |
| 7652 | _sensor_i2c_skeleton_handle_get_property, |
| 7653 | _sensor_i2c_skeleton_handle_set_property, |
| 7654 | {NULL} |
| 7655 | }; |
| 7656 | |
| 7657 | static GDBusInterfaceInfo * |
| 7658 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7659 | { |
| 7660 | return sensor_i2c_interface_info (); |
| 7661 | } |
| 7662 | |
| 7663 | static GDBusInterfaceVTable * |
| 7664 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 7665 | { |
| 7666 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 7667 | } |
| 7668 | |
| 7669 | static GVariant * |
| 7670 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 7671 | { |
| 7672 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 7673 | |
| 7674 | GVariantBuilder builder; |
| 7675 | guint n; |
| 7676 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7677 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 7678 | goto out; |
| 7679 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 7680 | { |
| 7681 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 7682 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 7683 | { |
| 7684 | GVariant *value; |
| 7685 | 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); |
| 7686 | if (value != NULL) |
| 7687 | { |
| 7688 | g_variant_take_ref (value); |
| 7689 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 7690 | g_variant_unref (value); |
| 7691 | } |
| 7692 | } |
| 7693 | } |
| 7694 | out: |
| 7695 | return g_variant_builder_end (&builder); |
| 7696 | } |
| 7697 | |
| 7698 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 7699 | |
| 7700 | static void |
| 7701 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 7702 | { |
| 7703 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 7704 | gboolean emit_changed = FALSE; |
| 7705 | |
| 7706 | g_mutex_lock (&skeleton->priv->lock); |
| 7707 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7708 | { |
| 7709 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7710 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7711 | emit_changed = TRUE; |
| 7712 | } |
| 7713 | g_mutex_unlock (&skeleton->priv->lock); |
| 7714 | |
| 7715 | if (emit_changed) |
| 7716 | _sensor_i2c_emit_changed (skeleton); |
| 7717 | } |
| 7718 | |
| 7719 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 7720 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7721 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7722 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 7723 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 7724 | |
| 7725 | #else |
| 7726 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 7727 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 7728 | |
| 7729 | #endif |
| 7730 | static void |
| 7731 | sensor_i2c_skeleton_finalize (GObject *object) |
| 7732 | { |
| 7733 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7734 | guint n; |
| 7735 | for (n = 0; n < 2; n++) |
| 7736 | g_value_unset (&skeleton->priv->properties[n]); |
| 7737 | g_free (skeleton->priv->properties); |
| 7738 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7739 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 7740 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 7741 | g_main_context_unref (skeleton->priv->context); |
| 7742 | g_mutex_clear (&skeleton->priv->lock); |
| 7743 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 7744 | } |
| 7745 | |
| 7746 | static void |
| 7747 | sensor_i2c_skeleton_get_property (GObject *object, |
| 7748 | guint prop_id, |
| 7749 | GValue *value, |
| 7750 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7751 | { |
| 7752 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7753 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7754 | g_mutex_lock (&skeleton->priv->lock); |
| 7755 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 7756 | g_mutex_unlock (&skeleton->priv->lock); |
| 7757 | } |
| 7758 | |
| 7759 | static gboolean |
| 7760 | _sensor_i2c_emit_changed (gpointer user_data) |
| 7761 | { |
| 7762 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 7763 | GList *l; |
| 7764 | GVariantBuilder builder; |
| 7765 | GVariantBuilder invalidated_builder; |
| 7766 | guint num_changes; |
| 7767 | |
| 7768 | g_mutex_lock (&skeleton->priv->lock); |
| 7769 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 7770 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 7771 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 7772 | { |
| 7773 | ChangedProperty *cp = l->data; |
| 7774 | GVariant *variant; |
| 7775 | const GValue *cur_value; |
| 7776 | |
| 7777 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 7778 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 7779 | { |
| 7780 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 7781 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 7782 | g_variant_unref (variant); |
| 7783 | num_changes++; |
| 7784 | } |
| 7785 | } |
| 7786 | if (num_changes > 0) |
| 7787 | { |
| 7788 | GList *connections, *ll; |
| 7789 | GVariant *signal_variant; |
| 7790 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 7791 | &builder, &invalidated_builder)); |
| 7792 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 7793 | for (ll = connections; ll != NULL; ll = ll->next) |
| 7794 | { |
| 7795 | GDBusConnection *connection = ll->data; |
| 7796 | |
| 7797 | g_dbus_connection_emit_signal (connection, |
| 7798 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 7799 | "org.freedesktop.DBus.Properties", |
| 7800 | "PropertiesChanged", |
| 7801 | signal_variant, |
| 7802 | NULL); |
| 7803 | } |
| 7804 | g_variant_unref (signal_variant); |
| 7805 | g_list_free_full (connections, g_object_unref); |
| 7806 | } |
| 7807 | else |
| 7808 | { |
| 7809 | g_variant_builder_clear (&builder); |
| 7810 | g_variant_builder_clear (&invalidated_builder); |
| 7811 | } |
| 7812 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 7813 | skeleton->priv->changed_properties = NULL; |
| 7814 | skeleton->priv->changed_properties_idle_source = NULL; |
| 7815 | g_mutex_unlock (&skeleton->priv->lock); |
| 7816 | return FALSE; |
| 7817 | } |
| 7818 | |
| 7819 | static void |
| 7820 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 7821 | { |
| 7822 | ChangedProperty *cp; |
| 7823 | GList *l; |
| 7824 | cp = NULL; |
| 7825 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 7826 | { |
| 7827 | ChangedProperty *i_cp = l->data; |
| 7828 | if (i_cp->info == info) |
| 7829 | { |
| 7830 | cp = i_cp; |
| 7831 | break; |
| 7832 | } |
| 7833 | } |
| 7834 | if (cp == NULL) |
| 7835 | { |
| 7836 | cp = g_new0 (ChangedProperty, 1); |
| 7837 | cp->prop_id = prop_id; |
| 7838 | cp->info = info; |
| 7839 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 7840 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 7841 | g_value_copy (orig_value, &cp->orig_value); |
| 7842 | } |
| 7843 | } |
| 7844 | |
| 7845 | static void |
| 7846 | sensor_i2c_skeleton_notify (GObject *object, |
| 7847 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7848 | { |
| 7849 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7850 | g_mutex_lock (&skeleton->priv->lock); |
| 7851 | if (skeleton->priv->changed_properties != NULL && |
| 7852 | skeleton->priv->changed_properties_idle_source == NULL) |
| 7853 | { |
| 7854 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 7855 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 7856 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 7857 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 7858 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 7859 | } |
| 7860 | g_mutex_unlock (&skeleton->priv->lock); |
| 7861 | } |
| 7862 | |
| 7863 | static void |
| 7864 | sensor_i2c_skeleton_set_property (GObject *object, |
| 7865 | guint prop_id, |
| 7866 | const GValue *value, |
| 7867 | GParamSpec *pspec) |
| 7868 | { |
| 7869 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7870 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 7871 | g_mutex_lock (&skeleton->priv->lock); |
| 7872 | g_object_freeze_notify (object); |
| 7873 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 7874 | { |
| 7875 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 7876 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 7877 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 7878 | g_object_notify_by_pspec (object, pspec); |
| 7879 | } |
| 7880 | g_mutex_unlock (&skeleton->priv->lock); |
| 7881 | g_object_thaw_notify (object); |
| 7882 | } |
| 7883 | |
| 7884 | static void |
| 7885 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 7886 | { |
| 7887 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7888 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 7889 | #else |
| 7890 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 7891 | #endif |
| 7892 | |
| 7893 | g_mutex_init (&skeleton->priv->lock); |
| 7894 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 7895 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 7896 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 7897 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 7898 | } |
| 7899 | |
| 7900 | static const gchar * |
| 7901 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 7902 | { |
| 7903 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7904 | const gchar *value; |
| 7905 | g_mutex_lock (&skeleton->priv->lock); |
| 7906 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 7907 | g_mutex_unlock (&skeleton->priv->lock); |
| 7908 | return value; |
| 7909 | } |
| 7910 | |
| 7911 | static const gchar * |
| 7912 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 7913 | { |
| 7914 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 7915 | const gchar *value; |
| 7916 | g_mutex_lock (&skeleton->priv->lock); |
| 7917 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 7918 | g_mutex_unlock (&skeleton->priv->lock); |
| 7919 | return value; |
| 7920 | } |
| 7921 | |
| 7922 | static void |
| 7923 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 7924 | { |
| 7925 | GObjectClass *gobject_class; |
| 7926 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 7927 | |
| 7928 | gobject_class = G_OBJECT_CLASS (klass); |
| 7929 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 7930 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 7931 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 7932 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 7933 | |
| 7934 | |
| 7935 | sensor_i2c_override_properties (gobject_class, 1); |
| 7936 | |
| 7937 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 7938 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 7939 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 7940 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 7941 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 7942 | |
| 7943 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7944 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 7945 | #endif |
| 7946 | } |
| 7947 | |
| 7948 | static void |
| 7949 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 7950 | { |
| 7951 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 7952 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 7953 | } |
| 7954 | |
| 7955 | /** |
| 7956 | * sensor_i2c_skeleton_new: |
| 7957 | * |
| 7958 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 7959 | * |
| 7960 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 7961 | */ |
| 7962 | SensorI2c * |
| 7963 | sensor_i2c_skeleton_new (void) |
| 7964 | { |
| 7965 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 7966 | } |
| 7967 | |
| 7968 | /* ------------------------------------------------------------------------ |
| 7969 | * Code for interface org.openbmc.SensorMatch |
| 7970 | * ------------------------------------------------------------------------ |
| 7971 | */ |
| 7972 | |
| 7973 | /** |
| 7974 | * SECTION:SensorMatch |
| 7975 | * @title: SensorMatch |
| 7976 | * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface |
| 7977 | * |
| 7978 | * 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. |
| 7979 | */ |
| 7980 | |
| 7981 | /* ---- Introspection data for org.openbmc.SensorMatch ---- */ |
| 7982 | |
| 7983 | static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = |
| 7984 | { |
| 7985 | { |
| 7986 | -1, |
| 7987 | (gchar *) "state", |
| 7988 | (gchar *) "y", |
| 7989 | NULL |
| 7990 | }, |
| 7991 | FALSE |
| 7992 | }; |
| 7993 | |
| 7994 | static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = |
| 7995 | { |
| 7996 | &_sensor_match_signal_info_sensor_match_ARG_state, |
| 7997 | NULL |
| 7998 | }; |
| 7999 | |
| 8000 | static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = |
| 8001 | { |
| 8002 | { |
| 8003 | -1, |
| 8004 | (gchar *) "SensorMatch", |
| 8005 | (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, |
| 8006 | NULL |
| 8007 | }, |
| 8008 | "sensor-match" |
| 8009 | }; |
| 8010 | |
| 8011 | static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = |
| 8012 | { |
| 8013 | &_sensor_match_signal_info_sensor_match, |
| 8014 | NULL |
| 8015 | }; |
| 8016 | |
| 8017 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = |
| 8018 | { |
| 8019 | { |
| 8020 | -1, |
| 8021 | (gchar *) "match_value", |
| 8022 | (gchar *) "v", |
| 8023 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 8024 | NULL |
| 8025 | }, |
| 8026 | "match-value", |
| 8027 | FALSE |
| 8028 | }; |
| 8029 | |
| 8030 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = |
| 8031 | { |
| 8032 | { |
| 8033 | -1, |
| 8034 | (gchar *) "state", |
| 8035 | (gchar *) "y", |
| 8036 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 8037 | NULL |
| 8038 | }, |
| 8039 | "state", |
| 8040 | FALSE |
| 8041 | }; |
| 8042 | |
| 8043 | static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = |
| 8044 | { |
| 8045 | &_sensor_match_property_info_match_value, |
| 8046 | &_sensor_match_property_info_state, |
| 8047 | NULL |
| 8048 | }; |
| 8049 | |
| 8050 | static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = |
| 8051 | { |
| 8052 | { |
| 8053 | -1, |
| 8054 | (gchar *) "org.openbmc.SensorMatch", |
| 8055 | NULL, |
| 8056 | (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, |
| 8057 | (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, |
| 8058 | NULL |
| 8059 | }, |
| 8060 | "sensor-match", |
| 8061 | }; |
| 8062 | |
| 8063 | |
| 8064 | /** |
| 8065 | * sensor_match_interface_info: |
| 8066 | * |
| 8067 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. |
| 8068 | * |
| 8069 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 8070 | */ |
| 8071 | GDBusInterfaceInfo * |
| 8072 | sensor_match_interface_info (void) |
| 8073 | { |
| 8074 | return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; |
| 8075 | } |
| 8076 | |
| 8077 | /** |
| 8078 | * sensor_match_override_properties: |
| 8079 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 8080 | * @property_id_begin: The property id to assign to the first overridden property. |
| 8081 | * |
| 8082 | * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. |
| 8083 | * The properties are overridden in the order they are defined. |
| 8084 | * |
| 8085 | * Returns: The last property id. |
| 8086 | */ |
| 8087 | guint |
| 8088 | sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) |
| 8089 | { |
| 8090 | g_object_class_override_property (klass, property_id_begin++, "match-value"); |
| 8091 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 8092 | return property_id_begin - 1; |
| 8093 | } |
| 8094 | |
| 8095 | |
| 8096 | |
| 8097 | /** |
| 8098 | * SensorMatch: |
| 8099 | * |
| 8100 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 8101 | */ |
| 8102 | |
| 8103 | /** |
| 8104 | * SensorMatchIface: |
| 8105 | * @parent_iface: The parent interface. |
| 8106 | * @get_match_value: Getter for the #SensorMatch:match-value property. |
| 8107 | * @get_state: Getter for the #SensorMatch:state property. |
| 8108 | * @sensor_match: Handler for the #SensorMatch::sensor-match signal. |
| 8109 | * |
| 8110 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 8111 | */ |
| 8112 | |
| 8113 | typedef SensorMatchIface SensorMatchInterface; |
| 8114 | G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); |
| 8115 | |
| 8116 | static void |
| 8117 | sensor_match_default_init (SensorMatchIface *iface) |
| 8118 | { |
| 8119 | /* GObject signals for received D-Bus signals: */ |
| 8120 | /** |
| 8121 | * SensorMatch::sensor-match: |
| 8122 | * @object: A #SensorMatch. |
| 8123 | * @arg_state: Argument. |
| 8124 | * |
| 8125 | * 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. |
| 8126 | * |
| 8127 | * 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. |
| 8128 | */ |
| 8129 | g_signal_new ("sensor-match", |
| 8130 | G_TYPE_FROM_INTERFACE (iface), |
| 8131 | G_SIGNAL_RUN_LAST, |
| 8132 | G_STRUCT_OFFSET (SensorMatchIface, sensor_match), |
| 8133 | NULL, |
| 8134 | NULL, |
| 8135 | g_cclosure_marshal_generic, |
| 8136 | G_TYPE_NONE, |
| 8137 | 1, G_TYPE_UCHAR); |
| 8138 | |
| 8139 | /* GObject properties for D-Bus properties: */ |
| 8140 | /** |
| 8141 | * SensorMatch:match-value: |
| 8142 | * |
| 8143 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. |
| 8144 | * |
| 8145 | * 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. |
| 8146 | */ |
| 8147 | g_object_interface_install_property (iface, |
| 8148 | g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8149 | /** |
| 8150 | * SensorMatch:state: |
| 8151 | * |
| 8152 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. |
| 8153 | * |
| 8154 | * 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. |
| 8155 | */ |
| 8156 | g_object_interface_install_property (iface, |
| 8157 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 8158 | } |
| 8159 | |
| 8160 | /** |
| 8161 | * sensor_match_get_match_value: (skip) |
| 8162 | * @object: A #SensorMatch. |
| 8163 | * |
| 8164 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 8165 | * |
| 8166 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8167 | * |
| 8168 | * <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> |
| 8169 | * |
| 8170 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 8171 | */ |
| 8172 | GVariant * |
| 8173 | sensor_match_get_match_value (SensorMatch *object) |
| 8174 | { |
| 8175 | return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); |
| 8176 | } |
| 8177 | |
| 8178 | /** |
| 8179 | * sensor_match_dup_match_value: (skip) |
| 8180 | * @object: A #SensorMatch. |
| 8181 | * |
| 8182 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 8183 | * |
| 8184 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8185 | * |
| 8186 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 8187 | */ |
| 8188 | GVariant * |
| 8189 | sensor_match_dup_match_value (SensorMatch *object) |
| 8190 | { |
| 8191 | GVariant *value; |
| 8192 | g_object_get (G_OBJECT (object), "match-value", &value, NULL); |
| 8193 | return value; |
| 8194 | } |
| 8195 | |
| 8196 | /** |
| 8197 | * sensor_match_set_match_value: (skip) |
| 8198 | * @object: A #SensorMatch. |
| 8199 | * @value: The value to set. |
| 8200 | * |
| 8201 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. |
| 8202 | * |
| 8203 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 8204 | */ |
| 8205 | void |
| 8206 | sensor_match_set_match_value (SensorMatch *object, GVariant *value) |
| 8207 | { |
| 8208 | g_object_set (G_OBJECT (object), "match-value", value, NULL); |
| 8209 | } |
| 8210 | |
| 8211 | /** |
| 8212 | * sensor_match_get_state: (skip) |
| 8213 | * @object: A #SensorMatch. |
| 8214 | * |
| 8215 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. |
| 8216 | * |
| 8217 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 8218 | * |
| 8219 | * Returns: The property value. |
| 8220 | */ |
| 8221 | guchar |
| 8222 | sensor_match_get_state (SensorMatch *object) |
| 8223 | { |
| 8224 | return SENSOR_MATCH_GET_IFACE (object)->get_state (object); |
| 8225 | } |
| 8226 | |
| 8227 | /** |
| 8228 | * sensor_match_set_state: (skip) |
| 8229 | * @object: A #SensorMatch. |
| 8230 | * @value: The value to set. |
| 8231 | * |
| 8232 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. |
| 8233 | * |
| 8234 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 8235 | */ |
| 8236 | void |
| 8237 | sensor_match_set_state (SensorMatch *object, guchar value) |
| 8238 | { |
| 8239 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 8240 | } |
| 8241 | |
| 8242 | /** |
| 8243 | * sensor_match_emit_sensor_match: |
| 8244 | * @object: A #SensorMatch. |
| 8245 | * @arg_state: Argument to pass with the signal. |
| 8246 | * |
| 8247 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. |
| 8248 | */ |
| 8249 | void |
| 8250 | sensor_match_emit_sensor_match ( |
| 8251 | SensorMatch *object, |
| 8252 | guchar arg_state) |
| 8253 | { |
| 8254 | g_signal_emit_by_name (object, "sensor-match", arg_state); |
| 8255 | } |
| 8256 | |
| 8257 | /* ------------------------------------------------------------------------ */ |
| 8258 | |
| 8259 | /** |
| 8260 | * SensorMatchProxy: |
| 8261 | * |
| 8262 | * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. |
| 8263 | */ |
| 8264 | |
| 8265 | /** |
| 8266 | * SensorMatchProxyClass: |
| 8267 | * @parent_class: The parent class. |
| 8268 | * |
| 8269 | * Class structure for #SensorMatchProxy. |
| 8270 | */ |
| 8271 | |
| 8272 | struct _SensorMatchProxyPrivate |
| 8273 | { |
| 8274 | GData *qdata; |
| 8275 | }; |
| 8276 | |
| 8277 | static void sensor_match_proxy_iface_init (SensorMatchIface *iface); |
| 8278 | |
| 8279 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8280 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 8281 | G_ADD_PRIVATE (SensorMatchProxy) |
| 8282 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 8283 | |
| 8284 | #else |
| 8285 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 8286 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 8287 | |
| 8288 | #endif |
| 8289 | static void |
| 8290 | sensor_match_proxy_finalize (GObject *object) |
| 8291 | { |
| 8292 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 8293 | g_datalist_clear (&proxy->priv->qdata); |
| 8294 | G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); |
| 8295 | } |
| 8296 | |
| 8297 | static void |
| 8298 | sensor_match_proxy_get_property (GObject *object, |
| 8299 | guint prop_id, |
| 8300 | GValue *value, |
| 8301 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8302 | { |
| 8303 | const _ExtendedGDBusPropertyInfo *info; |
| 8304 | GVariant *variant; |
| 8305 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8306 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 8307 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 8308 | if (info->use_gvariant) |
| 8309 | { |
| 8310 | g_value_set_variant (value, variant); |
| 8311 | } |
| 8312 | else |
| 8313 | { |
| 8314 | if (variant != NULL) |
| 8315 | g_dbus_gvariant_to_gvalue (variant, value); |
| 8316 | } |
| 8317 | if (variant != NULL) |
| 8318 | g_variant_unref (variant); |
| 8319 | } |
| 8320 | |
| 8321 | static void |
| 8322 | sensor_match_proxy_set_property_cb (GDBusProxy *proxy, |
| 8323 | GAsyncResult *res, |
| 8324 | gpointer user_data) |
| 8325 | { |
| 8326 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 8327 | GError *error; |
| 8328 | GVariant *_ret; |
| 8329 | error = NULL; |
| 8330 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 8331 | if (!_ret) |
| 8332 | { |
| 8333 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", |
| 8334 | info->parent_struct.name, |
| 8335 | error->message, g_quark_to_string (error->domain), error->code); |
| 8336 | g_error_free (error); |
| 8337 | } |
| 8338 | else |
| 8339 | { |
| 8340 | g_variant_unref (_ret); |
| 8341 | } |
| 8342 | } |
| 8343 | |
| 8344 | static void |
| 8345 | sensor_match_proxy_set_property (GObject *object, |
| 8346 | guint prop_id, |
| 8347 | const GValue *value, |
| 8348 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8349 | { |
| 8350 | const _ExtendedGDBusPropertyInfo *info; |
| 8351 | GVariant *variant; |
| 8352 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8353 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 8354 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8355 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 8356 | "org.freedesktop.DBus.Properties.Set", |
| 8357 | g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), |
| 8358 | G_DBUS_CALL_FLAGS_NONE, |
| 8359 | -1, |
| 8360 | NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 8361 | g_variant_unref (variant); |
| 8362 | } |
| 8363 | |
| 8364 | static void |
| 8365 | sensor_match_proxy_g_signal (GDBusProxy *proxy, |
| 8366 | const gchar *sender_name G_GNUC_UNUSED, |
| 8367 | const gchar *signal_name, |
| 8368 | GVariant *parameters) |
| 8369 | { |
| 8370 | _ExtendedGDBusSignalInfo *info; |
| 8371 | GVariantIter iter; |
| 8372 | GVariant *child; |
| 8373 | GValue *paramv; |
| 8374 | guint num_params; |
| 8375 | guint n; |
| 8376 | guint signal_id; |
| 8377 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); |
| 8378 | if (info == NULL) |
| 8379 | return; |
| 8380 | num_params = g_variant_n_children (parameters); |
| 8381 | paramv = g_new0 (GValue, num_params + 1); |
| 8382 | g_value_init (¶mv[0], TYPE_SENSOR_MATCH); |
| 8383 | g_value_set_object (¶mv[0], proxy); |
| 8384 | g_variant_iter_init (&iter, parameters); |
| 8385 | n = 1; |
| 8386 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8387 | { |
| 8388 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 8389 | if (arg_info->use_gvariant) |
| 8390 | { |
| 8391 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8392 | g_value_set_variant (¶mv[n], child); |
| 8393 | n++; |
| 8394 | } |
| 8395 | else |
| 8396 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8397 | g_variant_unref (child); |
| 8398 | } |
| 8399 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 8400 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 8401 | for (n = 0; n < num_params + 1; n++) |
| 8402 | g_value_unset (¶mv[n]); |
| 8403 | g_free (paramv); |
| 8404 | } |
| 8405 | |
| 8406 | static void |
| 8407 | sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 8408 | GVariant *changed_properties, |
| 8409 | const gchar *const *invalidated_properties) |
| 8410 | { |
| 8411 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); |
| 8412 | guint n; |
| 8413 | const gchar *key; |
| 8414 | GVariantIter *iter; |
| 8415 | _ExtendedGDBusPropertyInfo *info; |
| 8416 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 8417 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 8418 | { |
| 8419 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); |
| 8420 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 8421 | if (info != NULL) |
| 8422 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8423 | } |
| 8424 | g_variant_iter_free (iter); |
| 8425 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 8426 | { |
| 8427 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); |
| 8428 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 8429 | if (info != NULL) |
| 8430 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 8431 | } |
| 8432 | } |
| 8433 | |
| 8434 | static GVariant * |
| 8435 | sensor_match_proxy_get_match_value (SensorMatch *object) |
| 8436 | { |
| 8437 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 8438 | GVariant *variant; |
| 8439 | GVariant *value = NULL; |
| 8440 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); |
| 8441 | value = variant; |
| 8442 | if (variant != NULL) |
| 8443 | g_variant_unref (variant); |
| 8444 | return value; |
| 8445 | } |
| 8446 | |
| 8447 | static guchar |
| 8448 | sensor_match_proxy_get_state (SensorMatch *object) |
| 8449 | { |
| 8450 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 8451 | GVariant *variant; |
| 8452 | guchar value = 0; |
| 8453 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 8454 | if (variant != NULL) |
| 8455 | { |
| 8456 | value = g_variant_get_byte (variant); |
| 8457 | g_variant_unref (variant); |
| 8458 | } |
| 8459 | return value; |
| 8460 | } |
| 8461 | |
| 8462 | static void |
| 8463 | sensor_match_proxy_init (SensorMatchProxy *proxy) |
| 8464 | { |
| 8465 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8466 | proxy->priv = sensor_match_proxy_get_instance_private (proxy); |
| 8467 | #else |
| 8468 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); |
| 8469 | #endif |
| 8470 | |
| 8471 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); |
| 8472 | } |
| 8473 | |
| 8474 | static void |
| 8475 | sensor_match_proxy_class_init (SensorMatchProxyClass *klass) |
| 8476 | { |
| 8477 | GObjectClass *gobject_class; |
| 8478 | GDBusProxyClass *proxy_class; |
| 8479 | |
| 8480 | gobject_class = G_OBJECT_CLASS (klass); |
| 8481 | gobject_class->finalize = sensor_match_proxy_finalize; |
| 8482 | gobject_class->get_property = sensor_match_proxy_get_property; |
| 8483 | gobject_class->set_property = sensor_match_proxy_set_property; |
| 8484 | |
| 8485 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 8486 | proxy_class->g_signal = sensor_match_proxy_g_signal; |
| 8487 | proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; |
| 8488 | |
| 8489 | sensor_match_override_properties (gobject_class, 1); |
| 8490 | |
| 8491 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8492 | g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); |
| 8493 | #endif |
| 8494 | } |
| 8495 | |
| 8496 | static void |
| 8497 | sensor_match_proxy_iface_init (SensorMatchIface *iface) |
| 8498 | { |
| 8499 | iface->get_match_value = sensor_match_proxy_get_match_value; |
| 8500 | iface->get_state = sensor_match_proxy_get_state; |
| 8501 | } |
| 8502 | |
| 8503 | /** |
| 8504 | * sensor_match_proxy_new: |
| 8505 | * @connection: A #GDBusConnection. |
| 8506 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8507 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8508 | * @object_path: An object path. |
| 8509 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8510 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8511 | * @user_data: User data to pass to @callback. |
| 8512 | * |
| 8513 | * 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. |
| 8514 | * |
| 8515 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 8516 | * You can then call sensor_match_proxy_new_finish() to get the result of the operation. |
| 8517 | * |
| 8518 | * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 8519 | */ |
| 8520 | void |
| 8521 | sensor_match_proxy_new ( |
| 8522 | GDBusConnection *connection, |
| 8523 | GDBusProxyFlags flags, |
| 8524 | const gchar *name, |
| 8525 | const gchar *object_path, |
| 8526 | GCancellable *cancellable, |
| 8527 | GAsyncReadyCallback callback, |
| 8528 | gpointer user_data) |
| 8529 | { |
| 8530 | 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); |
| 8531 | } |
| 8532 | |
| 8533 | /** |
| 8534 | * sensor_match_proxy_new_finish: |
| 8535 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). |
| 8536 | * @error: Return location for error or %NULL |
| 8537 | * |
| 8538 | * Finishes an operation started with sensor_match_proxy_new(). |
| 8539 | * |
| 8540 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 8541 | */ |
| 8542 | SensorMatch * |
| 8543 | sensor_match_proxy_new_finish ( |
| 8544 | GAsyncResult *res, |
| 8545 | GError **error) |
| 8546 | { |
| 8547 | GObject *ret; |
| 8548 | GObject *source_object; |
| 8549 | source_object = g_async_result_get_source_object (res); |
| 8550 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8551 | g_object_unref (source_object); |
| 8552 | if (ret != NULL) |
| 8553 | return SENSOR_MATCH (ret); |
| 8554 | else |
| 8555 | return NULL; |
| 8556 | } |
| 8557 | |
| 8558 | /** |
| 8559 | * sensor_match_proxy_new_sync: |
| 8560 | * @connection: A #GDBusConnection. |
| 8561 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8562 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 8563 | * @object_path: An object path. |
| 8564 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8565 | * @error: Return location for error or %NULL |
| 8566 | * |
| 8567 | * 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. |
| 8568 | * |
| 8569 | * The calling thread is blocked until a reply is received. |
| 8570 | * |
| 8571 | * See sensor_match_proxy_new() for the asynchronous version of this constructor. |
| 8572 | * |
| 8573 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 8574 | */ |
| 8575 | SensorMatch * |
| 8576 | sensor_match_proxy_new_sync ( |
| 8577 | GDBusConnection *connection, |
| 8578 | GDBusProxyFlags flags, |
| 8579 | const gchar *name, |
| 8580 | const gchar *object_path, |
| 8581 | GCancellable *cancellable, |
| 8582 | GError **error) |
| 8583 | { |
| 8584 | GInitable *ret; |
| 8585 | 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); |
| 8586 | if (ret != NULL) |
| 8587 | return SENSOR_MATCH (ret); |
| 8588 | else |
| 8589 | return NULL; |
| 8590 | } |
| 8591 | |
| 8592 | |
| 8593 | /** |
| 8594 | * sensor_match_proxy_new_for_bus: |
| 8595 | * @bus_type: A #GBusType. |
| 8596 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8597 | * @name: A bus name (well-known or unique). |
| 8598 | * @object_path: An object path. |
| 8599 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8600 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 8601 | * @user_data: User data to pass to @callback. |
| 8602 | * |
| 8603 | * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 8604 | * |
| 8605 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 8606 | * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. |
| 8607 | * |
| 8608 | * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 8609 | */ |
| 8610 | void |
| 8611 | sensor_match_proxy_new_for_bus ( |
| 8612 | GBusType bus_type, |
| 8613 | GDBusProxyFlags flags, |
| 8614 | const gchar *name, |
| 8615 | const gchar *object_path, |
| 8616 | GCancellable *cancellable, |
| 8617 | GAsyncReadyCallback callback, |
| 8618 | gpointer user_data) |
| 8619 | { |
| 8620 | 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); |
| 8621 | } |
| 8622 | |
| 8623 | /** |
| 8624 | * sensor_match_proxy_new_for_bus_finish: |
| 8625 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). |
| 8626 | * @error: Return location for error or %NULL |
| 8627 | * |
| 8628 | * Finishes an operation started with sensor_match_proxy_new_for_bus(). |
| 8629 | * |
| 8630 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 8631 | */ |
| 8632 | SensorMatch * |
| 8633 | sensor_match_proxy_new_for_bus_finish ( |
| 8634 | GAsyncResult *res, |
| 8635 | GError **error) |
| 8636 | { |
| 8637 | GObject *ret; |
| 8638 | GObject *source_object; |
| 8639 | source_object = g_async_result_get_source_object (res); |
| 8640 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 8641 | g_object_unref (source_object); |
| 8642 | if (ret != NULL) |
| 8643 | return SENSOR_MATCH (ret); |
| 8644 | else |
| 8645 | return NULL; |
| 8646 | } |
| 8647 | |
| 8648 | /** |
| 8649 | * sensor_match_proxy_new_for_bus_sync: |
| 8650 | * @bus_type: A #GBusType. |
| 8651 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 8652 | * @name: A bus name (well-known or unique). |
| 8653 | * @object_path: An object path. |
| 8654 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 8655 | * @error: Return location for error or %NULL |
| 8656 | * |
| 8657 | * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 8658 | * |
| 8659 | * The calling thread is blocked until a reply is received. |
| 8660 | * |
| 8661 | * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 8662 | * |
| 8663 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 8664 | */ |
| 8665 | SensorMatch * |
| 8666 | sensor_match_proxy_new_for_bus_sync ( |
| 8667 | GBusType bus_type, |
| 8668 | GDBusProxyFlags flags, |
| 8669 | const gchar *name, |
| 8670 | const gchar *object_path, |
| 8671 | GCancellable *cancellable, |
| 8672 | GError **error) |
| 8673 | { |
| 8674 | GInitable *ret; |
| 8675 | 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); |
| 8676 | if (ret != NULL) |
| 8677 | return SENSOR_MATCH (ret); |
| 8678 | else |
| 8679 | return NULL; |
| 8680 | } |
| 8681 | |
| 8682 | |
| 8683 | /* ------------------------------------------------------------------------ */ |
| 8684 | |
| 8685 | /** |
| 8686 | * SensorMatchSkeleton: |
| 8687 | * |
| 8688 | * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. |
| 8689 | */ |
| 8690 | |
| 8691 | /** |
| 8692 | * SensorMatchSkeletonClass: |
| 8693 | * @parent_class: The parent class. |
| 8694 | * |
| 8695 | * Class structure for #SensorMatchSkeleton. |
| 8696 | */ |
| 8697 | |
| 8698 | struct _SensorMatchSkeletonPrivate |
| 8699 | { |
| 8700 | GValue *properties; |
| 8701 | GList *changed_properties; |
| 8702 | GSource *changed_properties_idle_source; |
| 8703 | GMainContext *context; |
| 8704 | GMutex lock; |
| 8705 | }; |
| 8706 | |
| 8707 | static void |
| 8708 | _sensor_match_skeleton_handle_method_call ( |
| 8709 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8710 | const gchar *sender G_GNUC_UNUSED, |
| 8711 | const gchar *object_path G_GNUC_UNUSED, |
| 8712 | const gchar *interface_name, |
| 8713 | const gchar *method_name, |
| 8714 | GVariant *parameters, |
| 8715 | GDBusMethodInvocation *invocation, |
| 8716 | gpointer user_data) |
| 8717 | { |
| 8718 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 8719 | _ExtendedGDBusMethodInfo *info; |
| 8720 | GVariantIter iter; |
| 8721 | GVariant *child; |
| 8722 | GValue *paramv; |
| 8723 | guint num_params; |
| 8724 | guint num_extra; |
| 8725 | guint n; |
| 8726 | guint signal_id; |
| 8727 | GValue return_value = G_VALUE_INIT; |
| 8728 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 8729 | g_assert (info != NULL); |
| 8730 | num_params = g_variant_n_children (parameters); |
| 8731 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 8732 | n = 0; |
| 8733 | g_value_init (¶mv[n], TYPE_SENSOR_MATCH); |
| 8734 | g_value_set_object (¶mv[n++], skeleton); |
| 8735 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 8736 | g_value_set_object (¶mv[n++], invocation); |
| 8737 | if (info->pass_fdlist) |
| 8738 | { |
| 8739 | #ifdef G_OS_UNIX |
| 8740 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 8741 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 8742 | #else |
| 8743 | g_assert_not_reached (); |
| 8744 | #endif |
| 8745 | } |
| 8746 | g_variant_iter_init (&iter, parameters); |
| 8747 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 8748 | { |
| 8749 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 8750 | if (arg_info->use_gvariant) |
| 8751 | { |
| 8752 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 8753 | g_value_set_variant (¶mv[n], child); |
| 8754 | n++; |
| 8755 | } |
| 8756 | else |
| 8757 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8758 | g_variant_unref (child); |
| 8759 | } |
| 8760 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 8761 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 8762 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 8763 | if (!g_value_get_boolean (&return_value)) |
| 8764 | 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); |
| 8765 | g_value_unset (&return_value); |
| 8766 | for (n = 0; n < num_params + num_extra; n++) |
| 8767 | g_value_unset (¶mv[n]); |
| 8768 | g_free (paramv); |
| 8769 | } |
| 8770 | |
| 8771 | static GVariant * |
| 8772 | _sensor_match_skeleton_handle_get_property ( |
| 8773 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8774 | const gchar *sender G_GNUC_UNUSED, |
| 8775 | const gchar *object_path G_GNUC_UNUSED, |
| 8776 | const gchar *interface_name G_GNUC_UNUSED, |
| 8777 | const gchar *property_name, |
| 8778 | GError **error, |
| 8779 | gpointer user_data) |
| 8780 | { |
| 8781 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 8782 | GValue value = G_VALUE_INIT; |
| 8783 | GParamSpec *pspec; |
| 8784 | _ExtendedGDBusPropertyInfo *info; |
| 8785 | GVariant *ret; |
| 8786 | ret = NULL; |
| 8787 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 8788 | g_assert (info != NULL); |
| 8789 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8790 | if (pspec == NULL) |
| 8791 | { |
| 8792 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8793 | } |
| 8794 | else |
| 8795 | { |
| 8796 | g_value_init (&value, pspec->value_type); |
| 8797 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8798 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8799 | g_value_unset (&value); |
| 8800 | } |
| 8801 | return ret; |
| 8802 | } |
| 8803 | |
| 8804 | static gboolean |
| 8805 | _sensor_match_skeleton_handle_set_property ( |
| 8806 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8807 | const gchar *sender G_GNUC_UNUSED, |
| 8808 | const gchar *object_path G_GNUC_UNUSED, |
| 8809 | const gchar *interface_name G_GNUC_UNUSED, |
| 8810 | const gchar *property_name, |
| 8811 | GVariant *variant, |
| 8812 | GError **error, |
| 8813 | gpointer user_data) |
| 8814 | { |
| 8815 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 8816 | GValue value = G_VALUE_INIT; |
| 8817 | GParamSpec *pspec; |
| 8818 | _ExtendedGDBusPropertyInfo *info; |
| 8819 | gboolean ret; |
| 8820 | ret = FALSE; |
| 8821 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 8822 | g_assert (info != NULL); |
| 8823 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8824 | if (pspec == NULL) |
| 8825 | { |
| 8826 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8827 | } |
| 8828 | else |
| 8829 | { |
| 8830 | if (info->use_gvariant) |
| 8831 | g_value_set_variant (&value, variant); |
| 8832 | else |
| 8833 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 8834 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8835 | g_value_unset (&value); |
| 8836 | ret = TRUE; |
| 8837 | } |
| 8838 | return ret; |
| 8839 | } |
| 8840 | |
| 8841 | static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = |
| 8842 | { |
| 8843 | _sensor_match_skeleton_handle_method_call, |
| 8844 | _sensor_match_skeleton_handle_get_property, |
| 8845 | _sensor_match_skeleton_handle_set_property, |
| 8846 | {NULL} |
| 8847 | }; |
| 8848 | |
| 8849 | static GDBusInterfaceInfo * |
| 8850 | sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8851 | { |
| 8852 | return sensor_match_interface_info (); |
| 8853 | } |
| 8854 | |
| 8855 | static GDBusInterfaceVTable * |
| 8856 | sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8857 | { |
| 8858 | return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; |
| 8859 | } |
| 8860 | |
| 8861 | static GVariant * |
| 8862 | sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 8863 | { |
| 8864 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 8865 | |
| 8866 | GVariantBuilder builder; |
| 8867 | guint n; |
| 8868 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8869 | if (_sensor_match_interface_info.parent_struct.properties == NULL) |
| 8870 | goto out; |
| 8871 | for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) |
| 8872 | { |
| 8873 | GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; |
| 8874 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 8875 | { |
| 8876 | GVariant *value; |
| 8877 | 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); |
| 8878 | if (value != NULL) |
| 8879 | { |
| 8880 | g_variant_take_ref (value); |
| 8881 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 8882 | g_variant_unref (value); |
| 8883 | } |
| 8884 | } |
| 8885 | } |
| 8886 | out: |
| 8887 | return g_variant_builder_end (&builder); |
| 8888 | } |
| 8889 | |
| 8890 | static gboolean _sensor_match_emit_changed (gpointer user_data); |
| 8891 | |
| 8892 | static void |
| 8893 | sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 8894 | { |
| 8895 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 8896 | gboolean emit_changed = FALSE; |
| 8897 | |
| 8898 | g_mutex_lock (&skeleton->priv->lock); |
| 8899 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8900 | { |
| 8901 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8902 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8903 | emit_changed = TRUE; |
| 8904 | } |
| 8905 | g_mutex_unlock (&skeleton->priv->lock); |
| 8906 | |
| 8907 | if (emit_changed) |
| 8908 | _sensor_match_emit_changed (skeleton); |
| 8909 | } |
| 8910 | |
| 8911 | static void |
| 8912 | _sensor_match_on_signal_sensor_match ( |
| 8913 | SensorMatch *object, |
| 8914 | guchar arg_state) |
| 8915 | { |
| 8916 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8917 | |
| 8918 | GList *connections, *l; |
| 8919 | GVariant *signal_variant; |
| 8920 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8921 | |
| 8922 | signal_variant = g_variant_ref_sink (g_variant_new ("(y)", |
| 8923 | arg_state)); |
| 8924 | for (l = connections; l != NULL; l = l->next) |
| 8925 | { |
| 8926 | GDBusConnection *connection = l->data; |
| 8927 | g_dbus_connection_emit_signal (connection, |
| 8928 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", |
| 8929 | signal_variant, NULL); |
| 8930 | } |
| 8931 | g_variant_unref (signal_variant); |
| 8932 | g_list_free_full (connections, g_object_unref); |
| 8933 | } |
| 8934 | |
| 8935 | static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); |
| 8936 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8937 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8938 | G_ADD_PRIVATE (SensorMatchSkeleton) |
| 8939 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 8940 | |
| 8941 | #else |
| 8942 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8943 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 8944 | |
| 8945 | #endif |
| 8946 | static void |
| 8947 | sensor_match_skeleton_finalize (GObject *object) |
| 8948 | { |
| 8949 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8950 | guint n; |
| 8951 | for (n = 0; n < 2; n++) |
| 8952 | g_value_unset (&skeleton->priv->properties[n]); |
| 8953 | g_free (skeleton->priv->properties); |
| 8954 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8955 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8956 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8957 | g_main_context_unref (skeleton->priv->context); |
| 8958 | g_mutex_clear (&skeleton->priv->lock); |
| 8959 | G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); |
| 8960 | } |
| 8961 | |
| 8962 | static void |
| 8963 | sensor_match_skeleton_get_property (GObject *object, |
| 8964 | guint prop_id, |
| 8965 | GValue *value, |
| 8966 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8967 | { |
| 8968 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 8969 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 8970 | g_mutex_lock (&skeleton->priv->lock); |
| 8971 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 8972 | g_mutex_unlock (&skeleton->priv->lock); |
| 8973 | } |
| 8974 | |
| 8975 | static gboolean |
| 8976 | _sensor_match_emit_changed (gpointer user_data) |
| 8977 | { |
| 8978 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 8979 | GList *l; |
| 8980 | GVariantBuilder builder; |
| 8981 | GVariantBuilder invalidated_builder; |
| 8982 | guint num_changes; |
| 8983 | |
| 8984 | g_mutex_lock (&skeleton->priv->lock); |
| 8985 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8986 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 8987 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 8988 | { |
| 8989 | ChangedProperty *cp = l->data; |
| 8990 | GVariant *variant; |
| 8991 | const GValue *cur_value; |
| 8992 | |
| 8993 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 8994 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 8995 | { |
| 8996 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 8997 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 8998 | g_variant_unref (variant); |
| 8999 | num_changes++; |
| 9000 | } |
| 9001 | } |
| 9002 | if (num_changes > 0) |
| 9003 | { |
| 9004 | GList *connections, *ll; |
| 9005 | GVariant *signal_variant; |
| 9006 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", |
| 9007 | &builder, &invalidated_builder)); |
| 9008 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 9009 | for (ll = connections; ll != NULL; ll = ll->next) |
| 9010 | { |
| 9011 | GDBusConnection *connection = ll->data; |
| 9012 | |
| 9013 | g_dbus_connection_emit_signal (connection, |
| 9014 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 9015 | "org.freedesktop.DBus.Properties", |
| 9016 | "PropertiesChanged", |
| 9017 | signal_variant, |
| 9018 | NULL); |
| 9019 | } |
| 9020 | g_variant_unref (signal_variant); |
| 9021 | g_list_free_full (connections, g_object_unref); |
| 9022 | } |
| 9023 | else |
| 9024 | { |
| 9025 | g_variant_builder_clear (&builder); |
| 9026 | g_variant_builder_clear (&invalidated_builder); |
| 9027 | } |
| 9028 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9029 | skeleton->priv->changed_properties = NULL; |
| 9030 | skeleton->priv->changed_properties_idle_source = NULL; |
| 9031 | g_mutex_unlock (&skeleton->priv->lock); |
| 9032 | return FALSE; |
| 9033 | } |
| 9034 | |
| 9035 | static void |
| 9036 | _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 9037 | { |
| 9038 | ChangedProperty *cp; |
| 9039 | GList *l; |
| 9040 | cp = NULL; |
| 9041 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 9042 | { |
| 9043 | ChangedProperty *i_cp = l->data; |
| 9044 | if (i_cp->info == info) |
| 9045 | { |
| 9046 | cp = i_cp; |
| 9047 | break; |
| 9048 | } |
| 9049 | } |
| 9050 | if (cp == NULL) |
| 9051 | { |
| 9052 | cp = g_new0 (ChangedProperty, 1); |
| 9053 | cp->prop_id = prop_id; |
| 9054 | cp->info = info; |
| 9055 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 9056 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 9057 | g_value_copy (orig_value, &cp->orig_value); |
| 9058 | } |
| 9059 | } |
| 9060 | |
| 9061 | static void |
| 9062 | sensor_match_skeleton_notify (GObject *object, |
| 9063 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9064 | { |
| 9065 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9066 | g_mutex_lock (&skeleton->priv->lock); |
| 9067 | if (skeleton->priv->changed_properties != NULL && |
| 9068 | skeleton->priv->changed_properties_idle_source == NULL) |
| 9069 | { |
| 9070 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 9071 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 9072 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 9073 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 9074 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 9075 | } |
| 9076 | g_mutex_unlock (&skeleton->priv->lock); |
| 9077 | } |
| 9078 | |
| 9079 | static void |
| 9080 | sensor_match_skeleton_set_property (GObject *object, |
| 9081 | guint prop_id, |
| 9082 | const GValue *value, |
| 9083 | GParamSpec *pspec) |
| 9084 | { |
| 9085 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9086 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 9087 | g_mutex_lock (&skeleton->priv->lock); |
| 9088 | g_object_freeze_notify (object); |
| 9089 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 9090 | { |
| 9091 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 9092 | _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 9093 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 9094 | g_object_notify_by_pspec (object, pspec); |
| 9095 | } |
| 9096 | g_mutex_unlock (&skeleton->priv->lock); |
| 9097 | g_object_thaw_notify (object); |
| 9098 | } |
| 9099 | |
| 9100 | static void |
| 9101 | sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) |
| 9102 | { |
| 9103 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9104 | skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); |
| 9105 | #else |
| 9106 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); |
| 9107 | #endif |
| 9108 | |
| 9109 | g_mutex_init (&skeleton->priv->lock); |
| 9110 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 9111 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 9112 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 9113 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); |
| 9114 | } |
| 9115 | |
| 9116 | static GVariant * |
| 9117 | sensor_match_skeleton_get_match_value (SensorMatch *object) |
| 9118 | { |
| 9119 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9120 | GVariant *value; |
| 9121 | g_mutex_lock (&skeleton->priv->lock); |
| 9122 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 9123 | g_mutex_unlock (&skeleton->priv->lock); |
| 9124 | return value; |
| 9125 | } |
| 9126 | |
| 9127 | static guchar |
| 9128 | sensor_match_skeleton_get_state (SensorMatch *object) |
| 9129 | { |
| 9130 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 9131 | guchar value; |
| 9132 | g_mutex_lock (&skeleton->priv->lock); |
| 9133 | value = g_value_get_uchar (&(skeleton->priv->properties[1])); |
| 9134 | g_mutex_unlock (&skeleton->priv->lock); |
| 9135 | return value; |
| 9136 | } |
| 9137 | |
| 9138 | static void |
| 9139 | sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) |
| 9140 | { |
| 9141 | GObjectClass *gobject_class; |
| 9142 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 9143 | |
| 9144 | gobject_class = G_OBJECT_CLASS (klass); |
| 9145 | gobject_class->finalize = sensor_match_skeleton_finalize; |
| 9146 | gobject_class->get_property = sensor_match_skeleton_get_property; |
| 9147 | gobject_class->set_property = sensor_match_skeleton_set_property; |
| 9148 | gobject_class->notify = sensor_match_skeleton_notify; |
| 9149 | |
| 9150 | |
| 9151 | sensor_match_override_properties (gobject_class, 1); |
| 9152 | |
| 9153 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 9154 | skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; |
| 9155 | skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; |
| 9156 | skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; |
| 9157 | skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; |
| 9158 | |
| 9159 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9160 | g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); |
| 9161 | #endif |
| 9162 | } |
| 9163 | |
| 9164 | static void |
| 9165 | sensor_match_skeleton_iface_init (SensorMatchIface *iface) |
| 9166 | { |
| 9167 | iface->sensor_match = _sensor_match_on_signal_sensor_match; |
| 9168 | iface->get_match_value = sensor_match_skeleton_get_match_value; |
| 9169 | iface->get_state = sensor_match_skeleton_get_state; |
| 9170 | } |
| 9171 | |
| 9172 | /** |
| 9173 | * sensor_match_skeleton_new: |
| 9174 | * |
| 9175 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 9176 | * |
| 9177 | * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. |
| 9178 | */ |
| 9179 | SensorMatch * |
| 9180 | sensor_match_skeleton_new (void) |
| 9181 | { |
| 9182 | return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); |
| 9183 | } |
| 9184 | |
| 9185 | /* ------------------------------------------------------------------------ |
| 9186 | * Code for interface org.openbmc.Process |
| 9187 | * ------------------------------------------------------------------------ |
| 9188 | */ |
| 9189 | |
| 9190 | /** |
| 9191 | * SECTION:Process |
| 9192 | * @title: Process |
| 9193 | * @short_description: Generated C code for the org.openbmc.Process D-Bus interface |
| 9194 | * |
| 9195 | * 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. |
| 9196 | */ |
| 9197 | |
| 9198 | /* ---- Introspection data for org.openbmc.Process ---- */ |
| 9199 | |
| 9200 | static const _ExtendedGDBusMethodInfo _process_method_info_stop = |
| 9201 | { |
| 9202 | { |
| 9203 | -1, |
| 9204 | (gchar *) "stop", |
| 9205 | NULL, |
| 9206 | NULL, |
| 9207 | NULL |
| 9208 | }, |
| 9209 | "handle-stop", |
| 9210 | FALSE |
| 9211 | }; |
| 9212 | |
| 9213 | static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] = |
| 9214 | { |
| 9215 | &_process_method_info_stop, |
| 9216 | NULL |
| 9217 | }; |
| 9218 | |
| 9219 | static const _ExtendedGDBusInterfaceInfo _process_interface_info = |
| 9220 | { |
| 9221 | { |
| 9222 | -1, |
| 9223 | (gchar *) "org.openbmc.Process", |
| 9224 | (GDBusMethodInfo **) &_process_method_info_pointers, |
| 9225 | NULL, |
| 9226 | NULL, |
| 9227 | NULL |
| 9228 | }, |
| 9229 | "process", |
| 9230 | }; |
| 9231 | |
| 9232 | |
| 9233 | /** |
| 9234 | * process_interface_info: |
| 9235 | * |
| 9236 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface. |
| 9237 | * |
| 9238 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 9239 | */ |
| 9240 | GDBusInterfaceInfo * |
| 9241 | process_interface_info (void) |
| 9242 | { |
| 9243 | return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct; |
| 9244 | } |
| 9245 | |
| 9246 | /** |
| 9247 | * process_override_properties: |
| 9248 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 9249 | * @property_id_begin: The property id to assign to the first overridden property. |
| 9250 | * |
| 9251 | * Overrides all #GObject properties in the #Process interface for a concrete class. |
| 9252 | * The properties are overridden in the order they are defined. |
| 9253 | * |
| 9254 | * Returns: The last property id. |
| 9255 | */ |
| 9256 | guint |
| 9257 | process_override_properties (GObjectClass *klass, guint property_id_begin) |
| 9258 | { |
| 9259 | return property_id_begin - 1; |
| 9260 | } |
| 9261 | |
| 9262 | |
| 9263 | |
| 9264 | /** |
| 9265 | * Process: |
| 9266 | * |
| 9267 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 9268 | */ |
| 9269 | |
| 9270 | /** |
| 9271 | * ProcessIface: |
| 9272 | * @parent_iface: The parent interface. |
| 9273 | * @handle_stop: Handler for the #Process::handle-stop signal. |
| 9274 | * |
| 9275 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 9276 | */ |
| 9277 | |
| 9278 | typedef ProcessIface ProcessInterface; |
| 9279 | G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT); |
| 9280 | |
| 9281 | static void |
| 9282 | process_default_init (ProcessIface *iface) |
| 9283 | { |
| 9284 | /* GObject signals for incoming D-Bus method calls: */ |
| 9285 | /** |
| 9286 | * Process::handle-stop: |
| 9287 | * @object: A #Process. |
| 9288 | * @invocation: A #GDBusMethodInvocation. |
| 9289 | * |
| 9290 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. |
| 9291 | * |
| 9292 | * 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. |
| 9293 | * |
| 9294 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 9295 | */ |
| 9296 | g_signal_new ("handle-stop", |
| 9297 | G_TYPE_FROM_INTERFACE (iface), |
| 9298 | G_SIGNAL_RUN_LAST, |
| 9299 | G_STRUCT_OFFSET (ProcessIface, handle_stop), |
| 9300 | g_signal_accumulator_true_handled, |
| 9301 | NULL, |
| 9302 | g_cclosure_marshal_generic, |
| 9303 | G_TYPE_BOOLEAN, |
| 9304 | 1, |
| 9305 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 9306 | |
| 9307 | } |
| 9308 | |
| 9309 | /** |
| 9310 | * process_call_stop: |
| 9311 | * @proxy: A #ProcessProxy. |
| 9312 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9313 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 9314 | * @user_data: User data to pass to @callback. |
| 9315 | * |
| 9316 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. |
| 9317 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 9318 | * You can then call process_call_stop_finish() to get the result of the operation. |
| 9319 | * |
| 9320 | * See process_call_stop_sync() for the synchronous, blocking version of this method. |
| 9321 | */ |
| 9322 | void |
| 9323 | process_call_stop ( |
| 9324 | Process *proxy, |
| 9325 | GCancellable *cancellable, |
| 9326 | GAsyncReadyCallback callback, |
| 9327 | gpointer user_data) |
| 9328 | { |
| 9329 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 9330 | "stop", |
| 9331 | g_variant_new ("()"), |
| 9332 | G_DBUS_CALL_FLAGS_NONE, |
| 9333 | -1, |
| 9334 | cancellable, |
| 9335 | callback, |
| 9336 | user_data); |
| 9337 | } |
| 9338 | |
| 9339 | /** |
| 9340 | * process_call_stop_finish: |
| 9341 | * @proxy: A #ProcessProxy. |
| 9342 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop(). |
| 9343 | * @error: Return location for error or %NULL. |
| 9344 | * |
| 9345 | * Finishes an operation started with process_call_stop(). |
| 9346 | * |
| 9347 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9348 | */ |
| 9349 | gboolean |
| 9350 | process_call_stop_finish ( |
| 9351 | Process *proxy, |
| 9352 | GAsyncResult *res, |
| 9353 | GError **error) |
| 9354 | { |
| 9355 | GVariant *_ret; |
| 9356 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 9357 | if (_ret == NULL) |
| 9358 | goto _out; |
| 9359 | g_variant_get (_ret, |
| 9360 | "()"); |
| 9361 | g_variant_unref (_ret); |
| 9362 | _out: |
| 9363 | return _ret != NULL; |
| 9364 | } |
| 9365 | |
| 9366 | /** |
| 9367 | * process_call_stop_sync: |
| 9368 | * @proxy: A #ProcessProxy. |
| 9369 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9370 | * @error: Return location for error or %NULL. |
| 9371 | * |
| 9372 | * 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. |
| 9373 | * |
| 9374 | * See process_call_stop() for the asynchronous version of this method. |
| 9375 | * |
| 9376 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 9377 | */ |
| 9378 | gboolean |
| 9379 | process_call_stop_sync ( |
| 9380 | Process *proxy, |
| 9381 | GCancellable *cancellable, |
| 9382 | GError **error) |
| 9383 | { |
| 9384 | GVariant *_ret; |
| 9385 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 9386 | "stop", |
| 9387 | g_variant_new ("()"), |
| 9388 | G_DBUS_CALL_FLAGS_NONE, |
| 9389 | -1, |
| 9390 | cancellable, |
| 9391 | error); |
| 9392 | if (_ret == NULL) |
| 9393 | goto _out; |
| 9394 | g_variant_get (_ret, |
| 9395 | "()"); |
| 9396 | g_variant_unref (_ret); |
| 9397 | _out: |
| 9398 | return _ret != NULL; |
| 9399 | } |
| 9400 | |
| 9401 | /** |
| 9402 | * process_complete_stop: |
| 9403 | * @object: A #Process. |
| 9404 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 9405 | * |
| 9406 | * 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. |
| 9407 | * |
| 9408 | * This method will free @invocation, you cannot use it afterwards. |
| 9409 | */ |
| 9410 | void |
| 9411 | process_complete_stop ( |
| 9412 | Process *object, |
| 9413 | GDBusMethodInvocation *invocation) |
| 9414 | { |
| 9415 | g_dbus_method_invocation_return_value (invocation, |
| 9416 | g_variant_new ("()")); |
| 9417 | } |
| 9418 | |
| 9419 | /* ------------------------------------------------------------------------ */ |
| 9420 | |
| 9421 | /** |
| 9422 | * ProcessProxy: |
| 9423 | * |
| 9424 | * The #ProcessProxy structure contains only private data and should only be accessed using the provided API. |
| 9425 | */ |
| 9426 | |
| 9427 | /** |
| 9428 | * ProcessProxyClass: |
| 9429 | * @parent_class: The parent class. |
| 9430 | * |
| 9431 | * Class structure for #ProcessProxy. |
| 9432 | */ |
| 9433 | |
| 9434 | struct _ProcessProxyPrivate |
| 9435 | { |
| 9436 | GData *qdata; |
| 9437 | }; |
| 9438 | |
| 9439 | static void process_proxy_iface_init (ProcessIface *iface); |
| 9440 | |
| 9441 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9442 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 9443 | G_ADD_PRIVATE (ProcessProxy) |
| 9444 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 9445 | |
| 9446 | #else |
| 9447 | G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, |
| 9448 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); |
| 9449 | |
| 9450 | #endif |
| 9451 | static void |
| 9452 | process_proxy_finalize (GObject *object) |
| 9453 | { |
| 9454 | ProcessProxy *proxy = PROCESS_PROXY (object); |
| 9455 | g_datalist_clear (&proxy->priv->qdata); |
| 9456 | G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object); |
| 9457 | } |
| 9458 | |
| 9459 | static void |
| 9460 | process_proxy_get_property (GObject *object, |
| 9461 | guint prop_id, |
| 9462 | GValue *value, |
| 9463 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9464 | { |
| 9465 | } |
| 9466 | |
| 9467 | static void |
| 9468 | process_proxy_set_property (GObject *object, |
| 9469 | guint prop_id, |
| 9470 | const GValue *value, |
| 9471 | GParamSpec *pspec G_GNUC_UNUSED) |
| 9472 | { |
| 9473 | } |
| 9474 | |
| 9475 | static void |
| 9476 | process_proxy_g_signal (GDBusProxy *proxy, |
| 9477 | const gchar *sender_name G_GNUC_UNUSED, |
| 9478 | const gchar *signal_name, |
| 9479 | GVariant *parameters) |
| 9480 | { |
| 9481 | _ExtendedGDBusSignalInfo *info; |
| 9482 | GVariantIter iter; |
| 9483 | GVariant *child; |
| 9484 | GValue *paramv; |
| 9485 | guint num_params; |
| 9486 | guint n; |
| 9487 | guint signal_id; |
| 9488 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name); |
| 9489 | if (info == NULL) |
| 9490 | return; |
| 9491 | num_params = g_variant_n_children (parameters); |
| 9492 | paramv = g_new0 (GValue, num_params + 1); |
| 9493 | g_value_init (¶mv[0], TYPE_PROCESS); |
| 9494 | g_value_set_object (¶mv[0], proxy); |
| 9495 | g_variant_iter_init (&iter, parameters); |
| 9496 | n = 1; |
| 9497 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9498 | { |
| 9499 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 9500 | if (arg_info->use_gvariant) |
| 9501 | { |
| 9502 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9503 | g_value_set_variant (¶mv[n], child); |
| 9504 | n++; |
| 9505 | } |
| 9506 | else |
| 9507 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9508 | g_variant_unref (child); |
| 9509 | } |
| 9510 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 9511 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 9512 | for (n = 0; n < num_params + 1; n++) |
| 9513 | g_value_unset (¶mv[n]); |
| 9514 | g_free (paramv); |
| 9515 | } |
| 9516 | |
| 9517 | static void |
| 9518 | process_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 9519 | GVariant *changed_properties, |
| 9520 | const gchar *const *invalidated_properties) |
| 9521 | { |
| 9522 | ProcessProxy *proxy = PROCESS_PROXY (_proxy); |
| 9523 | guint n; |
| 9524 | const gchar *key; |
| 9525 | GVariantIter *iter; |
| 9526 | _ExtendedGDBusPropertyInfo *info; |
| 9527 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 9528 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 9529 | { |
| 9530 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key); |
| 9531 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 9532 | if (info != NULL) |
| 9533 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9534 | } |
| 9535 | g_variant_iter_free (iter); |
| 9536 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 9537 | { |
| 9538 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]); |
| 9539 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 9540 | if (info != NULL) |
| 9541 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 9542 | } |
| 9543 | } |
| 9544 | |
| 9545 | static void |
| 9546 | process_proxy_init (ProcessProxy *proxy) |
| 9547 | { |
| 9548 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9549 | proxy->priv = process_proxy_get_instance_private (proxy); |
| 9550 | #else |
| 9551 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate); |
| 9552 | #endif |
| 9553 | |
| 9554 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ()); |
| 9555 | } |
| 9556 | |
| 9557 | static void |
| 9558 | process_proxy_class_init (ProcessProxyClass *klass) |
| 9559 | { |
| 9560 | GObjectClass *gobject_class; |
| 9561 | GDBusProxyClass *proxy_class; |
| 9562 | |
| 9563 | gobject_class = G_OBJECT_CLASS (klass); |
| 9564 | gobject_class->finalize = process_proxy_finalize; |
| 9565 | gobject_class->get_property = process_proxy_get_property; |
| 9566 | gobject_class->set_property = process_proxy_set_property; |
| 9567 | |
| 9568 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 9569 | proxy_class->g_signal = process_proxy_g_signal; |
| 9570 | proxy_class->g_properties_changed = process_proxy_g_properties_changed; |
| 9571 | |
| 9572 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 9573 | g_type_class_add_private (klass, sizeof (ProcessProxyPrivate)); |
| 9574 | #endif |
| 9575 | } |
| 9576 | |
| 9577 | static void |
| 9578 | process_proxy_iface_init (ProcessIface *iface) |
| 9579 | { |
| 9580 | } |
| 9581 | |
| 9582 | /** |
| 9583 | * process_proxy_new: |
| 9584 | * @connection: A #GDBusConnection. |
| 9585 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9586 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9587 | * @object_path: An object path. |
| 9588 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9589 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9590 | * @user_data: User data to pass to @callback. |
| 9591 | * |
| 9592 | * 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. |
| 9593 | * |
| 9594 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 9595 | * You can then call process_proxy_new_finish() to get the result of the operation. |
| 9596 | * |
| 9597 | * See process_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 9598 | */ |
| 9599 | void |
| 9600 | process_proxy_new ( |
| 9601 | GDBusConnection *connection, |
| 9602 | GDBusProxyFlags flags, |
| 9603 | const gchar *name, |
| 9604 | const gchar *object_path, |
| 9605 | GCancellable *cancellable, |
| 9606 | GAsyncReadyCallback callback, |
| 9607 | gpointer user_data) |
| 9608 | { |
| 9609 | 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); |
| 9610 | } |
| 9611 | |
| 9612 | /** |
| 9613 | * process_proxy_new_finish: |
| 9614 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new(). |
| 9615 | * @error: Return location for error or %NULL |
| 9616 | * |
| 9617 | * Finishes an operation started with process_proxy_new(). |
| 9618 | * |
| 9619 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 9620 | */ |
| 9621 | Process * |
| 9622 | process_proxy_new_finish ( |
| 9623 | GAsyncResult *res, |
| 9624 | GError **error) |
| 9625 | { |
| 9626 | GObject *ret; |
| 9627 | GObject *source_object; |
| 9628 | source_object = g_async_result_get_source_object (res); |
| 9629 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9630 | g_object_unref (source_object); |
| 9631 | if (ret != NULL) |
| 9632 | return PROCESS (ret); |
| 9633 | else |
| 9634 | return NULL; |
| 9635 | } |
| 9636 | |
| 9637 | /** |
| 9638 | * process_proxy_new_sync: |
| 9639 | * @connection: A #GDBusConnection. |
| 9640 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9641 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9642 | * @object_path: An object path. |
| 9643 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9644 | * @error: Return location for error or %NULL |
| 9645 | * |
| 9646 | * 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. |
| 9647 | * |
| 9648 | * The calling thread is blocked until a reply is received. |
| 9649 | * |
| 9650 | * See process_proxy_new() for the asynchronous version of this constructor. |
| 9651 | * |
| 9652 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 9653 | */ |
| 9654 | Process * |
| 9655 | process_proxy_new_sync ( |
| 9656 | GDBusConnection *connection, |
| 9657 | GDBusProxyFlags flags, |
| 9658 | const gchar *name, |
| 9659 | const gchar *object_path, |
| 9660 | GCancellable *cancellable, |
| 9661 | GError **error) |
| 9662 | { |
| 9663 | GInitable *ret; |
| 9664 | 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); |
| 9665 | if (ret != NULL) |
| 9666 | return PROCESS (ret); |
| 9667 | else |
| 9668 | return NULL; |
| 9669 | } |
| 9670 | |
| 9671 | |
| 9672 | /** |
| 9673 | * process_proxy_new_for_bus: |
| 9674 | * @bus_type: A #GBusType. |
| 9675 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9676 | * @name: A bus name (well-known or unique). |
| 9677 | * @object_path: An object path. |
| 9678 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9679 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9680 | * @user_data: User data to pass to @callback. |
| 9681 | * |
| 9682 | * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 9683 | * |
| 9684 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 9685 | * You can then call process_proxy_new_for_bus_finish() to get the result of the operation. |
| 9686 | * |
| 9687 | * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 9688 | */ |
| 9689 | void |
| 9690 | process_proxy_new_for_bus ( |
| 9691 | GBusType bus_type, |
| 9692 | GDBusProxyFlags flags, |
| 9693 | const gchar *name, |
| 9694 | const gchar *object_path, |
| 9695 | GCancellable *cancellable, |
| 9696 | GAsyncReadyCallback callback, |
| 9697 | gpointer user_data) |
| 9698 | { |
| 9699 | 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); |
| 9700 | } |
| 9701 | |
| 9702 | /** |
| 9703 | * process_proxy_new_for_bus_finish: |
| 9704 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus(). |
| 9705 | * @error: Return location for error or %NULL |
| 9706 | * |
| 9707 | * Finishes an operation started with process_proxy_new_for_bus(). |
| 9708 | * |
| 9709 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 9710 | */ |
| 9711 | Process * |
| 9712 | process_proxy_new_for_bus_finish ( |
| 9713 | GAsyncResult *res, |
| 9714 | GError **error) |
| 9715 | { |
| 9716 | GObject *ret; |
| 9717 | GObject *source_object; |
| 9718 | source_object = g_async_result_get_source_object (res); |
| 9719 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9720 | g_object_unref (source_object); |
| 9721 | if (ret != NULL) |
| 9722 | return PROCESS (ret); |
| 9723 | else |
| 9724 | return NULL; |
| 9725 | } |
| 9726 | |
| 9727 | /** |
| 9728 | * process_proxy_new_for_bus_sync: |
| 9729 | * @bus_type: A #GBusType. |
| 9730 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 9731 | * @name: A bus name (well-known or unique). |
| 9732 | * @object_path: An object path. |
| 9733 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9734 | * @error: Return location for error or %NULL |
| 9735 | * |
| 9736 | * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 9737 | * |
| 9738 | * The calling thread is blocked until a reply is received. |
| 9739 | * |
| 9740 | * See process_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 9741 | * |
| 9742 | * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. |
| 9743 | */ |
| 9744 | Process * |
| 9745 | process_proxy_new_for_bus_sync ( |
| 9746 | GBusType bus_type, |
| 9747 | GDBusProxyFlags flags, |
| 9748 | const gchar *name, |
| 9749 | const gchar *object_path, |
| 9750 | GCancellable *cancellable, |
| 9751 | GError **error) |
| 9752 | { |
| 9753 | GInitable *ret; |
| 9754 | 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); |
| 9755 | if (ret != NULL) |
| 9756 | return PROCESS (ret); |
| 9757 | else |
| 9758 | return NULL; |
| 9759 | } |
| 9760 | |
| 9761 | |
| 9762 | /* ------------------------------------------------------------------------ */ |
| 9763 | |
| 9764 | /** |
| 9765 | * ProcessSkeleton: |
| 9766 | * |
| 9767 | * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API. |
| 9768 | */ |
| 9769 | |
| 9770 | /** |
| 9771 | * ProcessSkeletonClass: |
| 9772 | * @parent_class: The parent class. |
| 9773 | * |
| 9774 | * Class structure for #ProcessSkeleton. |
| 9775 | */ |
| 9776 | |
| 9777 | struct _ProcessSkeletonPrivate |
| 9778 | { |
| 9779 | GValue *properties; |
| 9780 | GList *changed_properties; |
| 9781 | GSource *changed_properties_idle_source; |
| 9782 | GMainContext *context; |
| 9783 | GMutex lock; |
| 9784 | }; |
| 9785 | |
| 9786 | static void |
| 9787 | _process_skeleton_handle_method_call ( |
| 9788 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9789 | const gchar *sender G_GNUC_UNUSED, |
| 9790 | const gchar *object_path G_GNUC_UNUSED, |
| 9791 | const gchar *interface_name, |
| 9792 | const gchar *method_name, |
| 9793 | GVariant *parameters, |
| 9794 | GDBusMethodInvocation *invocation, |
| 9795 | gpointer user_data) |
| 9796 | { |
| 9797 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 9798 | _ExtendedGDBusMethodInfo *info; |
| 9799 | GVariantIter iter; |
| 9800 | GVariant *child; |
| 9801 | GValue *paramv; |
| 9802 | guint num_params; |
| 9803 | guint num_extra; |
| 9804 | guint n; |
| 9805 | guint signal_id; |
| 9806 | GValue return_value = G_VALUE_INIT; |
| 9807 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 9808 | g_assert (info != NULL); |
| 9809 | num_params = g_variant_n_children (parameters); |
| 9810 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 9811 | n = 0; |
| 9812 | g_value_init (¶mv[n], TYPE_PROCESS); |
| 9813 | g_value_set_object (¶mv[n++], skeleton); |
| 9814 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 9815 | g_value_set_object (¶mv[n++], invocation); |
| 9816 | if (info->pass_fdlist) |
| 9817 | { |
| 9818 | #ifdef G_OS_UNIX |
| 9819 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 9820 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 9821 | #else |
| 9822 | g_assert_not_reached (); |
| 9823 | #endif |
| 9824 | } |
| 9825 | g_variant_iter_init (&iter, parameters); |
| 9826 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 9827 | { |
| 9828 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 9829 | if (arg_info->use_gvariant) |
| 9830 | { |
| 9831 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 9832 | g_value_set_variant (¶mv[n], child); |
| 9833 | n++; |
| 9834 | } |
| 9835 | else |
| 9836 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 9837 | g_variant_unref (child); |
| 9838 | } |
| 9839 | signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); |
| 9840 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 9841 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 9842 | if (!g_value_get_boolean (&return_value)) |
| 9843 | 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); |
| 9844 | g_value_unset (&return_value); |
| 9845 | for (n = 0; n < num_params + num_extra; n++) |
| 9846 | g_value_unset (¶mv[n]); |
| 9847 | g_free (paramv); |
| 9848 | } |
| 9849 | |
| 9850 | static GVariant * |
| 9851 | _process_skeleton_handle_get_property ( |
| 9852 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9853 | const gchar *sender G_GNUC_UNUSED, |
| 9854 | const gchar *object_path G_GNUC_UNUSED, |
| 9855 | const gchar *interface_name G_GNUC_UNUSED, |
| 9856 | const gchar *property_name, |
| 9857 | GError **error, |
| 9858 | gpointer user_data) |
| 9859 | { |
| 9860 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 9861 | GValue value = G_VALUE_INIT; |
| 9862 | GParamSpec *pspec; |
| 9863 | _ExtendedGDBusPropertyInfo *info; |
| 9864 | GVariant *ret; |
| 9865 | ret = NULL; |
| 9866 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 9867 | g_assert (info != NULL); |
| 9868 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9869 | if (pspec == NULL) |
| 9870 | { |
| 9871 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9872 | } |
| 9873 | else |
| 9874 | { |
| 9875 | g_value_init (&value, pspec->value_type); |
| 9876 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9877 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 9878 | g_value_unset (&value); |
| 9879 | } |
| 9880 | return ret; |
| 9881 | } |
| 9882 | |
| 9883 | static gboolean |
| 9884 | _process_skeleton_handle_set_property ( |
| 9885 | GDBusConnection *connection G_GNUC_UNUSED, |
| 9886 | const gchar *sender G_GNUC_UNUSED, |
| 9887 | const gchar *object_path G_GNUC_UNUSED, |
| 9888 | const gchar *interface_name G_GNUC_UNUSED, |
| 9889 | const gchar *property_name, |
| 9890 | GVariant *variant, |
| 9891 | GError **error, |
| 9892 | gpointer user_data) |
| 9893 | { |
| 9894 | ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); |
| 9895 | GValue value = G_VALUE_INIT; |
| 9896 | GParamSpec *pspec; |
| 9897 | _ExtendedGDBusPropertyInfo *info; |
| 9898 | gboolean ret; |
| 9899 | ret = FALSE; |
| 9900 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); |
| 9901 | g_assert (info != NULL); |
| 9902 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 9903 | if (pspec == NULL) |
| 9904 | { |
| 9905 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 9906 | } |
| 9907 | else |
| 9908 | { |
| 9909 | if (info->use_gvariant) |
| 9910 | g_value_set_variant (&value, variant); |
| 9911 | else |
| 9912 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 9913 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 9914 | g_value_unset (&value); |
| 9915 | ret = TRUE; |
| 9916 | } |
| 9917 | return ret; |
| 9918 | } |
| 9919 | |
| 9920 | static const GDBusInterfaceVTable _process_skeleton_vtable = |
| 9921 | { |
| 9922 | _process_skeleton_handle_method_call, |
| 9923 | _process_skeleton_handle_get_property, |
| 9924 | _process_skeleton_handle_set_property, |
| 9925 | {NULL} |
| 9926 | }; |
| 9927 | |
| 9928 | static GDBusInterfaceInfo * |
| 9929 | process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9930 | { |
| 9931 | return process_interface_info (); |
| 9932 | } |
| 9933 | |
| 9934 | static GDBusInterfaceVTable * |
| 9935 | process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 9936 | { |
| 9937 | return (GDBusInterfaceVTable *) &_process_skeleton_vtable; |
| 9938 | } |
| 9939 | |
| 9940 | static GVariant * |
| 9941 | process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 9942 | { |
| 9943 | ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton); |
| 9944 | |
| 9945 | GVariantBuilder builder; |
| 9946 | guint n; |
| 9947 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 9948 | if (_process_interface_info.parent_struct.properties == NULL) |
| 9949 | goto out; |
| 9950 | for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++) |
| 9951 | { |
| 9952 | GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n]; |
| 9953 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 9954 | { |
| 9955 | GVariant *value; |
| 9956 | 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); |
| 9957 | if (value != NULL) |
| 9958 | { |
| 9959 | g_variant_take_ref (value); |
| 9960 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 9961 | g_variant_unref (value); |
| 9962 | } |
| 9963 | } |
| 9964 | } |
| 9965 | out: |
| 9966 | return g_variant_builder_end (&builder); |
| 9967 | } |
| 9968 | |
| 9969 | static void |
| 9970 | process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 9971 | { |
| 9972 | } |
| 9973 | |
| 9974 | static void process_skeleton_iface_init (ProcessIface *iface); |
| 9975 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 9976 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9977 | G_ADD_PRIVATE (ProcessSkeleton) |
| 9978 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 9979 | |
| 9980 | #else |
| 9981 | G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 9982 | G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); |
| 9983 | |
| 9984 | #endif |
| 9985 | static void |
| 9986 | process_skeleton_finalize (GObject *object) |
| 9987 | { |
| 9988 | ProcessSkeleton *skeleton = PROCESS_SKELETON (object); |
| 9989 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 9990 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 9991 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 9992 | g_main_context_unref (skeleton->priv->context); |
| 9993 | g_mutex_clear (&skeleton->priv->lock); |
| 9994 | G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object); |
| 9995 | } |
| 9996 | |
| 9997 | static void |
| 9998 | process_skeleton_init (ProcessSkeleton *skeleton) |
| 9999 | { |
| 10000 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10001 | skeleton->priv = process_skeleton_get_instance_private (skeleton); |
| 10002 | #else |
| 10003 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate); |
| 10004 | #endif |
| 10005 | |
| 10006 | g_mutex_init (&skeleton->priv->lock); |
| 10007 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 10008 | } |
| 10009 | |
| 10010 | static void |
| 10011 | process_skeleton_class_init (ProcessSkeletonClass *klass) |
| 10012 | { |
| 10013 | GObjectClass *gobject_class; |
| 10014 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 10015 | |
| 10016 | gobject_class = G_OBJECT_CLASS (klass); |
| 10017 | gobject_class->finalize = process_skeleton_finalize; |
| 10018 | |
| 10019 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 10020 | skeleton_class->get_info = process_skeleton_dbus_interface_get_info; |
| 10021 | skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties; |
| 10022 | skeleton_class->flush = process_skeleton_dbus_interface_flush; |
| 10023 | skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable; |
| 10024 | |
| 10025 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 10026 | g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate)); |
| 10027 | #endif |
| 10028 | } |
| 10029 | |
| 10030 | static void |
| 10031 | process_skeleton_iface_init (ProcessIface *iface) |
| 10032 | { |
| 10033 | } |
| 10034 | |
| 10035 | /** |
| 10036 | * process_skeleton_new: |
| 10037 | * |
| 10038 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. |
| 10039 | * |
| 10040 | * Returns: (transfer full) (type ProcessSkeleton): The skeleton object. |
| 10041 | */ |
| 10042 | Process * |
| 10043 | process_skeleton_new (void) |
| 10044 | { |
| 10045 | return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL)); |
| 10046 | } |
| 10047 | |
| 10048 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 10049 | * Code for interface org.openbmc.SharedResource |
| 10050 | * ------------------------------------------------------------------------ |
| 10051 | */ |
| 10052 | |
| 10053 | /** |
| 10054 | * SECTION:SharedResource |
| 10055 | * @title: SharedResource |
| 10056 | * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface |
| 10057 | * |
| 10058 | * 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. |
| 10059 | */ |
| 10060 | |
| 10061 | /* ---- Introspection data for org.openbmc.SharedResource ---- */ |
| 10062 | |
| 10063 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name = |
| 10064 | { |
| 10065 | { |
| 10066 | -1, |
| 10067 | (gchar *) "name", |
| 10068 | (gchar *) "s", |
| 10069 | NULL |
| 10070 | }, |
| 10071 | FALSE |
| 10072 | }; |
| 10073 | |
| 10074 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] = |
| 10075 | { |
| 10076 | &_shared_resource_method_info_lock_IN_ARG_name, |
| 10077 | NULL |
| 10078 | }; |
| 10079 | |
| 10080 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock = |
| 10081 | { |
| 10082 | { |
| 10083 | -1, |
| 10084 | (gchar *) "lock", |
| 10085 | (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers, |
| 10086 | NULL, |
| 10087 | NULL |
| 10088 | }, |
| 10089 | "handle-lock", |
| 10090 | FALSE |
| 10091 | }; |
| 10092 | |
| 10093 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock = |
| 10094 | { |
| 10095 | { |
| 10096 | -1, |
| 10097 | (gchar *) "unlock", |
| 10098 | NULL, |
| 10099 | NULL, |
| 10100 | NULL |
| 10101 | }, |
| 10102 | "handle-unlock", |
| 10103 | FALSE |
| 10104 | }; |
| 10105 | |
| 10106 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock = |
| 10107 | { |
| 10108 | { |
| 10109 | -1, |
| 10110 | (gchar *) "lock", |
| 10111 | (gchar *) "b", |
| 10112 | NULL |
| 10113 | }, |
| 10114 | FALSE |
| 10115 | }; |
| 10116 | |
| 10117 | static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name = |
| 10118 | { |
| 10119 | { |
| 10120 | -1, |
| 10121 | (gchar *) "name", |
| 10122 | (gchar *) "s", |
| 10123 | NULL |
| 10124 | }, |
| 10125 | FALSE |
| 10126 | }; |
| 10127 | |
| 10128 | static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] = |
| 10129 | { |
| 10130 | &_shared_resource_method_info_is_locked_OUT_ARG_lock, |
| 10131 | &_shared_resource_method_info_is_locked_OUT_ARG_name, |
| 10132 | NULL |
| 10133 | }; |
| 10134 | |
| 10135 | static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked = |
| 10136 | { |
| 10137 | { |
| 10138 | -1, |
| 10139 | (gchar *) "isLocked", |
| 10140 | NULL, |
| 10141 | (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers, |
| 10142 | NULL |
| 10143 | }, |
| 10144 | "handle-is-locked", |
| 10145 | FALSE |
| 10146 | }; |
| 10147 | |
| 10148 | static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] = |
| 10149 | { |
| 10150 | &_shared_resource_method_info_lock, |
| 10151 | &_shared_resource_method_info_unlock, |
| 10152 | &_shared_resource_method_info_is_locked, |
| 10153 | NULL |
| 10154 | }; |
| 10155 | |
| 10156 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock = |
| 10157 | { |
| 10158 | { |
| 10159 | -1, |
| 10160 | (gchar *) "lock", |
| 10161 | (gchar *) "b", |
| 10162 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 10163 | NULL |
| 10164 | }, |
| 10165 | "lock", |
| 10166 | FALSE |
| 10167 | }; |
| 10168 | |
| 10169 | static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name = |
| 10170 | { |
| 10171 | { |
| 10172 | -1, |
| 10173 | (gchar *) "name", |
| 10174 | (gchar *) "s", |
| 10175 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 10176 | NULL |
| 10177 | }, |
| 10178 | "name", |
| 10179 | FALSE |
| 10180 | }; |
| 10181 | |
| 10182 | static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] = |
| 10183 | { |
| 10184 | &_shared_resource_property_info_lock, |
| 10185 | &_shared_resource_property_info_name, |
| 10186 | NULL |
| 10187 | }; |
| 10188 | |
| 10189 | static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info = |
| 10190 | { |
| 10191 | { |
| 10192 | -1, |
| 10193 | (gchar *) "org.openbmc.SharedResource", |
| 10194 | (GDBusMethodInfo **) &_shared_resource_method_info_pointers, |
| 10195 | NULL, |
| 10196 | (GDBusPropertyInfo **) &_shared_resource_property_info_pointers, |
| 10197 | NULL |
| 10198 | }, |
| 10199 | "shared-resource", |
| 10200 | }; |
| 10201 | |
| 10202 | |
| 10203 | /** |
| 10204 | * shared_resource_interface_info: |
| 10205 | * |
| 10206 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface. |
| 10207 | * |
| 10208 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 10209 | */ |
| 10210 | GDBusInterfaceInfo * |
| 10211 | shared_resource_interface_info (void) |
| 10212 | { |
| 10213 | return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct; |
| 10214 | } |
| 10215 | |
| 10216 | /** |
| 10217 | * shared_resource_override_properties: |
| 10218 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 10219 | * @property_id_begin: The property id to assign to the first overridden property. |
| 10220 | * |
| 10221 | * Overrides all #GObject properties in the #SharedResource interface for a concrete class. |
| 10222 | * The properties are overridden in the order they are defined. |
| 10223 | * |
| 10224 | * Returns: The last property id. |
| 10225 | */ |
| 10226 | guint |
| 10227 | shared_resource_override_properties (GObjectClass *klass, guint property_id_begin) |
| 10228 | { |
| 10229 | g_object_class_override_property (klass, property_id_begin++, "lock"); |
| 10230 | g_object_class_override_property (klass, property_id_begin++, "name"); |
| 10231 | return property_id_begin - 1; |
| 10232 | } |
| 10233 | |
| 10234 | |
| 10235 | |
| 10236 | /** |
| 10237 | * SharedResource: |
| 10238 | * |
| 10239 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 10240 | */ |
| 10241 | |
| 10242 | /** |
| 10243 | * SharedResourceIface: |
| 10244 | * @parent_iface: The parent interface. |
| 10245 | * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal. |
| 10246 | * @handle_lock: Handler for the #SharedResource::handle-lock signal. |
| 10247 | * @handle_unlock: Handler for the #SharedResource::handle-unlock signal. |
| 10248 | * @get_lock: Getter for the #SharedResource:lock property. |
| 10249 | * @get_name: Getter for the #SharedResource:name property. |
| 10250 | * |
| 10251 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 10252 | */ |
| 10253 | |
| 10254 | typedef SharedResourceIface SharedResourceInterface; |
| 10255 | G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT); |
| 10256 | |
| 10257 | static void |
| 10258 | shared_resource_default_init (SharedResourceIface *iface) |
| 10259 | { |
| 10260 | /* GObject signals for incoming D-Bus method calls: */ |
| 10261 | /** |
| 10262 | * SharedResource::handle-lock: |
| 10263 | * @object: A #SharedResource. |
| 10264 | * @invocation: A #GDBusMethodInvocation. |
| 10265 | * @arg_name: Argument passed by remote caller. |
| 10266 | * |
| 10267 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. |
| 10268 | * |
| 10269 | * 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. |
| 10270 | * |
| 10271 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 10272 | */ |
| 10273 | g_signal_new ("handle-lock", |
| 10274 | G_TYPE_FROM_INTERFACE (iface), |
| 10275 | G_SIGNAL_RUN_LAST, |
| 10276 | G_STRUCT_OFFSET (SharedResourceIface, handle_lock), |
| 10277 | g_signal_accumulator_true_handled, |
| 10278 | NULL, |
| 10279 | g_cclosure_marshal_generic, |
| 10280 | G_TYPE_BOOLEAN, |
| 10281 | 2, |
| 10282 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 10283 | |
| 10284 | /** |
| 10285 | * SharedResource::handle-unlock: |
| 10286 | * @object: A #SharedResource. |
| 10287 | * @invocation: A #GDBusMethodInvocation. |
| 10288 | * |
| 10289 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. |
| 10290 | * |
| 10291 | * 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. |
| 10292 | * |
| 10293 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 10294 | */ |
| 10295 | g_signal_new ("handle-unlock", |
| 10296 | G_TYPE_FROM_INTERFACE (iface), |
| 10297 | G_SIGNAL_RUN_LAST, |
| 10298 | G_STRUCT_OFFSET (SharedResourceIface, handle_unlock), |
| 10299 | g_signal_accumulator_true_handled, |
| 10300 | NULL, |
| 10301 | g_cclosure_marshal_generic, |
| 10302 | G_TYPE_BOOLEAN, |
| 10303 | 1, |
| 10304 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 10305 | |
| 10306 | /** |
| 10307 | * SharedResource::handle-is-locked: |
| 10308 | * @object: A #SharedResource. |
| 10309 | * @invocation: A #GDBusMethodInvocation. |
| 10310 | * |
| 10311 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. |
| 10312 | * |
| 10313 | * 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. |
| 10314 | * |
| 10315 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 10316 | */ |
| 10317 | g_signal_new ("handle-is-locked", |
| 10318 | G_TYPE_FROM_INTERFACE (iface), |
| 10319 | G_SIGNAL_RUN_LAST, |
| 10320 | G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked), |
| 10321 | g_signal_accumulator_true_handled, |
| 10322 | NULL, |
| 10323 | g_cclosure_marshal_generic, |
| 10324 | G_TYPE_BOOLEAN, |
| 10325 | 1, |
| 10326 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 10327 | |
| 10328 | /* GObject properties for D-Bus properties: */ |
| 10329 | /** |
| 10330 | * SharedResource:lock: |
| 10331 | * |
| 10332 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>. |
| 10333 | * |
| 10334 | * 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. |
| 10335 | */ |
| 10336 | g_object_interface_install_property (iface, |
| 10337 | g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 10338 | /** |
| 10339 | * SharedResource:name: |
| 10340 | * |
| 10341 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>. |
| 10342 | * |
| 10343 | * 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. |
| 10344 | */ |
| 10345 | g_object_interface_install_property (iface, |
| 10346 | g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 10347 | } |
| 10348 | |
| 10349 | /** |
| 10350 | * shared_resource_get_lock: (skip) |
| 10351 | * @object: A #SharedResource. |
| 10352 | * |
| 10353 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property. |
| 10354 | * |
| 10355 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 10356 | * |
| 10357 | * Returns: The property value. |
| 10358 | */ |
| 10359 | gboolean |
| 10360 | shared_resource_get_lock (SharedResource *object) |
| 10361 | { |
| 10362 | return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object); |
| 10363 | } |
| 10364 | |
| 10365 | /** |
| 10366 | * shared_resource_set_lock: (skip) |
| 10367 | * @object: A #SharedResource. |
| 10368 | * @value: The value to set. |
| 10369 | * |
| 10370 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value. |
| 10371 | * |
| 10372 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 10373 | */ |
| 10374 | void |
| 10375 | shared_resource_set_lock (SharedResource *object, gboolean value) |
| 10376 | { |
| 10377 | g_object_set (G_OBJECT (object), "lock", value, NULL); |
| 10378 | } |
| 10379 | |
| 10380 | /** |
| 10381 | * shared_resource_get_name: (skip) |
| 10382 | * @object: A #SharedResource. |
| 10383 | * |
| 10384 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 10385 | * |
| 10386 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 10387 | * |
| 10388 | * <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> |
| 10389 | * |
| 10390 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 10391 | */ |
| 10392 | const gchar * |
| 10393 | shared_resource_get_name (SharedResource *object) |
| 10394 | { |
| 10395 | return SHARED_RESOURCE_GET_IFACE (object)->get_name (object); |
| 10396 | } |
| 10397 | |
| 10398 | /** |
| 10399 | * shared_resource_dup_name: (skip) |
| 10400 | * @object: A #SharedResource. |
| 10401 | * |
| 10402 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. |
| 10403 | * |
| 10404 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 10405 | * |
| 10406 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 10407 | */ |
| 10408 | gchar * |
| 10409 | shared_resource_dup_name (SharedResource *object) |
| 10410 | { |
| 10411 | gchar *value; |
| 10412 | g_object_get (G_OBJECT (object), "name", &value, NULL); |
| 10413 | return value; |
| 10414 | } |
| 10415 | |
| 10416 | /** |
| 10417 | * shared_resource_set_name: (skip) |
| 10418 | * @object: A #SharedResource. |
| 10419 | * @value: The value to set. |
| 10420 | * |
| 10421 | * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value. |
| 10422 | * |
| 10423 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 10424 | */ |
| 10425 | void |
| 10426 | shared_resource_set_name (SharedResource *object, const gchar *value) |
| 10427 | { |
| 10428 | g_object_set (G_OBJECT (object), "name", value, NULL); |
| 10429 | } |
| 10430 | |
| 10431 | /** |
| 10432 | * shared_resource_call_lock: |
| 10433 | * @proxy: A #SharedResourceProxy. |
| 10434 | * @arg_name: Argument to pass with the method invocation. |
| 10435 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10436 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 10437 | * @user_data: User data to pass to @callback. |
| 10438 | * |
| 10439 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. |
| 10440 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 10441 | * You can then call shared_resource_call_lock_finish() to get the result of the operation. |
| 10442 | * |
| 10443 | * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method. |
| 10444 | */ |
| 10445 | void |
| 10446 | shared_resource_call_lock ( |
| 10447 | SharedResource *proxy, |
| 10448 | const gchar *arg_name, |
| 10449 | GCancellable *cancellable, |
| 10450 | GAsyncReadyCallback callback, |
| 10451 | gpointer user_data) |
| 10452 | { |
| 10453 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 10454 | "lock", |
| 10455 | g_variant_new ("(s)", |
| 10456 | arg_name), |
| 10457 | G_DBUS_CALL_FLAGS_NONE, |
| 10458 | -1, |
| 10459 | cancellable, |
| 10460 | callback, |
| 10461 | user_data); |
| 10462 | } |
| 10463 | |
| 10464 | /** |
| 10465 | * shared_resource_call_lock_finish: |
| 10466 | * @proxy: A #SharedResourceProxy. |
| 10467 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock(). |
| 10468 | * @error: Return location for error or %NULL. |
| 10469 | * |
| 10470 | * Finishes an operation started with shared_resource_call_lock(). |
| 10471 | * |
| 10472 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10473 | */ |
| 10474 | gboolean |
| 10475 | shared_resource_call_lock_finish ( |
| 10476 | SharedResource *proxy, |
| 10477 | GAsyncResult *res, |
| 10478 | GError **error) |
| 10479 | { |
| 10480 | GVariant *_ret; |
| 10481 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 10482 | if (_ret == NULL) |
| 10483 | goto _out; |
| 10484 | g_variant_get (_ret, |
| 10485 | "()"); |
| 10486 | g_variant_unref (_ret); |
| 10487 | _out: |
| 10488 | return _ret != NULL; |
| 10489 | } |
| 10490 | |
| 10491 | /** |
| 10492 | * shared_resource_call_lock_sync: |
| 10493 | * @proxy: A #SharedResourceProxy. |
| 10494 | * @arg_name: Argument to pass with the method invocation. |
| 10495 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10496 | * @error: Return location for error or %NULL. |
| 10497 | * |
| 10498 | * 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. |
| 10499 | * |
| 10500 | * See shared_resource_call_lock() for the asynchronous version of this method. |
| 10501 | * |
| 10502 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10503 | */ |
| 10504 | gboolean |
| 10505 | shared_resource_call_lock_sync ( |
| 10506 | SharedResource *proxy, |
| 10507 | const gchar *arg_name, |
| 10508 | GCancellable *cancellable, |
| 10509 | GError **error) |
| 10510 | { |
| 10511 | GVariant *_ret; |
| 10512 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 10513 | "lock", |
| 10514 | g_variant_new ("(s)", |
| 10515 | arg_name), |
| 10516 | G_DBUS_CALL_FLAGS_NONE, |
| 10517 | -1, |
| 10518 | cancellable, |
| 10519 | error); |
| 10520 | if (_ret == NULL) |
| 10521 | goto _out; |
| 10522 | g_variant_get (_ret, |
| 10523 | "()"); |
| 10524 | g_variant_unref (_ret); |
| 10525 | _out: |
| 10526 | return _ret != NULL; |
| 10527 | } |
| 10528 | |
| 10529 | /** |
| 10530 | * shared_resource_call_unlock: |
| 10531 | * @proxy: A #SharedResourceProxy. |
| 10532 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10533 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 10534 | * @user_data: User data to pass to @callback. |
| 10535 | * |
| 10536 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. |
| 10537 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 10538 | * You can then call shared_resource_call_unlock_finish() to get the result of the operation. |
| 10539 | * |
| 10540 | * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method. |
| 10541 | */ |
| 10542 | void |
| 10543 | shared_resource_call_unlock ( |
| 10544 | SharedResource *proxy, |
| 10545 | GCancellable *cancellable, |
| 10546 | GAsyncReadyCallback callback, |
| 10547 | gpointer user_data) |
| 10548 | { |
| 10549 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 10550 | "unlock", |
| 10551 | g_variant_new ("()"), |
| 10552 | G_DBUS_CALL_FLAGS_NONE, |
| 10553 | -1, |
| 10554 | cancellable, |
| 10555 | callback, |
| 10556 | user_data); |
| 10557 | } |
| 10558 | |
| 10559 | /** |
| 10560 | * shared_resource_call_unlock_finish: |
| 10561 | * @proxy: A #SharedResourceProxy. |
| 10562 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock(). |
| 10563 | * @error: Return location for error or %NULL. |
| 10564 | * |
| 10565 | * Finishes an operation started with shared_resource_call_unlock(). |
| 10566 | * |
| 10567 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10568 | */ |
| 10569 | gboolean |
| 10570 | shared_resource_call_unlock_finish ( |
| 10571 | SharedResource *proxy, |
| 10572 | GAsyncResult *res, |
| 10573 | GError **error) |
| 10574 | { |
| 10575 | GVariant *_ret; |
| 10576 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 10577 | if (_ret == NULL) |
| 10578 | goto _out; |
| 10579 | g_variant_get (_ret, |
| 10580 | "()"); |
| 10581 | g_variant_unref (_ret); |
| 10582 | _out: |
| 10583 | return _ret != NULL; |
| 10584 | } |
| 10585 | |
| 10586 | /** |
| 10587 | * shared_resource_call_unlock_sync: |
| 10588 | * @proxy: A #SharedResourceProxy. |
| 10589 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10590 | * @error: Return location for error or %NULL. |
| 10591 | * |
| 10592 | * 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. |
| 10593 | * |
| 10594 | * See shared_resource_call_unlock() for the asynchronous version of this method. |
| 10595 | * |
| 10596 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10597 | */ |
| 10598 | gboolean |
| 10599 | shared_resource_call_unlock_sync ( |
| 10600 | SharedResource *proxy, |
| 10601 | GCancellable *cancellable, |
| 10602 | GError **error) |
| 10603 | { |
| 10604 | GVariant *_ret; |
| 10605 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 10606 | "unlock", |
| 10607 | g_variant_new ("()"), |
| 10608 | G_DBUS_CALL_FLAGS_NONE, |
| 10609 | -1, |
| 10610 | cancellable, |
| 10611 | error); |
| 10612 | if (_ret == NULL) |
| 10613 | goto _out; |
| 10614 | g_variant_get (_ret, |
| 10615 | "()"); |
| 10616 | g_variant_unref (_ret); |
| 10617 | _out: |
| 10618 | return _ret != NULL; |
| 10619 | } |
| 10620 | |
| 10621 | /** |
| 10622 | * shared_resource_call_is_locked: |
| 10623 | * @proxy: A #SharedResourceProxy. |
| 10624 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10625 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 10626 | * @user_data: User data to pass to @callback. |
| 10627 | * |
| 10628 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. |
| 10629 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 10630 | * You can then call shared_resource_call_is_locked_finish() to get the result of the operation. |
| 10631 | * |
| 10632 | * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method. |
| 10633 | */ |
| 10634 | void |
| 10635 | shared_resource_call_is_locked ( |
| 10636 | SharedResource *proxy, |
| 10637 | GCancellable *cancellable, |
| 10638 | GAsyncReadyCallback callback, |
| 10639 | gpointer user_data) |
| 10640 | { |
| 10641 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 10642 | "isLocked", |
| 10643 | g_variant_new ("()"), |
| 10644 | G_DBUS_CALL_FLAGS_NONE, |
| 10645 | -1, |
| 10646 | cancellable, |
| 10647 | callback, |
| 10648 | user_data); |
| 10649 | } |
| 10650 | |
| 10651 | /** |
| 10652 | * shared_resource_call_is_locked_finish: |
| 10653 | * @proxy: A #SharedResourceProxy. |
| 10654 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 10655 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 10656 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked(). |
| 10657 | * @error: Return location for error or %NULL. |
| 10658 | * |
| 10659 | * Finishes an operation started with shared_resource_call_is_locked(). |
| 10660 | * |
| 10661 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10662 | */ |
| 10663 | gboolean |
| 10664 | shared_resource_call_is_locked_finish ( |
| 10665 | SharedResource *proxy, |
| 10666 | gboolean *out_lock, |
| 10667 | gchar **out_name, |
| 10668 | GAsyncResult *res, |
| 10669 | GError **error) |
| 10670 | { |
| 10671 | GVariant *_ret; |
| 10672 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 10673 | if (_ret == NULL) |
| 10674 | goto _out; |
| 10675 | g_variant_get (_ret, |
| 10676 | "(bs)", |
| 10677 | out_lock, |
| 10678 | out_name); |
| 10679 | g_variant_unref (_ret); |
| 10680 | _out: |
| 10681 | return _ret != NULL; |
| 10682 | } |
| 10683 | |
| 10684 | /** |
| 10685 | * shared_resource_call_is_locked_sync: |
| 10686 | * @proxy: A #SharedResourceProxy. |
| 10687 | * @out_lock: (out): Return location for return parameter or %NULL to ignore. |
| 10688 | * @out_name: (out): Return location for return parameter or %NULL to ignore. |
| 10689 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 10690 | * @error: Return location for error or %NULL. |
| 10691 | * |
| 10692 | * 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. |
| 10693 | * |
| 10694 | * See shared_resource_call_is_locked() for the asynchronous version of this method. |
| 10695 | * |
| 10696 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 10697 | */ |
| 10698 | gboolean |
| 10699 | shared_resource_call_is_locked_sync ( |
| 10700 | SharedResource *proxy, |
| 10701 | gboolean *out_lock, |
| 10702 | gchar **out_name, |
| 10703 | GCancellable *cancellable, |
| 10704 | GError **error) |
| 10705 | { |
| 10706 | GVariant *_ret; |
| 10707 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 10708 | "isLocked", |
| 10709 | g_variant_new ("()"), |
| 10710 | G_DBUS_CALL_FLAGS_NONE, |
| 10711 | -1, |
| 10712 | cancellable, |
| 10713 | error); |
| 10714 | if (_ret == NULL) |
| 10715 | goto _out; |
| 10716 | g_variant_get (_ret, |
| 10717 | "(bs)", |
| 10718 | out_lock, |
| 10719 | out_name); |
| 10720 | g_variant_unref (_ret); |
| 10721 | _out: |
| 10722 | return _ret != NULL; |
| 10723 | } |
| 10724 | |
| 10725 | /** |
| 10726 | * shared_resource_complete_lock: |
| 10727 | * @object: A #SharedResource. |
| 10728 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 10729 | * |
| 10730 | * 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. |
| 10731 | * |
| 10732 | * This method will free @invocation, you cannot use it afterwards. |
| 10733 | */ |
| 10734 | void |
| 10735 | shared_resource_complete_lock ( |
| 10736 | SharedResource *object, |
| 10737 | GDBusMethodInvocation *invocation) |
| 10738 | { |
| 10739 | g_dbus_method_invocation_return_value (invocation, |
| 10740 | g_variant_new ("()")); |
| 10741 | } |
| 10742 | |
| 10743 | /** |
| 10744 | * shared_resource_complete_unlock: |
| 10745 | * @object: A #SharedResource. |
| 10746 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 10747 | * |
| 10748 | * 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. |
| 10749 | * |
| 10750 | * This method will free @invocation, you cannot use it afterwards. |
| 10751 | */ |
| 10752 | void |
| 10753 | shared_resource_complete_unlock ( |
| 10754 | SharedResource *object, |
| 10755 | GDBusMethodInvocation *invocation) |
| 10756 | { |
| 10757 | g_dbus_method_invocation_return_value (invocation, |
| 10758 | g_variant_new ("()")); |
| 10759 | } |
| 10760 | |
| 10761 | /** |
| 10762 | * shared_resource_complete_is_locked: |
| 10763 | * @object: A #SharedResource. |
| 10764 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 10765 | * @lock: Parameter to return. |
| 10766 | * @name: Parameter to return. |
| 10767 | * |
| 10768 | * 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. |
| 10769 | * |
| 10770 | * This method will free @invocation, you cannot use it afterwards. |
| 10771 | */ |
| 10772 | void |
| 10773 | shared_resource_complete_is_locked ( |
| 10774 | SharedResource *object, |
| 10775 | GDBusMethodInvocation *invocation, |
| 10776 | gboolean lock, |
| 10777 | const gchar *name) |
| 10778 | { |
| 10779 | g_dbus_method_invocation_return_value (invocation, |
| 10780 | g_variant_new ("(bs)", |
| 10781 | lock, |
| 10782 | name)); |
| 10783 | } |
| 10784 | |
| 10785 | /* ------------------------------------------------------------------------ */ |
| 10786 | |
| 10787 | /** |
| 10788 | * SharedResourceProxy: |
| 10789 | * |
| 10790 | * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API. |
| 10791 | */ |
| 10792 | |
| 10793 | /** |
| 10794 | * SharedResourceProxyClass: |
| 10795 | * @parent_class: The parent class. |
| 10796 | * |
| 10797 | * Class structure for #SharedResourceProxy. |
| 10798 | */ |
| 10799 | |
| 10800 | struct _SharedResourceProxyPrivate |
| 10801 | { |
| 10802 | GData *qdata; |
| 10803 | }; |
| 10804 | |
| 10805 | static void shared_resource_proxy_iface_init (SharedResourceIface *iface); |
| 10806 | |
| 10807 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10808 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 10809 | G_ADD_PRIVATE (SharedResourceProxy) |
| 10810 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 10811 | |
| 10812 | #else |
| 10813 | G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, |
| 10814 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); |
| 10815 | |
| 10816 | #endif |
| 10817 | static void |
| 10818 | shared_resource_proxy_finalize (GObject *object) |
| 10819 | { |
| 10820 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 10821 | g_datalist_clear (&proxy->priv->qdata); |
| 10822 | G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object); |
| 10823 | } |
| 10824 | |
| 10825 | static void |
| 10826 | shared_resource_proxy_get_property (GObject *object, |
| 10827 | guint prop_id, |
| 10828 | GValue *value, |
| 10829 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10830 | { |
| 10831 | const _ExtendedGDBusPropertyInfo *info; |
| 10832 | GVariant *variant; |
| 10833 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10834 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 10835 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 10836 | if (info->use_gvariant) |
| 10837 | { |
| 10838 | g_value_set_variant (value, variant); |
| 10839 | } |
| 10840 | else |
| 10841 | { |
| 10842 | if (variant != NULL) |
| 10843 | g_dbus_gvariant_to_gvalue (variant, value); |
| 10844 | } |
| 10845 | if (variant != NULL) |
| 10846 | g_variant_unref (variant); |
| 10847 | } |
| 10848 | |
| 10849 | static void |
| 10850 | shared_resource_proxy_set_property_cb (GDBusProxy *proxy, |
| 10851 | GAsyncResult *res, |
| 10852 | gpointer user_data) |
| 10853 | { |
| 10854 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 10855 | GError *error; |
| 10856 | GVariant *_ret; |
| 10857 | error = NULL; |
| 10858 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 10859 | if (!_ret) |
| 10860 | { |
| 10861 | g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)", |
| 10862 | info->parent_struct.name, |
| 10863 | error->message, g_quark_to_string (error->domain), error->code); |
| 10864 | g_error_free (error); |
| 10865 | } |
| 10866 | else |
| 10867 | { |
| 10868 | g_variant_unref (_ret); |
| 10869 | } |
| 10870 | } |
| 10871 | |
| 10872 | static void |
| 10873 | shared_resource_proxy_set_property (GObject *object, |
| 10874 | guint prop_id, |
| 10875 | const GValue *value, |
| 10876 | GParamSpec *pspec G_GNUC_UNUSED) |
| 10877 | { |
| 10878 | const _ExtendedGDBusPropertyInfo *info; |
| 10879 | GVariant *variant; |
| 10880 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 10881 | info = _shared_resource_property_info_pointers[prop_id - 1]; |
| 10882 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 10883 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 10884 | "org.freedesktop.DBus.Properties.Set", |
| 10885 | g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant), |
| 10886 | G_DBUS_CALL_FLAGS_NONE, |
| 10887 | -1, |
| 10888 | NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 10889 | g_variant_unref (variant); |
| 10890 | } |
| 10891 | |
| 10892 | static void |
| 10893 | shared_resource_proxy_g_signal (GDBusProxy *proxy, |
| 10894 | const gchar *sender_name G_GNUC_UNUSED, |
| 10895 | const gchar *signal_name, |
| 10896 | GVariant *parameters) |
| 10897 | { |
| 10898 | _ExtendedGDBusSignalInfo *info; |
| 10899 | GVariantIter iter; |
| 10900 | GVariant *child; |
| 10901 | GValue *paramv; |
| 10902 | guint num_params; |
| 10903 | guint n; |
| 10904 | guint signal_id; |
| 10905 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name); |
| 10906 | if (info == NULL) |
| 10907 | return; |
| 10908 | num_params = g_variant_n_children (parameters); |
| 10909 | paramv = g_new0 (GValue, num_params + 1); |
| 10910 | g_value_init (¶mv[0], TYPE_SHARED_RESOURCE); |
| 10911 | g_value_set_object (¶mv[0], proxy); |
| 10912 | g_variant_iter_init (&iter, parameters); |
| 10913 | n = 1; |
| 10914 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 10915 | { |
| 10916 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 10917 | if (arg_info->use_gvariant) |
| 10918 | { |
| 10919 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 10920 | g_value_set_variant (¶mv[n], child); |
| 10921 | n++; |
| 10922 | } |
| 10923 | else |
| 10924 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 10925 | g_variant_unref (child); |
| 10926 | } |
| 10927 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 10928 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 10929 | for (n = 0; n < num_params + 1; n++) |
| 10930 | g_value_unset (¶mv[n]); |
| 10931 | g_free (paramv); |
| 10932 | } |
| 10933 | |
| 10934 | static void |
| 10935 | shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 10936 | GVariant *changed_properties, |
| 10937 | const gchar *const *invalidated_properties) |
| 10938 | { |
| 10939 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy); |
| 10940 | guint n; |
| 10941 | const gchar *key; |
| 10942 | GVariantIter *iter; |
| 10943 | _ExtendedGDBusPropertyInfo *info; |
| 10944 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 10945 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 10946 | { |
| 10947 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key); |
| 10948 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 10949 | if (info != NULL) |
| 10950 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10951 | } |
| 10952 | g_variant_iter_free (iter); |
| 10953 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 10954 | { |
| 10955 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]); |
| 10956 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 10957 | if (info != NULL) |
| 10958 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 10959 | } |
| 10960 | } |
| 10961 | |
| 10962 | static gboolean |
| 10963 | shared_resource_proxy_get_lock (SharedResource *object) |
| 10964 | { |
| 10965 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 10966 | GVariant *variant; |
| 10967 | gboolean value = 0; |
| 10968 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock"); |
| 10969 | if (variant != NULL) |
| 10970 | { |
| 10971 | value = g_variant_get_boolean (variant); |
| 10972 | g_variant_unref (variant); |
| 10973 | } |
| 10974 | return value; |
| 10975 | } |
| 10976 | |
| 10977 | static const gchar * |
| 10978 | shared_resource_proxy_get_name (SharedResource *object) |
| 10979 | { |
| 10980 | SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); |
| 10981 | GVariant *variant; |
| 10982 | const gchar *value = NULL; |
| 10983 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name"); |
| 10984 | if (variant != NULL) |
| 10985 | { |
| 10986 | value = g_variant_get_string (variant, NULL); |
| 10987 | g_variant_unref (variant); |
| 10988 | } |
| 10989 | return value; |
| 10990 | } |
| 10991 | |
| 10992 | static void |
| 10993 | shared_resource_proxy_init (SharedResourceProxy *proxy) |
| 10994 | { |
| 10995 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 10996 | proxy->priv = shared_resource_proxy_get_instance_private (proxy); |
| 10997 | #else |
| 10998 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate); |
| 10999 | #endif |
| 11000 | |
| 11001 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ()); |
| 11002 | } |
| 11003 | |
| 11004 | static void |
| 11005 | shared_resource_proxy_class_init (SharedResourceProxyClass *klass) |
| 11006 | { |
| 11007 | GObjectClass *gobject_class; |
| 11008 | GDBusProxyClass *proxy_class; |
| 11009 | |
| 11010 | gobject_class = G_OBJECT_CLASS (klass); |
| 11011 | gobject_class->finalize = shared_resource_proxy_finalize; |
| 11012 | gobject_class->get_property = shared_resource_proxy_get_property; |
| 11013 | gobject_class->set_property = shared_resource_proxy_set_property; |
| 11014 | |
| 11015 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 11016 | proxy_class->g_signal = shared_resource_proxy_g_signal; |
| 11017 | proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed; |
| 11018 | |
| 11019 | shared_resource_override_properties (gobject_class, 1); |
| 11020 | |
| 11021 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 11022 | g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate)); |
| 11023 | #endif |
| 11024 | } |
| 11025 | |
| 11026 | static void |
| 11027 | shared_resource_proxy_iface_init (SharedResourceIface *iface) |
| 11028 | { |
| 11029 | iface->get_lock = shared_resource_proxy_get_lock; |
| 11030 | iface->get_name = shared_resource_proxy_get_name; |
| 11031 | } |
| 11032 | |
| 11033 | /** |
| 11034 | * shared_resource_proxy_new: |
| 11035 | * @connection: A #GDBusConnection. |
| 11036 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11037 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11038 | * @object_path: An object path. |
| 11039 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11040 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11041 | * @user_data: User data to pass to @callback. |
| 11042 | * |
| 11043 | * 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. |
| 11044 | * |
| 11045 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 11046 | * You can then call shared_resource_proxy_new_finish() to get the result of the operation. |
| 11047 | * |
| 11048 | * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 11049 | */ |
| 11050 | void |
| 11051 | shared_resource_proxy_new ( |
| 11052 | GDBusConnection *connection, |
| 11053 | GDBusProxyFlags flags, |
| 11054 | const gchar *name, |
| 11055 | const gchar *object_path, |
| 11056 | GCancellable *cancellable, |
| 11057 | GAsyncReadyCallback callback, |
| 11058 | gpointer user_data) |
| 11059 | { |
| 11060 | 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); |
| 11061 | } |
| 11062 | |
| 11063 | /** |
| 11064 | * shared_resource_proxy_new_finish: |
| 11065 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new(). |
| 11066 | * @error: Return location for error or %NULL |
| 11067 | * |
| 11068 | * Finishes an operation started with shared_resource_proxy_new(). |
| 11069 | * |
| 11070 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 11071 | */ |
| 11072 | SharedResource * |
| 11073 | shared_resource_proxy_new_finish ( |
| 11074 | GAsyncResult *res, |
| 11075 | GError **error) |
| 11076 | { |
| 11077 | GObject *ret; |
| 11078 | GObject *source_object; |
| 11079 | source_object = g_async_result_get_source_object (res); |
| 11080 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11081 | g_object_unref (source_object); |
| 11082 | if (ret != NULL) |
| 11083 | return SHARED_RESOURCE (ret); |
| 11084 | else |
| 11085 | return NULL; |
| 11086 | } |
| 11087 | |
| 11088 | /** |
| 11089 | * shared_resource_proxy_new_sync: |
| 11090 | * @connection: A #GDBusConnection. |
| 11091 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11092 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 11093 | * @object_path: An object path. |
| 11094 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11095 | * @error: Return location for error or %NULL |
| 11096 | * |
| 11097 | * 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. |
| 11098 | * |
| 11099 | * The calling thread is blocked until a reply is received. |
| 11100 | * |
| 11101 | * See shared_resource_proxy_new() for the asynchronous version of this constructor. |
| 11102 | * |
| 11103 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 11104 | */ |
| 11105 | SharedResource * |
| 11106 | shared_resource_proxy_new_sync ( |
| 11107 | GDBusConnection *connection, |
| 11108 | GDBusProxyFlags flags, |
| 11109 | const gchar *name, |
| 11110 | const gchar *object_path, |
| 11111 | GCancellable *cancellable, |
| 11112 | GError **error) |
| 11113 | { |
| 11114 | GInitable *ret; |
| 11115 | 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); |
| 11116 | if (ret != NULL) |
| 11117 | return SHARED_RESOURCE (ret); |
| 11118 | else |
| 11119 | return NULL; |
| 11120 | } |
| 11121 | |
| 11122 | |
| 11123 | /** |
| 11124 | * shared_resource_proxy_new_for_bus: |
| 11125 | * @bus_type: A #GBusType. |
| 11126 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11127 | * @name: A bus name (well-known or unique). |
| 11128 | * @object_path: An object path. |
| 11129 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11130 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 11131 | * @user_data: User data to pass to @callback. |
| 11132 | * |
| 11133 | * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 11134 | * |
| 11135 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 11136 | * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation. |
| 11137 | * |
| 11138 | * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 11139 | */ |
| 11140 | void |
| 11141 | shared_resource_proxy_new_for_bus ( |
| 11142 | GBusType bus_type, |
| 11143 | GDBusProxyFlags flags, |
| 11144 | const gchar *name, |
| 11145 | const gchar *object_path, |
| 11146 | GCancellable *cancellable, |
| 11147 | GAsyncReadyCallback callback, |
| 11148 | gpointer user_data) |
| 11149 | { |
| 11150 | 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); |
| 11151 | } |
| 11152 | |
| 11153 | /** |
| 11154 | * shared_resource_proxy_new_for_bus_finish: |
| 11155 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus(). |
| 11156 | * @error: Return location for error or %NULL |
| 11157 | * |
| 11158 | * Finishes an operation started with shared_resource_proxy_new_for_bus(). |
| 11159 | * |
| 11160 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 11161 | */ |
| 11162 | SharedResource * |
| 11163 | shared_resource_proxy_new_for_bus_finish ( |
| 11164 | GAsyncResult *res, |
| 11165 | GError **error) |
| 11166 | { |
| 11167 | GObject *ret; |
| 11168 | GObject *source_object; |
| 11169 | source_object = g_async_result_get_source_object (res); |
| 11170 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 11171 | g_object_unref (source_object); |
| 11172 | if (ret != NULL) |
| 11173 | return SHARED_RESOURCE (ret); |
| 11174 | else |
| 11175 | return NULL; |
| 11176 | } |
| 11177 | |
| 11178 | /** |
| 11179 | * shared_resource_proxy_new_for_bus_sync: |
| 11180 | * @bus_type: A #GBusType. |
| 11181 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 11182 | * @name: A bus name (well-known or unique). |
| 11183 | * @object_path: An object path. |
| 11184 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 11185 | * @error: Return location for error or %NULL |
| 11186 | * |
| 11187 | * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 11188 | * |
| 11189 | * The calling thread is blocked until a reply is received. |
| 11190 | * |
| 11191 | * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 11192 | * |
| 11193 | * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. |
| 11194 | */ |
| 11195 | SharedResource * |
| 11196 | shared_resource_proxy_new_for_bus_sync ( |
| 11197 | GBusType bus_type, |
| 11198 | GDBusProxyFlags flags, |
| 11199 | const gchar *name, |
| 11200 | const gchar *object_path, |
| 11201 | GCancellable *cancellable, |
| 11202 | GError **error) |
| 11203 | { |
| 11204 | GInitable *ret; |
| 11205 | 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); |
| 11206 | if (ret != NULL) |
| 11207 | return SHARED_RESOURCE (ret); |
| 11208 | else |
| 11209 | return NULL; |
| 11210 | } |
| 11211 | |
| 11212 | |
| 11213 | /* ------------------------------------------------------------------------ */ |
| 11214 | |
| 11215 | /** |
| 11216 | * SharedResourceSkeleton: |
| 11217 | * |
| 11218 | * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API. |
| 11219 | */ |
| 11220 | |
| 11221 | /** |
| 11222 | * SharedResourceSkeletonClass: |
| 11223 | * @parent_class: The parent class. |
| 11224 | * |
| 11225 | * Class structure for #SharedResourceSkeleton. |
| 11226 | */ |
| 11227 | |
| 11228 | struct _SharedResourceSkeletonPrivate |
| 11229 | { |
| 11230 | GValue *properties; |
| 11231 | GList *changed_properties; |
| 11232 | GSource *changed_properties_idle_source; |
| 11233 | GMainContext *context; |
| 11234 | GMutex lock; |
| 11235 | }; |
| 11236 | |
| 11237 | static void |
| 11238 | _shared_resource_skeleton_handle_method_call ( |
| 11239 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11240 | const gchar *sender G_GNUC_UNUSED, |
| 11241 | const gchar *object_path G_GNUC_UNUSED, |
| 11242 | const gchar *interface_name, |
| 11243 | const gchar *method_name, |
| 11244 | GVariant *parameters, |
| 11245 | GDBusMethodInvocation *invocation, |
| 11246 | gpointer user_data) |
| 11247 | { |
| 11248 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 11249 | _ExtendedGDBusMethodInfo *info; |
| 11250 | GVariantIter iter; |
| 11251 | GVariant *child; |
| 11252 | GValue *paramv; |
| 11253 | guint num_params; |
| 11254 | guint num_extra; |
| 11255 | guint n; |
| 11256 | guint signal_id; |
| 11257 | GValue return_value = G_VALUE_INIT; |
| 11258 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 11259 | g_assert (info != NULL); |
| 11260 | num_params = g_variant_n_children (parameters); |
| 11261 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 11262 | n = 0; |
| 11263 | g_value_init (¶mv[n], TYPE_SHARED_RESOURCE); |
| 11264 | g_value_set_object (¶mv[n++], skeleton); |
| 11265 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 11266 | g_value_set_object (¶mv[n++], invocation); |
| 11267 | if (info->pass_fdlist) |
| 11268 | { |
| 11269 | #ifdef G_OS_UNIX |
| 11270 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 11271 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 11272 | #else |
| 11273 | g_assert_not_reached (); |
| 11274 | #endif |
| 11275 | } |
| 11276 | g_variant_iter_init (&iter, parameters); |
| 11277 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 11278 | { |
| 11279 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 11280 | if (arg_info->use_gvariant) |
| 11281 | { |
| 11282 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 11283 | g_value_set_variant (¶mv[n], child); |
| 11284 | n++; |
| 11285 | } |
| 11286 | else |
| 11287 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 11288 | g_variant_unref (child); |
| 11289 | } |
| 11290 | signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); |
| 11291 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 11292 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 11293 | if (!g_value_get_boolean (&return_value)) |
| 11294 | 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); |
| 11295 | g_value_unset (&return_value); |
| 11296 | for (n = 0; n < num_params + num_extra; n++) |
| 11297 | g_value_unset (¶mv[n]); |
| 11298 | g_free (paramv); |
| 11299 | } |
| 11300 | |
| 11301 | static GVariant * |
| 11302 | _shared_resource_skeleton_handle_get_property ( |
| 11303 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11304 | const gchar *sender G_GNUC_UNUSED, |
| 11305 | const gchar *object_path G_GNUC_UNUSED, |
| 11306 | const gchar *interface_name G_GNUC_UNUSED, |
| 11307 | const gchar *property_name, |
| 11308 | GError **error, |
| 11309 | gpointer user_data) |
| 11310 | { |
| 11311 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 11312 | GValue value = G_VALUE_INIT; |
| 11313 | GParamSpec *pspec; |
| 11314 | _ExtendedGDBusPropertyInfo *info; |
| 11315 | GVariant *ret; |
| 11316 | ret = NULL; |
| 11317 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 11318 | g_assert (info != NULL); |
| 11319 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11320 | if (pspec == NULL) |
| 11321 | { |
| 11322 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11323 | } |
| 11324 | else |
| 11325 | { |
| 11326 | g_value_init (&value, pspec->value_type); |
| 11327 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11328 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 11329 | g_value_unset (&value); |
| 11330 | } |
| 11331 | return ret; |
| 11332 | } |
| 11333 | |
| 11334 | static gboolean |
| 11335 | _shared_resource_skeleton_handle_set_property ( |
| 11336 | GDBusConnection *connection G_GNUC_UNUSED, |
| 11337 | const gchar *sender G_GNUC_UNUSED, |
| 11338 | const gchar *object_path G_GNUC_UNUSED, |
| 11339 | const gchar *interface_name G_GNUC_UNUSED, |
| 11340 | const gchar *property_name, |
| 11341 | GVariant *variant, |
| 11342 | GError **error, |
| 11343 | gpointer user_data) |
| 11344 | { |
| 11345 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 11346 | GValue value = G_VALUE_INIT; |
| 11347 | GParamSpec *pspec; |
| 11348 | _ExtendedGDBusPropertyInfo *info; |
| 11349 | gboolean ret; |
| 11350 | ret = FALSE; |
| 11351 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); |
| 11352 | g_assert (info != NULL); |
| 11353 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 11354 | if (pspec == NULL) |
| 11355 | { |
| 11356 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 11357 | } |
| 11358 | else |
| 11359 | { |
| 11360 | if (info->use_gvariant) |
| 11361 | g_value_set_variant (&value, variant); |
| 11362 | else |
| 11363 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 11364 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 11365 | g_value_unset (&value); |
| 11366 | ret = TRUE; |
| 11367 | } |
| 11368 | return ret; |
| 11369 | } |
| 11370 | |
| 11371 | static const GDBusInterfaceVTable _shared_resource_skeleton_vtable = |
| 11372 | { |
| 11373 | _shared_resource_skeleton_handle_method_call, |
| 11374 | _shared_resource_skeleton_handle_get_property, |
| 11375 | _shared_resource_skeleton_handle_set_property, |
| 11376 | {NULL} |
| 11377 | }; |
| 11378 | |
| 11379 | static GDBusInterfaceInfo * |
| 11380 | shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11381 | { |
| 11382 | return shared_resource_interface_info (); |
| 11383 | } |
| 11384 | |
| 11385 | static GDBusInterfaceVTable * |
| 11386 | shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 11387 | { |
| 11388 | return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable; |
| 11389 | } |
| 11390 | |
| 11391 | static GVariant * |
| 11392 | shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 11393 | { |
| 11394 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 11395 | |
| 11396 | GVariantBuilder builder; |
| 11397 | guint n; |
| 11398 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 11399 | if (_shared_resource_interface_info.parent_struct.properties == NULL) |
| 11400 | goto out; |
| 11401 | for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++) |
| 11402 | { |
| 11403 | GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n]; |
| 11404 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 11405 | { |
| 11406 | GVariant *value; |
| 11407 | 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); |
| 11408 | if (value != NULL) |
| 11409 | { |
| 11410 | g_variant_take_ref (value); |
| 11411 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 11412 | g_variant_unref (value); |
| 11413 | } |
| 11414 | } |
| 11415 | } |
| 11416 | out: |
| 11417 | return g_variant_builder_end (&builder); |
| 11418 | } |
| 11419 | |
| 11420 | static gboolean _shared_resource_emit_changed (gpointer user_data); |
| 11421 | |
| 11422 | static void |
| 11423 | shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 11424 | { |
| 11425 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); |
| 11426 | gboolean emit_changed = FALSE; |
| 11427 | |
| 11428 | g_mutex_lock (&skeleton->priv->lock); |
| 11429 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 11430 | { |
| 11431 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 11432 | skeleton->priv->changed_properties_idle_source = NULL; |
| 11433 | emit_changed = TRUE; |
| 11434 | } |
| 11435 | g_mutex_unlock (&skeleton->priv->lock); |
| 11436 | |
| 11437 | if (emit_changed) |
| 11438 | _shared_resource_emit_changed (skeleton); |
| 11439 | } |
| 11440 | |
| 11441 | static void shared_resource_skeleton_iface_init (SharedResourceIface *iface); |
| 11442 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11443 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 11444 | G_ADD_PRIVATE (SharedResourceSkeleton) |
| 11445 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 11446 | |
| 11447 | #else |
| 11448 | G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 11449 | G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); |
| 11450 | |
| 11451 | #endif |
| 11452 | static void |
| 11453 | shared_resource_skeleton_finalize (GObject *object) |
| 11454 | { |
| 11455 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11456 | guint n; |
| 11457 | for (n = 0; n < 2; n++) |
| 11458 | g_value_unset (&skeleton->priv->properties[n]); |
| 11459 | g_free (skeleton->priv->properties); |
| 11460 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 11461 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 11462 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 11463 | g_main_context_unref (skeleton->priv->context); |
| 11464 | g_mutex_clear (&skeleton->priv->lock); |
| 11465 | G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object); |
| 11466 | } |
| 11467 | |
| 11468 | static void |
| 11469 | shared_resource_skeleton_get_property (GObject *object, |
| 11470 | guint prop_id, |
| 11471 | GValue *value, |
| 11472 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11473 | { |
| 11474 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11475 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11476 | g_mutex_lock (&skeleton->priv->lock); |
| 11477 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 11478 | g_mutex_unlock (&skeleton->priv->lock); |
| 11479 | } |
| 11480 | |
| 11481 | static gboolean |
| 11482 | _shared_resource_emit_changed (gpointer user_data) |
| 11483 | { |
| 11484 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); |
| 11485 | GList *l; |
| 11486 | GVariantBuilder builder; |
| 11487 | GVariantBuilder invalidated_builder; |
| 11488 | guint num_changes; |
| 11489 | |
| 11490 | g_mutex_lock (&skeleton->priv->lock); |
| 11491 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 11492 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 11493 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 11494 | { |
| 11495 | ChangedProperty *cp = l->data; |
| 11496 | GVariant *variant; |
| 11497 | const GValue *cur_value; |
| 11498 | |
| 11499 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 11500 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 11501 | { |
| 11502 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 11503 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 11504 | g_variant_unref (variant); |
| 11505 | num_changes++; |
| 11506 | } |
| 11507 | } |
| 11508 | if (num_changes > 0) |
| 11509 | { |
| 11510 | GList *connections, *ll; |
| 11511 | GVariant *signal_variant; |
| 11512 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource", |
| 11513 | &builder, &invalidated_builder)); |
| 11514 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 11515 | for (ll = connections; ll != NULL; ll = ll->next) |
| 11516 | { |
| 11517 | GDBusConnection *connection = ll->data; |
| 11518 | |
| 11519 | g_dbus_connection_emit_signal (connection, |
| 11520 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 11521 | "org.freedesktop.DBus.Properties", |
| 11522 | "PropertiesChanged", |
| 11523 | signal_variant, |
| 11524 | NULL); |
| 11525 | } |
| 11526 | g_variant_unref (signal_variant); |
| 11527 | g_list_free_full (connections, g_object_unref); |
| 11528 | } |
| 11529 | else |
| 11530 | { |
| 11531 | g_variant_builder_clear (&builder); |
| 11532 | g_variant_builder_clear (&invalidated_builder); |
| 11533 | } |
| 11534 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 11535 | skeleton->priv->changed_properties = NULL; |
| 11536 | skeleton->priv->changed_properties_idle_source = NULL; |
| 11537 | g_mutex_unlock (&skeleton->priv->lock); |
| 11538 | return FALSE; |
| 11539 | } |
| 11540 | |
| 11541 | static void |
| 11542 | _shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 11543 | { |
| 11544 | ChangedProperty *cp; |
| 11545 | GList *l; |
| 11546 | cp = NULL; |
| 11547 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 11548 | { |
| 11549 | ChangedProperty *i_cp = l->data; |
| 11550 | if (i_cp->info == info) |
| 11551 | { |
| 11552 | cp = i_cp; |
| 11553 | break; |
| 11554 | } |
| 11555 | } |
| 11556 | if (cp == NULL) |
| 11557 | { |
| 11558 | cp = g_new0 (ChangedProperty, 1); |
| 11559 | cp->prop_id = prop_id; |
| 11560 | cp->info = info; |
| 11561 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 11562 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 11563 | g_value_copy (orig_value, &cp->orig_value); |
| 11564 | } |
| 11565 | } |
| 11566 | |
| 11567 | static void |
| 11568 | shared_resource_skeleton_notify (GObject *object, |
| 11569 | GParamSpec *pspec G_GNUC_UNUSED) |
| 11570 | { |
| 11571 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11572 | g_mutex_lock (&skeleton->priv->lock); |
| 11573 | if (skeleton->priv->changed_properties != NULL && |
| 11574 | skeleton->priv->changed_properties_idle_source == NULL) |
| 11575 | { |
| 11576 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 11577 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 11578 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 11579 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 11580 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 11581 | } |
| 11582 | g_mutex_unlock (&skeleton->priv->lock); |
| 11583 | } |
| 11584 | |
| 11585 | static void |
| 11586 | shared_resource_skeleton_set_property (GObject *object, |
| 11587 | guint prop_id, |
| 11588 | const GValue *value, |
| 11589 | GParamSpec *pspec) |
| 11590 | { |
| 11591 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11592 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 11593 | g_mutex_lock (&skeleton->priv->lock); |
| 11594 | g_object_freeze_notify (object); |
| 11595 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 11596 | { |
| 11597 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 11598 | _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 11599 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 11600 | g_object_notify_by_pspec (object, pspec); |
| 11601 | } |
| 11602 | g_mutex_unlock (&skeleton->priv->lock); |
| 11603 | g_object_thaw_notify (object); |
| 11604 | } |
| 11605 | |
| 11606 | static void |
| 11607 | shared_resource_skeleton_init (SharedResourceSkeleton *skeleton) |
| 11608 | { |
| 11609 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 11610 | skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton); |
| 11611 | #else |
| 11612 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate); |
| 11613 | #endif |
| 11614 | |
| 11615 | g_mutex_init (&skeleton->priv->lock); |
| 11616 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 11617 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 11618 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
| 11619 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 11620 | } |
| 11621 | |
| 11622 | static gboolean |
| 11623 | shared_resource_skeleton_get_lock (SharedResource *object) |
| 11624 | { |
| 11625 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11626 | gboolean value; |
| 11627 | g_mutex_lock (&skeleton->priv->lock); |
| 11628 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 11629 | g_mutex_unlock (&skeleton->priv->lock); |
| 11630 | return value; |
| 11631 | } |
| 11632 | |
| 11633 | static const gchar * |
| 11634 | shared_resource_skeleton_get_name (SharedResource *object) |
| 11635 | { |
| 11636 | SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); |
| 11637 | const gchar *value; |
| 11638 | g_mutex_lock (&skeleton->priv->lock); |
| 11639 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 11640 | g_mutex_unlock (&skeleton->priv->lock); |
| 11641 | return value; |
| 11642 | } |
| 11643 | |
| 11644 | static void |
| 11645 | shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass) |
| 11646 | { |
| 11647 | GObjectClass *gobject_class; |
| 11648 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 11649 | |
| 11650 | gobject_class = G_OBJECT_CLASS (klass); |
| 11651 | gobject_class->finalize = shared_resource_skeleton_finalize; |
| 11652 | gobject_class->get_property = shared_resource_skeleton_get_property; |
| 11653 | gobject_class->set_property = shared_resource_skeleton_set_property; |
| 11654 | gobject_class->notify = shared_resource_skeleton_notify; |
| 11655 | |
| 11656 | |
| 11657 | shared_resource_override_properties (gobject_class, 1); |
| 11658 | |
| 11659 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 11660 | skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info; |
| 11661 | skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties; |
| 11662 | skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush; |
| 11663 | skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable; |
| 11664 | |
| 11665 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 11666 | g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate)); |
| 11667 | #endif |
| 11668 | } |
| 11669 | |
| 11670 | static void |
| 11671 | shared_resource_skeleton_iface_init (SharedResourceIface *iface) |
| 11672 | { |
| 11673 | iface->get_lock = shared_resource_skeleton_get_lock; |
| 11674 | iface->get_name = shared_resource_skeleton_get_name; |
| 11675 | } |
| 11676 | |
| 11677 | /** |
| 11678 | * shared_resource_skeleton_new: |
| 11679 | * |
| 11680 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. |
| 11681 | * |
| 11682 | * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object. |
| 11683 | */ |
| 11684 | SharedResource * |
| 11685 | shared_resource_skeleton_new (void) |
| 11686 | { |
| 11687 | return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL)); |
| 11688 | } |
| 11689 | |
| 11690 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11691 | * Code for interface org.openbmc.Control |
| 11692 | * ------------------------------------------------------------------------ |
| 11693 | */ |
| 11694 | |
| 11695 | /** |
| 11696 | * SECTION:Control |
| 11697 | * @title: Control |
| 11698 | * @short_description: Generated C code for the org.openbmc.Control D-Bus interface |
| 11699 | * |
| 11700 | * 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. |
| 11701 | */ |
| 11702 | |
| 11703 | /* ---- Introspection data for org.openbmc.Control ---- */ |
| 11704 | |
| 11705 | static const _ExtendedGDBusMethodInfo _control_method_info_init = |
| 11706 | { |
| 11707 | { |
| 11708 | -1, |
| 11709 | (gchar *) "init", |
| 11710 | NULL, |
| 11711 | NULL, |
| 11712 | NULL |
| 11713 | }, |
| 11714 | "handle-init", |
| 11715 | FALSE |
| 11716 | }; |
| 11717 | |
| 11718 | static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = |
| 11719 | { |
| 11720 | &_control_method_info_init, |
| 11721 | NULL |
| 11722 | }; |
| 11723 | |
| 11724 | static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name = |
| 11725 | { |
| 11726 | { |
| 11727 | -1, |
| 11728 | (gchar *) "bus_name", |
| 11729 | (gchar *) "s", |
| 11730 | NULL |
| 11731 | }, |
| 11732 | FALSE |
| 11733 | }; |
| 11734 | |
| 11735 | static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] = |
| 11736 | { |
| 11737 | &_control_signal_info_heartbeat_ARG_bus_name, |
| 11738 | NULL |
| 11739 | }; |
| 11740 | |
| 11741 | static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat = |
| 11742 | { |
| 11743 | { |
| 11744 | -1, |
| 11745 | (gchar *) "Heartbeat", |
| 11746 | (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers, |
| 11747 | NULL |
| 11748 | }, |
| 11749 | "heartbeat" |
| 11750 | }; |
| 11751 | |
| 11752 | static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name = |
| 11753 | { |
| 11754 | { |
| 11755 | -1, |
| 11756 | (gchar *) "state_name", |
| 11757 | (gchar *) "s", |
| 11758 | NULL |
| 11759 | }, |
| 11760 | FALSE |
| 11761 | }; |
| 11762 | |
| 11763 | static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] = |
| 11764 | { |
| 11765 | &_control_signal_info_goto_system_state_ARG_state_name, |
| 11766 | NULL |
| 11767 | }; |
| 11768 | |
| 11769 | static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state = |
| 11770 | { |
| 11771 | { |
| 11772 | -1, |
| 11773 | (gchar *) "GotoSystemState", |
| 11774 | (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers, |
| 11775 | NULL |
| 11776 | }, |
| 11777 | "goto-system-state" |
| 11778 | }; |
| 11779 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11780 | static const _ExtendedGDBusSignalInfo _control_signal_info_started = |
| 11781 | { |
| 11782 | { |
| 11783 | -1, |
| 11784 | (gchar *) "Started", |
| 11785 | NULL, |
| 11786 | NULL |
| 11787 | }, |
| 11788 | "started" |
| 11789 | }; |
| 11790 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11791 | static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] = |
| 11792 | { |
| 11793 | &_control_signal_info_heartbeat, |
| 11794 | &_control_signal_info_goto_system_state, |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11795 | &_control_signal_info_started, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11796 | NULL |
| 11797 | }; |
| 11798 | |
| 11799 | static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = |
| 11800 | { |
| 11801 | { |
| 11802 | -1, |
| 11803 | (gchar *) "poll_interval", |
| 11804 | (gchar *) "i", |
| 11805 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 11806 | NULL |
| 11807 | }, |
| 11808 | "poll-interval", |
| 11809 | FALSE |
| 11810 | }; |
| 11811 | |
| 11812 | static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat = |
| 11813 | { |
| 11814 | { |
| 11815 | -1, |
| 11816 | (gchar *) "heatbeat", |
| 11817 | (gchar *) "i", |
| 11818 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 11819 | NULL |
| 11820 | }, |
| 11821 | "heatbeat", |
| 11822 | FALSE |
| 11823 | }; |
| 11824 | |
| 11825 | static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] = |
| 11826 | { |
| 11827 | &_control_property_info_poll_interval, |
| 11828 | &_control_property_info_heatbeat, |
| 11829 | NULL |
| 11830 | }; |
| 11831 | |
| 11832 | static const _ExtendedGDBusInterfaceInfo _control_interface_info = |
| 11833 | { |
| 11834 | { |
| 11835 | -1, |
| 11836 | (gchar *) "org.openbmc.Control", |
| 11837 | (GDBusMethodInfo **) &_control_method_info_pointers, |
| 11838 | (GDBusSignalInfo **) &_control_signal_info_pointers, |
| 11839 | (GDBusPropertyInfo **) &_control_property_info_pointers, |
| 11840 | NULL |
| 11841 | }, |
| 11842 | "control", |
| 11843 | }; |
| 11844 | |
| 11845 | |
| 11846 | /** |
| 11847 | * control_interface_info: |
| 11848 | * |
| 11849 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface. |
| 11850 | * |
| 11851 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 11852 | */ |
| 11853 | GDBusInterfaceInfo * |
| 11854 | control_interface_info (void) |
| 11855 | { |
| 11856 | return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct; |
| 11857 | } |
| 11858 | |
| 11859 | /** |
| 11860 | * control_override_properties: |
| 11861 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 11862 | * @property_id_begin: The property id to assign to the first overridden property. |
| 11863 | * |
| 11864 | * Overrides all #GObject properties in the #Control interface for a concrete class. |
| 11865 | * The properties are overridden in the order they are defined. |
| 11866 | * |
| 11867 | * Returns: The last property id. |
| 11868 | */ |
| 11869 | guint |
| 11870 | control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 11871 | { |
| 11872 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 11873 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
| 11874 | return property_id_begin - 1; |
| 11875 | } |
| 11876 | |
| 11877 | |
| 11878 | |
| 11879 | /** |
| 11880 | * Control: |
| 11881 | * |
| 11882 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11883 | */ |
| 11884 | |
| 11885 | /** |
| 11886 | * ControlIface: |
| 11887 | * @parent_iface: The parent interface. |
| 11888 | * @handle_init: Handler for the #Control::handle-init signal. |
| 11889 | * @get_heatbeat: Getter for the #Control:heatbeat property. |
| 11890 | * @get_poll_interval: Getter for the #Control:poll-interval property. |
| 11891 | * @goto_system_state: Handler for the #Control::goto-system-state signal. |
| 11892 | * @heartbeat: Handler for the #Control::heartbeat signal. |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11893 | * @started: Handler for the #Control::started signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11894 | * |
| 11895 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 11896 | */ |
| 11897 | |
| 11898 | typedef ControlIface ControlInterface; |
| 11899 | G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT); |
| 11900 | |
| 11901 | static void |
| 11902 | control_default_init (ControlIface *iface) |
| 11903 | { |
| 11904 | /* GObject signals for incoming D-Bus method calls: */ |
| 11905 | /** |
| 11906 | * Control::handle-init: |
| 11907 | * @object: A #Control. |
| 11908 | * @invocation: A #GDBusMethodInvocation. |
| 11909 | * |
| 11910 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. |
| 11911 | * |
| 11912 | * 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. |
| 11913 | * |
| 11914 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 11915 | */ |
| 11916 | g_signal_new ("handle-init", |
| 11917 | G_TYPE_FROM_INTERFACE (iface), |
| 11918 | G_SIGNAL_RUN_LAST, |
| 11919 | G_STRUCT_OFFSET (ControlIface, handle_init), |
| 11920 | g_signal_accumulator_true_handled, |
| 11921 | NULL, |
| 11922 | g_cclosure_marshal_generic, |
| 11923 | G_TYPE_BOOLEAN, |
| 11924 | 1, |
| 11925 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 11926 | |
| 11927 | /* GObject signals for received D-Bus signals: */ |
| 11928 | /** |
| 11929 | * Control::heartbeat: |
| 11930 | * @object: A #Control. |
| 11931 | * @arg_bus_name: Argument. |
| 11932 | * |
| 11933 | * 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. |
| 11934 | * |
| 11935 | * 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. |
| 11936 | */ |
| 11937 | g_signal_new ("heartbeat", |
| 11938 | G_TYPE_FROM_INTERFACE (iface), |
| 11939 | G_SIGNAL_RUN_LAST, |
| 11940 | G_STRUCT_OFFSET (ControlIface, heartbeat), |
| 11941 | NULL, |
| 11942 | NULL, |
| 11943 | g_cclosure_marshal_generic, |
| 11944 | G_TYPE_NONE, |
| 11945 | 1, G_TYPE_STRING); |
| 11946 | |
| 11947 | /** |
| 11948 | * Control::goto-system-state: |
| 11949 | * @object: A #Control. |
| 11950 | * @arg_state_name: Argument. |
| 11951 | * |
| 11952 | * 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. |
| 11953 | * |
| 11954 | * 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. |
| 11955 | */ |
| 11956 | g_signal_new ("goto-system-state", |
| 11957 | G_TYPE_FROM_INTERFACE (iface), |
| 11958 | G_SIGNAL_RUN_LAST, |
| 11959 | G_STRUCT_OFFSET (ControlIface, goto_system_state), |
| 11960 | NULL, |
| 11961 | NULL, |
| 11962 | g_cclosure_marshal_generic, |
| 11963 | G_TYPE_NONE, |
| 11964 | 1, G_TYPE_STRING); |
| 11965 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 11966 | /** |
| 11967 | * Control::started: |
| 11968 | * @object: A #Control. |
| 11969 | * |
| 11970 | * 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. |
| 11971 | * |
| 11972 | * 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. |
| 11973 | */ |
| 11974 | g_signal_new ("started", |
| 11975 | G_TYPE_FROM_INTERFACE (iface), |
| 11976 | G_SIGNAL_RUN_LAST, |
| 11977 | G_STRUCT_OFFSET (ControlIface, started), |
| 11978 | NULL, |
| 11979 | NULL, |
| 11980 | g_cclosure_marshal_generic, |
| 11981 | G_TYPE_NONE, |
| 11982 | 0); |
| 11983 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 11984 | /* GObject properties for D-Bus properties: */ |
| 11985 | /** |
| 11986 | * Control:poll-interval: |
| 11987 | * |
| 11988 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. |
| 11989 | * |
| 11990 | * 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. |
| 11991 | */ |
| 11992 | g_object_interface_install_property (iface, |
| 11993 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 11994 | /** |
| 11995 | * Control:heatbeat: |
| 11996 | * |
| 11997 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>. |
| 11998 | * |
| 11999 | * 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. |
| 12000 | */ |
| 12001 | g_object_interface_install_property (iface, |
| 12002 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 12003 | } |
| 12004 | |
| 12005 | /** |
| 12006 | * control_get_poll_interval: (skip) |
| 12007 | * @object: A #Control. |
| 12008 | * |
| 12009 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. |
| 12010 | * |
| 12011 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 12012 | * |
| 12013 | * Returns: The property value. |
| 12014 | */ |
| 12015 | gint |
| 12016 | control_get_poll_interval (Control *object) |
| 12017 | { |
| 12018 | return CONTROL_GET_IFACE (object)->get_poll_interval (object); |
| 12019 | } |
| 12020 | |
| 12021 | /** |
| 12022 | * control_set_poll_interval: (skip) |
| 12023 | * @object: A #Control. |
| 12024 | * @value: The value to set. |
| 12025 | * |
| 12026 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 12027 | * |
| 12028 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 12029 | */ |
| 12030 | void |
| 12031 | control_set_poll_interval (Control *object, gint value) |
| 12032 | { |
| 12033 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 12034 | } |
| 12035 | |
| 12036 | /** |
| 12037 | * control_get_heatbeat: (skip) |
| 12038 | * @object: A #Control. |
| 12039 | * |
| 12040 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property. |
| 12041 | * |
| 12042 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 12043 | * |
| 12044 | * Returns: The property value. |
| 12045 | */ |
| 12046 | gint |
| 12047 | control_get_heatbeat (Control *object) |
| 12048 | { |
| 12049 | return CONTROL_GET_IFACE (object)->get_heatbeat (object); |
| 12050 | } |
| 12051 | |
| 12052 | /** |
| 12053 | * control_set_heatbeat: (skip) |
| 12054 | * @object: A #Control. |
| 12055 | * @value: The value to set. |
| 12056 | * |
| 12057 | * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value. |
| 12058 | * |
| 12059 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 12060 | */ |
| 12061 | void |
| 12062 | control_set_heatbeat (Control *object, gint value) |
| 12063 | { |
| 12064 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
| 12065 | } |
| 12066 | |
| 12067 | /** |
| 12068 | * control_emit_heartbeat: |
| 12069 | * @object: A #Control. |
| 12070 | * @arg_bus_name: Argument to pass with the signal. |
| 12071 | * |
| 12072 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal. |
| 12073 | */ |
| 12074 | void |
| 12075 | control_emit_heartbeat ( |
| 12076 | Control *object, |
| 12077 | const gchar *arg_bus_name) |
| 12078 | { |
| 12079 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
| 12080 | } |
| 12081 | |
| 12082 | /** |
| 12083 | * control_emit_goto_system_state: |
| 12084 | * @object: A #Control. |
| 12085 | * @arg_state_name: Argument to pass with the signal. |
| 12086 | * |
| 12087 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal. |
| 12088 | */ |
| 12089 | void |
| 12090 | control_emit_goto_system_state ( |
| 12091 | Control *object, |
| 12092 | const gchar *arg_state_name) |
| 12093 | { |
| 12094 | g_signal_emit_by_name (object, "goto-system-state", arg_state_name); |
| 12095 | } |
| 12096 | |
| 12097 | /** |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 12098 | * control_emit_started: |
| 12099 | * @object: A #Control. |
| 12100 | * |
| 12101 | * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal. |
| 12102 | */ |
| 12103 | void |
| 12104 | control_emit_started ( |
| 12105 | Control *object) |
| 12106 | { |
| 12107 | g_signal_emit_by_name (object, "started"); |
| 12108 | } |
| 12109 | |
| 12110 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 12111 | * control_call_init: |
| 12112 | * @proxy: A #ControlProxy. |
| 12113 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12114 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 12115 | * @user_data: User data to pass to @callback. |
| 12116 | * |
| 12117 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. |
| 12118 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 12119 | * You can then call control_call_init_finish() to get the result of the operation. |
| 12120 | * |
| 12121 | * See control_call_init_sync() for the synchronous, blocking version of this method. |
| 12122 | */ |
| 12123 | void |
| 12124 | control_call_init ( |
| 12125 | Control *proxy, |
| 12126 | GCancellable *cancellable, |
| 12127 | GAsyncReadyCallback callback, |
| 12128 | gpointer user_data) |
| 12129 | { |
| 12130 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 12131 | "init", |
| 12132 | g_variant_new ("()"), |
| 12133 | G_DBUS_CALL_FLAGS_NONE, |
| 12134 | -1, |
| 12135 | cancellable, |
| 12136 | callback, |
| 12137 | user_data); |
| 12138 | } |
| 12139 | |
| 12140 | /** |
| 12141 | * control_call_init_finish: |
| 12142 | * @proxy: A #ControlProxy. |
| 12143 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). |
| 12144 | * @error: Return location for error or %NULL. |
| 12145 | * |
| 12146 | * Finishes an operation started with control_call_init(). |
| 12147 | * |
| 12148 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12149 | */ |
| 12150 | gboolean |
| 12151 | control_call_init_finish ( |
| 12152 | Control *proxy, |
| 12153 | GAsyncResult *res, |
| 12154 | GError **error) |
| 12155 | { |
| 12156 | GVariant *_ret; |
| 12157 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 12158 | if (_ret == NULL) |
| 12159 | goto _out; |
| 12160 | g_variant_get (_ret, |
| 12161 | "()"); |
| 12162 | g_variant_unref (_ret); |
| 12163 | _out: |
| 12164 | return _ret != NULL; |
| 12165 | } |
| 12166 | |
| 12167 | /** |
| 12168 | * control_call_init_sync: |
| 12169 | * @proxy: A #ControlProxy. |
| 12170 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12171 | * @error: Return location for error or %NULL. |
| 12172 | * |
| 12173 | * 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. |
| 12174 | * |
| 12175 | * See control_call_init() for the asynchronous version of this method. |
| 12176 | * |
| 12177 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 12178 | */ |
| 12179 | gboolean |
| 12180 | control_call_init_sync ( |
| 12181 | Control *proxy, |
| 12182 | GCancellable *cancellable, |
| 12183 | GError **error) |
| 12184 | { |
| 12185 | GVariant *_ret; |
| 12186 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 12187 | "init", |
| 12188 | g_variant_new ("()"), |
| 12189 | G_DBUS_CALL_FLAGS_NONE, |
| 12190 | -1, |
| 12191 | cancellable, |
| 12192 | error); |
| 12193 | if (_ret == NULL) |
| 12194 | goto _out; |
| 12195 | g_variant_get (_ret, |
| 12196 | "()"); |
| 12197 | g_variant_unref (_ret); |
| 12198 | _out: |
| 12199 | return _ret != NULL; |
| 12200 | } |
| 12201 | |
| 12202 | /** |
| 12203 | * control_complete_init: |
| 12204 | * @object: A #Control. |
| 12205 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 12206 | * |
| 12207 | * 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. |
| 12208 | * |
| 12209 | * This method will free @invocation, you cannot use it afterwards. |
| 12210 | */ |
| 12211 | void |
| 12212 | control_complete_init ( |
| 12213 | Control *object, |
| 12214 | GDBusMethodInvocation *invocation) |
| 12215 | { |
| 12216 | g_dbus_method_invocation_return_value (invocation, |
| 12217 | g_variant_new ("()")); |
| 12218 | } |
| 12219 | |
| 12220 | /* ------------------------------------------------------------------------ */ |
| 12221 | |
| 12222 | /** |
| 12223 | * ControlProxy: |
| 12224 | * |
| 12225 | * The #ControlProxy structure contains only private data and should only be accessed using the provided API. |
| 12226 | */ |
| 12227 | |
| 12228 | /** |
| 12229 | * ControlProxyClass: |
| 12230 | * @parent_class: The parent class. |
| 12231 | * |
| 12232 | * Class structure for #ControlProxy. |
| 12233 | */ |
| 12234 | |
| 12235 | struct _ControlProxyPrivate |
| 12236 | { |
| 12237 | GData *qdata; |
| 12238 | }; |
| 12239 | |
| 12240 | static void control_proxy_iface_init (ControlIface *iface); |
| 12241 | |
| 12242 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12243 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 12244 | G_ADD_PRIVATE (ControlProxy) |
| 12245 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 12246 | |
| 12247 | #else |
| 12248 | G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, |
| 12249 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); |
| 12250 | |
| 12251 | #endif |
| 12252 | static void |
| 12253 | control_proxy_finalize (GObject *object) |
| 12254 | { |
| 12255 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 12256 | g_datalist_clear (&proxy->priv->qdata); |
| 12257 | G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object); |
| 12258 | } |
| 12259 | |
| 12260 | static void |
| 12261 | control_proxy_get_property (GObject *object, |
| 12262 | guint prop_id, |
| 12263 | GValue *value, |
| 12264 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12265 | { |
| 12266 | const _ExtendedGDBusPropertyInfo *info; |
| 12267 | GVariant *variant; |
| 12268 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12269 | info = _control_property_info_pointers[prop_id - 1]; |
| 12270 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 12271 | if (info->use_gvariant) |
| 12272 | { |
| 12273 | g_value_set_variant (value, variant); |
| 12274 | } |
| 12275 | else |
| 12276 | { |
| 12277 | if (variant != NULL) |
| 12278 | g_dbus_gvariant_to_gvalue (variant, value); |
| 12279 | } |
| 12280 | if (variant != NULL) |
| 12281 | g_variant_unref (variant); |
| 12282 | } |
| 12283 | |
| 12284 | static void |
| 12285 | control_proxy_set_property_cb (GDBusProxy *proxy, |
| 12286 | GAsyncResult *res, |
| 12287 | gpointer user_data) |
| 12288 | { |
| 12289 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 12290 | GError *error; |
| 12291 | GVariant *_ret; |
| 12292 | error = NULL; |
| 12293 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 12294 | if (!_ret) |
| 12295 | { |
| 12296 | g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)", |
| 12297 | info->parent_struct.name, |
| 12298 | error->message, g_quark_to_string (error->domain), error->code); |
| 12299 | g_error_free (error); |
| 12300 | } |
| 12301 | else |
| 12302 | { |
| 12303 | g_variant_unref (_ret); |
| 12304 | } |
| 12305 | } |
| 12306 | |
| 12307 | static void |
| 12308 | control_proxy_set_property (GObject *object, |
| 12309 | guint prop_id, |
| 12310 | const GValue *value, |
| 12311 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12312 | { |
| 12313 | const _ExtendedGDBusPropertyInfo *info; |
| 12314 | GVariant *variant; |
| 12315 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12316 | info = _control_property_info_pointers[prop_id - 1]; |
| 12317 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 12318 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 12319 | "org.freedesktop.DBus.Properties.Set", |
| 12320 | g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant), |
| 12321 | G_DBUS_CALL_FLAGS_NONE, |
| 12322 | -1, |
| 12323 | NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 12324 | g_variant_unref (variant); |
| 12325 | } |
| 12326 | |
| 12327 | static void |
| 12328 | control_proxy_g_signal (GDBusProxy *proxy, |
| 12329 | const gchar *sender_name G_GNUC_UNUSED, |
| 12330 | const gchar *signal_name, |
| 12331 | GVariant *parameters) |
| 12332 | { |
| 12333 | _ExtendedGDBusSignalInfo *info; |
| 12334 | GVariantIter iter; |
| 12335 | GVariant *child; |
| 12336 | GValue *paramv; |
| 12337 | guint num_params; |
| 12338 | guint n; |
| 12339 | guint signal_id; |
| 12340 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name); |
| 12341 | if (info == NULL) |
| 12342 | return; |
| 12343 | num_params = g_variant_n_children (parameters); |
| 12344 | paramv = g_new0 (GValue, num_params + 1); |
| 12345 | g_value_init (¶mv[0], TYPE_CONTROL); |
| 12346 | g_value_set_object (¶mv[0], proxy); |
| 12347 | g_variant_iter_init (&iter, parameters); |
| 12348 | n = 1; |
| 12349 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12350 | { |
| 12351 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 12352 | if (arg_info->use_gvariant) |
| 12353 | { |
| 12354 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12355 | g_value_set_variant (¶mv[n], child); |
| 12356 | n++; |
| 12357 | } |
| 12358 | else |
| 12359 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12360 | g_variant_unref (child); |
| 12361 | } |
| 12362 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 12363 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 12364 | for (n = 0; n < num_params + 1; n++) |
| 12365 | g_value_unset (¶mv[n]); |
| 12366 | g_free (paramv); |
| 12367 | } |
| 12368 | |
| 12369 | static void |
| 12370 | control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 12371 | GVariant *changed_properties, |
| 12372 | const gchar *const *invalidated_properties) |
| 12373 | { |
| 12374 | ControlProxy *proxy = CONTROL_PROXY (_proxy); |
| 12375 | guint n; |
| 12376 | const gchar *key; |
| 12377 | GVariantIter *iter; |
| 12378 | _ExtendedGDBusPropertyInfo *info; |
| 12379 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 12380 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 12381 | { |
| 12382 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key); |
| 12383 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 12384 | if (info != NULL) |
| 12385 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12386 | } |
| 12387 | g_variant_iter_free (iter); |
| 12388 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 12389 | { |
| 12390 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]); |
| 12391 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 12392 | if (info != NULL) |
| 12393 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 12394 | } |
| 12395 | } |
| 12396 | |
| 12397 | static gint |
| 12398 | control_proxy_get_poll_interval (Control *object) |
| 12399 | { |
| 12400 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 12401 | GVariant *variant; |
| 12402 | gint value = 0; |
| 12403 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 12404 | if (variant != NULL) |
| 12405 | { |
| 12406 | value = g_variant_get_int32 (variant); |
| 12407 | g_variant_unref (variant); |
| 12408 | } |
| 12409 | return value; |
| 12410 | } |
| 12411 | |
| 12412 | static gint |
| 12413 | control_proxy_get_heatbeat (Control *object) |
| 12414 | { |
| 12415 | ControlProxy *proxy = CONTROL_PROXY (object); |
| 12416 | GVariant *variant; |
| 12417 | gint value = 0; |
| 12418 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
| 12419 | if (variant != NULL) |
| 12420 | { |
| 12421 | value = g_variant_get_int32 (variant); |
| 12422 | g_variant_unref (variant); |
| 12423 | } |
| 12424 | return value; |
| 12425 | } |
| 12426 | |
| 12427 | static void |
| 12428 | control_proxy_init (ControlProxy *proxy) |
| 12429 | { |
| 12430 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12431 | proxy->priv = control_proxy_get_instance_private (proxy); |
| 12432 | #else |
| 12433 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate); |
| 12434 | #endif |
| 12435 | |
| 12436 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ()); |
| 12437 | } |
| 12438 | |
| 12439 | static void |
| 12440 | control_proxy_class_init (ControlProxyClass *klass) |
| 12441 | { |
| 12442 | GObjectClass *gobject_class; |
| 12443 | GDBusProxyClass *proxy_class; |
| 12444 | |
| 12445 | gobject_class = G_OBJECT_CLASS (klass); |
| 12446 | gobject_class->finalize = control_proxy_finalize; |
| 12447 | gobject_class->get_property = control_proxy_get_property; |
| 12448 | gobject_class->set_property = control_proxy_set_property; |
| 12449 | |
| 12450 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 12451 | proxy_class->g_signal = control_proxy_g_signal; |
| 12452 | proxy_class->g_properties_changed = control_proxy_g_properties_changed; |
| 12453 | |
| 12454 | control_override_properties (gobject_class, 1); |
| 12455 | |
| 12456 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 12457 | g_type_class_add_private (klass, sizeof (ControlProxyPrivate)); |
| 12458 | #endif |
| 12459 | } |
| 12460 | |
| 12461 | static void |
| 12462 | control_proxy_iface_init (ControlIface *iface) |
| 12463 | { |
| 12464 | iface->get_poll_interval = control_proxy_get_poll_interval; |
| 12465 | iface->get_heatbeat = control_proxy_get_heatbeat; |
| 12466 | } |
| 12467 | |
| 12468 | /** |
| 12469 | * control_proxy_new: |
| 12470 | * @connection: A #GDBusConnection. |
| 12471 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12472 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12473 | * @object_path: An object path. |
| 12474 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12475 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12476 | * @user_data: User data to pass to @callback. |
| 12477 | * |
| 12478 | * 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. |
| 12479 | * |
| 12480 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 12481 | * You can then call control_proxy_new_finish() to get the result of the operation. |
| 12482 | * |
| 12483 | * See control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 12484 | */ |
| 12485 | void |
| 12486 | control_proxy_new ( |
| 12487 | GDBusConnection *connection, |
| 12488 | GDBusProxyFlags flags, |
| 12489 | const gchar *name, |
| 12490 | const gchar *object_path, |
| 12491 | GCancellable *cancellable, |
| 12492 | GAsyncReadyCallback callback, |
| 12493 | gpointer user_data) |
| 12494 | { |
| 12495 | 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); |
| 12496 | } |
| 12497 | |
| 12498 | /** |
| 12499 | * control_proxy_new_finish: |
| 12500 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new(). |
| 12501 | * @error: Return location for error or %NULL |
| 12502 | * |
| 12503 | * Finishes an operation started with control_proxy_new(). |
| 12504 | * |
| 12505 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 12506 | */ |
| 12507 | Control * |
| 12508 | control_proxy_new_finish ( |
| 12509 | GAsyncResult *res, |
| 12510 | GError **error) |
| 12511 | { |
| 12512 | GObject *ret; |
| 12513 | GObject *source_object; |
| 12514 | source_object = g_async_result_get_source_object (res); |
| 12515 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12516 | g_object_unref (source_object); |
| 12517 | if (ret != NULL) |
| 12518 | return CONTROL (ret); |
| 12519 | else |
| 12520 | return NULL; |
| 12521 | } |
| 12522 | |
| 12523 | /** |
| 12524 | * control_proxy_new_sync: |
| 12525 | * @connection: A #GDBusConnection. |
| 12526 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12527 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 12528 | * @object_path: An object path. |
| 12529 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12530 | * @error: Return location for error or %NULL |
| 12531 | * |
| 12532 | * 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. |
| 12533 | * |
| 12534 | * The calling thread is blocked until a reply is received. |
| 12535 | * |
| 12536 | * See control_proxy_new() for the asynchronous version of this constructor. |
| 12537 | * |
| 12538 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 12539 | */ |
| 12540 | Control * |
| 12541 | control_proxy_new_sync ( |
| 12542 | GDBusConnection *connection, |
| 12543 | GDBusProxyFlags flags, |
| 12544 | const gchar *name, |
| 12545 | const gchar *object_path, |
| 12546 | GCancellable *cancellable, |
| 12547 | GError **error) |
| 12548 | { |
| 12549 | GInitable *ret; |
| 12550 | 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); |
| 12551 | if (ret != NULL) |
| 12552 | return CONTROL (ret); |
| 12553 | else |
| 12554 | return NULL; |
| 12555 | } |
| 12556 | |
| 12557 | |
| 12558 | /** |
| 12559 | * control_proxy_new_for_bus: |
| 12560 | * @bus_type: A #GBusType. |
| 12561 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12562 | * @name: A bus name (well-known or unique). |
| 12563 | * @object_path: An object path. |
| 12564 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12565 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 12566 | * @user_data: User data to pass to @callback. |
| 12567 | * |
| 12568 | * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 12569 | * |
| 12570 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 12571 | * You can then call control_proxy_new_for_bus_finish() to get the result of the operation. |
| 12572 | * |
| 12573 | * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 12574 | */ |
| 12575 | void |
| 12576 | control_proxy_new_for_bus ( |
| 12577 | GBusType bus_type, |
| 12578 | GDBusProxyFlags flags, |
| 12579 | const gchar *name, |
| 12580 | const gchar *object_path, |
| 12581 | GCancellable *cancellable, |
| 12582 | GAsyncReadyCallback callback, |
| 12583 | gpointer user_data) |
| 12584 | { |
| 12585 | 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); |
| 12586 | } |
| 12587 | |
| 12588 | /** |
| 12589 | * control_proxy_new_for_bus_finish: |
| 12590 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus(). |
| 12591 | * @error: Return location for error or %NULL |
| 12592 | * |
| 12593 | * Finishes an operation started with control_proxy_new_for_bus(). |
| 12594 | * |
| 12595 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 12596 | */ |
| 12597 | Control * |
| 12598 | control_proxy_new_for_bus_finish ( |
| 12599 | GAsyncResult *res, |
| 12600 | GError **error) |
| 12601 | { |
| 12602 | GObject *ret; |
| 12603 | GObject *source_object; |
| 12604 | source_object = g_async_result_get_source_object (res); |
| 12605 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 12606 | g_object_unref (source_object); |
| 12607 | if (ret != NULL) |
| 12608 | return CONTROL (ret); |
| 12609 | else |
| 12610 | return NULL; |
| 12611 | } |
| 12612 | |
| 12613 | /** |
| 12614 | * control_proxy_new_for_bus_sync: |
| 12615 | * @bus_type: A #GBusType. |
| 12616 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 12617 | * @name: A bus name (well-known or unique). |
| 12618 | * @object_path: An object path. |
| 12619 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 12620 | * @error: Return location for error or %NULL |
| 12621 | * |
| 12622 | * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 12623 | * |
| 12624 | * The calling thread is blocked until a reply is received. |
| 12625 | * |
| 12626 | * See control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 12627 | * |
| 12628 | * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. |
| 12629 | */ |
| 12630 | Control * |
| 12631 | control_proxy_new_for_bus_sync ( |
| 12632 | GBusType bus_type, |
| 12633 | GDBusProxyFlags flags, |
| 12634 | const gchar *name, |
| 12635 | const gchar *object_path, |
| 12636 | GCancellable *cancellable, |
| 12637 | GError **error) |
| 12638 | { |
| 12639 | GInitable *ret; |
| 12640 | 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); |
| 12641 | if (ret != NULL) |
| 12642 | return CONTROL (ret); |
| 12643 | else |
| 12644 | return NULL; |
| 12645 | } |
| 12646 | |
| 12647 | |
| 12648 | /* ------------------------------------------------------------------------ */ |
| 12649 | |
| 12650 | /** |
| 12651 | * ControlSkeleton: |
| 12652 | * |
| 12653 | * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 12654 | */ |
| 12655 | |
| 12656 | /** |
| 12657 | * ControlSkeletonClass: |
| 12658 | * @parent_class: The parent class. |
| 12659 | * |
| 12660 | * Class structure for #ControlSkeleton. |
| 12661 | */ |
| 12662 | |
| 12663 | struct _ControlSkeletonPrivate |
| 12664 | { |
| 12665 | GValue *properties; |
| 12666 | GList *changed_properties; |
| 12667 | GSource *changed_properties_idle_source; |
| 12668 | GMainContext *context; |
| 12669 | GMutex lock; |
| 12670 | }; |
| 12671 | |
| 12672 | static void |
| 12673 | _control_skeleton_handle_method_call ( |
| 12674 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12675 | const gchar *sender G_GNUC_UNUSED, |
| 12676 | const gchar *object_path G_GNUC_UNUSED, |
| 12677 | const gchar *interface_name, |
| 12678 | const gchar *method_name, |
| 12679 | GVariant *parameters, |
| 12680 | GDBusMethodInvocation *invocation, |
| 12681 | gpointer user_data) |
| 12682 | { |
| 12683 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12684 | _ExtendedGDBusMethodInfo *info; |
| 12685 | GVariantIter iter; |
| 12686 | GVariant *child; |
| 12687 | GValue *paramv; |
| 12688 | guint num_params; |
| 12689 | guint num_extra; |
| 12690 | guint n; |
| 12691 | guint signal_id; |
| 12692 | GValue return_value = G_VALUE_INIT; |
| 12693 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 12694 | g_assert (info != NULL); |
| 12695 | num_params = g_variant_n_children (parameters); |
| 12696 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 12697 | n = 0; |
| 12698 | g_value_init (¶mv[n], TYPE_CONTROL); |
| 12699 | g_value_set_object (¶mv[n++], skeleton); |
| 12700 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 12701 | g_value_set_object (¶mv[n++], invocation); |
| 12702 | if (info->pass_fdlist) |
| 12703 | { |
| 12704 | #ifdef G_OS_UNIX |
| 12705 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 12706 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 12707 | #else |
| 12708 | g_assert_not_reached (); |
| 12709 | #endif |
| 12710 | } |
| 12711 | g_variant_iter_init (&iter, parameters); |
| 12712 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 12713 | { |
| 12714 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 12715 | if (arg_info->use_gvariant) |
| 12716 | { |
| 12717 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 12718 | g_value_set_variant (¶mv[n], child); |
| 12719 | n++; |
| 12720 | } |
| 12721 | else |
| 12722 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 12723 | g_variant_unref (child); |
| 12724 | } |
| 12725 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); |
| 12726 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 12727 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 12728 | if (!g_value_get_boolean (&return_value)) |
| 12729 | 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); |
| 12730 | g_value_unset (&return_value); |
| 12731 | for (n = 0; n < num_params + num_extra; n++) |
| 12732 | g_value_unset (¶mv[n]); |
| 12733 | g_free (paramv); |
| 12734 | } |
| 12735 | |
| 12736 | static GVariant * |
| 12737 | _control_skeleton_handle_get_property ( |
| 12738 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12739 | const gchar *sender G_GNUC_UNUSED, |
| 12740 | const gchar *object_path G_GNUC_UNUSED, |
| 12741 | const gchar *interface_name G_GNUC_UNUSED, |
| 12742 | const gchar *property_name, |
| 12743 | GError **error, |
| 12744 | gpointer user_data) |
| 12745 | { |
| 12746 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12747 | GValue value = G_VALUE_INIT; |
| 12748 | GParamSpec *pspec; |
| 12749 | _ExtendedGDBusPropertyInfo *info; |
| 12750 | GVariant *ret; |
| 12751 | ret = NULL; |
| 12752 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 12753 | g_assert (info != NULL); |
| 12754 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12755 | if (pspec == NULL) |
| 12756 | { |
| 12757 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12758 | } |
| 12759 | else |
| 12760 | { |
| 12761 | g_value_init (&value, pspec->value_type); |
| 12762 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12763 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 12764 | g_value_unset (&value); |
| 12765 | } |
| 12766 | return ret; |
| 12767 | } |
| 12768 | |
| 12769 | static gboolean |
| 12770 | _control_skeleton_handle_set_property ( |
| 12771 | GDBusConnection *connection G_GNUC_UNUSED, |
| 12772 | const gchar *sender G_GNUC_UNUSED, |
| 12773 | const gchar *object_path G_GNUC_UNUSED, |
| 12774 | const gchar *interface_name G_GNUC_UNUSED, |
| 12775 | const gchar *property_name, |
| 12776 | GVariant *variant, |
| 12777 | GError **error, |
| 12778 | gpointer user_data) |
| 12779 | { |
| 12780 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12781 | GValue value = G_VALUE_INIT; |
| 12782 | GParamSpec *pspec; |
| 12783 | _ExtendedGDBusPropertyInfo *info; |
| 12784 | gboolean ret; |
| 12785 | ret = FALSE; |
| 12786 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); |
| 12787 | g_assert (info != NULL); |
| 12788 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 12789 | if (pspec == NULL) |
| 12790 | { |
| 12791 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 12792 | } |
| 12793 | else |
| 12794 | { |
| 12795 | if (info->use_gvariant) |
| 12796 | g_value_set_variant (&value, variant); |
| 12797 | else |
| 12798 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 12799 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 12800 | g_value_unset (&value); |
| 12801 | ret = TRUE; |
| 12802 | } |
| 12803 | return ret; |
| 12804 | } |
| 12805 | |
| 12806 | static const GDBusInterfaceVTable _control_skeleton_vtable = |
| 12807 | { |
| 12808 | _control_skeleton_handle_method_call, |
| 12809 | _control_skeleton_handle_get_property, |
| 12810 | _control_skeleton_handle_set_property, |
| 12811 | {NULL} |
| 12812 | }; |
| 12813 | |
| 12814 | static GDBusInterfaceInfo * |
| 12815 | control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 12816 | { |
| 12817 | return control_interface_info (); |
| 12818 | } |
| 12819 | |
| 12820 | static GDBusInterfaceVTable * |
| 12821 | control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 12822 | { |
| 12823 | return (GDBusInterfaceVTable *) &_control_skeleton_vtable; |
| 12824 | } |
| 12825 | |
| 12826 | static GVariant * |
| 12827 | control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 12828 | { |
| 12829 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 12830 | |
| 12831 | GVariantBuilder builder; |
| 12832 | guint n; |
| 12833 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12834 | if (_control_interface_info.parent_struct.properties == NULL) |
| 12835 | goto out; |
| 12836 | for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 12837 | { |
| 12838 | GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n]; |
| 12839 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 12840 | { |
| 12841 | GVariant *value; |
| 12842 | 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); |
| 12843 | if (value != NULL) |
| 12844 | { |
| 12845 | g_variant_take_ref (value); |
| 12846 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 12847 | g_variant_unref (value); |
| 12848 | } |
| 12849 | } |
| 12850 | } |
| 12851 | out: |
| 12852 | return g_variant_builder_end (&builder); |
| 12853 | } |
| 12854 | |
| 12855 | static gboolean _control_emit_changed (gpointer user_data); |
| 12856 | |
| 12857 | static void |
| 12858 | control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 12859 | { |
| 12860 | ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); |
| 12861 | gboolean emit_changed = FALSE; |
| 12862 | |
| 12863 | g_mutex_lock (&skeleton->priv->lock); |
| 12864 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12865 | { |
| 12866 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12867 | skeleton->priv->changed_properties_idle_source = NULL; |
| 12868 | emit_changed = TRUE; |
| 12869 | } |
| 12870 | g_mutex_unlock (&skeleton->priv->lock); |
| 12871 | |
| 12872 | if (emit_changed) |
| 12873 | _control_emit_changed (skeleton); |
| 12874 | } |
| 12875 | |
| 12876 | static void |
| 12877 | _control_on_signal_heartbeat ( |
| 12878 | Control *object, |
| 12879 | const gchar *arg_bus_name) |
| 12880 | { |
| 12881 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12882 | |
| 12883 | GList *connections, *l; |
| 12884 | GVariant *signal_variant; |
| 12885 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12886 | |
| 12887 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 12888 | arg_bus_name)); |
| 12889 | for (l = connections; l != NULL; l = l->next) |
| 12890 | { |
| 12891 | GDBusConnection *connection = l->data; |
| 12892 | g_dbus_connection_emit_signal (connection, |
| 12893 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat", |
| 12894 | signal_variant, NULL); |
| 12895 | } |
| 12896 | g_variant_unref (signal_variant); |
| 12897 | g_list_free_full (connections, g_object_unref); |
| 12898 | } |
| 12899 | |
| 12900 | static void |
| 12901 | _control_on_signal_goto_system_state ( |
| 12902 | Control *object, |
| 12903 | const gchar *arg_state_name) |
| 12904 | { |
| 12905 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12906 | |
| 12907 | GList *connections, *l; |
| 12908 | GVariant *signal_variant; |
| 12909 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12910 | |
| 12911 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 12912 | arg_state_name)); |
| 12913 | for (l = connections; l != NULL; l = l->next) |
| 12914 | { |
| 12915 | GDBusConnection *connection = l->data; |
| 12916 | g_dbus_connection_emit_signal (connection, |
| 12917 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState", |
| 12918 | signal_variant, NULL); |
| 12919 | } |
| 12920 | g_variant_unref (signal_variant); |
| 12921 | g_list_free_full (connections, g_object_unref); |
| 12922 | } |
| 12923 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 12924 | static void |
| 12925 | _control_on_signal_started ( |
| 12926 | Control *object) |
| 12927 | { |
| 12928 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12929 | |
| 12930 | GList *connections, *l; |
| 12931 | GVariant *signal_variant; |
| 12932 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 12933 | |
| 12934 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 12935 | for (l = connections; l != NULL; l = l->next) |
| 12936 | { |
| 12937 | GDBusConnection *connection = l->data; |
| 12938 | g_dbus_connection_emit_signal (connection, |
| 12939 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started", |
| 12940 | signal_variant, NULL); |
| 12941 | } |
| 12942 | g_variant_unref (signal_variant); |
| 12943 | g_list_free_full (connections, g_object_unref); |
| 12944 | } |
| 12945 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 12946 | static void control_skeleton_iface_init (ControlIface *iface); |
| 12947 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 12948 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12949 | G_ADD_PRIVATE (ControlSkeleton) |
| 12950 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12951 | |
| 12952 | #else |
| 12953 | G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 12954 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); |
| 12955 | |
| 12956 | #endif |
| 12957 | static void |
| 12958 | control_skeleton_finalize (GObject *object) |
| 12959 | { |
| 12960 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12961 | guint n; |
| 12962 | for (n = 0; n < 2; n++) |
| 12963 | g_value_unset (&skeleton->priv->properties[n]); |
| 12964 | g_free (skeleton->priv->properties); |
| 12965 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 12966 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 12967 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 12968 | g_main_context_unref (skeleton->priv->context); |
| 12969 | g_mutex_clear (&skeleton->priv->lock); |
| 12970 | G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object); |
| 12971 | } |
| 12972 | |
| 12973 | static void |
| 12974 | control_skeleton_get_property (GObject *object, |
| 12975 | guint prop_id, |
| 12976 | GValue *value, |
| 12977 | GParamSpec *pspec G_GNUC_UNUSED) |
| 12978 | { |
| 12979 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 12980 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 12981 | g_mutex_lock (&skeleton->priv->lock); |
| 12982 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 12983 | g_mutex_unlock (&skeleton->priv->lock); |
| 12984 | } |
| 12985 | |
| 12986 | static gboolean |
| 12987 | _control_emit_changed (gpointer user_data) |
| 12988 | { |
| 12989 | ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); |
| 12990 | GList *l; |
| 12991 | GVariantBuilder builder; |
| 12992 | GVariantBuilder invalidated_builder; |
| 12993 | guint num_changes; |
| 12994 | |
| 12995 | g_mutex_lock (&skeleton->priv->lock); |
| 12996 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 12997 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 12998 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 12999 | { |
| 13000 | ChangedProperty *cp = l->data; |
| 13001 | GVariant *variant; |
| 13002 | const GValue *cur_value; |
| 13003 | |
| 13004 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 13005 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 13006 | { |
| 13007 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 13008 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 13009 | g_variant_unref (variant); |
| 13010 | num_changes++; |
| 13011 | } |
| 13012 | } |
| 13013 | if (num_changes > 0) |
| 13014 | { |
| 13015 | GList *connections, *ll; |
| 13016 | GVariant *signal_variant; |
| 13017 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control", |
| 13018 | &builder, &invalidated_builder)); |
| 13019 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 13020 | for (ll = connections; ll != NULL; ll = ll->next) |
| 13021 | { |
| 13022 | GDBusConnection *connection = ll->data; |
| 13023 | |
| 13024 | g_dbus_connection_emit_signal (connection, |
| 13025 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 13026 | "org.freedesktop.DBus.Properties", |
| 13027 | "PropertiesChanged", |
| 13028 | signal_variant, |
| 13029 | NULL); |
| 13030 | } |
| 13031 | g_variant_unref (signal_variant); |
| 13032 | g_list_free_full (connections, g_object_unref); |
| 13033 | } |
| 13034 | else |
| 13035 | { |
| 13036 | g_variant_builder_clear (&builder); |
| 13037 | g_variant_builder_clear (&invalidated_builder); |
| 13038 | } |
| 13039 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 13040 | skeleton->priv->changed_properties = NULL; |
| 13041 | skeleton->priv->changed_properties_idle_source = NULL; |
| 13042 | g_mutex_unlock (&skeleton->priv->lock); |
| 13043 | return FALSE; |
| 13044 | } |
| 13045 | |
| 13046 | static void |
| 13047 | _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 13048 | { |
| 13049 | ChangedProperty *cp; |
| 13050 | GList *l; |
| 13051 | cp = NULL; |
| 13052 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 13053 | { |
| 13054 | ChangedProperty *i_cp = l->data; |
| 13055 | if (i_cp->info == info) |
| 13056 | { |
| 13057 | cp = i_cp; |
| 13058 | break; |
| 13059 | } |
| 13060 | } |
| 13061 | if (cp == NULL) |
| 13062 | { |
| 13063 | cp = g_new0 (ChangedProperty, 1); |
| 13064 | cp->prop_id = prop_id; |
| 13065 | cp->info = info; |
| 13066 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 13067 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 13068 | g_value_copy (orig_value, &cp->orig_value); |
| 13069 | } |
| 13070 | } |
| 13071 | |
| 13072 | static void |
| 13073 | control_skeleton_notify (GObject *object, |
| 13074 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13075 | { |
| 13076 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 13077 | g_mutex_lock (&skeleton->priv->lock); |
| 13078 | if (skeleton->priv->changed_properties != NULL && |
| 13079 | skeleton->priv->changed_properties_idle_source == NULL) |
| 13080 | { |
| 13081 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 13082 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 13083 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 13084 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 13085 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 13086 | } |
| 13087 | g_mutex_unlock (&skeleton->priv->lock); |
| 13088 | } |
| 13089 | |
| 13090 | static void |
| 13091 | control_skeleton_set_property (GObject *object, |
| 13092 | guint prop_id, |
| 13093 | const GValue *value, |
| 13094 | GParamSpec *pspec) |
| 13095 | { |
| 13096 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 13097 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 13098 | g_mutex_lock (&skeleton->priv->lock); |
| 13099 | g_object_freeze_notify (object); |
| 13100 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 13101 | { |
| 13102 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 13103 | _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 13104 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 13105 | g_object_notify_by_pspec (object, pspec); |
| 13106 | } |
| 13107 | g_mutex_unlock (&skeleton->priv->lock); |
| 13108 | g_object_thaw_notify (object); |
| 13109 | } |
| 13110 | |
| 13111 | static void |
| 13112 | control_skeleton_init (ControlSkeleton *skeleton) |
| 13113 | { |
| 13114 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13115 | skeleton->priv = control_skeleton_get_instance_private (skeleton); |
| 13116 | #else |
| 13117 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate); |
| 13118 | #endif |
| 13119 | |
| 13120 | g_mutex_init (&skeleton->priv->lock); |
| 13121 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 13122 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 13123 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 13124 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 13125 | } |
| 13126 | |
| 13127 | static gint |
| 13128 | control_skeleton_get_poll_interval (Control *object) |
| 13129 | { |
| 13130 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 13131 | gint value; |
| 13132 | g_mutex_lock (&skeleton->priv->lock); |
| 13133 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 13134 | g_mutex_unlock (&skeleton->priv->lock); |
| 13135 | return value; |
| 13136 | } |
| 13137 | |
| 13138 | static gint |
| 13139 | control_skeleton_get_heatbeat (Control *object) |
| 13140 | { |
| 13141 | ControlSkeleton *skeleton = CONTROL_SKELETON (object); |
| 13142 | gint value; |
| 13143 | g_mutex_lock (&skeleton->priv->lock); |
| 13144 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 13145 | g_mutex_unlock (&skeleton->priv->lock); |
| 13146 | return value; |
| 13147 | } |
| 13148 | |
| 13149 | static void |
| 13150 | control_skeleton_class_init (ControlSkeletonClass *klass) |
| 13151 | { |
| 13152 | GObjectClass *gobject_class; |
| 13153 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 13154 | |
| 13155 | gobject_class = G_OBJECT_CLASS (klass); |
| 13156 | gobject_class->finalize = control_skeleton_finalize; |
| 13157 | gobject_class->get_property = control_skeleton_get_property; |
| 13158 | gobject_class->set_property = control_skeleton_set_property; |
| 13159 | gobject_class->notify = control_skeleton_notify; |
| 13160 | |
| 13161 | |
| 13162 | control_override_properties (gobject_class, 1); |
| 13163 | |
| 13164 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 13165 | skeleton_class->get_info = control_skeleton_dbus_interface_get_info; |
| 13166 | skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties; |
| 13167 | skeleton_class->flush = control_skeleton_dbus_interface_flush; |
| 13168 | skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable; |
| 13169 | |
| 13170 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13171 | g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate)); |
| 13172 | #endif |
| 13173 | } |
| 13174 | |
| 13175 | static void |
| 13176 | control_skeleton_iface_init (ControlIface *iface) |
| 13177 | { |
| 13178 | iface->heartbeat = _control_on_signal_heartbeat; |
| 13179 | iface->goto_system_state = _control_on_signal_goto_system_state; |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 13180 | iface->started = _control_on_signal_started; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 13181 | iface->get_poll_interval = control_skeleton_get_poll_interval; |
| 13182 | iface->get_heatbeat = control_skeleton_get_heatbeat; |
| 13183 | } |
| 13184 | |
| 13185 | /** |
| 13186 | * control_skeleton_new: |
| 13187 | * |
| 13188 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. |
| 13189 | * |
| 13190 | * Returns: (transfer full) (type ControlSkeleton): The skeleton object. |
| 13191 | */ |
| 13192 | Control * |
| 13193 | control_skeleton_new (void) |
| 13194 | { |
| 13195 | return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL)); |
| 13196 | } |
| 13197 | |
| 13198 | /* ------------------------------------------------------------------------ |
| 13199 | * Code for interface org.openbmc.control.Bmc |
| 13200 | * ------------------------------------------------------------------------ |
| 13201 | */ |
| 13202 | |
| 13203 | /** |
| 13204 | * SECTION:ControlBmc |
| 13205 | * @title: ControlBmc |
| 13206 | * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface |
| 13207 | * |
| 13208 | * 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. |
| 13209 | */ |
| 13210 | |
| 13211 | /* ---- Introspection data for org.openbmc.control.Bmc ---- */ |
| 13212 | |
| 13213 | static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder = |
| 13214 | { |
| 13215 | { |
| 13216 | -1, |
| 13217 | (gchar *) "place_holder", |
| 13218 | NULL, |
| 13219 | NULL, |
| 13220 | NULL |
| 13221 | }, |
| 13222 | "handle-place-holder", |
| 13223 | FALSE |
| 13224 | }; |
| 13225 | |
| 13226 | static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] = |
| 13227 | { |
| 13228 | &_control_bmc_method_info_place_holder, |
| 13229 | NULL |
| 13230 | }; |
| 13231 | |
| 13232 | static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info = |
| 13233 | { |
| 13234 | { |
| 13235 | -1, |
| 13236 | (gchar *) "org.openbmc.control.Bmc", |
| 13237 | (GDBusMethodInfo **) &_control_bmc_method_info_pointers, |
| 13238 | NULL, |
| 13239 | NULL, |
| 13240 | NULL |
| 13241 | }, |
| 13242 | "control-bmc", |
| 13243 | }; |
| 13244 | |
| 13245 | |
| 13246 | /** |
| 13247 | * control_bmc_interface_info: |
| 13248 | * |
| 13249 | * 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. |
| 13250 | * |
| 13251 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 13252 | */ |
| 13253 | GDBusInterfaceInfo * |
| 13254 | control_bmc_interface_info (void) |
| 13255 | { |
| 13256 | return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct; |
| 13257 | } |
| 13258 | |
| 13259 | /** |
| 13260 | * control_bmc_override_properties: |
| 13261 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 13262 | * @property_id_begin: The property id to assign to the first overridden property. |
| 13263 | * |
| 13264 | * Overrides all #GObject properties in the #ControlBmc interface for a concrete class. |
| 13265 | * The properties are overridden in the order they are defined. |
| 13266 | * |
| 13267 | * Returns: The last property id. |
| 13268 | */ |
| 13269 | guint |
| 13270 | control_bmc_override_properties (GObjectClass *klass, guint property_id_begin) |
| 13271 | { |
| 13272 | return property_id_begin - 1; |
| 13273 | } |
| 13274 | |
| 13275 | |
| 13276 | |
| 13277 | /** |
| 13278 | * ControlBmc: |
| 13279 | * |
| 13280 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 13281 | */ |
| 13282 | |
| 13283 | /** |
| 13284 | * ControlBmcIface: |
| 13285 | * @parent_iface: The parent interface. |
| 13286 | * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal. |
| 13287 | * |
| 13288 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. |
| 13289 | */ |
| 13290 | |
| 13291 | typedef ControlBmcIface ControlBmcInterface; |
| 13292 | G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT); |
| 13293 | |
| 13294 | static void |
| 13295 | control_bmc_default_init (ControlBmcIface *iface) |
| 13296 | { |
| 13297 | /* GObject signals for incoming D-Bus method calls: */ |
| 13298 | /** |
| 13299 | * ControlBmc::handle-place-holder: |
| 13300 | * @object: A #ControlBmc. |
| 13301 | * @invocation: A #GDBusMethodInvocation. |
| 13302 | * |
| 13303 | * 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. |
| 13304 | * |
| 13305 | * 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. |
| 13306 | * |
| 13307 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 13308 | */ |
| 13309 | g_signal_new ("handle-place-holder", |
| 13310 | G_TYPE_FROM_INTERFACE (iface), |
| 13311 | G_SIGNAL_RUN_LAST, |
| 13312 | G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder), |
| 13313 | g_signal_accumulator_true_handled, |
| 13314 | NULL, |
| 13315 | g_cclosure_marshal_generic, |
| 13316 | G_TYPE_BOOLEAN, |
| 13317 | 1, |
| 13318 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 13319 | |
| 13320 | } |
| 13321 | |
| 13322 | /** |
| 13323 | * control_bmc_call_place_holder: |
| 13324 | * @proxy: A #ControlBmcProxy. |
| 13325 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13326 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 13327 | * @user_data: User data to pass to @callback. |
| 13328 | * |
| 13329 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. |
| 13330 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 13331 | * You can then call control_bmc_call_place_holder_finish() to get the result of the operation. |
| 13332 | * |
| 13333 | * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method. |
| 13334 | */ |
| 13335 | void |
| 13336 | control_bmc_call_place_holder ( |
| 13337 | ControlBmc *proxy, |
| 13338 | GCancellable *cancellable, |
| 13339 | GAsyncReadyCallback callback, |
| 13340 | gpointer user_data) |
| 13341 | { |
| 13342 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 13343 | "place_holder", |
| 13344 | g_variant_new ("()"), |
| 13345 | G_DBUS_CALL_FLAGS_NONE, |
| 13346 | -1, |
| 13347 | cancellable, |
| 13348 | callback, |
| 13349 | user_data); |
| 13350 | } |
| 13351 | |
| 13352 | /** |
| 13353 | * control_bmc_call_place_holder_finish: |
| 13354 | * @proxy: A #ControlBmcProxy. |
| 13355 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder(). |
| 13356 | * @error: Return location for error or %NULL. |
| 13357 | * |
| 13358 | * Finishes an operation started with control_bmc_call_place_holder(). |
| 13359 | * |
| 13360 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13361 | */ |
| 13362 | gboolean |
| 13363 | control_bmc_call_place_holder_finish ( |
| 13364 | ControlBmc *proxy, |
| 13365 | GAsyncResult *res, |
| 13366 | GError **error) |
| 13367 | { |
| 13368 | GVariant *_ret; |
| 13369 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 13370 | if (_ret == NULL) |
| 13371 | goto _out; |
| 13372 | g_variant_get (_ret, |
| 13373 | "()"); |
| 13374 | g_variant_unref (_ret); |
| 13375 | _out: |
| 13376 | return _ret != NULL; |
| 13377 | } |
| 13378 | |
| 13379 | /** |
| 13380 | * control_bmc_call_place_holder_sync: |
| 13381 | * @proxy: A #ControlBmcProxy. |
| 13382 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13383 | * @error: Return location for error or %NULL. |
| 13384 | * |
| 13385 | * 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. |
| 13386 | * |
| 13387 | * See control_bmc_call_place_holder() for the asynchronous version of this method. |
| 13388 | * |
| 13389 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 13390 | */ |
| 13391 | gboolean |
| 13392 | control_bmc_call_place_holder_sync ( |
| 13393 | ControlBmc *proxy, |
| 13394 | GCancellable *cancellable, |
| 13395 | GError **error) |
| 13396 | { |
| 13397 | GVariant *_ret; |
| 13398 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 13399 | "place_holder", |
| 13400 | g_variant_new ("()"), |
| 13401 | G_DBUS_CALL_FLAGS_NONE, |
| 13402 | -1, |
| 13403 | cancellable, |
| 13404 | error); |
| 13405 | if (_ret == NULL) |
| 13406 | goto _out; |
| 13407 | g_variant_get (_ret, |
| 13408 | "()"); |
| 13409 | g_variant_unref (_ret); |
| 13410 | _out: |
| 13411 | return _ret != NULL; |
| 13412 | } |
| 13413 | |
| 13414 | /** |
| 13415 | * control_bmc_complete_place_holder: |
| 13416 | * @object: A #ControlBmc. |
| 13417 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 13418 | * |
| 13419 | * 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. |
| 13420 | * |
| 13421 | * This method will free @invocation, you cannot use it afterwards. |
| 13422 | */ |
| 13423 | void |
| 13424 | control_bmc_complete_place_holder ( |
| 13425 | ControlBmc *object, |
| 13426 | GDBusMethodInvocation *invocation) |
| 13427 | { |
| 13428 | g_dbus_method_invocation_return_value (invocation, |
| 13429 | g_variant_new ("()")); |
| 13430 | } |
| 13431 | |
| 13432 | /* ------------------------------------------------------------------------ */ |
| 13433 | |
| 13434 | /** |
| 13435 | * ControlBmcProxy: |
| 13436 | * |
| 13437 | * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API. |
| 13438 | */ |
| 13439 | |
| 13440 | /** |
| 13441 | * ControlBmcProxyClass: |
| 13442 | * @parent_class: The parent class. |
| 13443 | * |
| 13444 | * Class structure for #ControlBmcProxy. |
| 13445 | */ |
| 13446 | |
| 13447 | struct _ControlBmcProxyPrivate |
| 13448 | { |
| 13449 | GData *qdata; |
| 13450 | }; |
| 13451 | |
| 13452 | static void control_bmc_proxy_iface_init (ControlBmcIface *iface); |
| 13453 | |
| 13454 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13455 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 13456 | G_ADD_PRIVATE (ControlBmcProxy) |
| 13457 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 13458 | |
| 13459 | #else |
| 13460 | G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, |
| 13461 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); |
| 13462 | |
| 13463 | #endif |
| 13464 | static void |
| 13465 | control_bmc_proxy_finalize (GObject *object) |
| 13466 | { |
| 13467 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object); |
| 13468 | g_datalist_clear (&proxy->priv->qdata); |
| 13469 | G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object); |
| 13470 | } |
| 13471 | |
| 13472 | static void |
| 13473 | control_bmc_proxy_get_property (GObject *object, |
| 13474 | guint prop_id, |
| 13475 | GValue *value, |
| 13476 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13477 | { |
| 13478 | } |
| 13479 | |
| 13480 | static void |
| 13481 | control_bmc_proxy_set_property (GObject *object, |
| 13482 | guint prop_id, |
| 13483 | const GValue *value, |
| 13484 | GParamSpec *pspec G_GNUC_UNUSED) |
| 13485 | { |
| 13486 | } |
| 13487 | |
| 13488 | static void |
| 13489 | control_bmc_proxy_g_signal (GDBusProxy *proxy, |
| 13490 | const gchar *sender_name G_GNUC_UNUSED, |
| 13491 | const gchar *signal_name, |
| 13492 | GVariant *parameters) |
| 13493 | { |
| 13494 | _ExtendedGDBusSignalInfo *info; |
| 13495 | GVariantIter iter; |
| 13496 | GVariant *child; |
| 13497 | GValue *paramv; |
| 13498 | guint num_params; |
| 13499 | guint n; |
| 13500 | guint signal_id; |
| 13501 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name); |
| 13502 | if (info == NULL) |
| 13503 | return; |
| 13504 | num_params = g_variant_n_children (parameters); |
| 13505 | paramv = g_new0 (GValue, num_params + 1); |
| 13506 | g_value_init (¶mv[0], TYPE_CONTROL_BMC); |
| 13507 | g_value_set_object (¶mv[0], proxy); |
| 13508 | g_variant_iter_init (&iter, parameters); |
| 13509 | n = 1; |
| 13510 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13511 | { |
| 13512 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 13513 | if (arg_info->use_gvariant) |
| 13514 | { |
| 13515 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13516 | g_value_set_variant (¶mv[n], child); |
| 13517 | n++; |
| 13518 | } |
| 13519 | else |
| 13520 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13521 | g_variant_unref (child); |
| 13522 | } |
| 13523 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 13524 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 13525 | for (n = 0; n < num_params + 1; n++) |
| 13526 | g_value_unset (¶mv[n]); |
| 13527 | g_free (paramv); |
| 13528 | } |
| 13529 | |
| 13530 | static void |
| 13531 | control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 13532 | GVariant *changed_properties, |
| 13533 | const gchar *const *invalidated_properties) |
| 13534 | { |
| 13535 | ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy); |
| 13536 | guint n; |
| 13537 | const gchar *key; |
| 13538 | GVariantIter *iter; |
| 13539 | _ExtendedGDBusPropertyInfo *info; |
| 13540 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 13541 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 13542 | { |
| 13543 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key); |
| 13544 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 13545 | if (info != NULL) |
| 13546 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13547 | } |
| 13548 | g_variant_iter_free (iter); |
| 13549 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 13550 | { |
| 13551 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]); |
| 13552 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 13553 | if (info != NULL) |
| 13554 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 13555 | } |
| 13556 | } |
| 13557 | |
| 13558 | static void |
| 13559 | control_bmc_proxy_init (ControlBmcProxy *proxy) |
| 13560 | { |
| 13561 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13562 | proxy->priv = control_bmc_proxy_get_instance_private (proxy); |
| 13563 | #else |
| 13564 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate); |
| 13565 | #endif |
| 13566 | |
| 13567 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ()); |
| 13568 | } |
| 13569 | |
| 13570 | static void |
| 13571 | control_bmc_proxy_class_init (ControlBmcProxyClass *klass) |
| 13572 | { |
| 13573 | GObjectClass *gobject_class; |
| 13574 | GDBusProxyClass *proxy_class; |
| 13575 | |
| 13576 | gobject_class = G_OBJECT_CLASS (klass); |
| 13577 | gobject_class->finalize = control_bmc_proxy_finalize; |
| 13578 | gobject_class->get_property = control_bmc_proxy_get_property; |
| 13579 | gobject_class->set_property = control_bmc_proxy_set_property; |
| 13580 | |
| 13581 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 13582 | proxy_class->g_signal = control_bmc_proxy_g_signal; |
| 13583 | proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed; |
| 13584 | |
| 13585 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 13586 | g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate)); |
| 13587 | #endif |
| 13588 | } |
| 13589 | |
| 13590 | static void |
| 13591 | control_bmc_proxy_iface_init (ControlBmcIface *iface) |
| 13592 | { |
| 13593 | } |
| 13594 | |
| 13595 | /** |
| 13596 | * control_bmc_proxy_new: |
| 13597 | * @connection: A #GDBusConnection. |
| 13598 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13599 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13600 | * @object_path: An object path. |
| 13601 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13602 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13603 | * @user_data: User data to pass to @callback. |
| 13604 | * |
| 13605 | * 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. |
| 13606 | * |
| 13607 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 13608 | * You can then call control_bmc_proxy_new_finish() to get the result of the operation. |
| 13609 | * |
| 13610 | * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 13611 | */ |
| 13612 | void |
| 13613 | control_bmc_proxy_new ( |
| 13614 | GDBusConnection *connection, |
| 13615 | GDBusProxyFlags flags, |
| 13616 | const gchar *name, |
| 13617 | const gchar *object_path, |
| 13618 | GCancellable *cancellable, |
| 13619 | GAsyncReadyCallback callback, |
| 13620 | gpointer user_data) |
| 13621 | { |
| 13622 | 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); |
| 13623 | } |
| 13624 | |
| 13625 | /** |
| 13626 | * control_bmc_proxy_new_finish: |
| 13627 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new(). |
| 13628 | * @error: Return location for error or %NULL |
| 13629 | * |
| 13630 | * Finishes an operation started with control_bmc_proxy_new(). |
| 13631 | * |
| 13632 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 13633 | */ |
| 13634 | ControlBmc * |
| 13635 | control_bmc_proxy_new_finish ( |
| 13636 | GAsyncResult *res, |
| 13637 | GError **error) |
| 13638 | { |
| 13639 | GObject *ret; |
| 13640 | GObject *source_object; |
| 13641 | source_object = g_async_result_get_source_object (res); |
| 13642 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 13643 | g_object_unref (source_object); |
| 13644 | if (ret != NULL) |
| 13645 | return CONTROL_BMC (ret); |
| 13646 | else |
| 13647 | return NULL; |
| 13648 | } |
| 13649 | |
| 13650 | /** |
| 13651 | * control_bmc_proxy_new_sync: |
| 13652 | * @connection: A #GDBusConnection. |
| 13653 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13654 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 13655 | * @object_path: An object path. |
| 13656 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13657 | * @error: Return location for error or %NULL |
| 13658 | * |
| 13659 | * 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. |
| 13660 | * |
| 13661 | * The calling thread is blocked until a reply is received. |
| 13662 | * |
| 13663 | * See control_bmc_proxy_new() for the asynchronous version of this constructor. |
| 13664 | * |
| 13665 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 13666 | */ |
| 13667 | ControlBmc * |
| 13668 | control_bmc_proxy_new_sync ( |
| 13669 | GDBusConnection *connection, |
| 13670 | GDBusProxyFlags flags, |
| 13671 | const gchar *name, |
| 13672 | const gchar *object_path, |
| 13673 | GCancellable *cancellable, |
| 13674 | GError **error) |
| 13675 | { |
| 13676 | GInitable *ret; |
| 13677 | 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); |
| 13678 | if (ret != NULL) |
| 13679 | return CONTROL_BMC (ret); |
| 13680 | else |
| 13681 | return NULL; |
| 13682 | } |
| 13683 | |
| 13684 | |
| 13685 | /** |
| 13686 | * control_bmc_proxy_new_for_bus: |
| 13687 | * @bus_type: A #GBusType. |
| 13688 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13689 | * @name: A bus name (well-known or unique). |
| 13690 | * @object_path: An object path. |
| 13691 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13692 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 13693 | * @user_data: User data to pass to @callback. |
| 13694 | * |
| 13695 | * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 13696 | * |
| 13697 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 13698 | * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation. |
| 13699 | * |
| 13700 | * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 13701 | */ |
| 13702 | void |
| 13703 | control_bmc_proxy_new_for_bus ( |
| 13704 | GBusType bus_type, |
| 13705 | GDBusProxyFlags flags, |
| 13706 | const gchar *name, |
| 13707 | const gchar *object_path, |
| 13708 | GCancellable *cancellable, |
| 13709 | GAsyncReadyCallback callback, |
| 13710 | gpointer user_data) |
| 13711 | { |
| 13712 | 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); |
| 13713 | } |
| 13714 | |
| 13715 | /** |
| 13716 | * control_bmc_proxy_new_for_bus_finish: |
| 13717 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus(). |
| 13718 | * @error: Return location for error or %NULL |
| 13719 | * |
| 13720 | * Finishes an operation started with control_bmc_proxy_new_for_bus(). |
| 13721 | * |
| 13722 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 13723 | */ |
| 13724 | ControlBmc * |
| 13725 | control_bmc_proxy_new_for_bus_finish ( |
| 13726 | GAsyncResult *res, |
| 13727 | GError **error) |
| 13728 | { |
| 13729 | GObject *ret; |
| 13730 | GObject *source_object; |
| 13731 | source_object = g_async_result_get_source_object (res); |
| 13732 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 13733 | g_object_unref (source_object); |
| 13734 | if (ret != NULL) |
| 13735 | return CONTROL_BMC (ret); |
| 13736 | else |
| 13737 | return NULL; |
| 13738 | } |
| 13739 | |
| 13740 | /** |
| 13741 | * control_bmc_proxy_new_for_bus_sync: |
| 13742 | * @bus_type: A #GBusType. |
| 13743 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 13744 | * @name: A bus name (well-known or unique). |
| 13745 | * @object_path: An object path. |
| 13746 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 13747 | * @error: Return location for error or %NULL |
| 13748 | * |
| 13749 | * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 13750 | * |
| 13751 | * The calling thread is blocked until a reply is received. |
| 13752 | * |
| 13753 | * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 13754 | * |
| 13755 | * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. |
| 13756 | */ |
| 13757 | ControlBmc * |
| 13758 | control_bmc_proxy_new_for_bus_sync ( |
| 13759 | GBusType bus_type, |
| 13760 | GDBusProxyFlags flags, |
| 13761 | const gchar *name, |
| 13762 | const gchar *object_path, |
| 13763 | GCancellable *cancellable, |
| 13764 | GError **error) |
| 13765 | { |
| 13766 | GInitable *ret; |
| 13767 | 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); |
| 13768 | if (ret != NULL) |
| 13769 | return CONTROL_BMC (ret); |
| 13770 | else |
| 13771 | return NULL; |
| 13772 | } |
| 13773 | |
| 13774 | |
| 13775 | /* ------------------------------------------------------------------------ */ |
| 13776 | |
| 13777 | /** |
| 13778 | * ControlBmcSkeleton: |
| 13779 | * |
| 13780 | * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API. |
| 13781 | */ |
| 13782 | |
| 13783 | /** |
| 13784 | * ControlBmcSkeletonClass: |
| 13785 | * @parent_class: The parent class. |
| 13786 | * |
| 13787 | * Class structure for #ControlBmcSkeleton. |
| 13788 | */ |
| 13789 | |
| 13790 | struct _ControlBmcSkeletonPrivate |
| 13791 | { |
| 13792 | GValue *properties; |
| 13793 | GList *changed_properties; |
| 13794 | GSource *changed_properties_idle_source; |
| 13795 | GMainContext *context; |
| 13796 | GMutex lock; |
| 13797 | }; |
| 13798 | |
| 13799 | static void |
| 13800 | _control_bmc_skeleton_handle_method_call ( |
| 13801 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13802 | const gchar *sender G_GNUC_UNUSED, |
| 13803 | const gchar *object_path G_GNUC_UNUSED, |
| 13804 | const gchar *interface_name, |
| 13805 | const gchar *method_name, |
| 13806 | GVariant *parameters, |
| 13807 | GDBusMethodInvocation *invocation, |
| 13808 | gpointer user_data) |
| 13809 | { |
| 13810 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 13811 | _ExtendedGDBusMethodInfo *info; |
| 13812 | GVariantIter iter; |
| 13813 | GVariant *child; |
| 13814 | GValue *paramv; |
| 13815 | guint num_params; |
| 13816 | guint num_extra; |
| 13817 | guint n; |
| 13818 | guint signal_id; |
| 13819 | GValue return_value = G_VALUE_INIT; |
| 13820 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 13821 | g_assert (info != NULL); |
| 13822 | num_params = g_variant_n_children (parameters); |
| 13823 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 13824 | n = 0; |
| 13825 | g_value_init (¶mv[n], TYPE_CONTROL_BMC); |
| 13826 | g_value_set_object (¶mv[n++], skeleton); |
| 13827 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 13828 | g_value_set_object (¶mv[n++], invocation); |
| 13829 | if (info->pass_fdlist) |
| 13830 | { |
| 13831 | #ifdef G_OS_UNIX |
| 13832 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 13833 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 13834 | #else |
| 13835 | g_assert_not_reached (); |
| 13836 | #endif |
| 13837 | } |
| 13838 | g_variant_iter_init (&iter, parameters); |
| 13839 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 13840 | { |
| 13841 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 13842 | if (arg_info->use_gvariant) |
| 13843 | { |
| 13844 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 13845 | g_value_set_variant (¶mv[n], child); |
| 13846 | n++; |
| 13847 | } |
| 13848 | else |
| 13849 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 13850 | g_variant_unref (child); |
| 13851 | } |
| 13852 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); |
| 13853 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 13854 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 13855 | if (!g_value_get_boolean (&return_value)) |
| 13856 | 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); |
| 13857 | g_value_unset (&return_value); |
| 13858 | for (n = 0; n < num_params + num_extra; n++) |
| 13859 | g_value_unset (¶mv[n]); |
| 13860 | g_free (paramv); |
| 13861 | } |
| 13862 | |
| 13863 | static GVariant * |
| 13864 | _control_bmc_skeleton_handle_get_property ( |
| 13865 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13866 | const gchar *sender G_GNUC_UNUSED, |
| 13867 | const gchar *object_path G_GNUC_UNUSED, |
| 13868 | const gchar *interface_name G_GNUC_UNUSED, |
| 13869 | const gchar *property_name, |
| 13870 | GError **error, |
| 13871 | gpointer user_data) |
| 13872 | { |
| 13873 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 13874 | GValue value = G_VALUE_INIT; |
| 13875 | GParamSpec *pspec; |
| 13876 | _ExtendedGDBusPropertyInfo *info; |
| 13877 | GVariant *ret; |
| 13878 | ret = NULL; |
| 13879 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 13880 | g_assert (info != NULL); |
| 13881 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13882 | if (pspec == NULL) |
| 13883 | { |
| 13884 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 13885 | } |
| 13886 | else |
| 13887 | { |
| 13888 | g_value_init (&value, pspec->value_type); |
| 13889 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 13890 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 13891 | g_value_unset (&value); |
| 13892 | } |
| 13893 | return ret; |
| 13894 | } |
| 13895 | |
| 13896 | static gboolean |
| 13897 | _control_bmc_skeleton_handle_set_property ( |
| 13898 | GDBusConnection *connection G_GNUC_UNUSED, |
| 13899 | const gchar *sender G_GNUC_UNUSED, |
| 13900 | const gchar *object_path G_GNUC_UNUSED, |
| 13901 | const gchar *interface_name G_GNUC_UNUSED, |
| 13902 | const gchar *property_name, |
| 13903 | GVariant *variant, |
| 13904 | GError **error, |
| 13905 | gpointer user_data) |
| 13906 | { |
| 13907 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); |
| 13908 | GValue value = G_VALUE_INIT; |
| 13909 | GParamSpec *pspec; |
| 13910 | _ExtendedGDBusPropertyInfo *info; |
| 13911 | gboolean ret; |
| 13912 | ret = FALSE; |
| 13913 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); |
| 13914 | g_assert (info != NULL); |
| 13915 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 13916 | if (pspec == NULL) |
| 13917 | { |
| 13918 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 13919 | } |
| 13920 | else |
| 13921 | { |
| 13922 | if (info->use_gvariant) |
| 13923 | g_value_set_variant (&value, variant); |
| 13924 | else |
| 13925 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 13926 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 13927 | g_value_unset (&value); |
| 13928 | ret = TRUE; |
| 13929 | } |
| 13930 | return ret; |
| 13931 | } |
| 13932 | |
| 13933 | static const GDBusInterfaceVTable _control_bmc_skeleton_vtable = |
| 13934 | { |
| 13935 | _control_bmc_skeleton_handle_method_call, |
| 13936 | _control_bmc_skeleton_handle_get_property, |
| 13937 | _control_bmc_skeleton_handle_set_property, |
| 13938 | {NULL} |
| 13939 | }; |
| 13940 | |
| 13941 | static GDBusInterfaceInfo * |
| 13942 | control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13943 | { |
| 13944 | return control_bmc_interface_info (); |
| 13945 | } |
| 13946 | |
| 13947 | static GDBusInterfaceVTable * |
| 13948 | control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 13949 | { |
| 13950 | return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable; |
| 13951 | } |
| 13952 | |
| 13953 | static GVariant * |
| 13954 | control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 13955 | { |
| 13956 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton); |
| 13957 | |
| 13958 | GVariantBuilder builder; |
| 13959 | guint n; |
| 13960 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 13961 | if (_control_bmc_interface_info.parent_struct.properties == NULL) |
| 13962 | goto out; |
| 13963 | for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++) |
| 13964 | { |
| 13965 | GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n]; |
| 13966 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 13967 | { |
| 13968 | GVariant *value; |
| 13969 | 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); |
| 13970 | if (value != NULL) |
| 13971 | { |
| 13972 | g_variant_take_ref (value); |
| 13973 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 13974 | g_variant_unref (value); |
| 13975 | } |
| 13976 | } |
| 13977 | } |
| 13978 | out: |
| 13979 | return g_variant_builder_end (&builder); |
| 13980 | } |
| 13981 | |
| 13982 | static void |
| 13983 | control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 13984 | { |
| 13985 | } |
| 13986 | |
| 13987 | static void control_bmc_skeleton_iface_init (ControlBmcIface *iface); |
| 13988 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 13989 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13990 | G_ADD_PRIVATE (ControlBmcSkeleton) |
| 13991 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13992 | |
| 13993 | #else |
| 13994 | G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 13995 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); |
| 13996 | |
| 13997 | #endif |
| 13998 | static void |
| 13999 | control_bmc_skeleton_finalize (GObject *object) |
| 14000 | { |
| 14001 | ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object); |
| 14002 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 14003 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 14004 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 14005 | g_main_context_unref (skeleton->priv->context); |
| 14006 | g_mutex_clear (&skeleton->priv->lock); |
| 14007 | G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object); |
| 14008 | } |
| 14009 | |
| 14010 | static void |
| 14011 | control_bmc_skeleton_init (ControlBmcSkeleton *skeleton) |
| 14012 | { |
| 14013 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14014 | skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton); |
| 14015 | #else |
| 14016 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate); |
| 14017 | #endif |
| 14018 | |
| 14019 | g_mutex_init (&skeleton->priv->lock); |
| 14020 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 14021 | } |
| 14022 | |
| 14023 | static void |
| 14024 | control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass) |
| 14025 | { |
| 14026 | GObjectClass *gobject_class; |
| 14027 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 14028 | |
| 14029 | gobject_class = G_OBJECT_CLASS (klass); |
| 14030 | gobject_class->finalize = control_bmc_skeleton_finalize; |
| 14031 | |
| 14032 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 14033 | skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info; |
| 14034 | skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties; |
| 14035 | skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush; |
| 14036 | skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable; |
| 14037 | |
| 14038 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 14039 | g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate)); |
| 14040 | #endif |
| 14041 | } |
| 14042 | |
| 14043 | static void |
| 14044 | control_bmc_skeleton_iface_init (ControlBmcIface *iface) |
| 14045 | { |
| 14046 | } |
| 14047 | |
| 14048 | /** |
| 14049 | * control_bmc_skeleton_new: |
| 14050 | * |
| 14051 | * 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>. |
| 14052 | * |
| 14053 | * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object. |
| 14054 | */ |
| 14055 | ControlBmc * |
| 14056 | control_bmc_skeleton_new (void) |
| 14057 | { |
| 14058 | return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL)); |
| 14059 | } |
| 14060 | |
| 14061 | /* ------------------------------------------------------------------------ |
| 14062 | * Code for interface org.openbmc.control.Host |
| 14063 | * ------------------------------------------------------------------------ |
| 14064 | */ |
| 14065 | |
| 14066 | /** |
| 14067 | * SECTION:ControlHost |
| 14068 | * @title: ControlHost |
| 14069 | * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface |
| 14070 | * |
| 14071 | * 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. |
| 14072 | */ |
| 14073 | |
| 14074 | /* ---- Introspection data for org.openbmc.control.Host ---- */ |
| 14075 | |
| 14076 | static const _ExtendedGDBusMethodInfo _control_host_method_info_boot = |
| 14077 | { |
| 14078 | { |
| 14079 | -1, |
| 14080 | (gchar *) "boot", |
| 14081 | NULL, |
| 14082 | NULL, |
| 14083 | NULL |
| 14084 | }, |
| 14085 | "handle-boot", |
| 14086 | FALSE |
| 14087 | }; |
| 14088 | |
| 14089 | static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown = |
| 14090 | { |
| 14091 | { |
| 14092 | -1, |
| 14093 | (gchar *) "shutdown", |
| 14094 | NULL, |
| 14095 | NULL, |
| 14096 | NULL |
| 14097 | }, |
| 14098 | "handle-shutdown", |
| 14099 | FALSE |
| 14100 | }; |
| 14101 | |
| 14102 | static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot = |
| 14103 | { |
| 14104 | { |
| 14105 | -1, |
| 14106 | (gchar *) "reboot", |
| 14107 | NULL, |
| 14108 | NULL, |
| 14109 | NULL |
| 14110 | }, |
| 14111 | "handle-reboot", |
| 14112 | FALSE |
| 14113 | }; |
| 14114 | |
| 14115 | static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] = |
| 14116 | { |
| 14117 | &_control_host_method_info_boot, |
| 14118 | &_control_host_method_info_shutdown, |
| 14119 | &_control_host_method_info_reboot, |
| 14120 | NULL |
| 14121 | }; |
| 14122 | |
| 14123 | static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted = |
| 14124 | { |
| 14125 | { |
| 14126 | -1, |
| 14127 | (gchar *) "Booted", |
| 14128 | NULL, |
| 14129 | NULL |
| 14130 | }, |
| 14131 | "booted" |
| 14132 | }; |
| 14133 | |
| 14134 | static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] = |
| 14135 | { |
| 14136 | &_control_host_signal_info_booted, |
| 14137 | NULL |
| 14138 | }; |
| 14139 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14140 | static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode = |
| 14141 | { |
| 14142 | { |
| 14143 | -1, |
| 14144 | (gchar *) "debug_mode", |
| 14145 | (gchar *) "i", |
| 14146 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 14147 | NULL |
| 14148 | }, |
| 14149 | "debug-mode", |
| 14150 | FALSE |
| 14151 | }; |
| 14152 | |
| 14153 | static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side = |
| 14154 | { |
| 14155 | { |
| 14156 | -1, |
| 14157 | (gchar *) "flash_side", |
| 14158 | (gchar *) "s", |
| 14159 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 14160 | NULL |
| 14161 | }, |
| 14162 | "flash-side", |
| 14163 | FALSE |
| 14164 | }; |
| 14165 | |
| 14166 | static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] = |
| 14167 | { |
| 14168 | &_control_host_property_info_debug_mode, |
| 14169 | &_control_host_property_info_flash_side, |
| 14170 | NULL |
| 14171 | }; |
| 14172 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14173 | static const _ExtendedGDBusInterfaceInfo _control_host_interface_info = |
| 14174 | { |
| 14175 | { |
| 14176 | -1, |
| 14177 | (gchar *) "org.openbmc.control.Host", |
| 14178 | (GDBusMethodInfo **) &_control_host_method_info_pointers, |
| 14179 | (GDBusSignalInfo **) &_control_host_signal_info_pointers, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14180 | (GDBusPropertyInfo **) &_control_host_property_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14181 | NULL |
| 14182 | }, |
| 14183 | "control-host", |
| 14184 | }; |
| 14185 | |
| 14186 | |
| 14187 | /** |
| 14188 | * control_host_interface_info: |
| 14189 | * |
| 14190 | * 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. |
| 14191 | * |
| 14192 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 14193 | */ |
| 14194 | GDBusInterfaceInfo * |
| 14195 | control_host_interface_info (void) |
| 14196 | { |
| 14197 | return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct; |
| 14198 | } |
| 14199 | |
| 14200 | /** |
| 14201 | * control_host_override_properties: |
| 14202 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 14203 | * @property_id_begin: The property id to assign to the first overridden property. |
| 14204 | * |
| 14205 | * Overrides all #GObject properties in the #ControlHost interface for a concrete class. |
| 14206 | * The properties are overridden in the order they are defined. |
| 14207 | * |
| 14208 | * Returns: The last property id. |
| 14209 | */ |
| 14210 | guint |
| 14211 | control_host_override_properties (GObjectClass *klass, guint property_id_begin) |
| 14212 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14213 | g_object_class_override_property (klass, property_id_begin++, "debug-mode"); |
| 14214 | g_object_class_override_property (klass, property_id_begin++, "flash-side"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14215 | return property_id_begin - 1; |
| 14216 | } |
| 14217 | |
| 14218 | |
| 14219 | |
| 14220 | /** |
| 14221 | * ControlHost: |
| 14222 | * |
| 14223 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 14224 | */ |
| 14225 | |
| 14226 | /** |
| 14227 | * ControlHostIface: |
| 14228 | * @parent_iface: The parent interface. |
| 14229 | * @handle_boot: Handler for the #ControlHost::handle-boot signal. |
| 14230 | * @handle_reboot: Handler for the #ControlHost::handle-reboot signal. |
| 14231 | * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14232 | * @get_debug_mode: Getter for the #ControlHost:debug-mode property. |
| 14233 | * @get_flash_side: Getter for the #ControlHost:flash-side property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14234 | * @booted: Handler for the #ControlHost::booted signal. |
| 14235 | * |
| 14236 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. |
| 14237 | */ |
| 14238 | |
| 14239 | typedef ControlHostIface ControlHostInterface; |
| 14240 | G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT); |
| 14241 | |
| 14242 | static void |
| 14243 | control_host_default_init (ControlHostIface *iface) |
| 14244 | { |
| 14245 | /* GObject signals for incoming D-Bus method calls: */ |
| 14246 | /** |
| 14247 | * ControlHost::handle-boot: |
| 14248 | * @object: A #ControlHost. |
| 14249 | * @invocation: A #GDBusMethodInvocation. |
| 14250 | * |
| 14251 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. |
| 14252 | * |
| 14253 | * 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. |
| 14254 | * |
| 14255 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14256 | */ |
| 14257 | g_signal_new ("handle-boot", |
| 14258 | G_TYPE_FROM_INTERFACE (iface), |
| 14259 | G_SIGNAL_RUN_LAST, |
| 14260 | G_STRUCT_OFFSET (ControlHostIface, handle_boot), |
| 14261 | g_signal_accumulator_true_handled, |
| 14262 | NULL, |
| 14263 | g_cclosure_marshal_generic, |
| 14264 | G_TYPE_BOOLEAN, |
| 14265 | 1, |
| 14266 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14267 | |
| 14268 | /** |
| 14269 | * ControlHost::handle-shutdown: |
| 14270 | * @object: A #ControlHost. |
| 14271 | * @invocation: A #GDBusMethodInvocation. |
| 14272 | * |
| 14273 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. |
| 14274 | * |
| 14275 | * 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. |
| 14276 | * |
| 14277 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14278 | */ |
| 14279 | g_signal_new ("handle-shutdown", |
| 14280 | G_TYPE_FROM_INTERFACE (iface), |
| 14281 | G_SIGNAL_RUN_LAST, |
| 14282 | G_STRUCT_OFFSET (ControlHostIface, handle_shutdown), |
| 14283 | g_signal_accumulator_true_handled, |
| 14284 | NULL, |
| 14285 | g_cclosure_marshal_generic, |
| 14286 | G_TYPE_BOOLEAN, |
| 14287 | 1, |
| 14288 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14289 | |
| 14290 | /** |
| 14291 | * ControlHost::handle-reboot: |
| 14292 | * @object: A #ControlHost. |
| 14293 | * @invocation: A #GDBusMethodInvocation. |
| 14294 | * |
| 14295 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. |
| 14296 | * |
| 14297 | * 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. |
| 14298 | * |
| 14299 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 14300 | */ |
| 14301 | g_signal_new ("handle-reboot", |
| 14302 | G_TYPE_FROM_INTERFACE (iface), |
| 14303 | G_SIGNAL_RUN_LAST, |
| 14304 | G_STRUCT_OFFSET (ControlHostIface, handle_reboot), |
| 14305 | g_signal_accumulator_true_handled, |
| 14306 | NULL, |
| 14307 | g_cclosure_marshal_generic, |
| 14308 | G_TYPE_BOOLEAN, |
| 14309 | 1, |
| 14310 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 14311 | |
| 14312 | /* GObject signals for received D-Bus signals: */ |
| 14313 | /** |
| 14314 | * ControlHost::booted: |
| 14315 | * @object: A #ControlHost. |
| 14316 | * |
| 14317 | * 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. |
| 14318 | * |
| 14319 | * 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. |
| 14320 | */ |
| 14321 | g_signal_new ("booted", |
| 14322 | G_TYPE_FROM_INTERFACE (iface), |
| 14323 | G_SIGNAL_RUN_LAST, |
| 14324 | G_STRUCT_OFFSET (ControlHostIface, booted), |
| 14325 | NULL, |
| 14326 | NULL, |
| 14327 | g_cclosure_marshal_generic, |
| 14328 | G_TYPE_NONE, |
| 14329 | 0); |
| 14330 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14331 | /* GObject properties for D-Bus properties: */ |
| 14332 | /** |
| 14333 | * ControlHost:debug-mode: |
| 14334 | * |
| 14335 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>. |
| 14336 | * |
| 14337 | * 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. |
| 14338 | */ |
| 14339 | g_object_interface_install_property (iface, |
| 14340 | g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 14341 | /** |
| 14342 | * ControlHost:flash-side: |
| 14343 | * |
| 14344 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>. |
| 14345 | * |
| 14346 | * 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. |
| 14347 | */ |
| 14348 | g_object_interface_install_property (iface, |
| 14349 | g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 14350 | } |
| 14351 | |
| 14352 | /** |
| 14353 | * control_host_get_debug_mode: (skip) |
| 14354 | * @object: A #ControlHost. |
| 14355 | * |
| 14356 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property. |
| 14357 | * |
| 14358 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14359 | * |
| 14360 | * Returns: The property value. |
| 14361 | */ |
| 14362 | gint |
| 14363 | control_host_get_debug_mode (ControlHost *object) |
| 14364 | { |
| 14365 | return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object); |
| 14366 | } |
| 14367 | |
| 14368 | /** |
| 14369 | * control_host_set_debug_mode: (skip) |
| 14370 | * @object: A #ControlHost. |
| 14371 | * @value: The value to set. |
| 14372 | * |
| 14373 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value. |
| 14374 | * |
| 14375 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14376 | */ |
| 14377 | void |
| 14378 | control_host_set_debug_mode (ControlHost *object, gint value) |
| 14379 | { |
| 14380 | g_object_set (G_OBJECT (object), "debug-mode", value, NULL); |
| 14381 | } |
| 14382 | |
| 14383 | /** |
| 14384 | * control_host_get_flash_side: (skip) |
| 14385 | * @object: A #ControlHost. |
| 14386 | * |
| 14387 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. |
| 14388 | * |
| 14389 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14390 | * |
| 14391 | * <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> |
| 14392 | * |
| 14393 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 14394 | */ |
| 14395 | const gchar * |
| 14396 | control_host_get_flash_side (ControlHost *object) |
| 14397 | { |
| 14398 | return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object); |
| 14399 | } |
| 14400 | |
| 14401 | /** |
| 14402 | * control_host_dup_flash_side: (skip) |
| 14403 | * @object: A #ControlHost. |
| 14404 | * |
| 14405 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. |
| 14406 | * |
| 14407 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14408 | * |
| 14409 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 14410 | */ |
| 14411 | gchar * |
| 14412 | control_host_dup_flash_side (ControlHost *object) |
| 14413 | { |
| 14414 | gchar *value; |
| 14415 | g_object_get (G_OBJECT (object), "flash-side", &value, NULL); |
| 14416 | return value; |
| 14417 | } |
| 14418 | |
| 14419 | /** |
| 14420 | * control_host_set_flash_side: (skip) |
| 14421 | * @object: A #ControlHost. |
| 14422 | * @value: The value to set. |
| 14423 | * |
| 14424 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value. |
| 14425 | * |
| 14426 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 14427 | */ |
| 14428 | void |
| 14429 | control_host_set_flash_side (ControlHost *object, const gchar *value) |
| 14430 | { |
| 14431 | g_object_set (G_OBJECT (object), "flash-side", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14432 | } |
| 14433 | |
| 14434 | /** |
| 14435 | * control_host_emit_booted: |
| 14436 | * @object: A #ControlHost. |
| 14437 | * |
| 14438 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal. |
| 14439 | */ |
| 14440 | void |
| 14441 | control_host_emit_booted ( |
| 14442 | ControlHost *object) |
| 14443 | { |
| 14444 | g_signal_emit_by_name (object, "booted"); |
| 14445 | } |
| 14446 | |
| 14447 | /** |
| 14448 | * control_host_call_boot: |
| 14449 | * @proxy: A #ControlHostProxy. |
| 14450 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14451 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14452 | * @user_data: User data to pass to @callback. |
| 14453 | * |
| 14454 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. |
| 14455 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 14456 | * You can then call control_host_call_boot_finish() to get the result of the operation. |
| 14457 | * |
| 14458 | * See control_host_call_boot_sync() for the synchronous, blocking version of this method. |
| 14459 | */ |
| 14460 | void |
| 14461 | control_host_call_boot ( |
| 14462 | ControlHost *proxy, |
| 14463 | GCancellable *cancellable, |
| 14464 | GAsyncReadyCallback callback, |
| 14465 | gpointer user_data) |
| 14466 | { |
| 14467 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14468 | "boot", |
| 14469 | g_variant_new ("()"), |
| 14470 | G_DBUS_CALL_FLAGS_NONE, |
| 14471 | -1, |
| 14472 | cancellable, |
| 14473 | callback, |
| 14474 | user_data); |
| 14475 | } |
| 14476 | |
| 14477 | /** |
| 14478 | * control_host_call_boot_finish: |
| 14479 | * @proxy: A #ControlHostProxy. |
| 14480 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot(). |
| 14481 | * @error: Return location for error or %NULL. |
| 14482 | * |
| 14483 | * Finishes an operation started with control_host_call_boot(). |
| 14484 | * |
| 14485 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14486 | */ |
| 14487 | gboolean |
| 14488 | control_host_call_boot_finish ( |
| 14489 | ControlHost *proxy, |
| 14490 | GAsyncResult *res, |
| 14491 | GError **error) |
| 14492 | { |
| 14493 | GVariant *_ret; |
| 14494 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14495 | if (_ret == NULL) |
| 14496 | goto _out; |
| 14497 | g_variant_get (_ret, |
| 14498 | "()"); |
| 14499 | g_variant_unref (_ret); |
| 14500 | _out: |
| 14501 | return _ret != NULL; |
| 14502 | } |
| 14503 | |
| 14504 | /** |
| 14505 | * control_host_call_boot_sync: |
| 14506 | * @proxy: A #ControlHostProxy. |
| 14507 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14508 | * @error: Return location for error or %NULL. |
| 14509 | * |
| 14510 | * 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. |
| 14511 | * |
| 14512 | * See control_host_call_boot() for the asynchronous version of this method. |
| 14513 | * |
| 14514 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14515 | */ |
| 14516 | gboolean |
| 14517 | control_host_call_boot_sync ( |
| 14518 | ControlHost *proxy, |
| 14519 | GCancellable *cancellable, |
| 14520 | GError **error) |
| 14521 | { |
| 14522 | GVariant *_ret; |
| 14523 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14524 | "boot", |
| 14525 | g_variant_new ("()"), |
| 14526 | G_DBUS_CALL_FLAGS_NONE, |
| 14527 | -1, |
| 14528 | cancellable, |
| 14529 | error); |
| 14530 | if (_ret == NULL) |
| 14531 | goto _out; |
| 14532 | g_variant_get (_ret, |
| 14533 | "()"); |
| 14534 | g_variant_unref (_ret); |
| 14535 | _out: |
| 14536 | return _ret != NULL; |
| 14537 | } |
| 14538 | |
| 14539 | /** |
| 14540 | * control_host_call_shutdown: |
| 14541 | * @proxy: A #ControlHostProxy. |
| 14542 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14543 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14544 | * @user_data: User data to pass to @callback. |
| 14545 | * |
| 14546 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. |
| 14547 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 14548 | * You can then call control_host_call_shutdown_finish() to get the result of the operation. |
| 14549 | * |
| 14550 | * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method. |
| 14551 | */ |
| 14552 | void |
| 14553 | control_host_call_shutdown ( |
| 14554 | ControlHost *proxy, |
| 14555 | GCancellable *cancellable, |
| 14556 | GAsyncReadyCallback callback, |
| 14557 | gpointer user_data) |
| 14558 | { |
| 14559 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14560 | "shutdown", |
| 14561 | g_variant_new ("()"), |
| 14562 | G_DBUS_CALL_FLAGS_NONE, |
| 14563 | -1, |
| 14564 | cancellable, |
| 14565 | callback, |
| 14566 | user_data); |
| 14567 | } |
| 14568 | |
| 14569 | /** |
| 14570 | * control_host_call_shutdown_finish: |
| 14571 | * @proxy: A #ControlHostProxy. |
| 14572 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown(). |
| 14573 | * @error: Return location for error or %NULL. |
| 14574 | * |
| 14575 | * Finishes an operation started with control_host_call_shutdown(). |
| 14576 | * |
| 14577 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14578 | */ |
| 14579 | gboolean |
| 14580 | control_host_call_shutdown_finish ( |
| 14581 | ControlHost *proxy, |
| 14582 | GAsyncResult *res, |
| 14583 | GError **error) |
| 14584 | { |
| 14585 | GVariant *_ret; |
| 14586 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14587 | if (_ret == NULL) |
| 14588 | goto _out; |
| 14589 | g_variant_get (_ret, |
| 14590 | "()"); |
| 14591 | g_variant_unref (_ret); |
| 14592 | _out: |
| 14593 | return _ret != NULL; |
| 14594 | } |
| 14595 | |
| 14596 | /** |
| 14597 | * control_host_call_shutdown_sync: |
| 14598 | * @proxy: A #ControlHostProxy. |
| 14599 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14600 | * @error: Return location for error or %NULL. |
| 14601 | * |
| 14602 | * 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. |
| 14603 | * |
| 14604 | * See control_host_call_shutdown() for the asynchronous version of this method. |
| 14605 | * |
| 14606 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14607 | */ |
| 14608 | gboolean |
| 14609 | control_host_call_shutdown_sync ( |
| 14610 | ControlHost *proxy, |
| 14611 | GCancellable *cancellable, |
| 14612 | GError **error) |
| 14613 | { |
| 14614 | GVariant *_ret; |
| 14615 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14616 | "shutdown", |
| 14617 | g_variant_new ("()"), |
| 14618 | G_DBUS_CALL_FLAGS_NONE, |
| 14619 | -1, |
| 14620 | cancellable, |
| 14621 | error); |
| 14622 | if (_ret == NULL) |
| 14623 | goto _out; |
| 14624 | g_variant_get (_ret, |
| 14625 | "()"); |
| 14626 | g_variant_unref (_ret); |
| 14627 | _out: |
| 14628 | return _ret != NULL; |
| 14629 | } |
| 14630 | |
| 14631 | /** |
| 14632 | * control_host_call_reboot: |
| 14633 | * @proxy: A #ControlHostProxy. |
| 14634 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14635 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 14636 | * @user_data: User data to pass to @callback. |
| 14637 | * |
| 14638 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. |
| 14639 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 14640 | * You can then call control_host_call_reboot_finish() to get the result of the operation. |
| 14641 | * |
| 14642 | * See control_host_call_reboot_sync() for the synchronous, blocking version of this method. |
| 14643 | */ |
| 14644 | void |
| 14645 | control_host_call_reboot ( |
| 14646 | ControlHost *proxy, |
| 14647 | GCancellable *cancellable, |
| 14648 | GAsyncReadyCallback callback, |
| 14649 | gpointer user_data) |
| 14650 | { |
| 14651 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 14652 | "reboot", |
| 14653 | g_variant_new ("()"), |
| 14654 | G_DBUS_CALL_FLAGS_NONE, |
| 14655 | -1, |
| 14656 | cancellable, |
| 14657 | callback, |
| 14658 | user_data); |
| 14659 | } |
| 14660 | |
| 14661 | /** |
| 14662 | * control_host_call_reboot_finish: |
| 14663 | * @proxy: A #ControlHostProxy. |
| 14664 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot(). |
| 14665 | * @error: Return location for error or %NULL. |
| 14666 | * |
| 14667 | * Finishes an operation started with control_host_call_reboot(). |
| 14668 | * |
| 14669 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14670 | */ |
| 14671 | gboolean |
| 14672 | control_host_call_reboot_finish ( |
| 14673 | ControlHost *proxy, |
| 14674 | GAsyncResult *res, |
| 14675 | GError **error) |
| 14676 | { |
| 14677 | GVariant *_ret; |
| 14678 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 14679 | if (_ret == NULL) |
| 14680 | goto _out; |
| 14681 | g_variant_get (_ret, |
| 14682 | "()"); |
| 14683 | g_variant_unref (_ret); |
| 14684 | _out: |
| 14685 | return _ret != NULL; |
| 14686 | } |
| 14687 | |
| 14688 | /** |
| 14689 | * control_host_call_reboot_sync: |
| 14690 | * @proxy: A #ControlHostProxy. |
| 14691 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 14692 | * @error: Return location for error or %NULL. |
| 14693 | * |
| 14694 | * 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. |
| 14695 | * |
| 14696 | * See control_host_call_reboot() for the asynchronous version of this method. |
| 14697 | * |
| 14698 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 14699 | */ |
| 14700 | gboolean |
| 14701 | control_host_call_reboot_sync ( |
| 14702 | ControlHost *proxy, |
| 14703 | GCancellable *cancellable, |
| 14704 | GError **error) |
| 14705 | { |
| 14706 | GVariant *_ret; |
| 14707 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 14708 | "reboot", |
| 14709 | g_variant_new ("()"), |
| 14710 | G_DBUS_CALL_FLAGS_NONE, |
| 14711 | -1, |
| 14712 | cancellable, |
| 14713 | error); |
| 14714 | if (_ret == NULL) |
| 14715 | goto _out; |
| 14716 | g_variant_get (_ret, |
| 14717 | "()"); |
| 14718 | g_variant_unref (_ret); |
| 14719 | _out: |
| 14720 | return _ret != NULL; |
| 14721 | } |
| 14722 | |
| 14723 | /** |
| 14724 | * control_host_complete_boot: |
| 14725 | * @object: A #ControlHost. |
| 14726 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 14727 | * |
| 14728 | * 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. |
| 14729 | * |
| 14730 | * This method will free @invocation, you cannot use it afterwards. |
| 14731 | */ |
| 14732 | void |
| 14733 | control_host_complete_boot ( |
| 14734 | ControlHost *object, |
| 14735 | GDBusMethodInvocation *invocation) |
| 14736 | { |
| 14737 | g_dbus_method_invocation_return_value (invocation, |
| 14738 | g_variant_new ("()")); |
| 14739 | } |
| 14740 | |
| 14741 | /** |
| 14742 | * control_host_complete_shutdown: |
| 14743 | * @object: A #ControlHost. |
| 14744 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 14745 | * |
| 14746 | * 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. |
| 14747 | * |
| 14748 | * This method will free @invocation, you cannot use it afterwards. |
| 14749 | */ |
| 14750 | void |
| 14751 | control_host_complete_shutdown ( |
| 14752 | ControlHost *object, |
| 14753 | GDBusMethodInvocation *invocation) |
| 14754 | { |
| 14755 | g_dbus_method_invocation_return_value (invocation, |
| 14756 | g_variant_new ("()")); |
| 14757 | } |
| 14758 | |
| 14759 | /** |
| 14760 | * control_host_complete_reboot: |
| 14761 | * @object: A #ControlHost. |
| 14762 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 14763 | * |
| 14764 | * 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. |
| 14765 | * |
| 14766 | * This method will free @invocation, you cannot use it afterwards. |
| 14767 | */ |
| 14768 | void |
| 14769 | control_host_complete_reboot ( |
| 14770 | ControlHost *object, |
| 14771 | GDBusMethodInvocation *invocation) |
| 14772 | { |
| 14773 | g_dbus_method_invocation_return_value (invocation, |
| 14774 | g_variant_new ("()")); |
| 14775 | } |
| 14776 | |
| 14777 | /* ------------------------------------------------------------------------ */ |
| 14778 | |
| 14779 | /** |
| 14780 | * ControlHostProxy: |
| 14781 | * |
| 14782 | * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API. |
| 14783 | */ |
| 14784 | |
| 14785 | /** |
| 14786 | * ControlHostProxyClass: |
| 14787 | * @parent_class: The parent class. |
| 14788 | * |
| 14789 | * Class structure for #ControlHostProxy. |
| 14790 | */ |
| 14791 | |
| 14792 | struct _ControlHostProxyPrivate |
| 14793 | { |
| 14794 | GData *qdata; |
| 14795 | }; |
| 14796 | |
| 14797 | static void control_host_proxy_iface_init (ControlHostIface *iface); |
| 14798 | |
| 14799 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14800 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 14801 | G_ADD_PRIVATE (ControlHostProxy) |
| 14802 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 14803 | |
| 14804 | #else |
| 14805 | G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, |
| 14806 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); |
| 14807 | |
| 14808 | #endif |
| 14809 | static void |
| 14810 | control_host_proxy_finalize (GObject *object) |
| 14811 | { |
| 14812 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 14813 | g_datalist_clear (&proxy->priv->qdata); |
| 14814 | G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object); |
| 14815 | } |
| 14816 | |
| 14817 | static void |
| 14818 | control_host_proxy_get_property (GObject *object, |
| 14819 | guint prop_id, |
| 14820 | GValue *value, |
| 14821 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14822 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14823 | const _ExtendedGDBusPropertyInfo *info; |
| 14824 | GVariant *variant; |
| 14825 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 14826 | info = _control_host_property_info_pointers[prop_id - 1]; |
| 14827 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 14828 | if (info->use_gvariant) |
| 14829 | { |
| 14830 | g_value_set_variant (value, variant); |
| 14831 | } |
| 14832 | else |
| 14833 | { |
| 14834 | if (variant != NULL) |
| 14835 | g_dbus_gvariant_to_gvalue (variant, value); |
| 14836 | } |
| 14837 | if (variant != NULL) |
| 14838 | g_variant_unref (variant); |
| 14839 | } |
| 14840 | |
| 14841 | static void |
| 14842 | control_host_proxy_set_property_cb (GDBusProxy *proxy, |
| 14843 | GAsyncResult *res, |
| 14844 | gpointer user_data) |
| 14845 | { |
| 14846 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 14847 | GError *error; |
| 14848 | GVariant *_ret; |
| 14849 | error = NULL; |
| 14850 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 14851 | if (!_ret) |
| 14852 | { |
| 14853 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)", |
| 14854 | info->parent_struct.name, |
| 14855 | error->message, g_quark_to_string (error->domain), error->code); |
| 14856 | g_error_free (error); |
| 14857 | } |
| 14858 | else |
| 14859 | { |
| 14860 | g_variant_unref (_ret); |
| 14861 | } |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14862 | } |
| 14863 | |
| 14864 | static void |
| 14865 | control_host_proxy_set_property (GObject *object, |
| 14866 | guint prop_id, |
| 14867 | const GValue *value, |
| 14868 | GParamSpec *pspec G_GNUC_UNUSED) |
| 14869 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14870 | const _ExtendedGDBusPropertyInfo *info; |
| 14871 | GVariant *variant; |
| 14872 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 14873 | info = _control_host_property_info_pointers[prop_id - 1]; |
| 14874 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 14875 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 14876 | "org.freedesktop.DBus.Properties.Set", |
| 14877 | g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant), |
| 14878 | G_DBUS_CALL_FLAGS_NONE, |
| 14879 | -1, |
| 14880 | NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 14881 | g_variant_unref (variant); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14882 | } |
| 14883 | |
| 14884 | static void |
| 14885 | control_host_proxy_g_signal (GDBusProxy *proxy, |
| 14886 | const gchar *sender_name G_GNUC_UNUSED, |
| 14887 | const gchar *signal_name, |
| 14888 | GVariant *parameters) |
| 14889 | { |
| 14890 | _ExtendedGDBusSignalInfo *info; |
| 14891 | GVariantIter iter; |
| 14892 | GVariant *child; |
| 14893 | GValue *paramv; |
| 14894 | guint num_params; |
| 14895 | guint n; |
| 14896 | guint signal_id; |
| 14897 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name); |
| 14898 | if (info == NULL) |
| 14899 | return; |
| 14900 | num_params = g_variant_n_children (parameters); |
| 14901 | paramv = g_new0 (GValue, num_params + 1); |
| 14902 | g_value_init (¶mv[0], TYPE_CONTROL_HOST); |
| 14903 | g_value_set_object (¶mv[0], proxy); |
| 14904 | g_variant_iter_init (&iter, parameters); |
| 14905 | n = 1; |
| 14906 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 14907 | { |
| 14908 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 14909 | if (arg_info->use_gvariant) |
| 14910 | { |
| 14911 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 14912 | g_value_set_variant (¶mv[n], child); |
| 14913 | n++; |
| 14914 | } |
| 14915 | else |
| 14916 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 14917 | g_variant_unref (child); |
| 14918 | } |
| 14919 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 14920 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 14921 | for (n = 0; n < num_params + 1; n++) |
| 14922 | g_value_unset (¶mv[n]); |
| 14923 | g_free (paramv); |
| 14924 | } |
| 14925 | |
| 14926 | static void |
| 14927 | control_host_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 14928 | GVariant *changed_properties, |
| 14929 | const gchar *const *invalidated_properties) |
| 14930 | { |
| 14931 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy); |
| 14932 | guint n; |
| 14933 | const gchar *key; |
| 14934 | GVariantIter *iter; |
| 14935 | _ExtendedGDBusPropertyInfo *info; |
| 14936 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 14937 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 14938 | { |
| 14939 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key); |
| 14940 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 14941 | if (info != NULL) |
| 14942 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 14943 | } |
| 14944 | g_variant_iter_free (iter); |
| 14945 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 14946 | { |
| 14947 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]); |
| 14948 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 14949 | if (info != NULL) |
| 14950 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 14951 | } |
| 14952 | } |
| 14953 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 14954 | static gint |
| 14955 | control_host_proxy_get_debug_mode (ControlHost *object) |
| 14956 | { |
| 14957 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 14958 | GVariant *variant; |
| 14959 | gint value = 0; |
| 14960 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode"); |
| 14961 | if (variant != NULL) |
| 14962 | { |
| 14963 | value = g_variant_get_int32 (variant); |
| 14964 | g_variant_unref (variant); |
| 14965 | } |
| 14966 | return value; |
| 14967 | } |
| 14968 | |
| 14969 | static const gchar * |
| 14970 | control_host_proxy_get_flash_side (ControlHost *object) |
| 14971 | { |
| 14972 | ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); |
| 14973 | GVariant *variant; |
| 14974 | const gchar *value = NULL; |
| 14975 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side"); |
| 14976 | if (variant != NULL) |
| 14977 | { |
| 14978 | value = g_variant_get_string (variant, NULL); |
| 14979 | g_variant_unref (variant); |
| 14980 | } |
| 14981 | return value; |
| 14982 | } |
| 14983 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 14984 | static void |
| 14985 | control_host_proxy_init (ControlHostProxy *proxy) |
| 14986 | { |
| 14987 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 14988 | proxy->priv = control_host_proxy_get_instance_private (proxy); |
| 14989 | #else |
| 14990 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate); |
| 14991 | #endif |
| 14992 | |
| 14993 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ()); |
| 14994 | } |
| 14995 | |
| 14996 | static void |
| 14997 | control_host_proxy_class_init (ControlHostProxyClass *klass) |
| 14998 | { |
| 14999 | GObjectClass *gobject_class; |
| 15000 | GDBusProxyClass *proxy_class; |
| 15001 | |
| 15002 | gobject_class = G_OBJECT_CLASS (klass); |
| 15003 | gobject_class->finalize = control_host_proxy_finalize; |
| 15004 | gobject_class->get_property = control_host_proxy_get_property; |
| 15005 | gobject_class->set_property = control_host_proxy_set_property; |
| 15006 | |
| 15007 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 15008 | proxy_class->g_signal = control_host_proxy_g_signal; |
| 15009 | proxy_class->g_properties_changed = control_host_proxy_g_properties_changed; |
| 15010 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15011 | control_host_override_properties (gobject_class, 1); |
| 15012 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15013 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 15014 | g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate)); |
| 15015 | #endif |
| 15016 | } |
| 15017 | |
| 15018 | static void |
| 15019 | control_host_proxy_iface_init (ControlHostIface *iface) |
| 15020 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15021 | iface->get_debug_mode = control_host_proxy_get_debug_mode; |
| 15022 | iface->get_flash_side = control_host_proxy_get_flash_side; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15023 | } |
| 15024 | |
| 15025 | /** |
| 15026 | * control_host_proxy_new: |
| 15027 | * @connection: A #GDBusConnection. |
| 15028 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15029 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15030 | * @object_path: An object path. |
| 15031 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15032 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15033 | * @user_data: User data to pass to @callback. |
| 15034 | * |
| 15035 | * 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. |
| 15036 | * |
| 15037 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 15038 | * You can then call control_host_proxy_new_finish() to get the result of the operation. |
| 15039 | * |
| 15040 | * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 15041 | */ |
| 15042 | void |
| 15043 | control_host_proxy_new ( |
| 15044 | GDBusConnection *connection, |
| 15045 | GDBusProxyFlags flags, |
| 15046 | const gchar *name, |
| 15047 | const gchar *object_path, |
| 15048 | GCancellable *cancellable, |
| 15049 | GAsyncReadyCallback callback, |
| 15050 | gpointer user_data) |
| 15051 | { |
| 15052 | 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); |
| 15053 | } |
| 15054 | |
| 15055 | /** |
| 15056 | * control_host_proxy_new_finish: |
| 15057 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new(). |
| 15058 | * @error: Return location for error or %NULL |
| 15059 | * |
| 15060 | * Finishes an operation started with control_host_proxy_new(). |
| 15061 | * |
| 15062 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 15063 | */ |
| 15064 | ControlHost * |
| 15065 | control_host_proxy_new_finish ( |
| 15066 | GAsyncResult *res, |
| 15067 | GError **error) |
| 15068 | { |
| 15069 | GObject *ret; |
| 15070 | GObject *source_object; |
| 15071 | source_object = g_async_result_get_source_object (res); |
| 15072 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15073 | g_object_unref (source_object); |
| 15074 | if (ret != NULL) |
| 15075 | return CONTROL_HOST (ret); |
| 15076 | else |
| 15077 | return NULL; |
| 15078 | } |
| 15079 | |
| 15080 | /** |
| 15081 | * control_host_proxy_new_sync: |
| 15082 | * @connection: A #GDBusConnection. |
| 15083 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15084 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 15085 | * @object_path: An object path. |
| 15086 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15087 | * @error: Return location for error or %NULL |
| 15088 | * |
| 15089 | * 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. |
| 15090 | * |
| 15091 | * The calling thread is blocked until a reply is received. |
| 15092 | * |
| 15093 | * See control_host_proxy_new() for the asynchronous version of this constructor. |
| 15094 | * |
| 15095 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 15096 | */ |
| 15097 | ControlHost * |
| 15098 | control_host_proxy_new_sync ( |
| 15099 | GDBusConnection *connection, |
| 15100 | GDBusProxyFlags flags, |
| 15101 | const gchar *name, |
| 15102 | const gchar *object_path, |
| 15103 | GCancellable *cancellable, |
| 15104 | GError **error) |
| 15105 | { |
| 15106 | GInitable *ret; |
| 15107 | 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); |
| 15108 | if (ret != NULL) |
| 15109 | return CONTROL_HOST (ret); |
| 15110 | else |
| 15111 | return NULL; |
| 15112 | } |
| 15113 | |
| 15114 | |
| 15115 | /** |
| 15116 | * control_host_proxy_new_for_bus: |
| 15117 | * @bus_type: A #GBusType. |
| 15118 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15119 | * @name: A bus name (well-known or unique). |
| 15120 | * @object_path: An object path. |
| 15121 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15122 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 15123 | * @user_data: User data to pass to @callback. |
| 15124 | * |
| 15125 | * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 15126 | * |
| 15127 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 15128 | * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation. |
| 15129 | * |
| 15130 | * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 15131 | */ |
| 15132 | void |
| 15133 | control_host_proxy_new_for_bus ( |
| 15134 | GBusType bus_type, |
| 15135 | GDBusProxyFlags flags, |
| 15136 | const gchar *name, |
| 15137 | const gchar *object_path, |
| 15138 | GCancellable *cancellable, |
| 15139 | GAsyncReadyCallback callback, |
| 15140 | gpointer user_data) |
| 15141 | { |
| 15142 | 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); |
| 15143 | } |
| 15144 | |
| 15145 | /** |
| 15146 | * control_host_proxy_new_for_bus_finish: |
| 15147 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus(). |
| 15148 | * @error: Return location for error or %NULL |
| 15149 | * |
| 15150 | * Finishes an operation started with control_host_proxy_new_for_bus(). |
| 15151 | * |
| 15152 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 15153 | */ |
| 15154 | ControlHost * |
| 15155 | control_host_proxy_new_for_bus_finish ( |
| 15156 | GAsyncResult *res, |
| 15157 | GError **error) |
| 15158 | { |
| 15159 | GObject *ret; |
| 15160 | GObject *source_object; |
| 15161 | source_object = g_async_result_get_source_object (res); |
| 15162 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 15163 | g_object_unref (source_object); |
| 15164 | if (ret != NULL) |
| 15165 | return CONTROL_HOST (ret); |
| 15166 | else |
| 15167 | return NULL; |
| 15168 | } |
| 15169 | |
| 15170 | /** |
| 15171 | * control_host_proxy_new_for_bus_sync: |
| 15172 | * @bus_type: A #GBusType. |
| 15173 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 15174 | * @name: A bus name (well-known or unique). |
| 15175 | * @object_path: An object path. |
| 15176 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 15177 | * @error: Return location for error or %NULL |
| 15178 | * |
| 15179 | * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 15180 | * |
| 15181 | * The calling thread is blocked until a reply is received. |
| 15182 | * |
| 15183 | * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 15184 | * |
| 15185 | * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. |
| 15186 | */ |
| 15187 | ControlHost * |
| 15188 | control_host_proxy_new_for_bus_sync ( |
| 15189 | GBusType bus_type, |
| 15190 | GDBusProxyFlags flags, |
| 15191 | const gchar *name, |
| 15192 | const gchar *object_path, |
| 15193 | GCancellable *cancellable, |
| 15194 | GError **error) |
| 15195 | { |
| 15196 | GInitable *ret; |
| 15197 | 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); |
| 15198 | if (ret != NULL) |
| 15199 | return CONTROL_HOST (ret); |
| 15200 | else |
| 15201 | return NULL; |
| 15202 | } |
| 15203 | |
| 15204 | |
| 15205 | /* ------------------------------------------------------------------------ */ |
| 15206 | |
| 15207 | /** |
| 15208 | * ControlHostSkeleton: |
| 15209 | * |
| 15210 | * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API. |
| 15211 | */ |
| 15212 | |
| 15213 | /** |
| 15214 | * ControlHostSkeletonClass: |
| 15215 | * @parent_class: The parent class. |
| 15216 | * |
| 15217 | * Class structure for #ControlHostSkeleton. |
| 15218 | */ |
| 15219 | |
| 15220 | struct _ControlHostSkeletonPrivate |
| 15221 | { |
| 15222 | GValue *properties; |
| 15223 | GList *changed_properties; |
| 15224 | GSource *changed_properties_idle_source; |
| 15225 | GMainContext *context; |
| 15226 | GMutex lock; |
| 15227 | }; |
| 15228 | |
| 15229 | static void |
| 15230 | _control_host_skeleton_handle_method_call ( |
| 15231 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15232 | const gchar *sender G_GNUC_UNUSED, |
| 15233 | const gchar *object_path G_GNUC_UNUSED, |
| 15234 | const gchar *interface_name, |
| 15235 | const gchar *method_name, |
| 15236 | GVariant *parameters, |
| 15237 | GDBusMethodInvocation *invocation, |
| 15238 | gpointer user_data) |
| 15239 | { |
| 15240 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 15241 | _ExtendedGDBusMethodInfo *info; |
| 15242 | GVariantIter iter; |
| 15243 | GVariant *child; |
| 15244 | GValue *paramv; |
| 15245 | guint num_params; |
| 15246 | guint num_extra; |
| 15247 | guint n; |
| 15248 | guint signal_id; |
| 15249 | GValue return_value = G_VALUE_INIT; |
| 15250 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 15251 | g_assert (info != NULL); |
| 15252 | num_params = g_variant_n_children (parameters); |
| 15253 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 15254 | n = 0; |
| 15255 | g_value_init (¶mv[n], TYPE_CONTROL_HOST); |
| 15256 | g_value_set_object (¶mv[n++], skeleton); |
| 15257 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 15258 | g_value_set_object (¶mv[n++], invocation); |
| 15259 | if (info->pass_fdlist) |
| 15260 | { |
| 15261 | #ifdef G_OS_UNIX |
| 15262 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 15263 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 15264 | #else |
| 15265 | g_assert_not_reached (); |
| 15266 | #endif |
| 15267 | } |
| 15268 | g_variant_iter_init (&iter, parameters); |
| 15269 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 15270 | { |
| 15271 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 15272 | if (arg_info->use_gvariant) |
| 15273 | { |
| 15274 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 15275 | g_value_set_variant (¶mv[n], child); |
| 15276 | n++; |
| 15277 | } |
| 15278 | else |
| 15279 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 15280 | g_variant_unref (child); |
| 15281 | } |
| 15282 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); |
| 15283 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 15284 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 15285 | if (!g_value_get_boolean (&return_value)) |
| 15286 | 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); |
| 15287 | g_value_unset (&return_value); |
| 15288 | for (n = 0; n < num_params + num_extra; n++) |
| 15289 | g_value_unset (¶mv[n]); |
| 15290 | g_free (paramv); |
| 15291 | } |
| 15292 | |
| 15293 | static GVariant * |
| 15294 | _control_host_skeleton_handle_get_property ( |
| 15295 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15296 | const gchar *sender G_GNUC_UNUSED, |
| 15297 | const gchar *object_path G_GNUC_UNUSED, |
| 15298 | const gchar *interface_name G_GNUC_UNUSED, |
| 15299 | const gchar *property_name, |
| 15300 | GError **error, |
| 15301 | gpointer user_data) |
| 15302 | { |
| 15303 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 15304 | GValue value = G_VALUE_INIT; |
| 15305 | GParamSpec *pspec; |
| 15306 | _ExtendedGDBusPropertyInfo *info; |
| 15307 | GVariant *ret; |
| 15308 | ret = NULL; |
| 15309 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 15310 | g_assert (info != NULL); |
| 15311 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15312 | if (pspec == NULL) |
| 15313 | { |
| 15314 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15315 | } |
| 15316 | else |
| 15317 | { |
| 15318 | g_value_init (&value, pspec->value_type); |
| 15319 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15320 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 15321 | g_value_unset (&value); |
| 15322 | } |
| 15323 | return ret; |
| 15324 | } |
| 15325 | |
| 15326 | static gboolean |
| 15327 | _control_host_skeleton_handle_set_property ( |
| 15328 | GDBusConnection *connection G_GNUC_UNUSED, |
| 15329 | const gchar *sender G_GNUC_UNUSED, |
| 15330 | const gchar *object_path G_GNUC_UNUSED, |
| 15331 | const gchar *interface_name G_GNUC_UNUSED, |
| 15332 | const gchar *property_name, |
| 15333 | GVariant *variant, |
| 15334 | GError **error, |
| 15335 | gpointer user_data) |
| 15336 | { |
| 15337 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 15338 | GValue value = G_VALUE_INIT; |
| 15339 | GParamSpec *pspec; |
| 15340 | _ExtendedGDBusPropertyInfo *info; |
| 15341 | gboolean ret; |
| 15342 | ret = FALSE; |
| 15343 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); |
| 15344 | g_assert (info != NULL); |
| 15345 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 15346 | if (pspec == NULL) |
| 15347 | { |
| 15348 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 15349 | } |
| 15350 | else |
| 15351 | { |
| 15352 | if (info->use_gvariant) |
| 15353 | g_value_set_variant (&value, variant); |
| 15354 | else |
| 15355 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 15356 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 15357 | g_value_unset (&value); |
| 15358 | ret = TRUE; |
| 15359 | } |
| 15360 | return ret; |
| 15361 | } |
| 15362 | |
| 15363 | static const GDBusInterfaceVTable _control_host_skeleton_vtable = |
| 15364 | { |
| 15365 | _control_host_skeleton_handle_method_call, |
| 15366 | _control_host_skeleton_handle_get_property, |
| 15367 | _control_host_skeleton_handle_set_property, |
| 15368 | {NULL} |
| 15369 | }; |
| 15370 | |
| 15371 | static GDBusInterfaceInfo * |
| 15372 | control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15373 | { |
| 15374 | return control_host_interface_info (); |
| 15375 | } |
| 15376 | |
| 15377 | static GDBusInterfaceVTable * |
| 15378 | control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 15379 | { |
| 15380 | return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable; |
| 15381 | } |
| 15382 | |
| 15383 | static GVariant * |
| 15384 | control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 15385 | { |
| 15386 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 15387 | |
| 15388 | GVariantBuilder builder; |
| 15389 | guint n; |
| 15390 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15391 | if (_control_host_interface_info.parent_struct.properties == NULL) |
| 15392 | goto out; |
| 15393 | for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++) |
| 15394 | { |
| 15395 | GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n]; |
| 15396 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 15397 | { |
| 15398 | GVariant *value; |
| 15399 | 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); |
| 15400 | if (value != NULL) |
| 15401 | { |
| 15402 | g_variant_take_ref (value); |
| 15403 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 15404 | g_variant_unref (value); |
| 15405 | } |
| 15406 | } |
| 15407 | } |
| 15408 | out: |
| 15409 | return g_variant_builder_end (&builder); |
| 15410 | } |
| 15411 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15412 | static gboolean _control_host_emit_changed (gpointer user_data); |
| 15413 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15414 | static void |
| 15415 | control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 15416 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15417 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); |
| 15418 | gboolean emit_changed = FALSE; |
| 15419 | |
| 15420 | g_mutex_lock (&skeleton->priv->lock); |
| 15421 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15422 | { |
| 15423 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15424 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15425 | emit_changed = TRUE; |
| 15426 | } |
| 15427 | g_mutex_unlock (&skeleton->priv->lock); |
| 15428 | |
| 15429 | if (emit_changed) |
| 15430 | _control_host_emit_changed (skeleton); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15431 | } |
| 15432 | |
| 15433 | static void |
| 15434 | _control_host_on_signal_booted ( |
| 15435 | ControlHost *object) |
| 15436 | { |
| 15437 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15438 | |
| 15439 | GList *connections, *l; |
| 15440 | GVariant *signal_variant; |
| 15441 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15442 | |
| 15443 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 15444 | for (l = connections; l != NULL; l = l->next) |
| 15445 | { |
| 15446 | GDBusConnection *connection = l->data; |
| 15447 | g_dbus_connection_emit_signal (connection, |
| 15448 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted", |
| 15449 | signal_variant, NULL); |
| 15450 | } |
| 15451 | g_variant_unref (signal_variant); |
| 15452 | g_list_free_full (connections, g_object_unref); |
| 15453 | } |
| 15454 | |
| 15455 | static void control_host_skeleton_iface_init (ControlHostIface *iface); |
| 15456 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15457 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15458 | G_ADD_PRIVATE (ControlHostSkeleton) |
| 15459 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 15460 | |
| 15461 | #else |
| 15462 | G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 15463 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); |
| 15464 | |
| 15465 | #endif |
| 15466 | static void |
| 15467 | control_host_skeleton_finalize (GObject *object) |
| 15468 | { |
| 15469 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15470 | guint n; |
| 15471 | for (n = 0; n < 2; n++) |
| 15472 | g_value_unset (&skeleton->priv->properties[n]); |
| 15473 | g_free (skeleton->priv->properties); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15474 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15475 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 15476 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 15477 | g_main_context_unref (skeleton->priv->context); |
| 15478 | g_mutex_clear (&skeleton->priv->lock); |
| 15479 | G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object); |
| 15480 | } |
| 15481 | |
| 15482 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15483 | control_host_skeleton_get_property (GObject *object, |
| 15484 | guint prop_id, |
| 15485 | GValue *value, |
| 15486 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15487 | { |
| 15488 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15489 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 15490 | g_mutex_lock (&skeleton->priv->lock); |
| 15491 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 15492 | g_mutex_unlock (&skeleton->priv->lock); |
| 15493 | } |
| 15494 | |
| 15495 | static gboolean |
| 15496 | _control_host_emit_changed (gpointer user_data) |
| 15497 | { |
| 15498 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); |
| 15499 | GList *l; |
| 15500 | GVariantBuilder builder; |
| 15501 | GVariantBuilder invalidated_builder; |
| 15502 | guint num_changes; |
| 15503 | |
| 15504 | g_mutex_lock (&skeleton->priv->lock); |
| 15505 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 15506 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 15507 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 15508 | { |
| 15509 | ChangedProperty *cp = l->data; |
| 15510 | GVariant *variant; |
| 15511 | const GValue *cur_value; |
| 15512 | |
| 15513 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 15514 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 15515 | { |
| 15516 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 15517 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 15518 | g_variant_unref (variant); |
| 15519 | num_changes++; |
| 15520 | } |
| 15521 | } |
| 15522 | if (num_changes > 0) |
| 15523 | { |
| 15524 | GList *connections, *ll; |
| 15525 | GVariant *signal_variant; |
| 15526 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host", |
| 15527 | &builder, &invalidated_builder)); |
| 15528 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 15529 | for (ll = connections; ll != NULL; ll = ll->next) |
| 15530 | { |
| 15531 | GDBusConnection *connection = ll->data; |
| 15532 | |
| 15533 | g_dbus_connection_emit_signal (connection, |
| 15534 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 15535 | "org.freedesktop.DBus.Properties", |
| 15536 | "PropertiesChanged", |
| 15537 | signal_variant, |
| 15538 | NULL); |
| 15539 | } |
| 15540 | g_variant_unref (signal_variant); |
| 15541 | g_list_free_full (connections, g_object_unref); |
| 15542 | } |
| 15543 | else |
| 15544 | { |
| 15545 | g_variant_builder_clear (&builder); |
| 15546 | g_variant_builder_clear (&invalidated_builder); |
| 15547 | } |
| 15548 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 15549 | skeleton->priv->changed_properties = NULL; |
| 15550 | skeleton->priv->changed_properties_idle_source = NULL; |
| 15551 | g_mutex_unlock (&skeleton->priv->lock); |
| 15552 | return FALSE; |
| 15553 | } |
| 15554 | |
| 15555 | static void |
| 15556 | _control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 15557 | { |
| 15558 | ChangedProperty *cp; |
| 15559 | GList *l; |
| 15560 | cp = NULL; |
| 15561 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 15562 | { |
| 15563 | ChangedProperty *i_cp = l->data; |
| 15564 | if (i_cp->info == info) |
| 15565 | { |
| 15566 | cp = i_cp; |
| 15567 | break; |
| 15568 | } |
| 15569 | } |
| 15570 | if (cp == NULL) |
| 15571 | { |
| 15572 | cp = g_new0 (ChangedProperty, 1); |
| 15573 | cp->prop_id = prop_id; |
| 15574 | cp->info = info; |
| 15575 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 15576 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 15577 | g_value_copy (orig_value, &cp->orig_value); |
| 15578 | } |
| 15579 | } |
| 15580 | |
| 15581 | static void |
| 15582 | control_host_skeleton_notify (GObject *object, |
| 15583 | GParamSpec *pspec G_GNUC_UNUSED) |
| 15584 | { |
| 15585 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15586 | g_mutex_lock (&skeleton->priv->lock); |
| 15587 | if (skeleton->priv->changed_properties != NULL && |
| 15588 | skeleton->priv->changed_properties_idle_source == NULL) |
| 15589 | { |
| 15590 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 15591 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 15592 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 15593 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 15594 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 15595 | } |
| 15596 | g_mutex_unlock (&skeleton->priv->lock); |
| 15597 | } |
| 15598 | |
| 15599 | static void |
| 15600 | control_host_skeleton_set_property (GObject *object, |
| 15601 | guint prop_id, |
| 15602 | const GValue *value, |
| 15603 | GParamSpec *pspec) |
| 15604 | { |
| 15605 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15606 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 15607 | g_mutex_lock (&skeleton->priv->lock); |
| 15608 | g_object_freeze_notify (object); |
| 15609 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 15610 | { |
| 15611 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 15612 | _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 15613 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 15614 | g_object_notify_by_pspec (object, pspec); |
| 15615 | } |
| 15616 | g_mutex_unlock (&skeleton->priv->lock); |
| 15617 | g_object_thaw_notify (object); |
| 15618 | } |
| 15619 | |
| 15620 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15621 | control_host_skeleton_init (ControlHostSkeleton *skeleton) |
| 15622 | { |
| 15623 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 15624 | skeleton->priv = control_host_skeleton_get_instance_private (skeleton); |
| 15625 | #else |
| 15626 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate); |
| 15627 | #endif |
| 15628 | |
| 15629 | g_mutex_init (&skeleton->priv->lock); |
| 15630 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15631 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 15632 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 15633 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 15634 | } |
| 15635 | |
| 15636 | static gint |
| 15637 | control_host_skeleton_get_debug_mode (ControlHost *object) |
| 15638 | { |
| 15639 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15640 | gint value; |
| 15641 | g_mutex_lock (&skeleton->priv->lock); |
| 15642 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 15643 | g_mutex_unlock (&skeleton->priv->lock); |
| 15644 | return value; |
| 15645 | } |
| 15646 | |
| 15647 | static const gchar * |
| 15648 | control_host_skeleton_get_flash_side (ControlHost *object) |
| 15649 | { |
| 15650 | ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); |
| 15651 | const gchar *value; |
| 15652 | g_mutex_lock (&skeleton->priv->lock); |
| 15653 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 15654 | g_mutex_unlock (&skeleton->priv->lock); |
| 15655 | return value; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15656 | } |
| 15657 | |
| 15658 | static void |
| 15659 | control_host_skeleton_class_init (ControlHostSkeletonClass *klass) |
| 15660 | { |
| 15661 | GObjectClass *gobject_class; |
| 15662 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 15663 | |
| 15664 | gobject_class = G_OBJECT_CLASS (klass); |
| 15665 | gobject_class->finalize = control_host_skeleton_finalize; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15666 | gobject_class->get_property = control_host_skeleton_get_property; |
| 15667 | gobject_class->set_property = control_host_skeleton_set_property; |
| 15668 | gobject_class->notify = control_host_skeleton_notify; |
| 15669 | |
| 15670 | |
| 15671 | control_host_override_properties (gobject_class, 1); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15672 | |
| 15673 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 15674 | skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info; |
| 15675 | skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties; |
| 15676 | skeleton_class->flush = control_host_skeleton_dbus_interface_flush; |
| 15677 | skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable; |
| 15678 | |
| 15679 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 15680 | g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate)); |
| 15681 | #endif |
| 15682 | } |
| 15683 | |
| 15684 | static void |
| 15685 | control_host_skeleton_iface_init (ControlHostIface *iface) |
| 15686 | { |
| 15687 | iface->booted = _control_host_on_signal_booted; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 15688 | iface->get_debug_mode = control_host_skeleton_get_debug_mode; |
| 15689 | iface->get_flash_side = control_host_skeleton_get_flash_side; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15690 | } |
| 15691 | |
| 15692 | /** |
| 15693 | * control_host_skeleton_new: |
| 15694 | * |
| 15695 | * 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>. |
| 15696 | * |
| 15697 | * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object. |
| 15698 | */ |
| 15699 | ControlHost * |
| 15700 | control_host_skeleton_new (void) |
| 15701 | { |
| 15702 | return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL)); |
| 15703 | } |
| 15704 | |
| 15705 | /* ------------------------------------------------------------------------ |
| 15706 | * Code for interface org.openbmc.control.Power |
| 15707 | * ------------------------------------------------------------------------ |
| 15708 | */ |
| 15709 | |
| 15710 | /** |
| 15711 | * SECTION:ControlPower |
| 15712 | * @title: ControlPower |
| 15713 | * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface |
| 15714 | * |
| 15715 | * 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. |
| 15716 | */ |
| 15717 | |
| 15718 | /* ---- Introspection data for org.openbmc.control.Power ---- */ |
| 15719 | |
| 15720 | static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state = |
| 15721 | { |
| 15722 | { |
| 15723 | -1, |
| 15724 | (gchar *) "state", |
| 15725 | (gchar *) "i", |
| 15726 | NULL |
| 15727 | }, |
| 15728 | FALSE |
| 15729 | }; |
| 15730 | |
| 15731 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] = |
| 15732 | { |
| 15733 | &_control_power_method_info_set_power_state_IN_ARG_state, |
| 15734 | NULL |
| 15735 | }; |
| 15736 | |
| 15737 | static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state = |
| 15738 | { |
| 15739 | { |
| 15740 | -1, |
| 15741 | (gchar *) "setPowerState", |
| 15742 | (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers, |
| 15743 | NULL, |
| 15744 | NULL |
| 15745 | }, |
| 15746 | "handle-set-power-state", |
| 15747 | FALSE |
| 15748 | }; |
| 15749 | |
| 15750 | static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state = |
| 15751 | { |
| 15752 | { |
| 15753 | -1, |
| 15754 | (gchar *) "state", |
| 15755 | (gchar *) "i", |
| 15756 | NULL |
| 15757 | }, |
| 15758 | FALSE |
| 15759 | }; |
| 15760 | |
| 15761 | static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] = |
| 15762 | { |
| 15763 | &_control_power_method_info_get_power_state_OUT_ARG_state, |
| 15764 | NULL |
| 15765 | }; |
| 15766 | |
| 15767 | static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state = |
| 15768 | { |
| 15769 | { |
| 15770 | -1, |
| 15771 | (gchar *) "getPowerState", |
| 15772 | NULL, |
| 15773 | (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers, |
| 15774 | NULL |
| 15775 | }, |
| 15776 | "handle-get-power-state", |
| 15777 | FALSE |
| 15778 | }; |
| 15779 | |
| 15780 | static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] = |
| 15781 | { |
| 15782 | &_control_power_method_info_set_power_state, |
| 15783 | &_control_power_method_info_get_power_state, |
| 15784 | NULL |
| 15785 | }; |
| 15786 | |
| 15787 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good = |
| 15788 | { |
| 15789 | { |
| 15790 | -1, |
| 15791 | (gchar *) "PowerGood", |
| 15792 | NULL, |
| 15793 | NULL |
| 15794 | }, |
| 15795 | "power-good" |
| 15796 | }; |
| 15797 | |
| 15798 | static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost = |
| 15799 | { |
| 15800 | { |
| 15801 | -1, |
| 15802 | (gchar *) "PowerLost", |
| 15803 | NULL, |
| 15804 | NULL |
| 15805 | }, |
| 15806 | "power-lost" |
| 15807 | }; |
| 15808 | |
| 15809 | static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] = |
| 15810 | { |
| 15811 | &_control_power_signal_info_power_good, |
| 15812 | &_control_power_signal_info_power_lost, |
| 15813 | NULL |
| 15814 | }; |
| 15815 | |
| 15816 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood = |
| 15817 | { |
| 15818 | { |
| 15819 | -1, |
| 15820 | (gchar *) "pgood", |
| 15821 | (gchar *) "i", |
| 15822 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 15823 | NULL |
| 15824 | }, |
| 15825 | "pgood", |
| 15826 | FALSE |
| 15827 | }; |
| 15828 | |
| 15829 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_state = |
| 15830 | { |
| 15831 | { |
| 15832 | -1, |
| 15833 | (gchar *) "state", |
| 15834 | (gchar *) "i", |
| 15835 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 15836 | NULL |
| 15837 | }, |
| 15838 | "state", |
| 15839 | FALSE |
| 15840 | }; |
| 15841 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15842 | static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout = |
| 15843 | { |
| 15844 | { |
| 15845 | -1, |
| 15846 | (gchar *) "pgood_timeout", |
| 15847 | (gchar *) "i", |
| 15848 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 15849 | NULL |
| 15850 | }, |
| 15851 | "pgood-timeout", |
| 15852 | FALSE |
| 15853 | }; |
| 15854 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15855 | static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] = |
| 15856 | { |
| 15857 | &_control_power_property_info_pgood, |
| 15858 | &_control_power_property_info_state, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15859 | &_control_power_property_info_pgood_timeout, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15860 | NULL |
| 15861 | }; |
| 15862 | |
| 15863 | static const _ExtendedGDBusInterfaceInfo _control_power_interface_info = |
| 15864 | { |
| 15865 | { |
| 15866 | -1, |
| 15867 | (gchar *) "org.openbmc.control.Power", |
| 15868 | (GDBusMethodInfo **) &_control_power_method_info_pointers, |
| 15869 | (GDBusSignalInfo **) &_control_power_signal_info_pointers, |
| 15870 | (GDBusPropertyInfo **) &_control_power_property_info_pointers, |
| 15871 | NULL |
| 15872 | }, |
| 15873 | "control-power", |
| 15874 | }; |
| 15875 | |
| 15876 | |
| 15877 | /** |
| 15878 | * control_power_interface_info: |
| 15879 | * |
| 15880 | * 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. |
| 15881 | * |
| 15882 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 15883 | */ |
| 15884 | GDBusInterfaceInfo * |
| 15885 | control_power_interface_info (void) |
| 15886 | { |
| 15887 | return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct; |
| 15888 | } |
| 15889 | |
| 15890 | /** |
| 15891 | * control_power_override_properties: |
| 15892 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 15893 | * @property_id_begin: The property id to assign to the first overridden property. |
| 15894 | * |
| 15895 | * Overrides all #GObject properties in the #ControlPower interface for a concrete class. |
| 15896 | * The properties are overridden in the order they are defined. |
| 15897 | * |
| 15898 | * Returns: The last property id. |
| 15899 | */ |
| 15900 | guint |
| 15901 | control_power_override_properties (GObjectClass *klass, guint property_id_begin) |
| 15902 | { |
| 15903 | g_object_class_override_property (klass, property_id_begin++, "pgood"); |
| 15904 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15905 | g_object_class_override_property (klass, property_id_begin++, "pgood-timeout"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15906 | return property_id_begin - 1; |
| 15907 | } |
| 15908 | |
| 15909 | |
| 15910 | |
| 15911 | /** |
| 15912 | * ControlPower: |
| 15913 | * |
| 15914 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 15915 | */ |
| 15916 | |
| 15917 | /** |
| 15918 | * ControlPowerIface: |
| 15919 | * @parent_iface: The parent interface. |
| 15920 | * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal. |
| 15921 | * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal. |
| 15922 | * @get_pgood: Getter for the #ControlPower:pgood property. |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 15923 | * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 15924 | * @get_state: Getter for the #ControlPower:state property. |
| 15925 | * @power_good: Handler for the #ControlPower::power-good signal. |
| 15926 | * @power_lost: Handler for the #ControlPower::power-lost signal. |
| 15927 | * |
| 15928 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. |
| 15929 | */ |
| 15930 | |
| 15931 | typedef ControlPowerIface ControlPowerInterface; |
| 15932 | G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT); |
| 15933 | |
| 15934 | static void |
| 15935 | control_power_default_init (ControlPowerIface *iface) |
| 15936 | { |
| 15937 | /* GObject signals for incoming D-Bus method calls: */ |
| 15938 | /** |
| 15939 | * ControlPower::handle-set-power-state: |
| 15940 | * @object: A #ControlPower. |
| 15941 | * @invocation: A #GDBusMethodInvocation. |
| 15942 | * @arg_state: Argument passed by remote caller. |
| 15943 | * |
| 15944 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. |
| 15945 | * |
| 15946 | * 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. |
| 15947 | * |
| 15948 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 15949 | */ |
| 15950 | g_signal_new ("handle-set-power-state", |
| 15951 | G_TYPE_FROM_INTERFACE (iface), |
| 15952 | G_SIGNAL_RUN_LAST, |
| 15953 | G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state), |
| 15954 | g_signal_accumulator_true_handled, |
| 15955 | NULL, |
| 15956 | g_cclosure_marshal_generic, |
| 15957 | G_TYPE_BOOLEAN, |
| 15958 | 2, |
| 15959 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 15960 | |
| 15961 | /** |
| 15962 | * ControlPower::handle-get-power-state: |
| 15963 | * @object: A #ControlPower. |
| 15964 | * @invocation: A #GDBusMethodInvocation. |
| 15965 | * |
| 15966 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. |
| 15967 | * |
| 15968 | * 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. |
| 15969 | * |
| 15970 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 15971 | */ |
| 15972 | g_signal_new ("handle-get-power-state", |
| 15973 | G_TYPE_FROM_INTERFACE (iface), |
| 15974 | G_SIGNAL_RUN_LAST, |
| 15975 | G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state), |
| 15976 | g_signal_accumulator_true_handled, |
| 15977 | NULL, |
| 15978 | g_cclosure_marshal_generic, |
| 15979 | G_TYPE_BOOLEAN, |
| 15980 | 1, |
| 15981 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 15982 | |
| 15983 | /* GObject signals for received D-Bus signals: */ |
| 15984 | /** |
| 15985 | * ControlPower::power-good: |
| 15986 | * @object: A #ControlPower. |
| 15987 | * |
| 15988 | * 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. |
| 15989 | * |
| 15990 | * 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. |
| 15991 | */ |
| 15992 | g_signal_new ("power-good", |
| 15993 | G_TYPE_FROM_INTERFACE (iface), |
| 15994 | G_SIGNAL_RUN_LAST, |
| 15995 | G_STRUCT_OFFSET (ControlPowerIface, power_good), |
| 15996 | NULL, |
| 15997 | NULL, |
| 15998 | g_cclosure_marshal_generic, |
| 15999 | G_TYPE_NONE, |
| 16000 | 0); |
| 16001 | |
| 16002 | /** |
| 16003 | * ControlPower::power-lost: |
| 16004 | * @object: A #ControlPower. |
| 16005 | * |
| 16006 | * 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. |
| 16007 | * |
| 16008 | * 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. |
| 16009 | */ |
| 16010 | g_signal_new ("power-lost", |
| 16011 | G_TYPE_FROM_INTERFACE (iface), |
| 16012 | G_SIGNAL_RUN_LAST, |
| 16013 | G_STRUCT_OFFSET (ControlPowerIface, power_lost), |
| 16014 | NULL, |
| 16015 | NULL, |
| 16016 | g_cclosure_marshal_generic, |
| 16017 | G_TYPE_NONE, |
| 16018 | 0); |
| 16019 | |
| 16020 | /* GObject properties for D-Bus properties: */ |
| 16021 | /** |
| 16022 | * ControlPower:pgood: |
| 16023 | * |
| 16024 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>. |
| 16025 | * |
| 16026 | * 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. |
| 16027 | */ |
| 16028 | g_object_interface_install_property (iface, |
| 16029 | g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 16030 | /** |
| 16031 | * ControlPower:state: |
| 16032 | * |
| 16033 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>. |
| 16034 | * |
| 16035 | * 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. |
| 16036 | */ |
| 16037 | g_object_interface_install_property (iface, |
| 16038 | 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] | 16039 | /** |
| 16040 | * ControlPower:pgood-timeout: |
| 16041 | * |
| 16042 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>. |
| 16043 | * |
| 16044 | * 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. |
| 16045 | */ |
| 16046 | g_object_interface_install_property (iface, |
| 16047 | 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] | 16048 | } |
| 16049 | |
| 16050 | /** |
| 16051 | * control_power_get_pgood: (skip) |
| 16052 | * @object: A #ControlPower. |
| 16053 | * |
| 16054 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property. |
| 16055 | * |
| 16056 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 16057 | * |
| 16058 | * Returns: The property value. |
| 16059 | */ |
| 16060 | gint |
| 16061 | control_power_get_pgood (ControlPower *object) |
| 16062 | { |
| 16063 | return CONTROL_POWER_GET_IFACE (object)->get_pgood (object); |
| 16064 | } |
| 16065 | |
| 16066 | /** |
| 16067 | * control_power_set_pgood: (skip) |
| 16068 | * @object: A #ControlPower. |
| 16069 | * @value: The value to set. |
| 16070 | * |
| 16071 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value. |
| 16072 | * |
| 16073 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 16074 | */ |
| 16075 | void |
| 16076 | control_power_set_pgood (ControlPower *object, gint value) |
| 16077 | { |
| 16078 | g_object_set (G_OBJECT (object), "pgood", value, NULL); |
| 16079 | } |
| 16080 | |
| 16081 | /** |
| 16082 | * control_power_get_state: (skip) |
| 16083 | * @object: A #ControlPower. |
| 16084 | * |
| 16085 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property. |
| 16086 | * |
| 16087 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 16088 | * |
| 16089 | * Returns: The property value. |
| 16090 | */ |
| 16091 | gint |
| 16092 | control_power_get_state (ControlPower *object) |
| 16093 | { |
| 16094 | return CONTROL_POWER_GET_IFACE (object)->get_state (object); |
| 16095 | } |
| 16096 | |
| 16097 | /** |
| 16098 | * control_power_set_state: (skip) |
| 16099 | * @object: A #ControlPower. |
| 16100 | * @value: The value to set. |
| 16101 | * |
| 16102 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value. |
| 16103 | * |
| 16104 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 16105 | */ |
| 16106 | void |
| 16107 | control_power_set_state (ControlPower *object, gint value) |
| 16108 | { |
| 16109 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 16110 | } |
| 16111 | |
| 16112 | /** |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16113 | * control_power_get_pgood_timeout: (skip) |
| 16114 | * @object: A #ControlPower. |
| 16115 | * |
| 16116 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property. |
| 16117 | * |
| 16118 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16119 | * |
| 16120 | * Returns: The property value. |
| 16121 | */ |
| 16122 | gint |
| 16123 | control_power_get_pgood_timeout (ControlPower *object) |
| 16124 | { |
| 16125 | return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object); |
| 16126 | } |
| 16127 | |
| 16128 | /** |
| 16129 | * control_power_set_pgood_timeout: (skip) |
| 16130 | * @object: A #ControlPower. |
| 16131 | * @value: The value to set. |
| 16132 | * |
| 16133 | * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value. |
| 16134 | * |
| 16135 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 16136 | */ |
| 16137 | void |
| 16138 | control_power_set_pgood_timeout (ControlPower *object, gint value) |
| 16139 | { |
| 16140 | g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL); |
| 16141 | } |
| 16142 | |
| 16143 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16144 | * control_power_emit_power_good: |
| 16145 | * @object: A #ControlPower. |
| 16146 | * |
| 16147 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal. |
| 16148 | */ |
| 16149 | void |
| 16150 | control_power_emit_power_good ( |
| 16151 | ControlPower *object) |
| 16152 | { |
| 16153 | g_signal_emit_by_name (object, "power-good"); |
| 16154 | } |
| 16155 | |
| 16156 | /** |
| 16157 | * control_power_emit_power_lost: |
| 16158 | * @object: A #ControlPower. |
| 16159 | * |
| 16160 | * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal. |
| 16161 | */ |
| 16162 | void |
| 16163 | control_power_emit_power_lost ( |
| 16164 | ControlPower *object) |
| 16165 | { |
| 16166 | g_signal_emit_by_name (object, "power-lost"); |
| 16167 | } |
| 16168 | |
| 16169 | /** |
| 16170 | * control_power_call_set_power_state: |
| 16171 | * @proxy: A #ControlPowerProxy. |
| 16172 | * @arg_state: Argument to pass with the method invocation. |
| 16173 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16174 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16175 | * @user_data: User data to pass to @callback. |
| 16176 | * |
| 16177 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. |
| 16178 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 16179 | * You can then call control_power_call_set_power_state_finish() to get the result of the operation. |
| 16180 | * |
| 16181 | * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method. |
| 16182 | */ |
| 16183 | void |
| 16184 | control_power_call_set_power_state ( |
| 16185 | ControlPower *proxy, |
| 16186 | gint arg_state, |
| 16187 | GCancellable *cancellable, |
| 16188 | GAsyncReadyCallback callback, |
| 16189 | gpointer user_data) |
| 16190 | { |
| 16191 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16192 | "setPowerState", |
| 16193 | g_variant_new ("(i)", |
| 16194 | arg_state), |
| 16195 | G_DBUS_CALL_FLAGS_NONE, |
| 16196 | -1, |
| 16197 | cancellable, |
| 16198 | callback, |
| 16199 | user_data); |
| 16200 | } |
| 16201 | |
| 16202 | /** |
| 16203 | * control_power_call_set_power_state_finish: |
| 16204 | * @proxy: A #ControlPowerProxy. |
| 16205 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state(). |
| 16206 | * @error: Return location for error or %NULL. |
| 16207 | * |
| 16208 | * Finishes an operation started with control_power_call_set_power_state(). |
| 16209 | * |
| 16210 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16211 | */ |
| 16212 | gboolean |
| 16213 | control_power_call_set_power_state_finish ( |
| 16214 | ControlPower *proxy, |
| 16215 | GAsyncResult *res, |
| 16216 | GError **error) |
| 16217 | { |
| 16218 | GVariant *_ret; |
| 16219 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16220 | if (_ret == NULL) |
| 16221 | goto _out; |
| 16222 | g_variant_get (_ret, |
| 16223 | "()"); |
| 16224 | g_variant_unref (_ret); |
| 16225 | _out: |
| 16226 | return _ret != NULL; |
| 16227 | } |
| 16228 | |
| 16229 | /** |
| 16230 | * control_power_call_set_power_state_sync: |
| 16231 | * @proxy: A #ControlPowerProxy. |
| 16232 | * @arg_state: Argument to pass with the method invocation. |
| 16233 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16234 | * @error: Return location for error or %NULL. |
| 16235 | * |
| 16236 | * 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. |
| 16237 | * |
| 16238 | * See control_power_call_set_power_state() for the asynchronous version of this method. |
| 16239 | * |
| 16240 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16241 | */ |
| 16242 | gboolean |
| 16243 | control_power_call_set_power_state_sync ( |
| 16244 | ControlPower *proxy, |
| 16245 | gint arg_state, |
| 16246 | GCancellable *cancellable, |
| 16247 | GError **error) |
| 16248 | { |
| 16249 | GVariant *_ret; |
| 16250 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16251 | "setPowerState", |
| 16252 | g_variant_new ("(i)", |
| 16253 | arg_state), |
| 16254 | G_DBUS_CALL_FLAGS_NONE, |
| 16255 | -1, |
| 16256 | cancellable, |
| 16257 | error); |
| 16258 | if (_ret == NULL) |
| 16259 | goto _out; |
| 16260 | g_variant_get (_ret, |
| 16261 | "()"); |
| 16262 | g_variant_unref (_ret); |
| 16263 | _out: |
| 16264 | return _ret != NULL; |
| 16265 | } |
| 16266 | |
| 16267 | /** |
| 16268 | * control_power_call_get_power_state: |
| 16269 | * @proxy: A #ControlPowerProxy. |
| 16270 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16271 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 16272 | * @user_data: User data to pass to @callback. |
| 16273 | * |
| 16274 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. |
| 16275 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 16276 | * You can then call control_power_call_get_power_state_finish() to get the result of the operation. |
| 16277 | * |
| 16278 | * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method. |
| 16279 | */ |
| 16280 | void |
| 16281 | control_power_call_get_power_state ( |
| 16282 | ControlPower *proxy, |
| 16283 | GCancellable *cancellable, |
| 16284 | GAsyncReadyCallback callback, |
| 16285 | gpointer user_data) |
| 16286 | { |
| 16287 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 16288 | "getPowerState", |
| 16289 | g_variant_new ("()"), |
| 16290 | G_DBUS_CALL_FLAGS_NONE, |
| 16291 | -1, |
| 16292 | cancellable, |
| 16293 | callback, |
| 16294 | user_data); |
| 16295 | } |
| 16296 | |
| 16297 | /** |
| 16298 | * control_power_call_get_power_state_finish: |
| 16299 | * @proxy: A #ControlPowerProxy. |
| 16300 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 16301 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state(). |
| 16302 | * @error: Return location for error or %NULL. |
| 16303 | * |
| 16304 | * Finishes an operation started with control_power_call_get_power_state(). |
| 16305 | * |
| 16306 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16307 | */ |
| 16308 | gboolean |
| 16309 | control_power_call_get_power_state_finish ( |
| 16310 | ControlPower *proxy, |
| 16311 | gint *out_state, |
| 16312 | GAsyncResult *res, |
| 16313 | GError **error) |
| 16314 | { |
| 16315 | GVariant *_ret; |
| 16316 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 16317 | if (_ret == NULL) |
| 16318 | goto _out; |
| 16319 | g_variant_get (_ret, |
| 16320 | "(i)", |
| 16321 | out_state); |
| 16322 | g_variant_unref (_ret); |
| 16323 | _out: |
| 16324 | return _ret != NULL; |
| 16325 | } |
| 16326 | |
| 16327 | /** |
| 16328 | * control_power_call_get_power_state_sync: |
| 16329 | * @proxy: A #ControlPowerProxy. |
| 16330 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 16331 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16332 | * @error: Return location for error or %NULL. |
| 16333 | * |
| 16334 | * 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. |
| 16335 | * |
| 16336 | * See control_power_call_get_power_state() for the asynchronous version of this method. |
| 16337 | * |
| 16338 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 16339 | */ |
| 16340 | gboolean |
| 16341 | control_power_call_get_power_state_sync ( |
| 16342 | ControlPower *proxy, |
| 16343 | gint *out_state, |
| 16344 | GCancellable *cancellable, |
| 16345 | GError **error) |
| 16346 | { |
| 16347 | GVariant *_ret; |
| 16348 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 16349 | "getPowerState", |
| 16350 | g_variant_new ("()"), |
| 16351 | G_DBUS_CALL_FLAGS_NONE, |
| 16352 | -1, |
| 16353 | cancellable, |
| 16354 | error); |
| 16355 | if (_ret == NULL) |
| 16356 | goto _out; |
| 16357 | g_variant_get (_ret, |
| 16358 | "(i)", |
| 16359 | out_state); |
| 16360 | g_variant_unref (_ret); |
| 16361 | _out: |
| 16362 | return _ret != NULL; |
| 16363 | } |
| 16364 | |
| 16365 | /** |
| 16366 | * control_power_complete_set_power_state: |
| 16367 | * @object: A #ControlPower. |
| 16368 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16369 | * |
| 16370 | * 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. |
| 16371 | * |
| 16372 | * This method will free @invocation, you cannot use it afterwards. |
| 16373 | */ |
| 16374 | void |
| 16375 | control_power_complete_set_power_state ( |
| 16376 | ControlPower *object, |
| 16377 | GDBusMethodInvocation *invocation) |
| 16378 | { |
| 16379 | g_dbus_method_invocation_return_value (invocation, |
| 16380 | g_variant_new ("()")); |
| 16381 | } |
| 16382 | |
| 16383 | /** |
| 16384 | * control_power_complete_get_power_state: |
| 16385 | * @object: A #ControlPower. |
| 16386 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 16387 | * @state: Parameter to return. |
| 16388 | * |
| 16389 | * 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. |
| 16390 | * |
| 16391 | * This method will free @invocation, you cannot use it afterwards. |
| 16392 | */ |
| 16393 | void |
| 16394 | control_power_complete_get_power_state ( |
| 16395 | ControlPower *object, |
| 16396 | GDBusMethodInvocation *invocation, |
| 16397 | gint state) |
| 16398 | { |
| 16399 | g_dbus_method_invocation_return_value (invocation, |
| 16400 | g_variant_new ("(i)", |
| 16401 | state)); |
| 16402 | } |
| 16403 | |
| 16404 | /* ------------------------------------------------------------------------ */ |
| 16405 | |
| 16406 | /** |
| 16407 | * ControlPowerProxy: |
| 16408 | * |
| 16409 | * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API. |
| 16410 | */ |
| 16411 | |
| 16412 | /** |
| 16413 | * ControlPowerProxyClass: |
| 16414 | * @parent_class: The parent class. |
| 16415 | * |
| 16416 | * Class structure for #ControlPowerProxy. |
| 16417 | */ |
| 16418 | |
| 16419 | struct _ControlPowerProxyPrivate |
| 16420 | { |
| 16421 | GData *qdata; |
| 16422 | }; |
| 16423 | |
| 16424 | static void control_power_proxy_iface_init (ControlPowerIface *iface); |
| 16425 | |
| 16426 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16427 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 16428 | G_ADD_PRIVATE (ControlPowerProxy) |
| 16429 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 16430 | |
| 16431 | #else |
| 16432 | G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, |
| 16433 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); |
| 16434 | |
| 16435 | #endif |
| 16436 | static void |
| 16437 | control_power_proxy_finalize (GObject *object) |
| 16438 | { |
| 16439 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 16440 | g_datalist_clear (&proxy->priv->qdata); |
| 16441 | G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object); |
| 16442 | } |
| 16443 | |
| 16444 | static void |
| 16445 | control_power_proxy_get_property (GObject *object, |
| 16446 | guint prop_id, |
| 16447 | GValue *value, |
| 16448 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16449 | { |
| 16450 | const _ExtendedGDBusPropertyInfo *info; |
| 16451 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16452 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16453 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 16454 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 16455 | if (info->use_gvariant) |
| 16456 | { |
| 16457 | g_value_set_variant (value, variant); |
| 16458 | } |
| 16459 | else |
| 16460 | { |
| 16461 | if (variant != NULL) |
| 16462 | g_dbus_gvariant_to_gvalue (variant, value); |
| 16463 | } |
| 16464 | if (variant != NULL) |
| 16465 | g_variant_unref (variant); |
| 16466 | } |
| 16467 | |
| 16468 | static void |
| 16469 | control_power_proxy_set_property_cb (GDBusProxy *proxy, |
| 16470 | GAsyncResult *res, |
| 16471 | gpointer user_data) |
| 16472 | { |
| 16473 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 16474 | GError *error; |
| 16475 | GVariant *_ret; |
| 16476 | error = NULL; |
| 16477 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 16478 | if (!_ret) |
| 16479 | { |
| 16480 | g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)", |
| 16481 | info->parent_struct.name, |
| 16482 | error->message, g_quark_to_string (error->domain), error->code); |
| 16483 | g_error_free (error); |
| 16484 | } |
| 16485 | else |
| 16486 | { |
| 16487 | g_variant_unref (_ret); |
| 16488 | } |
| 16489 | } |
| 16490 | |
| 16491 | static void |
| 16492 | control_power_proxy_set_property (GObject *object, |
| 16493 | guint prop_id, |
| 16494 | const GValue *value, |
| 16495 | GParamSpec *pspec G_GNUC_UNUSED) |
| 16496 | { |
| 16497 | const _ExtendedGDBusPropertyInfo *info; |
| 16498 | GVariant *variant; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16499 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16500 | info = _control_power_property_info_pointers[prop_id - 1]; |
| 16501 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16502 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 16503 | "org.freedesktop.DBus.Properties.Set", |
| 16504 | g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant), |
| 16505 | G_DBUS_CALL_FLAGS_NONE, |
| 16506 | -1, |
| 16507 | NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 16508 | g_variant_unref (variant); |
| 16509 | } |
| 16510 | |
| 16511 | static void |
| 16512 | control_power_proxy_g_signal (GDBusProxy *proxy, |
| 16513 | const gchar *sender_name G_GNUC_UNUSED, |
| 16514 | const gchar *signal_name, |
| 16515 | GVariant *parameters) |
| 16516 | { |
| 16517 | _ExtendedGDBusSignalInfo *info; |
| 16518 | GVariantIter iter; |
| 16519 | GVariant *child; |
| 16520 | GValue *paramv; |
| 16521 | guint num_params; |
| 16522 | guint n; |
| 16523 | guint signal_id; |
| 16524 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name); |
| 16525 | if (info == NULL) |
| 16526 | return; |
| 16527 | num_params = g_variant_n_children (parameters); |
| 16528 | paramv = g_new0 (GValue, num_params + 1); |
| 16529 | g_value_init (¶mv[0], TYPE_CONTROL_POWER); |
| 16530 | g_value_set_object (¶mv[0], proxy); |
| 16531 | g_variant_iter_init (&iter, parameters); |
| 16532 | n = 1; |
| 16533 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16534 | { |
| 16535 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 16536 | if (arg_info->use_gvariant) |
| 16537 | { |
| 16538 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16539 | g_value_set_variant (¶mv[n], child); |
| 16540 | n++; |
| 16541 | } |
| 16542 | else |
| 16543 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16544 | g_variant_unref (child); |
| 16545 | } |
| 16546 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 16547 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 16548 | for (n = 0; n < num_params + 1; n++) |
| 16549 | g_value_unset (¶mv[n]); |
| 16550 | g_free (paramv); |
| 16551 | } |
| 16552 | |
| 16553 | static void |
| 16554 | control_power_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 16555 | GVariant *changed_properties, |
| 16556 | const gchar *const *invalidated_properties) |
| 16557 | { |
| 16558 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy); |
| 16559 | guint n; |
| 16560 | const gchar *key; |
| 16561 | GVariantIter *iter; |
| 16562 | _ExtendedGDBusPropertyInfo *info; |
| 16563 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 16564 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 16565 | { |
| 16566 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key); |
| 16567 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 16568 | if (info != NULL) |
| 16569 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16570 | } |
| 16571 | g_variant_iter_free (iter); |
| 16572 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 16573 | { |
| 16574 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]); |
| 16575 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 16576 | if (info != NULL) |
| 16577 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 16578 | } |
| 16579 | } |
| 16580 | |
| 16581 | static gint |
| 16582 | control_power_proxy_get_pgood (ControlPower *object) |
| 16583 | { |
| 16584 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 16585 | GVariant *variant; |
| 16586 | gint value = 0; |
| 16587 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood"); |
| 16588 | if (variant != NULL) |
| 16589 | { |
| 16590 | value = g_variant_get_int32 (variant); |
| 16591 | g_variant_unref (variant); |
| 16592 | } |
| 16593 | return value; |
| 16594 | } |
| 16595 | |
| 16596 | static gint |
| 16597 | control_power_proxy_get_state (ControlPower *object) |
| 16598 | { |
| 16599 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 16600 | GVariant *variant; |
| 16601 | gint value = 0; |
| 16602 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 16603 | if (variant != NULL) |
| 16604 | { |
| 16605 | value = g_variant_get_int32 (variant); |
| 16606 | g_variant_unref (variant); |
| 16607 | } |
| 16608 | return value; |
| 16609 | } |
| 16610 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16611 | static gint |
| 16612 | control_power_proxy_get_pgood_timeout (ControlPower *object) |
| 16613 | { |
| 16614 | ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); |
| 16615 | GVariant *variant; |
| 16616 | gint value = 0; |
| 16617 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout"); |
| 16618 | if (variant != NULL) |
| 16619 | { |
| 16620 | value = g_variant_get_int32 (variant); |
| 16621 | g_variant_unref (variant); |
| 16622 | } |
| 16623 | return value; |
| 16624 | } |
| 16625 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16626 | static void |
| 16627 | control_power_proxy_init (ControlPowerProxy *proxy) |
| 16628 | { |
| 16629 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 16630 | proxy->priv = control_power_proxy_get_instance_private (proxy); |
| 16631 | #else |
| 16632 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate); |
| 16633 | #endif |
| 16634 | |
| 16635 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ()); |
| 16636 | } |
| 16637 | |
| 16638 | static void |
| 16639 | control_power_proxy_class_init (ControlPowerProxyClass *klass) |
| 16640 | { |
| 16641 | GObjectClass *gobject_class; |
| 16642 | GDBusProxyClass *proxy_class; |
| 16643 | |
| 16644 | gobject_class = G_OBJECT_CLASS (klass); |
| 16645 | gobject_class->finalize = control_power_proxy_finalize; |
| 16646 | gobject_class->get_property = control_power_proxy_get_property; |
| 16647 | gobject_class->set_property = control_power_proxy_set_property; |
| 16648 | |
| 16649 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 16650 | proxy_class->g_signal = control_power_proxy_g_signal; |
| 16651 | proxy_class->g_properties_changed = control_power_proxy_g_properties_changed; |
| 16652 | |
| 16653 | control_power_override_properties (gobject_class, 1); |
| 16654 | |
| 16655 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 16656 | g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate)); |
| 16657 | #endif |
| 16658 | } |
| 16659 | |
| 16660 | static void |
| 16661 | control_power_proxy_iface_init (ControlPowerIface *iface) |
| 16662 | { |
| 16663 | iface->get_pgood = control_power_proxy_get_pgood; |
| 16664 | iface->get_state = control_power_proxy_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 16665 | iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 16666 | } |
| 16667 | |
| 16668 | /** |
| 16669 | * control_power_proxy_new: |
| 16670 | * @connection: A #GDBusConnection. |
| 16671 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16672 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 16673 | * @object_path: An object path. |
| 16674 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16675 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 16676 | * @user_data: User data to pass to @callback. |
| 16677 | * |
| 16678 | * 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. |
| 16679 | * |
| 16680 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 16681 | * You can then call control_power_proxy_new_finish() to get the result of the operation. |
| 16682 | * |
| 16683 | * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 16684 | */ |
| 16685 | void |
| 16686 | control_power_proxy_new ( |
| 16687 | GDBusConnection *connection, |
| 16688 | GDBusProxyFlags flags, |
| 16689 | const gchar *name, |
| 16690 | const gchar *object_path, |
| 16691 | GCancellable *cancellable, |
| 16692 | GAsyncReadyCallback callback, |
| 16693 | gpointer user_data) |
| 16694 | { |
| 16695 | 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); |
| 16696 | } |
| 16697 | |
| 16698 | /** |
| 16699 | * control_power_proxy_new_finish: |
| 16700 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new(). |
| 16701 | * @error: Return location for error or %NULL |
| 16702 | * |
| 16703 | * Finishes an operation started with control_power_proxy_new(). |
| 16704 | * |
| 16705 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 16706 | */ |
| 16707 | ControlPower * |
| 16708 | control_power_proxy_new_finish ( |
| 16709 | GAsyncResult *res, |
| 16710 | GError **error) |
| 16711 | { |
| 16712 | GObject *ret; |
| 16713 | GObject *source_object; |
| 16714 | source_object = g_async_result_get_source_object (res); |
| 16715 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 16716 | g_object_unref (source_object); |
| 16717 | if (ret != NULL) |
| 16718 | return CONTROL_POWER (ret); |
| 16719 | else |
| 16720 | return NULL; |
| 16721 | } |
| 16722 | |
| 16723 | /** |
| 16724 | * control_power_proxy_new_sync: |
| 16725 | * @connection: A #GDBusConnection. |
| 16726 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16727 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 16728 | * @object_path: An object path. |
| 16729 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16730 | * @error: Return location for error or %NULL |
| 16731 | * |
| 16732 | * 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. |
| 16733 | * |
| 16734 | * The calling thread is blocked until a reply is received. |
| 16735 | * |
| 16736 | * See control_power_proxy_new() for the asynchronous version of this constructor. |
| 16737 | * |
| 16738 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 16739 | */ |
| 16740 | ControlPower * |
| 16741 | control_power_proxy_new_sync ( |
| 16742 | GDBusConnection *connection, |
| 16743 | GDBusProxyFlags flags, |
| 16744 | const gchar *name, |
| 16745 | const gchar *object_path, |
| 16746 | GCancellable *cancellable, |
| 16747 | GError **error) |
| 16748 | { |
| 16749 | GInitable *ret; |
| 16750 | 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); |
| 16751 | if (ret != NULL) |
| 16752 | return CONTROL_POWER (ret); |
| 16753 | else |
| 16754 | return NULL; |
| 16755 | } |
| 16756 | |
| 16757 | |
| 16758 | /** |
| 16759 | * control_power_proxy_new_for_bus: |
| 16760 | * @bus_type: A #GBusType. |
| 16761 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16762 | * @name: A bus name (well-known or unique). |
| 16763 | * @object_path: An object path. |
| 16764 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16765 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 16766 | * @user_data: User data to pass to @callback. |
| 16767 | * |
| 16768 | * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 16769 | * |
| 16770 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 16771 | * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation. |
| 16772 | * |
| 16773 | * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 16774 | */ |
| 16775 | void |
| 16776 | control_power_proxy_new_for_bus ( |
| 16777 | GBusType bus_type, |
| 16778 | GDBusProxyFlags flags, |
| 16779 | const gchar *name, |
| 16780 | const gchar *object_path, |
| 16781 | GCancellable *cancellable, |
| 16782 | GAsyncReadyCallback callback, |
| 16783 | gpointer user_data) |
| 16784 | { |
| 16785 | 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); |
| 16786 | } |
| 16787 | |
| 16788 | /** |
| 16789 | * control_power_proxy_new_for_bus_finish: |
| 16790 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus(). |
| 16791 | * @error: Return location for error or %NULL |
| 16792 | * |
| 16793 | * Finishes an operation started with control_power_proxy_new_for_bus(). |
| 16794 | * |
| 16795 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 16796 | */ |
| 16797 | ControlPower * |
| 16798 | control_power_proxy_new_for_bus_finish ( |
| 16799 | GAsyncResult *res, |
| 16800 | GError **error) |
| 16801 | { |
| 16802 | GObject *ret; |
| 16803 | GObject *source_object; |
| 16804 | source_object = g_async_result_get_source_object (res); |
| 16805 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 16806 | g_object_unref (source_object); |
| 16807 | if (ret != NULL) |
| 16808 | return CONTROL_POWER (ret); |
| 16809 | else |
| 16810 | return NULL; |
| 16811 | } |
| 16812 | |
| 16813 | /** |
| 16814 | * control_power_proxy_new_for_bus_sync: |
| 16815 | * @bus_type: A #GBusType. |
| 16816 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 16817 | * @name: A bus name (well-known or unique). |
| 16818 | * @object_path: An object path. |
| 16819 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 16820 | * @error: Return location for error or %NULL |
| 16821 | * |
| 16822 | * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 16823 | * |
| 16824 | * The calling thread is blocked until a reply is received. |
| 16825 | * |
| 16826 | * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 16827 | * |
| 16828 | * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. |
| 16829 | */ |
| 16830 | ControlPower * |
| 16831 | control_power_proxy_new_for_bus_sync ( |
| 16832 | GBusType bus_type, |
| 16833 | GDBusProxyFlags flags, |
| 16834 | const gchar *name, |
| 16835 | const gchar *object_path, |
| 16836 | GCancellable *cancellable, |
| 16837 | GError **error) |
| 16838 | { |
| 16839 | GInitable *ret; |
| 16840 | 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); |
| 16841 | if (ret != NULL) |
| 16842 | return CONTROL_POWER (ret); |
| 16843 | else |
| 16844 | return NULL; |
| 16845 | } |
| 16846 | |
| 16847 | |
| 16848 | /* ------------------------------------------------------------------------ */ |
| 16849 | |
| 16850 | /** |
| 16851 | * ControlPowerSkeleton: |
| 16852 | * |
| 16853 | * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API. |
| 16854 | */ |
| 16855 | |
| 16856 | /** |
| 16857 | * ControlPowerSkeletonClass: |
| 16858 | * @parent_class: The parent class. |
| 16859 | * |
| 16860 | * Class structure for #ControlPowerSkeleton. |
| 16861 | */ |
| 16862 | |
| 16863 | struct _ControlPowerSkeletonPrivate |
| 16864 | { |
| 16865 | GValue *properties; |
| 16866 | GList *changed_properties; |
| 16867 | GSource *changed_properties_idle_source; |
| 16868 | GMainContext *context; |
| 16869 | GMutex lock; |
| 16870 | }; |
| 16871 | |
| 16872 | static void |
| 16873 | _control_power_skeleton_handle_method_call ( |
| 16874 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16875 | const gchar *sender G_GNUC_UNUSED, |
| 16876 | const gchar *object_path G_GNUC_UNUSED, |
| 16877 | const gchar *interface_name, |
| 16878 | const gchar *method_name, |
| 16879 | GVariant *parameters, |
| 16880 | GDBusMethodInvocation *invocation, |
| 16881 | gpointer user_data) |
| 16882 | { |
| 16883 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 16884 | _ExtendedGDBusMethodInfo *info; |
| 16885 | GVariantIter iter; |
| 16886 | GVariant *child; |
| 16887 | GValue *paramv; |
| 16888 | guint num_params; |
| 16889 | guint num_extra; |
| 16890 | guint n; |
| 16891 | guint signal_id; |
| 16892 | GValue return_value = G_VALUE_INIT; |
| 16893 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 16894 | g_assert (info != NULL); |
| 16895 | num_params = g_variant_n_children (parameters); |
| 16896 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 16897 | n = 0; |
| 16898 | g_value_init (¶mv[n], TYPE_CONTROL_POWER); |
| 16899 | g_value_set_object (¶mv[n++], skeleton); |
| 16900 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 16901 | g_value_set_object (¶mv[n++], invocation); |
| 16902 | if (info->pass_fdlist) |
| 16903 | { |
| 16904 | #ifdef G_OS_UNIX |
| 16905 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 16906 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 16907 | #else |
| 16908 | g_assert_not_reached (); |
| 16909 | #endif |
| 16910 | } |
| 16911 | g_variant_iter_init (&iter, parameters); |
| 16912 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 16913 | { |
| 16914 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 16915 | if (arg_info->use_gvariant) |
| 16916 | { |
| 16917 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 16918 | g_value_set_variant (¶mv[n], child); |
| 16919 | n++; |
| 16920 | } |
| 16921 | else |
| 16922 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 16923 | g_variant_unref (child); |
| 16924 | } |
| 16925 | signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); |
| 16926 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 16927 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 16928 | if (!g_value_get_boolean (&return_value)) |
| 16929 | 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); |
| 16930 | g_value_unset (&return_value); |
| 16931 | for (n = 0; n < num_params + num_extra; n++) |
| 16932 | g_value_unset (¶mv[n]); |
| 16933 | g_free (paramv); |
| 16934 | } |
| 16935 | |
| 16936 | static GVariant * |
| 16937 | _control_power_skeleton_handle_get_property ( |
| 16938 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16939 | const gchar *sender G_GNUC_UNUSED, |
| 16940 | const gchar *object_path G_GNUC_UNUSED, |
| 16941 | const gchar *interface_name G_GNUC_UNUSED, |
| 16942 | const gchar *property_name, |
| 16943 | GError **error, |
| 16944 | gpointer user_data) |
| 16945 | { |
| 16946 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 16947 | GValue value = G_VALUE_INIT; |
| 16948 | GParamSpec *pspec; |
| 16949 | _ExtendedGDBusPropertyInfo *info; |
| 16950 | GVariant *ret; |
| 16951 | ret = NULL; |
| 16952 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 16953 | g_assert (info != NULL); |
| 16954 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 16955 | if (pspec == NULL) |
| 16956 | { |
| 16957 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 16958 | } |
| 16959 | else |
| 16960 | { |
| 16961 | g_value_init (&value, pspec->value_type); |
| 16962 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 16963 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 16964 | g_value_unset (&value); |
| 16965 | } |
| 16966 | return ret; |
| 16967 | } |
| 16968 | |
| 16969 | static gboolean |
| 16970 | _control_power_skeleton_handle_set_property ( |
| 16971 | GDBusConnection *connection G_GNUC_UNUSED, |
| 16972 | const gchar *sender G_GNUC_UNUSED, |
| 16973 | const gchar *object_path G_GNUC_UNUSED, |
| 16974 | const gchar *interface_name G_GNUC_UNUSED, |
| 16975 | const gchar *property_name, |
| 16976 | GVariant *variant, |
| 16977 | GError **error, |
| 16978 | gpointer user_data) |
| 16979 | { |
| 16980 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 16981 | GValue value = G_VALUE_INIT; |
| 16982 | GParamSpec *pspec; |
| 16983 | _ExtendedGDBusPropertyInfo *info; |
| 16984 | gboolean ret; |
| 16985 | ret = FALSE; |
| 16986 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); |
| 16987 | g_assert (info != NULL); |
| 16988 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 16989 | if (pspec == NULL) |
| 16990 | { |
| 16991 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 16992 | } |
| 16993 | else |
| 16994 | { |
| 16995 | if (info->use_gvariant) |
| 16996 | g_value_set_variant (&value, variant); |
| 16997 | else |
| 16998 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 16999 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 17000 | g_value_unset (&value); |
| 17001 | ret = TRUE; |
| 17002 | } |
| 17003 | return ret; |
| 17004 | } |
| 17005 | |
| 17006 | static const GDBusInterfaceVTable _control_power_skeleton_vtable = |
| 17007 | { |
| 17008 | _control_power_skeleton_handle_method_call, |
| 17009 | _control_power_skeleton_handle_get_property, |
| 17010 | _control_power_skeleton_handle_set_property, |
| 17011 | {NULL} |
| 17012 | }; |
| 17013 | |
| 17014 | static GDBusInterfaceInfo * |
| 17015 | control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17016 | { |
| 17017 | return control_power_interface_info (); |
| 17018 | } |
| 17019 | |
| 17020 | static GDBusInterfaceVTable * |
| 17021 | control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 17022 | { |
| 17023 | return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable; |
| 17024 | } |
| 17025 | |
| 17026 | static GVariant * |
| 17027 | control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 17028 | { |
| 17029 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 17030 | |
| 17031 | GVariantBuilder builder; |
| 17032 | guint n; |
| 17033 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17034 | if (_control_power_interface_info.parent_struct.properties == NULL) |
| 17035 | goto out; |
| 17036 | for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++) |
| 17037 | { |
| 17038 | GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n]; |
| 17039 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 17040 | { |
| 17041 | GVariant *value; |
| 17042 | 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); |
| 17043 | if (value != NULL) |
| 17044 | { |
| 17045 | g_variant_take_ref (value); |
| 17046 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 17047 | g_variant_unref (value); |
| 17048 | } |
| 17049 | } |
| 17050 | } |
| 17051 | out: |
| 17052 | return g_variant_builder_end (&builder); |
| 17053 | } |
| 17054 | |
| 17055 | static gboolean _control_power_emit_changed (gpointer user_data); |
| 17056 | |
| 17057 | static void |
| 17058 | control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 17059 | { |
| 17060 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); |
| 17061 | gboolean emit_changed = FALSE; |
| 17062 | |
| 17063 | g_mutex_lock (&skeleton->priv->lock); |
| 17064 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17065 | { |
| 17066 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17067 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17068 | emit_changed = TRUE; |
| 17069 | } |
| 17070 | g_mutex_unlock (&skeleton->priv->lock); |
| 17071 | |
| 17072 | if (emit_changed) |
| 17073 | _control_power_emit_changed (skeleton); |
| 17074 | } |
| 17075 | |
| 17076 | static void |
| 17077 | _control_power_on_signal_power_good ( |
| 17078 | ControlPower *object) |
| 17079 | { |
| 17080 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17081 | |
| 17082 | GList *connections, *l; |
| 17083 | GVariant *signal_variant; |
| 17084 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17085 | |
| 17086 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 17087 | for (l = connections; l != NULL; l = l->next) |
| 17088 | { |
| 17089 | GDBusConnection *connection = l->data; |
| 17090 | g_dbus_connection_emit_signal (connection, |
| 17091 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood", |
| 17092 | signal_variant, NULL); |
| 17093 | } |
| 17094 | g_variant_unref (signal_variant); |
| 17095 | g_list_free_full (connections, g_object_unref); |
| 17096 | } |
| 17097 | |
| 17098 | static void |
| 17099 | _control_power_on_signal_power_lost ( |
| 17100 | ControlPower *object) |
| 17101 | { |
| 17102 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17103 | |
| 17104 | GList *connections, *l; |
| 17105 | GVariant *signal_variant; |
| 17106 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17107 | |
| 17108 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 17109 | for (l = connections; l != NULL; l = l->next) |
| 17110 | { |
| 17111 | GDBusConnection *connection = l->data; |
| 17112 | g_dbus_connection_emit_signal (connection, |
| 17113 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost", |
| 17114 | signal_variant, NULL); |
| 17115 | } |
| 17116 | g_variant_unref (signal_variant); |
| 17117 | g_list_free_full (connections, g_object_unref); |
| 17118 | } |
| 17119 | |
| 17120 | static void control_power_skeleton_iface_init (ControlPowerIface *iface); |
| 17121 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17122 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17123 | G_ADD_PRIVATE (ControlPowerSkeleton) |
| 17124 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 17125 | |
| 17126 | #else |
| 17127 | G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 17128 | G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); |
| 17129 | |
| 17130 | #endif |
| 17131 | static void |
| 17132 | control_power_skeleton_finalize (GObject *object) |
| 17133 | { |
| 17134 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17135 | guint n; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17136 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17137 | g_value_unset (&skeleton->priv->properties[n]); |
| 17138 | g_free (skeleton->priv->properties); |
| 17139 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17140 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 17141 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 17142 | g_main_context_unref (skeleton->priv->context); |
| 17143 | g_mutex_clear (&skeleton->priv->lock); |
| 17144 | G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object); |
| 17145 | } |
| 17146 | |
| 17147 | static void |
| 17148 | control_power_skeleton_get_property (GObject *object, |
| 17149 | guint prop_id, |
| 17150 | GValue *value, |
| 17151 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17152 | { |
| 17153 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17154 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17155 | g_mutex_lock (&skeleton->priv->lock); |
| 17156 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 17157 | g_mutex_unlock (&skeleton->priv->lock); |
| 17158 | } |
| 17159 | |
| 17160 | static gboolean |
| 17161 | _control_power_emit_changed (gpointer user_data) |
| 17162 | { |
| 17163 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); |
| 17164 | GList *l; |
| 17165 | GVariantBuilder builder; |
| 17166 | GVariantBuilder invalidated_builder; |
| 17167 | guint num_changes; |
| 17168 | |
| 17169 | g_mutex_lock (&skeleton->priv->lock); |
| 17170 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 17171 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 17172 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 17173 | { |
| 17174 | ChangedProperty *cp = l->data; |
| 17175 | GVariant *variant; |
| 17176 | const GValue *cur_value; |
| 17177 | |
| 17178 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 17179 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 17180 | { |
| 17181 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 17182 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 17183 | g_variant_unref (variant); |
| 17184 | num_changes++; |
| 17185 | } |
| 17186 | } |
| 17187 | if (num_changes > 0) |
| 17188 | { |
| 17189 | GList *connections, *ll; |
| 17190 | GVariant *signal_variant; |
| 17191 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power", |
| 17192 | &builder, &invalidated_builder)); |
| 17193 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 17194 | for (ll = connections; ll != NULL; ll = ll->next) |
| 17195 | { |
| 17196 | GDBusConnection *connection = ll->data; |
| 17197 | |
| 17198 | g_dbus_connection_emit_signal (connection, |
| 17199 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 17200 | "org.freedesktop.DBus.Properties", |
| 17201 | "PropertiesChanged", |
| 17202 | signal_variant, |
| 17203 | NULL); |
| 17204 | } |
| 17205 | g_variant_unref (signal_variant); |
| 17206 | g_list_free_full (connections, g_object_unref); |
| 17207 | } |
| 17208 | else |
| 17209 | { |
| 17210 | g_variant_builder_clear (&builder); |
| 17211 | g_variant_builder_clear (&invalidated_builder); |
| 17212 | } |
| 17213 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 17214 | skeleton->priv->changed_properties = NULL; |
| 17215 | skeleton->priv->changed_properties_idle_source = NULL; |
| 17216 | g_mutex_unlock (&skeleton->priv->lock); |
| 17217 | return FALSE; |
| 17218 | } |
| 17219 | |
| 17220 | static void |
| 17221 | _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 17222 | { |
| 17223 | ChangedProperty *cp; |
| 17224 | GList *l; |
| 17225 | cp = NULL; |
| 17226 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 17227 | { |
| 17228 | ChangedProperty *i_cp = l->data; |
| 17229 | if (i_cp->info == info) |
| 17230 | { |
| 17231 | cp = i_cp; |
| 17232 | break; |
| 17233 | } |
| 17234 | } |
| 17235 | if (cp == NULL) |
| 17236 | { |
| 17237 | cp = g_new0 (ChangedProperty, 1); |
| 17238 | cp->prop_id = prop_id; |
| 17239 | cp->info = info; |
| 17240 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 17241 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 17242 | g_value_copy (orig_value, &cp->orig_value); |
| 17243 | } |
| 17244 | } |
| 17245 | |
| 17246 | static void |
| 17247 | control_power_skeleton_notify (GObject *object, |
| 17248 | GParamSpec *pspec G_GNUC_UNUSED) |
| 17249 | { |
| 17250 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17251 | g_mutex_lock (&skeleton->priv->lock); |
| 17252 | if (skeleton->priv->changed_properties != NULL && |
| 17253 | skeleton->priv->changed_properties_idle_source == NULL) |
| 17254 | { |
| 17255 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 17256 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 17257 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 17258 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 17259 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 17260 | } |
| 17261 | g_mutex_unlock (&skeleton->priv->lock); |
| 17262 | } |
| 17263 | |
| 17264 | static void |
| 17265 | control_power_skeleton_set_property (GObject *object, |
| 17266 | guint prop_id, |
| 17267 | const GValue *value, |
| 17268 | GParamSpec *pspec) |
| 17269 | { |
| 17270 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17271 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17272 | g_mutex_lock (&skeleton->priv->lock); |
| 17273 | g_object_freeze_notify (object); |
| 17274 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 17275 | { |
| 17276 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 17277 | _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 17278 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 17279 | g_object_notify_by_pspec (object, pspec); |
| 17280 | } |
| 17281 | g_mutex_unlock (&skeleton->priv->lock); |
| 17282 | g_object_thaw_notify (object); |
| 17283 | } |
| 17284 | |
| 17285 | static void |
| 17286 | control_power_skeleton_init (ControlPowerSkeleton *skeleton) |
| 17287 | { |
| 17288 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 17289 | skeleton->priv = control_power_skeleton_get_instance_private (skeleton); |
| 17290 | #else |
| 17291 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate); |
| 17292 | #endif |
| 17293 | |
| 17294 | g_mutex_init (&skeleton->priv->lock); |
| 17295 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17296 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17297 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 17298 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17299 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17300 | } |
| 17301 | |
| 17302 | static gint |
| 17303 | control_power_skeleton_get_pgood (ControlPower *object) |
| 17304 | { |
| 17305 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17306 | gint value; |
| 17307 | g_mutex_lock (&skeleton->priv->lock); |
| 17308 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 17309 | g_mutex_unlock (&skeleton->priv->lock); |
| 17310 | return value; |
| 17311 | } |
| 17312 | |
| 17313 | static gint |
| 17314 | control_power_skeleton_get_state (ControlPower *object) |
| 17315 | { |
| 17316 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17317 | gint value; |
| 17318 | g_mutex_lock (&skeleton->priv->lock); |
| 17319 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 17320 | g_mutex_unlock (&skeleton->priv->lock); |
| 17321 | return value; |
| 17322 | } |
| 17323 | |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17324 | static gint |
| 17325 | control_power_skeleton_get_pgood_timeout (ControlPower *object) |
| 17326 | { |
| 17327 | ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); |
| 17328 | gint value; |
| 17329 | g_mutex_lock (&skeleton->priv->lock); |
| 17330 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 17331 | g_mutex_unlock (&skeleton->priv->lock); |
| 17332 | return value; |
| 17333 | } |
| 17334 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17335 | static void |
| 17336 | control_power_skeleton_class_init (ControlPowerSkeletonClass *klass) |
| 17337 | { |
| 17338 | GObjectClass *gobject_class; |
| 17339 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 17340 | |
| 17341 | gobject_class = G_OBJECT_CLASS (klass); |
| 17342 | gobject_class->finalize = control_power_skeleton_finalize; |
| 17343 | gobject_class->get_property = control_power_skeleton_get_property; |
| 17344 | gobject_class->set_property = control_power_skeleton_set_property; |
| 17345 | gobject_class->notify = control_power_skeleton_notify; |
| 17346 | |
| 17347 | |
| 17348 | control_power_override_properties (gobject_class, 1); |
| 17349 | |
| 17350 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 17351 | skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info; |
| 17352 | skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties; |
| 17353 | skeleton_class->flush = control_power_skeleton_dbus_interface_flush; |
| 17354 | skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable; |
| 17355 | |
| 17356 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 17357 | g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate)); |
| 17358 | #endif |
| 17359 | } |
| 17360 | |
| 17361 | static void |
| 17362 | control_power_skeleton_iface_init (ControlPowerIface *iface) |
| 17363 | { |
| 17364 | iface->power_good = _control_power_on_signal_power_good; |
| 17365 | iface->power_lost = _control_power_on_signal_power_lost; |
| 17366 | iface->get_pgood = control_power_skeleton_get_pgood; |
| 17367 | iface->get_state = control_power_skeleton_get_state; |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17368 | iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17369 | } |
| 17370 | |
| 17371 | /** |
| 17372 | * control_power_skeleton_new: |
| 17373 | * |
| 17374 | * 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>. |
| 17375 | * |
| 17376 | * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object. |
| 17377 | */ |
| 17378 | ControlPower * |
| 17379 | control_power_skeleton_new (void) |
| 17380 | { |
| 17381 | return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL)); |
| 17382 | } |
| 17383 | |
| 17384 | /* ------------------------------------------------------------------------ |
| 17385 | * Code for interface org.openbmc.Watchdog |
| 17386 | * ------------------------------------------------------------------------ |
| 17387 | */ |
| 17388 | |
| 17389 | /** |
| 17390 | * SECTION:Watchdog |
| 17391 | * @title: Watchdog |
| 17392 | * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface |
| 17393 | * |
| 17394 | * 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. |
| 17395 | */ |
| 17396 | |
| 17397 | /* ---- Introspection data for org.openbmc.Watchdog ---- */ |
| 17398 | |
| 17399 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = |
| 17400 | { |
| 17401 | { |
| 17402 | -1, |
| 17403 | (gchar *) "start", |
| 17404 | NULL, |
| 17405 | NULL, |
| 17406 | NULL |
| 17407 | }, |
| 17408 | "handle-start", |
| 17409 | FALSE |
| 17410 | }; |
| 17411 | |
| 17412 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = |
| 17413 | { |
| 17414 | { |
| 17415 | -1, |
| 17416 | (gchar *) "poke", |
| 17417 | NULL, |
| 17418 | NULL, |
| 17419 | NULL |
| 17420 | }, |
| 17421 | "handle-poke", |
| 17422 | FALSE |
| 17423 | }; |
| 17424 | |
| 17425 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = |
| 17426 | { |
| 17427 | { |
| 17428 | -1, |
| 17429 | (gchar *) "stop", |
| 17430 | NULL, |
| 17431 | NULL, |
| 17432 | NULL |
| 17433 | }, |
| 17434 | "handle-stop", |
| 17435 | FALSE |
| 17436 | }; |
| 17437 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 17438 | static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval = |
| 17439 | { |
| 17440 | { |
| 17441 | -1, |
| 17442 | (gchar *) "interval", |
| 17443 | (gchar *) "i", |
| 17444 | NULL |
| 17445 | }, |
| 17446 | FALSE |
| 17447 | }; |
| 17448 | |
| 17449 | static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] = |
| 17450 | { |
| 17451 | &_watchdog_method_info_set_IN_ARG_interval, |
| 17452 | NULL |
| 17453 | }; |
| 17454 | |
| 17455 | static const _ExtendedGDBusMethodInfo _watchdog_method_info_set = |
| 17456 | { |
| 17457 | { |
| 17458 | -1, |
| 17459 | (gchar *) "set", |
| 17460 | (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers, |
| 17461 | NULL, |
| 17462 | NULL |
| 17463 | }, |
| 17464 | "handle-set", |
| 17465 | FALSE |
| 17466 | }; |
| 17467 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17468 | static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = |
| 17469 | { |
| 17470 | &_watchdog_method_info_start, |
| 17471 | &_watchdog_method_info_poke, |
| 17472 | &_watchdog_method_info_stop, |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 17473 | &_watchdog_method_info_set, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17474 | NULL |
| 17475 | }; |
| 17476 | |
| 17477 | static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = |
| 17478 | { |
| 17479 | { |
| 17480 | -1, |
| 17481 | (gchar *) "WatchdogError", |
| 17482 | NULL, |
| 17483 | NULL |
| 17484 | }, |
| 17485 | "watchdog-error" |
| 17486 | }; |
| 17487 | |
| 17488 | static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = |
| 17489 | { |
| 17490 | &_watchdog_signal_info_watchdog_error, |
| 17491 | NULL |
| 17492 | }; |
| 17493 | |
| 17494 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = |
| 17495 | { |
| 17496 | { |
| 17497 | -1, |
| 17498 | (gchar *) "watchdog", |
| 17499 | (gchar *) "i", |
| 17500 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 17501 | NULL |
| 17502 | }, |
| 17503 | "watchdog", |
| 17504 | FALSE |
| 17505 | }; |
| 17506 | |
| 17507 | static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = |
| 17508 | { |
| 17509 | { |
| 17510 | -1, |
| 17511 | (gchar *) "poll_interval", |
| 17512 | (gchar *) "i", |
| 17513 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 17514 | NULL |
| 17515 | }, |
| 17516 | "poll-interval", |
| 17517 | FALSE |
| 17518 | }; |
| 17519 | |
| 17520 | static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = |
| 17521 | { |
| 17522 | &_watchdog_property_info_watchdog, |
| 17523 | &_watchdog_property_info_poll_interval, |
| 17524 | NULL |
| 17525 | }; |
| 17526 | |
| 17527 | static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = |
| 17528 | { |
| 17529 | { |
| 17530 | -1, |
| 17531 | (gchar *) "org.openbmc.Watchdog", |
| 17532 | (GDBusMethodInfo **) &_watchdog_method_info_pointers, |
| 17533 | (GDBusSignalInfo **) &_watchdog_signal_info_pointers, |
| 17534 | (GDBusPropertyInfo **) &_watchdog_property_info_pointers, |
| 17535 | NULL |
| 17536 | }, |
| 17537 | "watchdog", |
| 17538 | }; |
| 17539 | |
| 17540 | |
| 17541 | /** |
| 17542 | * watchdog_interface_info: |
| 17543 | * |
| 17544 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. |
| 17545 | * |
| 17546 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 17547 | */ |
| 17548 | GDBusInterfaceInfo * |
| 17549 | watchdog_interface_info (void) |
| 17550 | { |
| 17551 | return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; |
| 17552 | } |
| 17553 | |
| 17554 | /** |
| 17555 | * watchdog_override_properties: |
| 17556 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 17557 | * @property_id_begin: The property id to assign to the first overridden property. |
| 17558 | * |
| 17559 | * Overrides all #GObject properties in the #Watchdog interface for a concrete class. |
| 17560 | * The properties are overridden in the order they are defined. |
| 17561 | * |
| 17562 | * Returns: The last property id. |
| 17563 | */ |
| 17564 | guint |
| 17565 | watchdog_override_properties (GObjectClass *klass, guint property_id_begin) |
| 17566 | { |
| 17567 | g_object_class_override_property (klass, property_id_begin++, "watchdog"); |
| 17568 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 17569 | return property_id_begin - 1; |
| 17570 | } |
| 17571 | |
| 17572 | |
| 17573 | |
| 17574 | /** |
| 17575 | * Watchdog: |
| 17576 | * |
| 17577 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 17578 | */ |
| 17579 | |
| 17580 | /** |
| 17581 | * WatchdogIface: |
| 17582 | * @parent_iface: The parent interface. |
| 17583 | * @handle_poke: Handler for the #Watchdog::handle-poke signal. |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 17584 | * @handle_set: Handler for the #Watchdog::handle-set signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17585 | * @handle_start: Handler for the #Watchdog::handle-start signal. |
| 17586 | * @handle_stop: Handler for the #Watchdog::handle-stop signal. |
| 17587 | * @get_poll_interval: Getter for the #Watchdog:poll-interval property. |
| 17588 | * @get_watchdog: Getter for the #Watchdog:watchdog property. |
| 17589 | * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. |
| 17590 | * |
| 17591 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 17592 | */ |
| 17593 | |
| 17594 | typedef WatchdogIface WatchdogInterface; |
| 17595 | G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); |
| 17596 | |
| 17597 | static void |
| 17598 | watchdog_default_init (WatchdogIface *iface) |
| 17599 | { |
| 17600 | /* GObject signals for incoming D-Bus method calls: */ |
| 17601 | /** |
| 17602 | * Watchdog::handle-start: |
| 17603 | * @object: A #Watchdog. |
| 17604 | * @invocation: A #GDBusMethodInvocation. |
| 17605 | * |
| 17606 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. |
| 17607 | * |
| 17608 | * 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. |
| 17609 | * |
| 17610 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17611 | */ |
| 17612 | g_signal_new ("handle-start", |
| 17613 | G_TYPE_FROM_INTERFACE (iface), |
| 17614 | G_SIGNAL_RUN_LAST, |
| 17615 | G_STRUCT_OFFSET (WatchdogIface, handle_start), |
| 17616 | g_signal_accumulator_true_handled, |
| 17617 | NULL, |
| 17618 | g_cclosure_marshal_generic, |
| 17619 | G_TYPE_BOOLEAN, |
| 17620 | 1, |
| 17621 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 17622 | |
| 17623 | /** |
| 17624 | * Watchdog::handle-poke: |
| 17625 | * @object: A #Watchdog. |
| 17626 | * @invocation: A #GDBusMethodInvocation. |
| 17627 | * |
| 17628 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. |
| 17629 | * |
| 17630 | * 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. |
| 17631 | * |
| 17632 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17633 | */ |
| 17634 | g_signal_new ("handle-poke", |
| 17635 | G_TYPE_FROM_INTERFACE (iface), |
| 17636 | G_SIGNAL_RUN_LAST, |
| 17637 | G_STRUCT_OFFSET (WatchdogIface, handle_poke), |
| 17638 | g_signal_accumulator_true_handled, |
| 17639 | NULL, |
| 17640 | g_cclosure_marshal_generic, |
| 17641 | G_TYPE_BOOLEAN, |
| 17642 | 1, |
| 17643 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 17644 | |
| 17645 | /** |
| 17646 | * Watchdog::handle-stop: |
| 17647 | * @object: A #Watchdog. |
| 17648 | * @invocation: A #GDBusMethodInvocation. |
| 17649 | * |
| 17650 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. |
| 17651 | * |
| 17652 | * 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. |
| 17653 | * |
| 17654 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17655 | */ |
| 17656 | g_signal_new ("handle-stop", |
| 17657 | G_TYPE_FROM_INTERFACE (iface), |
| 17658 | G_SIGNAL_RUN_LAST, |
| 17659 | G_STRUCT_OFFSET (WatchdogIface, handle_stop), |
| 17660 | g_signal_accumulator_true_handled, |
| 17661 | NULL, |
| 17662 | g_cclosure_marshal_generic, |
| 17663 | G_TYPE_BOOLEAN, |
| 17664 | 1, |
| 17665 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 17666 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 17667 | /** |
| 17668 | * Watchdog::handle-set: |
| 17669 | * @object: A #Watchdog. |
| 17670 | * @invocation: A #GDBusMethodInvocation. |
| 17671 | * @arg_interval: Argument passed by remote caller. |
| 17672 | * |
| 17673 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. |
| 17674 | * |
| 17675 | * 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. |
| 17676 | * |
| 17677 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 17678 | */ |
| 17679 | g_signal_new ("handle-set", |
| 17680 | G_TYPE_FROM_INTERFACE (iface), |
| 17681 | G_SIGNAL_RUN_LAST, |
| 17682 | G_STRUCT_OFFSET (WatchdogIface, handle_set), |
| 17683 | g_signal_accumulator_true_handled, |
| 17684 | NULL, |
| 17685 | g_cclosure_marshal_generic, |
| 17686 | G_TYPE_BOOLEAN, |
| 17687 | 2, |
| 17688 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 17689 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 17690 | /* GObject signals for received D-Bus signals: */ |
| 17691 | /** |
| 17692 | * Watchdog::watchdog-error: |
| 17693 | * @object: A #Watchdog. |
| 17694 | * |
| 17695 | * 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. |
| 17696 | * |
| 17697 | * 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. |
| 17698 | */ |
| 17699 | g_signal_new ("watchdog-error", |
| 17700 | G_TYPE_FROM_INTERFACE (iface), |
| 17701 | G_SIGNAL_RUN_LAST, |
| 17702 | G_STRUCT_OFFSET (WatchdogIface, watchdog_error), |
| 17703 | NULL, |
| 17704 | NULL, |
| 17705 | g_cclosure_marshal_generic, |
| 17706 | G_TYPE_NONE, |
| 17707 | 0); |
| 17708 | |
| 17709 | /* GObject properties for D-Bus properties: */ |
| 17710 | /** |
| 17711 | * Watchdog:watchdog: |
| 17712 | * |
| 17713 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. |
| 17714 | * |
| 17715 | * 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. |
| 17716 | */ |
| 17717 | g_object_interface_install_property (iface, |
| 17718 | g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 17719 | /** |
| 17720 | * Watchdog:poll-interval: |
| 17721 | * |
| 17722 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. |
| 17723 | * |
| 17724 | * 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. |
| 17725 | */ |
| 17726 | g_object_interface_install_property (iface, |
| 17727 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 17728 | } |
| 17729 | |
| 17730 | /** |
| 17731 | * watchdog_get_watchdog: (skip) |
| 17732 | * @object: A #Watchdog. |
| 17733 | * |
| 17734 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. |
| 17735 | * |
| 17736 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17737 | * |
| 17738 | * Returns: The property value. |
| 17739 | */ |
| 17740 | gint |
| 17741 | watchdog_get_watchdog (Watchdog *object) |
| 17742 | { |
| 17743 | return WATCHDOG_GET_IFACE (object)->get_watchdog (object); |
| 17744 | } |
| 17745 | |
| 17746 | /** |
| 17747 | * watchdog_set_watchdog: (skip) |
| 17748 | * @object: A #Watchdog. |
| 17749 | * @value: The value to set. |
| 17750 | * |
| 17751 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. |
| 17752 | * |
| 17753 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17754 | */ |
| 17755 | void |
| 17756 | watchdog_set_watchdog (Watchdog *object, gint value) |
| 17757 | { |
| 17758 | g_object_set (G_OBJECT (object), "watchdog", value, NULL); |
| 17759 | } |
| 17760 | |
| 17761 | /** |
| 17762 | * watchdog_get_poll_interval: (skip) |
| 17763 | * @object: A #Watchdog. |
| 17764 | * |
| 17765 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. |
| 17766 | * |
| 17767 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17768 | * |
| 17769 | * Returns: The property value. |
| 17770 | */ |
| 17771 | gint |
| 17772 | watchdog_get_poll_interval (Watchdog *object) |
| 17773 | { |
| 17774 | return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); |
| 17775 | } |
| 17776 | |
| 17777 | /** |
| 17778 | * watchdog_set_poll_interval: (skip) |
| 17779 | * @object: A #Watchdog. |
| 17780 | * @value: The value to set. |
| 17781 | * |
| 17782 | * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 17783 | * |
| 17784 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 17785 | */ |
| 17786 | void |
| 17787 | watchdog_set_poll_interval (Watchdog *object, gint value) |
| 17788 | { |
| 17789 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 17790 | } |
| 17791 | |
| 17792 | /** |
| 17793 | * watchdog_emit_watchdog_error: |
| 17794 | * @object: A #Watchdog. |
| 17795 | * |
| 17796 | * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. |
| 17797 | */ |
| 17798 | void |
| 17799 | watchdog_emit_watchdog_error ( |
| 17800 | Watchdog *object) |
| 17801 | { |
| 17802 | g_signal_emit_by_name (object, "watchdog-error"); |
| 17803 | } |
| 17804 | |
| 17805 | /** |
| 17806 | * watchdog_call_start: |
| 17807 | * @proxy: A #WatchdogProxy. |
| 17808 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17809 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 17810 | * @user_data: User data to pass to @callback. |
| 17811 | * |
| 17812 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. |
| 17813 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 17814 | * You can then call watchdog_call_start_finish() to get the result of the operation. |
| 17815 | * |
| 17816 | * See watchdog_call_start_sync() for the synchronous, blocking version of this method. |
| 17817 | */ |
| 17818 | void |
| 17819 | watchdog_call_start ( |
| 17820 | Watchdog *proxy, |
| 17821 | GCancellable *cancellable, |
| 17822 | GAsyncReadyCallback callback, |
| 17823 | gpointer user_data) |
| 17824 | { |
| 17825 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 17826 | "start", |
| 17827 | g_variant_new ("()"), |
| 17828 | G_DBUS_CALL_FLAGS_NONE, |
| 17829 | -1, |
| 17830 | cancellable, |
| 17831 | callback, |
| 17832 | user_data); |
| 17833 | } |
| 17834 | |
| 17835 | /** |
| 17836 | * watchdog_call_start_finish: |
| 17837 | * @proxy: A #WatchdogProxy. |
| 17838 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). |
| 17839 | * @error: Return location for error or %NULL. |
| 17840 | * |
| 17841 | * Finishes an operation started with watchdog_call_start(). |
| 17842 | * |
| 17843 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17844 | */ |
| 17845 | gboolean |
| 17846 | watchdog_call_start_finish ( |
| 17847 | Watchdog *proxy, |
| 17848 | GAsyncResult *res, |
| 17849 | GError **error) |
| 17850 | { |
| 17851 | GVariant *_ret; |
| 17852 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 17853 | if (_ret == NULL) |
| 17854 | goto _out; |
| 17855 | g_variant_get (_ret, |
| 17856 | "()"); |
| 17857 | g_variant_unref (_ret); |
| 17858 | _out: |
| 17859 | return _ret != NULL; |
| 17860 | } |
| 17861 | |
| 17862 | /** |
| 17863 | * watchdog_call_start_sync: |
| 17864 | * @proxy: A #WatchdogProxy. |
| 17865 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17866 | * @error: Return location for error or %NULL. |
| 17867 | * |
| 17868 | * 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. |
| 17869 | * |
| 17870 | * See watchdog_call_start() for the asynchronous version of this method. |
| 17871 | * |
| 17872 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17873 | */ |
| 17874 | gboolean |
| 17875 | watchdog_call_start_sync ( |
| 17876 | Watchdog *proxy, |
| 17877 | GCancellable *cancellable, |
| 17878 | GError **error) |
| 17879 | { |
| 17880 | GVariant *_ret; |
| 17881 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 17882 | "start", |
| 17883 | g_variant_new ("()"), |
| 17884 | G_DBUS_CALL_FLAGS_NONE, |
| 17885 | -1, |
| 17886 | cancellable, |
| 17887 | error); |
| 17888 | if (_ret == NULL) |
| 17889 | goto _out; |
| 17890 | g_variant_get (_ret, |
| 17891 | "()"); |
| 17892 | g_variant_unref (_ret); |
| 17893 | _out: |
| 17894 | return _ret != NULL; |
| 17895 | } |
| 17896 | |
| 17897 | /** |
| 17898 | * watchdog_call_poke: |
| 17899 | * @proxy: A #WatchdogProxy. |
| 17900 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17901 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 17902 | * @user_data: User data to pass to @callback. |
| 17903 | * |
| 17904 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. |
| 17905 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 17906 | * You can then call watchdog_call_poke_finish() to get the result of the operation. |
| 17907 | * |
| 17908 | * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. |
| 17909 | */ |
| 17910 | void |
| 17911 | watchdog_call_poke ( |
| 17912 | Watchdog *proxy, |
| 17913 | GCancellable *cancellable, |
| 17914 | GAsyncReadyCallback callback, |
| 17915 | gpointer user_data) |
| 17916 | { |
| 17917 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 17918 | "poke", |
| 17919 | g_variant_new ("()"), |
| 17920 | G_DBUS_CALL_FLAGS_NONE, |
| 17921 | -1, |
| 17922 | cancellable, |
| 17923 | callback, |
| 17924 | user_data); |
| 17925 | } |
| 17926 | |
| 17927 | /** |
| 17928 | * watchdog_call_poke_finish: |
| 17929 | * @proxy: A #WatchdogProxy. |
| 17930 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). |
| 17931 | * @error: Return location for error or %NULL. |
| 17932 | * |
| 17933 | * Finishes an operation started with watchdog_call_poke(). |
| 17934 | * |
| 17935 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17936 | */ |
| 17937 | gboolean |
| 17938 | watchdog_call_poke_finish ( |
| 17939 | Watchdog *proxy, |
| 17940 | GAsyncResult *res, |
| 17941 | GError **error) |
| 17942 | { |
| 17943 | GVariant *_ret; |
| 17944 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 17945 | if (_ret == NULL) |
| 17946 | goto _out; |
| 17947 | g_variant_get (_ret, |
| 17948 | "()"); |
| 17949 | g_variant_unref (_ret); |
| 17950 | _out: |
| 17951 | return _ret != NULL; |
| 17952 | } |
| 17953 | |
| 17954 | /** |
| 17955 | * watchdog_call_poke_sync: |
| 17956 | * @proxy: A #WatchdogProxy. |
| 17957 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17958 | * @error: Return location for error or %NULL. |
| 17959 | * |
| 17960 | * 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. |
| 17961 | * |
| 17962 | * See watchdog_call_poke() for the asynchronous version of this method. |
| 17963 | * |
| 17964 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 17965 | */ |
| 17966 | gboolean |
| 17967 | watchdog_call_poke_sync ( |
| 17968 | Watchdog *proxy, |
| 17969 | GCancellable *cancellable, |
| 17970 | GError **error) |
| 17971 | { |
| 17972 | GVariant *_ret; |
| 17973 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 17974 | "poke", |
| 17975 | g_variant_new ("()"), |
| 17976 | G_DBUS_CALL_FLAGS_NONE, |
| 17977 | -1, |
| 17978 | cancellable, |
| 17979 | error); |
| 17980 | if (_ret == NULL) |
| 17981 | goto _out; |
| 17982 | g_variant_get (_ret, |
| 17983 | "()"); |
| 17984 | g_variant_unref (_ret); |
| 17985 | _out: |
| 17986 | return _ret != NULL; |
| 17987 | } |
| 17988 | |
| 17989 | /** |
| 17990 | * watchdog_call_stop: |
| 17991 | * @proxy: A #WatchdogProxy. |
| 17992 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 17993 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 17994 | * @user_data: User data to pass to @callback. |
| 17995 | * |
| 17996 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. |
| 17997 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 17998 | * You can then call watchdog_call_stop_finish() to get the result of the operation. |
| 17999 | * |
| 18000 | * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. |
| 18001 | */ |
| 18002 | void |
| 18003 | watchdog_call_stop ( |
| 18004 | Watchdog *proxy, |
| 18005 | GCancellable *cancellable, |
| 18006 | GAsyncReadyCallback callback, |
| 18007 | gpointer user_data) |
| 18008 | { |
| 18009 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 18010 | "stop", |
| 18011 | g_variant_new ("()"), |
| 18012 | G_DBUS_CALL_FLAGS_NONE, |
| 18013 | -1, |
| 18014 | cancellable, |
| 18015 | callback, |
| 18016 | user_data); |
| 18017 | } |
| 18018 | |
| 18019 | /** |
| 18020 | * watchdog_call_stop_finish: |
| 18021 | * @proxy: A #WatchdogProxy. |
| 18022 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). |
| 18023 | * @error: Return location for error or %NULL. |
| 18024 | * |
| 18025 | * Finishes an operation started with watchdog_call_stop(). |
| 18026 | * |
| 18027 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18028 | */ |
| 18029 | gboolean |
| 18030 | watchdog_call_stop_finish ( |
| 18031 | Watchdog *proxy, |
| 18032 | GAsyncResult *res, |
| 18033 | GError **error) |
| 18034 | { |
| 18035 | GVariant *_ret; |
| 18036 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 18037 | if (_ret == NULL) |
| 18038 | goto _out; |
| 18039 | g_variant_get (_ret, |
| 18040 | "()"); |
| 18041 | g_variant_unref (_ret); |
| 18042 | _out: |
| 18043 | return _ret != NULL; |
| 18044 | } |
| 18045 | |
| 18046 | /** |
| 18047 | * watchdog_call_stop_sync: |
| 18048 | * @proxy: A #WatchdogProxy. |
| 18049 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18050 | * @error: Return location for error or %NULL. |
| 18051 | * |
| 18052 | * 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. |
| 18053 | * |
| 18054 | * See watchdog_call_stop() for the asynchronous version of this method. |
| 18055 | * |
| 18056 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18057 | */ |
| 18058 | gboolean |
| 18059 | watchdog_call_stop_sync ( |
| 18060 | Watchdog *proxy, |
| 18061 | GCancellable *cancellable, |
| 18062 | GError **error) |
| 18063 | { |
| 18064 | GVariant *_ret; |
| 18065 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 18066 | "stop", |
| 18067 | g_variant_new ("()"), |
| 18068 | G_DBUS_CALL_FLAGS_NONE, |
| 18069 | -1, |
| 18070 | cancellable, |
| 18071 | error); |
| 18072 | if (_ret == NULL) |
| 18073 | goto _out; |
| 18074 | g_variant_get (_ret, |
| 18075 | "()"); |
| 18076 | g_variant_unref (_ret); |
| 18077 | _out: |
| 18078 | return _ret != NULL; |
| 18079 | } |
| 18080 | |
| 18081 | /** |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18082 | * watchdog_call_set: |
| 18083 | * @proxy: A #WatchdogProxy. |
| 18084 | * @arg_interval: Argument to pass with the method invocation. |
| 18085 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18086 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 18087 | * @user_data: User data to pass to @callback. |
| 18088 | * |
| 18089 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. |
| 18090 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 18091 | * You can then call watchdog_call_set_finish() to get the result of the operation. |
| 18092 | * |
| 18093 | * See watchdog_call_set_sync() for the synchronous, blocking version of this method. |
| 18094 | */ |
| 18095 | void |
| 18096 | watchdog_call_set ( |
| 18097 | Watchdog *proxy, |
| 18098 | gint arg_interval, |
| 18099 | GCancellable *cancellable, |
| 18100 | GAsyncReadyCallback callback, |
| 18101 | gpointer user_data) |
| 18102 | { |
| 18103 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 18104 | "set", |
| 18105 | g_variant_new ("(i)", |
| 18106 | arg_interval), |
| 18107 | G_DBUS_CALL_FLAGS_NONE, |
| 18108 | -1, |
| 18109 | cancellable, |
| 18110 | callback, |
| 18111 | user_data); |
| 18112 | } |
| 18113 | |
| 18114 | /** |
| 18115 | * watchdog_call_set_finish: |
| 18116 | * @proxy: A #WatchdogProxy. |
| 18117 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set(). |
| 18118 | * @error: Return location for error or %NULL. |
| 18119 | * |
| 18120 | * Finishes an operation started with watchdog_call_set(). |
| 18121 | * |
| 18122 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18123 | */ |
| 18124 | gboolean |
| 18125 | watchdog_call_set_finish ( |
| 18126 | Watchdog *proxy, |
| 18127 | GAsyncResult *res, |
| 18128 | GError **error) |
| 18129 | { |
| 18130 | GVariant *_ret; |
| 18131 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 18132 | if (_ret == NULL) |
| 18133 | goto _out; |
| 18134 | g_variant_get (_ret, |
| 18135 | "()"); |
| 18136 | g_variant_unref (_ret); |
| 18137 | _out: |
| 18138 | return _ret != NULL; |
| 18139 | } |
| 18140 | |
| 18141 | /** |
| 18142 | * watchdog_call_set_sync: |
| 18143 | * @proxy: A #WatchdogProxy. |
| 18144 | * @arg_interval: Argument to pass with the method invocation. |
| 18145 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18146 | * @error: Return location for error or %NULL. |
| 18147 | * |
| 18148 | * 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. |
| 18149 | * |
| 18150 | * See watchdog_call_set() for the asynchronous version of this method. |
| 18151 | * |
| 18152 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 18153 | */ |
| 18154 | gboolean |
| 18155 | watchdog_call_set_sync ( |
| 18156 | Watchdog *proxy, |
| 18157 | gint arg_interval, |
| 18158 | GCancellable *cancellable, |
| 18159 | GError **error) |
| 18160 | { |
| 18161 | GVariant *_ret; |
| 18162 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 18163 | "set", |
| 18164 | g_variant_new ("(i)", |
| 18165 | arg_interval), |
| 18166 | G_DBUS_CALL_FLAGS_NONE, |
| 18167 | -1, |
| 18168 | cancellable, |
| 18169 | error); |
| 18170 | if (_ret == NULL) |
| 18171 | goto _out; |
| 18172 | g_variant_get (_ret, |
| 18173 | "()"); |
| 18174 | g_variant_unref (_ret); |
| 18175 | _out: |
| 18176 | return _ret != NULL; |
| 18177 | } |
| 18178 | |
| 18179 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18180 | * watchdog_complete_start: |
| 18181 | * @object: A #Watchdog. |
| 18182 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 18183 | * |
| 18184 | * 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. |
| 18185 | * |
| 18186 | * This method will free @invocation, you cannot use it afterwards. |
| 18187 | */ |
| 18188 | void |
| 18189 | watchdog_complete_start ( |
| 18190 | Watchdog *object, |
| 18191 | GDBusMethodInvocation *invocation) |
| 18192 | { |
| 18193 | g_dbus_method_invocation_return_value (invocation, |
| 18194 | g_variant_new ("()")); |
| 18195 | } |
| 18196 | |
| 18197 | /** |
| 18198 | * watchdog_complete_poke: |
| 18199 | * @object: A #Watchdog. |
| 18200 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 18201 | * |
| 18202 | * 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. |
| 18203 | * |
| 18204 | * This method will free @invocation, you cannot use it afterwards. |
| 18205 | */ |
| 18206 | void |
| 18207 | watchdog_complete_poke ( |
| 18208 | Watchdog *object, |
| 18209 | GDBusMethodInvocation *invocation) |
| 18210 | { |
| 18211 | g_dbus_method_invocation_return_value (invocation, |
| 18212 | g_variant_new ("()")); |
| 18213 | } |
| 18214 | |
| 18215 | /** |
| 18216 | * watchdog_complete_stop: |
| 18217 | * @object: A #Watchdog. |
| 18218 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 18219 | * |
| 18220 | * 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. |
| 18221 | * |
| 18222 | * This method will free @invocation, you cannot use it afterwards. |
| 18223 | */ |
| 18224 | void |
| 18225 | watchdog_complete_stop ( |
| 18226 | Watchdog *object, |
| 18227 | GDBusMethodInvocation *invocation) |
| 18228 | { |
| 18229 | g_dbus_method_invocation_return_value (invocation, |
| 18230 | g_variant_new ("()")); |
| 18231 | } |
| 18232 | |
Adriana Kobylak | 2cb2775 | 2015-10-19 16:23:14 -0500 | [diff] [blame] | 18233 | /** |
| 18234 | * watchdog_complete_set: |
| 18235 | * @object: A #Watchdog. |
| 18236 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 18237 | * |
| 18238 | * 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. |
| 18239 | * |
| 18240 | * This method will free @invocation, you cannot use it afterwards. |
| 18241 | */ |
| 18242 | void |
| 18243 | watchdog_complete_set ( |
| 18244 | Watchdog *object, |
| 18245 | GDBusMethodInvocation *invocation) |
| 18246 | { |
| 18247 | g_dbus_method_invocation_return_value (invocation, |
| 18248 | g_variant_new ("()")); |
| 18249 | } |
| 18250 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 18251 | /* ------------------------------------------------------------------------ */ |
| 18252 | |
| 18253 | /** |
| 18254 | * WatchdogProxy: |
| 18255 | * |
| 18256 | * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. |
| 18257 | */ |
| 18258 | |
| 18259 | /** |
| 18260 | * WatchdogProxyClass: |
| 18261 | * @parent_class: The parent class. |
| 18262 | * |
| 18263 | * Class structure for #WatchdogProxy. |
| 18264 | */ |
| 18265 | |
| 18266 | struct _WatchdogProxyPrivate |
| 18267 | { |
| 18268 | GData *qdata; |
| 18269 | }; |
| 18270 | |
| 18271 | static void watchdog_proxy_iface_init (WatchdogIface *iface); |
| 18272 | |
| 18273 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18274 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 18275 | G_ADD_PRIVATE (WatchdogProxy) |
| 18276 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 18277 | |
| 18278 | #else |
| 18279 | G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, |
| 18280 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); |
| 18281 | |
| 18282 | #endif |
| 18283 | static void |
| 18284 | watchdog_proxy_finalize (GObject *object) |
| 18285 | { |
| 18286 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 18287 | g_datalist_clear (&proxy->priv->qdata); |
| 18288 | G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); |
| 18289 | } |
| 18290 | |
| 18291 | static void |
| 18292 | watchdog_proxy_get_property (GObject *object, |
| 18293 | guint prop_id, |
| 18294 | GValue *value, |
| 18295 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18296 | { |
| 18297 | const _ExtendedGDBusPropertyInfo *info; |
| 18298 | GVariant *variant; |
| 18299 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 18300 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 18301 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 18302 | if (info->use_gvariant) |
| 18303 | { |
| 18304 | g_value_set_variant (value, variant); |
| 18305 | } |
| 18306 | else |
| 18307 | { |
| 18308 | if (variant != NULL) |
| 18309 | g_dbus_gvariant_to_gvalue (variant, value); |
| 18310 | } |
| 18311 | if (variant != NULL) |
| 18312 | g_variant_unref (variant); |
| 18313 | } |
| 18314 | |
| 18315 | static void |
| 18316 | watchdog_proxy_set_property_cb (GDBusProxy *proxy, |
| 18317 | GAsyncResult *res, |
| 18318 | gpointer user_data) |
| 18319 | { |
| 18320 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 18321 | GError *error; |
| 18322 | GVariant *_ret; |
| 18323 | error = NULL; |
| 18324 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 18325 | if (!_ret) |
| 18326 | { |
| 18327 | g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", |
| 18328 | info->parent_struct.name, |
| 18329 | error->message, g_quark_to_string (error->domain), error->code); |
| 18330 | g_error_free (error); |
| 18331 | } |
| 18332 | else |
| 18333 | { |
| 18334 | g_variant_unref (_ret); |
| 18335 | } |
| 18336 | } |
| 18337 | |
| 18338 | static void |
| 18339 | watchdog_proxy_set_property (GObject *object, |
| 18340 | guint prop_id, |
| 18341 | const GValue *value, |
| 18342 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18343 | { |
| 18344 | const _ExtendedGDBusPropertyInfo *info; |
| 18345 | GVariant *variant; |
| 18346 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 18347 | info = _watchdog_property_info_pointers[prop_id - 1]; |
| 18348 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 18349 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 18350 | "org.freedesktop.DBus.Properties.Set", |
| 18351 | g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), |
| 18352 | G_DBUS_CALL_FLAGS_NONE, |
| 18353 | -1, |
| 18354 | NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 18355 | g_variant_unref (variant); |
| 18356 | } |
| 18357 | |
| 18358 | static void |
| 18359 | watchdog_proxy_g_signal (GDBusProxy *proxy, |
| 18360 | const gchar *sender_name G_GNUC_UNUSED, |
| 18361 | const gchar *signal_name, |
| 18362 | GVariant *parameters) |
| 18363 | { |
| 18364 | _ExtendedGDBusSignalInfo *info; |
| 18365 | GVariantIter iter; |
| 18366 | GVariant *child; |
| 18367 | GValue *paramv; |
| 18368 | guint num_params; |
| 18369 | guint n; |
| 18370 | guint signal_id; |
| 18371 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); |
| 18372 | if (info == NULL) |
| 18373 | return; |
| 18374 | num_params = g_variant_n_children (parameters); |
| 18375 | paramv = g_new0 (GValue, num_params + 1); |
| 18376 | g_value_init (¶mv[0], TYPE_WATCHDOG); |
| 18377 | g_value_set_object (¶mv[0], proxy); |
| 18378 | g_variant_iter_init (&iter, parameters); |
| 18379 | n = 1; |
| 18380 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18381 | { |
| 18382 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 18383 | if (arg_info->use_gvariant) |
| 18384 | { |
| 18385 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18386 | g_value_set_variant (¶mv[n], child); |
| 18387 | n++; |
| 18388 | } |
| 18389 | else |
| 18390 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18391 | g_variant_unref (child); |
| 18392 | } |
| 18393 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 18394 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 18395 | for (n = 0; n < num_params + 1; n++) |
| 18396 | g_value_unset (¶mv[n]); |
| 18397 | g_free (paramv); |
| 18398 | } |
| 18399 | |
| 18400 | static void |
| 18401 | watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 18402 | GVariant *changed_properties, |
| 18403 | const gchar *const *invalidated_properties) |
| 18404 | { |
| 18405 | WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); |
| 18406 | guint n; |
| 18407 | const gchar *key; |
| 18408 | GVariantIter *iter; |
| 18409 | _ExtendedGDBusPropertyInfo *info; |
| 18410 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 18411 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 18412 | { |
| 18413 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); |
| 18414 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 18415 | if (info != NULL) |
| 18416 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 18417 | } |
| 18418 | g_variant_iter_free (iter); |
| 18419 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 18420 | { |
| 18421 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); |
| 18422 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 18423 | if (info != NULL) |
| 18424 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 18425 | } |
| 18426 | } |
| 18427 | |
| 18428 | static gint |
| 18429 | watchdog_proxy_get_watchdog (Watchdog *object) |
| 18430 | { |
| 18431 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 18432 | GVariant *variant; |
| 18433 | gint value = 0; |
| 18434 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); |
| 18435 | if (variant != NULL) |
| 18436 | { |
| 18437 | value = g_variant_get_int32 (variant); |
| 18438 | g_variant_unref (variant); |
| 18439 | } |
| 18440 | return value; |
| 18441 | } |
| 18442 | |
| 18443 | static gint |
| 18444 | watchdog_proxy_get_poll_interval (Watchdog *object) |
| 18445 | { |
| 18446 | WatchdogProxy *proxy = WATCHDOG_PROXY (object); |
| 18447 | GVariant *variant; |
| 18448 | gint value = 0; |
| 18449 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 18450 | if (variant != NULL) |
| 18451 | { |
| 18452 | value = g_variant_get_int32 (variant); |
| 18453 | g_variant_unref (variant); |
| 18454 | } |
| 18455 | return value; |
| 18456 | } |
| 18457 | |
| 18458 | static void |
| 18459 | watchdog_proxy_init (WatchdogProxy *proxy) |
| 18460 | { |
| 18461 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18462 | proxy->priv = watchdog_proxy_get_instance_private (proxy); |
| 18463 | #else |
| 18464 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); |
| 18465 | #endif |
| 18466 | |
| 18467 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); |
| 18468 | } |
| 18469 | |
| 18470 | static void |
| 18471 | watchdog_proxy_class_init (WatchdogProxyClass *klass) |
| 18472 | { |
| 18473 | GObjectClass *gobject_class; |
| 18474 | GDBusProxyClass *proxy_class; |
| 18475 | |
| 18476 | gobject_class = G_OBJECT_CLASS (klass); |
| 18477 | gobject_class->finalize = watchdog_proxy_finalize; |
| 18478 | gobject_class->get_property = watchdog_proxy_get_property; |
| 18479 | gobject_class->set_property = watchdog_proxy_set_property; |
| 18480 | |
| 18481 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 18482 | proxy_class->g_signal = watchdog_proxy_g_signal; |
| 18483 | proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; |
| 18484 | |
| 18485 | watchdog_override_properties (gobject_class, 1); |
| 18486 | |
| 18487 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 18488 | g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); |
| 18489 | #endif |
| 18490 | } |
| 18491 | |
| 18492 | static void |
| 18493 | watchdog_proxy_iface_init (WatchdogIface *iface) |
| 18494 | { |
| 18495 | iface->get_watchdog = watchdog_proxy_get_watchdog; |
| 18496 | iface->get_poll_interval = watchdog_proxy_get_poll_interval; |
| 18497 | } |
| 18498 | |
| 18499 | /** |
| 18500 | * watchdog_proxy_new: |
| 18501 | * @connection: A #GDBusConnection. |
| 18502 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18503 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 18504 | * @object_path: An object path. |
| 18505 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18506 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 18507 | * @user_data: User data to pass to @callback. |
| 18508 | * |
| 18509 | * 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. |
| 18510 | * |
| 18511 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 18512 | * You can then call watchdog_proxy_new_finish() to get the result of the operation. |
| 18513 | * |
| 18514 | * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 18515 | */ |
| 18516 | void |
| 18517 | watchdog_proxy_new ( |
| 18518 | GDBusConnection *connection, |
| 18519 | GDBusProxyFlags flags, |
| 18520 | const gchar *name, |
| 18521 | const gchar *object_path, |
| 18522 | GCancellable *cancellable, |
| 18523 | GAsyncReadyCallback callback, |
| 18524 | gpointer user_data) |
| 18525 | { |
| 18526 | 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); |
| 18527 | } |
| 18528 | |
| 18529 | /** |
| 18530 | * watchdog_proxy_new_finish: |
| 18531 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). |
| 18532 | * @error: Return location for error or %NULL |
| 18533 | * |
| 18534 | * Finishes an operation started with watchdog_proxy_new(). |
| 18535 | * |
| 18536 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 18537 | */ |
| 18538 | Watchdog * |
| 18539 | watchdog_proxy_new_finish ( |
| 18540 | GAsyncResult *res, |
| 18541 | GError **error) |
| 18542 | { |
| 18543 | GObject *ret; |
| 18544 | GObject *source_object; |
| 18545 | source_object = g_async_result_get_source_object (res); |
| 18546 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18547 | g_object_unref (source_object); |
| 18548 | if (ret != NULL) |
| 18549 | return WATCHDOG (ret); |
| 18550 | else |
| 18551 | return NULL; |
| 18552 | } |
| 18553 | |
| 18554 | /** |
| 18555 | * watchdog_proxy_new_sync: |
| 18556 | * @connection: A #GDBusConnection. |
| 18557 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18558 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 18559 | * @object_path: An object path. |
| 18560 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18561 | * @error: Return location for error or %NULL |
| 18562 | * |
| 18563 | * 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. |
| 18564 | * |
| 18565 | * The calling thread is blocked until a reply is received. |
| 18566 | * |
| 18567 | * See watchdog_proxy_new() for the asynchronous version of this constructor. |
| 18568 | * |
| 18569 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 18570 | */ |
| 18571 | Watchdog * |
| 18572 | watchdog_proxy_new_sync ( |
| 18573 | GDBusConnection *connection, |
| 18574 | GDBusProxyFlags flags, |
| 18575 | const gchar *name, |
| 18576 | const gchar *object_path, |
| 18577 | GCancellable *cancellable, |
| 18578 | GError **error) |
| 18579 | { |
| 18580 | GInitable *ret; |
| 18581 | 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); |
| 18582 | if (ret != NULL) |
| 18583 | return WATCHDOG (ret); |
| 18584 | else |
| 18585 | return NULL; |
| 18586 | } |
| 18587 | |
| 18588 | |
| 18589 | /** |
| 18590 | * watchdog_proxy_new_for_bus: |
| 18591 | * @bus_type: A #GBusType. |
| 18592 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18593 | * @name: A bus name (well-known or unique). |
| 18594 | * @object_path: An object path. |
| 18595 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18596 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 18597 | * @user_data: User data to pass to @callback. |
| 18598 | * |
| 18599 | * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 18600 | * |
| 18601 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 18602 | * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. |
| 18603 | * |
| 18604 | * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 18605 | */ |
| 18606 | void |
| 18607 | watchdog_proxy_new_for_bus ( |
| 18608 | GBusType bus_type, |
| 18609 | GDBusProxyFlags flags, |
| 18610 | const gchar *name, |
| 18611 | const gchar *object_path, |
| 18612 | GCancellable *cancellable, |
| 18613 | GAsyncReadyCallback callback, |
| 18614 | gpointer user_data) |
| 18615 | { |
| 18616 | 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); |
| 18617 | } |
| 18618 | |
| 18619 | /** |
| 18620 | * watchdog_proxy_new_for_bus_finish: |
| 18621 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). |
| 18622 | * @error: Return location for error or %NULL |
| 18623 | * |
| 18624 | * Finishes an operation started with watchdog_proxy_new_for_bus(). |
| 18625 | * |
| 18626 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 18627 | */ |
| 18628 | Watchdog * |
| 18629 | watchdog_proxy_new_for_bus_finish ( |
| 18630 | GAsyncResult *res, |
| 18631 | GError **error) |
| 18632 | { |
| 18633 | GObject *ret; |
| 18634 | GObject *source_object; |
| 18635 | source_object = g_async_result_get_source_object (res); |
| 18636 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 18637 | g_object_unref (source_object); |
| 18638 | if (ret != NULL) |
| 18639 | return WATCHDOG (ret); |
| 18640 | else |
| 18641 | return NULL; |
| 18642 | } |
| 18643 | |
| 18644 | /** |
| 18645 | * watchdog_proxy_new_for_bus_sync: |
| 18646 | * @bus_type: A #GBusType. |
| 18647 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 18648 | * @name: A bus name (well-known or unique). |
| 18649 | * @object_path: An object path. |
| 18650 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 18651 | * @error: Return location for error or %NULL |
| 18652 | * |
| 18653 | * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 18654 | * |
| 18655 | * The calling thread is blocked until a reply is received. |
| 18656 | * |
| 18657 | * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 18658 | * |
| 18659 | * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. |
| 18660 | */ |
| 18661 | Watchdog * |
| 18662 | watchdog_proxy_new_for_bus_sync ( |
| 18663 | GBusType bus_type, |
| 18664 | GDBusProxyFlags flags, |
| 18665 | const gchar *name, |
| 18666 | const gchar *object_path, |
| 18667 | GCancellable *cancellable, |
| 18668 | GError **error) |
| 18669 | { |
| 18670 | GInitable *ret; |
| 18671 | 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); |
| 18672 | if (ret != NULL) |
| 18673 | return WATCHDOG (ret); |
| 18674 | else |
| 18675 | return NULL; |
| 18676 | } |
| 18677 | |
| 18678 | |
| 18679 | /* ------------------------------------------------------------------------ */ |
| 18680 | |
| 18681 | /** |
| 18682 | * WatchdogSkeleton: |
| 18683 | * |
| 18684 | * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 18685 | */ |
| 18686 | |
| 18687 | /** |
| 18688 | * WatchdogSkeletonClass: |
| 18689 | * @parent_class: The parent class. |
| 18690 | * |
| 18691 | * Class structure for #WatchdogSkeleton. |
| 18692 | */ |
| 18693 | |
| 18694 | struct _WatchdogSkeletonPrivate |
| 18695 | { |
| 18696 | GValue *properties; |
| 18697 | GList *changed_properties; |
| 18698 | GSource *changed_properties_idle_source; |
| 18699 | GMainContext *context; |
| 18700 | GMutex lock; |
| 18701 | }; |
| 18702 | |
| 18703 | static void |
| 18704 | _watchdog_skeleton_handle_method_call ( |
| 18705 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18706 | const gchar *sender G_GNUC_UNUSED, |
| 18707 | const gchar *object_path G_GNUC_UNUSED, |
| 18708 | const gchar *interface_name, |
| 18709 | const gchar *method_name, |
| 18710 | GVariant *parameters, |
| 18711 | GDBusMethodInvocation *invocation, |
| 18712 | gpointer user_data) |
| 18713 | { |
| 18714 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 18715 | _ExtendedGDBusMethodInfo *info; |
| 18716 | GVariantIter iter; |
| 18717 | GVariant *child; |
| 18718 | GValue *paramv; |
| 18719 | guint num_params; |
| 18720 | guint num_extra; |
| 18721 | guint n; |
| 18722 | guint signal_id; |
| 18723 | GValue return_value = G_VALUE_INIT; |
| 18724 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 18725 | g_assert (info != NULL); |
| 18726 | num_params = g_variant_n_children (parameters); |
| 18727 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 18728 | n = 0; |
| 18729 | g_value_init (¶mv[n], TYPE_WATCHDOG); |
| 18730 | g_value_set_object (¶mv[n++], skeleton); |
| 18731 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 18732 | g_value_set_object (¶mv[n++], invocation); |
| 18733 | if (info->pass_fdlist) |
| 18734 | { |
| 18735 | #ifdef G_OS_UNIX |
| 18736 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 18737 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 18738 | #else |
| 18739 | g_assert_not_reached (); |
| 18740 | #endif |
| 18741 | } |
| 18742 | g_variant_iter_init (&iter, parameters); |
| 18743 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 18744 | { |
| 18745 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 18746 | if (arg_info->use_gvariant) |
| 18747 | { |
| 18748 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 18749 | g_value_set_variant (¶mv[n], child); |
| 18750 | n++; |
| 18751 | } |
| 18752 | else |
| 18753 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 18754 | g_variant_unref (child); |
| 18755 | } |
| 18756 | signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); |
| 18757 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 18758 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 18759 | if (!g_value_get_boolean (&return_value)) |
| 18760 | 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); |
| 18761 | g_value_unset (&return_value); |
| 18762 | for (n = 0; n < num_params + num_extra; n++) |
| 18763 | g_value_unset (¶mv[n]); |
| 18764 | g_free (paramv); |
| 18765 | } |
| 18766 | |
| 18767 | static GVariant * |
| 18768 | _watchdog_skeleton_handle_get_property ( |
| 18769 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18770 | const gchar *sender G_GNUC_UNUSED, |
| 18771 | const gchar *object_path G_GNUC_UNUSED, |
| 18772 | const gchar *interface_name G_GNUC_UNUSED, |
| 18773 | const gchar *property_name, |
| 18774 | GError **error, |
| 18775 | gpointer user_data) |
| 18776 | { |
| 18777 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 18778 | GValue value = G_VALUE_INIT; |
| 18779 | GParamSpec *pspec; |
| 18780 | _ExtendedGDBusPropertyInfo *info; |
| 18781 | GVariant *ret; |
| 18782 | ret = NULL; |
| 18783 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 18784 | g_assert (info != NULL); |
| 18785 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18786 | if (pspec == NULL) |
| 18787 | { |
| 18788 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18789 | } |
| 18790 | else |
| 18791 | { |
| 18792 | g_value_init (&value, pspec->value_type); |
| 18793 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18794 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 18795 | g_value_unset (&value); |
| 18796 | } |
| 18797 | return ret; |
| 18798 | } |
| 18799 | |
| 18800 | static gboolean |
| 18801 | _watchdog_skeleton_handle_set_property ( |
| 18802 | GDBusConnection *connection G_GNUC_UNUSED, |
| 18803 | const gchar *sender G_GNUC_UNUSED, |
| 18804 | const gchar *object_path G_GNUC_UNUSED, |
| 18805 | const gchar *interface_name G_GNUC_UNUSED, |
| 18806 | const gchar *property_name, |
| 18807 | GVariant *variant, |
| 18808 | GError **error, |
| 18809 | gpointer user_data) |
| 18810 | { |
| 18811 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 18812 | GValue value = G_VALUE_INIT; |
| 18813 | GParamSpec *pspec; |
| 18814 | _ExtendedGDBusPropertyInfo *info; |
| 18815 | gboolean ret; |
| 18816 | ret = FALSE; |
| 18817 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); |
| 18818 | g_assert (info != NULL); |
| 18819 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 18820 | if (pspec == NULL) |
| 18821 | { |
| 18822 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 18823 | } |
| 18824 | else |
| 18825 | { |
| 18826 | if (info->use_gvariant) |
| 18827 | g_value_set_variant (&value, variant); |
| 18828 | else |
| 18829 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 18830 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 18831 | g_value_unset (&value); |
| 18832 | ret = TRUE; |
| 18833 | } |
| 18834 | return ret; |
| 18835 | } |
| 18836 | |
| 18837 | static const GDBusInterfaceVTable _watchdog_skeleton_vtable = |
| 18838 | { |
| 18839 | _watchdog_skeleton_handle_method_call, |
| 18840 | _watchdog_skeleton_handle_get_property, |
| 18841 | _watchdog_skeleton_handle_set_property, |
| 18842 | {NULL} |
| 18843 | }; |
| 18844 | |
| 18845 | static GDBusInterfaceInfo * |
| 18846 | watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18847 | { |
| 18848 | return watchdog_interface_info (); |
| 18849 | } |
| 18850 | |
| 18851 | static GDBusInterfaceVTable * |
| 18852 | watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 18853 | { |
| 18854 | return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; |
| 18855 | } |
| 18856 | |
| 18857 | static GVariant * |
| 18858 | watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 18859 | { |
| 18860 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 18861 | |
| 18862 | GVariantBuilder builder; |
| 18863 | guint n; |
| 18864 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18865 | if (_watchdog_interface_info.parent_struct.properties == NULL) |
| 18866 | goto out; |
| 18867 | for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) |
| 18868 | { |
| 18869 | GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; |
| 18870 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 18871 | { |
| 18872 | GVariant *value; |
| 18873 | 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); |
| 18874 | if (value != NULL) |
| 18875 | { |
| 18876 | g_variant_take_ref (value); |
| 18877 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 18878 | g_variant_unref (value); |
| 18879 | } |
| 18880 | } |
| 18881 | } |
| 18882 | out: |
| 18883 | return g_variant_builder_end (&builder); |
| 18884 | } |
| 18885 | |
| 18886 | static gboolean _watchdog_emit_changed (gpointer user_data); |
| 18887 | |
| 18888 | static void |
| 18889 | watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 18890 | { |
| 18891 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); |
| 18892 | gboolean emit_changed = FALSE; |
| 18893 | |
| 18894 | g_mutex_lock (&skeleton->priv->lock); |
| 18895 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18896 | { |
| 18897 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18898 | skeleton->priv->changed_properties_idle_source = NULL; |
| 18899 | emit_changed = TRUE; |
| 18900 | } |
| 18901 | g_mutex_unlock (&skeleton->priv->lock); |
| 18902 | |
| 18903 | if (emit_changed) |
| 18904 | _watchdog_emit_changed (skeleton); |
| 18905 | } |
| 18906 | |
| 18907 | static void |
| 18908 | _watchdog_on_signal_watchdog_error ( |
| 18909 | Watchdog *object) |
| 18910 | { |
| 18911 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 18912 | |
| 18913 | GList *connections, *l; |
| 18914 | GVariant *signal_variant; |
| 18915 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 18916 | |
| 18917 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 18918 | for (l = connections; l != NULL; l = l->next) |
| 18919 | { |
| 18920 | GDBusConnection *connection = l->data; |
| 18921 | g_dbus_connection_emit_signal (connection, |
| 18922 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", |
| 18923 | signal_variant, NULL); |
| 18924 | } |
| 18925 | g_variant_unref (signal_variant); |
| 18926 | g_list_free_full (connections, g_object_unref); |
| 18927 | } |
| 18928 | |
| 18929 | static void watchdog_skeleton_iface_init (WatchdogIface *iface); |
| 18930 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 18931 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18932 | G_ADD_PRIVATE (WatchdogSkeleton) |
| 18933 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 18934 | |
| 18935 | #else |
| 18936 | G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 18937 | G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); |
| 18938 | |
| 18939 | #endif |
| 18940 | static void |
| 18941 | watchdog_skeleton_finalize (GObject *object) |
| 18942 | { |
| 18943 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 18944 | guint n; |
| 18945 | for (n = 0; n < 2; n++) |
| 18946 | g_value_unset (&skeleton->priv->properties[n]); |
| 18947 | g_free (skeleton->priv->properties); |
| 18948 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 18949 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 18950 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 18951 | g_main_context_unref (skeleton->priv->context); |
| 18952 | g_mutex_clear (&skeleton->priv->lock); |
| 18953 | G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); |
| 18954 | } |
| 18955 | |
| 18956 | static void |
| 18957 | watchdog_skeleton_get_property (GObject *object, |
| 18958 | guint prop_id, |
| 18959 | GValue *value, |
| 18960 | GParamSpec *pspec G_GNUC_UNUSED) |
| 18961 | { |
| 18962 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 18963 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 18964 | g_mutex_lock (&skeleton->priv->lock); |
| 18965 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 18966 | g_mutex_unlock (&skeleton->priv->lock); |
| 18967 | } |
| 18968 | |
| 18969 | static gboolean |
| 18970 | _watchdog_emit_changed (gpointer user_data) |
| 18971 | { |
| 18972 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); |
| 18973 | GList *l; |
| 18974 | GVariantBuilder builder; |
| 18975 | GVariantBuilder invalidated_builder; |
| 18976 | guint num_changes; |
| 18977 | |
| 18978 | g_mutex_lock (&skeleton->priv->lock); |
| 18979 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 18980 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 18981 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 18982 | { |
| 18983 | ChangedProperty *cp = l->data; |
| 18984 | GVariant *variant; |
| 18985 | const GValue *cur_value; |
| 18986 | |
| 18987 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 18988 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 18989 | { |
| 18990 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 18991 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 18992 | g_variant_unref (variant); |
| 18993 | num_changes++; |
| 18994 | } |
| 18995 | } |
| 18996 | if (num_changes > 0) |
| 18997 | { |
| 18998 | GList *connections, *ll; |
| 18999 | GVariant *signal_variant; |
| 19000 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", |
| 19001 | &builder, &invalidated_builder)); |
| 19002 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 19003 | for (ll = connections; ll != NULL; ll = ll->next) |
| 19004 | { |
| 19005 | GDBusConnection *connection = ll->data; |
| 19006 | |
| 19007 | g_dbus_connection_emit_signal (connection, |
| 19008 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 19009 | "org.freedesktop.DBus.Properties", |
| 19010 | "PropertiesChanged", |
| 19011 | signal_variant, |
| 19012 | NULL); |
| 19013 | } |
| 19014 | g_variant_unref (signal_variant); |
| 19015 | g_list_free_full (connections, g_object_unref); |
| 19016 | } |
| 19017 | else |
| 19018 | { |
| 19019 | g_variant_builder_clear (&builder); |
| 19020 | g_variant_builder_clear (&invalidated_builder); |
| 19021 | } |
| 19022 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 19023 | skeleton->priv->changed_properties = NULL; |
| 19024 | skeleton->priv->changed_properties_idle_source = NULL; |
| 19025 | g_mutex_unlock (&skeleton->priv->lock); |
| 19026 | return FALSE; |
| 19027 | } |
| 19028 | |
| 19029 | static void |
| 19030 | _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 19031 | { |
| 19032 | ChangedProperty *cp; |
| 19033 | GList *l; |
| 19034 | cp = NULL; |
| 19035 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 19036 | { |
| 19037 | ChangedProperty *i_cp = l->data; |
| 19038 | if (i_cp->info == info) |
| 19039 | { |
| 19040 | cp = i_cp; |
| 19041 | break; |
| 19042 | } |
| 19043 | } |
| 19044 | if (cp == NULL) |
| 19045 | { |
| 19046 | cp = g_new0 (ChangedProperty, 1); |
| 19047 | cp->prop_id = prop_id; |
| 19048 | cp->info = info; |
| 19049 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 19050 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 19051 | g_value_copy (orig_value, &cp->orig_value); |
| 19052 | } |
| 19053 | } |
| 19054 | |
| 19055 | static void |
| 19056 | watchdog_skeleton_notify (GObject *object, |
| 19057 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19058 | { |
| 19059 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 19060 | g_mutex_lock (&skeleton->priv->lock); |
| 19061 | if (skeleton->priv->changed_properties != NULL && |
| 19062 | skeleton->priv->changed_properties_idle_source == NULL) |
| 19063 | { |
| 19064 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 19065 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 19066 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 19067 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 19068 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 19069 | } |
| 19070 | g_mutex_unlock (&skeleton->priv->lock); |
| 19071 | } |
| 19072 | |
| 19073 | static void |
| 19074 | watchdog_skeleton_set_property (GObject *object, |
| 19075 | guint prop_id, |
| 19076 | const GValue *value, |
| 19077 | GParamSpec *pspec) |
| 19078 | { |
| 19079 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 19080 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 19081 | g_mutex_lock (&skeleton->priv->lock); |
| 19082 | g_object_freeze_notify (object); |
| 19083 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 19084 | { |
| 19085 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 19086 | _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 19087 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 19088 | g_object_notify_by_pspec (object, pspec); |
| 19089 | } |
| 19090 | g_mutex_unlock (&skeleton->priv->lock); |
| 19091 | g_object_thaw_notify (object); |
| 19092 | } |
| 19093 | |
| 19094 | static void |
| 19095 | watchdog_skeleton_init (WatchdogSkeleton *skeleton) |
| 19096 | { |
| 19097 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19098 | skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); |
| 19099 | #else |
| 19100 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); |
| 19101 | #endif |
| 19102 | |
| 19103 | g_mutex_init (&skeleton->priv->lock); |
| 19104 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 19105 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 19106 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 19107 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 19108 | } |
| 19109 | |
| 19110 | static gint |
| 19111 | watchdog_skeleton_get_watchdog (Watchdog *object) |
| 19112 | { |
| 19113 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 19114 | gint value; |
| 19115 | g_mutex_lock (&skeleton->priv->lock); |
| 19116 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 19117 | g_mutex_unlock (&skeleton->priv->lock); |
| 19118 | return value; |
| 19119 | } |
| 19120 | |
| 19121 | static gint |
| 19122 | watchdog_skeleton_get_poll_interval (Watchdog *object) |
| 19123 | { |
| 19124 | WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); |
| 19125 | gint value; |
| 19126 | g_mutex_lock (&skeleton->priv->lock); |
| 19127 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 19128 | g_mutex_unlock (&skeleton->priv->lock); |
| 19129 | return value; |
| 19130 | } |
| 19131 | |
| 19132 | static void |
| 19133 | watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) |
| 19134 | { |
| 19135 | GObjectClass *gobject_class; |
| 19136 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 19137 | |
| 19138 | gobject_class = G_OBJECT_CLASS (klass); |
| 19139 | gobject_class->finalize = watchdog_skeleton_finalize; |
| 19140 | gobject_class->get_property = watchdog_skeleton_get_property; |
| 19141 | gobject_class->set_property = watchdog_skeleton_set_property; |
| 19142 | gobject_class->notify = watchdog_skeleton_notify; |
| 19143 | |
| 19144 | |
| 19145 | watchdog_override_properties (gobject_class, 1); |
| 19146 | |
| 19147 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 19148 | skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; |
| 19149 | skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; |
| 19150 | skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; |
| 19151 | skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; |
| 19152 | |
| 19153 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 19154 | g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); |
| 19155 | #endif |
| 19156 | } |
| 19157 | |
| 19158 | static void |
| 19159 | watchdog_skeleton_iface_init (WatchdogIface *iface) |
| 19160 | { |
| 19161 | iface->watchdog_error = _watchdog_on_signal_watchdog_error; |
| 19162 | iface->get_watchdog = watchdog_skeleton_get_watchdog; |
| 19163 | iface->get_poll_interval = watchdog_skeleton_get_poll_interval; |
| 19164 | } |
| 19165 | |
| 19166 | /** |
| 19167 | * watchdog_skeleton_new: |
| 19168 | * |
| 19169 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. |
| 19170 | * |
| 19171 | * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. |
| 19172 | */ |
| 19173 | Watchdog * |
| 19174 | watchdog_skeleton_new (void) |
| 19175 | { |
| 19176 | return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); |
| 19177 | } |
| 19178 | |
| 19179 | /* ------------------------------------------------------------------------ |
| 19180 | * Code for interface org.openbmc.EventLog |
| 19181 | * ------------------------------------------------------------------------ |
| 19182 | */ |
| 19183 | |
| 19184 | /** |
| 19185 | * SECTION:EventLog |
| 19186 | * @title: EventLog |
| 19187 | * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface |
| 19188 | * |
| 19189 | * 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. |
| 19190 | */ |
| 19191 | |
| 19192 | /* ---- Introspection data for org.openbmc.EventLog ---- */ |
| 19193 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 19194 | static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log = |
| 19195 | { |
| 19196 | { |
| 19197 | -1, |
| 19198 | (gchar *) "log", |
| 19199 | (gchar *) "a(s)", |
| 19200 | NULL |
| 19201 | }, |
| 19202 | FALSE |
| 19203 | }; |
| 19204 | |
| 19205 | static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] = |
| 19206 | { |
| 19207 | &_event_log_method_info_get_event_log_OUT_ARG_log, |
| 19208 | NULL |
| 19209 | }; |
| 19210 | |
| 19211 | static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log = |
| 19212 | { |
| 19213 | { |
| 19214 | -1, |
| 19215 | (gchar *) "getEventLog", |
| 19216 | NULL, |
| 19217 | (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers, |
| 19218 | NULL |
| 19219 | }, |
| 19220 | "handle-get-event-log", |
| 19221 | FALSE |
| 19222 | }; |
| 19223 | |
| 19224 | static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] = |
| 19225 | { |
| 19226 | &_event_log_method_info_get_event_log, |
| 19227 | NULL |
| 19228 | }; |
| 19229 | |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19230 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19231 | { |
| 19232 | { |
| 19233 | -1, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19234 | (gchar *) "priority", |
| 19235 | (gchar *) "i", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19236 | NULL |
| 19237 | }, |
| 19238 | FALSE |
| 19239 | }; |
| 19240 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19241 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message = |
| 19242 | { |
| 19243 | { |
| 19244 | -1, |
| 19245 | (gchar *) "message", |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 19246 | (gchar *) "s", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19247 | NULL |
| 19248 | }, |
| 19249 | FALSE |
| 19250 | }; |
| 19251 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19252 | static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc = |
| 19253 | { |
| 19254 | { |
| 19255 | -1, |
| 19256 | (gchar *) "rc", |
| 19257 | (gchar *) "i", |
| 19258 | NULL |
| 19259 | }, |
| 19260 | FALSE |
| 19261 | }; |
| 19262 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19263 | static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] = |
| 19264 | { |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19265 | &_event_log_signal_info_event_log_ARG_priority, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19266 | &_event_log_signal_info_event_log_ARG_message, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19267 | &_event_log_signal_info_event_log_ARG_rc, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19268 | NULL |
| 19269 | }; |
| 19270 | |
| 19271 | static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log = |
| 19272 | { |
| 19273 | { |
| 19274 | -1, |
| 19275 | (gchar *) "EventLog", |
| 19276 | (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers, |
| 19277 | NULL |
| 19278 | }, |
| 19279 | "event-log" |
| 19280 | }; |
| 19281 | |
| 19282 | static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] = |
| 19283 | { |
| 19284 | &_event_log_signal_info_event_log, |
| 19285 | NULL |
| 19286 | }; |
| 19287 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19288 | static const _ExtendedGDBusInterfaceInfo _event_log_interface_info = |
| 19289 | { |
| 19290 | { |
| 19291 | -1, |
| 19292 | (gchar *) "org.openbmc.EventLog", |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 19293 | (GDBusMethodInfo **) &_event_log_method_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19294 | (GDBusSignalInfo **) &_event_log_signal_info_pointers, |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 19295 | NULL, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19296 | NULL |
| 19297 | }, |
| 19298 | "event-log", |
| 19299 | }; |
| 19300 | |
| 19301 | |
| 19302 | /** |
| 19303 | * event_log_interface_info: |
| 19304 | * |
| 19305 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface. |
| 19306 | * |
| 19307 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 19308 | */ |
| 19309 | GDBusInterfaceInfo * |
| 19310 | event_log_interface_info (void) |
| 19311 | { |
| 19312 | return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct; |
| 19313 | } |
| 19314 | |
| 19315 | /** |
| 19316 | * event_log_override_properties: |
| 19317 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 19318 | * @property_id_begin: The property id to assign to the first overridden property. |
| 19319 | * |
| 19320 | * Overrides all #GObject properties in the #EventLog interface for a concrete class. |
| 19321 | * The properties are overridden in the order they are defined. |
| 19322 | * |
| 19323 | * Returns: The last property id. |
| 19324 | */ |
| 19325 | guint |
| 19326 | event_log_override_properties (GObjectClass *klass, guint property_id_begin) |
| 19327 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19328 | return property_id_begin - 1; |
| 19329 | } |
| 19330 | |
| 19331 | |
| 19332 | |
| 19333 | /** |
| 19334 | * EventLog: |
| 19335 | * |
| 19336 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 19337 | */ |
| 19338 | |
| 19339 | /** |
| 19340 | * EventLogIface: |
| 19341 | * @parent_iface: The parent interface. |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 19342 | * @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] | 19343 | * @event_log: Handler for the #EventLog::event-log signal. |
| 19344 | * |
| 19345 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 19346 | */ |
| 19347 | |
| 19348 | typedef EventLogIface EventLogInterface; |
| 19349 | G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT); |
| 19350 | |
| 19351 | static void |
| 19352 | event_log_default_init (EventLogIface *iface) |
| 19353 | { |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 19354 | /* GObject signals for incoming D-Bus method calls: */ |
| 19355 | /** |
| 19356 | * EventLog::handle-get-event-log: |
| 19357 | * @object: A #EventLog. |
| 19358 | * @invocation: A #GDBusMethodInvocation. |
| 19359 | * |
| 19360 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. |
| 19361 | * |
| 19362 | * 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. |
| 19363 | * |
| 19364 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 19365 | */ |
| 19366 | g_signal_new ("handle-get-event-log", |
| 19367 | G_TYPE_FROM_INTERFACE (iface), |
| 19368 | G_SIGNAL_RUN_LAST, |
| 19369 | G_STRUCT_OFFSET (EventLogIface, handle_get_event_log), |
| 19370 | g_signal_accumulator_true_handled, |
| 19371 | NULL, |
| 19372 | g_cclosure_marshal_generic, |
| 19373 | G_TYPE_BOOLEAN, |
| 19374 | 1, |
| 19375 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 19376 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19377 | /* GObject signals for received D-Bus signals: */ |
| 19378 | /** |
| 19379 | * EventLog::event-log: |
| 19380 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19381 | * @arg_priority: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19382 | * @arg_message: Argument. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19383 | * @arg_rc: Argument. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19384 | * |
| 19385 | * 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. |
| 19386 | * |
| 19387 | * 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. |
| 19388 | */ |
| 19389 | g_signal_new ("event-log", |
| 19390 | G_TYPE_FROM_INTERFACE (iface), |
| 19391 | G_SIGNAL_RUN_LAST, |
| 19392 | G_STRUCT_OFFSET (EventLogIface, event_log), |
| 19393 | NULL, |
| 19394 | NULL, |
| 19395 | g_cclosure_marshal_generic, |
| 19396 | G_TYPE_NONE, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19397 | 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19398 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19399 | } |
| 19400 | |
| 19401 | /** |
| 19402 | * event_log_emit_event_log: |
| 19403 | * @object: A #EventLog. |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19404 | * @arg_priority: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19405 | * @arg_message: Argument to pass with the signal. |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19406 | * @arg_rc: Argument to pass with the signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19407 | * |
| 19408 | * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal. |
| 19409 | */ |
| 19410 | void |
| 19411 | event_log_emit_event_log ( |
| 19412 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 19413 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19414 | const gchar *arg_message, |
| 19415 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19416 | { |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 19417 | 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] | 19418 | } |
| 19419 | |
Norman James | 2d1ee89 | 2015-09-16 23:13:45 -0500 | [diff] [blame] | 19420 | /** |
| 19421 | * event_log_call_get_event_log: |
| 19422 | * @proxy: A #EventLogProxy. |
| 19423 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19424 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 19425 | * @user_data: User data to pass to @callback. |
| 19426 | * |
| 19427 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. |
| 19428 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 19429 | * You can then call event_log_call_get_event_log_finish() to get the result of the operation. |
| 19430 | * |
| 19431 | * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method. |
| 19432 | */ |
| 19433 | void |
| 19434 | event_log_call_get_event_log ( |
| 19435 | EventLog *proxy, |
| 19436 | GCancellable *cancellable, |
| 19437 | GAsyncReadyCallback callback, |
| 19438 | gpointer user_data) |
| 19439 | { |
| 19440 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 19441 | "getEventLog", |
| 19442 | g_variant_new ("()"), |
| 19443 | G_DBUS_CALL_FLAGS_NONE, |
| 19444 | -1, |
| 19445 | cancellable, |
| 19446 | callback, |
| 19447 | user_data); |
| 19448 | } |
| 19449 | |
| 19450 | /** |
| 19451 | * event_log_call_get_event_log_finish: |
| 19452 | * @proxy: A #EventLogProxy. |
| 19453 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 19454 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log(). |
| 19455 | * @error: Return location for error or %NULL. |
| 19456 | * |
| 19457 | * Finishes an operation started with event_log_call_get_event_log(). |
| 19458 | * |
| 19459 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19460 | */ |
| 19461 | gboolean |
| 19462 | event_log_call_get_event_log_finish ( |
| 19463 | EventLog *proxy, |
| 19464 | GVariant **out_log, |
| 19465 | GAsyncResult *res, |
| 19466 | GError **error) |
| 19467 | { |
| 19468 | GVariant *_ret; |
| 19469 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 19470 | if (_ret == NULL) |
| 19471 | goto _out; |
| 19472 | g_variant_get (_ret, |
| 19473 | "(@a(s))", |
| 19474 | out_log); |
| 19475 | g_variant_unref (_ret); |
| 19476 | _out: |
| 19477 | return _ret != NULL; |
| 19478 | } |
| 19479 | |
| 19480 | /** |
| 19481 | * event_log_call_get_event_log_sync: |
| 19482 | * @proxy: A #EventLogProxy. |
| 19483 | * @out_log: (out): Return location for return parameter or %NULL to ignore. |
| 19484 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19485 | * @error: Return location for error or %NULL. |
| 19486 | * |
| 19487 | * 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. |
| 19488 | * |
| 19489 | * See event_log_call_get_event_log() for the asynchronous version of this method. |
| 19490 | * |
| 19491 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 19492 | */ |
| 19493 | gboolean |
| 19494 | event_log_call_get_event_log_sync ( |
| 19495 | EventLog *proxy, |
| 19496 | GVariant **out_log, |
| 19497 | GCancellable *cancellable, |
| 19498 | GError **error) |
| 19499 | { |
| 19500 | GVariant *_ret; |
| 19501 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 19502 | "getEventLog", |
| 19503 | g_variant_new ("()"), |
| 19504 | G_DBUS_CALL_FLAGS_NONE, |
| 19505 | -1, |
| 19506 | cancellable, |
| 19507 | error); |
| 19508 | if (_ret == NULL) |
| 19509 | goto _out; |
| 19510 | g_variant_get (_ret, |
| 19511 | "(@a(s))", |
| 19512 | out_log); |
| 19513 | g_variant_unref (_ret); |
| 19514 | _out: |
| 19515 | return _ret != NULL; |
| 19516 | } |
| 19517 | |
| 19518 | /** |
| 19519 | * event_log_complete_get_event_log: |
| 19520 | * @object: A #EventLog. |
| 19521 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 19522 | * @log: Parameter to return. |
| 19523 | * |
| 19524 | * 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. |
| 19525 | * |
| 19526 | * This method will free @invocation, you cannot use it afterwards. |
| 19527 | */ |
| 19528 | void |
| 19529 | event_log_complete_get_event_log ( |
| 19530 | EventLog *object, |
| 19531 | GDBusMethodInvocation *invocation, |
| 19532 | GVariant *log) |
| 19533 | { |
| 19534 | g_dbus_method_invocation_return_value (invocation, |
| 19535 | g_variant_new ("(@a(s))", |
| 19536 | log)); |
| 19537 | } |
| 19538 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19539 | /* ------------------------------------------------------------------------ */ |
| 19540 | |
| 19541 | /** |
| 19542 | * EventLogProxy: |
| 19543 | * |
| 19544 | * The #EventLogProxy structure contains only private data and should only be accessed using the provided API. |
| 19545 | */ |
| 19546 | |
| 19547 | /** |
| 19548 | * EventLogProxyClass: |
| 19549 | * @parent_class: The parent class. |
| 19550 | * |
| 19551 | * Class structure for #EventLogProxy. |
| 19552 | */ |
| 19553 | |
| 19554 | struct _EventLogProxyPrivate |
| 19555 | { |
| 19556 | GData *qdata; |
| 19557 | }; |
| 19558 | |
| 19559 | static void event_log_proxy_iface_init (EventLogIface *iface); |
| 19560 | |
| 19561 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19562 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 19563 | G_ADD_PRIVATE (EventLogProxy) |
| 19564 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 19565 | |
| 19566 | #else |
| 19567 | G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, |
| 19568 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); |
| 19569 | |
| 19570 | #endif |
| 19571 | static void |
| 19572 | event_log_proxy_finalize (GObject *object) |
| 19573 | { |
| 19574 | EventLogProxy *proxy = EVENT_LOG_PROXY (object); |
| 19575 | g_datalist_clear (&proxy->priv->qdata); |
| 19576 | G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object); |
| 19577 | } |
| 19578 | |
| 19579 | static void |
| 19580 | event_log_proxy_get_property (GObject *object, |
| 19581 | guint prop_id, |
| 19582 | GValue *value, |
| 19583 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19584 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19585 | } |
| 19586 | |
| 19587 | static void |
| 19588 | event_log_proxy_set_property (GObject *object, |
| 19589 | guint prop_id, |
| 19590 | const GValue *value, |
| 19591 | GParamSpec *pspec G_GNUC_UNUSED) |
| 19592 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19593 | } |
| 19594 | |
| 19595 | static void |
| 19596 | event_log_proxy_g_signal (GDBusProxy *proxy, |
| 19597 | const gchar *sender_name G_GNUC_UNUSED, |
| 19598 | const gchar *signal_name, |
| 19599 | GVariant *parameters) |
| 19600 | { |
| 19601 | _ExtendedGDBusSignalInfo *info; |
| 19602 | GVariantIter iter; |
| 19603 | GVariant *child; |
| 19604 | GValue *paramv; |
| 19605 | guint num_params; |
| 19606 | guint n; |
| 19607 | guint signal_id; |
| 19608 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name); |
| 19609 | if (info == NULL) |
| 19610 | return; |
| 19611 | num_params = g_variant_n_children (parameters); |
| 19612 | paramv = g_new0 (GValue, num_params + 1); |
| 19613 | g_value_init (¶mv[0], TYPE_EVENT_LOG); |
| 19614 | g_value_set_object (¶mv[0], proxy); |
| 19615 | g_variant_iter_init (&iter, parameters); |
| 19616 | n = 1; |
| 19617 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19618 | { |
| 19619 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 19620 | if (arg_info->use_gvariant) |
| 19621 | { |
| 19622 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19623 | g_value_set_variant (¶mv[n], child); |
| 19624 | n++; |
| 19625 | } |
| 19626 | else |
| 19627 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19628 | g_variant_unref (child); |
| 19629 | } |
| 19630 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 19631 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 19632 | for (n = 0; n < num_params + 1; n++) |
| 19633 | g_value_unset (¶mv[n]); |
| 19634 | g_free (paramv); |
| 19635 | } |
| 19636 | |
| 19637 | static void |
| 19638 | event_log_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 19639 | GVariant *changed_properties, |
| 19640 | const gchar *const *invalidated_properties) |
| 19641 | { |
| 19642 | EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy); |
| 19643 | guint n; |
| 19644 | const gchar *key; |
| 19645 | GVariantIter *iter; |
| 19646 | _ExtendedGDBusPropertyInfo *info; |
| 19647 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 19648 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 19649 | { |
| 19650 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key); |
| 19651 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 19652 | if (info != NULL) |
| 19653 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19654 | } |
| 19655 | g_variant_iter_free (iter); |
| 19656 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 19657 | { |
| 19658 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]); |
| 19659 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 19660 | if (info != NULL) |
| 19661 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 19662 | } |
| 19663 | } |
| 19664 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19665 | static void |
| 19666 | event_log_proxy_init (EventLogProxy *proxy) |
| 19667 | { |
| 19668 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 19669 | proxy->priv = event_log_proxy_get_instance_private (proxy); |
| 19670 | #else |
| 19671 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate); |
| 19672 | #endif |
| 19673 | |
| 19674 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ()); |
| 19675 | } |
| 19676 | |
| 19677 | static void |
| 19678 | event_log_proxy_class_init (EventLogProxyClass *klass) |
| 19679 | { |
| 19680 | GObjectClass *gobject_class; |
| 19681 | GDBusProxyClass *proxy_class; |
| 19682 | |
| 19683 | gobject_class = G_OBJECT_CLASS (klass); |
| 19684 | gobject_class->finalize = event_log_proxy_finalize; |
| 19685 | gobject_class->get_property = event_log_proxy_get_property; |
| 19686 | gobject_class->set_property = event_log_proxy_set_property; |
| 19687 | |
| 19688 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 19689 | proxy_class->g_signal = event_log_proxy_g_signal; |
| 19690 | proxy_class->g_properties_changed = event_log_proxy_g_properties_changed; |
| 19691 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19692 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 19693 | g_type_class_add_private (klass, sizeof (EventLogProxyPrivate)); |
| 19694 | #endif |
| 19695 | } |
| 19696 | |
| 19697 | static void |
| 19698 | event_log_proxy_iface_init (EventLogIface *iface) |
| 19699 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 19700 | } |
| 19701 | |
| 19702 | /** |
| 19703 | * event_log_proxy_new: |
| 19704 | * @connection: A #GDBusConnection. |
| 19705 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19706 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19707 | * @object_path: An object path. |
| 19708 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19709 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19710 | * @user_data: User data to pass to @callback. |
| 19711 | * |
| 19712 | * 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. |
| 19713 | * |
| 19714 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 19715 | * You can then call event_log_proxy_new_finish() to get the result of the operation. |
| 19716 | * |
| 19717 | * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 19718 | */ |
| 19719 | void |
| 19720 | event_log_proxy_new ( |
| 19721 | GDBusConnection *connection, |
| 19722 | GDBusProxyFlags flags, |
| 19723 | const gchar *name, |
| 19724 | const gchar *object_path, |
| 19725 | GCancellable *cancellable, |
| 19726 | GAsyncReadyCallback callback, |
| 19727 | gpointer user_data) |
| 19728 | { |
| 19729 | 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); |
| 19730 | } |
| 19731 | |
| 19732 | /** |
| 19733 | * event_log_proxy_new_finish: |
| 19734 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new(). |
| 19735 | * @error: Return location for error or %NULL |
| 19736 | * |
| 19737 | * Finishes an operation started with event_log_proxy_new(). |
| 19738 | * |
| 19739 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 19740 | */ |
| 19741 | EventLog * |
| 19742 | event_log_proxy_new_finish ( |
| 19743 | GAsyncResult *res, |
| 19744 | GError **error) |
| 19745 | { |
| 19746 | GObject *ret; |
| 19747 | GObject *source_object; |
| 19748 | source_object = g_async_result_get_source_object (res); |
| 19749 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19750 | g_object_unref (source_object); |
| 19751 | if (ret != NULL) |
| 19752 | return EVENT_LOG (ret); |
| 19753 | else |
| 19754 | return NULL; |
| 19755 | } |
| 19756 | |
| 19757 | /** |
| 19758 | * event_log_proxy_new_sync: |
| 19759 | * @connection: A #GDBusConnection. |
| 19760 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19761 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 19762 | * @object_path: An object path. |
| 19763 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19764 | * @error: Return location for error or %NULL |
| 19765 | * |
| 19766 | * 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. |
| 19767 | * |
| 19768 | * The calling thread is blocked until a reply is received. |
| 19769 | * |
| 19770 | * See event_log_proxy_new() for the asynchronous version of this constructor. |
| 19771 | * |
| 19772 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 19773 | */ |
| 19774 | EventLog * |
| 19775 | event_log_proxy_new_sync ( |
| 19776 | GDBusConnection *connection, |
| 19777 | GDBusProxyFlags flags, |
| 19778 | const gchar *name, |
| 19779 | const gchar *object_path, |
| 19780 | GCancellable *cancellable, |
| 19781 | GError **error) |
| 19782 | { |
| 19783 | GInitable *ret; |
| 19784 | 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); |
| 19785 | if (ret != NULL) |
| 19786 | return EVENT_LOG (ret); |
| 19787 | else |
| 19788 | return NULL; |
| 19789 | } |
| 19790 | |
| 19791 | |
| 19792 | /** |
| 19793 | * event_log_proxy_new_for_bus: |
| 19794 | * @bus_type: A #GBusType. |
| 19795 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19796 | * @name: A bus name (well-known or unique). |
| 19797 | * @object_path: An object path. |
| 19798 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19799 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 19800 | * @user_data: User data to pass to @callback. |
| 19801 | * |
| 19802 | * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 19803 | * |
| 19804 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 19805 | * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation. |
| 19806 | * |
| 19807 | * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 19808 | */ |
| 19809 | void |
| 19810 | event_log_proxy_new_for_bus ( |
| 19811 | GBusType bus_type, |
| 19812 | GDBusProxyFlags flags, |
| 19813 | const gchar *name, |
| 19814 | const gchar *object_path, |
| 19815 | GCancellable *cancellable, |
| 19816 | GAsyncReadyCallback callback, |
| 19817 | gpointer user_data) |
| 19818 | { |
| 19819 | 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); |
| 19820 | } |
| 19821 | |
| 19822 | /** |
| 19823 | * event_log_proxy_new_for_bus_finish: |
| 19824 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus(). |
| 19825 | * @error: Return location for error or %NULL |
| 19826 | * |
| 19827 | * Finishes an operation started with event_log_proxy_new_for_bus(). |
| 19828 | * |
| 19829 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 19830 | */ |
| 19831 | EventLog * |
| 19832 | event_log_proxy_new_for_bus_finish ( |
| 19833 | GAsyncResult *res, |
| 19834 | GError **error) |
| 19835 | { |
| 19836 | GObject *ret; |
| 19837 | GObject *source_object; |
| 19838 | source_object = g_async_result_get_source_object (res); |
| 19839 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 19840 | g_object_unref (source_object); |
| 19841 | if (ret != NULL) |
| 19842 | return EVENT_LOG (ret); |
| 19843 | else |
| 19844 | return NULL; |
| 19845 | } |
| 19846 | |
| 19847 | /** |
| 19848 | * event_log_proxy_new_for_bus_sync: |
| 19849 | * @bus_type: A #GBusType. |
| 19850 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 19851 | * @name: A bus name (well-known or unique). |
| 19852 | * @object_path: An object path. |
| 19853 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 19854 | * @error: Return location for error or %NULL |
| 19855 | * |
| 19856 | * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 19857 | * |
| 19858 | * The calling thread is blocked until a reply is received. |
| 19859 | * |
| 19860 | * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 19861 | * |
| 19862 | * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. |
| 19863 | */ |
| 19864 | EventLog * |
| 19865 | event_log_proxy_new_for_bus_sync ( |
| 19866 | GBusType bus_type, |
| 19867 | GDBusProxyFlags flags, |
| 19868 | const gchar *name, |
| 19869 | const gchar *object_path, |
| 19870 | GCancellable *cancellable, |
| 19871 | GError **error) |
| 19872 | { |
| 19873 | GInitable *ret; |
| 19874 | 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); |
| 19875 | if (ret != NULL) |
| 19876 | return EVENT_LOG (ret); |
| 19877 | else |
| 19878 | return NULL; |
| 19879 | } |
| 19880 | |
| 19881 | |
| 19882 | /* ------------------------------------------------------------------------ */ |
| 19883 | |
| 19884 | /** |
| 19885 | * EventLogSkeleton: |
| 19886 | * |
| 19887 | * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API. |
| 19888 | */ |
| 19889 | |
| 19890 | /** |
| 19891 | * EventLogSkeletonClass: |
| 19892 | * @parent_class: The parent class. |
| 19893 | * |
| 19894 | * Class structure for #EventLogSkeleton. |
| 19895 | */ |
| 19896 | |
| 19897 | struct _EventLogSkeletonPrivate |
| 19898 | { |
| 19899 | GValue *properties; |
| 19900 | GList *changed_properties; |
| 19901 | GSource *changed_properties_idle_source; |
| 19902 | GMainContext *context; |
| 19903 | GMutex lock; |
| 19904 | }; |
| 19905 | |
| 19906 | static void |
| 19907 | _event_log_skeleton_handle_method_call ( |
| 19908 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19909 | const gchar *sender G_GNUC_UNUSED, |
| 19910 | const gchar *object_path G_GNUC_UNUSED, |
| 19911 | const gchar *interface_name, |
| 19912 | const gchar *method_name, |
| 19913 | GVariant *parameters, |
| 19914 | GDBusMethodInvocation *invocation, |
| 19915 | gpointer user_data) |
| 19916 | { |
| 19917 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 19918 | _ExtendedGDBusMethodInfo *info; |
| 19919 | GVariantIter iter; |
| 19920 | GVariant *child; |
| 19921 | GValue *paramv; |
| 19922 | guint num_params; |
| 19923 | guint num_extra; |
| 19924 | guint n; |
| 19925 | guint signal_id; |
| 19926 | GValue return_value = G_VALUE_INIT; |
| 19927 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 19928 | g_assert (info != NULL); |
| 19929 | num_params = g_variant_n_children (parameters); |
| 19930 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 19931 | n = 0; |
| 19932 | g_value_init (¶mv[n], TYPE_EVENT_LOG); |
| 19933 | g_value_set_object (¶mv[n++], skeleton); |
| 19934 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 19935 | g_value_set_object (¶mv[n++], invocation); |
| 19936 | if (info->pass_fdlist) |
| 19937 | { |
| 19938 | #ifdef G_OS_UNIX |
| 19939 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 19940 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 19941 | #else |
| 19942 | g_assert_not_reached (); |
| 19943 | #endif |
| 19944 | } |
| 19945 | g_variant_iter_init (&iter, parameters); |
| 19946 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 19947 | { |
| 19948 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 19949 | if (arg_info->use_gvariant) |
| 19950 | { |
| 19951 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 19952 | g_value_set_variant (¶mv[n], child); |
| 19953 | n++; |
| 19954 | } |
| 19955 | else |
| 19956 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 19957 | g_variant_unref (child); |
| 19958 | } |
| 19959 | signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); |
| 19960 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 19961 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 19962 | if (!g_value_get_boolean (&return_value)) |
| 19963 | 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); |
| 19964 | g_value_unset (&return_value); |
| 19965 | for (n = 0; n < num_params + num_extra; n++) |
| 19966 | g_value_unset (¶mv[n]); |
| 19967 | g_free (paramv); |
| 19968 | } |
| 19969 | |
| 19970 | static GVariant * |
| 19971 | _event_log_skeleton_handle_get_property ( |
| 19972 | GDBusConnection *connection G_GNUC_UNUSED, |
| 19973 | const gchar *sender G_GNUC_UNUSED, |
| 19974 | const gchar *object_path G_GNUC_UNUSED, |
| 19975 | const gchar *interface_name G_GNUC_UNUSED, |
| 19976 | const gchar *property_name, |
| 19977 | GError **error, |
| 19978 | gpointer user_data) |
| 19979 | { |
| 19980 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 19981 | GValue value = G_VALUE_INIT; |
| 19982 | GParamSpec *pspec; |
| 19983 | _ExtendedGDBusPropertyInfo *info; |
| 19984 | GVariant *ret; |
| 19985 | ret = NULL; |
| 19986 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 19987 | g_assert (info != NULL); |
| 19988 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 19989 | if (pspec == NULL) |
| 19990 | { |
| 19991 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 19992 | } |
| 19993 | else |
| 19994 | { |
| 19995 | g_value_init (&value, pspec->value_type); |
| 19996 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 19997 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 19998 | g_value_unset (&value); |
| 19999 | } |
| 20000 | return ret; |
| 20001 | } |
| 20002 | |
| 20003 | static gboolean |
| 20004 | _event_log_skeleton_handle_set_property ( |
| 20005 | GDBusConnection *connection G_GNUC_UNUSED, |
| 20006 | const gchar *sender G_GNUC_UNUSED, |
| 20007 | const gchar *object_path G_GNUC_UNUSED, |
| 20008 | const gchar *interface_name G_GNUC_UNUSED, |
| 20009 | const gchar *property_name, |
| 20010 | GVariant *variant, |
| 20011 | GError **error, |
| 20012 | gpointer user_data) |
| 20013 | { |
| 20014 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); |
| 20015 | GValue value = G_VALUE_INIT; |
| 20016 | GParamSpec *pspec; |
| 20017 | _ExtendedGDBusPropertyInfo *info; |
| 20018 | gboolean ret; |
| 20019 | ret = FALSE; |
| 20020 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); |
| 20021 | g_assert (info != NULL); |
| 20022 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 20023 | if (pspec == NULL) |
| 20024 | { |
| 20025 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 20026 | } |
| 20027 | else |
| 20028 | { |
| 20029 | if (info->use_gvariant) |
| 20030 | g_value_set_variant (&value, variant); |
| 20031 | else |
| 20032 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 20033 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 20034 | g_value_unset (&value); |
| 20035 | ret = TRUE; |
| 20036 | } |
| 20037 | return ret; |
| 20038 | } |
| 20039 | |
| 20040 | static const GDBusInterfaceVTable _event_log_skeleton_vtable = |
| 20041 | { |
| 20042 | _event_log_skeleton_handle_method_call, |
| 20043 | _event_log_skeleton_handle_get_property, |
| 20044 | _event_log_skeleton_handle_set_property, |
| 20045 | {NULL} |
| 20046 | }; |
| 20047 | |
| 20048 | static GDBusInterfaceInfo * |
| 20049 | event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20050 | { |
| 20051 | return event_log_interface_info (); |
| 20052 | } |
| 20053 | |
| 20054 | static GDBusInterfaceVTable * |
| 20055 | event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 20056 | { |
| 20057 | return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable; |
| 20058 | } |
| 20059 | |
| 20060 | static GVariant * |
| 20061 | event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 20062 | { |
| 20063 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton); |
| 20064 | |
| 20065 | GVariantBuilder builder; |
| 20066 | guint n; |
| 20067 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 20068 | if (_event_log_interface_info.parent_struct.properties == NULL) |
| 20069 | goto out; |
| 20070 | for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++) |
| 20071 | { |
| 20072 | GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n]; |
| 20073 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 20074 | { |
| 20075 | GVariant *value; |
| 20076 | 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); |
| 20077 | if (value != NULL) |
| 20078 | { |
| 20079 | g_variant_take_ref (value); |
| 20080 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 20081 | g_variant_unref (value); |
| 20082 | } |
| 20083 | } |
| 20084 | } |
| 20085 | out: |
| 20086 | return g_variant_builder_end (&builder); |
| 20087 | } |
| 20088 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20089 | static void |
| 20090 | event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 20091 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20092 | } |
| 20093 | |
| 20094 | static void |
| 20095 | _event_log_on_signal_event_log ( |
| 20096 | EventLog *object, |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20097 | gint arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20098 | const gchar *arg_message, |
| 20099 | gint arg_rc) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20100 | { |
| 20101 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
| 20102 | |
| 20103 | GList *connections, *l; |
| 20104 | GVariant *signal_variant; |
| 20105 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 20106 | |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20107 | signal_variant = g_variant_ref_sink (g_variant_new ("(isi)", |
Norman James | 8abb50c | 2015-09-16 10:58:16 -0500 | [diff] [blame] | 20108 | arg_priority, |
Norman James | 8887267 | 2015-09-21 16:51:35 -0500 | [diff] [blame] | 20109 | arg_message, |
| 20110 | arg_rc)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20111 | for (l = connections; l != NULL; l = l->next) |
| 20112 | { |
| 20113 | GDBusConnection *connection = l->data; |
| 20114 | g_dbus_connection_emit_signal (connection, |
| 20115 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog", |
| 20116 | signal_variant, NULL); |
| 20117 | } |
| 20118 | g_variant_unref (signal_variant); |
| 20119 | g_list_free_full (connections, g_object_unref); |
| 20120 | } |
| 20121 | |
| 20122 | static void event_log_skeleton_iface_init (EventLogIface *iface); |
| 20123 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20124 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20125 | G_ADD_PRIVATE (EventLogSkeleton) |
| 20126 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 20127 | |
| 20128 | #else |
| 20129 | G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 20130 | G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); |
| 20131 | |
| 20132 | #endif |
| 20133 | static void |
| 20134 | event_log_skeleton_finalize (GObject *object) |
| 20135 | { |
| 20136 | EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20137 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 20138 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 20139 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 20140 | g_main_context_unref (skeleton->priv->context); |
| 20141 | g_mutex_clear (&skeleton->priv->lock); |
| 20142 | G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object); |
| 20143 | } |
| 20144 | |
| 20145 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20146 | event_log_skeleton_init (EventLogSkeleton *skeleton) |
| 20147 | { |
| 20148 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 20149 | skeleton->priv = event_log_skeleton_get_instance_private (skeleton); |
| 20150 | #else |
| 20151 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate); |
| 20152 | #endif |
| 20153 | |
| 20154 | g_mutex_init (&skeleton->priv->lock); |
| 20155 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20156 | } |
| 20157 | |
| 20158 | static void |
| 20159 | event_log_skeleton_class_init (EventLogSkeletonClass *klass) |
| 20160 | { |
| 20161 | GObjectClass *gobject_class; |
| 20162 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 20163 | |
| 20164 | gobject_class = G_OBJECT_CLASS (klass); |
| 20165 | gobject_class->finalize = event_log_skeleton_finalize; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20166 | |
| 20167 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 20168 | skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info; |
| 20169 | skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties; |
| 20170 | skeleton_class->flush = event_log_skeleton_dbus_interface_flush; |
| 20171 | skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable; |
| 20172 | |
| 20173 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 20174 | g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate)); |
| 20175 | #endif |
| 20176 | } |
| 20177 | |
| 20178 | static void |
| 20179 | event_log_skeleton_iface_init (EventLogIface *iface) |
| 20180 | { |
| 20181 | iface->event_log = _event_log_on_signal_event_log; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20182 | } |
| 20183 | |
| 20184 | /** |
| 20185 | * event_log_skeleton_new: |
| 20186 | * |
| 20187 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. |
| 20188 | * |
| 20189 | * Returns: (transfer full) (type EventLogSkeleton): The skeleton object. |
| 20190 | */ |
| 20191 | EventLog * |
| 20192 | event_log_skeleton_new (void) |
| 20193 | { |
| 20194 | return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL)); |
| 20195 | } |
| 20196 | |
| 20197 | /* ------------------------------------------------------------------------ |
| 20198 | * Code for interface org.openbmc.Flash |
| 20199 | * ------------------------------------------------------------------------ |
| 20200 | */ |
| 20201 | |
| 20202 | /** |
| 20203 | * SECTION:Flash |
| 20204 | * @title: Flash |
| 20205 | * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface |
| 20206 | * |
| 20207 | * 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. |
| 20208 | */ |
| 20209 | |
| 20210 | /* ---- Introspection data for org.openbmc.Flash ---- */ |
| 20211 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20212 | static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20213 | { |
| 20214 | { |
| 20215 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20216 | (gchar *) "filename", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20217 | (gchar *) "s", |
| 20218 | NULL |
| 20219 | }, |
| 20220 | FALSE |
| 20221 | }; |
| 20222 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20223 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20224 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20225 | &_flash_method_info_update_IN_ARG_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20226 | NULL |
| 20227 | }; |
| 20228 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20229 | static const _ExtendedGDBusMethodInfo _flash_method_info_update = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20230 | { |
| 20231 | { |
| 20232 | -1, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20233 | (gchar *) "update", |
| 20234 | (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20235 | NULL, |
| 20236 | NULL |
| 20237 | }, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20238 | "handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20239 | FALSE |
| 20240 | }; |
| 20241 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20242 | static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message = |
| 20243 | { |
| 20244 | { |
| 20245 | -1, |
| 20246 | (gchar *) "message", |
| 20247 | (gchar *) "s", |
| 20248 | NULL |
| 20249 | }, |
| 20250 | FALSE |
| 20251 | }; |
| 20252 | |
| 20253 | static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] = |
| 20254 | { |
| 20255 | &_flash_method_info_error_IN_ARG_message, |
| 20256 | NULL |
| 20257 | }; |
| 20258 | |
| 20259 | static const _ExtendedGDBusMethodInfo _flash_method_info_error = |
| 20260 | { |
| 20261 | { |
| 20262 | -1, |
| 20263 | (gchar *) "error", |
| 20264 | (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers, |
| 20265 | NULL, |
| 20266 | NULL |
| 20267 | }, |
| 20268 | "handle-error", |
| 20269 | FALSE |
| 20270 | }; |
| 20271 | |
| 20272 | static const _ExtendedGDBusMethodInfo _flash_method_info_done = |
| 20273 | { |
| 20274 | { |
| 20275 | -1, |
| 20276 | (gchar *) "done", |
| 20277 | NULL, |
| 20278 | NULL, |
| 20279 | NULL |
| 20280 | }, |
| 20281 | "handle-done", |
| 20282 | FALSE |
| 20283 | }; |
| 20284 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20285 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url = |
| 20286 | { |
| 20287 | { |
| 20288 | -1, |
| 20289 | (gchar *) "url", |
| 20290 | (gchar *) "s", |
| 20291 | NULL |
| 20292 | }, |
| 20293 | FALSE |
| 20294 | }; |
| 20295 | |
| 20296 | static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename = |
| 20297 | { |
| 20298 | { |
| 20299 | -1, |
| 20300 | (gchar *) "filename", |
| 20301 | (gchar *) "s", |
| 20302 | NULL |
| 20303 | }, |
| 20304 | FALSE |
| 20305 | }; |
| 20306 | |
| 20307 | static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] = |
| 20308 | { |
| 20309 | &_flash_method_info_update_via_tftp_IN_ARG_url, |
| 20310 | &_flash_method_info_update_via_tftp_IN_ARG_filename, |
| 20311 | NULL |
| 20312 | }; |
| 20313 | |
| 20314 | static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp = |
| 20315 | { |
| 20316 | { |
| 20317 | -1, |
| 20318 | (gchar *) "updateViaTftp", |
| 20319 | (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers, |
| 20320 | NULL, |
| 20321 | NULL |
| 20322 | }, |
| 20323 | "handle-update-via-tftp", |
| 20324 | FALSE |
| 20325 | }; |
| 20326 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20327 | static const _ExtendedGDBusMethodInfo _flash_method_info_init = |
| 20328 | { |
| 20329 | { |
| 20330 | -1, |
| 20331 | (gchar *) "init", |
| 20332 | NULL, |
| 20333 | NULL, |
| 20334 | NULL |
| 20335 | }, |
| 20336 | "handle-init", |
| 20337 | FALSE |
| 20338 | }; |
| 20339 | |
| 20340 | static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] = |
| 20341 | { |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20342 | &_flash_method_info_update, |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20343 | &_flash_method_info_error, |
| 20344 | &_flash_method_info_done, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20345 | &_flash_method_info_update_via_tftp, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20346 | &_flash_method_info_init, |
| 20347 | NULL |
| 20348 | }; |
| 20349 | |
| 20350 | static const _ExtendedGDBusSignalInfo _flash_signal_info_updated = |
| 20351 | { |
| 20352 | { |
| 20353 | -1, |
| 20354 | (gchar *) "Updated", |
| 20355 | NULL, |
| 20356 | NULL |
| 20357 | }, |
| 20358 | "updated" |
| 20359 | }; |
| 20360 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20361 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url = |
| 20362 | { |
| 20363 | { |
| 20364 | -1, |
| 20365 | (gchar *) "url", |
| 20366 | (gchar *) "s", |
| 20367 | NULL |
| 20368 | }, |
| 20369 | FALSE |
| 20370 | }; |
| 20371 | |
| 20372 | static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename = |
| 20373 | { |
| 20374 | { |
| 20375 | -1, |
| 20376 | (gchar *) "filename", |
| 20377 | (gchar *) "s", |
| 20378 | NULL |
| 20379 | }, |
| 20380 | FALSE |
| 20381 | }; |
| 20382 | |
| 20383 | static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] = |
| 20384 | { |
| 20385 | &_flash_signal_info_download_ARG_url, |
| 20386 | &_flash_signal_info_download_ARG_filename, |
| 20387 | NULL |
| 20388 | }; |
| 20389 | |
| 20390 | static const _ExtendedGDBusSignalInfo _flash_signal_info_download = |
| 20391 | { |
| 20392 | { |
| 20393 | -1, |
| 20394 | (gchar *) "Download", |
| 20395 | (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers, |
| 20396 | NULL |
| 20397 | }, |
| 20398 | "download" |
| 20399 | }; |
| 20400 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20401 | static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] = |
| 20402 | { |
| 20403 | &_flash_signal_info_updated, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20404 | &_flash_signal_info_download, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20405 | NULL |
| 20406 | }; |
| 20407 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20408 | static const _ExtendedGDBusPropertyInfo _flash_property_info_filename = |
| 20409 | { |
| 20410 | { |
| 20411 | -1, |
| 20412 | (gchar *) "filename", |
| 20413 | (gchar *) "s", |
| 20414 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20415 | NULL |
| 20416 | }, |
| 20417 | "filename", |
| 20418 | FALSE |
| 20419 | }; |
| 20420 | |
| 20421 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path = |
| 20422 | { |
| 20423 | { |
| 20424 | -1, |
| 20425 | (gchar *) "flasher_path", |
| 20426 | (gchar *) "s", |
| 20427 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20428 | NULL |
| 20429 | }, |
| 20430 | "flasher-path", |
| 20431 | FALSE |
| 20432 | }; |
| 20433 | |
| 20434 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name = |
| 20435 | { |
| 20436 | { |
| 20437 | -1, |
| 20438 | (gchar *) "flasher_name", |
| 20439 | (gchar *) "s", |
| 20440 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20441 | NULL |
| 20442 | }, |
| 20443 | "flasher-name", |
| 20444 | FALSE |
| 20445 | }; |
| 20446 | |
| 20447 | static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance = |
| 20448 | { |
| 20449 | { |
| 20450 | -1, |
| 20451 | (gchar *) "flasher_instance", |
| 20452 | (gchar *) "s", |
| 20453 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20454 | NULL |
| 20455 | }, |
| 20456 | "flasher-instance", |
| 20457 | FALSE |
| 20458 | }; |
| 20459 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20460 | static const _ExtendedGDBusPropertyInfo _flash_property_info_status = |
| 20461 | { |
| 20462 | { |
| 20463 | -1, |
| 20464 | (gchar *) "status", |
| 20465 | (gchar *) "s", |
| 20466 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 20467 | NULL |
| 20468 | }, |
| 20469 | "status", |
| 20470 | FALSE |
| 20471 | }; |
| 20472 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20473 | static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] = |
| 20474 | { |
| 20475 | &_flash_property_info_filename, |
| 20476 | &_flash_property_info_flasher_path, |
| 20477 | &_flash_property_info_flasher_name, |
| 20478 | &_flash_property_info_flasher_instance, |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20479 | &_flash_property_info_status, |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20480 | NULL |
| 20481 | }; |
| 20482 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20483 | static const _ExtendedGDBusInterfaceInfo _flash_interface_info = |
| 20484 | { |
| 20485 | { |
| 20486 | -1, |
| 20487 | (gchar *) "org.openbmc.Flash", |
| 20488 | (GDBusMethodInfo **) &_flash_method_info_pointers, |
| 20489 | (GDBusSignalInfo **) &_flash_signal_info_pointers, |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20490 | (GDBusPropertyInfo **) &_flash_property_info_pointers, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20491 | NULL |
| 20492 | }, |
| 20493 | "flash", |
| 20494 | }; |
| 20495 | |
| 20496 | |
| 20497 | /** |
| 20498 | * flash_interface_info: |
| 20499 | * |
| 20500 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface. |
| 20501 | * |
| 20502 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 20503 | */ |
| 20504 | GDBusInterfaceInfo * |
| 20505 | flash_interface_info (void) |
| 20506 | { |
| 20507 | return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct; |
| 20508 | } |
| 20509 | |
| 20510 | /** |
| 20511 | * flash_override_properties: |
| 20512 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 20513 | * @property_id_begin: The property id to assign to the first overridden property. |
| 20514 | * |
| 20515 | * Overrides all #GObject properties in the #Flash interface for a concrete class. |
| 20516 | * The properties are overridden in the order they are defined. |
| 20517 | * |
| 20518 | * Returns: The last property id. |
| 20519 | */ |
| 20520 | guint |
| 20521 | flash_override_properties (GObjectClass *klass, guint property_id_begin) |
| 20522 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20523 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 20524 | g_object_class_override_property (klass, property_id_begin++, "flasher-path"); |
| 20525 | g_object_class_override_property (klass, property_id_begin++, "flasher-name"); |
| 20526 | g_object_class_override_property (klass, property_id_begin++, "flasher-instance"); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20527 | g_object_class_override_property (klass, property_id_begin++, "status"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20528 | return property_id_begin - 1; |
| 20529 | } |
| 20530 | |
| 20531 | |
| 20532 | |
| 20533 | /** |
| 20534 | * Flash: |
| 20535 | * |
| 20536 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 20537 | */ |
| 20538 | |
| 20539 | /** |
| 20540 | * FlashIface: |
| 20541 | * @parent_iface: The parent interface. |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20542 | * @handle_done: Handler for the #Flash::handle-done signal. |
| 20543 | * @handle_error: Handler for the #Flash::handle-error signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20544 | * @handle_init: Handler for the #Flash::handle-init signal. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20545 | * @handle_update: Handler for the #Flash::handle-update signal. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20546 | * @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] | 20547 | * @get_filename: Getter for the #Flash:filename property. |
| 20548 | * @get_flasher_instance: Getter for the #Flash:flasher-instance property. |
| 20549 | * @get_flasher_name: Getter for the #Flash:flasher-name property. |
| 20550 | * @get_flasher_path: Getter for the #Flash:flasher-path property. |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20551 | * @get_status: Getter for the #Flash:status property. |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20552 | * @download: Handler for the #Flash::download signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20553 | * @updated: Handler for the #Flash::updated signal. |
| 20554 | * |
| 20555 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 20556 | */ |
| 20557 | |
| 20558 | typedef FlashIface FlashInterface; |
| 20559 | G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT); |
| 20560 | |
| 20561 | static void |
| 20562 | flash_default_init (FlashIface *iface) |
| 20563 | { |
| 20564 | /* GObject signals for incoming D-Bus method calls: */ |
| 20565 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20566 | * Flash::handle-update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20567 | * @object: A #Flash. |
| 20568 | * @invocation: A #GDBusMethodInvocation. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20569 | * @arg_filename: Argument passed by remote caller. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20570 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20571 | * 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] | 20572 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20573 | * 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] | 20574 | * |
| 20575 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20576 | */ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20577 | g_signal_new ("handle-update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20578 | G_TYPE_FROM_INTERFACE (iface), |
| 20579 | G_SIGNAL_RUN_LAST, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 20580 | G_STRUCT_OFFSET (FlashIface, handle_update), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20581 | g_signal_accumulator_true_handled, |
| 20582 | NULL, |
| 20583 | g_cclosure_marshal_generic, |
| 20584 | G_TYPE_BOOLEAN, |
| 20585 | 2, |
| 20586 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 20587 | |
| 20588 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20589 | * Flash::handle-error: |
| 20590 | * @object: A #Flash. |
| 20591 | * @invocation: A #GDBusMethodInvocation. |
| 20592 | * @arg_message: Argument passed by remote caller. |
| 20593 | * |
| 20594 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method. |
| 20595 | * |
| 20596 | * 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. |
| 20597 | * |
| 20598 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20599 | */ |
| 20600 | g_signal_new ("handle-error", |
| 20601 | G_TYPE_FROM_INTERFACE (iface), |
| 20602 | G_SIGNAL_RUN_LAST, |
| 20603 | G_STRUCT_OFFSET (FlashIface, handle_error), |
| 20604 | g_signal_accumulator_true_handled, |
| 20605 | NULL, |
| 20606 | g_cclosure_marshal_generic, |
| 20607 | G_TYPE_BOOLEAN, |
| 20608 | 2, |
| 20609 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
| 20610 | |
| 20611 | /** |
| 20612 | * Flash::handle-done: |
| 20613 | * @object: A #Flash. |
| 20614 | * @invocation: A #GDBusMethodInvocation. |
| 20615 | * |
| 20616 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method. |
| 20617 | * |
| 20618 | * 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. |
| 20619 | * |
| 20620 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20621 | */ |
| 20622 | g_signal_new ("handle-done", |
| 20623 | G_TYPE_FROM_INTERFACE (iface), |
| 20624 | G_SIGNAL_RUN_LAST, |
| 20625 | G_STRUCT_OFFSET (FlashIface, handle_done), |
| 20626 | g_signal_accumulator_true_handled, |
| 20627 | NULL, |
| 20628 | g_cclosure_marshal_generic, |
| 20629 | G_TYPE_BOOLEAN, |
| 20630 | 1, |
| 20631 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20632 | |
| 20633 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20634 | * Flash::handle-update-via-tftp: |
| 20635 | * @object: A #Flash. |
| 20636 | * @invocation: A #GDBusMethodInvocation. |
| 20637 | * @arg_url: Argument passed by remote caller. |
| 20638 | * @arg_filename: Argument passed by remote caller. |
| 20639 | * |
| 20640 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. |
| 20641 | * |
| 20642 | * 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. |
| 20643 | * |
| 20644 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20645 | */ |
| 20646 | g_signal_new ("handle-update-via-tftp", |
| 20647 | G_TYPE_FROM_INTERFACE (iface), |
| 20648 | G_SIGNAL_RUN_LAST, |
| 20649 | G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp), |
| 20650 | g_signal_accumulator_true_handled, |
| 20651 | NULL, |
| 20652 | g_cclosure_marshal_generic, |
| 20653 | G_TYPE_BOOLEAN, |
| 20654 | 3, |
| 20655 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 20656 | |
| 20657 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20658 | * Flash::handle-init: |
| 20659 | * @object: A #Flash. |
| 20660 | * @invocation: A #GDBusMethodInvocation. |
| 20661 | * |
| 20662 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. |
| 20663 | * |
| 20664 | * 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. |
| 20665 | * |
| 20666 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 20667 | */ |
| 20668 | g_signal_new ("handle-init", |
| 20669 | G_TYPE_FROM_INTERFACE (iface), |
| 20670 | G_SIGNAL_RUN_LAST, |
| 20671 | G_STRUCT_OFFSET (FlashIface, handle_init), |
| 20672 | g_signal_accumulator_true_handled, |
| 20673 | NULL, |
| 20674 | g_cclosure_marshal_generic, |
| 20675 | G_TYPE_BOOLEAN, |
| 20676 | 1, |
| 20677 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 20678 | |
| 20679 | /* GObject signals for received D-Bus signals: */ |
| 20680 | /** |
| 20681 | * Flash::updated: |
| 20682 | * @object: A #Flash. |
| 20683 | * |
| 20684 | * 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. |
| 20685 | * |
| 20686 | * 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. |
| 20687 | */ |
| 20688 | g_signal_new ("updated", |
| 20689 | G_TYPE_FROM_INTERFACE (iface), |
| 20690 | G_SIGNAL_RUN_LAST, |
| 20691 | G_STRUCT_OFFSET (FlashIface, updated), |
| 20692 | NULL, |
| 20693 | NULL, |
| 20694 | g_cclosure_marshal_generic, |
| 20695 | G_TYPE_NONE, |
| 20696 | 0); |
| 20697 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 20698 | /** |
| 20699 | * Flash::download: |
| 20700 | * @object: A #Flash. |
| 20701 | * @arg_url: Argument. |
| 20702 | * @arg_filename: Argument. |
| 20703 | * |
| 20704 | * 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. |
| 20705 | * |
| 20706 | * 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. |
| 20707 | */ |
| 20708 | g_signal_new ("download", |
| 20709 | G_TYPE_FROM_INTERFACE (iface), |
| 20710 | G_SIGNAL_RUN_LAST, |
| 20711 | G_STRUCT_OFFSET (FlashIface, download), |
| 20712 | NULL, |
| 20713 | NULL, |
| 20714 | g_cclosure_marshal_generic, |
| 20715 | G_TYPE_NONE, |
| 20716 | 2, G_TYPE_STRING, G_TYPE_STRING); |
| 20717 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 20718 | /* GObject properties for D-Bus properties: */ |
| 20719 | /** |
| 20720 | * Flash:filename: |
| 20721 | * |
| 20722 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>. |
| 20723 | * |
| 20724 | * 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. |
| 20725 | */ |
| 20726 | g_object_interface_install_property (iface, |
| 20727 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 20728 | /** |
| 20729 | * Flash:flasher-path: |
| 20730 | * |
| 20731 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>. |
| 20732 | * |
| 20733 | * 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. |
| 20734 | */ |
| 20735 | g_object_interface_install_property (iface, |
| 20736 | g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 20737 | /** |
| 20738 | * Flash:flasher-name: |
| 20739 | * |
| 20740 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>. |
| 20741 | * |
| 20742 | * 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. |
| 20743 | */ |
| 20744 | g_object_interface_install_property (iface, |
| 20745 | g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 20746 | /** |
| 20747 | * Flash:flasher-instance: |
| 20748 | * |
| 20749 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>. |
| 20750 | * |
| 20751 | * 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. |
| 20752 | */ |
| 20753 | g_object_interface_install_property (iface, |
| 20754 | 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] | 20755 | /** |
| 20756 | * Flash:status: |
| 20757 | * |
| 20758 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>. |
| 20759 | * |
| 20760 | * 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. |
| 20761 | */ |
| 20762 | g_object_interface_install_property (iface, |
| 20763 | 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] | 20764 | } |
| 20765 | |
| 20766 | /** |
| 20767 | * flash_get_filename: (skip) |
| 20768 | * @object: A #Flash. |
| 20769 | * |
| 20770 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 20771 | * |
| 20772 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20773 | * |
| 20774 | * <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> |
| 20775 | * |
| 20776 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 20777 | */ |
| 20778 | const gchar * |
| 20779 | flash_get_filename (Flash *object) |
| 20780 | { |
| 20781 | return FLASH_GET_IFACE (object)->get_filename (object); |
| 20782 | } |
| 20783 | |
| 20784 | /** |
| 20785 | * flash_dup_filename: (skip) |
| 20786 | * @object: A #Flash. |
| 20787 | * |
| 20788 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. |
| 20789 | * |
| 20790 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20791 | * |
| 20792 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 20793 | */ |
| 20794 | gchar * |
| 20795 | flash_dup_filename (Flash *object) |
| 20796 | { |
| 20797 | gchar *value; |
| 20798 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 20799 | return value; |
| 20800 | } |
| 20801 | |
| 20802 | /** |
| 20803 | * flash_set_filename: (skip) |
| 20804 | * @object: A #Flash. |
| 20805 | * @value: The value to set. |
| 20806 | * |
| 20807 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value. |
| 20808 | * |
| 20809 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 20810 | */ |
| 20811 | void |
| 20812 | flash_set_filename (Flash *object, const gchar *value) |
| 20813 | { |
| 20814 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 20815 | } |
| 20816 | |
| 20817 | /** |
| 20818 | * flash_get_flasher_path: (skip) |
| 20819 | * @object: A #Flash. |
| 20820 | * |
| 20821 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 20822 | * |
| 20823 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20824 | * |
| 20825 | * <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> |
| 20826 | * |
| 20827 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 20828 | */ |
| 20829 | const gchar * |
| 20830 | flash_get_flasher_path (Flash *object) |
| 20831 | { |
| 20832 | return FLASH_GET_IFACE (object)->get_flasher_path (object); |
| 20833 | } |
| 20834 | |
| 20835 | /** |
| 20836 | * flash_dup_flasher_path: (skip) |
| 20837 | * @object: A #Flash. |
| 20838 | * |
| 20839 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. |
| 20840 | * |
| 20841 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20842 | * |
| 20843 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 20844 | */ |
| 20845 | gchar * |
| 20846 | flash_dup_flasher_path (Flash *object) |
| 20847 | { |
| 20848 | gchar *value; |
| 20849 | g_object_get (G_OBJECT (object), "flasher-path", &value, NULL); |
| 20850 | return value; |
| 20851 | } |
| 20852 | |
| 20853 | /** |
| 20854 | * flash_set_flasher_path: (skip) |
| 20855 | * @object: A #Flash. |
| 20856 | * @value: The value to set. |
| 20857 | * |
| 20858 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value. |
| 20859 | * |
| 20860 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 20861 | */ |
| 20862 | void |
| 20863 | flash_set_flasher_path (Flash *object, const gchar *value) |
| 20864 | { |
| 20865 | g_object_set (G_OBJECT (object), "flasher-path", value, NULL); |
| 20866 | } |
| 20867 | |
| 20868 | /** |
| 20869 | * flash_get_flasher_name: (skip) |
| 20870 | * @object: A #Flash. |
| 20871 | * |
| 20872 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 20873 | * |
| 20874 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20875 | * |
| 20876 | * <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> |
| 20877 | * |
| 20878 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 20879 | */ |
| 20880 | const gchar * |
| 20881 | flash_get_flasher_name (Flash *object) |
| 20882 | { |
| 20883 | return FLASH_GET_IFACE (object)->get_flasher_name (object); |
| 20884 | } |
| 20885 | |
| 20886 | /** |
| 20887 | * flash_dup_flasher_name: (skip) |
| 20888 | * @object: A #Flash. |
| 20889 | * |
| 20890 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. |
| 20891 | * |
| 20892 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20893 | * |
| 20894 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 20895 | */ |
| 20896 | gchar * |
| 20897 | flash_dup_flasher_name (Flash *object) |
| 20898 | { |
| 20899 | gchar *value; |
| 20900 | g_object_get (G_OBJECT (object), "flasher-name", &value, NULL); |
| 20901 | return value; |
| 20902 | } |
| 20903 | |
| 20904 | /** |
| 20905 | * flash_set_flasher_name: (skip) |
| 20906 | * @object: A #Flash. |
| 20907 | * @value: The value to set. |
| 20908 | * |
| 20909 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value. |
| 20910 | * |
| 20911 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 20912 | */ |
| 20913 | void |
| 20914 | flash_set_flasher_name (Flash *object, const gchar *value) |
| 20915 | { |
| 20916 | g_object_set (G_OBJECT (object), "flasher-name", value, NULL); |
| 20917 | } |
| 20918 | |
| 20919 | /** |
| 20920 | * flash_get_flasher_instance: (skip) |
| 20921 | * @object: A #Flash. |
| 20922 | * |
| 20923 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 20924 | * |
| 20925 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20926 | * |
| 20927 | * <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> |
| 20928 | * |
| 20929 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 20930 | */ |
| 20931 | const gchar * |
| 20932 | flash_get_flasher_instance (Flash *object) |
| 20933 | { |
| 20934 | return FLASH_GET_IFACE (object)->get_flasher_instance (object); |
| 20935 | } |
| 20936 | |
| 20937 | /** |
| 20938 | * flash_dup_flasher_instance: (skip) |
| 20939 | * @object: A #Flash. |
| 20940 | * |
| 20941 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. |
| 20942 | * |
| 20943 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20944 | * |
| 20945 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 20946 | */ |
| 20947 | gchar * |
| 20948 | flash_dup_flasher_instance (Flash *object) |
| 20949 | { |
| 20950 | gchar *value; |
| 20951 | g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL); |
| 20952 | return value; |
| 20953 | } |
| 20954 | |
| 20955 | /** |
| 20956 | * flash_set_flasher_instance: (skip) |
| 20957 | * @object: A #Flash. |
| 20958 | * @value: The value to set. |
| 20959 | * |
| 20960 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value. |
| 20961 | * |
| 20962 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 20963 | */ |
| 20964 | void |
| 20965 | flash_set_flasher_instance (Flash *object, const gchar *value) |
| 20966 | { |
| 20967 | g_object_set (G_OBJECT (object), "flasher-instance", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 20968 | } |
| 20969 | |
| 20970 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 20971 | * flash_get_status: (skip) |
| 20972 | * @object: A #Flash. |
| 20973 | * |
| 20974 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. |
| 20975 | * |
| 20976 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20977 | * |
| 20978 | * <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> |
| 20979 | * |
| 20980 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 20981 | */ |
| 20982 | const gchar * |
| 20983 | flash_get_status (Flash *object) |
| 20984 | { |
| 20985 | return FLASH_GET_IFACE (object)->get_status (object); |
| 20986 | } |
| 20987 | |
| 20988 | /** |
| 20989 | * flash_dup_status: (skip) |
| 20990 | * @object: A #Flash. |
| 20991 | * |
| 20992 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. |
| 20993 | * |
| 20994 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 20995 | * |
| 20996 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 20997 | */ |
| 20998 | gchar * |
| 20999 | flash_dup_status (Flash *object) |
| 21000 | { |
| 21001 | gchar *value; |
| 21002 | g_object_get (G_OBJECT (object), "status", &value, NULL); |
| 21003 | return value; |
| 21004 | } |
| 21005 | |
| 21006 | /** |
| 21007 | * flash_set_status: (skip) |
| 21008 | * @object: A #Flash. |
| 21009 | * @value: The value to set. |
| 21010 | * |
| 21011 | * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value. |
| 21012 | * |
| 21013 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 21014 | */ |
| 21015 | void |
| 21016 | flash_set_status (Flash *object, const gchar *value) |
| 21017 | { |
| 21018 | g_object_set (G_OBJECT (object), "status", value, NULL); |
| 21019 | } |
| 21020 | |
| 21021 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21022 | * flash_emit_updated: |
| 21023 | * @object: A #Flash. |
| 21024 | * |
| 21025 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal. |
| 21026 | */ |
| 21027 | void |
| 21028 | flash_emit_updated ( |
| 21029 | Flash *object) |
| 21030 | { |
| 21031 | g_signal_emit_by_name (object, "updated"); |
| 21032 | } |
| 21033 | |
| 21034 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21035 | * flash_emit_download: |
| 21036 | * @object: A #Flash. |
| 21037 | * @arg_url: Argument to pass with the signal. |
| 21038 | * @arg_filename: Argument to pass with the signal. |
| 21039 | * |
| 21040 | * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal. |
| 21041 | */ |
| 21042 | void |
| 21043 | flash_emit_download ( |
| 21044 | Flash *object, |
| 21045 | const gchar *arg_url, |
| 21046 | const gchar *arg_filename) |
| 21047 | { |
| 21048 | g_signal_emit_by_name (object, "download", arg_url, arg_filename); |
| 21049 | } |
| 21050 | |
| 21051 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21052 | * flash_call_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21053 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21054 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21055 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21056 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21057 | * @user_data: User data to pass to @callback. |
| 21058 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21059 | * 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] | 21060 | * When the operation is finished, @callback will be invoked 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] | 21061 | * 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] | 21062 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21063 | * 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] | 21064 | */ |
| 21065 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21066 | flash_call_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21067 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21068 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21069 | GCancellable *cancellable, |
| 21070 | GAsyncReadyCallback callback, |
| 21071 | gpointer user_data) |
| 21072 | { |
| 21073 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21074 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21075 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21076 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21077 | G_DBUS_CALL_FLAGS_NONE, |
| 21078 | -1, |
| 21079 | cancellable, |
| 21080 | callback, |
| 21081 | user_data); |
| 21082 | } |
| 21083 | |
| 21084 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21085 | * flash_call_update_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21086 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21087 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21088 | * @error: Return location for error or %NULL. |
| 21089 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21090 | * Finishes an operation started with flash_call_update(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21091 | * |
| 21092 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21093 | */ |
| 21094 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21095 | flash_call_update_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21096 | Flash *proxy, |
| 21097 | GAsyncResult *res, |
| 21098 | GError **error) |
| 21099 | { |
| 21100 | GVariant *_ret; |
| 21101 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21102 | if (_ret == NULL) |
| 21103 | goto _out; |
| 21104 | g_variant_get (_ret, |
| 21105 | "()"); |
| 21106 | g_variant_unref (_ret); |
| 21107 | _out: |
| 21108 | return _ret != NULL; |
| 21109 | } |
| 21110 | |
| 21111 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21112 | * flash_call_update_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21113 | * @proxy: A #FlashProxy. |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21114 | * @arg_filename: Argument to pass with the method invocation. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21115 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21116 | * @error: Return location for error or %NULL. |
| 21117 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21118 | * 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] | 21119 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21120 | * See flash_call_update() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21121 | * |
| 21122 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21123 | */ |
| 21124 | gboolean |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21125 | flash_call_update_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21126 | Flash *proxy, |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21127 | const gchar *arg_filename, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21128 | GCancellable *cancellable, |
| 21129 | GError **error) |
| 21130 | { |
| 21131 | GVariant *_ret; |
| 21132 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21133 | "update", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21134 | g_variant_new ("(s)", |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21135 | arg_filename), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21136 | G_DBUS_CALL_FLAGS_NONE, |
| 21137 | -1, |
| 21138 | cancellable, |
| 21139 | error); |
| 21140 | if (_ret == NULL) |
| 21141 | goto _out; |
| 21142 | g_variant_get (_ret, |
| 21143 | "()"); |
| 21144 | g_variant_unref (_ret); |
| 21145 | _out: |
| 21146 | return _ret != NULL; |
| 21147 | } |
| 21148 | |
| 21149 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21150 | * flash_call_error: |
| 21151 | * @proxy: A #FlashProxy. |
| 21152 | * @arg_message: Argument to pass with the method invocation. |
| 21153 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21154 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21155 | * @user_data: User data to pass to @callback. |
| 21156 | * |
| 21157 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. |
| 21158 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 21159 | * You can then call flash_call_error_finish() to get the result of the operation. |
| 21160 | * |
| 21161 | * See flash_call_error_sync() for the synchronous, blocking version of this method. |
| 21162 | */ |
| 21163 | void |
| 21164 | flash_call_error ( |
| 21165 | Flash *proxy, |
| 21166 | const gchar *arg_message, |
| 21167 | GCancellable *cancellable, |
| 21168 | GAsyncReadyCallback callback, |
| 21169 | gpointer user_data) |
| 21170 | { |
| 21171 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21172 | "error", |
| 21173 | g_variant_new ("(s)", |
| 21174 | arg_message), |
| 21175 | G_DBUS_CALL_FLAGS_NONE, |
| 21176 | -1, |
| 21177 | cancellable, |
| 21178 | callback, |
| 21179 | user_data); |
| 21180 | } |
| 21181 | |
| 21182 | /** |
| 21183 | * flash_call_error_finish: |
| 21184 | * @proxy: A #FlashProxy. |
| 21185 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error(). |
| 21186 | * @error: Return location for error or %NULL. |
| 21187 | * |
| 21188 | * Finishes an operation started with flash_call_error(). |
| 21189 | * |
| 21190 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21191 | */ |
| 21192 | gboolean |
| 21193 | flash_call_error_finish ( |
| 21194 | Flash *proxy, |
| 21195 | GAsyncResult *res, |
| 21196 | GError **error) |
| 21197 | { |
| 21198 | GVariant *_ret; |
| 21199 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21200 | if (_ret == NULL) |
| 21201 | goto _out; |
| 21202 | g_variant_get (_ret, |
| 21203 | "()"); |
| 21204 | g_variant_unref (_ret); |
| 21205 | _out: |
| 21206 | return _ret != NULL; |
| 21207 | } |
| 21208 | |
| 21209 | /** |
| 21210 | * flash_call_error_sync: |
| 21211 | * @proxy: A #FlashProxy. |
| 21212 | * @arg_message: Argument to pass with the method invocation. |
| 21213 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21214 | * @error: Return location for error or %NULL. |
| 21215 | * |
| 21216 | * 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. |
| 21217 | * |
| 21218 | * See flash_call_error() for the asynchronous version of this method. |
| 21219 | * |
| 21220 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21221 | */ |
| 21222 | gboolean |
| 21223 | flash_call_error_sync ( |
| 21224 | Flash *proxy, |
| 21225 | const gchar *arg_message, |
| 21226 | GCancellable *cancellable, |
| 21227 | GError **error) |
| 21228 | { |
| 21229 | GVariant *_ret; |
| 21230 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 21231 | "error", |
| 21232 | g_variant_new ("(s)", |
| 21233 | arg_message), |
| 21234 | G_DBUS_CALL_FLAGS_NONE, |
| 21235 | -1, |
| 21236 | cancellable, |
| 21237 | error); |
| 21238 | if (_ret == NULL) |
| 21239 | goto _out; |
| 21240 | g_variant_get (_ret, |
| 21241 | "()"); |
| 21242 | g_variant_unref (_ret); |
| 21243 | _out: |
| 21244 | return _ret != NULL; |
| 21245 | } |
| 21246 | |
| 21247 | /** |
| 21248 | * flash_call_done: |
| 21249 | * @proxy: A #FlashProxy. |
| 21250 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21251 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21252 | * @user_data: User data to pass to @callback. |
| 21253 | * |
| 21254 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. |
| 21255 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 21256 | * You can then call flash_call_done_finish() to get the result of the operation. |
| 21257 | * |
| 21258 | * See flash_call_done_sync() for the synchronous, blocking version of this method. |
| 21259 | */ |
| 21260 | void |
| 21261 | flash_call_done ( |
| 21262 | Flash *proxy, |
| 21263 | GCancellable *cancellable, |
| 21264 | GAsyncReadyCallback callback, |
| 21265 | gpointer user_data) |
| 21266 | { |
| 21267 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21268 | "done", |
| 21269 | g_variant_new ("()"), |
| 21270 | G_DBUS_CALL_FLAGS_NONE, |
| 21271 | -1, |
| 21272 | cancellable, |
| 21273 | callback, |
| 21274 | user_data); |
| 21275 | } |
| 21276 | |
| 21277 | /** |
| 21278 | * flash_call_done_finish: |
| 21279 | * @proxy: A #FlashProxy. |
| 21280 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done(). |
| 21281 | * @error: Return location for error or %NULL. |
| 21282 | * |
| 21283 | * Finishes an operation started with flash_call_done(). |
| 21284 | * |
| 21285 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21286 | */ |
| 21287 | gboolean |
| 21288 | flash_call_done_finish ( |
| 21289 | Flash *proxy, |
| 21290 | GAsyncResult *res, |
| 21291 | GError **error) |
| 21292 | { |
| 21293 | GVariant *_ret; |
| 21294 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21295 | if (_ret == NULL) |
| 21296 | goto _out; |
| 21297 | g_variant_get (_ret, |
| 21298 | "()"); |
| 21299 | g_variant_unref (_ret); |
| 21300 | _out: |
| 21301 | return _ret != NULL; |
| 21302 | } |
| 21303 | |
| 21304 | /** |
| 21305 | * flash_call_done_sync: |
| 21306 | * @proxy: A #FlashProxy. |
| 21307 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21308 | * @error: Return location for error or %NULL. |
| 21309 | * |
| 21310 | * 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. |
| 21311 | * |
| 21312 | * See flash_call_done() for the asynchronous version of this method. |
| 21313 | * |
| 21314 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21315 | */ |
| 21316 | gboolean |
| 21317 | flash_call_done_sync ( |
| 21318 | Flash *proxy, |
| 21319 | GCancellable *cancellable, |
| 21320 | GError **error) |
| 21321 | { |
| 21322 | GVariant *_ret; |
| 21323 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 21324 | "done", |
| 21325 | g_variant_new ("()"), |
| 21326 | G_DBUS_CALL_FLAGS_NONE, |
| 21327 | -1, |
| 21328 | cancellable, |
| 21329 | error); |
| 21330 | if (_ret == NULL) |
| 21331 | goto _out; |
| 21332 | g_variant_get (_ret, |
| 21333 | "()"); |
| 21334 | g_variant_unref (_ret); |
| 21335 | _out: |
| 21336 | return _ret != NULL; |
| 21337 | } |
| 21338 | |
| 21339 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21340 | * flash_call_update_via_tftp: |
| 21341 | * @proxy: A #FlashProxy. |
| 21342 | * @arg_url: Argument to pass with the method invocation. |
| 21343 | * @arg_filename: Argument to pass with the method invocation. |
| 21344 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21345 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21346 | * @user_data: User data to pass to @callback. |
| 21347 | * |
| 21348 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. |
| 21349 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 21350 | * You can then call flash_call_update_via_tftp_finish() to get the result of the operation. |
| 21351 | * |
| 21352 | * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method. |
| 21353 | */ |
| 21354 | void |
| 21355 | flash_call_update_via_tftp ( |
| 21356 | Flash *proxy, |
| 21357 | const gchar *arg_url, |
| 21358 | const gchar *arg_filename, |
| 21359 | GCancellable *cancellable, |
| 21360 | GAsyncReadyCallback callback, |
| 21361 | gpointer user_data) |
| 21362 | { |
| 21363 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21364 | "updateViaTftp", |
| 21365 | g_variant_new ("(ss)", |
| 21366 | arg_url, |
| 21367 | arg_filename), |
| 21368 | G_DBUS_CALL_FLAGS_NONE, |
| 21369 | -1, |
| 21370 | cancellable, |
| 21371 | callback, |
| 21372 | user_data); |
| 21373 | } |
| 21374 | |
| 21375 | /** |
| 21376 | * flash_call_update_via_tftp_finish: |
| 21377 | * @proxy: A #FlashProxy. |
| 21378 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp(). |
| 21379 | * @error: Return location for error or %NULL. |
| 21380 | * |
| 21381 | * Finishes an operation started with flash_call_update_via_tftp(). |
| 21382 | * |
| 21383 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21384 | */ |
| 21385 | gboolean |
| 21386 | flash_call_update_via_tftp_finish ( |
| 21387 | Flash *proxy, |
| 21388 | GAsyncResult *res, |
| 21389 | GError **error) |
| 21390 | { |
| 21391 | GVariant *_ret; |
| 21392 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21393 | if (_ret == NULL) |
| 21394 | goto _out; |
| 21395 | g_variant_get (_ret, |
| 21396 | "()"); |
| 21397 | g_variant_unref (_ret); |
| 21398 | _out: |
| 21399 | return _ret != NULL; |
| 21400 | } |
| 21401 | |
| 21402 | /** |
| 21403 | * flash_call_update_via_tftp_sync: |
| 21404 | * @proxy: A #FlashProxy. |
| 21405 | * @arg_url: Argument to pass with the method invocation. |
| 21406 | * @arg_filename: Argument to pass with the method invocation. |
| 21407 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21408 | * @error: Return location for error or %NULL. |
| 21409 | * |
| 21410 | * 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. |
| 21411 | * |
| 21412 | * See flash_call_update_via_tftp() for the asynchronous version of this method. |
| 21413 | * |
| 21414 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21415 | */ |
| 21416 | gboolean |
| 21417 | flash_call_update_via_tftp_sync ( |
| 21418 | Flash *proxy, |
| 21419 | const gchar *arg_url, |
| 21420 | const gchar *arg_filename, |
| 21421 | GCancellable *cancellable, |
| 21422 | GError **error) |
| 21423 | { |
| 21424 | GVariant *_ret; |
| 21425 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 21426 | "updateViaTftp", |
| 21427 | g_variant_new ("(ss)", |
| 21428 | arg_url, |
| 21429 | arg_filename), |
| 21430 | G_DBUS_CALL_FLAGS_NONE, |
| 21431 | -1, |
| 21432 | cancellable, |
| 21433 | error); |
| 21434 | if (_ret == NULL) |
| 21435 | goto _out; |
| 21436 | g_variant_get (_ret, |
| 21437 | "()"); |
| 21438 | g_variant_unref (_ret); |
| 21439 | _out: |
| 21440 | return _ret != NULL; |
| 21441 | } |
| 21442 | |
| 21443 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21444 | * flash_call_init: |
| 21445 | * @proxy: A #FlashProxy. |
| 21446 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21447 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 21448 | * @user_data: User data to pass to @callback. |
| 21449 | * |
| 21450 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. |
| 21451 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 21452 | * You can then call flash_call_init_finish() to get the result of the operation. |
| 21453 | * |
| 21454 | * See flash_call_init_sync() for the synchronous, blocking version of this method. |
| 21455 | */ |
| 21456 | void |
| 21457 | flash_call_init ( |
| 21458 | Flash *proxy, |
| 21459 | GCancellable *cancellable, |
| 21460 | GAsyncReadyCallback callback, |
| 21461 | gpointer user_data) |
| 21462 | { |
| 21463 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 21464 | "init", |
| 21465 | g_variant_new ("()"), |
| 21466 | G_DBUS_CALL_FLAGS_NONE, |
| 21467 | -1, |
| 21468 | cancellable, |
| 21469 | callback, |
| 21470 | user_data); |
| 21471 | } |
| 21472 | |
| 21473 | /** |
| 21474 | * flash_call_init_finish: |
| 21475 | * @proxy: A #FlashProxy. |
| 21476 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init(). |
| 21477 | * @error: Return location for error or %NULL. |
| 21478 | * |
| 21479 | * Finishes an operation started with flash_call_init(). |
| 21480 | * |
| 21481 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21482 | */ |
| 21483 | gboolean |
| 21484 | flash_call_init_finish ( |
| 21485 | Flash *proxy, |
| 21486 | GAsyncResult *res, |
| 21487 | GError **error) |
| 21488 | { |
| 21489 | GVariant *_ret; |
| 21490 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 21491 | if (_ret == NULL) |
| 21492 | goto _out; |
| 21493 | g_variant_get (_ret, |
| 21494 | "()"); |
| 21495 | g_variant_unref (_ret); |
| 21496 | _out: |
| 21497 | return _ret != NULL; |
| 21498 | } |
| 21499 | |
| 21500 | /** |
| 21501 | * flash_call_init_sync: |
| 21502 | * @proxy: A #FlashProxy. |
| 21503 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21504 | * @error: Return location for error or %NULL. |
| 21505 | * |
| 21506 | * 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. |
| 21507 | * |
| 21508 | * See flash_call_init() for the asynchronous version of this method. |
| 21509 | * |
| 21510 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 21511 | */ |
| 21512 | gboolean |
| 21513 | flash_call_init_sync ( |
| 21514 | Flash *proxy, |
| 21515 | GCancellable *cancellable, |
| 21516 | GError **error) |
| 21517 | { |
| 21518 | GVariant *_ret; |
| 21519 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 21520 | "init", |
| 21521 | g_variant_new ("()"), |
| 21522 | G_DBUS_CALL_FLAGS_NONE, |
| 21523 | -1, |
| 21524 | cancellable, |
| 21525 | error); |
| 21526 | if (_ret == NULL) |
| 21527 | goto _out; |
| 21528 | g_variant_get (_ret, |
| 21529 | "()"); |
| 21530 | g_variant_unref (_ret); |
| 21531 | _out: |
| 21532 | return _ret != NULL; |
| 21533 | } |
| 21534 | |
| 21535 | /** |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21536 | * flash_complete_update: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21537 | * @object: A #Flash. |
| 21538 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21539 | * |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21540 | * 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] | 21541 | * |
| 21542 | * This method will free @invocation, you cannot use it afterwards. |
| 21543 | */ |
| 21544 | void |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 21545 | flash_complete_update ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21546 | Flash *object, |
| 21547 | GDBusMethodInvocation *invocation) |
| 21548 | { |
| 21549 | g_dbus_method_invocation_return_value (invocation, |
| 21550 | g_variant_new ("()")); |
| 21551 | } |
| 21552 | |
| 21553 | /** |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21554 | * flash_complete_error: |
| 21555 | * @object: A #Flash. |
| 21556 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21557 | * |
| 21558 | * 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. |
| 21559 | * |
| 21560 | * This method will free @invocation, you cannot use it afterwards. |
| 21561 | */ |
| 21562 | void |
| 21563 | flash_complete_error ( |
| 21564 | Flash *object, |
| 21565 | GDBusMethodInvocation *invocation) |
| 21566 | { |
| 21567 | g_dbus_method_invocation_return_value (invocation, |
| 21568 | g_variant_new ("()")); |
| 21569 | } |
| 21570 | |
| 21571 | /** |
| 21572 | * flash_complete_done: |
| 21573 | * @object: A #Flash. |
| 21574 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21575 | * |
| 21576 | * 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. |
| 21577 | * |
| 21578 | * This method will free @invocation, you cannot use it afterwards. |
| 21579 | */ |
| 21580 | void |
| 21581 | flash_complete_done ( |
| 21582 | Flash *object, |
| 21583 | GDBusMethodInvocation *invocation) |
| 21584 | { |
| 21585 | g_dbus_method_invocation_return_value (invocation, |
| 21586 | g_variant_new ("()")); |
| 21587 | } |
| 21588 | |
| 21589 | /** |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 21590 | * flash_complete_update_via_tftp: |
| 21591 | * @object: A #Flash. |
| 21592 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21593 | * |
| 21594 | * 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. |
| 21595 | * |
| 21596 | * This method will free @invocation, you cannot use it afterwards. |
| 21597 | */ |
| 21598 | void |
| 21599 | flash_complete_update_via_tftp ( |
| 21600 | Flash *object, |
| 21601 | GDBusMethodInvocation *invocation) |
| 21602 | { |
| 21603 | g_dbus_method_invocation_return_value (invocation, |
| 21604 | g_variant_new ("()")); |
| 21605 | } |
| 21606 | |
| 21607 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21608 | * flash_complete_init: |
| 21609 | * @object: A #Flash. |
| 21610 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 21611 | * |
| 21612 | * 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. |
| 21613 | * |
| 21614 | * This method will free @invocation, you cannot use it afterwards. |
| 21615 | */ |
| 21616 | void |
| 21617 | flash_complete_init ( |
| 21618 | Flash *object, |
| 21619 | GDBusMethodInvocation *invocation) |
| 21620 | { |
| 21621 | g_dbus_method_invocation_return_value (invocation, |
| 21622 | g_variant_new ("()")); |
| 21623 | } |
| 21624 | |
| 21625 | /* ------------------------------------------------------------------------ */ |
| 21626 | |
| 21627 | /** |
| 21628 | * FlashProxy: |
| 21629 | * |
| 21630 | * The #FlashProxy structure contains only private data and should only be accessed using the provided API. |
| 21631 | */ |
| 21632 | |
| 21633 | /** |
| 21634 | * FlashProxyClass: |
| 21635 | * @parent_class: The parent class. |
| 21636 | * |
| 21637 | * Class structure for #FlashProxy. |
| 21638 | */ |
| 21639 | |
| 21640 | struct _FlashProxyPrivate |
| 21641 | { |
| 21642 | GData *qdata; |
| 21643 | }; |
| 21644 | |
| 21645 | static void flash_proxy_iface_init (FlashIface *iface); |
| 21646 | |
| 21647 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21648 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 21649 | G_ADD_PRIVATE (FlashProxy) |
| 21650 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 21651 | |
| 21652 | #else |
| 21653 | G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, |
| 21654 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); |
| 21655 | |
| 21656 | #endif |
| 21657 | static void |
| 21658 | flash_proxy_finalize (GObject *object) |
| 21659 | { |
| 21660 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21661 | g_datalist_clear (&proxy->priv->qdata); |
| 21662 | G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object); |
| 21663 | } |
| 21664 | |
| 21665 | static void |
| 21666 | flash_proxy_get_property (GObject *object, |
| 21667 | guint prop_id, |
| 21668 | GValue *value, |
| 21669 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21670 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21671 | const _ExtendedGDBusPropertyInfo *info; |
| 21672 | GVariant *variant; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21673 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21674 | info = _flash_property_info_pointers[prop_id - 1]; |
| 21675 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 21676 | if (info->use_gvariant) |
| 21677 | { |
| 21678 | g_value_set_variant (value, variant); |
| 21679 | } |
| 21680 | else |
| 21681 | { |
| 21682 | if (variant != NULL) |
| 21683 | g_dbus_gvariant_to_gvalue (variant, value); |
| 21684 | } |
| 21685 | if (variant != NULL) |
| 21686 | g_variant_unref (variant); |
| 21687 | } |
| 21688 | |
| 21689 | static void |
| 21690 | flash_proxy_set_property_cb (GDBusProxy *proxy, |
| 21691 | GAsyncResult *res, |
| 21692 | gpointer user_data) |
| 21693 | { |
| 21694 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 21695 | GError *error; |
| 21696 | GVariant *_ret; |
| 21697 | error = NULL; |
| 21698 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 21699 | if (!_ret) |
| 21700 | { |
| 21701 | g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)", |
| 21702 | info->parent_struct.name, |
| 21703 | error->message, g_quark_to_string (error->domain), error->code); |
| 21704 | g_error_free (error); |
| 21705 | } |
| 21706 | else |
| 21707 | { |
| 21708 | g_variant_unref (_ret); |
| 21709 | } |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21710 | } |
| 21711 | |
| 21712 | static void |
| 21713 | flash_proxy_set_property (GObject *object, |
| 21714 | guint prop_id, |
| 21715 | const GValue *value, |
| 21716 | GParamSpec *pspec G_GNUC_UNUSED) |
| 21717 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21718 | const _ExtendedGDBusPropertyInfo *info; |
| 21719 | GVariant *variant; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21720 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21721 | info = _flash_property_info_pointers[prop_id - 1]; |
| 21722 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 21723 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 21724 | "org.freedesktop.DBus.Properties.Set", |
| 21725 | g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant), |
| 21726 | G_DBUS_CALL_FLAGS_NONE, |
| 21727 | -1, |
| 21728 | NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 21729 | g_variant_unref (variant); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21730 | } |
| 21731 | |
| 21732 | static void |
| 21733 | flash_proxy_g_signal (GDBusProxy *proxy, |
| 21734 | const gchar *sender_name G_GNUC_UNUSED, |
| 21735 | const gchar *signal_name, |
| 21736 | GVariant *parameters) |
| 21737 | { |
| 21738 | _ExtendedGDBusSignalInfo *info; |
| 21739 | GVariantIter iter; |
| 21740 | GVariant *child; |
| 21741 | GValue *paramv; |
| 21742 | guint num_params; |
| 21743 | guint n; |
| 21744 | guint signal_id; |
| 21745 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name); |
| 21746 | if (info == NULL) |
| 21747 | return; |
| 21748 | num_params = g_variant_n_children (parameters); |
| 21749 | paramv = g_new0 (GValue, num_params + 1); |
| 21750 | g_value_init (¶mv[0], TYPE_FLASH); |
| 21751 | g_value_set_object (¶mv[0], proxy); |
| 21752 | g_variant_iter_init (&iter, parameters); |
| 21753 | n = 1; |
| 21754 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 21755 | { |
| 21756 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 21757 | if (arg_info->use_gvariant) |
| 21758 | { |
| 21759 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 21760 | g_value_set_variant (¶mv[n], child); |
| 21761 | n++; |
| 21762 | } |
| 21763 | else |
| 21764 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 21765 | g_variant_unref (child); |
| 21766 | } |
| 21767 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 21768 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 21769 | for (n = 0; n < num_params + 1; n++) |
| 21770 | g_value_unset (¶mv[n]); |
| 21771 | g_free (paramv); |
| 21772 | } |
| 21773 | |
| 21774 | static void |
| 21775 | flash_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 21776 | GVariant *changed_properties, |
| 21777 | const gchar *const *invalidated_properties) |
| 21778 | { |
| 21779 | FlashProxy *proxy = FLASH_PROXY (_proxy); |
| 21780 | guint n; |
| 21781 | const gchar *key; |
| 21782 | GVariantIter *iter; |
| 21783 | _ExtendedGDBusPropertyInfo *info; |
| 21784 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 21785 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 21786 | { |
| 21787 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key); |
| 21788 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 21789 | if (info != NULL) |
| 21790 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 21791 | } |
| 21792 | g_variant_iter_free (iter); |
| 21793 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 21794 | { |
| 21795 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]); |
| 21796 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 21797 | if (info != NULL) |
| 21798 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 21799 | } |
| 21800 | } |
| 21801 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21802 | static const gchar * |
| 21803 | flash_proxy_get_filename (Flash *object) |
| 21804 | { |
| 21805 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21806 | GVariant *variant; |
| 21807 | const gchar *value = NULL; |
| 21808 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 21809 | if (variant != NULL) |
| 21810 | { |
| 21811 | value = g_variant_get_string (variant, NULL); |
| 21812 | g_variant_unref (variant); |
| 21813 | } |
| 21814 | return value; |
| 21815 | } |
| 21816 | |
| 21817 | static const gchar * |
| 21818 | flash_proxy_get_flasher_path (Flash *object) |
| 21819 | { |
| 21820 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21821 | GVariant *variant; |
| 21822 | const gchar *value = NULL; |
| 21823 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path"); |
| 21824 | if (variant != NULL) |
| 21825 | { |
| 21826 | value = g_variant_get_string (variant, NULL); |
| 21827 | g_variant_unref (variant); |
| 21828 | } |
| 21829 | return value; |
| 21830 | } |
| 21831 | |
| 21832 | static const gchar * |
| 21833 | flash_proxy_get_flasher_name (Flash *object) |
| 21834 | { |
| 21835 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21836 | GVariant *variant; |
| 21837 | const gchar *value = NULL; |
| 21838 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name"); |
| 21839 | if (variant != NULL) |
| 21840 | { |
| 21841 | value = g_variant_get_string (variant, NULL); |
| 21842 | g_variant_unref (variant); |
| 21843 | } |
| 21844 | return value; |
| 21845 | } |
| 21846 | |
| 21847 | static const gchar * |
| 21848 | flash_proxy_get_flasher_instance (Flash *object) |
| 21849 | { |
| 21850 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21851 | GVariant *variant; |
| 21852 | const gchar *value = NULL; |
| 21853 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance"); |
| 21854 | if (variant != NULL) |
| 21855 | { |
| 21856 | value = g_variant_get_string (variant, NULL); |
| 21857 | g_variant_unref (variant); |
| 21858 | } |
| 21859 | return value; |
| 21860 | } |
| 21861 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21862 | static const gchar * |
| 21863 | flash_proxy_get_status (Flash *object) |
| 21864 | { |
| 21865 | FlashProxy *proxy = FLASH_PROXY (object); |
| 21866 | GVariant *variant; |
| 21867 | const gchar *value = NULL; |
| 21868 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status"); |
| 21869 | if (variant != NULL) |
| 21870 | { |
| 21871 | value = g_variant_get_string (variant, NULL); |
| 21872 | g_variant_unref (variant); |
| 21873 | } |
| 21874 | return value; |
| 21875 | } |
| 21876 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21877 | static void |
| 21878 | flash_proxy_init (FlashProxy *proxy) |
| 21879 | { |
| 21880 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 21881 | proxy->priv = flash_proxy_get_instance_private (proxy); |
| 21882 | #else |
| 21883 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate); |
| 21884 | #endif |
| 21885 | |
| 21886 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ()); |
| 21887 | } |
| 21888 | |
| 21889 | static void |
| 21890 | flash_proxy_class_init (FlashProxyClass *klass) |
| 21891 | { |
| 21892 | GObjectClass *gobject_class; |
| 21893 | GDBusProxyClass *proxy_class; |
| 21894 | |
| 21895 | gobject_class = G_OBJECT_CLASS (klass); |
| 21896 | gobject_class->finalize = flash_proxy_finalize; |
| 21897 | gobject_class->get_property = flash_proxy_get_property; |
| 21898 | gobject_class->set_property = flash_proxy_set_property; |
| 21899 | |
| 21900 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 21901 | proxy_class->g_signal = flash_proxy_g_signal; |
| 21902 | proxy_class->g_properties_changed = flash_proxy_g_properties_changed; |
| 21903 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21904 | flash_override_properties (gobject_class, 1); |
| 21905 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21906 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 21907 | g_type_class_add_private (klass, sizeof (FlashProxyPrivate)); |
| 21908 | #endif |
| 21909 | } |
| 21910 | |
| 21911 | static void |
| 21912 | flash_proxy_iface_init (FlashIface *iface) |
| 21913 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 21914 | iface->get_filename = flash_proxy_get_filename; |
| 21915 | iface->get_flasher_path = flash_proxy_get_flasher_path; |
| 21916 | iface->get_flasher_name = flash_proxy_get_flasher_name; |
| 21917 | iface->get_flasher_instance = flash_proxy_get_flasher_instance; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 21918 | iface->get_status = flash_proxy_get_status; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 21919 | } |
| 21920 | |
| 21921 | /** |
| 21922 | * flash_proxy_new: |
| 21923 | * @connection: A #GDBusConnection. |
| 21924 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21925 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 21926 | * @object_path: An object path. |
| 21927 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21928 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 21929 | * @user_data: User data to pass to @callback. |
| 21930 | * |
| 21931 | * 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. |
| 21932 | * |
| 21933 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 21934 | * You can then call flash_proxy_new_finish() to get the result of the operation. |
| 21935 | * |
| 21936 | * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 21937 | */ |
| 21938 | void |
| 21939 | flash_proxy_new ( |
| 21940 | GDBusConnection *connection, |
| 21941 | GDBusProxyFlags flags, |
| 21942 | const gchar *name, |
| 21943 | const gchar *object_path, |
| 21944 | GCancellable *cancellable, |
| 21945 | GAsyncReadyCallback callback, |
| 21946 | gpointer user_data) |
| 21947 | { |
| 21948 | 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); |
| 21949 | } |
| 21950 | |
| 21951 | /** |
| 21952 | * flash_proxy_new_finish: |
| 21953 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new(). |
| 21954 | * @error: Return location for error or %NULL |
| 21955 | * |
| 21956 | * Finishes an operation started with flash_proxy_new(). |
| 21957 | * |
| 21958 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 21959 | */ |
| 21960 | Flash * |
| 21961 | flash_proxy_new_finish ( |
| 21962 | GAsyncResult *res, |
| 21963 | GError **error) |
| 21964 | { |
| 21965 | GObject *ret; |
| 21966 | GObject *source_object; |
| 21967 | source_object = g_async_result_get_source_object (res); |
| 21968 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 21969 | g_object_unref (source_object); |
| 21970 | if (ret != NULL) |
| 21971 | return FLASH (ret); |
| 21972 | else |
| 21973 | return NULL; |
| 21974 | } |
| 21975 | |
| 21976 | /** |
| 21977 | * flash_proxy_new_sync: |
| 21978 | * @connection: A #GDBusConnection. |
| 21979 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 21980 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 21981 | * @object_path: An object path. |
| 21982 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 21983 | * @error: Return location for error or %NULL |
| 21984 | * |
| 21985 | * 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. |
| 21986 | * |
| 21987 | * The calling thread is blocked until a reply is received. |
| 21988 | * |
| 21989 | * See flash_proxy_new() for the asynchronous version of this constructor. |
| 21990 | * |
| 21991 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 21992 | */ |
| 21993 | Flash * |
| 21994 | flash_proxy_new_sync ( |
| 21995 | GDBusConnection *connection, |
| 21996 | GDBusProxyFlags flags, |
| 21997 | const gchar *name, |
| 21998 | const gchar *object_path, |
| 21999 | GCancellable *cancellable, |
| 22000 | GError **error) |
| 22001 | { |
| 22002 | GInitable *ret; |
| 22003 | 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); |
| 22004 | if (ret != NULL) |
| 22005 | return FLASH (ret); |
| 22006 | else |
| 22007 | return NULL; |
| 22008 | } |
| 22009 | |
| 22010 | |
| 22011 | /** |
| 22012 | * flash_proxy_new_for_bus: |
| 22013 | * @bus_type: A #GBusType. |
| 22014 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22015 | * @name: A bus name (well-known or unique). |
| 22016 | * @object_path: An object path. |
| 22017 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22018 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 22019 | * @user_data: User data to pass to @callback. |
| 22020 | * |
| 22021 | * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 22022 | * |
| 22023 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 22024 | * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation. |
| 22025 | * |
| 22026 | * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 22027 | */ |
| 22028 | void |
| 22029 | flash_proxy_new_for_bus ( |
| 22030 | GBusType bus_type, |
| 22031 | GDBusProxyFlags flags, |
| 22032 | const gchar *name, |
| 22033 | const gchar *object_path, |
| 22034 | GCancellable *cancellable, |
| 22035 | GAsyncReadyCallback callback, |
| 22036 | gpointer user_data) |
| 22037 | { |
| 22038 | 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); |
| 22039 | } |
| 22040 | |
| 22041 | /** |
| 22042 | * flash_proxy_new_for_bus_finish: |
| 22043 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus(). |
| 22044 | * @error: Return location for error or %NULL |
| 22045 | * |
| 22046 | * Finishes an operation started with flash_proxy_new_for_bus(). |
| 22047 | * |
| 22048 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 22049 | */ |
| 22050 | Flash * |
| 22051 | flash_proxy_new_for_bus_finish ( |
| 22052 | GAsyncResult *res, |
| 22053 | GError **error) |
| 22054 | { |
| 22055 | GObject *ret; |
| 22056 | GObject *source_object; |
| 22057 | source_object = g_async_result_get_source_object (res); |
| 22058 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 22059 | g_object_unref (source_object); |
| 22060 | if (ret != NULL) |
| 22061 | return FLASH (ret); |
| 22062 | else |
| 22063 | return NULL; |
| 22064 | } |
| 22065 | |
| 22066 | /** |
| 22067 | * flash_proxy_new_for_bus_sync: |
| 22068 | * @bus_type: A #GBusType. |
| 22069 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 22070 | * @name: A bus name (well-known or unique). |
| 22071 | * @object_path: An object path. |
| 22072 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 22073 | * @error: Return location for error or %NULL |
| 22074 | * |
| 22075 | * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 22076 | * |
| 22077 | * The calling thread is blocked until a reply is received. |
| 22078 | * |
| 22079 | * See flash_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 22080 | * |
| 22081 | * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. |
| 22082 | */ |
| 22083 | Flash * |
| 22084 | flash_proxy_new_for_bus_sync ( |
| 22085 | GBusType bus_type, |
| 22086 | GDBusProxyFlags flags, |
| 22087 | const gchar *name, |
| 22088 | const gchar *object_path, |
| 22089 | GCancellable *cancellable, |
| 22090 | GError **error) |
| 22091 | { |
| 22092 | GInitable *ret; |
| 22093 | 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); |
| 22094 | if (ret != NULL) |
| 22095 | return FLASH (ret); |
| 22096 | else |
| 22097 | return NULL; |
| 22098 | } |
| 22099 | |
| 22100 | |
| 22101 | /* ------------------------------------------------------------------------ */ |
| 22102 | |
| 22103 | /** |
| 22104 | * FlashSkeleton: |
| 22105 | * |
| 22106 | * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API. |
| 22107 | */ |
| 22108 | |
| 22109 | /** |
| 22110 | * FlashSkeletonClass: |
| 22111 | * @parent_class: The parent class. |
| 22112 | * |
| 22113 | * Class structure for #FlashSkeleton. |
| 22114 | */ |
| 22115 | |
| 22116 | struct _FlashSkeletonPrivate |
| 22117 | { |
| 22118 | GValue *properties; |
| 22119 | GList *changed_properties; |
| 22120 | GSource *changed_properties_idle_source; |
| 22121 | GMainContext *context; |
| 22122 | GMutex lock; |
| 22123 | }; |
| 22124 | |
| 22125 | static void |
| 22126 | _flash_skeleton_handle_method_call ( |
| 22127 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22128 | const gchar *sender G_GNUC_UNUSED, |
| 22129 | const gchar *object_path G_GNUC_UNUSED, |
| 22130 | const gchar *interface_name, |
| 22131 | const gchar *method_name, |
| 22132 | GVariant *parameters, |
| 22133 | GDBusMethodInvocation *invocation, |
| 22134 | gpointer user_data) |
| 22135 | { |
| 22136 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 22137 | _ExtendedGDBusMethodInfo *info; |
| 22138 | GVariantIter iter; |
| 22139 | GVariant *child; |
| 22140 | GValue *paramv; |
| 22141 | guint num_params; |
| 22142 | guint num_extra; |
| 22143 | guint n; |
| 22144 | guint signal_id; |
| 22145 | GValue return_value = G_VALUE_INIT; |
| 22146 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 22147 | g_assert (info != NULL); |
| 22148 | num_params = g_variant_n_children (parameters); |
| 22149 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 22150 | n = 0; |
| 22151 | g_value_init (¶mv[n], TYPE_FLASH); |
| 22152 | g_value_set_object (¶mv[n++], skeleton); |
| 22153 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 22154 | g_value_set_object (¶mv[n++], invocation); |
| 22155 | if (info->pass_fdlist) |
| 22156 | { |
| 22157 | #ifdef G_OS_UNIX |
| 22158 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 22159 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 22160 | #else |
| 22161 | g_assert_not_reached (); |
| 22162 | #endif |
| 22163 | } |
| 22164 | g_variant_iter_init (&iter, parameters); |
| 22165 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 22166 | { |
| 22167 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 22168 | if (arg_info->use_gvariant) |
| 22169 | { |
| 22170 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 22171 | g_value_set_variant (¶mv[n], child); |
| 22172 | n++; |
| 22173 | } |
| 22174 | else |
| 22175 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 22176 | g_variant_unref (child); |
| 22177 | } |
| 22178 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); |
| 22179 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 22180 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 22181 | if (!g_value_get_boolean (&return_value)) |
| 22182 | 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); |
| 22183 | g_value_unset (&return_value); |
| 22184 | for (n = 0; n < num_params + num_extra; n++) |
| 22185 | g_value_unset (¶mv[n]); |
| 22186 | g_free (paramv); |
| 22187 | } |
| 22188 | |
| 22189 | static GVariant * |
| 22190 | _flash_skeleton_handle_get_property ( |
| 22191 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22192 | const gchar *sender G_GNUC_UNUSED, |
| 22193 | const gchar *object_path G_GNUC_UNUSED, |
| 22194 | const gchar *interface_name G_GNUC_UNUSED, |
| 22195 | const gchar *property_name, |
| 22196 | GError **error, |
| 22197 | gpointer user_data) |
| 22198 | { |
| 22199 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 22200 | GValue value = G_VALUE_INIT; |
| 22201 | GParamSpec *pspec; |
| 22202 | _ExtendedGDBusPropertyInfo *info; |
| 22203 | GVariant *ret; |
| 22204 | ret = NULL; |
| 22205 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 22206 | g_assert (info != NULL); |
| 22207 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22208 | if (pspec == NULL) |
| 22209 | { |
| 22210 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22211 | } |
| 22212 | else |
| 22213 | { |
| 22214 | g_value_init (&value, pspec->value_type); |
| 22215 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22216 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 22217 | g_value_unset (&value); |
| 22218 | } |
| 22219 | return ret; |
| 22220 | } |
| 22221 | |
| 22222 | static gboolean |
| 22223 | _flash_skeleton_handle_set_property ( |
| 22224 | GDBusConnection *connection G_GNUC_UNUSED, |
| 22225 | const gchar *sender G_GNUC_UNUSED, |
| 22226 | const gchar *object_path G_GNUC_UNUSED, |
| 22227 | const gchar *interface_name G_GNUC_UNUSED, |
| 22228 | const gchar *property_name, |
| 22229 | GVariant *variant, |
| 22230 | GError **error, |
| 22231 | gpointer user_data) |
| 22232 | { |
| 22233 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 22234 | GValue value = G_VALUE_INIT; |
| 22235 | GParamSpec *pspec; |
| 22236 | _ExtendedGDBusPropertyInfo *info; |
| 22237 | gboolean ret; |
| 22238 | ret = FALSE; |
| 22239 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); |
| 22240 | g_assert (info != NULL); |
| 22241 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 22242 | if (pspec == NULL) |
| 22243 | { |
| 22244 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 22245 | } |
| 22246 | else |
| 22247 | { |
| 22248 | if (info->use_gvariant) |
| 22249 | g_value_set_variant (&value, variant); |
| 22250 | else |
| 22251 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 22252 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 22253 | g_value_unset (&value); |
| 22254 | ret = TRUE; |
| 22255 | } |
| 22256 | return ret; |
| 22257 | } |
| 22258 | |
| 22259 | static const GDBusInterfaceVTable _flash_skeleton_vtable = |
| 22260 | { |
| 22261 | _flash_skeleton_handle_method_call, |
| 22262 | _flash_skeleton_handle_get_property, |
| 22263 | _flash_skeleton_handle_set_property, |
| 22264 | {NULL} |
| 22265 | }; |
| 22266 | |
| 22267 | static GDBusInterfaceInfo * |
| 22268 | flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 22269 | { |
| 22270 | return flash_interface_info (); |
| 22271 | } |
| 22272 | |
| 22273 | static GDBusInterfaceVTable * |
| 22274 | flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 22275 | { |
| 22276 | return (GDBusInterfaceVTable *) &_flash_skeleton_vtable; |
| 22277 | } |
| 22278 | |
| 22279 | static GVariant * |
| 22280 | flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 22281 | { |
| 22282 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 22283 | |
| 22284 | GVariantBuilder builder; |
| 22285 | guint n; |
| 22286 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 22287 | if (_flash_interface_info.parent_struct.properties == NULL) |
| 22288 | goto out; |
| 22289 | for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++) |
| 22290 | { |
| 22291 | GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n]; |
| 22292 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 22293 | { |
| 22294 | GVariant *value; |
| 22295 | 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); |
| 22296 | if (value != NULL) |
| 22297 | { |
| 22298 | g_variant_take_ref (value); |
| 22299 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 22300 | g_variant_unref (value); |
| 22301 | } |
| 22302 | } |
| 22303 | } |
| 22304 | out: |
| 22305 | return g_variant_builder_end (&builder); |
| 22306 | } |
| 22307 | |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22308 | static gboolean _flash_emit_changed (gpointer user_data); |
| 22309 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22310 | static void |
| 22311 | flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 22312 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22313 | FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); |
| 22314 | gboolean emit_changed = FALSE; |
| 22315 | |
| 22316 | g_mutex_lock (&skeleton->priv->lock); |
| 22317 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 22318 | { |
| 22319 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 22320 | skeleton->priv->changed_properties_idle_source = NULL; |
| 22321 | emit_changed = TRUE; |
| 22322 | } |
| 22323 | g_mutex_unlock (&skeleton->priv->lock); |
| 22324 | |
| 22325 | if (emit_changed) |
| 22326 | _flash_emit_changed (skeleton); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22327 | } |
| 22328 | |
| 22329 | static void |
| 22330 | _flash_on_signal_updated ( |
| 22331 | Flash *object) |
| 22332 | { |
| 22333 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22334 | |
| 22335 | GList *connections, *l; |
| 22336 | GVariant *signal_variant; |
| 22337 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22338 | |
| 22339 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 22340 | for (l = connections; l != NULL; l = l->next) |
| 22341 | { |
| 22342 | GDBusConnection *connection = l->data; |
| 22343 | g_dbus_connection_emit_signal (connection, |
| 22344 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated", |
| 22345 | signal_variant, NULL); |
| 22346 | } |
| 22347 | g_variant_unref (signal_variant); |
| 22348 | g_list_free_full (connections, g_object_unref); |
| 22349 | } |
| 22350 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 22351 | static void |
| 22352 | _flash_on_signal_download ( |
| 22353 | Flash *object, |
| 22354 | const gchar *arg_url, |
| 22355 | const gchar *arg_filename) |
| 22356 | { |
| 22357 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22358 | |
| 22359 | GList *connections, *l; |
| 22360 | GVariant *signal_variant; |
| 22361 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22362 | |
| 22363 | signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", |
| 22364 | arg_url, |
| 22365 | arg_filename)); |
| 22366 | for (l = connections; l != NULL; l = l->next) |
| 22367 | { |
| 22368 | GDBusConnection *connection = l->data; |
| 22369 | g_dbus_connection_emit_signal (connection, |
| 22370 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download", |
| 22371 | signal_variant, NULL); |
| 22372 | } |
| 22373 | g_variant_unref (signal_variant); |
| 22374 | g_list_free_full (connections, g_object_unref); |
| 22375 | } |
| 22376 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22377 | static void flash_skeleton_iface_init (FlashIface *iface); |
| 22378 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22379 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 22380 | G_ADD_PRIVATE (FlashSkeleton) |
| 22381 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 22382 | |
| 22383 | #else |
| 22384 | G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 22385 | G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); |
| 22386 | |
| 22387 | #endif |
| 22388 | static void |
| 22389 | flash_skeleton_finalize (GObject *object) |
| 22390 | { |
| 22391 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22392 | guint n; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22393 | for (n = 0; n < 5; n++) |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22394 | g_value_unset (&skeleton->priv->properties[n]); |
| 22395 | g_free (skeleton->priv->properties); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22396 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 22397 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 22398 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 22399 | g_main_context_unref (skeleton->priv->context); |
| 22400 | g_mutex_clear (&skeleton->priv->lock); |
| 22401 | G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object); |
| 22402 | } |
| 22403 | |
| 22404 | static void |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22405 | flash_skeleton_get_property (GObject *object, |
| 22406 | guint prop_id, |
| 22407 | GValue *value, |
| 22408 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22409 | { |
| 22410 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22411 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22412 | g_mutex_lock (&skeleton->priv->lock); |
| 22413 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 22414 | g_mutex_unlock (&skeleton->priv->lock); |
| 22415 | } |
| 22416 | |
| 22417 | static gboolean |
| 22418 | _flash_emit_changed (gpointer user_data) |
| 22419 | { |
| 22420 | FlashSkeleton *skeleton = FLASH_SKELETON (user_data); |
| 22421 | GList *l; |
| 22422 | GVariantBuilder builder; |
| 22423 | GVariantBuilder invalidated_builder; |
| 22424 | guint num_changes; |
| 22425 | |
| 22426 | g_mutex_lock (&skeleton->priv->lock); |
| 22427 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 22428 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 22429 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 22430 | { |
| 22431 | ChangedProperty *cp = l->data; |
| 22432 | GVariant *variant; |
| 22433 | const GValue *cur_value; |
| 22434 | |
| 22435 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 22436 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 22437 | { |
| 22438 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 22439 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 22440 | g_variant_unref (variant); |
| 22441 | num_changes++; |
| 22442 | } |
| 22443 | } |
| 22444 | if (num_changes > 0) |
| 22445 | { |
| 22446 | GList *connections, *ll; |
| 22447 | GVariant *signal_variant; |
| 22448 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash", |
| 22449 | &builder, &invalidated_builder)); |
| 22450 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 22451 | for (ll = connections; ll != NULL; ll = ll->next) |
| 22452 | { |
| 22453 | GDBusConnection *connection = ll->data; |
| 22454 | |
| 22455 | g_dbus_connection_emit_signal (connection, |
| 22456 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 22457 | "org.freedesktop.DBus.Properties", |
| 22458 | "PropertiesChanged", |
| 22459 | signal_variant, |
| 22460 | NULL); |
| 22461 | } |
| 22462 | g_variant_unref (signal_variant); |
| 22463 | g_list_free_full (connections, g_object_unref); |
| 22464 | } |
| 22465 | else |
| 22466 | { |
| 22467 | g_variant_builder_clear (&builder); |
| 22468 | g_variant_builder_clear (&invalidated_builder); |
| 22469 | } |
| 22470 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 22471 | skeleton->priv->changed_properties = NULL; |
| 22472 | skeleton->priv->changed_properties_idle_source = NULL; |
| 22473 | g_mutex_unlock (&skeleton->priv->lock); |
| 22474 | return FALSE; |
| 22475 | } |
| 22476 | |
| 22477 | static void |
| 22478 | _flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 22479 | { |
| 22480 | ChangedProperty *cp; |
| 22481 | GList *l; |
| 22482 | cp = NULL; |
| 22483 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 22484 | { |
| 22485 | ChangedProperty *i_cp = l->data; |
| 22486 | if (i_cp->info == info) |
| 22487 | { |
| 22488 | cp = i_cp; |
| 22489 | break; |
| 22490 | } |
| 22491 | } |
| 22492 | if (cp == NULL) |
| 22493 | { |
| 22494 | cp = g_new0 (ChangedProperty, 1); |
| 22495 | cp->prop_id = prop_id; |
| 22496 | cp->info = info; |
| 22497 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 22498 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 22499 | g_value_copy (orig_value, &cp->orig_value); |
| 22500 | } |
| 22501 | } |
| 22502 | |
| 22503 | static void |
| 22504 | flash_skeleton_notify (GObject *object, |
| 22505 | GParamSpec *pspec G_GNUC_UNUSED) |
| 22506 | { |
| 22507 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22508 | g_mutex_lock (&skeleton->priv->lock); |
| 22509 | if (skeleton->priv->changed_properties != NULL && |
| 22510 | skeleton->priv->changed_properties_idle_source == NULL) |
| 22511 | { |
| 22512 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 22513 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 22514 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 22515 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 22516 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 22517 | } |
| 22518 | g_mutex_unlock (&skeleton->priv->lock); |
| 22519 | } |
| 22520 | |
| 22521 | static void |
| 22522 | flash_skeleton_set_property (GObject *object, |
| 22523 | guint prop_id, |
| 22524 | const GValue *value, |
| 22525 | GParamSpec *pspec) |
| 22526 | { |
| 22527 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22528 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22529 | g_mutex_lock (&skeleton->priv->lock); |
| 22530 | g_object_freeze_notify (object); |
| 22531 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 22532 | { |
| 22533 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 22534 | _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 22535 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 22536 | g_object_notify_by_pspec (object, pspec); |
| 22537 | } |
| 22538 | g_mutex_unlock (&skeleton->priv->lock); |
| 22539 | g_object_thaw_notify (object); |
| 22540 | } |
| 22541 | |
| 22542 | static void |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22543 | flash_skeleton_init (FlashSkeleton *skeleton) |
| 22544 | { |
| 22545 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 22546 | skeleton->priv = flash_skeleton_get_instance_private (skeleton); |
| 22547 | #else |
| 22548 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate); |
| 22549 | #endif |
| 22550 | |
| 22551 | g_mutex_init (&skeleton->priv->lock); |
| 22552 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22553 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22554 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 22555 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 22556 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
| 22557 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22558 | g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22559 | } |
| 22560 | |
| 22561 | static const gchar * |
| 22562 | flash_skeleton_get_filename (Flash *object) |
| 22563 | { |
| 22564 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22565 | const gchar *value; |
| 22566 | g_mutex_lock (&skeleton->priv->lock); |
| 22567 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 22568 | g_mutex_unlock (&skeleton->priv->lock); |
| 22569 | return value; |
| 22570 | } |
| 22571 | |
| 22572 | static const gchar * |
| 22573 | flash_skeleton_get_flasher_path (Flash *object) |
| 22574 | { |
| 22575 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22576 | const gchar *value; |
| 22577 | g_mutex_lock (&skeleton->priv->lock); |
| 22578 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 22579 | g_mutex_unlock (&skeleton->priv->lock); |
| 22580 | return value; |
| 22581 | } |
| 22582 | |
| 22583 | static const gchar * |
| 22584 | flash_skeleton_get_flasher_name (Flash *object) |
| 22585 | { |
| 22586 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22587 | const gchar *value; |
| 22588 | g_mutex_lock (&skeleton->priv->lock); |
| 22589 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
| 22590 | g_mutex_unlock (&skeleton->priv->lock); |
| 22591 | return value; |
| 22592 | } |
| 22593 | |
| 22594 | static const gchar * |
| 22595 | flash_skeleton_get_flasher_instance (Flash *object) |
| 22596 | { |
| 22597 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22598 | const gchar *value; |
| 22599 | g_mutex_lock (&skeleton->priv->lock); |
| 22600 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
| 22601 | g_mutex_unlock (&skeleton->priv->lock); |
| 22602 | return value; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22603 | } |
| 22604 | |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22605 | static const gchar * |
| 22606 | flash_skeleton_get_status (Flash *object) |
| 22607 | { |
| 22608 | FlashSkeleton *skeleton = FLASH_SKELETON (object); |
| 22609 | const gchar *value; |
| 22610 | g_mutex_lock (&skeleton->priv->lock); |
| 22611 | value = g_value_get_string (&(skeleton->priv->properties[4])); |
| 22612 | g_mutex_unlock (&skeleton->priv->lock); |
| 22613 | return value; |
| 22614 | } |
| 22615 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22616 | static void |
| 22617 | flash_skeleton_class_init (FlashSkeletonClass *klass) |
| 22618 | { |
| 22619 | GObjectClass *gobject_class; |
| 22620 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 22621 | |
| 22622 | gobject_class = G_OBJECT_CLASS (klass); |
| 22623 | gobject_class->finalize = flash_skeleton_finalize; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22624 | gobject_class->get_property = flash_skeleton_get_property; |
| 22625 | gobject_class->set_property = flash_skeleton_set_property; |
| 22626 | gobject_class->notify = flash_skeleton_notify; |
| 22627 | |
| 22628 | |
| 22629 | flash_override_properties (gobject_class, 1); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22630 | |
| 22631 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 22632 | skeleton_class->get_info = flash_skeleton_dbus_interface_get_info; |
| 22633 | skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties; |
| 22634 | skeleton_class->flush = flash_skeleton_dbus_interface_flush; |
| 22635 | skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable; |
| 22636 | |
| 22637 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 22638 | g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate)); |
| 22639 | #endif |
| 22640 | } |
| 22641 | |
| 22642 | static void |
| 22643 | flash_skeleton_iface_init (FlashIface *iface) |
| 22644 | { |
| 22645 | iface->updated = _flash_on_signal_updated; |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame] | 22646 | iface->download = _flash_on_signal_download; |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22647 | iface->get_filename = flash_skeleton_get_filename; |
| 22648 | iface->get_flasher_path = flash_skeleton_get_flasher_path; |
| 22649 | iface->get_flasher_name = flash_skeleton_get_flasher_name; |
| 22650 | iface->get_flasher_instance = flash_skeleton_get_flasher_instance; |
Norman James | 166acf4 | 2015-10-22 07:11:51 -0500 | [diff] [blame] | 22651 | iface->get_status = flash_skeleton_get_status; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 22652 | } |
| 22653 | |
| 22654 | /** |
| 22655 | * flash_skeleton_new: |
| 22656 | * |
| 22657 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. |
| 22658 | * |
| 22659 | * Returns: (transfer full) (type FlashSkeleton): The skeleton object. |
| 22660 | */ |
| 22661 | Flash * |
| 22662 | flash_skeleton_new (void) |
| 22663 | { |
| 22664 | return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL)); |
| 22665 | } |
| 22666 | |
| 22667 | /* ------------------------------------------------------------------------ |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 22668 | * Code for interface org.openbmc.FlashControl |
| 22669 | * ------------------------------------------------------------------------ |
| 22670 | */ |
| 22671 | |
| 22672 | /** |
| 22673 | * SECTION:FlashControl |
| 22674 | * @title: FlashControl |
| 22675 | * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface |
| 22676 | * |
| 22677 | * 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. |
| 22678 | */ |
| 22679 | |
| 22680 | /* ---- Introspection data for org.openbmc.FlashControl ---- */ |
| 22681 | |
| 22682 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type = |
| 22683 | { |
| 22684 | { |
| 22685 | -1, |
| 22686 | (gchar *) "type", |
| 22687 | (gchar *) "s", |
| 22688 | NULL |
| 22689 | }, |
| 22690 | FALSE |
| 22691 | }; |
| 22692 | |
| 22693 | static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename = |
| 22694 | { |
| 22695 | { |
| 22696 | -1, |
| 22697 | (gchar *) "filename", |
| 22698 | (gchar *) "s", |
| 22699 | NULL |
| 22700 | }, |
| 22701 | FALSE |
| 22702 | }; |
| 22703 | |
| 22704 | static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] = |
| 22705 | { |
| 22706 | &_flash_control_method_info_flash_IN_ARG_type, |
| 22707 | &_flash_control_method_info_flash_IN_ARG_filename, |
| 22708 | NULL |
| 22709 | }; |
| 22710 | |
| 22711 | static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash = |
| 22712 | { |
| 22713 | { |
| 22714 | -1, |
| 22715 | (gchar *) "flash", |
| 22716 | (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers, |
| 22717 | NULL, |
| 22718 | NULL |
| 22719 | }, |
| 22720 | "handle-flash", |
| 22721 | FALSE |
| 22722 | }; |
| 22723 | |
| 22724 | static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] = |
| 22725 | { |
| 22726 | &_flash_control_method_info_flash, |
| 22727 | NULL |
| 22728 | }; |
| 22729 | |
| 22730 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename = |
| 22731 | { |
| 22732 | { |
| 22733 | -1, |
| 22734 | (gchar *) "filename", |
| 22735 | (gchar *) "s", |
| 22736 | NULL |
| 22737 | }, |
| 22738 | FALSE |
| 22739 | }; |
| 22740 | |
| 22741 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] = |
| 22742 | { |
| 22743 | &_flash_control_signal_info_done_ARG_filename, |
| 22744 | NULL |
| 22745 | }; |
| 22746 | |
| 22747 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done = |
| 22748 | { |
| 22749 | { |
| 22750 | -1, |
| 22751 | (gchar *) "Done", |
| 22752 | (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers, |
| 22753 | NULL |
| 22754 | }, |
| 22755 | "done" |
| 22756 | }; |
| 22757 | |
| 22758 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename = |
| 22759 | { |
| 22760 | { |
| 22761 | -1, |
| 22762 | (gchar *) "filename", |
| 22763 | (gchar *) "s", |
| 22764 | NULL |
| 22765 | }, |
| 22766 | FALSE |
| 22767 | }; |
| 22768 | |
| 22769 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] = |
| 22770 | { |
| 22771 | &_flash_control_signal_info_error_ARG_filename, |
| 22772 | NULL |
| 22773 | }; |
| 22774 | |
| 22775 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error = |
| 22776 | { |
| 22777 | { |
| 22778 | -1, |
| 22779 | (gchar *) "Error", |
| 22780 | (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers, |
| 22781 | NULL |
| 22782 | }, |
| 22783 | "error" |
| 22784 | }; |
| 22785 | |
| 22786 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename = |
| 22787 | { |
| 22788 | { |
| 22789 | -1, |
| 22790 | (gchar *) "filename", |
| 22791 | (gchar *) "s", |
| 22792 | NULL |
| 22793 | }, |
| 22794 | FALSE |
| 22795 | }; |
| 22796 | |
| 22797 | static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress = |
| 22798 | { |
| 22799 | { |
| 22800 | -1, |
| 22801 | (gchar *) "progress", |
| 22802 | (gchar *) "y", |
| 22803 | NULL |
| 22804 | }, |
| 22805 | FALSE |
| 22806 | }; |
| 22807 | |
| 22808 | static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] = |
| 22809 | { |
| 22810 | &_flash_control_signal_info_progress_ARG_filename, |
| 22811 | &_flash_control_signal_info_progress_ARG_progress, |
| 22812 | NULL |
| 22813 | }; |
| 22814 | |
| 22815 | static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress = |
| 22816 | { |
| 22817 | { |
| 22818 | -1, |
| 22819 | (gchar *) "Progress", |
| 22820 | (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers, |
| 22821 | NULL |
| 22822 | }, |
| 22823 | "progress" |
| 22824 | }; |
| 22825 | |
| 22826 | static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] = |
| 22827 | { |
| 22828 | &_flash_control_signal_info_done, |
| 22829 | &_flash_control_signal_info_error, |
| 22830 | &_flash_control_signal_info_progress, |
| 22831 | NULL |
| 22832 | }; |
| 22833 | |
| 22834 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename = |
| 22835 | { |
| 22836 | { |
| 22837 | -1, |
| 22838 | (gchar *) "filename", |
| 22839 | (gchar *) "s", |
| 22840 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 22841 | NULL |
| 22842 | }, |
| 22843 | "filename", |
| 22844 | FALSE |
| 22845 | }; |
| 22846 | |
| 22847 | static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ = |
| 22848 | { |
| 22849 | { |
| 22850 | -1, |
| 22851 | (gchar *) "type", |
| 22852 | (gchar *) "s", |
| 22853 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 22854 | NULL |
| 22855 | }, |
| 22856 | "type", |
| 22857 | FALSE |
| 22858 | }; |
| 22859 | |
| 22860 | static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] = |
| 22861 | { |
| 22862 | &_flash_control_property_info_filename, |
| 22863 | &_flash_control_property_info_type_, |
| 22864 | NULL |
| 22865 | }; |
| 22866 | |
| 22867 | static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info = |
| 22868 | { |
| 22869 | { |
| 22870 | -1, |
| 22871 | (gchar *) "org.openbmc.FlashControl", |
| 22872 | (GDBusMethodInfo **) &_flash_control_method_info_pointers, |
| 22873 | (GDBusSignalInfo **) &_flash_control_signal_info_pointers, |
| 22874 | (GDBusPropertyInfo **) &_flash_control_property_info_pointers, |
| 22875 | NULL |
| 22876 | }, |
| 22877 | "flash-control", |
| 22878 | }; |
| 22879 | |
| 22880 | |
| 22881 | /** |
| 22882 | * flash_control_interface_info: |
| 22883 | * |
| 22884 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface. |
| 22885 | * |
| 22886 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 22887 | */ |
| 22888 | GDBusInterfaceInfo * |
| 22889 | flash_control_interface_info (void) |
| 22890 | { |
| 22891 | return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct; |
| 22892 | } |
| 22893 | |
| 22894 | /** |
| 22895 | * flash_control_override_properties: |
| 22896 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 22897 | * @property_id_begin: The property id to assign to the first overridden property. |
| 22898 | * |
| 22899 | * Overrides all #GObject properties in the #FlashControl interface for a concrete class. |
| 22900 | * The properties are overridden in the order they are defined. |
| 22901 | * |
| 22902 | * Returns: The last property id. |
| 22903 | */ |
| 22904 | guint |
| 22905 | flash_control_override_properties (GObjectClass *klass, guint property_id_begin) |
| 22906 | { |
| 22907 | g_object_class_override_property (klass, property_id_begin++, "filename"); |
| 22908 | g_object_class_override_property (klass, property_id_begin++, "type"); |
| 22909 | return property_id_begin - 1; |
| 22910 | } |
| 22911 | |
| 22912 | |
| 22913 | |
| 22914 | /** |
| 22915 | * FlashControl: |
| 22916 | * |
| 22917 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 22918 | */ |
| 22919 | |
| 22920 | /** |
| 22921 | * FlashControlIface: |
| 22922 | * @parent_iface: The parent interface. |
| 22923 | * @handle_flash: Handler for the #FlashControl::handle-flash signal. |
| 22924 | * @get_filename: Getter for the #FlashControl:filename property. |
| 22925 | * @get_type_: Getter for the #FlashControl:type property. |
| 22926 | * @done: Handler for the #FlashControl::done signal. |
| 22927 | * @error: Handler for the #FlashControl::error signal. |
| 22928 | * @progress: Handler for the #FlashControl::progress signal. |
| 22929 | * |
| 22930 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 22931 | */ |
| 22932 | |
| 22933 | typedef FlashControlIface FlashControlInterface; |
| 22934 | G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT); |
| 22935 | |
| 22936 | static void |
| 22937 | flash_control_default_init (FlashControlIface *iface) |
| 22938 | { |
| 22939 | /* GObject signals for incoming D-Bus method calls: */ |
| 22940 | /** |
| 22941 | * FlashControl::handle-flash: |
| 22942 | * @object: A #FlashControl. |
| 22943 | * @invocation: A #GDBusMethodInvocation. |
| 22944 | * @arg_type: Argument passed by remote caller. |
| 22945 | * @arg_filename: Argument passed by remote caller. |
| 22946 | * |
| 22947 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. |
| 22948 | * |
| 22949 | * 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. |
| 22950 | * |
| 22951 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 22952 | */ |
| 22953 | g_signal_new ("handle-flash", |
| 22954 | G_TYPE_FROM_INTERFACE (iface), |
| 22955 | G_SIGNAL_RUN_LAST, |
| 22956 | G_STRUCT_OFFSET (FlashControlIface, handle_flash), |
| 22957 | g_signal_accumulator_true_handled, |
| 22958 | NULL, |
| 22959 | g_cclosure_marshal_generic, |
| 22960 | G_TYPE_BOOLEAN, |
| 22961 | 3, |
| 22962 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
| 22963 | |
| 22964 | /* GObject signals for received D-Bus signals: */ |
| 22965 | /** |
| 22966 | * FlashControl::done: |
| 22967 | * @object: A #FlashControl. |
| 22968 | * @arg_filename: Argument. |
| 22969 | * |
| 22970 | * 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. |
| 22971 | * |
| 22972 | * 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. |
| 22973 | */ |
| 22974 | g_signal_new ("done", |
| 22975 | G_TYPE_FROM_INTERFACE (iface), |
| 22976 | G_SIGNAL_RUN_LAST, |
| 22977 | G_STRUCT_OFFSET (FlashControlIface, done), |
| 22978 | NULL, |
| 22979 | NULL, |
| 22980 | g_cclosure_marshal_generic, |
| 22981 | G_TYPE_NONE, |
| 22982 | 1, G_TYPE_STRING); |
| 22983 | |
| 22984 | /** |
| 22985 | * FlashControl::error: |
| 22986 | * @object: A #FlashControl. |
| 22987 | * @arg_filename: Argument. |
| 22988 | * |
| 22989 | * 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. |
| 22990 | * |
| 22991 | * 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. |
| 22992 | */ |
| 22993 | g_signal_new ("error", |
| 22994 | G_TYPE_FROM_INTERFACE (iface), |
| 22995 | G_SIGNAL_RUN_LAST, |
| 22996 | G_STRUCT_OFFSET (FlashControlIface, error), |
| 22997 | NULL, |
| 22998 | NULL, |
| 22999 | g_cclosure_marshal_generic, |
| 23000 | G_TYPE_NONE, |
| 23001 | 1, G_TYPE_STRING); |
| 23002 | |
| 23003 | /** |
| 23004 | * FlashControl::progress: |
| 23005 | * @object: A #FlashControl. |
| 23006 | * @arg_filename: Argument. |
| 23007 | * @arg_progress: Argument. |
| 23008 | * |
| 23009 | * 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. |
| 23010 | * |
| 23011 | * 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. |
| 23012 | */ |
| 23013 | g_signal_new ("progress", |
| 23014 | G_TYPE_FROM_INTERFACE (iface), |
| 23015 | G_SIGNAL_RUN_LAST, |
| 23016 | G_STRUCT_OFFSET (FlashControlIface, progress), |
| 23017 | NULL, |
| 23018 | NULL, |
| 23019 | g_cclosure_marshal_generic, |
| 23020 | G_TYPE_NONE, |
| 23021 | 2, G_TYPE_STRING, G_TYPE_UCHAR); |
| 23022 | |
| 23023 | /* GObject properties for D-Bus properties: */ |
| 23024 | /** |
| 23025 | * FlashControl:filename: |
| 23026 | * |
| 23027 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>. |
| 23028 | * |
| 23029 | * 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. |
| 23030 | */ |
| 23031 | g_object_interface_install_property (iface, |
| 23032 | g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 23033 | /** |
| 23034 | * FlashControl:type: |
| 23035 | * |
| 23036 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>. |
| 23037 | * |
| 23038 | * 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. |
| 23039 | */ |
| 23040 | g_object_interface_install_property (iface, |
| 23041 | g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 23042 | } |
| 23043 | |
| 23044 | /** |
| 23045 | * flash_control_get_filename: (skip) |
| 23046 | * @object: A #FlashControl. |
| 23047 | * |
| 23048 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 23049 | * |
| 23050 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 23051 | * |
| 23052 | * <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> |
| 23053 | * |
| 23054 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 23055 | */ |
| 23056 | const gchar * |
| 23057 | flash_control_get_filename (FlashControl *object) |
| 23058 | { |
| 23059 | return FLASH_CONTROL_GET_IFACE (object)->get_filename (object); |
| 23060 | } |
| 23061 | |
| 23062 | /** |
| 23063 | * flash_control_dup_filename: (skip) |
| 23064 | * @object: A #FlashControl. |
| 23065 | * |
| 23066 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. |
| 23067 | * |
| 23068 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 23069 | * |
| 23070 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 23071 | */ |
| 23072 | gchar * |
| 23073 | flash_control_dup_filename (FlashControl *object) |
| 23074 | { |
| 23075 | gchar *value; |
| 23076 | g_object_get (G_OBJECT (object), "filename", &value, NULL); |
| 23077 | return value; |
| 23078 | } |
| 23079 | |
| 23080 | /** |
| 23081 | * flash_control_set_filename: (skip) |
| 23082 | * @object: A #FlashControl. |
| 23083 | * @value: The value to set. |
| 23084 | * |
| 23085 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value. |
| 23086 | * |
| 23087 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 23088 | */ |
| 23089 | void |
| 23090 | flash_control_set_filename (FlashControl *object, const gchar *value) |
| 23091 | { |
| 23092 | g_object_set (G_OBJECT (object), "filename", value, NULL); |
| 23093 | } |
| 23094 | |
| 23095 | /** |
| 23096 | * flash_control_get_type_: (skip) |
| 23097 | * @object: A #FlashControl. |
| 23098 | * |
| 23099 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 23100 | * |
| 23101 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 23102 | * |
| 23103 | * <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> |
| 23104 | * |
| 23105 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 23106 | */ |
| 23107 | const gchar * |
| 23108 | flash_control_get_type_ (FlashControl *object) |
| 23109 | { |
| 23110 | return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object); |
| 23111 | } |
| 23112 | |
| 23113 | /** |
| 23114 | * flash_control_dup_type_: (skip) |
| 23115 | * @object: A #FlashControl. |
| 23116 | * |
| 23117 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. |
| 23118 | * |
| 23119 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 23120 | * |
| 23121 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 23122 | */ |
| 23123 | gchar * |
| 23124 | flash_control_dup_type_ (FlashControl *object) |
| 23125 | { |
| 23126 | gchar *value; |
| 23127 | g_object_get (G_OBJECT (object), "type", &value, NULL); |
| 23128 | return value; |
| 23129 | } |
| 23130 | |
| 23131 | /** |
| 23132 | * flash_control_set_type_: (skip) |
| 23133 | * @object: A #FlashControl. |
| 23134 | * @value: The value to set. |
| 23135 | * |
| 23136 | * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value. |
| 23137 | * |
| 23138 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 23139 | */ |
| 23140 | void |
| 23141 | flash_control_set_type_ (FlashControl *object, const gchar *value) |
| 23142 | { |
| 23143 | g_object_set (G_OBJECT (object), "type", value, NULL); |
| 23144 | } |
| 23145 | |
| 23146 | /** |
| 23147 | * flash_control_emit_done: |
| 23148 | * @object: A #FlashControl. |
| 23149 | * @arg_filename: Argument to pass with the signal. |
| 23150 | * |
| 23151 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal. |
| 23152 | */ |
| 23153 | void |
| 23154 | flash_control_emit_done ( |
| 23155 | FlashControl *object, |
| 23156 | const gchar *arg_filename) |
| 23157 | { |
| 23158 | g_signal_emit_by_name (object, "done", arg_filename); |
| 23159 | } |
| 23160 | |
| 23161 | /** |
| 23162 | * flash_control_emit_error: |
| 23163 | * @object: A #FlashControl. |
| 23164 | * @arg_filename: Argument to pass with the signal. |
| 23165 | * |
| 23166 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal. |
| 23167 | */ |
| 23168 | void |
| 23169 | flash_control_emit_error ( |
| 23170 | FlashControl *object, |
| 23171 | const gchar *arg_filename) |
| 23172 | { |
| 23173 | g_signal_emit_by_name (object, "error", arg_filename); |
| 23174 | } |
| 23175 | |
| 23176 | /** |
| 23177 | * flash_control_emit_progress: |
| 23178 | * @object: A #FlashControl. |
| 23179 | * @arg_filename: Argument to pass with the signal. |
| 23180 | * @arg_progress: Argument to pass with the signal. |
| 23181 | * |
| 23182 | * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal. |
| 23183 | */ |
| 23184 | void |
| 23185 | flash_control_emit_progress ( |
| 23186 | FlashControl *object, |
| 23187 | const gchar *arg_filename, |
| 23188 | guchar arg_progress) |
| 23189 | { |
| 23190 | g_signal_emit_by_name (object, "progress", arg_filename, arg_progress); |
| 23191 | } |
| 23192 | |
| 23193 | /** |
| 23194 | * flash_control_call_flash: |
| 23195 | * @proxy: A #FlashControlProxy. |
| 23196 | * @arg_type: Argument to pass with the method invocation. |
| 23197 | * @arg_filename: Argument to pass with the method invocation. |
| 23198 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23199 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 23200 | * @user_data: User data to pass to @callback. |
| 23201 | * |
| 23202 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. |
| 23203 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 23204 | * You can then call flash_control_call_flash_finish() to get the result of the operation. |
| 23205 | * |
| 23206 | * See flash_control_call_flash_sync() for the synchronous, blocking version of this method. |
| 23207 | */ |
| 23208 | void |
| 23209 | flash_control_call_flash ( |
| 23210 | FlashControl *proxy, |
| 23211 | const gchar *arg_type, |
| 23212 | const gchar *arg_filename, |
| 23213 | GCancellable *cancellable, |
| 23214 | GAsyncReadyCallback callback, |
| 23215 | gpointer user_data) |
| 23216 | { |
| 23217 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 23218 | "flash", |
| 23219 | g_variant_new ("(ss)", |
| 23220 | arg_type, |
| 23221 | arg_filename), |
| 23222 | G_DBUS_CALL_FLAGS_NONE, |
| 23223 | -1, |
| 23224 | cancellable, |
| 23225 | callback, |
| 23226 | user_data); |
| 23227 | } |
| 23228 | |
| 23229 | /** |
| 23230 | * flash_control_call_flash_finish: |
| 23231 | * @proxy: A #FlashControlProxy. |
| 23232 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash(). |
| 23233 | * @error: Return location for error or %NULL. |
| 23234 | * |
| 23235 | * Finishes an operation started with flash_control_call_flash(). |
| 23236 | * |
| 23237 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23238 | */ |
| 23239 | gboolean |
| 23240 | flash_control_call_flash_finish ( |
| 23241 | FlashControl *proxy, |
| 23242 | GAsyncResult *res, |
| 23243 | GError **error) |
| 23244 | { |
| 23245 | GVariant *_ret; |
| 23246 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 23247 | if (_ret == NULL) |
| 23248 | goto _out; |
| 23249 | g_variant_get (_ret, |
| 23250 | "()"); |
| 23251 | g_variant_unref (_ret); |
| 23252 | _out: |
| 23253 | return _ret != NULL; |
| 23254 | } |
| 23255 | |
| 23256 | /** |
| 23257 | * flash_control_call_flash_sync: |
| 23258 | * @proxy: A #FlashControlProxy. |
| 23259 | * @arg_type: Argument to pass with the method invocation. |
| 23260 | * @arg_filename: Argument to pass with the method invocation. |
| 23261 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23262 | * @error: Return location for error or %NULL. |
| 23263 | * |
| 23264 | * 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. |
| 23265 | * |
| 23266 | * See flash_control_call_flash() for the asynchronous version of this method. |
| 23267 | * |
| 23268 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 23269 | */ |
| 23270 | gboolean |
| 23271 | flash_control_call_flash_sync ( |
| 23272 | FlashControl *proxy, |
| 23273 | const gchar *arg_type, |
| 23274 | const gchar *arg_filename, |
| 23275 | GCancellable *cancellable, |
| 23276 | GError **error) |
| 23277 | { |
| 23278 | GVariant *_ret; |
| 23279 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 23280 | "flash", |
| 23281 | g_variant_new ("(ss)", |
| 23282 | arg_type, |
| 23283 | arg_filename), |
| 23284 | G_DBUS_CALL_FLAGS_NONE, |
| 23285 | -1, |
| 23286 | cancellable, |
| 23287 | error); |
| 23288 | if (_ret == NULL) |
| 23289 | goto _out; |
| 23290 | g_variant_get (_ret, |
| 23291 | "()"); |
| 23292 | g_variant_unref (_ret); |
| 23293 | _out: |
| 23294 | return _ret != NULL; |
| 23295 | } |
| 23296 | |
| 23297 | /** |
| 23298 | * flash_control_complete_flash: |
| 23299 | * @object: A #FlashControl. |
| 23300 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 23301 | * |
| 23302 | * 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. |
| 23303 | * |
| 23304 | * This method will free @invocation, you cannot use it afterwards. |
| 23305 | */ |
| 23306 | void |
| 23307 | flash_control_complete_flash ( |
| 23308 | FlashControl *object, |
| 23309 | GDBusMethodInvocation *invocation) |
| 23310 | { |
| 23311 | g_dbus_method_invocation_return_value (invocation, |
| 23312 | g_variant_new ("()")); |
| 23313 | } |
| 23314 | |
| 23315 | /* ------------------------------------------------------------------------ */ |
| 23316 | |
| 23317 | /** |
| 23318 | * FlashControlProxy: |
| 23319 | * |
| 23320 | * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API. |
| 23321 | */ |
| 23322 | |
| 23323 | /** |
| 23324 | * FlashControlProxyClass: |
| 23325 | * @parent_class: The parent class. |
| 23326 | * |
| 23327 | * Class structure for #FlashControlProxy. |
| 23328 | */ |
| 23329 | |
| 23330 | struct _FlashControlProxyPrivate |
| 23331 | { |
| 23332 | GData *qdata; |
| 23333 | }; |
| 23334 | |
| 23335 | static void flash_control_proxy_iface_init (FlashControlIface *iface); |
| 23336 | |
| 23337 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23338 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 23339 | G_ADD_PRIVATE (FlashControlProxy) |
| 23340 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 23341 | |
| 23342 | #else |
| 23343 | G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, |
| 23344 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); |
| 23345 | |
| 23346 | #endif |
| 23347 | static void |
| 23348 | flash_control_proxy_finalize (GObject *object) |
| 23349 | { |
| 23350 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 23351 | g_datalist_clear (&proxy->priv->qdata); |
| 23352 | G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object); |
| 23353 | } |
| 23354 | |
| 23355 | static void |
| 23356 | flash_control_proxy_get_property (GObject *object, |
| 23357 | guint prop_id, |
| 23358 | GValue *value, |
| 23359 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23360 | { |
| 23361 | const _ExtendedGDBusPropertyInfo *info; |
| 23362 | GVariant *variant; |
| 23363 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 23364 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 23365 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 23366 | if (info->use_gvariant) |
| 23367 | { |
| 23368 | g_value_set_variant (value, variant); |
| 23369 | } |
| 23370 | else |
| 23371 | { |
| 23372 | if (variant != NULL) |
| 23373 | g_dbus_gvariant_to_gvalue (variant, value); |
| 23374 | } |
| 23375 | if (variant != NULL) |
| 23376 | g_variant_unref (variant); |
| 23377 | } |
| 23378 | |
| 23379 | static void |
| 23380 | flash_control_proxy_set_property_cb (GDBusProxy *proxy, |
| 23381 | GAsyncResult *res, |
| 23382 | gpointer user_data) |
| 23383 | { |
| 23384 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 23385 | GError *error; |
| 23386 | GVariant *_ret; |
| 23387 | error = NULL; |
| 23388 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 23389 | if (!_ret) |
| 23390 | { |
| 23391 | g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)", |
| 23392 | info->parent_struct.name, |
| 23393 | error->message, g_quark_to_string (error->domain), error->code); |
| 23394 | g_error_free (error); |
| 23395 | } |
| 23396 | else |
| 23397 | { |
| 23398 | g_variant_unref (_ret); |
| 23399 | } |
| 23400 | } |
| 23401 | |
| 23402 | static void |
| 23403 | flash_control_proxy_set_property (GObject *object, |
| 23404 | guint prop_id, |
| 23405 | const GValue *value, |
| 23406 | GParamSpec *pspec G_GNUC_UNUSED) |
| 23407 | { |
| 23408 | const _ExtendedGDBusPropertyInfo *info; |
| 23409 | GVariant *variant; |
| 23410 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 23411 | info = _flash_control_property_info_pointers[prop_id - 1]; |
| 23412 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 23413 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 23414 | "org.freedesktop.DBus.Properties.Set", |
| 23415 | g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant), |
| 23416 | G_DBUS_CALL_FLAGS_NONE, |
| 23417 | -1, |
| 23418 | NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 23419 | g_variant_unref (variant); |
| 23420 | } |
| 23421 | |
| 23422 | static void |
| 23423 | flash_control_proxy_g_signal (GDBusProxy *proxy, |
| 23424 | const gchar *sender_name G_GNUC_UNUSED, |
| 23425 | const gchar *signal_name, |
| 23426 | GVariant *parameters) |
| 23427 | { |
| 23428 | _ExtendedGDBusSignalInfo *info; |
| 23429 | GVariantIter iter; |
| 23430 | GVariant *child; |
| 23431 | GValue *paramv; |
| 23432 | guint num_params; |
| 23433 | guint n; |
| 23434 | guint signal_id; |
| 23435 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name); |
| 23436 | if (info == NULL) |
| 23437 | return; |
| 23438 | num_params = g_variant_n_children (parameters); |
| 23439 | paramv = g_new0 (GValue, num_params + 1); |
| 23440 | g_value_init (¶mv[0], TYPE_FLASH_CONTROL); |
| 23441 | g_value_set_object (¶mv[0], proxy); |
| 23442 | g_variant_iter_init (&iter, parameters); |
| 23443 | n = 1; |
| 23444 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 23445 | { |
| 23446 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 23447 | if (arg_info->use_gvariant) |
| 23448 | { |
| 23449 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 23450 | g_value_set_variant (¶mv[n], child); |
| 23451 | n++; |
| 23452 | } |
| 23453 | else |
| 23454 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 23455 | g_variant_unref (child); |
| 23456 | } |
| 23457 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 23458 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 23459 | for (n = 0; n < num_params + 1; n++) |
| 23460 | g_value_unset (¶mv[n]); |
| 23461 | g_free (paramv); |
| 23462 | } |
| 23463 | |
| 23464 | static void |
| 23465 | flash_control_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 23466 | GVariant *changed_properties, |
| 23467 | const gchar *const *invalidated_properties) |
| 23468 | { |
| 23469 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy); |
| 23470 | guint n; |
| 23471 | const gchar *key; |
| 23472 | GVariantIter *iter; |
| 23473 | _ExtendedGDBusPropertyInfo *info; |
| 23474 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 23475 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 23476 | { |
| 23477 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key); |
| 23478 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 23479 | if (info != NULL) |
| 23480 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23481 | } |
| 23482 | g_variant_iter_free (iter); |
| 23483 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 23484 | { |
| 23485 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]); |
| 23486 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 23487 | if (info != NULL) |
| 23488 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 23489 | } |
| 23490 | } |
| 23491 | |
| 23492 | static const gchar * |
| 23493 | flash_control_proxy_get_filename (FlashControl *object) |
| 23494 | { |
| 23495 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 23496 | GVariant *variant; |
| 23497 | const gchar *value = NULL; |
| 23498 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); |
| 23499 | if (variant != NULL) |
| 23500 | { |
| 23501 | value = g_variant_get_string (variant, NULL); |
| 23502 | g_variant_unref (variant); |
| 23503 | } |
| 23504 | return value; |
| 23505 | } |
| 23506 | |
| 23507 | static const gchar * |
| 23508 | flash_control_proxy_get_type_ (FlashControl *object) |
| 23509 | { |
| 23510 | FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); |
| 23511 | GVariant *variant; |
| 23512 | const gchar *value = NULL; |
| 23513 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type"); |
| 23514 | if (variant != NULL) |
| 23515 | { |
| 23516 | value = g_variant_get_string (variant, NULL); |
| 23517 | g_variant_unref (variant); |
| 23518 | } |
| 23519 | return value; |
| 23520 | } |
| 23521 | |
| 23522 | static void |
| 23523 | flash_control_proxy_init (FlashControlProxy *proxy) |
| 23524 | { |
| 23525 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 23526 | proxy->priv = flash_control_proxy_get_instance_private (proxy); |
| 23527 | #else |
| 23528 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate); |
| 23529 | #endif |
| 23530 | |
| 23531 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ()); |
| 23532 | } |
| 23533 | |
| 23534 | static void |
| 23535 | flash_control_proxy_class_init (FlashControlProxyClass *klass) |
| 23536 | { |
| 23537 | GObjectClass *gobject_class; |
| 23538 | GDBusProxyClass *proxy_class; |
| 23539 | |
| 23540 | gobject_class = G_OBJECT_CLASS (klass); |
| 23541 | gobject_class->finalize = flash_control_proxy_finalize; |
| 23542 | gobject_class->get_property = flash_control_proxy_get_property; |
| 23543 | gobject_class->set_property = flash_control_proxy_set_property; |
| 23544 | |
| 23545 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 23546 | proxy_class->g_signal = flash_control_proxy_g_signal; |
| 23547 | proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed; |
| 23548 | |
| 23549 | flash_control_override_properties (gobject_class, 1); |
| 23550 | |
| 23551 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 23552 | g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate)); |
| 23553 | #endif |
| 23554 | } |
| 23555 | |
| 23556 | static void |
| 23557 | flash_control_proxy_iface_init (FlashControlIface *iface) |
| 23558 | { |
| 23559 | iface->get_filename = flash_control_proxy_get_filename; |
| 23560 | iface->get_type_ = flash_control_proxy_get_type_; |
| 23561 | } |
| 23562 | |
| 23563 | /** |
| 23564 | * flash_control_proxy_new: |
| 23565 | * @connection: A #GDBusConnection. |
| 23566 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23567 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23568 | * @object_path: An object path. |
| 23569 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23570 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23571 | * @user_data: User data to pass to @callback. |
| 23572 | * |
| 23573 | * 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. |
| 23574 | * |
| 23575 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 23576 | * You can then call flash_control_proxy_new_finish() to get the result of the operation. |
| 23577 | * |
| 23578 | * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 23579 | */ |
| 23580 | void |
| 23581 | flash_control_proxy_new ( |
| 23582 | GDBusConnection *connection, |
| 23583 | GDBusProxyFlags flags, |
| 23584 | const gchar *name, |
| 23585 | const gchar *object_path, |
| 23586 | GCancellable *cancellable, |
| 23587 | GAsyncReadyCallback callback, |
| 23588 | gpointer user_data) |
| 23589 | { |
| 23590 | 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); |
| 23591 | } |
| 23592 | |
| 23593 | /** |
| 23594 | * flash_control_proxy_new_finish: |
| 23595 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new(). |
| 23596 | * @error: Return location for error or %NULL |
| 23597 | * |
| 23598 | * Finishes an operation started with flash_control_proxy_new(). |
| 23599 | * |
| 23600 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 23601 | */ |
| 23602 | FlashControl * |
| 23603 | flash_control_proxy_new_finish ( |
| 23604 | GAsyncResult *res, |
| 23605 | GError **error) |
| 23606 | { |
| 23607 | GObject *ret; |
| 23608 | GObject *source_object; |
| 23609 | source_object = g_async_result_get_source_object (res); |
| 23610 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23611 | g_object_unref (source_object); |
| 23612 | if (ret != NULL) |
| 23613 | return FLASH_CONTROL (ret); |
| 23614 | else |
| 23615 | return NULL; |
| 23616 | } |
| 23617 | |
| 23618 | /** |
| 23619 | * flash_control_proxy_new_sync: |
| 23620 | * @connection: A #GDBusConnection. |
| 23621 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23622 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 23623 | * @object_path: An object path. |
| 23624 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23625 | * @error: Return location for error or %NULL |
| 23626 | * |
| 23627 | * 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. |
| 23628 | * |
| 23629 | * The calling thread is blocked until a reply is received. |
| 23630 | * |
| 23631 | * See flash_control_proxy_new() for the asynchronous version of this constructor. |
| 23632 | * |
| 23633 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 23634 | */ |
| 23635 | FlashControl * |
| 23636 | flash_control_proxy_new_sync ( |
| 23637 | GDBusConnection *connection, |
| 23638 | GDBusProxyFlags flags, |
| 23639 | const gchar *name, |
| 23640 | const gchar *object_path, |
| 23641 | GCancellable *cancellable, |
| 23642 | GError **error) |
| 23643 | { |
| 23644 | GInitable *ret; |
| 23645 | 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); |
| 23646 | if (ret != NULL) |
| 23647 | return FLASH_CONTROL (ret); |
| 23648 | else |
| 23649 | return NULL; |
| 23650 | } |
| 23651 | |
| 23652 | |
| 23653 | /** |
| 23654 | * flash_control_proxy_new_for_bus: |
| 23655 | * @bus_type: A #GBusType. |
| 23656 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23657 | * @name: A bus name (well-known or unique). |
| 23658 | * @object_path: An object path. |
| 23659 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23660 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 23661 | * @user_data: User data to pass to @callback. |
| 23662 | * |
| 23663 | * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 23664 | * |
| 23665 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 23666 | * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation. |
| 23667 | * |
| 23668 | * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 23669 | */ |
| 23670 | void |
| 23671 | flash_control_proxy_new_for_bus ( |
| 23672 | GBusType bus_type, |
| 23673 | GDBusProxyFlags flags, |
| 23674 | const gchar *name, |
| 23675 | const gchar *object_path, |
| 23676 | GCancellable *cancellable, |
| 23677 | GAsyncReadyCallback callback, |
| 23678 | gpointer user_data) |
| 23679 | { |
| 23680 | 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); |
| 23681 | } |
| 23682 | |
| 23683 | /** |
| 23684 | * flash_control_proxy_new_for_bus_finish: |
| 23685 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus(). |
| 23686 | * @error: Return location for error or %NULL |
| 23687 | * |
| 23688 | * Finishes an operation started with flash_control_proxy_new_for_bus(). |
| 23689 | * |
| 23690 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 23691 | */ |
| 23692 | FlashControl * |
| 23693 | flash_control_proxy_new_for_bus_finish ( |
| 23694 | GAsyncResult *res, |
| 23695 | GError **error) |
| 23696 | { |
| 23697 | GObject *ret; |
| 23698 | GObject *source_object; |
| 23699 | source_object = g_async_result_get_source_object (res); |
| 23700 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 23701 | g_object_unref (source_object); |
| 23702 | if (ret != NULL) |
| 23703 | return FLASH_CONTROL (ret); |
| 23704 | else |
| 23705 | return NULL; |
| 23706 | } |
| 23707 | |
| 23708 | /** |
| 23709 | * flash_control_proxy_new_for_bus_sync: |
| 23710 | * @bus_type: A #GBusType. |
| 23711 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 23712 | * @name: A bus name (well-known or unique). |
| 23713 | * @object_path: An object path. |
| 23714 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 23715 | * @error: Return location for error or %NULL |
| 23716 | * |
| 23717 | * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 23718 | * |
| 23719 | * The calling thread is blocked until a reply is received. |
| 23720 | * |
| 23721 | * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 23722 | * |
| 23723 | * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. |
| 23724 | */ |
| 23725 | FlashControl * |
| 23726 | flash_control_proxy_new_for_bus_sync ( |
| 23727 | GBusType bus_type, |
| 23728 | GDBusProxyFlags flags, |
| 23729 | const gchar *name, |
| 23730 | const gchar *object_path, |
| 23731 | GCancellable *cancellable, |
| 23732 | GError **error) |
| 23733 | { |
| 23734 | GInitable *ret; |
| 23735 | 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); |
| 23736 | if (ret != NULL) |
| 23737 | return FLASH_CONTROL (ret); |
| 23738 | else |
| 23739 | return NULL; |
| 23740 | } |
| 23741 | |
| 23742 | |
| 23743 | /* ------------------------------------------------------------------------ */ |
| 23744 | |
| 23745 | /** |
| 23746 | * FlashControlSkeleton: |
| 23747 | * |
| 23748 | * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API. |
| 23749 | */ |
| 23750 | |
| 23751 | /** |
| 23752 | * FlashControlSkeletonClass: |
| 23753 | * @parent_class: The parent class. |
| 23754 | * |
| 23755 | * Class structure for #FlashControlSkeleton. |
| 23756 | */ |
| 23757 | |
| 23758 | struct _FlashControlSkeletonPrivate |
| 23759 | { |
| 23760 | GValue *properties; |
| 23761 | GList *changed_properties; |
| 23762 | GSource *changed_properties_idle_source; |
| 23763 | GMainContext *context; |
| 23764 | GMutex lock; |
| 23765 | }; |
| 23766 | |
| 23767 | static void |
| 23768 | _flash_control_skeleton_handle_method_call ( |
| 23769 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23770 | const gchar *sender G_GNUC_UNUSED, |
| 23771 | const gchar *object_path G_GNUC_UNUSED, |
| 23772 | const gchar *interface_name, |
| 23773 | const gchar *method_name, |
| 23774 | GVariant *parameters, |
| 23775 | GDBusMethodInvocation *invocation, |
| 23776 | gpointer user_data) |
| 23777 | { |
| 23778 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 23779 | _ExtendedGDBusMethodInfo *info; |
| 23780 | GVariantIter iter; |
| 23781 | GVariant *child; |
| 23782 | GValue *paramv; |
| 23783 | guint num_params; |
| 23784 | guint num_extra; |
| 23785 | guint n; |
| 23786 | guint signal_id; |
| 23787 | GValue return_value = G_VALUE_INIT; |
| 23788 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 23789 | g_assert (info != NULL); |
| 23790 | num_params = g_variant_n_children (parameters); |
| 23791 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 23792 | n = 0; |
| 23793 | g_value_init (¶mv[n], TYPE_FLASH_CONTROL); |
| 23794 | g_value_set_object (¶mv[n++], skeleton); |
| 23795 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 23796 | g_value_set_object (¶mv[n++], invocation); |
| 23797 | if (info->pass_fdlist) |
| 23798 | { |
| 23799 | #ifdef G_OS_UNIX |
| 23800 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 23801 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 23802 | #else |
| 23803 | g_assert_not_reached (); |
| 23804 | #endif |
| 23805 | } |
| 23806 | g_variant_iter_init (&iter, parameters); |
| 23807 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 23808 | { |
| 23809 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 23810 | if (arg_info->use_gvariant) |
| 23811 | { |
| 23812 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 23813 | g_value_set_variant (¶mv[n], child); |
| 23814 | n++; |
| 23815 | } |
| 23816 | else |
| 23817 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 23818 | g_variant_unref (child); |
| 23819 | } |
| 23820 | signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); |
| 23821 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 23822 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 23823 | if (!g_value_get_boolean (&return_value)) |
| 23824 | 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); |
| 23825 | g_value_unset (&return_value); |
| 23826 | for (n = 0; n < num_params + num_extra; n++) |
| 23827 | g_value_unset (¶mv[n]); |
| 23828 | g_free (paramv); |
| 23829 | } |
| 23830 | |
| 23831 | static GVariant * |
| 23832 | _flash_control_skeleton_handle_get_property ( |
| 23833 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23834 | const gchar *sender G_GNUC_UNUSED, |
| 23835 | const gchar *object_path G_GNUC_UNUSED, |
| 23836 | const gchar *interface_name G_GNUC_UNUSED, |
| 23837 | const gchar *property_name, |
| 23838 | GError **error, |
| 23839 | gpointer user_data) |
| 23840 | { |
| 23841 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 23842 | GValue value = G_VALUE_INIT; |
| 23843 | GParamSpec *pspec; |
| 23844 | _ExtendedGDBusPropertyInfo *info; |
| 23845 | GVariant *ret; |
| 23846 | ret = NULL; |
| 23847 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 23848 | g_assert (info != NULL); |
| 23849 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23850 | if (pspec == NULL) |
| 23851 | { |
| 23852 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23853 | } |
| 23854 | else |
| 23855 | { |
| 23856 | g_value_init (&value, pspec->value_type); |
| 23857 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23858 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 23859 | g_value_unset (&value); |
| 23860 | } |
| 23861 | return ret; |
| 23862 | } |
| 23863 | |
| 23864 | static gboolean |
| 23865 | _flash_control_skeleton_handle_set_property ( |
| 23866 | GDBusConnection *connection G_GNUC_UNUSED, |
| 23867 | const gchar *sender G_GNUC_UNUSED, |
| 23868 | const gchar *object_path G_GNUC_UNUSED, |
| 23869 | const gchar *interface_name G_GNUC_UNUSED, |
| 23870 | const gchar *property_name, |
| 23871 | GVariant *variant, |
| 23872 | GError **error, |
| 23873 | gpointer user_data) |
| 23874 | { |
| 23875 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 23876 | GValue value = G_VALUE_INIT; |
| 23877 | GParamSpec *pspec; |
| 23878 | _ExtendedGDBusPropertyInfo *info; |
| 23879 | gboolean ret; |
| 23880 | ret = FALSE; |
| 23881 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); |
| 23882 | g_assert (info != NULL); |
| 23883 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 23884 | if (pspec == NULL) |
| 23885 | { |
| 23886 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 23887 | } |
| 23888 | else |
| 23889 | { |
| 23890 | if (info->use_gvariant) |
| 23891 | g_value_set_variant (&value, variant); |
| 23892 | else |
| 23893 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 23894 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 23895 | g_value_unset (&value); |
| 23896 | ret = TRUE; |
| 23897 | } |
| 23898 | return ret; |
| 23899 | } |
| 23900 | |
| 23901 | static const GDBusInterfaceVTable _flash_control_skeleton_vtable = |
| 23902 | { |
| 23903 | _flash_control_skeleton_handle_method_call, |
| 23904 | _flash_control_skeleton_handle_get_property, |
| 23905 | _flash_control_skeleton_handle_set_property, |
| 23906 | {NULL} |
| 23907 | }; |
| 23908 | |
| 23909 | static GDBusInterfaceInfo * |
| 23910 | flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23911 | { |
| 23912 | return flash_control_interface_info (); |
| 23913 | } |
| 23914 | |
| 23915 | static GDBusInterfaceVTable * |
| 23916 | flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 23917 | { |
| 23918 | return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable; |
| 23919 | } |
| 23920 | |
| 23921 | static GVariant * |
| 23922 | flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 23923 | { |
| 23924 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 23925 | |
| 23926 | GVariantBuilder builder; |
| 23927 | guint n; |
| 23928 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 23929 | if (_flash_control_interface_info.parent_struct.properties == NULL) |
| 23930 | goto out; |
| 23931 | for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++) |
| 23932 | { |
| 23933 | GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n]; |
| 23934 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 23935 | { |
| 23936 | GVariant *value; |
| 23937 | 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); |
| 23938 | if (value != NULL) |
| 23939 | { |
| 23940 | g_variant_take_ref (value); |
| 23941 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 23942 | g_variant_unref (value); |
| 23943 | } |
| 23944 | } |
| 23945 | } |
| 23946 | out: |
| 23947 | return g_variant_builder_end (&builder); |
| 23948 | } |
| 23949 | |
| 23950 | static gboolean _flash_control_emit_changed (gpointer user_data); |
| 23951 | |
| 23952 | static void |
| 23953 | flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 23954 | { |
| 23955 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); |
| 23956 | gboolean emit_changed = FALSE; |
| 23957 | |
| 23958 | g_mutex_lock (&skeleton->priv->lock); |
| 23959 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 23960 | { |
| 23961 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 23962 | skeleton->priv->changed_properties_idle_source = NULL; |
| 23963 | emit_changed = TRUE; |
| 23964 | } |
| 23965 | g_mutex_unlock (&skeleton->priv->lock); |
| 23966 | |
| 23967 | if (emit_changed) |
| 23968 | _flash_control_emit_changed (skeleton); |
| 23969 | } |
| 23970 | |
| 23971 | static void |
| 23972 | _flash_control_on_signal_done ( |
| 23973 | FlashControl *object, |
| 23974 | const gchar *arg_filename) |
| 23975 | { |
| 23976 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 23977 | |
| 23978 | GList *connections, *l; |
| 23979 | GVariant *signal_variant; |
| 23980 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 23981 | |
| 23982 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 23983 | arg_filename)); |
| 23984 | for (l = connections; l != NULL; l = l->next) |
| 23985 | { |
| 23986 | GDBusConnection *connection = l->data; |
| 23987 | g_dbus_connection_emit_signal (connection, |
| 23988 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done", |
| 23989 | signal_variant, NULL); |
| 23990 | } |
| 23991 | g_variant_unref (signal_variant); |
| 23992 | g_list_free_full (connections, g_object_unref); |
| 23993 | } |
| 23994 | |
| 23995 | static void |
| 23996 | _flash_control_on_signal_error ( |
| 23997 | FlashControl *object, |
| 23998 | const gchar *arg_filename) |
| 23999 | { |
| 24000 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24001 | |
| 24002 | GList *connections, *l; |
| 24003 | GVariant *signal_variant; |
| 24004 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 24005 | |
| 24006 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 24007 | arg_filename)); |
| 24008 | for (l = connections; l != NULL; l = l->next) |
| 24009 | { |
| 24010 | GDBusConnection *connection = l->data; |
| 24011 | g_dbus_connection_emit_signal (connection, |
| 24012 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error", |
| 24013 | signal_variant, NULL); |
| 24014 | } |
| 24015 | g_variant_unref (signal_variant); |
| 24016 | g_list_free_full (connections, g_object_unref); |
| 24017 | } |
| 24018 | |
| 24019 | static void |
| 24020 | _flash_control_on_signal_progress ( |
| 24021 | FlashControl *object, |
| 24022 | const gchar *arg_filename, |
| 24023 | guchar arg_progress) |
| 24024 | { |
| 24025 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24026 | |
| 24027 | GList *connections, *l; |
| 24028 | GVariant *signal_variant; |
| 24029 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 24030 | |
| 24031 | signal_variant = g_variant_ref_sink (g_variant_new ("(sy)", |
| 24032 | arg_filename, |
| 24033 | arg_progress)); |
| 24034 | for (l = connections; l != NULL; l = l->next) |
| 24035 | { |
| 24036 | GDBusConnection *connection = l->data; |
| 24037 | g_dbus_connection_emit_signal (connection, |
| 24038 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress", |
| 24039 | signal_variant, NULL); |
| 24040 | } |
| 24041 | g_variant_unref (signal_variant); |
| 24042 | g_list_free_full (connections, g_object_unref); |
| 24043 | } |
| 24044 | |
| 24045 | static void flash_control_skeleton_iface_init (FlashControlIface *iface); |
| 24046 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 24047 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 24048 | G_ADD_PRIVATE (FlashControlSkeleton) |
| 24049 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 24050 | |
| 24051 | #else |
| 24052 | G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 24053 | G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); |
| 24054 | |
| 24055 | #endif |
| 24056 | static void |
| 24057 | flash_control_skeleton_finalize (GObject *object) |
| 24058 | { |
| 24059 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24060 | guint n; |
| 24061 | for (n = 0; n < 2; n++) |
| 24062 | g_value_unset (&skeleton->priv->properties[n]); |
| 24063 | g_free (skeleton->priv->properties); |
| 24064 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 24065 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 24066 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 24067 | g_main_context_unref (skeleton->priv->context); |
| 24068 | g_mutex_clear (&skeleton->priv->lock); |
| 24069 | G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object); |
| 24070 | } |
| 24071 | |
| 24072 | static void |
| 24073 | flash_control_skeleton_get_property (GObject *object, |
| 24074 | guint prop_id, |
| 24075 | GValue *value, |
| 24076 | GParamSpec *pspec G_GNUC_UNUSED) |
| 24077 | { |
| 24078 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24079 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 24080 | g_mutex_lock (&skeleton->priv->lock); |
| 24081 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 24082 | g_mutex_unlock (&skeleton->priv->lock); |
| 24083 | } |
| 24084 | |
| 24085 | static gboolean |
| 24086 | _flash_control_emit_changed (gpointer user_data) |
| 24087 | { |
| 24088 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); |
| 24089 | GList *l; |
| 24090 | GVariantBuilder builder; |
| 24091 | GVariantBuilder invalidated_builder; |
| 24092 | guint num_changes; |
| 24093 | |
| 24094 | g_mutex_lock (&skeleton->priv->lock); |
| 24095 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 24096 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 24097 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 24098 | { |
| 24099 | ChangedProperty *cp = l->data; |
| 24100 | GVariant *variant; |
| 24101 | const GValue *cur_value; |
| 24102 | |
| 24103 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 24104 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 24105 | { |
| 24106 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 24107 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 24108 | g_variant_unref (variant); |
| 24109 | num_changes++; |
| 24110 | } |
| 24111 | } |
| 24112 | if (num_changes > 0) |
| 24113 | { |
| 24114 | GList *connections, *ll; |
| 24115 | GVariant *signal_variant; |
| 24116 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl", |
| 24117 | &builder, &invalidated_builder)); |
| 24118 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 24119 | for (ll = connections; ll != NULL; ll = ll->next) |
| 24120 | { |
| 24121 | GDBusConnection *connection = ll->data; |
| 24122 | |
| 24123 | g_dbus_connection_emit_signal (connection, |
| 24124 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 24125 | "org.freedesktop.DBus.Properties", |
| 24126 | "PropertiesChanged", |
| 24127 | signal_variant, |
| 24128 | NULL); |
| 24129 | } |
| 24130 | g_variant_unref (signal_variant); |
| 24131 | g_list_free_full (connections, g_object_unref); |
| 24132 | } |
| 24133 | else |
| 24134 | { |
| 24135 | g_variant_builder_clear (&builder); |
| 24136 | g_variant_builder_clear (&invalidated_builder); |
| 24137 | } |
| 24138 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 24139 | skeleton->priv->changed_properties = NULL; |
| 24140 | skeleton->priv->changed_properties_idle_source = NULL; |
| 24141 | g_mutex_unlock (&skeleton->priv->lock); |
| 24142 | return FALSE; |
| 24143 | } |
| 24144 | |
| 24145 | static void |
| 24146 | _flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 24147 | { |
| 24148 | ChangedProperty *cp; |
| 24149 | GList *l; |
| 24150 | cp = NULL; |
| 24151 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 24152 | { |
| 24153 | ChangedProperty *i_cp = l->data; |
| 24154 | if (i_cp->info == info) |
| 24155 | { |
| 24156 | cp = i_cp; |
| 24157 | break; |
| 24158 | } |
| 24159 | } |
| 24160 | if (cp == NULL) |
| 24161 | { |
| 24162 | cp = g_new0 (ChangedProperty, 1); |
| 24163 | cp->prop_id = prop_id; |
| 24164 | cp->info = info; |
| 24165 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 24166 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 24167 | g_value_copy (orig_value, &cp->orig_value); |
| 24168 | } |
| 24169 | } |
| 24170 | |
| 24171 | static void |
| 24172 | flash_control_skeleton_notify (GObject *object, |
| 24173 | GParamSpec *pspec G_GNUC_UNUSED) |
| 24174 | { |
| 24175 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24176 | g_mutex_lock (&skeleton->priv->lock); |
| 24177 | if (skeleton->priv->changed_properties != NULL && |
| 24178 | skeleton->priv->changed_properties_idle_source == NULL) |
| 24179 | { |
| 24180 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 24181 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 24182 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 24183 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 24184 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 24185 | } |
| 24186 | g_mutex_unlock (&skeleton->priv->lock); |
| 24187 | } |
| 24188 | |
| 24189 | static void |
| 24190 | flash_control_skeleton_set_property (GObject *object, |
| 24191 | guint prop_id, |
| 24192 | const GValue *value, |
| 24193 | GParamSpec *pspec) |
| 24194 | { |
| 24195 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24196 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 24197 | g_mutex_lock (&skeleton->priv->lock); |
| 24198 | g_object_freeze_notify (object); |
| 24199 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 24200 | { |
| 24201 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 24202 | _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 24203 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 24204 | g_object_notify_by_pspec (object, pspec); |
| 24205 | } |
| 24206 | g_mutex_unlock (&skeleton->priv->lock); |
| 24207 | g_object_thaw_notify (object); |
| 24208 | } |
| 24209 | |
| 24210 | static void |
| 24211 | flash_control_skeleton_init (FlashControlSkeleton *skeleton) |
| 24212 | { |
| 24213 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 24214 | skeleton->priv = flash_control_skeleton_get_instance_private (skeleton); |
| 24215 | #else |
| 24216 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate); |
| 24217 | #endif |
| 24218 | |
| 24219 | g_mutex_init (&skeleton->priv->lock); |
| 24220 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 24221 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 24222 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 24223 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 24224 | } |
| 24225 | |
| 24226 | static const gchar * |
| 24227 | flash_control_skeleton_get_filename (FlashControl *object) |
| 24228 | { |
| 24229 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24230 | const gchar *value; |
| 24231 | g_mutex_lock (&skeleton->priv->lock); |
| 24232 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 24233 | g_mutex_unlock (&skeleton->priv->lock); |
| 24234 | return value; |
| 24235 | } |
| 24236 | |
| 24237 | static const gchar * |
| 24238 | flash_control_skeleton_get_type_ (FlashControl *object) |
| 24239 | { |
| 24240 | FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); |
| 24241 | const gchar *value; |
| 24242 | g_mutex_lock (&skeleton->priv->lock); |
| 24243 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 24244 | g_mutex_unlock (&skeleton->priv->lock); |
| 24245 | return value; |
| 24246 | } |
| 24247 | |
| 24248 | static void |
| 24249 | flash_control_skeleton_class_init (FlashControlSkeletonClass *klass) |
| 24250 | { |
| 24251 | GObjectClass *gobject_class; |
| 24252 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 24253 | |
| 24254 | gobject_class = G_OBJECT_CLASS (klass); |
| 24255 | gobject_class->finalize = flash_control_skeleton_finalize; |
| 24256 | gobject_class->get_property = flash_control_skeleton_get_property; |
| 24257 | gobject_class->set_property = flash_control_skeleton_set_property; |
| 24258 | gobject_class->notify = flash_control_skeleton_notify; |
| 24259 | |
| 24260 | |
| 24261 | flash_control_override_properties (gobject_class, 1); |
| 24262 | |
| 24263 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 24264 | skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info; |
| 24265 | skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties; |
| 24266 | skeleton_class->flush = flash_control_skeleton_dbus_interface_flush; |
| 24267 | skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable; |
| 24268 | |
| 24269 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 24270 | g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate)); |
| 24271 | #endif |
| 24272 | } |
| 24273 | |
| 24274 | static void |
| 24275 | flash_control_skeleton_iface_init (FlashControlIface *iface) |
| 24276 | { |
| 24277 | iface->done = _flash_control_on_signal_done; |
| 24278 | iface->error = _flash_control_on_signal_error; |
| 24279 | iface->progress = _flash_control_on_signal_progress; |
| 24280 | iface->get_filename = flash_control_skeleton_get_filename; |
| 24281 | iface->get_type_ = flash_control_skeleton_get_type_; |
| 24282 | } |
| 24283 | |
| 24284 | /** |
| 24285 | * flash_control_skeleton_new: |
| 24286 | * |
| 24287 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. |
| 24288 | * |
| 24289 | * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object. |
| 24290 | */ |
| 24291 | FlashControl * |
| 24292 | flash_control_skeleton_new (void) |
| 24293 | { |
| 24294 | return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL)); |
| 24295 | } |
| 24296 | |
| 24297 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24298 | * Code for interface org.openbmc.Button |
| 24299 | * ------------------------------------------------------------------------ |
| 24300 | */ |
| 24301 | |
| 24302 | /** |
| 24303 | * SECTION:Button |
| 24304 | * @title: Button |
| 24305 | * @short_description: Generated C code for the org.openbmc.Button D-Bus interface |
| 24306 | * |
| 24307 | * 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. |
| 24308 | */ |
| 24309 | |
| 24310 | /* ---- Introspection data for org.openbmc.Button ---- */ |
| 24311 | |
| 24312 | static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state = |
| 24313 | { |
| 24314 | { |
| 24315 | -1, |
| 24316 | (gchar *) "state", |
| 24317 | (gchar *) "b", |
| 24318 | NULL |
| 24319 | }, |
| 24320 | FALSE |
| 24321 | }; |
| 24322 | |
| 24323 | static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] = |
| 24324 | { |
| 24325 | &_button_method_info_is_on_OUT_ARG_state, |
| 24326 | NULL |
| 24327 | }; |
| 24328 | |
| 24329 | static const _ExtendedGDBusMethodInfo _button_method_info_is_on = |
| 24330 | { |
| 24331 | { |
| 24332 | -1, |
| 24333 | (gchar *) "isOn", |
| 24334 | NULL, |
| 24335 | (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers, |
| 24336 | NULL |
| 24337 | }, |
| 24338 | "handle-is-on", |
| 24339 | FALSE |
| 24340 | }; |
| 24341 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24342 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_press = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24343 | { |
| 24344 | { |
| 24345 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24346 | (gchar *) "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24347 | NULL, |
| 24348 | NULL, |
| 24349 | NULL |
| 24350 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24351 | "handle-sim-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24352 | FALSE |
| 24353 | }; |
| 24354 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24355 | static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24356 | { |
| 24357 | { |
| 24358 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24359 | (gchar *) "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24360 | NULL, |
| 24361 | NULL, |
| 24362 | NULL |
| 24363 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24364 | "handle-sim-long-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24365 | FALSE |
| 24366 | }; |
| 24367 | |
| 24368 | static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] = |
| 24369 | { |
| 24370 | &_button_method_info_is_on, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24371 | &_button_method_info_sim_press, |
| 24372 | &_button_method_info_sim_long_press, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24373 | NULL |
| 24374 | }; |
| 24375 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24376 | static const _ExtendedGDBusSignalInfo _button_signal_info_released = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24377 | { |
| 24378 | { |
| 24379 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24380 | (gchar *) "Released", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24381 | NULL, |
| 24382 | NULL |
| 24383 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24384 | "released" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24385 | }; |
| 24386 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24387 | static const _ExtendedGDBusSignalInfo _button_signal_info_pressed = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24388 | { |
| 24389 | { |
| 24390 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24391 | (gchar *) "Pressed", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24392 | NULL, |
| 24393 | NULL |
| 24394 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24395 | "pressed" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24396 | }; |
| 24397 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24398 | static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long = |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24399 | { |
| 24400 | { |
| 24401 | -1, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24402 | (gchar *) "PressedLong", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24403 | NULL, |
| 24404 | NULL |
| 24405 | }, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24406 | "pressed-long" |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24407 | }; |
| 24408 | |
| 24409 | static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] = |
| 24410 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24411 | &_button_signal_info_released, |
| 24412 | &_button_signal_info_pressed, |
| 24413 | &_button_signal_info_pressed_long, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24414 | NULL |
| 24415 | }; |
| 24416 | |
| 24417 | static const _ExtendedGDBusPropertyInfo _button_property_info_state = |
| 24418 | { |
| 24419 | { |
| 24420 | -1, |
| 24421 | (gchar *) "state", |
| 24422 | (gchar *) "b", |
| 24423 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24424 | NULL |
| 24425 | }, |
| 24426 | "state", |
| 24427 | FALSE |
| 24428 | }; |
| 24429 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24430 | static const _ExtendedGDBusPropertyInfo _button_property_info_timer = |
| 24431 | { |
| 24432 | { |
| 24433 | -1, |
| 24434 | (gchar *) "timer", |
| 24435 | (gchar *) "t", |
| 24436 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 24437 | NULL |
| 24438 | }, |
| 24439 | "timer", |
| 24440 | FALSE |
| 24441 | }; |
| 24442 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24443 | static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] = |
| 24444 | { |
| 24445 | &_button_property_info_state, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24446 | &_button_property_info_timer, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24447 | NULL |
| 24448 | }; |
| 24449 | |
| 24450 | static const _ExtendedGDBusInterfaceInfo _button_interface_info = |
| 24451 | { |
| 24452 | { |
| 24453 | -1, |
| 24454 | (gchar *) "org.openbmc.Button", |
| 24455 | (GDBusMethodInfo **) &_button_method_info_pointers, |
| 24456 | (GDBusSignalInfo **) &_button_signal_info_pointers, |
| 24457 | (GDBusPropertyInfo **) &_button_property_info_pointers, |
| 24458 | NULL |
| 24459 | }, |
| 24460 | "button", |
| 24461 | }; |
| 24462 | |
| 24463 | |
| 24464 | /** |
| 24465 | * button_interface_info: |
| 24466 | * |
| 24467 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface. |
| 24468 | * |
| 24469 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 24470 | */ |
| 24471 | GDBusInterfaceInfo * |
| 24472 | button_interface_info (void) |
| 24473 | { |
| 24474 | return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct; |
| 24475 | } |
| 24476 | |
| 24477 | /** |
| 24478 | * button_override_properties: |
| 24479 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 24480 | * @property_id_begin: The property id to assign to the first overridden property. |
| 24481 | * |
| 24482 | * Overrides all #GObject properties in the #Button interface for a concrete class. |
| 24483 | * The properties are overridden in the order they are defined. |
| 24484 | * |
| 24485 | * Returns: The last property id. |
| 24486 | */ |
| 24487 | guint |
| 24488 | button_override_properties (GObjectClass *klass, guint property_id_begin) |
| 24489 | { |
| 24490 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24491 | g_object_class_override_property (klass, property_id_begin++, "timer"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24492 | return property_id_begin - 1; |
| 24493 | } |
| 24494 | |
| 24495 | |
| 24496 | |
| 24497 | /** |
| 24498 | * Button: |
| 24499 | * |
| 24500 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 24501 | */ |
| 24502 | |
| 24503 | /** |
| 24504 | * ButtonIface: |
| 24505 | * @parent_iface: The parent interface. |
| 24506 | * @handle_is_on: Handler for the #Button::handle-is-on signal. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24507 | * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal. |
| 24508 | * @handle_sim_press: Handler for the #Button::handle-sim-press signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24509 | * @get_state: Getter for the #Button:state property. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24510 | * @get_timer: Getter for the #Button:timer property. |
| 24511 | * @pressed: Handler for the #Button::pressed signal. |
| 24512 | * @pressed_long: Handler for the #Button::pressed-long signal. |
| 24513 | * @released: Handler for the #Button::released signal. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24514 | * |
| 24515 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 24516 | */ |
| 24517 | |
| 24518 | typedef ButtonIface ButtonInterface; |
| 24519 | G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT); |
| 24520 | |
| 24521 | static void |
| 24522 | button_default_init (ButtonIface *iface) |
| 24523 | { |
| 24524 | /* GObject signals for incoming D-Bus method calls: */ |
| 24525 | /** |
| 24526 | * Button::handle-is-on: |
| 24527 | * @object: A #Button. |
| 24528 | * @invocation: A #GDBusMethodInvocation. |
| 24529 | * |
| 24530 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. |
| 24531 | * |
| 24532 | * 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. |
| 24533 | * |
| 24534 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24535 | */ |
| 24536 | g_signal_new ("handle-is-on", |
| 24537 | G_TYPE_FROM_INTERFACE (iface), |
| 24538 | G_SIGNAL_RUN_LAST, |
| 24539 | G_STRUCT_OFFSET (ButtonIface, handle_is_on), |
| 24540 | g_signal_accumulator_true_handled, |
| 24541 | NULL, |
| 24542 | g_cclosure_marshal_generic, |
| 24543 | G_TYPE_BOOLEAN, |
| 24544 | 1, |
| 24545 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24546 | |
| 24547 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24548 | * Button::handle-sim-press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24549 | * @object: A #Button. |
| 24550 | * @invocation: A #GDBusMethodInvocation. |
| 24551 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24552 | * 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] | 24553 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24554 | * 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] | 24555 | * |
| 24556 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24557 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24558 | g_signal_new ("handle-sim-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24559 | G_TYPE_FROM_INTERFACE (iface), |
| 24560 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24561 | G_STRUCT_OFFSET (ButtonIface, handle_sim_press), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24562 | g_signal_accumulator_true_handled, |
| 24563 | NULL, |
| 24564 | g_cclosure_marshal_generic, |
| 24565 | G_TYPE_BOOLEAN, |
| 24566 | 1, |
| 24567 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24568 | |
| 24569 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24570 | * Button::handle-sim-long-press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24571 | * @object: A #Button. |
| 24572 | * @invocation: A #GDBusMethodInvocation. |
| 24573 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24574 | * 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] | 24575 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24576 | * 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] | 24577 | * |
| 24578 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 24579 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24580 | g_signal_new ("handle-sim-long-press", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24581 | G_TYPE_FROM_INTERFACE (iface), |
| 24582 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24583 | G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24584 | g_signal_accumulator_true_handled, |
| 24585 | NULL, |
| 24586 | g_cclosure_marshal_generic, |
| 24587 | G_TYPE_BOOLEAN, |
| 24588 | 1, |
| 24589 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 24590 | |
| 24591 | /* GObject signals for received D-Bus signals: */ |
| 24592 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24593 | * Button::released: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24594 | * @object: A #Button. |
| 24595 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24596 | * 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] | 24597 | * |
| 24598 | * 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. |
| 24599 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24600 | g_signal_new ("released", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24601 | G_TYPE_FROM_INTERFACE (iface), |
| 24602 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24603 | G_STRUCT_OFFSET (ButtonIface, released), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24604 | NULL, |
| 24605 | NULL, |
| 24606 | g_cclosure_marshal_generic, |
| 24607 | G_TYPE_NONE, |
| 24608 | 0); |
| 24609 | |
| 24610 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24611 | * Button::pressed: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24612 | * @object: A #Button. |
| 24613 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24614 | * 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] | 24615 | * |
| 24616 | * 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. |
| 24617 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24618 | g_signal_new ("pressed", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24619 | G_TYPE_FROM_INTERFACE (iface), |
| 24620 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24621 | G_STRUCT_OFFSET (ButtonIface, pressed), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24622 | NULL, |
| 24623 | NULL, |
| 24624 | g_cclosure_marshal_generic, |
| 24625 | G_TYPE_NONE, |
| 24626 | 0); |
| 24627 | |
| 24628 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24629 | * Button::pressed-long: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24630 | * @object: A #Button. |
| 24631 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24632 | * 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] | 24633 | * |
| 24634 | * 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. |
| 24635 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24636 | g_signal_new ("pressed-long", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24637 | G_TYPE_FROM_INTERFACE (iface), |
| 24638 | G_SIGNAL_RUN_LAST, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24639 | G_STRUCT_OFFSET (ButtonIface, pressed_long), |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24640 | NULL, |
| 24641 | NULL, |
| 24642 | g_cclosure_marshal_generic, |
| 24643 | G_TYPE_NONE, |
| 24644 | 0); |
| 24645 | |
| 24646 | /* GObject properties for D-Bus properties: */ |
| 24647 | /** |
| 24648 | * Button:state: |
| 24649 | * |
| 24650 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>. |
| 24651 | * |
| 24652 | * 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. |
| 24653 | */ |
| 24654 | g_object_interface_install_property (iface, |
| 24655 | 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] | 24656 | /** |
| 24657 | * Button:timer: |
| 24658 | * |
| 24659 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>. |
| 24660 | * |
| 24661 | * 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. |
| 24662 | */ |
| 24663 | g_object_interface_install_property (iface, |
| 24664 | 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] | 24665 | } |
| 24666 | |
| 24667 | /** |
| 24668 | * button_get_state: (skip) |
| 24669 | * @object: A #Button. |
| 24670 | * |
| 24671 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property. |
| 24672 | * |
| 24673 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24674 | * |
| 24675 | * Returns: The property value. |
| 24676 | */ |
| 24677 | gboolean |
| 24678 | button_get_state (Button *object) |
| 24679 | { |
| 24680 | return BUTTON_GET_IFACE (object)->get_state (object); |
| 24681 | } |
| 24682 | |
| 24683 | /** |
| 24684 | * button_set_state: (skip) |
| 24685 | * @object: A #Button. |
| 24686 | * @value: The value to set. |
| 24687 | * |
| 24688 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value. |
| 24689 | * |
| 24690 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 24691 | */ |
| 24692 | void |
| 24693 | button_set_state (Button *object, gboolean value) |
| 24694 | { |
| 24695 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 24696 | } |
| 24697 | |
| 24698 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24699 | * button_get_timer: (skip) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24700 | * @object: A #Button. |
| 24701 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24702 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property. |
| 24703 | * |
| 24704 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 24705 | * |
| 24706 | * Returns: The property value. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24707 | */ |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24708 | guint64 |
| 24709 | button_get_timer (Button *object) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24710 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24711 | return BUTTON_GET_IFACE (object)->get_timer (object); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24712 | } |
| 24713 | |
| 24714 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24715 | * button_set_timer: (skip) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24716 | * @object: A #Button. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24717 | * @value: The value to set. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24718 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24719 | * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value. |
| 24720 | * |
| 24721 | * 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] | 24722 | */ |
| 24723 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24724 | button_set_timer (Button *object, guint64 value) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24725 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24726 | g_object_set (G_OBJECT (object), "timer", value, NULL); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24727 | } |
| 24728 | |
| 24729 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24730 | * button_emit_released: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24731 | * @object: A #Button. |
| 24732 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24733 | * 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] | 24734 | */ |
| 24735 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24736 | button_emit_released ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24737 | Button *object) |
| 24738 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24739 | g_signal_emit_by_name (object, "released"); |
| 24740 | } |
| 24741 | |
| 24742 | /** |
| 24743 | * button_emit_pressed: |
| 24744 | * @object: A #Button. |
| 24745 | * |
| 24746 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal. |
| 24747 | */ |
| 24748 | void |
| 24749 | button_emit_pressed ( |
| 24750 | Button *object) |
| 24751 | { |
| 24752 | g_signal_emit_by_name (object, "pressed"); |
| 24753 | } |
| 24754 | |
| 24755 | /** |
| 24756 | * button_emit_pressed_long: |
| 24757 | * @object: A #Button. |
| 24758 | * |
| 24759 | * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal. |
| 24760 | */ |
| 24761 | void |
| 24762 | button_emit_pressed_long ( |
| 24763 | Button *object) |
| 24764 | { |
| 24765 | g_signal_emit_by_name (object, "pressed-long"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24766 | } |
| 24767 | |
| 24768 | /** |
| 24769 | * button_call_is_on: |
| 24770 | * @proxy: A #ButtonProxy. |
| 24771 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24772 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24773 | * @user_data: User data to pass to @callback. |
| 24774 | * |
| 24775 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. |
| 24776 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 24777 | * You can then call button_call_is_on_finish() to get the result of the operation. |
| 24778 | * |
| 24779 | * See button_call_is_on_sync() for the synchronous, blocking version of this method. |
| 24780 | */ |
| 24781 | void |
| 24782 | button_call_is_on ( |
| 24783 | Button *proxy, |
| 24784 | GCancellable *cancellable, |
| 24785 | GAsyncReadyCallback callback, |
| 24786 | gpointer user_data) |
| 24787 | { |
| 24788 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 24789 | "isOn", |
| 24790 | g_variant_new ("()"), |
| 24791 | G_DBUS_CALL_FLAGS_NONE, |
| 24792 | -1, |
| 24793 | cancellable, |
| 24794 | callback, |
| 24795 | user_data); |
| 24796 | } |
| 24797 | |
| 24798 | /** |
| 24799 | * button_call_is_on_finish: |
| 24800 | * @proxy: A #ButtonProxy. |
| 24801 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 24802 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on(). |
| 24803 | * @error: Return location for error or %NULL. |
| 24804 | * |
| 24805 | * Finishes an operation started with button_call_is_on(). |
| 24806 | * |
| 24807 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24808 | */ |
| 24809 | gboolean |
| 24810 | button_call_is_on_finish ( |
| 24811 | Button *proxy, |
| 24812 | gboolean *out_state, |
| 24813 | GAsyncResult *res, |
| 24814 | GError **error) |
| 24815 | { |
| 24816 | GVariant *_ret; |
| 24817 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24818 | if (_ret == NULL) |
| 24819 | goto _out; |
| 24820 | g_variant_get (_ret, |
| 24821 | "(b)", |
| 24822 | out_state); |
| 24823 | g_variant_unref (_ret); |
| 24824 | _out: |
| 24825 | return _ret != NULL; |
| 24826 | } |
| 24827 | |
| 24828 | /** |
| 24829 | * button_call_is_on_sync: |
| 24830 | * @proxy: A #ButtonProxy. |
| 24831 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
| 24832 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24833 | * @error: Return location for error or %NULL. |
| 24834 | * |
| 24835 | * 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. |
| 24836 | * |
| 24837 | * See button_call_is_on() for the asynchronous version of this method. |
| 24838 | * |
| 24839 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24840 | */ |
| 24841 | gboolean |
| 24842 | button_call_is_on_sync ( |
| 24843 | Button *proxy, |
| 24844 | gboolean *out_state, |
| 24845 | GCancellable *cancellable, |
| 24846 | GError **error) |
| 24847 | { |
| 24848 | GVariant *_ret; |
| 24849 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 24850 | "isOn", |
| 24851 | g_variant_new ("()"), |
| 24852 | G_DBUS_CALL_FLAGS_NONE, |
| 24853 | -1, |
| 24854 | cancellable, |
| 24855 | error); |
| 24856 | if (_ret == NULL) |
| 24857 | goto _out; |
| 24858 | g_variant_get (_ret, |
| 24859 | "(b)", |
| 24860 | out_state); |
| 24861 | g_variant_unref (_ret); |
| 24862 | _out: |
| 24863 | return _ret != NULL; |
| 24864 | } |
| 24865 | |
| 24866 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24867 | * button_call_sim_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24868 | * @proxy: A #ButtonProxy. |
| 24869 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24870 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24871 | * @user_data: User data to pass to @callback. |
| 24872 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24873 | * 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] | 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. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24875 | * 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] | 24876 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24877 | * 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] | 24878 | */ |
| 24879 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24880 | button_call_sim_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24881 | Button *proxy, |
| 24882 | GCancellable *cancellable, |
| 24883 | GAsyncReadyCallback callback, |
| 24884 | gpointer user_data) |
| 24885 | { |
| 24886 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24887 | "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24888 | g_variant_new ("()"), |
| 24889 | G_DBUS_CALL_FLAGS_NONE, |
| 24890 | -1, |
| 24891 | cancellable, |
| 24892 | callback, |
| 24893 | user_data); |
| 24894 | } |
| 24895 | |
| 24896 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24897 | * button_call_sim_press_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24898 | * @proxy: A #ButtonProxy. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24899 | * @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] | 24900 | * @error: Return location for error or %NULL. |
| 24901 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24902 | * Finishes an operation started with button_call_sim_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24903 | * |
| 24904 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24905 | */ |
| 24906 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24907 | button_call_sim_press_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24908 | Button *proxy, |
| 24909 | GAsyncResult *res, |
| 24910 | GError **error) |
| 24911 | { |
| 24912 | GVariant *_ret; |
| 24913 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 24914 | if (_ret == NULL) |
| 24915 | goto _out; |
| 24916 | g_variant_get (_ret, |
| 24917 | "()"); |
| 24918 | g_variant_unref (_ret); |
| 24919 | _out: |
| 24920 | return _ret != NULL; |
| 24921 | } |
| 24922 | |
| 24923 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24924 | * button_call_sim_press_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24925 | * @proxy: A #ButtonProxy. |
| 24926 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24927 | * @error: Return location for error or %NULL. |
| 24928 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24929 | * 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] | 24930 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24931 | * See button_call_sim_press() for the asynchronous version of this method. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24932 | * |
| 24933 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24934 | */ |
| 24935 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24936 | button_call_sim_press_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24937 | Button *proxy, |
| 24938 | GCancellable *cancellable, |
| 24939 | GError **error) |
| 24940 | { |
| 24941 | GVariant *_ret; |
| 24942 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24943 | "simPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24944 | g_variant_new ("()"), |
| 24945 | G_DBUS_CALL_FLAGS_NONE, |
| 24946 | -1, |
| 24947 | cancellable, |
| 24948 | error); |
| 24949 | if (_ret == NULL) |
| 24950 | goto _out; |
| 24951 | g_variant_get (_ret, |
| 24952 | "()"); |
| 24953 | g_variant_unref (_ret); |
| 24954 | _out: |
| 24955 | return _ret != NULL; |
| 24956 | } |
| 24957 | |
| 24958 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24959 | * button_call_sim_long_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24960 | * @proxy: A #ButtonProxy. |
| 24961 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 24962 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 24963 | * @user_data: User data to pass to @callback. |
| 24964 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24965 | * 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] | 24966 | * When the operation is finished, @callback will be invoked 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] | 24967 | * 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] | 24968 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24969 | * 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] | 24970 | */ |
| 24971 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24972 | button_call_sim_long_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24973 | Button *proxy, |
| 24974 | GCancellable *cancellable, |
| 24975 | GAsyncReadyCallback callback, |
| 24976 | gpointer user_data) |
| 24977 | { |
| 24978 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24979 | "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24980 | g_variant_new ("()"), |
| 24981 | G_DBUS_CALL_FLAGS_NONE, |
| 24982 | -1, |
| 24983 | cancellable, |
| 24984 | callback, |
| 24985 | user_data); |
| 24986 | } |
| 24987 | |
| 24988 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24989 | * button_call_sim_long_press_finish: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24990 | * @proxy: A #ButtonProxy. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24991 | * @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] | 24992 | * @error: Return location for error or %NULL. |
| 24993 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24994 | * Finishes an operation started with button_call_sim_long_press(). |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 24995 | * |
| 24996 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 24997 | */ |
| 24998 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 24999 | button_call_sim_long_press_finish ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25000 | Button *proxy, |
| 25001 | GAsyncResult *res, |
| 25002 | GError **error) |
| 25003 | { |
| 25004 | GVariant *_ret; |
| 25005 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 25006 | if (_ret == NULL) |
| 25007 | goto _out; |
| 25008 | g_variant_get (_ret, |
| 25009 | "()"); |
| 25010 | g_variant_unref (_ret); |
| 25011 | _out: |
| 25012 | return _ret != NULL; |
| 25013 | } |
| 25014 | |
| 25015 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25016 | * button_call_sim_long_press_sync: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25017 | * @proxy: A #ButtonProxy. |
| 25018 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25019 | * @error: Return location for error or %NULL. |
| 25020 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25021 | * 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] | 25022 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25023 | * 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] | 25024 | * |
| 25025 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 25026 | */ |
| 25027 | gboolean |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25028 | button_call_sim_long_press_sync ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25029 | Button *proxy, |
| 25030 | GCancellable *cancellable, |
| 25031 | GError **error) |
| 25032 | { |
| 25033 | GVariant *_ret; |
| 25034 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25035 | "simLongPress", |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25036 | g_variant_new ("()"), |
| 25037 | G_DBUS_CALL_FLAGS_NONE, |
| 25038 | -1, |
| 25039 | cancellable, |
| 25040 | error); |
| 25041 | if (_ret == NULL) |
| 25042 | goto _out; |
| 25043 | g_variant_get (_ret, |
| 25044 | "()"); |
| 25045 | g_variant_unref (_ret); |
| 25046 | _out: |
| 25047 | return _ret != NULL; |
| 25048 | } |
| 25049 | |
| 25050 | /** |
| 25051 | * button_complete_is_on: |
| 25052 | * @object: A #Button. |
| 25053 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 25054 | * @state: Parameter to return. |
| 25055 | * |
| 25056 | * 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. |
| 25057 | * |
| 25058 | * This method will free @invocation, you cannot use it afterwards. |
| 25059 | */ |
| 25060 | void |
| 25061 | button_complete_is_on ( |
| 25062 | Button *object, |
| 25063 | GDBusMethodInvocation *invocation, |
| 25064 | gboolean state) |
| 25065 | { |
| 25066 | g_dbus_method_invocation_return_value (invocation, |
| 25067 | g_variant_new ("(b)", |
| 25068 | state)); |
| 25069 | } |
| 25070 | |
| 25071 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25072 | * button_complete_sim_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25073 | * @object: A #Button. |
| 25074 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 25075 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25076 | * 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] | 25077 | * |
| 25078 | * This method will free @invocation, you cannot use it afterwards. |
| 25079 | */ |
| 25080 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25081 | button_complete_sim_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25082 | Button *object, |
| 25083 | GDBusMethodInvocation *invocation) |
| 25084 | { |
| 25085 | g_dbus_method_invocation_return_value (invocation, |
| 25086 | g_variant_new ("()")); |
| 25087 | } |
| 25088 | |
| 25089 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25090 | * button_complete_sim_long_press: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25091 | * @object: A #Button. |
| 25092 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 25093 | * |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25094 | * 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] | 25095 | * |
| 25096 | * This method will free @invocation, you cannot use it afterwards. |
| 25097 | */ |
| 25098 | void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25099 | button_complete_sim_long_press ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25100 | Button *object, |
| 25101 | GDBusMethodInvocation *invocation) |
| 25102 | { |
| 25103 | g_dbus_method_invocation_return_value (invocation, |
| 25104 | g_variant_new ("()")); |
| 25105 | } |
| 25106 | |
| 25107 | /* ------------------------------------------------------------------------ */ |
| 25108 | |
| 25109 | /** |
| 25110 | * ButtonProxy: |
| 25111 | * |
| 25112 | * The #ButtonProxy structure contains only private data and should only be accessed using the provided API. |
| 25113 | */ |
| 25114 | |
| 25115 | /** |
| 25116 | * ButtonProxyClass: |
| 25117 | * @parent_class: The parent class. |
| 25118 | * |
| 25119 | * Class structure for #ButtonProxy. |
| 25120 | */ |
| 25121 | |
| 25122 | struct _ButtonProxyPrivate |
| 25123 | { |
| 25124 | GData *qdata; |
| 25125 | }; |
| 25126 | |
| 25127 | static void button_proxy_iface_init (ButtonIface *iface); |
| 25128 | |
| 25129 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25130 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 25131 | G_ADD_PRIVATE (ButtonProxy) |
| 25132 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 25133 | |
| 25134 | #else |
| 25135 | G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, |
| 25136 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); |
| 25137 | |
| 25138 | #endif |
| 25139 | static void |
| 25140 | button_proxy_finalize (GObject *object) |
| 25141 | { |
| 25142 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 25143 | g_datalist_clear (&proxy->priv->qdata); |
| 25144 | G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object); |
| 25145 | } |
| 25146 | |
| 25147 | static void |
| 25148 | button_proxy_get_property (GObject *object, |
| 25149 | guint prop_id, |
| 25150 | GValue *value, |
| 25151 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25152 | { |
| 25153 | const _ExtendedGDBusPropertyInfo *info; |
| 25154 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25155 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25156 | info = _button_property_info_pointers[prop_id - 1]; |
| 25157 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 25158 | if (info->use_gvariant) |
| 25159 | { |
| 25160 | g_value_set_variant (value, variant); |
| 25161 | } |
| 25162 | else |
| 25163 | { |
| 25164 | if (variant != NULL) |
| 25165 | g_dbus_gvariant_to_gvalue (variant, value); |
| 25166 | } |
| 25167 | if (variant != NULL) |
| 25168 | g_variant_unref (variant); |
| 25169 | } |
| 25170 | |
| 25171 | static void |
| 25172 | button_proxy_set_property_cb (GDBusProxy *proxy, |
| 25173 | GAsyncResult *res, |
| 25174 | gpointer user_data) |
| 25175 | { |
| 25176 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 25177 | GError *error; |
| 25178 | GVariant *_ret; |
| 25179 | error = NULL; |
| 25180 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 25181 | if (!_ret) |
| 25182 | { |
| 25183 | g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)", |
| 25184 | info->parent_struct.name, |
| 25185 | error->message, g_quark_to_string (error->domain), error->code); |
| 25186 | g_error_free (error); |
| 25187 | } |
| 25188 | else |
| 25189 | { |
| 25190 | g_variant_unref (_ret); |
| 25191 | } |
| 25192 | } |
| 25193 | |
| 25194 | static void |
| 25195 | button_proxy_set_property (GObject *object, |
| 25196 | guint prop_id, |
| 25197 | const GValue *value, |
| 25198 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25199 | { |
| 25200 | const _ExtendedGDBusPropertyInfo *info; |
| 25201 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25202 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25203 | info = _button_property_info_pointers[prop_id - 1]; |
| 25204 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 25205 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 25206 | "org.freedesktop.DBus.Properties.Set", |
| 25207 | g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant), |
| 25208 | G_DBUS_CALL_FLAGS_NONE, |
| 25209 | -1, |
| 25210 | NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 25211 | g_variant_unref (variant); |
| 25212 | } |
| 25213 | |
| 25214 | static void |
| 25215 | button_proxy_g_signal (GDBusProxy *proxy, |
| 25216 | const gchar *sender_name G_GNUC_UNUSED, |
| 25217 | const gchar *signal_name, |
| 25218 | GVariant *parameters) |
| 25219 | { |
| 25220 | _ExtendedGDBusSignalInfo *info; |
| 25221 | GVariantIter iter; |
| 25222 | GVariant *child; |
| 25223 | GValue *paramv; |
| 25224 | guint num_params; |
| 25225 | guint n; |
| 25226 | guint signal_id; |
| 25227 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name); |
| 25228 | if (info == NULL) |
| 25229 | return; |
| 25230 | num_params = g_variant_n_children (parameters); |
| 25231 | paramv = g_new0 (GValue, num_params + 1); |
| 25232 | g_value_init (¶mv[0], TYPE_BUTTON); |
| 25233 | g_value_set_object (¶mv[0], proxy); |
| 25234 | g_variant_iter_init (&iter, parameters); |
| 25235 | n = 1; |
| 25236 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 25237 | { |
| 25238 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 25239 | if (arg_info->use_gvariant) |
| 25240 | { |
| 25241 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 25242 | g_value_set_variant (¶mv[n], child); |
| 25243 | n++; |
| 25244 | } |
| 25245 | else |
| 25246 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 25247 | g_variant_unref (child); |
| 25248 | } |
| 25249 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 25250 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 25251 | for (n = 0; n < num_params + 1; n++) |
| 25252 | g_value_unset (¶mv[n]); |
| 25253 | g_free (paramv); |
| 25254 | } |
| 25255 | |
| 25256 | static void |
| 25257 | button_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 25258 | GVariant *changed_properties, |
| 25259 | const gchar *const *invalidated_properties) |
| 25260 | { |
| 25261 | ButtonProxy *proxy = BUTTON_PROXY (_proxy); |
| 25262 | guint n; |
| 25263 | const gchar *key; |
| 25264 | GVariantIter *iter; |
| 25265 | _ExtendedGDBusPropertyInfo *info; |
| 25266 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 25267 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 25268 | { |
| 25269 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key); |
| 25270 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 25271 | if (info != NULL) |
| 25272 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 25273 | } |
| 25274 | g_variant_iter_free (iter); |
| 25275 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 25276 | { |
| 25277 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]); |
| 25278 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 25279 | if (info != NULL) |
| 25280 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 25281 | } |
| 25282 | } |
| 25283 | |
| 25284 | static gboolean |
| 25285 | button_proxy_get_state (Button *object) |
| 25286 | { |
| 25287 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 25288 | GVariant *variant; |
| 25289 | gboolean value = 0; |
| 25290 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 25291 | if (variant != NULL) |
| 25292 | { |
| 25293 | value = g_variant_get_boolean (variant); |
| 25294 | g_variant_unref (variant); |
| 25295 | } |
| 25296 | return value; |
| 25297 | } |
| 25298 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25299 | static guint64 |
| 25300 | button_proxy_get_timer (Button *object) |
| 25301 | { |
| 25302 | ButtonProxy *proxy = BUTTON_PROXY (object); |
| 25303 | GVariant *variant; |
| 25304 | guint64 value = 0; |
| 25305 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer"); |
| 25306 | if (variant != NULL) |
| 25307 | { |
| 25308 | value = g_variant_get_uint64 (variant); |
| 25309 | g_variant_unref (variant); |
| 25310 | } |
| 25311 | return value; |
| 25312 | } |
| 25313 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25314 | static void |
| 25315 | button_proxy_init (ButtonProxy *proxy) |
| 25316 | { |
| 25317 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25318 | proxy->priv = button_proxy_get_instance_private (proxy); |
| 25319 | #else |
| 25320 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate); |
| 25321 | #endif |
| 25322 | |
| 25323 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ()); |
| 25324 | } |
| 25325 | |
| 25326 | static void |
| 25327 | button_proxy_class_init (ButtonProxyClass *klass) |
| 25328 | { |
| 25329 | GObjectClass *gobject_class; |
| 25330 | GDBusProxyClass *proxy_class; |
| 25331 | |
| 25332 | gobject_class = G_OBJECT_CLASS (klass); |
| 25333 | gobject_class->finalize = button_proxy_finalize; |
| 25334 | gobject_class->get_property = button_proxy_get_property; |
| 25335 | gobject_class->set_property = button_proxy_set_property; |
| 25336 | |
| 25337 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 25338 | proxy_class->g_signal = button_proxy_g_signal; |
| 25339 | proxy_class->g_properties_changed = button_proxy_g_properties_changed; |
| 25340 | |
| 25341 | button_override_properties (gobject_class, 1); |
| 25342 | |
| 25343 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 25344 | g_type_class_add_private (klass, sizeof (ButtonProxyPrivate)); |
| 25345 | #endif |
| 25346 | } |
| 25347 | |
| 25348 | static void |
| 25349 | button_proxy_iface_init (ButtonIface *iface) |
| 25350 | { |
| 25351 | iface->get_state = button_proxy_get_state; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25352 | iface->get_timer = button_proxy_get_timer; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25353 | } |
| 25354 | |
| 25355 | /** |
| 25356 | * button_proxy_new: |
| 25357 | * @connection: A #GDBusConnection. |
| 25358 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25359 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 25360 | * @object_path: An object path. |
| 25361 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25362 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 25363 | * @user_data: User data to pass to @callback. |
| 25364 | * |
| 25365 | * 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. |
| 25366 | * |
| 25367 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 25368 | * You can then call button_proxy_new_finish() to get the result of the operation. |
| 25369 | * |
| 25370 | * See button_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 25371 | */ |
| 25372 | void |
| 25373 | button_proxy_new ( |
| 25374 | GDBusConnection *connection, |
| 25375 | GDBusProxyFlags flags, |
| 25376 | const gchar *name, |
| 25377 | const gchar *object_path, |
| 25378 | GCancellable *cancellable, |
| 25379 | GAsyncReadyCallback callback, |
| 25380 | gpointer user_data) |
| 25381 | { |
| 25382 | 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); |
| 25383 | } |
| 25384 | |
| 25385 | /** |
| 25386 | * button_proxy_new_finish: |
| 25387 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new(). |
| 25388 | * @error: Return location for error or %NULL |
| 25389 | * |
| 25390 | * Finishes an operation started with button_proxy_new(). |
| 25391 | * |
| 25392 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 25393 | */ |
| 25394 | Button * |
| 25395 | button_proxy_new_finish ( |
| 25396 | GAsyncResult *res, |
| 25397 | GError **error) |
| 25398 | { |
| 25399 | GObject *ret; |
| 25400 | GObject *source_object; |
| 25401 | source_object = g_async_result_get_source_object (res); |
| 25402 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25403 | g_object_unref (source_object); |
| 25404 | if (ret != NULL) |
| 25405 | return BUTTON (ret); |
| 25406 | else |
| 25407 | return NULL; |
| 25408 | } |
| 25409 | |
| 25410 | /** |
| 25411 | * button_proxy_new_sync: |
| 25412 | * @connection: A #GDBusConnection. |
| 25413 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25414 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 25415 | * @object_path: An object path. |
| 25416 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25417 | * @error: Return location for error or %NULL |
| 25418 | * |
| 25419 | * 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. |
| 25420 | * |
| 25421 | * The calling thread is blocked until a reply is received. |
| 25422 | * |
| 25423 | * See button_proxy_new() for the asynchronous version of this constructor. |
| 25424 | * |
| 25425 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 25426 | */ |
| 25427 | Button * |
| 25428 | button_proxy_new_sync ( |
| 25429 | GDBusConnection *connection, |
| 25430 | GDBusProxyFlags flags, |
| 25431 | const gchar *name, |
| 25432 | const gchar *object_path, |
| 25433 | GCancellable *cancellable, |
| 25434 | GError **error) |
| 25435 | { |
| 25436 | GInitable *ret; |
| 25437 | 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); |
| 25438 | if (ret != NULL) |
| 25439 | return BUTTON (ret); |
| 25440 | else |
| 25441 | return NULL; |
| 25442 | } |
| 25443 | |
| 25444 | |
| 25445 | /** |
| 25446 | * button_proxy_new_for_bus: |
| 25447 | * @bus_type: A #GBusType. |
| 25448 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25449 | * @name: A bus name (well-known or unique). |
| 25450 | * @object_path: An object path. |
| 25451 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25452 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 25453 | * @user_data: User data to pass to @callback. |
| 25454 | * |
| 25455 | * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 25456 | * |
| 25457 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 25458 | * You can then call button_proxy_new_for_bus_finish() to get the result of the operation. |
| 25459 | * |
| 25460 | * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 25461 | */ |
| 25462 | void |
| 25463 | button_proxy_new_for_bus ( |
| 25464 | GBusType bus_type, |
| 25465 | GDBusProxyFlags flags, |
| 25466 | const gchar *name, |
| 25467 | const gchar *object_path, |
| 25468 | GCancellable *cancellable, |
| 25469 | GAsyncReadyCallback callback, |
| 25470 | gpointer user_data) |
| 25471 | { |
| 25472 | 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); |
| 25473 | } |
| 25474 | |
| 25475 | /** |
| 25476 | * button_proxy_new_for_bus_finish: |
| 25477 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus(). |
| 25478 | * @error: Return location for error or %NULL |
| 25479 | * |
| 25480 | * Finishes an operation started with button_proxy_new_for_bus(). |
| 25481 | * |
| 25482 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 25483 | */ |
| 25484 | Button * |
| 25485 | button_proxy_new_for_bus_finish ( |
| 25486 | GAsyncResult *res, |
| 25487 | GError **error) |
| 25488 | { |
| 25489 | GObject *ret; |
| 25490 | GObject *source_object; |
| 25491 | source_object = g_async_result_get_source_object (res); |
| 25492 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 25493 | g_object_unref (source_object); |
| 25494 | if (ret != NULL) |
| 25495 | return BUTTON (ret); |
| 25496 | else |
| 25497 | return NULL; |
| 25498 | } |
| 25499 | |
| 25500 | /** |
| 25501 | * button_proxy_new_for_bus_sync: |
| 25502 | * @bus_type: A #GBusType. |
| 25503 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 25504 | * @name: A bus name (well-known or unique). |
| 25505 | * @object_path: An object path. |
| 25506 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 25507 | * @error: Return location for error or %NULL |
| 25508 | * |
| 25509 | * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 25510 | * |
| 25511 | * The calling thread is blocked until a reply is received. |
| 25512 | * |
| 25513 | * See button_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 25514 | * |
| 25515 | * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. |
| 25516 | */ |
| 25517 | Button * |
| 25518 | button_proxy_new_for_bus_sync ( |
| 25519 | GBusType bus_type, |
| 25520 | GDBusProxyFlags flags, |
| 25521 | const gchar *name, |
| 25522 | const gchar *object_path, |
| 25523 | GCancellable *cancellable, |
| 25524 | GError **error) |
| 25525 | { |
| 25526 | GInitable *ret; |
| 25527 | 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); |
| 25528 | if (ret != NULL) |
| 25529 | return BUTTON (ret); |
| 25530 | else |
| 25531 | return NULL; |
| 25532 | } |
| 25533 | |
| 25534 | |
| 25535 | /* ------------------------------------------------------------------------ */ |
| 25536 | |
| 25537 | /** |
| 25538 | * ButtonSkeleton: |
| 25539 | * |
| 25540 | * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API. |
| 25541 | */ |
| 25542 | |
| 25543 | /** |
| 25544 | * ButtonSkeletonClass: |
| 25545 | * @parent_class: The parent class. |
| 25546 | * |
| 25547 | * Class structure for #ButtonSkeleton. |
| 25548 | */ |
| 25549 | |
| 25550 | struct _ButtonSkeletonPrivate |
| 25551 | { |
| 25552 | GValue *properties; |
| 25553 | GList *changed_properties; |
| 25554 | GSource *changed_properties_idle_source; |
| 25555 | GMainContext *context; |
| 25556 | GMutex lock; |
| 25557 | }; |
| 25558 | |
| 25559 | static void |
| 25560 | _button_skeleton_handle_method_call ( |
| 25561 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25562 | const gchar *sender G_GNUC_UNUSED, |
| 25563 | const gchar *object_path G_GNUC_UNUSED, |
| 25564 | const gchar *interface_name, |
| 25565 | const gchar *method_name, |
| 25566 | GVariant *parameters, |
| 25567 | GDBusMethodInvocation *invocation, |
| 25568 | gpointer user_data) |
| 25569 | { |
| 25570 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 25571 | _ExtendedGDBusMethodInfo *info; |
| 25572 | GVariantIter iter; |
| 25573 | GVariant *child; |
| 25574 | GValue *paramv; |
| 25575 | guint num_params; |
| 25576 | guint num_extra; |
| 25577 | guint n; |
| 25578 | guint signal_id; |
| 25579 | GValue return_value = G_VALUE_INIT; |
| 25580 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 25581 | g_assert (info != NULL); |
| 25582 | num_params = g_variant_n_children (parameters); |
| 25583 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 25584 | n = 0; |
| 25585 | g_value_init (¶mv[n], TYPE_BUTTON); |
| 25586 | g_value_set_object (¶mv[n++], skeleton); |
| 25587 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 25588 | g_value_set_object (¶mv[n++], invocation); |
| 25589 | if (info->pass_fdlist) |
| 25590 | { |
| 25591 | #ifdef G_OS_UNIX |
| 25592 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 25593 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 25594 | #else |
| 25595 | g_assert_not_reached (); |
| 25596 | #endif |
| 25597 | } |
| 25598 | g_variant_iter_init (&iter, parameters); |
| 25599 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 25600 | { |
| 25601 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 25602 | if (arg_info->use_gvariant) |
| 25603 | { |
| 25604 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 25605 | g_value_set_variant (¶mv[n], child); |
| 25606 | n++; |
| 25607 | } |
| 25608 | else |
| 25609 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 25610 | g_variant_unref (child); |
| 25611 | } |
| 25612 | signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); |
| 25613 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 25614 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 25615 | if (!g_value_get_boolean (&return_value)) |
| 25616 | 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); |
| 25617 | g_value_unset (&return_value); |
| 25618 | for (n = 0; n < num_params + num_extra; n++) |
| 25619 | g_value_unset (¶mv[n]); |
| 25620 | g_free (paramv); |
| 25621 | } |
| 25622 | |
| 25623 | static GVariant * |
| 25624 | _button_skeleton_handle_get_property ( |
| 25625 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25626 | const gchar *sender G_GNUC_UNUSED, |
| 25627 | const gchar *object_path G_GNUC_UNUSED, |
| 25628 | const gchar *interface_name G_GNUC_UNUSED, |
| 25629 | const gchar *property_name, |
| 25630 | GError **error, |
| 25631 | gpointer user_data) |
| 25632 | { |
| 25633 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 25634 | GValue value = G_VALUE_INIT; |
| 25635 | GParamSpec *pspec; |
| 25636 | _ExtendedGDBusPropertyInfo *info; |
| 25637 | GVariant *ret; |
| 25638 | ret = NULL; |
| 25639 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 25640 | g_assert (info != NULL); |
| 25641 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25642 | if (pspec == NULL) |
| 25643 | { |
| 25644 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25645 | } |
| 25646 | else |
| 25647 | { |
| 25648 | g_value_init (&value, pspec->value_type); |
| 25649 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25650 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 25651 | g_value_unset (&value); |
| 25652 | } |
| 25653 | return ret; |
| 25654 | } |
| 25655 | |
| 25656 | static gboolean |
| 25657 | _button_skeleton_handle_set_property ( |
| 25658 | GDBusConnection *connection G_GNUC_UNUSED, |
| 25659 | const gchar *sender G_GNUC_UNUSED, |
| 25660 | const gchar *object_path G_GNUC_UNUSED, |
| 25661 | const gchar *interface_name G_GNUC_UNUSED, |
| 25662 | const gchar *property_name, |
| 25663 | GVariant *variant, |
| 25664 | GError **error, |
| 25665 | gpointer user_data) |
| 25666 | { |
| 25667 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 25668 | GValue value = G_VALUE_INIT; |
| 25669 | GParamSpec *pspec; |
| 25670 | _ExtendedGDBusPropertyInfo *info; |
| 25671 | gboolean ret; |
| 25672 | ret = FALSE; |
| 25673 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); |
| 25674 | g_assert (info != NULL); |
| 25675 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 25676 | if (pspec == NULL) |
| 25677 | { |
| 25678 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 25679 | } |
| 25680 | else |
| 25681 | { |
| 25682 | if (info->use_gvariant) |
| 25683 | g_value_set_variant (&value, variant); |
| 25684 | else |
| 25685 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 25686 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 25687 | g_value_unset (&value); |
| 25688 | ret = TRUE; |
| 25689 | } |
| 25690 | return ret; |
| 25691 | } |
| 25692 | |
| 25693 | static const GDBusInterfaceVTable _button_skeleton_vtable = |
| 25694 | { |
| 25695 | _button_skeleton_handle_method_call, |
| 25696 | _button_skeleton_handle_get_property, |
| 25697 | _button_skeleton_handle_set_property, |
| 25698 | {NULL} |
| 25699 | }; |
| 25700 | |
| 25701 | static GDBusInterfaceInfo * |
| 25702 | button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25703 | { |
| 25704 | return button_interface_info (); |
| 25705 | } |
| 25706 | |
| 25707 | static GDBusInterfaceVTable * |
| 25708 | button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 25709 | { |
| 25710 | return (GDBusInterfaceVTable *) &_button_skeleton_vtable; |
| 25711 | } |
| 25712 | |
| 25713 | static GVariant * |
| 25714 | button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 25715 | { |
| 25716 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 25717 | |
| 25718 | GVariantBuilder builder; |
| 25719 | guint n; |
| 25720 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25721 | if (_button_interface_info.parent_struct.properties == NULL) |
| 25722 | goto out; |
| 25723 | for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++) |
| 25724 | { |
| 25725 | GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n]; |
| 25726 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 25727 | { |
| 25728 | GVariant *value; |
| 25729 | 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); |
| 25730 | if (value != NULL) |
| 25731 | { |
| 25732 | g_variant_take_ref (value); |
| 25733 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 25734 | g_variant_unref (value); |
| 25735 | } |
| 25736 | } |
| 25737 | } |
| 25738 | out: |
| 25739 | return g_variant_builder_end (&builder); |
| 25740 | } |
| 25741 | |
| 25742 | static gboolean _button_emit_changed (gpointer user_data); |
| 25743 | |
| 25744 | static void |
| 25745 | button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 25746 | { |
| 25747 | ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); |
| 25748 | gboolean emit_changed = FALSE; |
| 25749 | |
| 25750 | g_mutex_lock (&skeleton->priv->lock); |
| 25751 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25752 | { |
| 25753 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25754 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25755 | emit_changed = TRUE; |
| 25756 | } |
| 25757 | g_mutex_unlock (&skeleton->priv->lock); |
| 25758 | |
| 25759 | if (emit_changed) |
| 25760 | _button_emit_changed (skeleton); |
| 25761 | } |
| 25762 | |
| 25763 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25764 | _button_on_signal_released ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25765 | Button *object) |
| 25766 | { |
| 25767 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 25768 | |
| 25769 | GList *connections, *l; |
| 25770 | GVariant *signal_variant; |
| 25771 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25772 | |
| 25773 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 25774 | for (l = connections; l != NULL; l = l->next) |
| 25775 | { |
| 25776 | GDBusConnection *connection = l->data; |
| 25777 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25778 | 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] | 25779 | signal_variant, NULL); |
| 25780 | } |
| 25781 | g_variant_unref (signal_variant); |
| 25782 | g_list_free_full (connections, g_object_unref); |
| 25783 | } |
| 25784 | |
| 25785 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25786 | _button_on_signal_pressed ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25787 | Button *object) |
| 25788 | { |
| 25789 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 25790 | |
| 25791 | GList *connections, *l; |
| 25792 | GVariant *signal_variant; |
| 25793 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25794 | |
| 25795 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 25796 | for (l = connections; l != NULL; l = l->next) |
| 25797 | { |
| 25798 | GDBusConnection *connection = l->data; |
| 25799 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25800 | 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] | 25801 | signal_variant, NULL); |
| 25802 | } |
| 25803 | g_variant_unref (signal_variant); |
| 25804 | g_list_free_full (connections, g_object_unref); |
| 25805 | } |
| 25806 | |
| 25807 | static void |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25808 | _button_on_signal_pressed_long ( |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25809 | Button *object) |
| 25810 | { |
| 25811 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 25812 | |
| 25813 | GList *connections, *l; |
| 25814 | GVariant *signal_variant; |
| 25815 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25816 | |
| 25817 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 25818 | for (l = connections; l != NULL; l = l->next) |
| 25819 | { |
| 25820 | GDBusConnection *connection = l->data; |
| 25821 | g_dbus_connection_emit_signal (connection, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25822 | 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] | 25823 | signal_variant, NULL); |
| 25824 | } |
| 25825 | g_variant_unref (signal_variant); |
| 25826 | g_list_free_full (connections, g_object_unref); |
| 25827 | } |
| 25828 | |
| 25829 | static void button_skeleton_iface_init (ButtonIface *iface); |
| 25830 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25831 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25832 | G_ADD_PRIVATE (ButtonSkeleton) |
| 25833 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 25834 | |
| 25835 | #else |
| 25836 | G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 25837 | G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); |
| 25838 | |
| 25839 | #endif |
| 25840 | static void |
| 25841 | button_skeleton_finalize (GObject *object) |
| 25842 | { |
| 25843 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 25844 | guint n; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25845 | for (n = 0; n < 2; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25846 | g_value_unset (&skeleton->priv->properties[n]); |
| 25847 | g_free (skeleton->priv->properties); |
| 25848 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25849 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 25850 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 25851 | g_main_context_unref (skeleton->priv->context); |
| 25852 | g_mutex_clear (&skeleton->priv->lock); |
| 25853 | G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object); |
| 25854 | } |
| 25855 | |
| 25856 | static void |
| 25857 | button_skeleton_get_property (GObject *object, |
| 25858 | guint prop_id, |
| 25859 | GValue *value, |
| 25860 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25861 | { |
| 25862 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25863 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25864 | g_mutex_lock (&skeleton->priv->lock); |
| 25865 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 25866 | g_mutex_unlock (&skeleton->priv->lock); |
| 25867 | } |
| 25868 | |
| 25869 | static gboolean |
| 25870 | _button_emit_changed (gpointer user_data) |
| 25871 | { |
| 25872 | ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); |
| 25873 | GList *l; |
| 25874 | GVariantBuilder builder; |
| 25875 | GVariantBuilder invalidated_builder; |
| 25876 | guint num_changes; |
| 25877 | |
| 25878 | g_mutex_lock (&skeleton->priv->lock); |
| 25879 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 25880 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 25881 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 25882 | { |
| 25883 | ChangedProperty *cp = l->data; |
| 25884 | GVariant *variant; |
| 25885 | const GValue *cur_value; |
| 25886 | |
| 25887 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 25888 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 25889 | { |
| 25890 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 25891 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 25892 | g_variant_unref (variant); |
| 25893 | num_changes++; |
| 25894 | } |
| 25895 | } |
| 25896 | if (num_changes > 0) |
| 25897 | { |
| 25898 | GList *connections, *ll; |
| 25899 | GVariant *signal_variant; |
| 25900 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button", |
| 25901 | &builder, &invalidated_builder)); |
| 25902 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 25903 | for (ll = connections; ll != NULL; ll = ll->next) |
| 25904 | { |
| 25905 | GDBusConnection *connection = ll->data; |
| 25906 | |
| 25907 | g_dbus_connection_emit_signal (connection, |
| 25908 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 25909 | "org.freedesktop.DBus.Properties", |
| 25910 | "PropertiesChanged", |
| 25911 | signal_variant, |
| 25912 | NULL); |
| 25913 | } |
| 25914 | g_variant_unref (signal_variant); |
| 25915 | g_list_free_full (connections, g_object_unref); |
| 25916 | } |
| 25917 | else |
| 25918 | { |
| 25919 | g_variant_builder_clear (&builder); |
| 25920 | g_variant_builder_clear (&invalidated_builder); |
| 25921 | } |
| 25922 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 25923 | skeleton->priv->changed_properties = NULL; |
| 25924 | skeleton->priv->changed_properties_idle_source = NULL; |
| 25925 | g_mutex_unlock (&skeleton->priv->lock); |
| 25926 | return FALSE; |
| 25927 | } |
| 25928 | |
| 25929 | static void |
| 25930 | _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 25931 | { |
| 25932 | ChangedProperty *cp; |
| 25933 | GList *l; |
| 25934 | cp = NULL; |
| 25935 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 25936 | { |
| 25937 | ChangedProperty *i_cp = l->data; |
| 25938 | if (i_cp->info == info) |
| 25939 | { |
| 25940 | cp = i_cp; |
| 25941 | break; |
| 25942 | } |
| 25943 | } |
| 25944 | if (cp == NULL) |
| 25945 | { |
| 25946 | cp = g_new0 (ChangedProperty, 1); |
| 25947 | cp->prop_id = prop_id; |
| 25948 | cp->info = info; |
| 25949 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 25950 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 25951 | g_value_copy (orig_value, &cp->orig_value); |
| 25952 | } |
| 25953 | } |
| 25954 | |
| 25955 | static void |
| 25956 | button_skeleton_notify (GObject *object, |
| 25957 | GParamSpec *pspec G_GNUC_UNUSED) |
| 25958 | { |
| 25959 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 25960 | g_mutex_lock (&skeleton->priv->lock); |
| 25961 | if (skeleton->priv->changed_properties != NULL && |
| 25962 | skeleton->priv->changed_properties_idle_source == NULL) |
| 25963 | { |
| 25964 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 25965 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 25966 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 25967 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 25968 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 25969 | } |
| 25970 | g_mutex_unlock (&skeleton->priv->lock); |
| 25971 | } |
| 25972 | |
| 25973 | static void |
| 25974 | button_skeleton_set_property (GObject *object, |
| 25975 | guint prop_id, |
| 25976 | const GValue *value, |
| 25977 | GParamSpec *pspec) |
| 25978 | { |
| 25979 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 25980 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 25981 | g_mutex_lock (&skeleton->priv->lock); |
| 25982 | g_object_freeze_notify (object); |
| 25983 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 25984 | { |
| 25985 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 25986 | _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 25987 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 25988 | g_object_notify_by_pspec (object, pspec); |
| 25989 | } |
| 25990 | g_mutex_unlock (&skeleton->priv->lock); |
| 25991 | g_object_thaw_notify (object); |
| 25992 | } |
| 25993 | |
| 25994 | static void |
| 25995 | button_skeleton_init (ButtonSkeleton *skeleton) |
| 25996 | { |
| 25997 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 25998 | skeleton->priv = button_skeleton_get_instance_private (skeleton); |
| 25999 | #else |
| 26000 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate); |
| 26001 | #endif |
| 26002 | |
| 26003 | g_mutex_init (&skeleton->priv->lock); |
| 26004 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26005 | skeleton->priv->properties = g_new0 (GValue, 2); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26006 | g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26007 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26008 | } |
| 26009 | |
| 26010 | static gboolean |
| 26011 | button_skeleton_get_state (Button *object) |
| 26012 | { |
| 26013 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 26014 | gboolean value; |
| 26015 | g_mutex_lock (&skeleton->priv->lock); |
| 26016 | value = g_value_get_boolean (&(skeleton->priv->properties[0])); |
| 26017 | g_mutex_unlock (&skeleton->priv->lock); |
| 26018 | return value; |
| 26019 | } |
| 26020 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26021 | static guint64 |
| 26022 | button_skeleton_get_timer (Button *object) |
| 26023 | { |
| 26024 | ButtonSkeleton *skeleton = BUTTON_SKELETON (object); |
| 26025 | guint64 value; |
| 26026 | g_mutex_lock (&skeleton->priv->lock); |
| 26027 | value = g_value_get_uint64 (&(skeleton->priv->properties[1])); |
| 26028 | g_mutex_unlock (&skeleton->priv->lock); |
| 26029 | return value; |
| 26030 | } |
| 26031 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26032 | static void |
| 26033 | button_skeleton_class_init (ButtonSkeletonClass *klass) |
| 26034 | { |
| 26035 | GObjectClass *gobject_class; |
| 26036 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 26037 | |
| 26038 | gobject_class = G_OBJECT_CLASS (klass); |
| 26039 | gobject_class->finalize = button_skeleton_finalize; |
| 26040 | gobject_class->get_property = button_skeleton_get_property; |
| 26041 | gobject_class->set_property = button_skeleton_set_property; |
| 26042 | gobject_class->notify = button_skeleton_notify; |
| 26043 | |
| 26044 | |
| 26045 | button_override_properties (gobject_class, 1); |
| 26046 | |
| 26047 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 26048 | skeleton_class->get_info = button_skeleton_dbus_interface_get_info; |
| 26049 | skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties; |
| 26050 | skeleton_class->flush = button_skeleton_dbus_interface_flush; |
| 26051 | skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable; |
| 26052 | |
| 26053 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 26054 | g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate)); |
| 26055 | #endif |
| 26056 | } |
| 26057 | |
| 26058 | static void |
| 26059 | button_skeleton_iface_init (ButtonIface *iface) |
| 26060 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26061 | iface->released = _button_on_signal_released; |
| 26062 | iface->pressed = _button_on_signal_pressed; |
| 26063 | iface->pressed_long = _button_on_signal_pressed_long; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26064 | iface->get_state = button_skeleton_get_state; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26065 | iface->get_timer = button_skeleton_get_timer; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26066 | } |
| 26067 | |
| 26068 | /** |
| 26069 | * button_skeleton_new: |
| 26070 | * |
| 26071 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. |
| 26072 | * |
| 26073 | * Returns: (transfer full) (type ButtonSkeleton): The skeleton object. |
| 26074 | */ |
| 26075 | Button * |
| 26076 | button_skeleton_new (void) |
| 26077 | { |
| 26078 | return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL)); |
| 26079 | } |
| 26080 | |
| 26081 | /* ------------------------------------------------------------------------ |
| 26082 | * Code for interface org.openbmc.Led |
| 26083 | * ------------------------------------------------------------------------ |
| 26084 | */ |
| 26085 | |
| 26086 | /** |
| 26087 | * SECTION:Led |
| 26088 | * @title: Led |
| 26089 | * @short_description: Generated C code for the org.openbmc.Led D-Bus interface |
| 26090 | * |
| 26091 | * 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. |
| 26092 | */ |
| 26093 | |
| 26094 | /* ---- Introspection data for org.openbmc.Led ---- */ |
| 26095 | |
| 26096 | static const _ExtendedGDBusMethodInfo _led_method_info_set_on = |
| 26097 | { |
| 26098 | { |
| 26099 | -1, |
| 26100 | (gchar *) "setOn", |
| 26101 | NULL, |
| 26102 | NULL, |
| 26103 | NULL |
| 26104 | }, |
| 26105 | "handle-set-on", |
| 26106 | FALSE |
| 26107 | }; |
| 26108 | |
| 26109 | static const _ExtendedGDBusMethodInfo _led_method_info_set_off = |
| 26110 | { |
| 26111 | { |
| 26112 | -1, |
| 26113 | (gchar *) "setOff", |
| 26114 | NULL, |
| 26115 | NULL, |
| 26116 | NULL |
| 26117 | }, |
| 26118 | "handle-set-off", |
| 26119 | FALSE |
| 26120 | }; |
| 26121 | |
| 26122 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow = |
| 26123 | { |
| 26124 | { |
| 26125 | -1, |
| 26126 | (gchar *) "setBlinkSlow", |
| 26127 | NULL, |
| 26128 | NULL, |
| 26129 | NULL |
| 26130 | }, |
| 26131 | "handle-set-blink-slow", |
| 26132 | FALSE |
| 26133 | }; |
| 26134 | |
| 26135 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast = |
| 26136 | { |
| 26137 | { |
| 26138 | -1, |
| 26139 | (gchar *) "setBlinkFast", |
| 26140 | NULL, |
| 26141 | NULL, |
| 26142 | NULL |
| 26143 | }, |
| 26144 | "handle-set-blink-fast", |
| 26145 | FALSE |
| 26146 | }; |
| 26147 | |
| 26148 | static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] = |
| 26149 | { |
| 26150 | &_led_method_info_set_on, |
| 26151 | &_led_method_info_set_off, |
| 26152 | &_led_method_info_set_blink_slow, |
| 26153 | &_led_method_info_set_blink_fast, |
| 26154 | NULL |
| 26155 | }; |
| 26156 | |
| 26157 | static const _ExtendedGDBusPropertyInfo _led_property_info_color = |
| 26158 | { |
| 26159 | { |
| 26160 | -1, |
| 26161 | (gchar *) "color", |
| 26162 | (gchar *) "i", |
| 26163 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 26164 | NULL |
| 26165 | }, |
| 26166 | "color", |
| 26167 | FALSE |
| 26168 | }; |
| 26169 | |
| 26170 | static const _ExtendedGDBusPropertyInfo _led_property_info_function = |
| 26171 | { |
| 26172 | { |
| 26173 | -1, |
| 26174 | (gchar *) "function", |
| 26175 | (gchar *) "s", |
| 26176 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 26177 | NULL |
| 26178 | }, |
| 26179 | "function", |
| 26180 | FALSE |
| 26181 | }; |
| 26182 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26183 | static const _ExtendedGDBusPropertyInfo _led_property_info_state = |
| 26184 | { |
| 26185 | { |
| 26186 | -1, |
| 26187 | (gchar *) "state", |
| 26188 | (gchar *) "s", |
| 26189 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 26190 | NULL |
| 26191 | }, |
| 26192 | "state", |
| 26193 | FALSE |
| 26194 | }; |
| 26195 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26196 | static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] = |
| 26197 | { |
| 26198 | &_led_property_info_color, |
| 26199 | &_led_property_info_function, |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26200 | &_led_property_info_state, |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26201 | NULL |
| 26202 | }; |
| 26203 | |
| 26204 | static const _ExtendedGDBusInterfaceInfo _led_interface_info = |
| 26205 | { |
| 26206 | { |
| 26207 | -1, |
| 26208 | (gchar *) "org.openbmc.Led", |
| 26209 | (GDBusMethodInfo **) &_led_method_info_pointers, |
| 26210 | NULL, |
| 26211 | (GDBusPropertyInfo **) &_led_property_info_pointers, |
| 26212 | NULL |
| 26213 | }, |
| 26214 | "led", |
| 26215 | }; |
| 26216 | |
| 26217 | |
| 26218 | /** |
| 26219 | * led_interface_info: |
| 26220 | * |
| 26221 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface. |
| 26222 | * |
| 26223 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 26224 | */ |
| 26225 | GDBusInterfaceInfo * |
| 26226 | led_interface_info (void) |
| 26227 | { |
| 26228 | return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct; |
| 26229 | } |
| 26230 | |
| 26231 | /** |
| 26232 | * led_override_properties: |
| 26233 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 26234 | * @property_id_begin: The property id to assign to the first overridden property. |
| 26235 | * |
| 26236 | * Overrides all #GObject properties in the #Led interface for a concrete class. |
| 26237 | * The properties are overridden in the order they are defined. |
| 26238 | * |
| 26239 | * Returns: The last property id. |
| 26240 | */ |
| 26241 | guint |
| 26242 | led_override_properties (GObjectClass *klass, guint property_id_begin) |
| 26243 | { |
| 26244 | g_object_class_override_property (klass, property_id_begin++, "color"); |
| 26245 | g_object_class_override_property (klass, property_id_begin++, "function"); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26246 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26247 | return property_id_begin - 1; |
| 26248 | } |
| 26249 | |
| 26250 | |
| 26251 | |
| 26252 | /** |
| 26253 | * Led: |
| 26254 | * |
| 26255 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 26256 | */ |
| 26257 | |
| 26258 | /** |
| 26259 | * LedIface: |
| 26260 | * @parent_iface: The parent interface. |
| 26261 | * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal. |
| 26262 | * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal. |
| 26263 | * @handle_set_off: Handler for the #Led::handle-set-off signal. |
| 26264 | * @handle_set_on: Handler for the #Led::handle-set-on signal. |
| 26265 | * @get_color: Getter for the #Led:color property. |
| 26266 | * @get_function: Getter for the #Led:function property. |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26267 | * @get_state: Getter for the #Led:state property. |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26268 | * |
| 26269 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 26270 | */ |
| 26271 | |
| 26272 | typedef LedIface LedInterface; |
| 26273 | G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT); |
| 26274 | |
| 26275 | static void |
| 26276 | led_default_init (LedIface *iface) |
| 26277 | { |
| 26278 | /* GObject signals for incoming D-Bus method calls: */ |
| 26279 | /** |
| 26280 | * Led::handle-set-on: |
| 26281 | * @object: A #Led. |
| 26282 | * @invocation: A #GDBusMethodInvocation. |
| 26283 | * |
| 26284 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. |
| 26285 | * |
| 26286 | * 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. |
| 26287 | * |
| 26288 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 26289 | */ |
| 26290 | g_signal_new ("handle-set-on", |
| 26291 | G_TYPE_FROM_INTERFACE (iface), |
| 26292 | G_SIGNAL_RUN_LAST, |
| 26293 | G_STRUCT_OFFSET (LedIface, handle_set_on), |
| 26294 | g_signal_accumulator_true_handled, |
| 26295 | NULL, |
| 26296 | g_cclosure_marshal_generic, |
| 26297 | G_TYPE_BOOLEAN, |
| 26298 | 1, |
| 26299 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 26300 | |
| 26301 | /** |
| 26302 | * Led::handle-set-off: |
| 26303 | * @object: A #Led. |
| 26304 | * @invocation: A #GDBusMethodInvocation. |
| 26305 | * |
| 26306 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. |
| 26307 | * |
| 26308 | * 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. |
| 26309 | * |
| 26310 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 26311 | */ |
| 26312 | g_signal_new ("handle-set-off", |
| 26313 | G_TYPE_FROM_INTERFACE (iface), |
| 26314 | G_SIGNAL_RUN_LAST, |
| 26315 | G_STRUCT_OFFSET (LedIface, handle_set_off), |
| 26316 | g_signal_accumulator_true_handled, |
| 26317 | NULL, |
| 26318 | g_cclosure_marshal_generic, |
| 26319 | G_TYPE_BOOLEAN, |
| 26320 | 1, |
| 26321 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 26322 | |
| 26323 | /** |
| 26324 | * Led::handle-set-blink-slow: |
| 26325 | * @object: A #Led. |
| 26326 | * @invocation: A #GDBusMethodInvocation. |
| 26327 | * |
| 26328 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. |
| 26329 | * |
| 26330 | * 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. |
| 26331 | * |
| 26332 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 26333 | */ |
| 26334 | g_signal_new ("handle-set-blink-slow", |
| 26335 | G_TYPE_FROM_INTERFACE (iface), |
| 26336 | G_SIGNAL_RUN_LAST, |
| 26337 | G_STRUCT_OFFSET (LedIface, handle_set_blink_slow), |
| 26338 | g_signal_accumulator_true_handled, |
| 26339 | NULL, |
| 26340 | g_cclosure_marshal_generic, |
| 26341 | G_TYPE_BOOLEAN, |
| 26342 | 1, |
| 26343 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 26344 | |
| 26345 | /** |
| 26346 | * Led::handle-set-blink-fast: |
| 26347 | * @object: A #Led. |
| 26348 | * @invocation: A #GDBusMethodInvocation. |
| 26349 | * |
| 26350 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. |
| 26351 | * |
| 26352 | * 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. |
| 26353 | * |
| 26354 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 26355 | */ |
| 26356 | g_signal_new ("handle-set-blink-fast", |
| 26357 | G_TYPE_FROM_INTERFACE (iface), |
| 26358 | G_SIGNAL_RUN_LAST, |
| 26359 | G_STRUCT_OFFSET (LedIface, handle_set_blink_fast), |
| 26360 | g_signal_accumulator_true_handled, |
| 26361 | NULL, |
| 26362 | g_cclosure_marshal_generic, |
| 26363 | G_TYPE_BOOLEAN, |
| 26364 | 1, |
| 26365 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 26366 | |
| 26367 | /* GObject properties for D-Bus properties: */ |
| 26368 | /** |
| 26369 | * Led:color: |
| 26370 | * |
| 26371 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>. |
| 26372 | * |
| 26373 | * 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. |
| 26374 | */ |
| 26375 | g_object_interface_install_property (iface, |
| 26376 | g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 26377 | /** |
| 26378 | * Led:function: |
| 26379 | * |
| 26380 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>. |
| 26381 | * |
| 26382 | * 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. |
| 26383 | */ |
| 26384 | g_object_interface_install_property (iface, |
| 26385 | 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] | 26386 | /** |
| 26387 | * Led:state: |
| 26388 | * |
| 26389 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>. |
| 26390 | * |
| 26391 | * 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. |
| 26392 | */ |
| 26393 | g_object_interface_install_property (iface, |
| 26394 | 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] | 26395 | } |
| 26396 | |
| 26397 | /** |
| 26398 | * led_get_color: (skip) |
| 26399 | * @object: A #Led. |
| 26400 | * |
| 26401 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property. |
| 26402 | * |
| 26403 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 26404 | * |
| 26405 | * Returns: The property value. |
| 26406 | */ |
| 26407 | gint |
| 26408 | led_get_color (Led *object) |
| 26409 | { |
| 26410 | return LED_GET_IFACE (object)->get_color (object); |
| 26411 | } |
| 26412 | |
| 26413 | /** |
| 26414 | * led_set_color: (skip) |
| 26415 | * @object: A #Led. |
| 26416 | * @value: The value to set. |
| 26417 | * |
| 26418 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value. |
| 26419 | * |
| 26420 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 26421 | */ |
| 26422 | void |
| 26423 | led_set_color (Led *object, gint value) |
| 26424 | { |
| 26425 | g_object_set (G_OBJECT (object), "color", value, NULL); |
| 26426 | } |
| 26427 | |
| 26428 | /** |
| 26429 | * led_get_function: (skip) |
| 26430 | * @object: A #Led. |
| 26431 | * |
| 26432 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 26433 | * |
| 26434 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 26435 | * |
| 26436 | * <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> |
| 26437 | * |
| 26438 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 26439 | */ |
| 26440 | const gchar * |
| 26441 | led_get_function (Led *object) |
| 26442 | { |
| 26443 | return LED_GET_IFACE (object)->get_function (object); |
| 26444 | } |
| 26445 | |
| 26446 | /** |
| 26447 | * led_dup_function: (skip) |
| 26448 | * @object: A #Led. |
| 26449 | * |
| 26450 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. |
| 26451 | * |
| 26452 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 26453 | * |
| 26454 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 26455 | */ |
| 26456 | gchar * |
| 26457 | led_dup_function (Led *object) |
| 26458 | { |
| 26459 | gchar *value; |
| 26460 | g_object_get (G_OBJECT (object), "function", &value, NULL); |
| 26461 | return value; |
| 26462 | } |
| 26463 | |
| 26464 | /** |
| 26465 | * led_set_function: (skip) |
| 26466 | * @object: A #Led. |
| 26467 | * @value: The value to set. |
| 26468 | * |
| 26469 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value. |
| 26470 | * |
| 26471 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 26472 | */ |
| 26473 | void |
| 26474 | led_set_function (Led *object, const gchar *value) |
| 26475 | { |
| 26476 | g_object_set (G_OBJECT (object), "function", value, NULL); |
| 26477 | } |
| 26478 | |
| 26479 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 26480 | * led_get_state: (skip) |
| 26481 | * @object: A #Led. |
| 26482 | * |
| 26483 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. |
| 26484 | * |
| 26485 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 26486 | * |
| 26487 | * <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> |
| 26488 | * |
| 26489 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 26490 | */ |
| 26491 | const gchar * |
| 26492 | led_get_state (Led *object) |
| 26493 | { |
| 26494 | return LED_GET_IFACE (object)->get_state (object); |
| 26495 | } |
| 26496 | |
| 26497 | /** |
| 26498 | * led_dup_state: (skip) |
| 26499 | * @object: A #Led. |
| 26500 | * |
| 26501 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. |
| 26502 | * |
| 26503 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 26504 | * |
| 26505 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 26506 | */ |
| 26507 | gchar * |
| 26508 | led_dup_state (Led *object) |
| 26509 | { |
| 26510 | gchar *value; |
| 26511 | g_object_get (G_OBJECT (object), "state", &value, NULL); |
| 26512 | return value; |
| 26513 | } |
| 26514 | |
| 26515 | /** |
| 26516 | * led_set_state: (skip) |
| 26517 | * @object: A #Led. |
| 26518 | * @value: The value to set. |
| 26519 | * |
| 26520 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value. |
| 26521 | * |
| 26522 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 26523 | */ |
| 26524 | void |
| 26525 | led_set_state (Led *object, const gchar *value) |
| 26526 | { |
| 26527 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 26528 | } |
| 26529 | |
| 26530 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 26531 | * led_call_set_on: |
| 26532 | * @proxy: A #LedProxy. |
| 26533 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26534 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26535 | * @user_data: User data to pass to @callback. |
| 26536 | * |
| 26537 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. |
| 26538 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 26539 | * You can then call led_call_set_on_finish() to get the result of the operation. |
| 26540 | * |
| 26541 | * See led_call_set_on_sync() for the synchronous, blocking version of this method. |
| 26542 | */ |
| 26543 | void |
| 26544 | led_call_set_on ( |
| 26545 | Led *proxy, |
| 26546 | GCancellable *cancellable, |
| 26547 | GAsyncReadyCallback callback, |
| 26548 | gpointer user_data) |
| 26549 | { |
| 26550 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 26551 | "setOn", |
| 26552 | g_variant_new ("()"), |
| 26553 | G_DBUS_CALL_FLAGS_NONE, |
| 26554 | -1, |
| 26555 | cancellable, |
| 26556 | callback, |
| 26557 | user_data); |
| 26558 | } |
| 26559 | |
| 26560 | /** |
| 26561 | * led_call_set_on_finish: |
| 26562 | * @proxy: A #LedProxy. |
| 26563 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on(). |
| 26564 | * @error: Return location for error or %NULL. |
| 26565 | * |
| 26566 | * Finishes an operation started with led_call_set_on(). |
| 26567 | * |
| 26568 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26569 | */ |
| 26570 | gboolean |
| 26571 | led_call_set_on_finish ( |
| 26572 | Led *proxy, |
| 26573 | GAsyncResult *res, |
| 26574 | GError **error) |
| 26575 | { |
| 26576 | GVariant *_ret; |
| 26577 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26578 | if (_ret == NULL) |
| 26579 | goto _out; |
| 26580 | g_variant_get (_ret, |
| 26581 | "()"); |
| 26582 | g_variant_unref (_ret); |
| 26583 | _out: |
| 26584 | return _ret != NULL; |
| 26585 | } |
| 26586 | |
| 26587 | /** |
| 26588 | * led_call_set_on_sync: |
| 26589 | * @proxy: A #LedProxy. |
| 26590 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26591 | * @error: Return location for error or %NULL. |
| 26592 | * |
| 26593 | * 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. |
| 26594 | * |
| 26595 | * See led_call_set_on() for the asynchronous version of this method. |
| 26596 | * |
| 26597 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26598 | */ |
| 26599 | gboolean |
| 26600 | led_call_set_on_sync ( |
| 26601 | Led *proxy, |
| 26602 | GCancellable *cancellable, |
| 26603 | GError **error) |
| 26604 | { |
| 26605 | GVariant *_ret; |
| 26606 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26607 | "setOn", |
| 26608 | g_variant_new ("()"), |
| 26609 | G_DBUS_CALL_FLAGS_NONE, |
| 26610 | -1, |
| 26611 | cancellable, |
| 26612 | error); |
| 26613 | if (_ret == NULL) |
| 26614 | goto _out; |
| 26615 | g_variant_get (_ret, |
| 26616 | "()"); |
| 26617 | g_variant_unref (_ret); |
| 26618 | _out: |
| 26619 | return _ret != NULL; |
| 26620 | } |
| 26621 | |
| 26622 | /** |
| 26623 | * led_call_set_off: |
| 26624 | * @proxy: A #LedProxy. |
| 26625 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26626 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26627 | * @user_data: User data to pass to @callback. |
| 26628 | * |
| 26629 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. |
| 26630 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 26631 | * You can then call led_call_set_off_finish() to get the result of the operation. |
| 26632 | * |
| 26633 | * See led_call_set_off_sync() for the synchronous, blocking version of this method. |
| 26634 | */ |
| 26635 | void |
| 26636 | led_call_set_off ( |
| 26637 | Led *proxy, |
| 26638 | GCancellable *cancellable, |
| 26639 | GAsyncReadyCallback callback, |
| 26640 | gpointer user_data) |
| 26641 | { |
| 26642 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 26643 | "setOff", |
| 26644 | g_variant_new ("()"), |
| 26645 | G_DBUS_CALL_FLAGS_NONE, |
| 26646 | -1, |
| 26647 | cancellable, |
| 26648 | callback, |
| 26649 | user_data); |
| 26650 | } |
| 26651 | |
| 26652 | /** |
| 26653 | * led_call_set_off_finish: |
| 26654 | * @proxy: A #LedProxy. |
| 26655 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off(). |
| 26656 | * @error: Return location for error or %NULL. |
| 26657 | * |
| 26658 | * Finishes an operation started with led_call_set_off(). |
| 26659 | * |
| 26660 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26661 | */ |
| 26662 | gboolean |
| 26663 | led_call_set_off_finish ( |
| 26664 | Led *proxy, |
| 26665 | GAsyncResult *res, |
| 26666 | GError **error) |
| 26667 | { |
| 26668 | GVariant *_ret; |
| 26669 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26670 | if (_ret == NULL) |
| 26671 | goto _out; |
| 26672 | g_variant_get (_ret, |
| 26673 | "()"); |
| 26674 | g_variant_unref (_ret); |
| 26675 | _out: |
| 26676 | return _ret != NULL; |
| 26677 | } |
| 26678 | |
| 26679 | /** |
| 26680 | * led_call_set_off_sync: |
| 26681 | * @proxy: A #LedProxy. |
| 26682 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26683 | * @error: Return location for error or %NULL. |
| 26684 | * |
| 26685 | * 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. |
| 26686 | * |
| 26687 | * See led_call_set_off() for the asynchronous version of this method. |
| 26688 | * |
| 26689 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26690 | */ |
| 26691 | gboolean |
| 26692 | led_call_set_off_sync ( |
| 26693 | Led *proxy, |
| 26694 | GCancellable *cancellable, |
| 26695 | GError **error) |
| 26696 | { |
| 26697 | GVariant *_ret; |
| 26698 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26699 | "setOff", |
| 26700 | g_variant_new ("()"), |
| 26701 | G_DBUS_CALL_FLAGS_NONE, |
| 26702 | -1, |
| 26703 | cancellable, |
| 26704 | error); |
| 26705 | if (_ret == NULL) |
| 26706 | goto _out; |
| 26707 | g_variant_get (_ret, |
| 26708 | "()"); |
| 26709 | g_variant_unref (_ret); |
| 26710 | _out: |
| 26711 | return _ret != NULL; |
| 26712 | } |
| 26713 | |
| 26714 | /** |
| 26715 | * led_call_set_blink_slow: |
| 26716 | * @proxy: A #LedProxy. |
| 26717 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26718 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26719 | * @user_data: User data to pass to @callback. |
| 26720 | * |
| 26721 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. |
| 26722 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 26723 | * You can then call led_call_set_blink_slow_finish() to get the result of the operation. |
| 26724 | * |
| 26725 | * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method. |
| 26726 | */ |
| 26727 | void |
| 26728 | led_call_set_blink_slow ( |
| 26729 | Led *proxy, |
| 26730 | GCancellable *cancellable, |
| 26731 | GAsyncReadyCallback callback, |
| 26732 | gpointer user_data) |
| 26733 | { |
| 26734 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 26735 | "setBlinkSlow", |
| 26736 | g_variant_new ("()"), |
| 26737 | G_DBUS_CALL_FLAGS_NONE, |
| 26738 | -1, |
| 26739 | cancellable, |
| 26740 | callback, |
| 26741 | user_data); |
| 26742 | } |
| 26743 | |
| 26744 | /** |
| 26745 | * led_call_set_blink_slow_finish: |
| 26746 | * @proxy: A #LedProxy. |
| 26747 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow(). |
| 26748 | * @error: Return location for error or %NULL. |
| 26749 | * |
| 26750 | * Finishes an operation started with led_call_set_blink_slow(). |
| 26751 | * |
| 26752 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26753 | */ |
| 26754 | gboolean |
| 26755 | led_call_set_blink_slow_finish ( |
| 26756 | Led *proxy, |
| 26757 | GAsyncResult *res, |
| 26758 | GError **error) |
| 26759 | { |
| 26760 | GVariant *_ret; |
| 26761 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26762 | if (_ret == NULL) |
| 26763 | goto _out; |
| 26764 | g_variant_get (_ret, |
| 26765 | "()"); |
| 26766 | g_variant_unref (_ret); |
| 26767 | _out: |
| 26768 | return _ret != NULL; |
| 26769 | } |
| 26770 | |
| 26771 | /** |
| 26772 | * led_call_set_blink_slow_sync: |
| 26773 | * @proxy: A #LedProxy. |
| 26774 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26775 | * @error: Return location for error or %NULL. |
| 26776 | * |
| 26777 | * 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. |
| 26778 | * |
| 26779 | * See led_call_set_blink_slow() for the asynchronous version of this method. |
| 26780 | * |
| 26781 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26782 | */ |
| 26783 | gboolean |
| 26784 | led_call_set_blink_slow_sync ( |
| 26785 | Led *proxy, |
| 26786 | GCancellable *cancellable, |
| 26787 | GError **error) |
| 26788 | { |
| 26789 | GVariant *_ret; |
| 26790 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26791 | "setBlinkSlow", |
| 26792 | g_variant_new ("()"), |
| 26793 | G_DBUS_CALL_FLAGS_NONE, |
| 26794 | -1, |
| 26795 | cancellable, |
| 26796 | error); |
| 26797 | if (_ret == NULL) |
| 26798 | goto _out; |
| 26799 | g_variant_get (_ret, |
| 26800 | "()"); |
| 26801 | g_variant_unref (_ret); |
| 26802 | _out: |
| 26803 | return _ret != NULL; |
| 26804 | } |
| 26805 | |
| 26806 | /** |
| 26807 | * led_call_set_blink_fast: |
| 26808 | * @proxy: A #LedProxy. |
| 26809 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26810 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 26811 | * @user_data: User data to pass to @callback. |
| 26812 | * |
| 26813 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. |
| 26814 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 26815 | * You can then call led_call_set_blink_fast_finish() to get the result of the operation. |
| 26816 | * |
| 26817 | * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method. |
| 26818 | */ |
| 26819 | void |
| 26820 | led_call_set_blink_fast ( |
| 26821 | Led *proxy, |
| 26822 | GCancellable *cancellable, |
| 26823 | GAsyncReadyCallback callback, |
| 26824 | gpointer user_data) |
| 26825 | { |
| 26826 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 26827 | "setBlinkFast", |
| 26828 | g_variant_new ("()"), |
| 26829 | G_DBUS_CALL_FLAGS_NONE, |
| 26830 | -1, |
| 26831 | cancellable, |
| 26832 | callback, |
| 26833 | user_data); |
| 26834 | } |
| 26835 | |
| 26836 | /** |
| 26837 | * led_call_set_blink_fast_finish: |
| 26838 | * @proxy: A #LedProxy. |
| 26839 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast(). |
| 26840 | * @error: Return location for error or %NULL. |
| 26841 | * |
| 26842 | * Finishes an operation started with led_call_set_blink_fast(). |
| 26843 | * |
| 26844 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26845 | */ |
| 26846 | gboolean |
| 26847 | led_call_set_blink_fast_finish ( |
| 26848 | Led *proxy, |
| 26849 | GAsyncResult *res, |
| 26850 | GError **error) |
| 26851 | { |
| 26852 | GVariant *_ret; |
| 26853 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 26854 | if (_ret == NULL) |
| 26855 | goto _out; |
| 26856 | g_variant_get (_ret, |
| 26857 | "()"); |
| 26858 | g_variant_unref (_ret); |
| 26859 | _out: |
| 26860 | return _ret != NULL; |
| 26861 | } |
| 26862 | |
| 26863 | /** |
| 26864 | * led_call_set_blink_fast_sync: |
| 26865 | * @proxy: A #LedProxy. |
| 26866 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 26867 | * @error: Return location for error or %NULL. |
| 26868 | * |
| 26869 | * 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. |
| 26870 | * |
| 26871 | * See led_call_set_blink_fast() for the asynchronous version of this method. |
| 26872 | * |
| 26873 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 26874 | */ |
| 26875 | gboolean |
| 26876 | led_call_set_blink_fast_sync ( |
| 26877 | Led *proxy, |
| 26878 | GCancellable *cancellable, |
| 26879 | GError **error) |
| 26880 | { |
| 26881 | GVariant *_ret; |
| 26882 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 26883 | "setBlinkFast", |
| 26884 | g_variant_new ("()"), |
| 26885 | G_DBUS_CALL_FLAGS_NONE, |
| 26886 | -1, |
| 26887 | cancellable, |
| 26888 | error); |
| 26889 | if (_ret == NULL) |
| 26890 | goto _out; |
| 26891 | g_variant_get (_ret, |
| 26892 | "()"); |
| 26893 | g_variant_unref (_ret); |
| 26894 | _out: |
| 26895 | return _ret != NULL; |
| 26896 | } |
| 26897 | |
| 26898 | /** |
| 26899 | * led_complete_set_on: |
| 26900 | * @object: A #Led. |
| 26901 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26902 | * |
| 26903 | * 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. |
| 26904 | * |
| 26905 | * This method will free @invocation, you cannot use it afterwards. |
| 26906 | */ |
| 26907 | void |
| 26908 | led_complete_set_on ( |
| 26909 | Led *object, |
| 26910 | GDBusMethodInvocation *invocation) |
| 26911 | { |
| 26912 | g_dbus_method_invocation_return_value (invocation, |
| 26913 | g_variant_new ("()")); |
| 26914 | } |
| 26915 | |
| 26916 | /** |
| 26917 | * led_complete_set_off: |
| 26918 | * @object: A #Led. |
| 26919 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26920 | * |
| 26921 | * 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. |
| 26922 | * |
| 26923 | * This method will free @invocation, you cannot use it afterwards. |
| 26924 | */ |
| 26925 | void |
| 26926 | led_complete_set_off ( |
| 26927 | Led *object, |
| 26928 | GDBusMethodInvocation *invocation) |
| 26929 | { |
| 26930 | g_dbus_method_invocation_return_value (invocation, |
| 26931 | g_variant_new ("()")); |
| 26932 | } |
| 26933 | |
| 26934 | /** |
| 26935 | * led_complete_set_blink_slow: |
| 26936 | * @object: A #Led. |
| 26937 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26938 | * |
| 26939 | * 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. |
| 26940 | * |
| 26941 | * This method will free @invocation, you cannot use it afterwards. |
| 26942 | */ |
| 26943 | void |
| 26944 | led_complete_set_blink_slow ( |
| 26945 | Led *object, |
| 26946 | GDBusMethodInvocation *invocation) |
| 26947 | { |
| 26948 | g_dbus_method_invocation_return_value (invocation, |
| 26949 | g_variant_new ("()")); |
| 26950 | } |
| 26951 | |
| 26952 | /** |
| 26953 | * led_complete_set_blink_fast: |
| 26954 | * @object: A #Led. |
| 26955 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 26956 | * |
| 26957 | * 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. |
| 26958 | * |
| 26959 | * This method will free @invocation, you cannot use it afterwards. |
| 26960 | */ |
| 26961 | void |
| 26962 | led_complete_set_blink_fast ( |
| 26963 | Led *object, |
| 26964 | GDBusMethodInvocation *invocation) |
| 26965 | { |
| 26966 | g_dbus_method_invocation_return_value (invocation, |
| 26967 | g_variant_new ("()")); |
| 26968 | } |
| 26969 | |
| 26970 | /* ------------------------------------------------------------------------ */ |
| 26971 | |
| 26972 | /** |
| 26973 | * LedProxy: |
| 26974 | * |
| 26975 | * The #LedProxy structure contains only private data and should only be accessed using the provided API. |
| 26976 | */ |
| 26977 | |
| 26978 | /** |
| 26979 | * LedProxyClass: |
| 26980 | * @parent_class: The parent class. |
| 26981 | * |
| 26982 | * Class structure for #LedProxy. |
| 26983 | */ |
| 26984 | |
| 26985 | struct _LedProxyPrivate |
| 26986 | { |
| 26987 | GData *qdata; |
| 26988 | }; |
| 26989 | |
| 26990 | static void led_proxy_iface_init (LedIface *iface); |
| 26991 | |
| 26992 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 26993 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 26994 | G_ADD_PRIVATE (LedProxy) |
| 26995 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 26996 | |
| 26997 | #else |
| 26998 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, |
| 26999 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); |
| 27000 | |
| 27001 | #endif |
| 27002 | static void |
| 27003 | led_proxy_finalize (GObject *object) |
| 27004 | { |
| 27005 | LedProxy *proxy = LED_PROXY (object); |
| 27006 | g_datalist_clear (&proxy->priv->qdata); |
| 27007 | G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object); |
| 27008 | } |
| 27009 | |
| 27010 | static void |
| 27011 | led_proxy_get_property (GObject *object, |
| 27012 | guint prop_id, |
| 27013 | GValue *value, |
| 27014 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27015 | { |
| 27016 | const _ExtendedGDBusPropertyInfo *info; |
| 27017 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27018 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27019 | info = _led_property_info_pointers[prop_id - 1]; |
| 27020 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 27021 | if (info->use_gvariant) |
| 27022 | { |
| 27023 | g_value_set_variant (value, variant); |
| 27024 | } |
| 27025 | else |
| 27026 | { |
| 27027 | if (variant != NULL) |
| 27028 | g_dbus_gvariant_to_gvalue (variant, value); |
| 27029 | } |
| 27030 | if (variant != NULL) |
| 27031 | g_variant_unref (variant); |
| 27032 | } |
| 27033 | |
| 27034 | static void |
| 27035 | led_proxy_set_property_cb (GDBusProxy *proxy, |
| 27036 | GAsyncResult *res, |
| 27037 | gpointer user_data) |
| 27038 | { |
| 27039 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 27040 | GError *error; |
| 27041 | GVariant *_ret; |
| 27042 | error = NULL; |
| 27043 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 27044 | if (!_ret) |
| 27045 | { |
| 27046 | g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)", |
| 27047 | info->parent_struct.name, |
| 27048 | error->message, g_quark_to_string (error->domain), error->code); |
| 27049 | g_error_free (error); |
| 27050 | } |
| 27051 | else |
| 27052 | { |
| 27053 | g_variant_unref (_ret); |
| 27054 | } |
| 27055 | } |
| 27056 | |
| 27057 | static void |
| 27058 | led_proxy_set_property (GObject *object, |
| 27059 | guint prop_id, |
| 27060 | const GValue *value, |
| 27061 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27062 | { |
| 27063 | const _ExtendedGDBusPropertyInfo *info; |
| 27064 | GVariant *variant; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27065 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27066 | info = _led_property_info_pointers[prop_id - 1]; |
| 27067 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 27068 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 27069 | "org.freedesktop.DBus.Properties.Set", |
| 27070 | g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant), |
| 27071 | G_DBUS_CALL_FLAGS_NONE, |
| 27072 | -1, |
| 27073 | NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 27074 | g_variant_unref (variant); |
| 27075 | } |
| 27076 | |
| 27077 | static void |
| 27078 | led_proxy_g_signal (GDBusProxy *proxy, |
| 27079 | const gchar *sender_name G_GNUC_UNUSED, |
| 27080 | const gchar *signal_name, |
| 27081 | GVariant *parameters) |
| 27082 | { |
| 27083 | _ExtendedGDBusSignalInfo *info; |
| 27084 | GVariantIter iter; |
| 27085 | GVariant *child; |
| 27086 | GValue *paramv; |
| 27087 | guint num_params; |
| 27088 | guint n; |
| 27089 | guint signal_id; |
| 27090 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name); |
| 27091 | if (info == NULL) |
| 27092 | return; |
| 27093 | num_params = g_variant_n_children (parameters); |
| 27094 | paramv = g_new0 (GValue, num_params + 1); |
| 27095 | g_value_init (¶mv[0], TYPE_LED); |
| 27096 | g_value_set_object (¶mv[0], proxy); |
| 27097 | g_variant_iter_init (&iter, parameters); |
| 27098 | n = 1; |
| 27099 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 27100 | { |
| 27101 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 27102 | if (arg_info->use_gvariant) |
| 27103 | { |
| 27104 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 27105 | g_value_set_variant (¶mv[n], child); |
| 27106 | n++; |
| 27107 | } |
| 27108 | else |
| 27109 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 27110 | g_variant_unref (child); |
| 27111 | } |
| 27112 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 27113 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 27114 | for (n = 0; n < num_params + 1; n++) |
| 27115 | g_value_unset (¶mv[n]); |
| 27116 | g_free (paramv); |
| 27117 | } |
| 27118 | |
| 27119 | static void |
| 27120 | led_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 27121 | GVariant *changed_properties, |
| 27122 | const gchar *const *invalidated_properties) |
| 27123 | { |
| 27124 | LedProxy *proxy = LED_PROXY (_proxy); |
| 27125 | guint n; |
| 27126 | const gchar *key; |
| 27127 | GVariantIter *iter; |
| 27128 | _ExtendedGDBusPropertyInfo *info; |
| 27129 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 27130 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 27131 | { |
| 27132 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key); |
| 27133 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 27134 | if (info != NULL) |
| 27135 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 27136 | } |
| 27137 | g_variant_iter_free (iter); |
| 27138 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 27139 | { |
| 27140 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]); |
| 27141 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 27142 | if (info != NULL) |
| 27143 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 27144 | } |
| 27145 | } |
| 27146 | |
| 27147 | static gint |
| 27148 | led_proxy_get_color (Led *object) |
| 27149 | { |
| 27150 | LedProxy *proxy = LED_PROXY (object); |
| 27151 | GVariant *variant; |
| 27152 | gint value = 0; |
| 27153 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color"); |
| 27154 | if (variant != NULL) |
| 27155 | { |
| 27156 | value = g_variant_get_int32 (variant); |
| 27157 | g_variant_unref (variant); |
| 27158 | } |
| 27159 | return value; |
| 27160 | } |
| 27161 | |
| 27162 | static const gchar * |
| 27163 | led_proxy_get_function (Led *object) |
| 27164 | { |
| 27165 | LedProxy *proxy = LED_PROXY (object); |
| 27166 | GVariant *variant; |
| 27167 | const gchar *value = NULL; |
| 27168 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function"); |
| 27169 | if (variant != NULL) |
| 27170 | { |
| 27171 | value = g_variant_get_string (variant, NULL); |
| 27172 | g_variant_unref (variant); |
| 27173 | } |
| 27174 | return value; |
| 27175 | } |
| 27176 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27177 | static const gchar * |
| 27178 | led_proxy_get_state (Led *object) |
| 27179 | { |
| 27180 | LedProxy *proxy = LED_PROXY (object); |
| 27181 | GVariant *variant; |
| 27182 | const gchar *value = NULL; |
| 27183 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 27184 | if (variant != NULL) |
| 27185 | { |
| 27186 | value = g_variant_get_string (variant, NULL); |
| 27187 | g_variant_unref (variant); |
| 27188 | } |
| 27189 | return value; |
| 27190 | } |
| 27191 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27192 | static void |
| 27193 | led_proxy_init (LedProxy *proxy) |
| 27194 | { |
| 27195 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 27196 | proxy->priv = led_proxy_get_instance_private (proxy); |
| 27197 | #else |
| 27198 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate); |
| 27199 | #endif |
| 27200 | |
| 27201 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ()); |
| 27202 | } |
| 27203 | |
| 27204 | static void |
| 27205 | led_proxy_class_init (LedProxyClass *klass) |
| 27206 | { |
| 27207 | GObjectClass *gobject_class; |
| 27208 | GDBusProxyClass *proxy_class; |
| 27209 | |
| 27210 | gobject_class = G_OBJECT_CLASS (klass); |
| 27211 | gobject_class->finalize = led_proxy_finalize; |
| 27212 | gobject_class->get_property = led_proxy_get_property; |
| 27213 | gobject_class->set_property = led_proxy_set_property; |
| 27214 | |
| 27215 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 27216 | proxy_class->g_signal = led_proxy_g_signal; |
| 27217 | proxy_class->g_properties_changed = led_proxy_g_properties_changed; |
| 27218 | |
| 27219 | led_override_properties (gobject_class, 1); |
| 27220 | |
| 27221 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 27222 | g_type_class_add_private (klass, sizeof (LedProxyPrivate)); |
| 27223 | #endif |
| 27224 | } |
| 27225 | |
| 27226 | static void |
| 27227 | led_proxy_iface_init (LedIface *iface) |
| 27228 | { |
| 27229 | iface->get_color = led_proxy_get_color; |
| 27230 | iface->get_function = led_proxy_get_function; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27231 | iface->get_state = led_proxy_get_state; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27232 | } |
| 27233 | |
| 27234 | /** |
| 27235 | * led_proxy_new: |
| 27236 | * @connection: A #GDBusConnection. |
| 27237 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 27238 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 27239 | * @object_path: An object path. |
| 27240 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27241 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 27242 | * @user_data: User data to pass to @callback. |
| 27243 | * |
| 27244 | * 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. |
| 27245 | * |
| 27246 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 27247 | * You can then call led_proxy_new_finish() to get the result of the operation. |
| 27248 | * |
| 27249 | * See led_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 27250 | */ |
| 27251 | void |
| 27252 | led_proxy_new ( |
| 27253 | GDBusConnection *connection, |
| 27254 | GDBusProxyFlags flags, |
| 27255 | const gchar *name, |
| 27256 | const gchar *object_path, |
| 27257 | GCancellable *cancellable, |
| 27258 | GAsyncReadyCallback callback, |
| 27259 | gpointer user_data) |
| 27260 | { |
| 27261 | 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); |
| 27262 | } |
| 27263 | |
| 27264 | /** |
| 27265 | * led_proxy_new_finish: |
| 27266 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new(). |
| 27267 | * @error: Return location for error or %NULL |
| 27268 | * |
| 27269 | * Finishes an operation started with led_proxy_new(). |
| 27270 | * |
| 27271 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 27272 | */ |
| 27273 | Led * |
| 27274 | led_proxy_new_finish ( |
| 27275 | GAsyncResult *res, |
| 27276 | GError **error) |
| 27277 | { |
| 27278 | GObject *ret; |
| 27279 | GObject *source_object; |
| 27280 | source_object = g_async_result_get_source_object (res); |
| 27281 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 27282 | g_object_unref (source_object); |
| 27283 | if (ret != NULL) |
| 27284 | return LED (ret); |
| 27285 | else |
| 27286 | return NULL; |
| 27287 | } |
| 27288 | |
| 27289 | /** |
| 27290 | * led_proxy_new_sync: |
| 27291 | * @connection: A #GDBusConnection. |
| 27292 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 27293 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 27294 | * @object_path: An object path. |
| 27295 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27296 | * @error: Return location for error or %NULL |
| 27297 | * |
| 27298 | * 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. |
| 27299 | * |
| 27300 | * The calling thread is blocked until a reply is received. |
| 27301 | * |
| 27302 | * See led_proxy_new() for the asynchronous version of this constructor. |
| 27303 | * |
| 27304 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 27305 | */ |
| 27306 | Led * |
| 27307 | led_proxy_new_sync ( |
| 27308 | GDBusConnection *connection, |
| 27309 | GDBusProxyFlags flags, |
| 27310 | const gchar *name, |
| 27311 | const gchar *object_path, |
| 27312 | GCancellable *cancellable, |
| 27313 | GError **error) |
| 27314 | { |
| 27315 | GInitable *ret; |
| 27316 | 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); |
| 27317 | if (ret != NULL) |
| 27318 | return LED (ret); |
| 27319 | else |
| 27320 | return NULL; |
| 27321 | } |
| 27322 | |
| 27323 | |
| 27324 | /** |
| 27325 | * led_proxy_new_for_bus: |
| 27326 | * @bus_type: A #GBusType. |
| 27327 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 27328 | * @name: A bus name (well-known or unique). |
| 27329 | * @object_path: An object path. |
| 27330 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27331 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 27332 | * @user_data: User data to pass to @callback. |
| 27333 | * |
| 27334 | * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 27335 | * |
| 27336 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 27337 | * You can then call led_proxy_new_for_bus_finish() to get the result of the operation. |
| 27338 | * |
| 27339 | * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 27340 | */ |
| 27341 | void |
| 27342 | led_proxy_new_for_bus ( |
| 27343 | GBusType bus_type, |
| 27344 | GDBusProxyFlags flags, |
| 27345 | const gchar *name, |
| 27346 | const gchar *object_path, |
| 27347 | GCancellable *cancellable, |
| 27348 | GAsyncReadyCallback callback, |
| 27349 | gpointer user_data) |
| 27350 | { |
| 27351 | 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); |
| 27352 | } |
| 27353 | |
| 27354 | /** |
| 27355 | * led_proxy_new_for_bus_finish: |
| 27356 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus(). |
| 27357 | * @error: Return location for error or %NULL |
| 27358 | * |
| 27359 | * Finishes an operation started with led_proxy_new_for_bus(). |
| 27360 | * |
| 27361 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 27362 | */ |
| 27363 | Led * |
| 27364 | led_proxy_new_for_bus_finish ( |
| 27365 | GAsyncResult *res, |
| 27366 | GError **error) |
| 27367 | { |
| 27368 | GObject *ret; |
| 27369 | GObject *source_object; |
| 27370 | source_object = g_async_result_get_source_object (res); |
| 27371 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 27372 | g_object_unref (source_object); |
| 27373 | if (ret != NULL) |
| 27374 | return LED (ret); |
| 27375 | else |
| 27376 | return NULL; |
| 27377 | } |
| 27378 | |
| 27379 | /** |
| 27380 | * led_proxy_new_for_bus_sync: |
| 27381 | * @bus_type: A #GBusType. |
| 27382 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 27383 | * @name: A bus name (well-known or unique). |
| 27384 | * @object_path: An object path. |
| 27385 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 27386 | * @error: Return location for error or %NULL |
| 27387 | * |
| 27388 | * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 27389 | * |
| 27390 | * The calling thread is blocked until a reply is received. |
| 27391 | * |
| 27392 | * See led_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 27393 | * |
| 27394 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. |
| 27395 | */ |
| 27396 | Led * |
| 27397 | led_proxy_new_for_bus_sync ( |
| 27398 | GBusType bus_type, |
| 27399 | GDBusProxyFlags flags, |
| 27400 | const gchar *name, |
| 27401 | const gchar *object_path, |
| 27402 | GCancellable *cancellable, |
| 27403 | GError **error) |
| 27404 | { |
| 27405 | GInitable *ret; |
| 27406 | 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); |
| 27407 | if (ret != NULL) |
| 27408 | return LED (ret); |
| 27409 | else |
| 27410 | return NULL; |
| 27411 | } |
| 27412 | |
| 27413 | |
| 27414 | /* ------------------------------------------------------------------------ */ |
| 27415 | |
| 27416 | /** |
| 27417 | * LedSkeleton: |
| 27418 | * |
| 27419 | * The #LedSkeleton structure contains only private data and should only be accessed using the provided API. |
| 27420 | */ |
| 27421 | |
| 27422 | /** |
| 27423 | * LedSkeletonClass: |
| 27424 | * @parent_class: The parent class. |
| 27425 | * |
| 27426 | * Class structure for #LedSkeleton. |
| 27427 | */ |
| 27428 | |
| 27429 | struct _LedSkeletonPrivate |
| 27430 | { |
| 27431 | GValue *properties; |
| 27432 | GList *changed_properties; |
| 27433 | GSource *changed_properties_idle_source; |
| 27434 | GMainContext *context; |
| 27435 | GMutex lock; |
| 27436 | }; |
| 27437 | |
| 27438 | static void |
| 27439 | _led_skeleton_handle_method_call ( |
| 27440 | GDBusConnection *connection G_GNUC_UNUSED, |
| 27441 | const gchar *sender G_GNUC_UNUSED, |
| 27442 | const gchar *object_path G_GNUC_UNUSED, |
| 27443 | const gchar *interface_name, |
| 27444 | const gchar *method_name, |
| 27445 | GVariant *parameters, |
| 27446 | GDBusMethodInvocation *invocation, |
| 27447 | gpointer user_data) |
| 27448 | { |
| 27449 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 27450 | _ExtendedGDBusMethodInfo *info; |
| 27451 | GVariantIter iter; |
| 27452 | GVariant *child; |
| 27453 | GValue *paramv; |
| 27454 | guint num_params; |
| 27455 | guint num_extra; |
| 27456 | guint n; |
| 27457 | guint signal_id; |
| 27458 | GValue return_value = G_VALUE_INIT; |
| 27459 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 27460 | g_assert (info != NULL); |
| 27461 | num_params = g_variant_n_children (parameters); |
| 27462 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 27463 | n = 0; |
| 27464 | g_value_init (¶mv[n], TYPE_LED); |
| 27465 | g_value_set_object (¶mv[n++], skeleton); |
| 27466 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 27467 | g_value_set_object (¶mv[n++], invocation); |
| 27468 | if (info->pass_fdlist) |
| 27469 | { |
| 27470 | #ifdef G_OS_UNIX |
| 27471 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 27472 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 27473 | #else |
| 27474 | g_assert_not_reached (); |
| 27475 | #endif |
| 27476 | } |
| 27477 | g_variant_iter_init (&iter, parameters); |
| 27478 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 27479 | { |
| 27480 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 27481 | if (arg_info->use_gvariant) |
| 27482 | { |
| 27483 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 27484 | g_value_set_variant (¶mv[n], child); |
| 27485 | n++; |
| 27486 | } |
| 27487 | else |
| 27488 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 27489 | g_variant_unref (child); |
| 27490 | } |
| 27491 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED); |
| 27492 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 27493 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 27494 | if (!g_value_get_boolean (&return_value)) |
| 27495 | 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); |
| 27496 | g_value_unset (&return_value); |
| 27497 | for (n = 0; n < num_params + num_extra; n++) |
| 27498 | g_value_unset (¶mv[n]); |
| 27499 | g_free (paramv); |
| 27500 | } |
| 27501 | |
| 27502 | static GVariant * |
| 27503 | _led_skeleton_handle_get_property ( |
| 27504 | GDBusConnection *connection G_GNUC_UNUSED, |
| 27505 | const gchar *sender G_GNUC_UNUSED, |
| 27506 | const gchar *object_path G_GNUC_UNUSED, |
| 27507 | const gchar *interface_name G_GNUC_UNUSED, |
| 27508 | const gchar *property_name, |
| 27509 | GError **error, |
| 27510 | gpointer user_data) |
| 27511 | { |
| 27512 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 27513 | GValue value = G_VALUE_INIT; |
| 27514 | GParamSpec *pspec; |
| 27515 | _ExtendedGDBusPropertyInfo *info; |
| 27516 | GVariant *ret; |
| 27517 | ret = NULL; |
| 27518 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 27519 | g_assert (info != NULL); |
| 27520 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 27521 | if (pspec == NULL) |
| 27522 | { |
| 27523 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 27524 | } |
| 27525 | else |
| 27526 | { |
| 27527 | g_value_init (&value, pspec->value_type); |
| 27528 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 27529 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 27530 | g_value_unset (&value); |
| 27531 | } |
| 27532 | return ret; |
| 27533 | } |
| 27534 | |
| 27535 | static gboolean |
| 27536 | _led_skeleton_handle_set_property ( |
| 27537 | GDBusConnection *connection G_GNUC_UNUSED, |
| 27538 | const gchar *sender G_GNUC_UNUSED, |
| 27539 | const gchar *object_path G_GNUC_UNUSED, |
| 27540 | const gchar *interface_name G_GNUC_UNUSED, |
| 27541 | const gchar *property_name, |
| 27542 | GVariant *variant, |
| 27543 | GError **error, |
| 27544 | gpointer user_data) |
| 27545 | { |
| 27546 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 27547 | GValue value = G_VALUE_INIT; |
| 27548 | GParamSpec *pspec; |
| 27549 | _ExtendedGDBusPropertyInfo *info; |
| 27550 | gboolean ret; |
| 27551 | ret = FALSE; |
| 27552 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); |
| 27553 | g_assert (info != NULL); |
| 27554 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 27555 | if (pspec == NULL) |
| 27556 | { |
| 27557 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 27558 | } |
| 27559 | else |
| 27560 | { |
| 27561 | if (info->use_gvariant) |
| 27562 | g_value_set_variant (&value, variant); |
| 27563 | else |
| 27564 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 27565 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 27566 | g_value_unset (&value); |
| 27567 | ret = TRUE; |
| 27568 | } |
| 27569 | return ret; |
| 27570 | } |
| 27571 | |
| 27572 | static const GDBusInterfaceVTable _led_skeleton_vtable = |
| 27573 | { |
| 27574 | _led_skeleton_handle_method_call, |
| 27575 | _led_skeleton_handle_get_property, |
| 27576 | _led_skeleton_handle_set_property, |
| 27577 | {NULL} |
| 27578 | }; |
| 27579 | |
| 27580 | static GDBusInterfaceInfo * |
| 27581 | led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 27582 | { |
| 27583 | return led_interface_info (); |
| 27584 | } |
| 27585 | |
| 27586 | static GDBusInterfaceVTable * |
| 27587 | led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 27588 | { |
| 27589 | return (GDBusInterfaceVTable *) &_led_skeleton_vtable; |
| 27590 | } |
| 27591 | |
| 27592 | static GVariant * |
| 27593 | led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 27594 | { |
| 27595 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 27596 | |
| 27597 | GVariantBuilder builder; |
| 27598 | guint n; |
| 27599 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 27600 | if (_led_interface_info.parent_struct.properties == NULL) |
| 27601 | goto out; |
| 27602 | for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++) |
| 27603 | { |
| 27604 | GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n]; |
| 27605 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 27606 | { |
| 27607 | GVariant *value; |
| 27608 | 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); |
| 27609 | if (value != NULL) |
| 27610 | { |
| 27611 | g_variant_take_ref (value); |
| 27612 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 27613 | g_variant_unref (value); |
| 27614 | } |
| 27615 | } |
| 27616 | } |
| 27617 | out: |
| 27618 | return g_variant_builder_end (&builder); |
| 27619 | } |
| 27620 | |
| 27621 | static gboolean _led_emit_changed (gpointer user_data); |
| 27622 | |
| 27623 | static void |
| 27624 | led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 27625 | { |
| 27626 | LedSkeleton *skeleton = LED_SKELETON (_skeleton); |
| 27627 | gboolean emit_changed = FALSE; |
| 27628 | |
| 27629 | g_mutex_lock (&skeleton->priv->lock); |
| 27630 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 27631 | { |
| 27632 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 27633 | skeleton->priv->changed_properties_idle_source = NULL; |
| 27634 | emit_changed = TRUE; |
| 27635 | } |
| 27636 | g_mutex_unlock (&skeleton->priv->lock); |
| 27637 | |
| 27638 | if (emit_changed) |
| 27639 | _led_emit_changed (skeleton); |
| 27640 | } |
| 27641 | |
| 27642 | static void led_skeleton_iface_init (LedIface *iface); |
| 27643 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 27644 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 27645 | G_ADD_PRIVATE (LedSkeleton) |
| 27646 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 27647 | |
| 27648 | #else |
| 27649 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 27650 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); |
| 27651 | |
| 27652 | #endif |
| 27653 | static void |
| 27654 | led_skeleton_finalize (GObject *object) |
| 27655 | { |
| 27656 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 27657 | guint n; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27658 | for (n = 0; n < 3; n++) |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27659 | g_value_unset (&skeleton->priv->properties[n]); |
| 27660 | g_free (skeleton->priv->properties); |
| 27661 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 27662 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 27663 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 27664 | g_main_context_unref (skeleton->priv->context); |
| 27665 | g_mutex_clear (&skeleton->priv->lock); |
| 27666 | G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object); |
| 27667 | } |
| 27668 | |
| 27669 | static void |
| 27670 | led_skeleton_get_property (GObject *object, |
| 27671 | guint prop_id, |
| 27672 | GValue *value, |
| 27673 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27674 | { |
| 27675 | LedSkeleton *skeleton = LED_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27676 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27677 | g_mutex_lock (&skeleton->priv->lock); |
| 27678 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 27679 | g_mutex_unlock (&skeleton->priv->lock); |
| 27680 | } |
| 27681 | |
| 27682 | static gboolean |
| 27683 | _led_emit_changed (gpointer user_data) |
| 27684 | { |
| 27685 | LedSkeleton *skeleton = LED_SKELETON (user_data); |
| 27686 | GList *l; |
| 27687 | GVariantBuilder builder; |
| 27688 | GVariantBuilder invalidated_builder; |
| 27689 | guint num_changes; |
| 27690 | |
| 27691 | g_mutex_lock (&skeleton->priv->lock); |
| 27692 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 27693 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 27694 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 27695 | { |
| 27696 | ChangedProperty *cp = l->data; |
| 27697 | GVariant *variant; |
| 27698 | const GValue *cur_value; |
| 27699 | |
| 27700 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 27701 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 27702 | { |
| 27703 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 27704 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 27705 | g_variant_unref (variant); |
| 27706 | num_changes++; |
| 27707 | } |
| 27708 | } |
| 27709 | if (num_changes > 0) |
| 27710 | { |
| 27711 | GList *connections, *ll; |
| 27712 | GVariant *signal_variant; |
| 27713 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led", |
| 27714 | &builder, &invalidated_builder)); |
| 27715 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 27716 | for (ll = connections; ll != NULL; ll = ll->next) |
| 27717 | { |
| 27718 | GDBusConnection *connection = ll->data; |
| 27719 | |
| 27720 | g_dbus_connection_emit_signal (connection, |
| 27721 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 27722 | "org.freedesktop.DBus.Properties", |
| 27723 | "PropertiesChanged", |
| 27724 | signal_variant, |
| 27725 | NULL); |
| 27726 | } |
| 27727 | g_variant_unref (signal_variant); |
| 27728 | g_list_free_full (connections, g_object_unref); |
| 27729 | } |
| 27730 | else |
| 27731 | { |
| 27732 | g_variant_builder_clear (&builder); |
| 27733 | g_variant_builder_clear (&invalidated_builder); |
| 27734 | } |
| 27735 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 27736 | skeleton->priv->changed_properties = NULL; |
| 27737 | skeleton->priv->changed_properties_idle_source = NULL; |
| 27738 | g_mutex_unlock (&skeleton->priv->lock); |
| 27739 | return FALSE; |
| 27740 | } |
| 27741 | |
| 27742 | static void |
| 27743 | _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 27744 | { |
| 27745 | ChangedProperty *cp; |
| 27746 | GList *l; |
| 27747 | cp = NULL; |
| 27748 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 27749 | { |
| 27750 | ChangedProperty *i_cp = l->data; |
| 27751 | if (i_cp->info == info) |
| 27752 | { |
| 27753 | cp = i_cp; |
| 27754 | break; |
| 27755 | } |
| 27756 | } |
| 27757 | if (cp == NULL) |
| 27758 | { |
| 27759 | cp = g_new0 (ChangedProperty, 1); |
| 27760 | cp->prop_id = prop_id; |
| 27761 | cp->info = info; |
| 27762 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 27763 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 27764 | g_value_copy (orig_value, &cp->orig_value); |
| 27765 | } |
| 27766 | } |
| 27767 | |
| 27768 | static void |
| 27769 | led_skeleton_notify (GObject *object, |
| 27770 | GParamSpec *pspec G_GNUC_UNUSED) |
| 27771 | { |
| 27772 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 27773 | g_mutex_lock (&skeleton->priv->lock); |
| 27774 | if (skeleton->priv->changed_properties != NULL && |
| 27775 | skeleton->priv->changed_properties_idle_source == NULL) |
| 27776 | { |
| 27777 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 27778 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 27779 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 27780 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 27781 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 27782 | } |
| 27783 | g_mutex_unlock (&skeleton->priv->lock); |
| 27784 | } |
| 27785 | |
| 27786 | static void |
| 27787 | led_skeleton_set_property (GObject *object, |
| 27788 | guint prop_id, |
| 27789 | const GValue *value, |
| 27790 | GParamSpec *pspec) |
| 27791 | { |
| 27792 | LedSkeleton *skeleton = LED_SKELETON (object); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27793 | g_assert (prop_id != 0 && prop_id - 1 < 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27794 | g_mutex_lock (&skeleton->priv->lock); |
| 27795 | g_object_freeze_notify (object); |
| 27796 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 27797 | { |
| 27798 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 27799 | _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 27800 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 27801 | g_object_notify_by_pspec (object, pspec); |
| 27802 | } |
| 27803 | g_mutex_unlock (&skeleton->priv->lock); |
| 27804 | g_object_thaw_notify (object); |
| 27805 | } |
| 27806 | |
| 27807 | static void |
| 27808 | led_skeleton_init (LedSkeleton *skeleton) |
| 27809 | { |
| 27810 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 27811 | skeleton->priv = led_skeleton_get_instance_private (skeleton); |
| 27812 | #else |
| 27813 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate); |
| 27814 | #endif |
| 27815 | |
| 27816 | g_mutex_init (&skeleton->priv->lock); |
| 27817 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27818 | skeleton->priv->properties = g_new0 (GValue, 3); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27819 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 27820 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27821 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27822 | } |
| 27823 | |
| 27824 | static gint |
| 27825 | led_skeleton_get_color (Led *object) |
| 27826 | { |
| 27827 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 27828 | gint value; |
| 27829 | g_mutex_lock (&skeleton->priv->lock); |
| 27830 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 27831 | g_mutex_unlock (&skeleton->priv->lock); |
| 27832 | return value; |
| 27833 | } |
| 27834 | |
| 27835 | static const gchar * |
| 27836 | led_skeleton_get_function (Led *object) |
| 27837 | { |
| 27838 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 27839 | const gchar *value; |
| 27840 | g_mutex_lock (&skeleton->priv->lock); |
| 27841 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 27842 | g_mutex_unlock (&skeleton->priv->lock); |
| 27843 | return value; |
| 27844 | } |
| 27845 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27846 | static const gchar * |
| 27847 | led_skeleton_get_state (Led *object) |
| 27848 | { |
| 27849 | LedSkeleton *skeleton = LED_SKELETON (object); |
| 27850 | const gchar *value; |
| 27851 | g_mutex_lock (&skeleton->priv->lock); |
| 27852 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
| 27853 | g_mutex_unlock (&skeleton->priv->lock); |
| 27854 | return value; |
| 27855 | } |
| 27856 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27857 | static void |
| 27858 | led_skeleton_class_init (LedSkeletonClass *klass) |
| 27859 | { |
| 27860 | GObjectClass *gobject_class; |
| 27861 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 27862 | |
| 27863 | gobject_class = G_OBJECT_CLASS (klass); |
| 27864 | gobject_class->finalize = led_skeleton_finalize; |
| 27865 | gobject_class->get_property = led_skeleton_get_property; |
| 27866 | gobject_class->set_property = led_skeleton_set_property; |
| 27867 | gobject_class->notify = led_skeleton_notify; |
| 27868 | |
| 27869 | |
| 27870 | led_override_properties (gobject_class, 1); |
| 27871 | |
| 27872 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 27873 | skeleton_class->get_info = led_skeleton_dbus_interface_get_info; |
| 27874 | skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties; |
| 27875 | skeleton_class->flush = led_skeleton_dbus_interface_flush; |
| 27876 | skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable; |
| 27877 | |
| 27878 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 27879 | g_type_class_add_private (klass, sizeof (LedSkeletonPrivate)); |
| 27880 | #endif |
| 27881 | } |
| 27882 | |
| 27883 | static void |
| 27884 | led_skeleton_iface_init (LedIface *iface) |
| 27885 | { |
| 27886 | iface->get_color = led_skeleton_get_color; |
| 27887 | iface->get_function = led_skeleton_get_function; |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 27888 | iface->get_state = led_skeleton_get_state; |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 27889 | } |
| 27890 | |
| 27891 | /** |
| 27892 | * led_skeleton_new: |
| 27893 | * |
| 27894 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. |
| 27895 | * |
| 27896 | * Returns: (transfer full) (type LedSkeleton): The skeleton object. |
| 27897 | */ |
| 27898 | Led * |
| 27899 | led_skeleton_new (void) |
| 27900 | { |
| 27901 | return LED (g_object_new (TYPE_LED_SKELETON, NULL)); |
| 27902 | } |
| 27903 | |
| 27904 | /* ------------------------------------------------------------------------ |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 27905 | * Code for interface org.openbmc.HostIpmi |
| 27906 | * ------------------------------------------------------------------------ |
| 27907 | */ |
| 27908 | |
| 27909 | /** |
| 27910 | * SECTION:HostIpmi |
| 27911 | * @title: HostIpmi |
| 27912 | * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface |
| 27913 | * |
| 27914 | * 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. |
| 27915 | */ |
| 27916 | |
| 27917 | /* ---- Introspection data for org.openbmc.HostIpmi ---- */ |
| 27918 | |
| 27919 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq = |
| 27920 | { |
| 27921 | { |
| 27922 | -1, |
| 27923 | (gchar *) "seq", |
| 27924 | (gchar *) "y", |
| 27925 | NULL |
| 27926 | }, |
| 27927 | FALSE |
| 27928 | }; |
| 27929 | |
| 27930 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn = |
| 27931 | { |
| 27932 | { |
| 27933 | -1, |
| 27934 | (gchar *) "netfn", |
| 27935 | (gchar *) "y", |
| 27936 | NULL |
| 27937 | }, |
| 27938 | FALSE |
| 27939 | }; |
| 27940 | |
| 27941 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd = |
| 27942 | { |
| 27943 | { |
| 27944 | -1, |
| 27945 | (gchar *) "cmd", |
| 27946 | (gchar *) "y", |
| 27947 | NULL |
| 27948 | }, |
| 27949 | FALSE |
| 27950 | }; |
| 27951 | |
| 27952 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data = |
| 27953 | { |
| 27954 | { |
| 27955 | -1, |
| 27956 | (gchar *) "data", |
| 27957 | (gchar *) "ay", |
| 27958 | NULL |
| 27959 | }, |
| 27960 | FALSE |
| 27961 | }; |
| 27962 | |
| 27963 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] = |
| 27964 | { |
| 27965 | &_host_ipmi_method_info_send_message_IN_ARG_seq, |
| 27966 | &_host_ipmi_method_info_send_message_IN_ARG_netfn, |
| 27967 | &_host_ipmi_method_info_send_message_IN_ARG_cmd, |
| 27968 | &_host_ipmi_method_info_send_message_IN_ARG_data, |
| 27969 | NULL |
| 27970 | }; |
| 27971 | |
| 27972 | static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 = |
| 27973 | { |
| 27974 | { |
| 27975 | -1, |
| 27976 | (gchar *) "unnamed_arg4", |
| 27977 | (gchar *) "x", |
| 27978 | NULL |
| 27979 | }, |
| 27980 | FALSE |
| 27981 | }; |
| 27982 | |
| 27983 | static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] = |
| 27984 | { |
| 27985 | &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4, |
| 27986 | NULL |
| 27987 | }; |
| 27988 | |
| 27989 | static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message = |
| 27990 | { |
| 27991 | { |
| 27992 | -1, |
| 27993 | (gchar *) "sendMessage", |
| 27994 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers, |
| 27995 | (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers, |
| 27996 | NULL |
| 27997 | }, |
| 27998 | "handle-send-message", |
| 27999 | FALSE |
| 28000 | }; |
| 28001 | |
| 28002 | static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] = |
| 28003 | { |
| 28004 | &_host_ipmi_method_info_send_message, |
| 28005 | NULL |
| 28006 | }; |
| 28007 | |
| 28008 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq = |
| 28009 | { |
| 28010 | { |
| 28011 | -1, |
| 28012 | (gchar *) "seq", |
| 28013 | (gchar *) "y", |
| 28014 | NULL |
| 28015 | }, |
| 28016 | FALSE |
| 28017 | }; |
| 28018 | |
| 28019 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn = |
| 28020 | { |
| 28021 | { |
| 28022 | -1, |
| 28023 | (gchar *) "netfn", |
| 28024 | (gchar *) "y", |
| 28025 | NULL |
| 28026 | }, |
| 28027 | FALSE |
| 28028 | }; |
| 28029 | |
| 28030 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd = |
| 28031 | { |
| 28032 | { |
| 28033 | -1, |
| 28034 | (gchar *) "cmd", |
| 28035 | (gchar *) "y", |
| 28036 | NULL |
| 28037 | }, |
| 28038 | FALSE |
| 28039 | }; |
| 28040 | |
| 28041 | static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data = |
| 28042 | { |
| 28043 | { |
| 28044 | -1, |
| 28045 | (gchar *) "data", |
| 28046 | (gchar *) "ay", |
| 28047 | NULL |
| 28048 | }, |
| 28049 | FALSE |
| 28050 | }; |
| 28051 | |
| 28052 | static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] = |
| 28053 | { |
| 28054 | &_host_ipmi_signal_info_received_message_ARG_seq, |
| 28055 | &_host_ipmi_signal_info_received_message_ARG_netfn, |
| 28056 | &_host_ipmi_signal_info_received_message_ARG_cmd, |
| 28057 | &_host_ipmi_signal_info_received_message_ARG_data, |
| 28058 | NULL |
| 28059 | }; |
| 28060 | |
| 28061 | static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message = |
| 28062 | { |
| 28063 | { |
| 28064 | -1, |
| 28065 | (gchar *) "ReceivedMessage", |
| 28066 | (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers, |
| 28067 | NULL |
| 28068 | }, |
| 28069 | "received-message" |
| 28070 | }; |
| 28071 | |
| 28072 | static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] = |
| 28073 | { |
| 28074 | &_host_ipmi_signal_info_received_message, |
| 28075 | NULL |
| 28076 | }; |
| 28077 | |
| 28078 | static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info = |
| 28079 | { |
| 28080 | { |
| 28081 | -1, |
| 28082 | (gchar *) "org.openbmc.HostIpmi", |
| 28083 | (GDBusMethodInfo **) &_host_ipmi_method_info_pointers, |
| 28084 | (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers, |
| 28085 | NULL, |
| 28086 | NULL |
| 28087 | }, |
| 28088 | "host-ipmi", |
| 28089 | }; |
| 28090 | |
| 28091 | |
| 28092 | /** |
| 28093 | * host_ipmi_interface_info: |
| 28094 | * |
| 28095 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface. |
| 28096 | * |
| 28097 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 28098 | */ |
| 28099 | GDBusInterfaceInfo * |
| 28100 | host_ipmi_interface_info (void) |
| 28101 | { |
| 28102 | return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct; |
| 28103 | } |
| 28104 | |
| 28105 | /** |
| 28106 | * host_ipmi_override_properties: |
| 28107 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 28108 | * @property_id_begin: The property id to assign to the first overridden property. |
| 28109 | * |
| 28110 | * Overrides all #GObject properties in the #HostIpmi interface for a concrete class. |
| 28111 | * The properties are overridden in the order they are defined. |
| 28112 | * |
| 28113 | * Returns: The last property id. |
| 28114 | */ |
| 28115 | guint |
| 28116 | host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin) |
| 28117 | { |
| 28118 | return property_id_begin - 1; |
| 28119 | } |
| 28120 | |
| 28121 | |
| 28122 | |
| 28123 | /** |
| 28124 | * HostIpmi: |
| 28125 | * |
| 28126 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 28127 | */ |
| 28128 | |
| 28129 | /** |
| 28130 | * HostIpmiIface: |
| 28131 | * @parent_iface: The parent interface. |
| 28132 | * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal. |
| 28133 | * @received_message: Handler for the #HostIpmi::received-message signal. |
| 28134 | * |
| 28135 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 28136 | */ |
| 28137 | |
| 28138 | typedef HostIpmiIface HostIpmiInterface; |
| 28139 | G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT); |
| 28140 | |
| 28141 | static void |
| 28142 | host_ipmi_default_init (HostIpmiIface *iface) |
| 28143 | { |
| 28144 | /* GObject signals for incoming D-Bus method calls: */ |
| 28145 | /** |
| 28146 | * HostIpmi::handle-send-message: |
| 28147 | * @object: A #HostIpmi. |
| 28148 | * @invocation: A #GDBusMethodInvocation. |
| 28149 | * @arg_seq: Argument passed by remote caller. |
| 28150 | * @arg_netfn: Argument passed by remote caller. |
| 28151 | * @arg_cmd: Argument passed by remote caller. |
| 28152 | * @arg_data: Argument passed by remote caller. |
| 28153 | * |
| 28154 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. |
| 28155 | * |
| 28156 | * 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. |
| 28157 | * |
| 28158 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 28159 | */ |
| 28160 | g_signal_new ("handle-send-message", |
| 28161 | G_TYPE_FROM_INTERFACE (iface), |
| 28162 | G_SIGNAL_RUN_LAST, |
| 28163 | G_STRUCT_OFFSET (HostIpmiIface, handle_send_message), |
| 28164 | g_signal_accumulator_true_handled, |
| 28165 | NULL, |
| 28166 | g_cclosure_marshal_generic, |
| 28167 | G_TYPE_BOOLEAN, |
| 28168 | 5, |
| 28169 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 28170 | |
| 28171 | /* GObject signals for received D-Bus signals: */ |
| 28172 | /** |
| 28173 | * HostIpmi::received-message: |
| 28174 | * @object: A #HostIpmi. |
| 28175 | * @arg_seq: Argument. |
| 28176 | * @arg_netfn: Argument. |
| 28177 | * @arg_cmd: Argument. |
| 28178 | * @arg_data: Argument. |
| 28179 | * |
| 28180 | * 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. |
| 28181 | * |
| 28182 | * 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. |
| 28183 | */ |
| 28184 | g_signal_new ("received-message", |
| 28185 | G_TYPE_FROM_INTERFACE (iface), |
| 28186 | G_SIGNAL_RUN_LAST, |
| 28187 | G_STRUCT_OFFSET (HostIpmiIface, received_message), |
| 28188 | NULL, |
| 28189 | NULL, |
| 28190 | g_cclosure_marshal_generic, |
| 28191 | G_TYPE_NONE, |
| 28192 | 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); |
| 28193 | |
| 28194 | } |
| 28195 | |
| 28196 | /** |
| 28197 | * host_ipmi_emit_received_message: |
| 28198 | * @object: A #HostIpmi. |
| 28199 | * @arg_seq: Argument to pass with the signal. |
| 28200 | * @arg_netfn: Argument to pass with the signal. |
| 28201 | * @arg_cmd: Argument to pass with the signal. |
| 28202 | * @arg_data: Argument to pass with the signal. |
| 28203 | * |
| 28204 | * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal. |
| 28205 | */ |
| 28206 | void |
| 28207 | host_ipmi_emit_received_message ( |
| 28208 | HostIpmi *object, |
| 28209 | guchar arg_seq, |
| 28210 | guchar arg_netfn, |
| 28211 | guchar arg_cmd, |
| 28212 | const gchar *arg_data) |
| 28213 | { |
| 28214 | g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data); |
| 28215 | } |
| 28216 | |
| 28217 | /** |
| 28218 | * host_ipmi_call_send_message: |
| 28219 | * @proxy: A #HostIpmiProxy. |
| 28220 | * @arg_seq: Argument to pass with the method invocation. |
| 28221 | * @arg_netfn: Argument to pass with the method invocation. |
| 28222 | * @arg_cmd: Argument to pass with the method invocation. |
| 28223 | * @arg_data: Argument to pass with the method invocation. |
| 28224 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28225 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 28226 | * @user_data: User data to pass to @callback. |
| 28227 | * |
| 28228 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. |
| 28229 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 28230 | * You can then call host_ipmi_call_send_message_finish() to get the result of the operation. |
| 28231 | * |
| 28232 | * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method. |
| 28233 | */ |
| 28234 | void |
| 28235 | host_ipmi_call_send_message ( |
| 28236 | HostIpmi *proxy, |
| 28237 | guchar arg_seq, |
| 28238 | guchar arg_netfn, |
| 28239 | guchar arg_cmd, |
| 28240 | const gchar *arg_data, |
| 28241 | GCancellable *cancellable, |
| 28242 | GAsyncReadyCallback callback, |
| 28243 | gpointer user_data) |
| 28244 | { |
| 28245 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 28246 | "sendMessage", |
| 28247 | g_variant_new ("(yyy^ay)", |
| 28248 | arg_seq, |
| 28249 | arg_netfn, |
| 28250 | arg_cmd, |
| 28251 | arg_data), |
| 28252 | G_DBUS_CALL_FLAGS_NONE, |
| 28253 | -1, |
| 28254 | cancellable, |
| 28255 | callback, |
| 28256 | user_data); |
| 28257 | } |
| 28258 | |
| 28259 | /** |
| 28260 | * host_ipmi_call_send_message_finish: |
| 28261 | * @proxy: A #HostIpmiProxy. |
| 28262 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 28263 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message(). |
| 28264 | * @error: Return location for error or %NULL. |
| 28265 | * |
| 28266 | * Finishes an operation started with host_ipmi_call_send_message(). |
| 28267 | * |
| 28268 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 28269 | */ |
| 28270 | gboolean |
| 28271 | host_ipmi_call_send_message_finish ( |
| 28272 | HostIpmi *proxy, |
| 28273 | gint64 *out_unnamed_arg4, |
| 28274 | GAsyncResult *res, |
| 28275 | GError **error) |
| 28276 | { |
| 28277 | GVariant *_ret; |
| 28278 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 28279 | if (_ret == NULL) |
| 28280 | goto _out; |
| 28281 | g_variant_get (_ret, |
| 28282 | "(x)", |
| 28283 | out_unnamed_arg4); |
| 28284 | g_variant_unref (_ret); |
| 28285 | _out: |
| 28286 | return _ret != NULL; |
| 28287 | } |
| 28288 | |
| 28289 | /** |
| 28290 | * host_ipmi_call_send_message_sync: |
| 28291 | * @proxy: A #HostIpmiProxy. |
| 28292 | * @arg_seq: Argument to pass with the method invocation. |
| 28293 | * @arg_netfn: Argument to pass with the method invocation. |
| 28294 | * @arg_cmd: Argument to pass with the method invocation. |
| 28295 | * @arg_data: Argument to pass with the method invocation. |
| 28296 | * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. |
| 28297 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28298 | * @error: Return location for error or %NULL. |
| 28299 | * |
| 28300 | * 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. |
| 28301 | * |
| 28302 | * See host_ipmi_call_send_message() for the asynchronous version of this method. |
| 28303 | * |
| 28304 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 28305 | */ |
| 28306 | gboolean |
| 28307 | host_ipmi_call_send_message_sync ( |
| 28308 | HostIpmi *proxy, |
| 28309 | guchar arg_seq, |
| 28310 | guchar arg_netfn, |
| 28311 | guchar arg_cmd, |
| 28312 | const gchar *arg_data, |
| 28313 | gint64 *out_unnamed_arg4, |
| 28314 | GCancellable *cancellable, |
| 28315 | GError **error) |
| 28316 | { |
| 28317 | GVariant *_ret; |
| 28318 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 28319 | "sendMessage", |
| 28320 | g_variant_new ("(yyy^ay)", |
| 28321 | arg_seq, |
| 28322 | arg_netfn, |
| 28323 | arg_cmd, |
| 28324 | arg_data), |
| 28325 | G_DBUS_CALL_FLAGS_NONE, |
| 28326 | -1, |
| 28327 | cancellable, |
| 28328 | error); |
| 28329 | if (_ret == NULL) |
| 28330 | goto _out; |
| 28331 | g_variant_get (_ret, |
| 28332 | "(x)", |
| 28333 | out_unnamed_arg4); |
| 28334 | g_variant_unref (_ret); |
| 28335 | _out: |
| 28336 | return _ret != NULL; |
| 28337 | } |
| 28338 | |
| 28339 | /** |
| 28340 | * host_ipmi_complete_send_message: |
| 28341 | * @object: A #HostIpmi. |
| 28342 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 28343 | * @unnamed_arg4: Parameter to return. |
| 28344 | * |
| 28345 | * 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. |
| 28346 | * |
| 28347 | * This method will free @invocation, you cannot use it afterwards. |
| 28348 | */ |
| 28349 | void |
| 28350 | host_ipmi_complete_send_message ( |
| 28351 | HostIpmi *object, |
| 28352 | GDBusMethodInvocation *invocation, |
| 28353 | gint64 unnamed_arg4) |
| 28354 | { |
| 28355 | g_dbus_method_invocation_return_value (invocation, |
| 28356 | g_variant_new ("(x)", |
| 28357 | unnamed_arg4)); |
| 28358 | } |
| 28359 | |
| 28360 | /* ------------------------------------------------------------------------ */ |
| 28361 | |
| 28362 | /** |
| 28363 | * HostIpmiProxy: |
| 28364 | * |
| 28365 | * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API. |
| 28366 | */ |
| 28367 | |
| 28368 | /** |
| 28369 | * HostIpmiProxyClass: |
| 28370 | * @parent_class: The parent class. |
| 28371 | * |
| 28372 | * Class structure for #HostIpmiProxy. |
| 28373 | */ |
| 28374 | |
| 28375 | struct _HostIpmiProxyPrivate |
| 28376 | { |
| 28377 | GData *qdata; |
| 28378 | }; |
| 28379 | |
| 28380 | static void host_ipmi_proxy_iface_init (HostIpmiIface *iface); |
| 28381 | |
| 28382 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28383 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 28384 | G_ADD_PRIVATE (HostIpmiProxy) |
| 28385 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 28386 | |
| 28387 | #else |
| 28388 | G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, |
| 28389 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); |
| 28390 | |
| 28391 | #endif |
| 28392 | static void |
| 28393 | host_ipmi_proxy_finalize (GObject *object) |
| 28394 | { |
| 28395 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (object); |
| 28396 | g_datalist_clear (&proxy->priv->qdata); |
| 28397 | G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object); |
| 28398 | } |
| 28399 | |
| 28400 | static void |
| 28401 | host_ipmi_proxy_get_property (GObject *object, |
| 28402 | guint prop_id, |
| 28403 | GValue *value, |
| 28404 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28405 | { |
| 28406 | } |
| 28407 | |
| 28408 | static void |
| 28409 | host_ipmi_proxy_set_property (GObject *object, |
| 28410 | guint prop_id, |
| 28411 | const GValue *value, |
| 28412 | GParamSpec *pspec G_GNUC_UNUSED) |
| 28413 | { |
| 28414 | } |
| 28415 | |
| 28416 | static void |
| 28417 | host_ipmi_proxy_g_signal (GDBusProxy *proxy, |
| 28418 | const gchar *sender_name G_GNUC_UNUSED, |
| 28419 | const gchar *signal_name, |
| 28420 | GVariant *parameters) |
| 28421 | { |
| 28422 | _ExtendedGDBusSignalInfo *info; |
| 28423 | GVariantIter iter; |
| 28424 | GVariant *child; |
| 28425 | GValue *paramv; |
| 28426 | guint num_params; |
| 28427 | guint n; |
| 28428 | guint signal_id; |
| 28429 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name); |
| 28430 | if (info == NULL) |
| 28431 | return; |
| 28432 | num_params = g_variant_n_children (parameters); |
| 28433 | paramv = g_new0 (GValue, num_params + 1); |
| 28434 | g_value_init (¶mv[0], TYPE_HOST_IPMI); |
| 28435 | g_value_set_object (¶mv[0], proxy); |
| 28436 | g_variant_iter_init (&iter, parameters); |
| 28437 | n = 1; |
| 28438 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 28439 | { |
| 28440 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 28441 | if (arg_info->use_gvariant) |
| 28442 | { |
| 28443 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 28444 | g_value_set_variant (¶mv[n], child); |
| 28445 | n++; |
| 28446 | } |
| 28447 | else |
| 28448 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 28449 | g_variant_unref (child); |
| 28450 | } |
| 28451 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 28452 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 28453 | for (n = 0; n < num_params + 1; n++) |
| 28454 | g_value_unset (¶mv[n]); |
| 28455 | g_free (paramv); |
| 28456 | } |
| 28457 | |
| 28458 | static void |
| 28459 | host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 28460 | GVariant *changed_properties, |
| 28461 | const gchar *const *invalidated_properties) |
| 28462 | { |
| 28463 | HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy); |
| 28464 | guint n; |
| 28465 | const gchar *key; |
| 28466 | GVariantIter *iter; |
| 28467 | _ExtendedGDBusPropertyInfo *info; |
| 28468 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 28469 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 28470 | { |
| 28471 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key); |
| 28472 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 28473 | if (info != NULL) |
| 28474 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 28475 | } |
| 28476 | g_variant_iter_free (iter); |
| 28477 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 28478 | { |
| 28479 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]); |
| 28480 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 28481 | if (info != NULL) |
| 28482 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 28483 | } |
| 28484 | } |
| 28485 | |
| 28486 | static void |
| 28487 | host_ipmi_proxy_init (HostIpmiProxy *proxy) |
| 28488 | { |
| 28489 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28490 | proxy->priv = host_ipmi_proxy_get_instance_private (proxy); |
| 28491 | #else |
| 28492 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate); |
| 28493 | #endif |
| 28494 | |
| 28495 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ()); |
| 28496 | } |
| 28497 | |
| 28498 | static void |
| 28499 | host_ipmi_proxy_class_init (HostIpmiProxyClass *klass) |
| 28500 | { |
| 28501 | GObjectClass *gobject_class; |
| 28502 | GDBusProxyClass *proxy_class; |
| 28503 | |
| 28504 | gobject_class = G_OBJECT_CLASS (klass); |
| 28505 | gobject_class->finalize = host_ipmi_proxy_finalize; |
| 28506 | gobject_class->get_property = host_ipmi_proxy_get_property; |
| 28507 | gobject_class->set_property = host_ipmi_proxy_set_property; |
| 28508 | |
| 28509 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 28510 | proxy_class->g_signal = host_ipmi_proxy_g_signal; |
| 28511 | proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed; |
| 28512 | |
| 28513 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 28514 | g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate)); |
| 28515 | #endif |
| 28516 | } |
| 28517 | |
| 28518 | static void |
| 28519 | host_ipmi_proxy_iface_init (HostIpmiIface *iface) |
| 28520 | { |
| 28521 | } |
| 28522 | |
| 28523 | /** |
| 28524 | * host_ipmi_proxy_new: |
| 28525 | * @connection: A #GDBusConnection. |
| 28526 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28527 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28528 | * @object_path: An object path. |
| 28529 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28530 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28531 | * @user_data: User data to pass to @callback. |
| 28532 | * |
| 28533 | * 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. |
| 28534 | * |
| 28535 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 28536 | * You can then call host_ipmi_proxy_new_finish() to get the result of the operation. |
| 28537 | * |
| 28538 | * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 28539 | */ |
| 28540 | void |
| 28541 | host_ipmi_proxy_new ( |
| 28542 | GDBusConnection *connection, |
| 28543 | GDBusProxyFlags flags, |
| 28544 | const gchar *name, |
| 28545 | const gchar *object_path, |
| 28546 | GCancellable *cancellable, |
| 28547 | GAsyncReadyCallback callback, |
| 28548 | gpointer user_data) |
| 28549 | { |
| 28550 | 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); |
| 28551 | } |
| 28552 | |
| 28553 | /** |
| 28554 | * host_ipmi_proxy_new_finish: |
| 28555 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new(). |
| 28556 | * @error: Return location for error or %NULL |
| 28557 | * |
| 28558 | * Finishes an operation started with host_ipmi_proxy_new(). |
| 28559 | * |
| 28560 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 28561 | */ |
| 28562 | HostIpmi * |
| 28563 | host_ipmi_proxy_new_finish ( |
| 28564 | GAsyncResult *res, |
| 28565 | GError **error) |
| 28566 | { |
| 28567 | GObject *ret; |
| 28568 | GObject *source_object; |
| 28569 | source_object = g_async_result_get_source_object (res); |
| 28570 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28571 | g_object_unref (source_object); |
| 28572 | if (ret != NULL) |
| 28573 | return HOST_IPMI (ret); |
| 28574 | else |
| 28575 | return NULL; |
| 28576 | } |
| 28577 | |
| 28578 | /** |
| 28579 | * host_ipmi_proxy_new_sync: |
| 28580 | * @connection: A #GDBusConnection. |
| 28581 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28582 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 28583 | * @object_path: An object path. |
| 28584 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28585 | * @error: Return location for error or %NULL |
| 28586 | * |
| 28587 | * 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. |
| 28588 | * |
| 28589 | * The calling thread is blocked until a reply is received. |
| 28590 | * |
| 28591 | * See host_ipmi_proxy_new() for the asynchronous version of this constructor. |
| 28592 | * |
| 28593 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 28594 | */ |
| 28595 | HostIpmi * |
| 28596 | host_ipmi_proxy_new_sync ( |
| 28597 | GDBusConnection *connection, |
| 28598 | GDBusProxyFlags flags, |
| 28599 | const gchar *name, |
| 28600 | const gchar *object_path, |
| 28601 | GCancellable *cancellable, |
| 28602 | GError **error) |
| 28603 | { |
| 28604 | GInitable *ret; |
| 28605 | 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); |
| 28606 | if (ret != NULL) |
| 28607 | return HOST_IPMI (ret); |
| 28608 | else |
| 28609 | return NULL; |
| 28610 | } |
| 28611 | |
| 28612 | |
| 28613 | /** |
| 28614 | * host_ipmi_proxy_new_for_bus: |
| 28615 | * @bus_type: A #GBusType. |
| 28616 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28617 | * @name: A bus name (well-known or unique). |
| 28618 | * @object_path: An object path. |
| 28619 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28620 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 28621 | * @user_data: User data to pass to @callback. |
| 28622 | * |
| 28623 | * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 28624 | * |
| 28625 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 28626 | * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation. |
| 28627 | * |
| 28628 | * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 28629 | */ |
| 28630 | void |
| 28631 | host_ipmi_proxy_new_for_bus ( |
| 28632 | GBusType bus_type, |
| 28633 | GDBusProxyFlags flags, |
| 28634 | const gchar *name, |
| 28635 | const gchar *object_path, |
| 28636 | GCancellable *cancellable, |
| 28637 | GAsyncReadyCallback callback, |
| 28638 | gpointer user_data) |
| 28639 | { |
| 28640 | 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); |
| 28641 | } |
| 28642 | |
| 28643 | /** |
| 28644 | * host_ipmi_proxy_new_for_bus_finish: |
| 28645 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus(). |
| 28646 | * @error: Return location for error or %NULL |
| 28647 | * |
| 28648 | * Finishes an operation started with host_ipmi_proxy_new_for_bus(). |
| 28649 | * |
| 28650 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 28651 | */ |
| 28652 | HostIpmi * |
| 28653 | host_ipmi_proxy_new_for_bus_finish ( |
| 28654 | GAsyncResult *res, |
| 28655 | GError **error) |
| 28656 | { |
| 28657 | GObject *ret; |
| 28658 | GObject *source_object; |
| 28659 | source_object = g_async_result_get_source_object (res); |
| 28660 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 28661 | g_object_unref (source_object); |
| 28662 | if (ret != NULL) |
| 28663 | return HOST_IPMI (ret); |
| 28664 | else |
| 28665 | return NULL; |
| 28666 | } |
| 28667 | |
| 28668 | /** |
| 28669 | * host_ipmi_proxy_new_for_bus_sync: |
| 28670 | * @bus_type: A #GBusType. |
| 28671 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 28672 | * @name: A bus name (well-known or unique). |
| 28673 | * @object_path: An object path. |
| 28674 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 28675 | * @error: Return location for error or %NULL |
| 28676 | * |
| 28677 | * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 28678 | * |
| 28679 | * The calling thread is blocked until a reply is received. |
| 28680 | * |
| 28681 | * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 28682 | * |
| 28683 | * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. |
| 28684 | */ |
| 28685 | HostIpmi * |
| 28686 | host_ipmi_proxy_new_for_bus_sync ( |
| 28687 | GBusType bus_type, |
| 28688 | GDBusProxyFlags flags, |
| 28689 | const gchar *name, |
| 28690 | const gchar *object_path, |
| 28691 | GCancellable *cancellable, |
| 28692 | GError **error) |
| 28693 | { |
| 28694 | GInitable *ret; |
| 28695 | 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); |
| 28696 | if (ret != NULL) |
| 28697 | return HOST_IPMI (ret); |
| 28698 | else |
| 28699 | return NULL; |
| 28700 | } |
| 28701 | |
| 28702 | |
| 28703 | /* ------------------------------------------------------------------------ */ |
| 28704 | |
| 28705 | /** |
| 28706 | * HostIpmiSkeleton: |
| 28707 | * |
| 28708 | * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API. |
| 28709 | */ |
| 28710 | |
| 28711 | /** |
| 28712 | * HostIpmiSkeletonClass: |
| 28713 | * @parent_class: The parent class. |
| 28714 | * |
| 28715 | * Class structure for #HostIpmiSkeleton. |
| 28716 | */ |
| 28717 | |
| 28718 | struct _HostIpmiSkeletonPrivate |
| 28719 | { |
| 28720 | GValue *properties; |
| 28721 | GList *changed_properties; |
| 28722 | GSource *changed_properties_idle_source; |
| 28723 | GMainContext *context; |
| 28724 | GMutex lock; |
| 28725 | }; |
| 28726 | |
| 28727 | static void |
| 28728 | _host_ipmi_skeleton_handle_method_call ( |
| 28729 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28730 | const gchar *sender G_GNUC_UNUSED, |
| 28731 | const gchar *object_path G_GNUC_UNUSED, |
| 28732 | const gchar *interface_name, |
| 28733 | const gchar *method_name, |
| 28734 | GVariant *parameters, |
| 28735 | GDBusMethodInvocation *invocation, |
| 28736 | gpointer user_data) |
| 28737 | { |
| 28738 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 28739 | _ExtendedGDBusMethodInfo *info; |
| 28740 | GVariantIter iter; |
| 28741 | GVariant *child; |
| 28742 | GValue *paramv; |
| 28743 | guint num_params; |
| 28744 | guint num_extra; |
| 28745 | guint n; |
| 28746 | guint signal_id; |
| 28747 | GValue return_value = G_VALUE_INIT; |
| 28748 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 28749 | g_assert (info != NULL); |
| 28750 | num_params = g_variant_n_children (parameters); |
| 28751 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 28752 | n = 0; |
| 28753 | g_value_init (¶mv[n], TYPE_HOST_IPMI); |
| 28754 | g_value_set_object (¶mv[n++], skeleton); |
| 28755 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 28756 | g_value_set_object (¶mv[n++], invocation); |
| 28757 | if (info->pass_fdlist) |
| 28758 | { |
| 28759 | #ifdef G_OS_UNIX |
| 28760 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 28761 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 28762 | #else |
| 28763 | g_assert_not_reached (); |
| 28764 | #endif |
| 28765 | } |
| 28766 | g_variant_iter_init (&iter, parameters); |
| 28767 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 28768 | { |
| 28769 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 28770 | if (arg_info->use_gvariant) |
| 28771 | { |
| 28772 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 28773 | g_value_set_variant (¶mv[n], child); |
| 28774 | n++; |
| 28775 | } |
| 28776 | else |
| 28777 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 28778 | g_variant_unref (child); |
| 28779 | } |
| 28780 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); |
| 28781 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 28782 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 28783 | if (!g_value_get_boolean (&return_value)) |
| 28784 | 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); |
| 28785 | g_value_unset (&return_value); |
| 28786 | for (n = 0; n < num_params + num_extra; n++) |
| 28787 | g_value_unset (¶mv[n]); |
| 28788 | g_free (paramv); |
| 28789 | } |
| 28790 | |
| 28791 | static GVariant * |
| 28792 | _host_ipmi_skeleton_handle_get_property ( |
| 28793 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28794 | const gchar *sender G_GNUC_UNUSED, |
| 28795 | const gchar *object_path G_GNUC_UNUSED, |
| 28796 | const gchar *interface_name G_GNUC_UNUSED, |
| 28797 | const gchar *property_name, |
| 28798 | GError **error, |
| 28799 | gpointer user_data) |
| 28800 | { |
| 28801 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 28802 | GValue value = G_VALUE_INIT; |
| 28803 | GParamSpec *pspec; |
| 28804 | _ExtendedGDBusPropertyInfo *info; |
| 28805 | GVariant *ret; |
| 28806 | ret = NULL; |
| 28807 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 28808 | g_assert (info != NULL); |
| 28809 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 28810 | if (pspec == NULL) |
| 28811 | { |
| 28812 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 28813 | } |
| 28814 | else |
| 28815 | { |
| 28816 | g_value_init (&value, pspec->value_type); |
| 28817 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 28818 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 28819 | g_value_unset (&value); |
| 28820 | } |
| 28821 | return ret; |
| 28822 | } |
| 28823 | |
| 28824 | static gboolean |
| 28825 | _host_ipmi_skeleton_handle_set_property ( |
| 28826 | GDBusConnection *connection G_GNUC_UNUSED, |
| 28827 | const gchar *sender G_GNUC_UNUSED, |
| 28828 | const gchar *object_path G_GNUC_UNUSED, |
| 28829 | const gchar *interface_name G_GNUC_UNUSED, |
| 28830 | const gchar *property_name, |
| 28831 | GVariant *variant, |
| 28832 | GError **error, |
| 28833 | gpointer user_data) |
| 28834 | { |
| 28835 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); |
| 28836 | GValue value = G_VALUE_INIT; |
| 28837 | GParamSpec *pspec; |
| 28838 | _ExtendedGDBusPropertyInfo *info; |
| 28839 | gboolean ret; |
| 28840 | ret = FALSE; |
| 28841 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); |
| 28842 | g_assert (info != NULL); |
| 28843 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 28844 | if (pspec == NULL) |
| 28845 | { |
| 28846 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 28847 | } |
| 28848 | else |
| 28849 | { |
| 28850 | if (info->use_gvariant) |
| 28851 | g_value_set_variant (&value, variant); |
| 28852 | else |
| 28853 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 28854 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 28855 | g_value_unset (&value); |
| 28856 | ret = TRUE; |
| 28857 | } |
| 28858 | return ret; |
| 28859 | } |
| 28860 | |
| 28861 | static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable = |
| 28862 | { |
| 28863 | _host_ipmi_skeleton_handle_method_call, |
| 28864 | _host_ipmi_skeleton_handle_get_property, |
| 28865 | _host_ipmi_skeleton_handle_set_property, |
| 28866 | {NULL} |
| 28867 | }; |
| 28868 | |
| 28869 | static GDBusInterfaceInfo * |
| 28870 | host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 28871 | { |
| 28872 | return host_ipmi_interface_info (); |
| 28873 | } |
| 28874 | |
| 28875 | static GDBusInterfaceVTable * |
| 28876 | host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 28877 | { |
| 28878 | return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable; |
| 28879 | } |
| 28880 | |
| 28881 | static GVariant * |
| 28882 | host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 28883 | { |
| 28884 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton); |
| 28885 | |
| 28886 | GVariantBuilder builder; |
| 28887 | guint n; |
| 28888 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 28889 | if (_host_ipmi_interface_info.parent_struct.properties == NULL) |
| 28890 | goto out; |
| 28891 | for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++) |
| 28892 | { |
| 28893 | GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n]; |
| 28894 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 28895 | { |
| 28896 | GVariant *value; |
| 28897 | 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); |
| 28898 | if (value != NULL) |
| 28899 | { |
| 28900 | g_variant_take_ref (value); |
| 28901 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 28902 | g_variant_unref (value); |
| 28903 | } |
| 28904 | } |
| 28905 | } |
| 28906 | out: |
| 28907 | return g_variant_builder_end (&builder); |
| 28908 | } |
| 28909 | |
| 28910 | static void |
| 28911 | host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 28912 | { |
| 28913 | } |
| 28914 | |
| 28915 | static void |
| 28916 | _host_ipmi_on_signal_received_message ( |
| 28917 | HostIpmi *object, |
| 28918 | guchar arg_seq, |
| 28919 | guchar arg_netfn, |
| 28920 | guchar arg_cmd, |
| 28921 | const gchar *arg_data) |
| 28922 | { |
| 28923 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 28924 | |
| 28925 | GList *connections, *l; |
| 28926 | GVariant *signal_variant; |
| 28927 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 28928 | |
| 28929 | signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)", |
| 28930 | arg_seq, |
| 28931 | arg_netfn, |
| 28932 | arg_cmd, |
| 28933 | arg_data)); |
| 28934 | for (l = connections; l != NULL; l = l->next) |
| 28935 | { |
| 28936 | GDBusConnection *connection = l->data; |
| 28937 | g_dbus_connection_emit_signal (connection, |
| 28938 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage", |
| 28939 | signal_variant, NULL); |
| 28940 | } |
| 28941 | g_variant_unref (signal_variant); |
| 28942 | g_list_free_full (connections, g_object_unref); |
| 28943 | } |
| 28944 | |
| 28945 | static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface); |
| 28946 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28947 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 28948 | G_ADD_PRIVATE (HostIpmiSkeleton) |
| 28949 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 28950 | |
| 28951 | #else |
| 28952 | G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 28953 | G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); |
| 28954 | |
| 28955 | #endif |
| 28956 | static void |
| 28957 | host_ipmi_skeleton_finalize (GObject *object) |
| 28958 | { |
| 28959 | HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); |
| 28960 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 28961 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 28962 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 28963 | g_main_context_unref (skeleton->priv->context); |
| 28964 | g_mutex_clear (&skeleton->priv->lock); |
| 28965 | G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object); |
| 28966 | } |
| 28967 | |
| 28968 | static void |
| 28969 | host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton) |
| 28970 | { |
| 28971 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 28972 | skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton); |
| 28973 | #else |
| 28974 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate); |
| 28975 | #endif |
| 28976 | |
| 28977 | g_mutex_init (&skeleton->priv->lock); |
| 28978 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 28979 | } |
| 28980 | |
| 28981 | static void |
| 28982 | host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass) |
| 28983 | { |
| 28984 | GObjectClass *gobject_class; |
| 28985 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 28986 | |
| 28987 | gobject_class = G_OBJECT_CLASS (klass); |
| 28988 | gobject_class->finalize = host_ipmi_skeleton_finalize; |
| 28989 | |
| 28990 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 28991 | skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info; |
| 28992 | skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties; |
| 28993 | skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush; |
| 28994 | skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable; |
| 28995 | |
| 28996 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 28997 | g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate)); |
| 28998 | #endif |
| 28999 | } |
| 29000 | |
| 29001 | static void |
| 29002 | host_ipmi_skeleton_iface_init (HostIpmiIface *iface) |
| 29003 | { |
| 29004 | iface->received_message = _host_ipmi_on_signal_received_message; |
| 29005 | } |
| 29006 | |
| 29007 | /** |
| 29008 | * host_ipmi_skeleton_new: |
| 29009 | * |
| 29010 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. |
| 29011 | * |
| 29012 | * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object. |
| 29013 | */ |
| 29014 | HostIpmi * |
| 29015 | host_ipmi_skeleton_new (void) |
| 29016 | { |
| 29017 | return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL)); |
| 29018 | } |
| 29019 | |
| 29020 | /* ------------------------------------------------------------------------ |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29021 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 29022 | * ------------------------------------------------------------------------ |
| 29023 | */ |
| 29024 | |
| 29025 | /** |
| 29026 | * SECTION:Object |
| 29027 | * @title: Object |
| 29028 | * @short_description: Specialized GDBusObject types |
| 29029 | * |
| 29030 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 29031 | */ |
| 29032 | |
| 29033 | /** |
| 29034 | * Object: |
| 29035 | * |
| 29036 | * The #Object type is a specialized container of interfaces. |
| 29037 | */ |
| 29038 | |
| 29039 | /** |
| 29040 | * ObjectIface: |
| 29041 | * @parent_iface: The parent interface. |
| 29042 | * |
| 29043 | * Virtual table for the #Object interface. |
| 29044 | */ |
| 29045 | |
| 29046 | typedef ObjectIface ObjectInterface; |
| 29047 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 29048 | |
| 29049 | static void |
| 29050 | object_default_init (ObjectIface *iface) |
| 29051 | { |
| 29052 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29053 | * Object:object-mapper: |
| 29054 | * |
| 29055 | * 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. |
| 29056 | * |
| 29057 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29058 | */ |
| 29059 | 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)); |
| 29060 | |
| 29061 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29062 | * Object:fan: |
| 29063 | * |
| 29064 | * 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. |
| 29065 | * |
| 29066 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29067 | */ |
| 29068 | g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29069 | |
| 29070 | /** |
| 29071 | * Object:sensor-value: |
| 29072 | * |
| 29073 | * 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. |
| 29074 | * |
| 29075 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29076 | */ |
| 29077 | 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)); |
| 29078 | |
| 29079 | /** |
| 29080 | * Object:sensor-threshold: |
| 29081 | * |
| 29082 | * 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. |
| 29083 | * |
| 29084 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29085 | */ |
| 29086 | 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)); |
| 29087 | |
| 29088 | /** |
| 29089 | * Object:sensor-i2c: |
| 29090 | * |
| 29091 | * 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. |
| 29092 | * |
| 29093 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29094 | */ |
| 29095 | 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)); |
| 29096 | |
| 29097 | /** |
| 29098 | * Object:sensor-match: |
| 29099 | * |
| 29100 | * 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. |
| 29101 | * |
| 29102 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29103 | */ |
| 29104 | 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)); |
| 29105 | |
| 29106 | /** |
| 29107 | * Object:process: |
| 29108 | * |
| 29109 | * 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. |
| 29110 | * |
| 29111 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29112 | */ |
| 29113 | g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29114 | |
| 29115 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29116 | * Object:shared-resource: |
| 29117 | * |
| 29118 | * 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. |
| 29119 | * |
| 29120 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29121 | */ |
| 29122 | 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)); |
| 29123 | |
| 29124 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29125 | * Object:control: |
| 29126 | * |
| 29127 | * 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. |
| 29128 | * |
| 29129 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29130 | */ |
| 29131 | g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29132 | |
| 29133 | /** |
| 29134 | * Object:control-bmc: |
| 29135 | * |
| 29136 | * 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. |
| 29137 | * |
| 29138 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29139 | */ |
| 29140 | 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)); |
| 29141 | |
| 29142 | /** |
| 29143 | * Object:control-host: |
| 29144 | * |
| 29145 | * 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. |
| 29146 | * |
| 29147 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29148 | */ |
| 29149 | 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)); |
| 29150 | |
| 29151 | /** |
| 29152 | * Object:control-power: |
| 29153 | * |
| 29154 | * 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. |
| 29155 | * |
| 29156 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29157 | */ |
| 29158 | 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)); |
| 29159 | |
| 29160 | /** |
| 29161 | * Object:watchdog: |
| 29162 | * |
| 29163 | * 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. |
| 29164 | * |
| 29165 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29166 | */ |
| 29167 | g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29168 | |
| 29169 | /** |
| 29170 | * Object:event-log: |
| 29171 | * |
| 29172 | * 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. |
| 29173 | * |
| 29174 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29175 | */ |
| 29176 | 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)); |
| 29177 | |
| 29178 | /** |
| 29179 | * Object:flash: |
| 29180 | * |
| 29181 | * 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. |
| 29182 | * |
| 29183 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29184 | */ |
| 29185 | g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29186 | |
| 29187 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29188 | * Object:flash-control: |
| 29189 | * |
| 29190 | * 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. |
| 29191 | * |
| 29192 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29193 | */ |
| 29194 | 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)); |
| 29195 | |
| 29196 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29197 | * Object:button: |
| 29198 | * |
| 29199 | * 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. |
| 29200 | * |
| 29201 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29202 | */ |
| 29203 | g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29204 | |
| 29205 | /** |
| 29206 | * Object:led: |
| 29207 | * |
| 29208 | * 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. |
| 29209 | * |
| 29210 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29211 | */ |
| 29212 | g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 29213 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 29214 | /** |
| 29215 | * Object:host-ipmi: |
| 29216 | * |
| 29217 | * 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. |
| 29218 | * |
| 29219 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 29220 | */ |
| 29221 | 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)); |
| 29222 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29223 | } |
| 29224 | |
| 29225 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29226 | * object_get_object_mapper: |
| 29227 | * @object: A #Object. |
| 29228 | * |
| 29229 | * 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. |
| 29230 | * |
| 29231 | * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29232 | */ |
| 29233 | ObjectMapper *object_get_object_mapper (Object *object) |
| 29234 | { |
| 29235 | GDBusInterface *ret; |
| 29236 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
| 29237 | if (ret == NULL) |
| 29238 | return NULL; |
| 29239 | return OBJECT_MAPPER (ret); |
| 29240 | } |
| 29241 | |
| 29242 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29243 | * object_get_fan: |
| 29244 | * @object: A #Object. |
| 29245 | * |
| 29246 | * 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. |
| 29247 | * |
| 29248 | * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29249 | */ |
| 29250 | Fan *object_get_fan (Object *object) |
| 29251 | { |
| 29252 | GDBusInterface *ret; |
| 29253 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 29254 | if (ret == NULL) |
| 29255 | return NULL; |
| 29256 | return FAN (ret); |
| 29257 | } |
| 29258 | |
| 29259 | /** |
| 29260 | * object_get_sensor_value: |
| 29261 | * @object: A #Object. |
| 29262 | * |
| 29263 | * 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. |
| 29264 | * |
| 29265 | * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29266 | */ |
| 29267 | SensorValue *object_get_sensor_value (Object *object) |
| 29268 | { |
| 29269 | GDBusInterface *ret; |
| 29270 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 29271 | if (ret == NULL) |
| 29272 | return NULL; |
| 29273 | return SENSOR_VALUE (ret); |
| 29274 | } |
| 29275 | |
| 29276 | /** |
| 29277 | * object_get_sensor_threshold: |
| 29278 | * @object: A #Object. |
| 29279 | * |
| 29280 | * 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. |
| 29281 | * |
| 29282 | * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29283 | */ |
| 29284 | SensorThreshold *object_get_sensor_threshold (Object *object) |
| 29285 | { |
| 29286 | GDBusInterface *ret; |
| 29287 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 29288 | if (ret == NULL) |
| 29289 | return NULL; |
| 29290 | return SENSOR_THRESHOLD (ret); |
| 29291 | } |
| 29292 | |
| 29293 | /** |
| 29294 | * object_get_sensor_i2c: |
| 29295 | * @object: A #Object. |
| 29296 | * |
| 29297 | * 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. |
| 29298 | * |
| 29299 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29300 | */ |
| 29301 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 29302 | { |
| 29303 | GDBusInterface *ret; |
| 29304 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 29305 | if (ret == NULL) |
| 29306 | return NULL; |
| 29307 | return SENSOR_I2C (ret); |
| 29308 | } |
| 29309 | |
| 29310 | /** |
| 29311 | * object_get_sensor_match: |
| 29312 | * @object: A #Object. |
| 29313 | * |
| 29314 | * 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. |
| 29315 | * |
| 29316 | * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29317 | */ |
| 29318 | SensorMatch *object_get_sensor_match (Object *object) |
| 29319 | { |
| 29320 | GDBusInterface *ret; |
| 29321 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 29322 | if (ret == NULL) |
| 29323 | return NULL; |
| 29324 | return SENSOR_MATCH (ret); |
| 29325 | } |
| 29326 | |
| 29327 | /** |
| 29328 | * object_get_process: |
| 29329 | * @object: A #Object. |
| 29330 | * |
| 29331 | * 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. |
| 29332 | * |
| 29333 | * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29334 | */ |
| 29335 | Process *object_get_process (Object *object) |
| 29336 | { |
| 29337 | GDBusInterface *ret; |
| 29338 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 29339 | if (ret == NULL) |
| 29340 | return NULL; |
| 29341 | return PROCESS (ret); |
| 29342 | } |
| 29343 | |
| 29344 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29345 | * object_get_shared_resource: |
| 29346 | * @object: A #Object. |
| 29347 | * |
| 29348 | * 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. |
| 29349 | * |
| 29350 | * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29351 | */ |
| 29352 | SharedResource *object_get_shared_resource (Object *object) |
| 29353 | { |
| 29354 | GDBusInterface *ret; |
| 29355 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 29356 | if (ret == NULL) |
| 29357 | return NULL; |
| 29358 | return SHARED_RESOURCE (ret); |
| 29359 | } |
| 29360 | |
| 29361 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29362 | * object_get_control: |
| 29363 | * @object: A #Object. |
| 29364 | * |
| 29365 | * 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. |
| 29366 | * |
| 29367 | * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29368 | */ |
| 29369 | Control *object_get_control (Object *object) |
| 29370 | { |
| 29371 | GDBusInterface *ret; |
| 29372 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 29373 | if (ret == NULL) |
| 29374 | return NULL; |
| 29375 | return CONTROL (ret); |
| 29376 | } |
| 29377 | |
| 29378 | /** |
| 29379 | * object_get_control_bmc: |
| 29380 | * @object: A #Object. |
| 29381 | * |
| 29382 | * 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. |
| 29383 | * |
| 29384 | * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29385 | */ |
| 29386 | ControlBmc *object_get_control_bmc (Object *object) |
| 29387 | { |
| 29388 | GDBusInterface *ret; |
| 29389 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 29390 | if (ret == NULL) |
| 29391 | return NULL; |
| 29392 | return CONTROL_BMC (ret); |
| 29393 | } |
| 29394 | |
| 29395 | /** |
| 29396 | * object_get_control_host: |
| 29397 | * @object: A #Object. |
| 29398 | * |
| 29399 | * 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. |
| 29400 | * |
| 29401 | * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29402 | */ |
| 29403 | ControlHost *object_get_control_host (Object *object) |
| 29404 | { |
| 29405 | GDBusInterface *ret; |
| 29406 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 29407 | if (ret == NULL) |
| 29408 | return NULL; |
| 29409 | return CONTROL_HOST (ret); |
| 29410 | } |
| 29411 | |
| 29412 | /** |
| 29413 | * object_get_control_power: |
| 29414 | * @object: A #Object. |
| 29415 | * |
| 29416 | * 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. |
| 29417 | * |
| 29418 | * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29419 | */ |
| 29420 | ControlPower *object_get_control_power (Object *object) |
| 29421 | { |
| 29422 | GDBusInterface *ret; |
| 29423 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 29424 | if (ret == NULL) |
| 29425 | return NULL; |
| 29426 | return CONTROL_POWER (ret); |
| 29427 | } |
| 29428 | |
| 29429 | /** |
| 29430 | * object_get_watchdog: |
| 29431 | * @object: A #Object. |
| 29432 | * |
| 29433 | * 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. |
| 29434 | * |
| 29435 | * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29436 | */ |
| 29437 | Watchdog *object_get_watchdog (Object *object) |
| 29438 | { |
| 29439 | GDBusInterface *ret; |
| 29440 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 29441 | if (ret == NULL) |
| 29442 | return NULL; |
| 29443 | return WATCHDOG (ret); |
| 29444 | } |
| 29445 | |
| 29446 | /** |
| 29447 | * object_get_event_log: |
| 29448 | * @object: A #Object. |
| 29449 | * |
| 29450 | * 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. |
| 29451 | * |
| 29452 | * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29453 | */ |
| 29454 | EventLog *object_get_event_log (Object *object) |
| 29455 | { |
| 29456 | GDBusInterface *ret; |
| 29457 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 29458 | if (ret == NULL) |
| 29459 | return NULL; |
| 29460 | return EVENT_LOG (ret); |
| 29461 | } |
| 29462 | |
| 29463 | /** |
| 29464 | * object_get_flash: |
| 29465 | * @object: A #Object. |
| 29466 | * |
| 29467 | * 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. |
| 29468 | * |
| 29469 | * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29470 | */ |
| 29471 | Flash *object_get_flash (Object *object) |
| 29472 | { |
| 29473 | GDBusInterface *ret; |
| 29474 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 29475 | if (ret == NULL) |
| 29476 | return NULL; |
| 29477 | return FLASH (ret); |
| 29478 | } |
| 29479 | |
| 29480 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29481 | * object_get_flash_control: |
| 29482 | * @object: A #Object. |
| 29483 | * |
| 29484 | * 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. |
| 29485 | * |
| 29486 | * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29487 | */ |
| 29488 | FlashControl *object_get_flash_control (Object *object) |
| 29489 | { |
| 29490 | GDBusInterface *ret; |
| 29491 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 29492 | if (ret == NULL) |
| 29493 | return NULL; |
| 29494 | return FLASH_CONTROL (ret); |
| 29495 | } |
| 29496 | |
| 29497 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29498 | * object_get_button: |
| 29499 | * @object: A #Object. |
| 29500 | * |
| 29501 | * 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. |
| 29502 | * |
| 29503 | * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29504 | */ |
| 29505 | Button *object_get_button (Object *object) |
| 29506 | { |
| 29507 | GDBusInterface *ret; |
| 29508 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 29509 | if (ret == NULL) |
| 29510 | return NULL; |
| 29511 | return BUTTON (ret); |
| 29512 | } |
| 29513 | |
| 29514 | /** |
| 29515 | * object_get_led: |
| 29516 | * @object: A #Object. |
| 29517 | * |
| 29518 | * 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. |
| 29519 | * |
| 29520 | * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29521 | */ |
| 29522 | Led *object_get_led (Object *object) |
| 29523 | { |
| 29524 | GDBusInterface *ret; |
| 29525 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 29526 | if (ret == NULL) |
| 29527 | return NULL; |
| 29528 | return LED (ret); |
| 29529 | } |
| 29530 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 29531 | /** |
| 29532 | * object_get_host_ipmi: |
| 29533 | * @object: A #Object. |
| 29534 | * |
| 29535 | * 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. |
| 29536 | * |
| 29537 | * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 29538 | */ |
| 29539 | HostIpmi *object_get_host_ipmi (Object *object) |
| 29540 | { |
| 29541 | GDBusInterface *ret; |
| 29542 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 29543 | if (ret == NULL) |
| 29544 | return NULL; |
| 29545 | return HOST_IPMI (ret); |
| 29546 | } |
| 29547 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29548 | |
| 29549 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29550 | * object_peek_object_mapper: (skip) |
| 29551 | * @object: A #Object. |
| 29552 | * |
| 29553 | * Like object_get_object_mapper() but doesn't increase the reference count on the returned object. |
| 29554 | * |
| 29555 | * <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> |
| 29556 | * |
| 29557 | * 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. |
| 29558 | */ |
| 29559 | ObjectMapper *object_peek_object_mapper (Object *object) |
| 29560 | { |
| 29561 | GDBusInterface *ret; |
| 29562 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper"); |
| 29563 | if (ret == NULL) |
| 29564 | return NULL; |
| 29565 | g_object_unref (ret); |
| 29566 | return OBJECT_MAPPER (ret); |
| 29567 | } |
| 29568 | |
| 29569 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29570 | * object_peek_fan: (skip) |
| 29571 | * @object: A #Object. |
| 29572 | * |
| 29573 | * Like object_get_fan() but doesn't increase the reference count on the returned object. |
| 29574 | * |
| 29575 | * <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> |
| 29576 | * |
| 29577 | * 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. |
| 29578 | */ |
| 29579 | Fan *object_peek_fan (Object *object) |
| 29580 | { |
| 29581 | GDBusInterface *ret; |
| 29582 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); |
| 29583 | if (ret == NULL) |
| 29584 | return NULL; |
| 29585 | g_object_unref (ret); |
| 29586 | return FAN (ret); |
| 29587 | } |
| 29588 | |
| 29589 | /** |
| 29590 | * object_peek_sensor_value: (skip) |
| 29591 | * @object: A #Object. |
| 29592 | * |
| 29593 | * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. |
| 29594 | * |
| 29595 | * <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> |
| 29596 | * |
| 29597 | * 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. |
| 29598 | */ |
| 29599 | SensorValue *object_peek_sensor_value (Object *object) |
| 29600 | { |
| 29601 | GDBusInterface *ret; |
| 29602 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
| 29603 | if (ret == NULL) |
| 29604 | return NULL; |
| 29605 | g_object_unref (ret); |
| 29606 | return SENSOR_VALUE (ret); |
| 29607 | } |
| 29608 | |
| 29609 | /** |
| 29610 | * object_peek_sensor_threshold: (skip) |
| 29611 | * @object: A #Object. |
| 29612 | * |
| 29613 | * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. |
| 29614 | * |
| 29615 | * <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> |
| 29616 | * |
| 29617 | * 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. |
| 29618 | */ |
| 29619 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
| 29620 | { |
| 29621 | GDBusInterface *ret; |
| 29622 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
| 29623 | if (ret == NULL) |
| 29624 | return NULL; |
| 29625 | g_object_unref (ret); |
| 29626 | return SENSOR_THRESHOLD (ret); |
| 29627 | } |
| 29628 | |
| 29629 | /** |
| 29630 | * object_peek_sensor_i2c: (skip) |
| 29631 | * @object: A #Object. |
| 29632 | * |
| 29633 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 29634 | * |
| 29635 | * <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> |
| 29636 | * |
| 29637 | * 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. |
| 29638 | */ |
| 29639 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 29640 | { |
| 29641 | GDBusInterface *ret; |
| 29642 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 29643 | if (ret == NULL) |
| 29644 | return NULL; |
| 29645 | g_object_unref (ret); |
| 29646 | return SENSOR_I2C (ret); |
| 29647 | } |
| 29648 | |
| 29649 | /** |
| 29650 | * object_peek_sensor_match: (skip) |
| 29651 | * @object: A #Object. |
| 29652 | * |
| 29653 | * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. |
| 29654 | * |
| 29655 | * <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> |
| 29656 | * |
| 29657 | * 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. |
| 29658 | */ |
| 29659 | SensorMatch *object_peek_sensor_match (Object *object) |
| 29660 | { |
| 29661 | GDBusInterface *ret; |
| 29662 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 29663 | if (ret == NULL) |
| 29664 | return NULL; |
| 29665 | g_object_unref (ret); |
| 29666 | return SENSOR_MATCH (ret); |
| 29667 | } |
| 29668 | |
| 29669 | /** |
| 29670 | * object_peek_process: (skip) |
| 29671 | * @object: A #Object. |
| 29672 | * |
| 29673 | * Like object_get_process() but doesn't increase the reference count on the returned object. |
| 29674 | * |
| 29675 | * <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> |
| 29676 | * |
| 29677 | * 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. |
| 29678 | */ |
| 29679 | Process *object_peek_process (Object *object) |
| 29680 | { |
| 29681 | GDBusInterface *ret; |
| 29682 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); |
| 29683 | if (ret == NULL) |
| 29684 | return NULL; |
| 29685 | g_object_unref (ret); |
| 29686 | return PROCESS (ret); |
| 29687 | } |
| 29688 | |
| 29689 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29690 | * object_peek_shared_resource: (skip) |
| 29691 | * @object: A #Object. |
| 29692 | * |
| 29693 | * Like object_get_shared_resource() but doesn't increase the reference count on the returned object. |
| 29694 | * |
| 29695 | * <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> |
| 29696 | * |
| 29697 | * 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. |
| 29698 | */ |
| 29699 | SharedResource *object_peek_shared_resource (Object *object) |
| 29700 | { |
| 29701 | GDBusInterface *ret; |
| 29702 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); |
| 29703 | if (ret == NULL) |
| 29704 | return NULL; |
| 29705 | g_object_unref (ret); |
| 29706 | return SHARED_RESOURCE (ret); |
| 29707 | } |
| 29708 | |
| 29709 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29710 | * object_peek_control: (skip) |
| 29711 | * @object: A #Object. |
| 29712 | * |
| 29713 | * Like object_get_control() but doesn't increase the reference count on the returned object. |
| 29714 | * |
| 29715 | * <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> |
| 29716 | * |
| 29717 | * 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. |
| 29718 | */ |
| 29719 | Control *object_peek_control (Object *object) |
| 29720 | { |
| 29721 | GDBusInterface *ret; |
| 29722 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); |
| 29723 | if (ret == NULL) |
| 29724 | return NULL; |
| 29725 | g_object_unref (ret); |
| 29726 | return CONTROL (ret); |
| 29727 | } |
| 29728 | |
| 29729 | /** |
| 29730 | * object_peek_control_bmc: (skip) |
| 29731 | * @object: A #Object. |
| 29732 | * |
| 29733 | * Like object_get_control_bmc() but doesn't increase the reference count on the returned object. |
| 29734 | * |
| 29735 | * <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> |
| 29736 | * |
| 29737 | * 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. |
| 29738 | */ |
| 29739 | ControlBmc *object_peek_control_bmc (Object *object) |
| 29740 | { |
| 29741 | GDBusInterface *ret; |
| 29742 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); |
| 29743 | if (ret == NULL) |
| 29744 | return NULL; |
| 29745 | g_object_unref (ret); |
| 29746 | return CONTROL_BMC (ret); |
| 29747 | } |
| 29748 | |
| 29749 | /** |
| 29750 | * object_peek_control_host: (skip) |
| 29751 | * @object: A #Object. |
| 29752 | * |
| 29753 | * Like object_get_control_host() but doesn't increase the reference count on the returned object. |
| 29754 | * |
| 29755 | * <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> |
| 29756 | * |
| 29757 | * 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. |
| 29758 | */ |
| 29759 | ControlHost *object_peek_control_host (Object *object) |
| 29760 | { |
| 29761 | GDBusInterface *ret; |
| 29762 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); |
| 29763 | if (ret == NULL) |
| 29764 | return NULL; |
| 29765 | g_object_unref (ret); |
| 29766 | return CONTROL_HOST (ret); |
| 29767 | } |
| 29768 | |
| 29769 | /** |
| 29770 | * object_peek_control_power: (skip) |
| 29771 | * @object: A #Object. |
| 29772 | * |
| 29773 | * Like object_get_control_power() but doesn't increase the reference count on the returned object. |
| 29774 | * |
| 29775 | * <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> |
| 29776 | * |
| 29777 | * 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. |
| 29778 | */ |
| 29779 | ControlPower *object_peek_control_power (Object *object) |
| 29780 | { |
| 29781 | GDBusInterface *ret; |
| 29782 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); |
| 29783 | if (ret == NULL) |
| 29784 | return NULL; |
| 29785 | g_object_unref (ret); |
| 29786 | return CONTROL_POWER (ret); |
| 29787 | } |
| 29788 | |
| 29789 | /** |
| 29790 | * object_peek_watchdog: (skip) |
| 29791 | * @object: A #Object. |
| 29792 | * |
| 29793 | * Like object_get_watchdog() but doesn't increase the reference count on the returned object. |
| 29794 | * |
| 29795 | * <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> |
| 29796 | * |
| 29797 | * 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. |
| 29798 | */ |
| 29799 | Watchdog *object_peek_watchdog (Object *object) |
| 29800 | { |
| 29801 | GDBusInterface *ret; |
| 29802 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
| 29803 | if (ret == NULL) |
| 29804 | return NULL; |
| 29805 | g_object_unref (ret); |
| 29806 | return WATCHDOG (ret); |
| 29807 | } |
| 29808 | |
| 29809 | /** |
| 29810 | * object_peek_event_log: (skip) |
| 29811 | * @object: A #Object. |
| 29812 | * |
| 29813 | * Like object_get_event_log() but doesn't increase the reference count on the returned object. |
| 29814 | * |
| 29815 | * <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> |
| 29816 | * |
| 29817 | * 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. |
| 29818 | */ |
| 29819 | EventLog *object_peek_event_log (Object *object) |
| 29820 | { |
| 29821 | GDBusInterface *ret; |
| 29822 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
| 29823 | if (ret == NULL) |
| 29824 | return NULL; |
| 29825 | g_object_unref (ret); |
| 29826 | return EVENT_LOG (ret); |
| 29827 | } |
| 29828 | |
| 29829 | /** |
| 29830 | * object_peek_flash: (skip) |
| 29831 | * @object: A #Object. |
| 29832 | * |
| 29833 | * Like object_get_flash() but doesn't increase the reference count on the returned object. |
| 29834 | * |
| 29835 | * <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> |
| 29836 | * |
| 29837 | * 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. |
| 29838 | */ |
| 29839 | Flash *object_peek_flash (Object *object) |
| 29840 | { |
| 29841 | GDBusInterface *ret; |
| 29842 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
| 29843 | if (ret == NULL) |
| 29844 | return NULL; |
| 29845 | g_object_unref (ret); |
| 29846 | return FLASH (ret); |
| 29847 | } |
| 29848 | |
| 29849 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 29850 | * object_peek_flash_control: (skip) |
| 29851 | * @object: A #Object. |
| 29852 | * |
| 29853 | * Like object_get_flash_control() but doesn't increase the reference count on the returned object. |
| 29854 | * |
| 29855 | * <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> |
| 29856 | * |
| 29857 | * 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. |
| 29858 | */ |
| 29859 | FlashControl *object_peek_flash_control (Object *object) |
| 29860 | { |
| 29861 | GDBusInterface *ret; |
| 29862 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); |
| 29863 | if (ret == NULL) |
| 29864 | return NULL; |
| 29865 | g_object_unref (ret); |
| 29866 | return FLASH_CONTROL (ret); |
| 29867 | } |
| 29868 | |
| 29869 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29870 | * object_peek_button: (skip) |
| 29871 | * @object: A #Object. |
| 29872 | * |
| 29873 | * Like object_get_button() but doesn't increase the reference count on the returned object. |
| 29874 | * |
| 29875 | * <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> |
| 29876 | * |
| 29877 | * 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. |
| 29878 | */ |
| 29879 | Button *object_peek_button (Object *object) |
| 29880 | { |
| 29881 | GDBusInterface *ret; |
| 29882 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
| 29883 | if (ret == NULL) |
| 29884 | return NULL; |
| 29885 | g_object_unref (ret); |
| 29886 | return BUTTON (ret); |
| 29887 | } |
| 29888 | |
| 29889 | /** |
| 29890 | * object_peek_led: (skip) |
| 29891 | * @object: A #Object. |
| 29892 | * |
| 29893 | * Like object_get_led() but doesn't increase the reference count on the returned object. |
| 29894 | * |
| 29895 | * <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> |
| 29896 | * |
| 29897 | * 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. |
| 29898 | */ |
| 29899 | Led *object_peek_led (Object *object) |
| 29900 | { |
| 29901 | GDBusInterface *ret; |
| 29902 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 29903 | if (ret == NULL) |
| 29904 | return NULL; |
| 29905 | g_object_unref (ret); |
| 29906 | return LED (ret); |
| 29907 | } |
| 29908 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 29909 | /** |
| 29910 | * object_peek_host_ipmi: (skip) |
| 29911 | * @object: A #Object. |
| 29912 | * |
| 29913 | * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object. |
| 29914 | * |
| 29915 | * <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> |
| 29916 | * |
| 29917 | * 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. |
| 29918 | */ |
| 29919 | HostIpmi *object_peek_host_ipmi (Object *object) |
| 29920 | { |
| 29921 | GDBusInterface *ret; |
| 29922 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 29923 | if (ret == NULL) |
| 29924 | return NULL; |
| 29925 | g_object_unref (ret); |
| 29926 | return HOST_IPMI (ret); |
| 29927 | } |
| 29928 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 29929 | |
| 29930 | static void |
| 29931 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 29932 | { |
| 29933 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 29934 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 29935 | * anything about, for example old generated code in this process talking to |
| 29936 | * newer generated code in the other process. */ |
| 29937 | if (info != NULL) |
| 29938 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 29939 | } |
| 29940 | |
| 29941 | /** |
| 29942 | * ObjectProxy: |
| 29943 | * |
| 29944 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 29945 | */ |
| 29946 | |
| 29947 | /** |
| 29948 | * ObjectProxyClass: |
| 29949 | * @parent_class: The parent class. |
| 29950 | * |
| 29951 | * Class structure for #ObjectProxy. |
| 29952 | */ |
| 29953 | |
| 29954 | static void |
| 29955 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 29956 | { |
| 29957 | } |
| 29958 | |
| 29959 | static void |
| 29960 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 29961 | { |
| 29962 | iface->interface_added = object_notify; |
| 29963 | iface->interface_removed = object_notify; |
| 29964 | } |
| 29965 | |
| 29966 | |
| 29967 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 29968 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 29969 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 29970 | |
| 29971 | static void |
| 29972 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 29973 | { |
| 29974 | } |
| 29975 | |
| 29976 | static void |
| 29977 | object_proxy_set_property (GObject *gobject, |
| 29978 | guint prop_id, |
| 29979 | const GValue *value G_GNUC_UNUSED, |
| 29980 | GParamSpec *pspec) |
| 29981 | { |
| 29982 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 29983 | } |
| 29984 | |
| 29985 | static void |
| 29986 | object_proxy_get_property (GObject *gobject, |
| 29987 | guint prop_id, |
| 29988 | GValue *value, |
| 29989 | GParamSpec *pspec) |
| 29990 | { |
| 29991 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 29992 | GDBusInterface *interface; |
| 29993 | |
| 29994 | switch (prop_id) |
| 29995 | { |
| 29996 | case 1: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 29997 | 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] | 29998 | g_value_take_object (value, interface); |
| 29999 | break; |
| 30000 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30001 | case 2: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30002 | 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] | 30003 | g_value_take_object (value, interface); |
| 30004 | break; |
| 30005 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30006 | case 3: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30007 | 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] | 30008 | g_value_take_object (value, interface); |
| 30009 | break; |
| 30010 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30011 | case 4: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30012 | 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] | 30013 | g_value_take_object (value, interface); |
| 30014 | break; |
| 30015 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30016 | case 5: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30017 | 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] | 30018 | g_value_take_object (value, interface); |
| 30019 | break; |
| 30020 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30021 | case 6: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30022 | 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] | 30023 | g_value_take_object (value, interface); |
| 30024 | break; |
| 30025 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30026 | case 7: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30027 | 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] | 30028 | g_value_take_object (value, interface); |
| 30029 | break; |
| 30030 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30031 | case 8: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30032 | 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] | 30033 | g_value_take_object (value, interface); |
| 30034 | break; |
| 30035 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30036 | case 9: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30037 | 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] | 30038 | g_value_take_object (value, interface); |
| 30039 | break; |
| 30040 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30041 | case 10: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30042 | 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] | 30043 | g_value_take_object (value, interface); |
| 30044 | break; |
| 30045 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30046 | case 11: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30047 | 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] | 30048 | g_value_take_object (value, interface); |
| 30049 | break; |
| 30050 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30051 | case 12: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30052 | 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] | 30053 | g_value_take_object (value, interface); |
| 30054 | break; |
| 30055 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30056 | case 13: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30057 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30058 | g_value_take_object (value, interface); |
| 30059 | break; |
| 30060 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30061 | case 14: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30062 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 30063 | g_value_take_object (value, interface); |
| 30064 | break; |
| 30065 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30066 | case 15: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30067 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30068 | g_value_take_object (value, interface); |
| 30069 | break; |
| 30070 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30071 | case 16: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30072 | 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] | 30073 | g_value_take_object (value, interface); |
| 30074 | break; |
| 30075 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30076 | case 17: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30077 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30078 | g_value_take_object (value, interface); |
| 30079 | break; |
| 30080 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30081 | case 18: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30082 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 30083 | g_value_take_object (value, interface); |
| 30084 | break; |
| 30085 | |
| 30086 | case 19: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30087 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 30088 | g_value_take_object (value, interface); |
| 30089 | break; |
| 30090 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30091 | default: |
| 30092 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 30093 | break; |
| 30094 | } |
| 30095 | } |
| 30096 | |
| 30097 | static void |
| 30098 | object_proxy_class_init (ObjectProxyClass *klass) |
| 30099 | { |
| 30100 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 30101 | |
| 30102 | gobject_class->set_property = object_proxy_set_property; |
| 30103 | gobject_class->get_property = object_proxy_get_property; |
| 30104 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30105 | g_object_class_override_property (gobject_class, 1, "object-mapper"); |
| 30106 | g_object_class_override_property (gobject_class, 2, "fan"); |
| 30107 | g_object_class_override_property (gobject_class, 3, "sensor-value"); |
| 30108 | g_object_class_override_property (gobject_class, 4, "sensor-threshold"); |
| 30109 | g_object_class_override_property (gobject_class, 5, "sensor-i2c"); |
| 30110 | g_object_class_override_property (gobject_class, 6, "sensor-match"); |
| 30111 | g_object_class_override_property (gobject_class, 7, "process"); |
| 30112 | g_object_class_override_property (gobject_class, 8, "shared-resource"); |
| 30113 | g_object_class_override_property (gobject_class, 9, "control"); |
| 30114 | g_object_class_override_property (gobject_class, 10, "control-bmc"); |
| 30115 | g_object_class_override_property (gobject_class, 11, "control-host"); |
| 30116 | g_object_class_override_property (gobject_class, 12, "control-power"); |
| 30117 | g_object_class_override_property (gobject_class, 13, "watchdog"); |
| 30118 | g_object_class_override_property (gobject_class, 14, "event-log"); |
| 30119 | g_object_class_override_property (gobject_class, 15, "flash"); |
| 30120 | g_object_class_override_property (gobject_class, 16, "flash-control"); |
| 30121 | g_object_class_override_property (gobject_class, 17, "button"); |
| 30122 | g_object_class_override_property (gobject_class, 18, "led"); |
| 30123 | g_object_class_override_property (gobject_class, 19, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30124 | } |
| 30125 | |
| 30126 | /** |
| 30127 | * object_proxy_new: |
| 30128 | * @connection: A #GDBusConnection. |
| 30129 | * @object_path: An object path. |
| 30130 | * |
| 30131 | * Creates a new proxy object. |
| 30132 | * |
| 30133 | * Returns: (transfer full): The proxy object. |
| 30134 | */ |
| 30135 | ObjectProxy * |
| 30136 | object_proxy_new (GDBusConnection *connection, |
| 30137 | const gchar *object_path) |
| 30138 | { |
| 30139 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 30140 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 30141 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 30142 | } |
| 30143 | |
| 30144 | /** |
| 30145 | * ObjectSkeleton: |
| 30146 | * |
| 30147 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 30148 | */ |
| 30149 | |
| 30150 | /** |
| 30151 | * ObjectSkeletonClass: |
| 30152 | * @parent_class: The parent class. |
| 30153 | * |
| 30154 | * Class structure for #ObjectSkeleton. |
| 30155 | */ |
| 30156 | |
| 30157 | static void |
| 30158 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 30159 | { |
| 30160 | } |
| 30161 | |
| 30162 | |
| 30163 | static void |
| 30164 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 30165 | { |
| 30166 | iface->interface_added = object_notify; |
| 30167 | iface->interface_removed = object_notify; |
| 30168 | } |
| 30169 | |
| 30170 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 30171 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 30172 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 30173 | |
| 30174 | static void |
| 30175 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 30176 | { |
| 30177 | } |
| 30178 | |
| 30179 | static void |
| 30180 | object_skeleton_set_property (GObject *gobject, |
| 30181 | guint prop_id, |
| 30182 | const GValue *value, |
| 30183 | GParamSpec *pspec) |
| 30184 | { |
| 30185 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 30186 | GDBusInterfaceSkeleton *interface; |
| 30187 | |
| 30188 | switch (prop_id) |
| 30189 | { |
| 30190 | case 1: |
| 30191 | interface = g_value_get_object (value); |
| 30192 | if (interface != NULL) |
| 30193 | { |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30194 | g_warn_if_fail (IS_OBJECT_MAPPER (interface)); |
| 30195 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30196 | } |
| 30197 | else |
| 30198 | { |
| 30199 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper"); |
| 30200 | } |
| 30201 | break; |
| 30202 | |
| 30203 | case 2: |
| 30204 | interface = g_value_get_object (value); |
| 30205 | if (interface != NULL) |
| 30206 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30207 | g_warn_if_fail (IS_FAN (interface)); |
| 30208 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30209 | } |
| 30210 | else |
| 30211 | { |
| 30212 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan"); |
| 30213 | } |
| 30214 | break; |
| 30215 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30216 | case 3: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30217 | interface = g_value_get_object (value); |
| 30218 | if (interface != NULL) |
| 30219 | { |
| 30220 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
| 30221 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30222 | } |
| 30223 | else |
| 30224 | { |
| 30225 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); |
| 30226 | } |
| 30227 | break; |
| 30228 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30229 | case 4: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30230 | interface = g_value_get_object (value); |
| 30231 | if (interface != NULL) |
| 30232 | { |
| 30233 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
| 30234 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30235 | } |
| 30236 | else |
| 30237 | { |
| 30238 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); |
| 30239 | } |
| 30240 | break; |
| 30241 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30242 | case 5: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30243 | interface = g_value_get_object (value); |
| 30244 | if (interface != NULL) |
| 30245 | { |
| 30246 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
| 30247 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30248 | } |
| 30249 | else |
| 30250 | { |
| 30251 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); |
| 30252 | } |
| 30253 | break; |
| 30254 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30255 | case 6: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30256 | interface = g_value_get_object (value); |
| 30257 | if (interface != NULL) |
| 30258 | { |
| 30259 | g_warn_if_fail (IS_SENSOR_MATCH (interface)); |
| 30260 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30261 | } |
| 30262 | else |
| 30263 | { |
| 30264 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); |
| 30265 | } |
| 30266 | break; |
| 30267 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30268 | case 7: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30269 | interface = g_value_get_object (value); |
| 30270 | if (interface != NULL) |
| 30271 | { |
| 30272 | g_warn_if_fail (IS_PROCESS (interface)); |
| 30273 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30274 | } |
| 30275 | else |
| 30276 | { |
| 30277 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process"); |
| 30278 | } |
| 30279 | break; |
| 30280 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30281 | case 8: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30282 | interface = g_value_get_object (value); |
| 30283 | if (interface != NULL) |
| 30284 | { |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30285 | g_warn_if_fail (IS_SHARED_RESOURCE (interface)); |
| 30286 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30287 | } |
| 30288 | else |
| 30289 | { |
| 30290 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource"); |
| 30291 | } |
| 30292 | break; |
| 30293 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30294 | case 9: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30295 | interface = g_value_get_object (value); |
| 30296 | if (interface != NULL) |
| 30297 | { |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30298 | g_warn_if_fail (IS_CONTROL (interface)); |
| 30299 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30300 | } |
| 30301 | else |
| 30302 | { |
| 30303 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control"); |
| 30304 | } |
| 30305 | break; |
| 30306 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30307 | case 10: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30308 | interface = g_value_get_object (value); |
| 30309 | if (interface != NULL) |
| 30310 | { |
| 30311 | g_warn_if_fail (IS_CONTROL_BMC (interface)); |
| 30312 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30313 | } |
| 30314 | else |
| 30315 | { |
| 30316 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc"); |
| 30317 | } |
| 30318 | break; |
| 30319 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30320 | case 11: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30321 | interface = g_value_get_object (value); |
| 30322 | if (interface != NULL) |
| 30323 | { |
| 30324 | g_warn_if_fail (IS_CONTROL_HOST (interface)); |
| 30325 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30326 | } |
| 30327 | else |
| 30328 | { |
| 30329 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host"); |
| 30330 | } |
| 30331 | break; |
| 30332 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30333 | case 12: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30334 | interface = g_value_get_object (value); |
| 30335 | if (interface != NULL) |
| 30336 | { |
| 30337 | g_warn_if_fail (IS_CONTROL_POWER (interface)); |
| 30338 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30339 | } |
| 30340 | else |
| 30341 | { |
| 30342 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power"); |
| 30343 | } |
| 30344 | break; |
| 30345 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30346 | case 13: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30347 | interface = g_value_get_object (value); |
| 30348 | if (interface != NULL) |
| 30349 | { |
| 30350 | g_warn_if_fail (IS_WATCHDOG (interface)); |
| 30351 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30352 | } |
| 30353 | else |
| 30354 | { |
| 30355 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); |
| 30356 | } |
| 30357 | break; |
| 30358 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30359 | case 14: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30360 | interface = g_value_get_object (value); |
| 30361 | if (interface != NULL) |
| 30362 | { |
| 30363 | g_warn_if_fail (IS_EVENT_LOG (interface)); |
| 30364 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30365 | } |
| 30366 | else |
| 30367 | { |
| 30368 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog"); |
| 30369 | } |
| 30370 | break; |
| 30371 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30372 | case 15: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30373 | interface = g_value_get_object (value); |
| 30374 | if (interface != NULL) |
| 30375 | { |
| 30376 | g_warn_if_fail (IS_FLASH (interface)); |
| 30377 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30378 | } |
| 30379 | else |
| 30380 | { |
| 30381 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash"); |
| 30382 | } |
| 30383 | break; |
| 30384 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30385 | case 16: |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30386 | interface = g_value_get_object (value); |
| 30387 | if (interface != NULL) |
| 30388 | { |
| 30389 | g_warn_if_fail (IS_FLASH_CONTROL (interface)); |
| 30390 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30391 | } |
| 30392 | else |
| 30393 | { |
| 30394 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl"); |
| 30395 | } |
| 30396 | break; |
| 30397 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30398 | case 17: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30399 | interface = g_value_get_object (value); |
| 30400 | if (interface != NULL) |
| 30401 | { |
| 30402 | g_warn_if_fail (IS_BUTTON (interface)); |
| 30403 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30404 | } |
| 30405 | else |
| 30406 | { |
| 30407 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button"); |
| 30408 | } |
| 30409 | break; |
| 30410 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30411 | case 18: |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30412 | interface = g_value_get_object (value); |
| 30413 | if (interface != NULL) |
| 30414 | { |
| 30415 | g_warn_if_fail (IS_LED (interface)); |
| 30416 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30417 | } |
| 30418 | else |
| 30419 | { |
| 30420 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led"); |
| 30421 | } |
| 30422 | break; |
| 30423 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30424 | case 19: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30425 | interface = g_value_get_object (value); |
| 30426 | if (interface != NULL) |
| 30427 | { |
| 30428 | g_warn_if_fail (IS_HOST_IPMI (interface)); |
| 30429 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 30430 | } |
| 30431 | else |
| 30432 | { |
| 30433 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi"); |
| 30434 | } |
| 30435 | break; |
| 30436 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30437 | default: |
| 30438 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 30439 | break; |
| 30440 | } |
| 30441 | } |
| 30442 | |
| 30443 | static void |
| 30444 | object_skeleton_get_property (GObject *gobject, |
| 30445 | guint prop_id, |
| 30446 | GValue *value, |
| 30447 | GParamSpec *pspec) |
| 30448 | { |
| 30449 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 30450 | GDBusInterface *interface; |
| 30451 | |
| 30452 | switch (prop_id) |
| 30453 | { |
| 30454 | case 1: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30455 | 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] | 30456 | g_value_take_object (value, interface); |
| 30457 | break; |
| 30458 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30459 | case 2: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30460 | 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] | 30461 | g_value_take_object (value, interface); |
| 30462 | break; |
| 30463 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30464 | case 3: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30465 | 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] | 30466 | g_value_take_object (value, interface); |
| 30467 | break; |
| 30468 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30469 | case 4: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30470 | 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] | 30471 | g_value_take_object (value, interface); |
| 30472 | break; |
| 30473 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30474 | case 5: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30475 | 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] | 30476 | g_value_take_object (value, interface); |
| 30477 | break; |
| 30478 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30479 | case 6: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30480 | 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] | 30481 | g_value_take_object (value, interface); |
| 30482 | break; |
| 30483 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30484 | case 7: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30485 | 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] | 30486 | g_value_take_object (value, interface); |
| 30487 | break; |
| 30488 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30489 | case 8: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30490 | 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] | 30491 | g_value_take_object (value, interface); |
| 30492 | break; |
| 30493 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30494 | case 9: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30495 | 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] | 30496 | g_value_take_object (value, interface); |
| 30497 | break; |
| 30498 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30499 | case 10: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30500 | 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] | 30501 | g_value_take_object (value, interface); |
| 30502 | break; |
| 30503 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30504 | case 11: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30505 | 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] | 30506 | g_value_take_object (value, interface); |
| 30507 | break; |
| 30508 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30509 | case 12: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30510 | 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] | 30511 | g_value_take_object (value, interface); |
| 30512 | break; |
| 30513 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30514 | case 13: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30515 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30516 | g_value_take_object (value, interface); |
| 30517 | break; |
| 30518 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30519 | case 14: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30520 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); |
Norman James | dfdaca9 | 2015-09-27 22:11:15 -0500 | [diff] [blame] | 30521 | g_value_take_object (value, interface); |
| 30522 | break; |
| 30523 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30524 | case 15: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30525 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30526 | g_value_take_object (value, interface); |
| 30527 | break; |
| 30528 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30529 | case 16: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30530 | 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] | 30531 | g_value_take_object (value, interface); |
| 30532 | break; |
| 30533 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30534 | case 17: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30535 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30536 | g_value_take_object (value, interface); |
| 30537 | break; |
| 30538 | |
Norman James | a3e47c4 | 2015-10-18 14:43:10 -0500 | [diff] [blame] | 30539 | case 18: |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30540 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); |
| 30541 | g_value_take_object (value, interface); |
| 30542 | break; |
| 30543 | |
| 30544 | case 19: |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30545 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); |
| 30546 | g_value_take_object (value, interface); |
| 30547 | break; |
| 30548 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30549 | default: |
| 30550 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 30551 | break; |
| 30552 | } |
| 30553 | } |
| 30554 | |
| 30555 | static void |
| 30556 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 30557 | { |
| 30558 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 30559 | |
| 30560 | gobject_class->set_property = object_skeleton_set_property; |
| 30561 | gobject_class->get_property = object_skeleton_get_property; |
| 30562 | |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30563 | g_object_class_override_property (gobject_class, 1, "object-mapper"); |
| 30564 | g_object_class_override_property (gobject_class, 2, "fan"); |
| 30565 | g_object_class_override_property (gobject_class, 3, "sensor-value"); |
| 30566 | g_object_class_override_property (gobject_class, 4, "sensor-threshold"); |
| 30567 | g_object_class_override_property (gobject_class, 5, "sensor-i2c"); |
| 30568 | g_object_class_override_property (gobject_class, 6, "sensor-match"); |
| 30569 | g_object_class_override_property (gobject_class, 7, "process"); |
| 30570 | g_object_class_override_property (gobject_class, 8, "shared-resource"); |
| 30571 | g_object_class_override_property (gobject_class, 9, "control"); |
| 30572 | g_object_class_override_property (gobject_class, 10, "control-bmc"); |
| 30573 | g_object_class_override_property (gobject_class, 11, "control-host"); |
| 30574 | g_object_class_override_property (gobject_class, 12, "control-power"); |
| 30575 | g_object_class_override_property (gobject_class, 13, "watchdog"); |
| 30576 | g_object_class_override_property (gobject_class, 14, "event-log"); |
| 30577 | g_object_class_override_property (gobject_class, 15, "flash"); |
| 30578 | g_object_class_override_property (gobject_class, 16, "flash-control"); |
| 30579 | g_object_class_override_property (gobject_class, 17, "button"); |
| 30580 | g_object_class_override_property (gobject_class, 18, "led"); |
| 30581 | g_object_class_override_property (gobject_class, 19, "host-ipmi"); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30582 | } |
| 30583 | |
| 30584 | /** |
| 30585 | * object_skeleton_new: |
| 30586 | * @object_path: An object path. |
| 30587 | * |
| 30588 | * Creates a new skeleton object. |
| 30589 | * |
| 30590 | * Returns: (transfer full): The skeleton object. |
| 30591 | */ |
| 30592 | ObjectSkeleton * |
| 30593 | object_skeleton_new (const gchar *object_path) |
| 30594 | { |
| 30595 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 30596 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 30597 | } |
| 30598 | |
| 30599 | /** |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30600 | * object_skeleton_set_object_mapper: |
| 30601 | * @object: A #ObjectSkeleton. |
| 30602 | * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface. |
| 30603 | * |
| 30604 | * 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. |
| 30605 | */ |
| 30606 | void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_) |
| 30607 | { |
| 30608 | g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL); |
| 30609 | } |
| 30610 | |
| 30611 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30612 | * object_skeleton_set_fan: |
| 30613 | * @object: A #ObjectSkeleton. |
| 30614 | * @interface_: (allow-none): A #Fan or %NULL to clear the interface. |
| 30615 | * |
| 30616 | * 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. |
| 30617 | */ |
| 30618 | void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_) |
| 30619 | { |
| 30620 | g_object_set (G_OBJECT (object), "fan", interface_, NULL); |
| 30621 | } |
| 30622 | |
| 30623 | /** |
| 30624 | * object_skeleton_set_sensor_value: |
| 30625 | * @object: A #ObjectSkeleton. |
| 30626 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
| 30627 | * |
| 30628 | * 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. |
| 30629 | */ |
| 30630 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
| 30631 | { |
| 30632 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
| 30633 | } |
| 30634 | |
| 30635 | /** |
| 30636 | * object_skeleton_set_sensor_threshold: |
| 30637 | * @object: A #ObjectSkeleton. |
| 30638 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
| 30639 | * |
| 30640 | * 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. |
| 30641 | */ |
| 30642 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
| 30643 | { |
| 30644 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
| 30645 | } |
| 30646 | |
| 30647 | /** |
| 30648 | * object_skeleton_set_sensor_i2c: |
| 30649 | * @object: A #ObjectSkeleton. |
| 30650 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 30651 | * |
| 30652 | * 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. |
| 30653 | */ |
| 30654 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 30655 | { |
| 30656 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 30657 | } |
| 30658 | |
| 30659 | /** |
| 30660 | * object_skeleton_set_sensor_match: |
| 30661 | * @object: A #ObjectSkeleton. |
| 30662 | * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. |
| 30663 | * |
| 30664 | * 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. |
| 30665 | */ |
| 30666 | void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) |
| 30667 | { |
| 30668 | g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); |
| 30669 | } |
| 30670 | |
| 30671 | /** |
| 30672 | * object_skeleton_set_process: |
| 30673 | * @object: A #ObjectSkeleton. |
| 30674 | * @interface_: (allow-none): A #Process or %NULL to clear the interface. |
| 30675 | * |
| 30676 | * 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. |
| 30677 | */ |
| 30678 | void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_) |
| 30679 | { |
| 30680 | g_object_set (G_OBJECT (object), "process", interface_, NULL); |
| 30681 | } |
| 30682 | |
| 30683 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30684 | * object_skeleton_set_shared_resource: |
| 30685 | * @object: A #ObjectSkeleton. |
| 30686 | * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface. |
| 30687 | * |
| 30688 | * 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. |
| 30689 | */ |
| 30690 | void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_) |
| 30691 | { |
| 30692 | g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL); |
| 30693 | } |
| 30694 | |
| 30695 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30696 | * object_skeleton_set_control: |
| 30697 | * @object: A #ObjectSkeleton. |
| 30698 | * @interface_: (allow-none): A #Control or %NULL to clear the interface. |
| 30699 | * |
| 30700 | * 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. |
| 30701 | */ |
| 30702 | void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_) |
| 30703 | { |
| 30704 | g_object_set (G_OBJECT (object), "control", interface_, NULL); |
| 30705 | } |
| 30706 | |
| 30707 | /** |
| 30708 | * object_skeleton_set_control_bmc: |
| 30709 | * @object: A #ObjectSkeleton. |
| 30710 | * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface. |
| 30711 | * |
| 30712 | * 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. |
| 30713 | */ |
| 30714 | void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_) |
| 30715 | { |
| 30716 | g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL); |
| 30717 | } |
| 30718 | |
| 30719 | /** |
| 30720 | * object_skeleton_set_control_host: |
| 30721 | * @object: A #ObjectSkeleton. |
| 30722 | * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface. |
| 30723 | * |
| 30724 | * 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. |
| 30725 | */ |
| 30726 | void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_) |
| 30727 | { |
| 30728 | g_object_set (G_OBJECT (object), "control-host", interface_, NULL); |
| 30729 | } |
| 30730 | |
| 30731 | /** |
| 30732 | * object_skeleton_set_control_power: |
| 30733 | * @object: A #ObjectSkeleton. |
| 30734 | * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface. |
| 30735 | * |
| 30736 | * 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. |
| 30737 | */ |
| 30738 | void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_) |
| 30739 | { |
| 30740 | g_object_set (G_OBJECT (object), "control-power", interface_, NULL); |
| 30741 | } |
| 30742 | |
| 30743 | /** |
| 30744 | * object_skeleton_set_watchdog: |
| 30745 | * @object: A #ObjectSkeleton. |
| 30746 | * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. |
| 30747 | * |
| 30748 | * 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. |
| 30749 | */ |
| 30750 | void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) |
| 30751 | { |
| 30752 | g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); |
| 30753 | } |
| 30754 | |
| 30755 | /** |
| 30756 | * object_skeleton_set_event_log: |
| 30757 | * @object: A #ObjectSkeleton. |
| 30758 | * @interface_: (allow-none): A #EventLog or %NULL to clear the interface. |
| 30759 | * |
| 30760 | * 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. |
| 30761 | */ |
| 30762 | void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_) |
| 30763 | { |
| 30764 | g_object_set (G_OBJECT (object), "event-log", interface_, NULL); |
| 30765 | } |
| 30766 | |
| 30767 | /** |
| 30768 | * object_skeleton_set_flash: |
| 30769 | * @object: A #ObjectSkeleton. |
| 30770 | * @interface_: (allow-none): A #Flash or %NULL to clear the interface. |
| 30771 | * |
| 30772 | * 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. |
| 30773 | */ |
| 30774 | void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_) |
| 30775 | { |
| 30776 | g_object_set (G_OBJECT (object), "flash", interface_, NULL); |
| 30777 | } |
| 30778 | |
| 30779 | /** |
Norman James | 1899818 | 2015-10-11 21:54:53 -0500 | [diff] [blame] | 30780 | * object_skeleton_set_flash_control: |
| 30781 | * @object: A #ObjectSkeleton. |
| 30782 | * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface. |
| 30783 | * |
| 30784 | * 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. |
| 30785 | */ |
| 30786 | void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_) |
| 30787 | { |
| 30788 | g_object_set (G_OBJECT (object), "flash-control", interface_, NULL); |
| 30789 | } |
| 30790 | |
| 30791 | /** |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30792 | * object_skeleton_set_button: |
| 30793 | * @object: A #ObjectSkeleton. |
| 30794 | * @interface_: (allow-none): A #Button or %NULL to clear the interface. |
| 30795 | * |
| 30796 | * 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. |
| 30797 | */ |
| 30798 | void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_) |
| 30799 | { |
| 30800 | g_object_set (G_OBJECT (object), "button", interface_, NULL); |
| 30801 | } |
| 30802 | |
| 30803 | /** |
| 30804 | * object_skeleton_set_led: |
| 30805 | * @object: A #ObjectSkeleton. |
| 30806 | * @interface_: (allow-none): A #Led or %NULL to clear the interface. |
| 30807 | * |
| 30808 | * 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. |
| 30809 | */ |
| 30810 | void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_) |
| 30811 | { |
| 30812 | g_object_set (G_OBJECT (object), "led", interface_, NULL); |
| 30813 | } |
| 30814 | |
Norman James | dbcffbd | 2015-10-06 16:53:06 -0500 | [diff] [blame] | 30815 | /** |
| 30816 | * object_skeleton_set_host_ipmi: |
| 30817 | * @object: A #ObjectSkeleton. |
| 30818 | * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface. |
| 30819 | * |
| 30820 | * 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. |
| 30821 | */ |
| 30822 | void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_) |
| 30823 | { |
| 30824 | g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL); |
| 30825 | } |
| 30826 | |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30827 | |
| 30828 | /* ------------------------------------------------------------------------ |
| 30829 | * Code for ObjectManager client |
| 30830 | * ------------------------------------------------------------------------ |
| 30831 | */ |
| 30832 | |
| 30833 | /** |
| 30834 | * SECTION:ObjectManagerClient |
| 30835 | * @title: ObjectManagerClient |
| 30836 | * @short_description: Generated GDBusObjectManagerClient type |
| 30837 | * |
| 30838 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 30839 | */ |
| 30840 | |
| 30841 | /** |
| 30842 | * ObjectManagerClient: |
| 30843 | * |
| 30844 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 30845 | */ |
| 30846 | |
| 30847 | /** |
| 30848 | * ObjectManagerClientClass: |
| 30849 | * @parent_class: The parent class. |
| 30850 | * |
| 30851 | * Class structure for #ObjectManagerClient. |
| 30852 | */ |
| 30853 | |
| 30854 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 30855 | |
| 30856 | static void |
| 30857 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 30858 | { |
| 30859 | } |
| 30860 | |
| 30861 | static void |
| 30862 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 30863 | { |
| 30864 | } |
| 30865 | |
| 30866 | /** |
| 30867 | * object_manager_client_get_proxy_type: |
| 30868 | * @manager: A #GDBusObjectManagerClient. |
| 30869 | * @object_path: The object path of the remote object (unused). |
| 30870 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 30871 | * @user_data: User data (unused). |
| 30872 | * |
| 30873 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 30874 | * |
| 30875 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 30876 | */ |
| 30877 | GType |
| 30878 | 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) |
| 30879 | { |
| 30880 | static gsize once_init_value = 0; |
| 30881 | static GHashTable *lookup_hash; |
| 30882 | GType ret; |
| 30883 | |
| 30884 | if (interface_name == NULL) |
| 30885 | return TYPE_OBJECT_PROXY; |
| 30886 | if (g_once_init_enter (&once_init_value)) |
| 30887 | { |
| 30888 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
Norman James | 493996c | 2015-10-31 17:27:13 -0500 | [diff] [blame] | 30889 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Object.Mapper", GSIZE_TO_POINTER (TYPE_OBJECT_MAPPER_PROXY)); |
Norman James | 362a80f | 2015-09-14 14:04:39 -0500 | [diff] [blame] | 30890 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY)); |
| 30891 | 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] | 30892 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); |
| 30893 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
| 30894 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); |
| 30895 | 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] | 30896 | 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] | 30897 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY)); |
| 30898 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY)); |
| 30899 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY)); |
| 30900 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY)); |
| 30901 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); |
| 30902 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY)); |
| 30903 | 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] | 30904 | 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] | 30905 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY)); |
| 30906 | 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] | 30907 | 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] | 30908 | g_once_init_leave (&once_init_value, 1); |
| 30909 | } |
| 30910 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 30911 | if (ret == (GType) 0) |
| 30912 | ret = G_TYPE_DBUS_PROXY; |
| 30913 | return ret; |
| 30914 | } |
| 30915 | |
| 30916 | /** |
| 30917 | * object_manager_client_new: |
| 30918 | * @connection: A #GDBusConnection. |
| 30919 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 30920 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 30921 | * @object_path: An object path. |
| 30922 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 30923 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 30924 | * @user_data: User data to pass to @callback. |
| 30925 | * |
| 30926 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 30927 | * |
| 30928 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 30929 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 30930 | * |
| 30931 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 30932 | */ |
| 30933 | void |
| 30934 | object_manager_client_new ( |
| 30935 | GDBusConnection *connection, |
| 30936 | GDBusObjectManagerClientFlags flags, |
| 30937 | const gchar *name, |
| 30938 | const gchar *object_path, |
| 30939 | GCancellable *cancellable, |
| 30940 | GAsyncReadyCallback callback, |
| 30941 | gpointer user_data) |
| 30942 | { |
| 30943 | 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); |
| 30944 | } |
| 30945 | |
| 30946 | /** |
| 30947 | * object_manager_client_new_finish: |
| 30948 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 30949 | * @error: Return location for error or %NULL |
| 30950 | * |
| 30951 | * Finishes an operation started with object_manager_client_new(). |
| 30952 | * |
| 30953 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 30954 | */ |
| 30955 | GDBusObjectManager * |
| 30956 | object_manager_client_new_finish ( |
| 30957 | GAsyncResult *res, |
| 30958 | GError **error) |
| 30959 | { |
| 30960 | GObject *ret; |
| 30961 | GObject *source_object; |
| 30962 | source_object = g_async_result_get_source_object (res); |
| 30963 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 30964 | g_object_unref (source_object); |
| 30965 | if (ret != NULL) |
| 30966 | return G_DBUS_OBJECT_MANAGER (ret); |
| 30967 | else |
| 30968 | return NULL; |
| 30969 | } |
| 30970 | |
| 30971 | /** |
| 30972 | * object_manager_client_new_sync: |
| 30973 | * @connection: A #GDBusConnection. |
| 30974 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 30975 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 30976 | * @object_path: An object path. |
| 30977 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 30978 | * @error: Return location for error or %NULL |
| 30979 | * |
| 30980 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 30981 | * |
| 30982 | * The calling thread is blocked until a reply is received. |
| 30983 | * |
| 30984 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 30985 | * |
| 30986 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 30987 | */ |
| 30988 | GDBusObjectManager * |
| 30989 | object_manager_client_new_sync ( |
| 30990 | GDBusConnection *connection, |
| 30991 | GDBusObjectManagerClientFlags flags, |
| 30992 | const gchar *name, |
| 30993 | const gchar *object_path, |
| 30994 | GCancellable *cancellable, |
| 30995 | GError **error) |
| 30996 | { |
| 30997 | GInitable *ret; |
| 30998 | 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); |
| 30999 | if (ret != NULL) |
| 31000 | return G_DBUS_OBJECT_MANAGER (ret); |
| 31001 | else |
| 31002 | return NULL; |
| 31003 | } |
| 31004 | |
| 31005 | |
| 31006 | /** |
| 31007 | * object_manager_client_new_for_bus: |
| 31008 | * @bus_type: A #GBusType. |
| 31009 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 31010 | * @name: A bus name (well-known or unique). |
| 31011 | * @object_path: An object path. |
| 31012 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 31013 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 31014 | * @user_data: User data to pass to @callback. |
| 31015 | * |
| 31016 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 31017 | * |
| 31018 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 31019 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 31020 | * |
| 31021 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 31022 | */ |
| 31023 | void |
| 31024 | object_manager_client_new_for_bus ( |
| 31025 | GBusType bus_type, |
| 31026 | GDBusObjectManagerClientFlags flags, |
| 31027 | const gchar *name, |
| 31028 | const gchar *object_path, |
| 31029 | GCancellable *cancellable, |
| 31030 | GAsyncReadyCallback callback, |
| 31031 | gpointer user_data) |
| 31032 | { |
| 31033 | 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); |
| 31034 | } |
| 31035 | |
| 31036 | /** |
| 31037 | * object_manager_client_new_for_bus_finish: |
| 31038 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 31039 | * @error: Return location for error or %NULL |
| 31040 | * |
| 31041 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 31042 | * |
| 31043 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 31044 | */ |
| 31045 | GDBusObjectManager * |
| 31046 | object_manager_client_new_for_bus_finish ( |
| 31047 | GAsyncResult *res, |
| 31048 | GError **error) |
| 31049 | { |
| 31050 | GObject *ret; |
| 31051 | GObject *source_object; |
| 31052 | source_object = g_async_result_get_source_object (res); |
| 31053 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 31054 | g_object_unref (source_object); |
| 31055 | if (ret != NULL) |
| 31056 | return G_DBUS_OBJECT_MANAGER (ret); |
| 31057 | else |
| 31058 | return NULL; |
| 31059 | } |
| 31060 | |
| 31061 | /** |
| 31062 | * object_manager_client_new_for_bus_sync: |
| 31063 | * @bus_type: A #GBusType. |
| 31064 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 31065 | * @name: A bus name (well-known or unique). |
| 31066 | * @object_path: An object path. |
| 31067 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 31068 | * @error: Return location for error or %NULL |
| 31069 | * |
| 31070 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 31071 | * |
| 31072 | * The calling thread is blocked until a reply is received. |
| 31073 | * |
| 31074 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 31075 | * |
| 31076 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 31077 | */ |
| 31078 | GDBusObjectManager * |
| 31079 | object_manager_client_new_for_bus_sync ( |
| 31080 | GBusType bus_type, |
| 31081 | GDBusObjectManagerClientFlags flags, |
| 31082 | const gchar *name, |
| 31083 | const gchar *object_path, |
| 31084 | GCancellable *cancellable, |
| 31085 | GError **error) |
| 31086 | { |
| 31087 | GInitable *ret; |
| 31088 | 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); |
| 31089 | if (ret != NULL) |
| 31090 | return G_DBUS_OBJECT_MANAGER (ret); |
| 31091 | else |
| 31092 | return NULL; |
| 31093 | } |
| 31094 | |
| 31095 | |