Norman James | dc95ef7 | 2015-08-27 21:27:03 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Generated by gdbus-codegen 2.40.2. DO NOT EDIT. |
| 3 | * |
| 4 | * The license of this code is the same as for the source it was derived from. |
| 5 | */ |
| 6 | |
| 7 | #ifdef HAVE_CONFIG_H |
| 8 | # include "config.h" |
| 9 | #endif |
| 10 | |
| 11 | #include "interfaces/sensor_threshold.h" |
| 12 | |
| 13 | #include <string.h> |
| 14 | #ifdef G_OS_UNIX |
| 15 | # include <gio/gunixfdlist.h> |
| 16 | #endif |
| 17 | |
| 18 | typedef struct |
| 19 | { |
| 20 | GDBusArgInfo parent_struct; |
| 21 | gboolean use_gvariant; |
| 22 | } _ExtendedGDBusArgInfo; |
| 23 | |
| 24 | typedef struct |
| 25 | { |
| 26 | GDBusMethodInfo parent_struct; |
| 27 | const gchar *signal_name; |
| 28 | gboolean pass_fdlist; |
| 29 | } _ExtendedGDBusMethodInfo; |
| 30 | |
| 31 | typedef struct |
| 32 | { |
| 33 | GDBusSignalInfo parent_struct; |
| 34 | const gchar *signal_name; |
| 35 | } _ExtendedGDBusSignalInfo; |
| 36 | |
| 37 | typedef struct |
| 38 | { |
| 39 | GDBusPropertyInfo parent_struct; |
| 40 | const gchar *hyphen_name; |
| 41 | gboolean use_gvariant; |
| 42 | } _ExtendedGDBusPropertyInfo; |
| 43 | |
| 44 | typedef struct |
| 45 | { |
| 46 | GDBusInterfaceInfo parent_struct; |
| 47 | const gchar *hyphen_name; |
| 48 | } _ExtendedGDBusInterfaceInfo; |
| 49 | |
| 50 | typedef struct |
| 51 | { |
| 52 | const _ExtendedGDBusPropertyInfo *info; |
| 53 | guint prop_id; |
| 54 | GValue orig_value; /* the value before the change */ |
| 55 | } ChangedProperty; |
| 56 | |
| 57 | static void |
| 58 | _changed_property_free (ChangedProperty *data) |
| 59 | { |
| 60 | g_value_unset (&data->orig_value); |
| 61 | g_free (data); |
| 62 | } |
| 63 | |
| 64 | static gboolean |
| 65 | _g_strv_equal0 (gchar **a, gchar **b) |
| 66 | { |
| 67 | gboolean ret = FALSE; |
| 68 | guint n; |
| 69 | if (a == NULL && b == NULL) |
| 70 | { |
| 71 | ret = TRUE; |
| 72 | goto out; |
| 73 | } |
| 74 | if (a == NULL || b == NULL) |
| 75 | goto out; |
| 76 | if (g_strv_length (a) != g_strv_length (b)) |
| 77 | goto out; |
| 78 | for (n = 0; a[n] != NULL; n++) |
| 79 | if (g_strcmp0 (a[n], b[n]) != 0) |
| 80 | goto out; |
| 81 | ret = TRUE; |
| 82 | out: |
| 83 | return ret; |
| 84 | } |
| 85 | |
| 86 | static gboolean |
| 87 | _g_variant_equal0 (GVariant *a, GVariant *b) |
| 88 | { |
| 89 | gboolean ret = FALSE; |
| 90 | if (a == NULL && b == NULL) |
| 91 | { |
| 92 | ret = TRUE; |
| 93 | goto out; |
| 94 | } |
| 95 | if (a == NULL || b == NULL) |
| 96 | goto out; |
| 97 | ret = g_variant_equal (a, b); |
| 98 | out: |
| 99 | return ret; |
| 100 | } |
| 101 | |
| 102 | G_GNUC_UNUSED static gboolean |
| 103 | _g_value_equal (const GValue *a, const GValue *b) |
| 104 | { |
| 105 | gboolean ret = FALSE; |
| 106 | g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
| 107 | switch (G_VALUE_TYPE (a)) |
| 108 | { |
| 109 | case G_TYPE_BOOLEAN: |
| 110 | ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
| 111 | break; |
| 112 | case G_TYPE_UCHAR: |
| 113 | ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
| 114 | break; |
| 115 | case G_TYPE_INT: |
| 116 | ret = (g_value_get_int (a) == g_value_get_int (b)); |
| 117 | break; |
| 118 | case G_TYPE_UINT: |
| 119 | ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
| 120 | break; |
| 121 | case G_TYPE_INT64: |
| 122 | ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
| 123 | break; |
| 124 | case G_TYPE_UINT64: |
| 125 | ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
| 126 | break; |
| 127 | case G_TYPE_DOUBLE: |
| 128 | { |
| 129 | /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
| 130 | gdouble da = g_value_get_double (a); |
| 131 | gdouble db = g_value_get_double (b); |
| 132 | ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
| 133 | } |
| 134 | break; |
| 135 | case G_TYPE_STRING: |
| 136 | ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
| 137 | break; |
| 138 | case G_TYPE_VARIANT: |
| 139 | ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
| 140 | break; |
| 141 | default: |
| 142 | if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
| 143 | ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
| 144 | else |
| 145 | g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
| 146 | break; |
| 147 | } |
| 148 | return ret; |
| 149 | } |
| 150 | |
| 151 | /* ------------------------------------------------------------------------ |
| 152 | * Code for interface org.openbmc.SensorIntegerThreshold |
| 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * SECTION:SensorIntegerThreshold |
| 158 | * @title: SensorIntegerThreshold |
| 159 | * @short_description: Generated C code for the org.openbmc.SensorIntegerThreshold D-Bus interface |
| 160 | * |
| 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface in C. |
| 162 | */ |
| 163 | |
| 164 | /* ---- Introspection data for org.openbmc.SensorIntegerThreshold ---- */ |
| 165 | |
| 166 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_lower_critical = |
| 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "lower_critical", |
| 171 | (gchar *) "i", |
| 172 | NULL |
| 173 | }, |
| 174 | FALSE |
| 175 | }; |
| 176 | |
| 177 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_lower_warning = |
| 178 | { |
| 179 | { |
| 180 | -1, |
| 181 | (gchar *) "lower_warning", |
| 182 | (gchar *) "i", |
| 183 | NULL |
| 184 | }, |
| 185 | FALSE |
| 186 | }; |
| 187 | |
| 188 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_upper_warning = |
| 189 | { |
| 190 | { |
| 191 | -1, |
| 192 | (gchar *) "upper_warning", |
| 193 | (gchar *) "i", |
| 194 | NULL |
| 195 | }, |
| 196 | FALSE |
| 197 | }; |
| 198 | |
| 199 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_upper_critical = |
| 200 | { |
| 201 | { |
| 202 | -1, |
| 203 | (gchar *) "upper_critical", |
| 204 | (gchar *) "i", |
| 205 | NULL |
| 206 | }, |
| 207 | FALSE |
| 208 | }; |
| 209 | |
| 210 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers[] = |
| 211 | { |
| 212 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_lower_critical, |
| 213 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_lower_warning, |
| 214 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_upper_warning, |
| 215 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_upper_critical, |
| 216 | NULL |
| 217 | }; |
| 218 | |
| 219 | static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_set_thresholds = |
| 220 | { |
| 221 | { |
| 222 | -1, |
| 223 | (gchar *) "setThresholds", |
| 224 | (GDBusArgInfo **) &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers, |
| 225 | NULL, |
| 226 | NULL |
| 227 | }, |
| 228 | "handle-set-thresholds", |
| 229 | FALSE |
| 230 | }; |
| 231 | |
| 232 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_get_threshold_state_OUT_ARG_threshold_state = |
| 233 | { |
| 234 | { |
| 235 | -1, |
| 236 | (gchar *) "threshold_state", |
| 237 | (gchar *) "i", |
| 238 | NULL |
| 239 | }, |
| 240 | FALSE |
| 241 | }; |
| 242 | |
| 243 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_get_threshold_state_OUT_ARG_pointers[] = |
| 244 | { |
| 245 | &_sensor_integer_threshold_method_info_get_threshold_state_OUT_ARG_threshold_state, |
| 246 | NULL |
| 247 | }; |
| 248 | |
| 249 | static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_get_threshold_state = |
| 250 | { |
| 251 | { |
| 252 | -1, |
| 253 | (gchar *) "getThresholdState", |
| 254 | NULL, |
| 255 | (GDBusArgInfo **) &_sensor_integer_threshold_method_info_get_threshold_state_OUT_ARG_pointers, |
| 256 | NULL |
| 257 | }, |
| 258 | "handle-get-threshold-state", |
| 259 | FALSE |
| 260 | }; |
| 261 | |
| 262 | static const _ExtendedGDBusMethodInfo * const _sensor_integer_threshold_method_info_pointers[] = |
| 263 | { |
| 264 | &_sensor_integer_threshold_method_info_set_thresholds, |
| 265 | &_sensor_integer_threshold_method_info_get_threshold_state, |
| 266 | NULL |
| 267 | }; |
| 268 | |
| 269 | static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_warning = |
| 270 | { |
| 271 | { |
| 272 | -1, |
| 273 | (gchar *) "Warning", |
| 274 | NULL, |
| 275 | NULL |
| 276 | }, |
| 277 | "warning" |
| 278 | }; |
| 279 | |
| 280 | static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_critical = |
| 281 | { |
| 282 | { |
| 283 | -1, |
| 284 | (gchar *) "Critical", |
| 285 | NULL, |
| 286 | NULL |
| 287 | }, |
| 288 | "critical" |
| 289 | }; |
| 290 | |
| 291 | static const _ExtendedGDBusSignalInfo * const _sensor_integer_threshold_signal_info_pointers[] = |
| 292 | { |
| 293 | &_sensor_integer_threshold_signal_info_warning, |
| 294 | &_sensor_integer_threshold_signal_info_critical, |
| 295 | NULL |
| 296 | }; |
| 297 | |
| 298 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_threshold_lower_warning = |
| 299 | { |
| 300 | { |
| 301 | -1, |
| 302 | (gchar *) "threshold_lower_warning", |
| 303 | (gchar *) "i", |
| 304 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 305 | NULL |
| 306 | }, |
| 307 | "threshold-lower-warning", |
| 308 | FALSE |
| 309 | }; |
| 310 | |
| 311 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_threshold_upper_warning = |
| 312 | { |
| 313 | { |
| 314 | -1, |
| 315 | (gchar *) "threshold_upper_warning", |
| 316 | (gchar *) "i", |
| 317 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 318 | NULL |
| 319 | }, |
| 320 | "threshold-upper-warning", |
| 321 | FALSE |
| 322 | }; |
| 323 | |
| 324 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_threshold_upper_critical = |
| 325 | { |
| 326 | { |
| 327 | -1, |
| 328 | (gchar *) "threshold_upper_critical", |
| 329 | (gchar *) "i", |
| 330 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 331 | NULL |
| 332 | }, |
| 333 | "threshold-upper-critical", |
| 334 | FALSE |
| 335 | }; |
| 336 | |
| 337 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_threshold_state = |
| 338 | { |
| 339 | { |
| 340 | -1, |
| 341 | (gchar *) "threshold_state", |
| 342 | (gchar *) "i", |
| 343 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 344 | NULL |
| 345 | }, |
| 346 | "threshold-state", |
| 347 | FALSE |
| 348 | }; |
| 349 | |
| 350 | static const _ExtendedGDBusPropertyInfo * const _sensor_integer_threshold_property_info_pointers[] = |
| 351 | { |
| 352 | &_sensor_integer_threshold_property_info_threshold_lower_warning, |
| 353 | &_sensor_integer_threshold_property_info_threshold_upper_warning, |
| 354 | &_sensor_integer_threshold_property_info_threshold_upper_critical, |
| 355 | &_sensor_integer_threshold_property_info_threshold_state, |
| 356 | NULL |
| 357 | }; |
| 358 | |
| 359 | static const _ExtendedGDBusInterfaceInfo _sensor_integer_threshold_interface_info = |
| 360 | { |
| 361 | { |
| 362 | -1, |
| 363 | (gchar *) "org.openbmc.SensorIntegerThreshold", |
| 364 | (GDBusMethodInfo **) &_sensor_integer_threshold_method_info_pointers, |
| 365 | (GDBusSignalInfo **) &_sensor_integer_threshold_signal_info_pointers, |
| 366 | (GDBusPropertyInfo **) &_sensor_integer_threshold_property_info_pointers, |
| 367 | NULL |
| 368 | }, |
| 369 | "sensor-integer-threshold", |
| 370 | }; |
| 371 | |
| 372 | |
| 373 | /** |
| 374 | * sensor_integer_threshold_interface_info: |
| 375 | * |
| 376 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface. |
| 377 | * |
| 378 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 379 | */ |
| 380 | GDBusInterfaceInfo * |
| 381 | sensor_integer_threshold_interface_info (void) |
| 382 | { |
| 383 | return (GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * sensor_integer_threshold_override_properties: |
| 388 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 389 | * @property_id_begin: The property id to assign to the first overridden property. |
| 390 | * |
| 391 | * Overrides all #GObject properties in the #SensorIntegerThreshold interface for a concrete class. |
| 392 | * The properties are overridden in the order they are defined. |
| 393 | * |
| 394 | * Returns: The last property id. |
| 395 | */ |
| 396 | guint |
| 397 | sensor_integer_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 398 | { |
| 399 | g_object_class_override_property (klass, property_id_begin++, "threshold-lower-warning"); |
| 400 | g_object_class_override_property (klass, property_id_begin++, "threshold-upper-warning"); |
| 401 | g_object_class_override_property (klass, property_id_begin++, "threshold-upper-critical"); |
| 402 | g_object_class_override_property (klass, property_id_begin++, "threshold-state"); |
| 403 | return property_id_begin - 1; |
| 404 | } |
| 405 | |
| 406 | |
| 407 | |
| 408 | /** |
| 409 | * SensorIntegerThreshold: |
| 410 | * |
| 411 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 412 | */ |
| 413 | |
| 414 | /** |
| 415 | * SensorIntegerThresholdIface: |
| 416 | * @parent_iface: The parent interface. |
| 417 | * @handle_get_threshold_state: Handler for the #SensorIntegerThreshold::handle-get-threshold-state signal. |
| 418 | * @handle_set_thresholds: Handler for the #SensorIntegerThreshold::handle-set-thresholds signal. |
| 419 | * @get_threshold_lower_warning: Getter for the #SensorIntegerThreshold:threshold-lower-warning property. |
| 420 | * @get_threshold_state: Getter for the #SensorIntegerThreshold:threshold-state property. |
| 421 | * @get_threshold_upper_critical: Getter for the #SensorIntegerThreshold:threshold-upper-critical property. |
| 422 | * @get_threshold_upper_warning: Getter for the #SensorIntegerThreshold:threshold-upper-warning property. |
| 423 | * @critical: Handler for the #SensorIntegerThreshold::critical signal. |
| 424 | * @warning: Handler for the #SensorIntegerThreshold::warning signal. |
| 425 | * |
| 426 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 427 | */ |
| 428 | |
| 429 | typedef SensorIntegerThresholdIface SensorIntegerThresholdInterface; |
| 430 | G_DEFINE_INTERFACE (SensorIntegerThreshold, sensor_integer_threshold, G_TYPE_OBJECT); |
| 431 | |
| 432 | static void |
| 433 | sensor_integer_threshold_default_init (SensorIntegerThresholdIface *iface) |
| 434 | { |
| 435 | /* GObject signals for incoming D-Bus method calls: */ |
| 436 | /** |
| 437 | * SensorIntegerThreshold::handle-set-thresholds: |
| 438 | * @object: A #SensorIntegerThreshold. |
| 439 | * @invocation: A #GDBusMethodInvocation. |
| 440 | * @arg_lower_critical: Argument passed by remote caller. |
| 441 | * @arg_lower_warning: Argument passed by remote caller. |
| 442 | * @arg_upper_warning: Argument passed by remote caller. |
| 443 | * @arg_upper_critical: Argument passed by remote caller. |
| 444 | * |
| 445 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method. |
| 446 | * |
| 447 | * 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_integer_threshold_complete_set_thresholds() 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. |
| 448 | * |
| 449 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 450 | */ |
| 451 | g_signal_new ("handle-set-thresholds", |
| 452 | G_TYPE_FROM_INTERFACE (iface), |
| 453 | G_SIGNAL_RUN_LAST, |
| 454 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_set_thresholds), |
| 455 | g_signal_accumulator_true_handled, |
| 456 | NULL, |
| 457 | g_cclosure_marshal_generic, |
| 458 | G_TYPE_BOOLEAN, |
| 459 | 5, |
| 460 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); |
| 461 | |
| 462 | /** |
| 463 | * SensorIntegerThreshold::handle-get-threshold-state: |
| 464 | * @object: A #SensorIntegerThreshold. |
| 465 | * @invocation: A #GDBusMethodInvocation. |
| 466 | * |
| 467 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getThresholdState">getThresholdState()</link> D-Bus method. |
| 468 | * |
| 469 | * 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_integer_threshold_complete_get_threshold_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. |
| 470 | * |
| 471 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 472 | */ |
| 473 | g_signal_new ("handle-get-threshold-state", |
| 474 | G_TYPE_FROM_INTERFACE (iface), |
| 475 | G_SIGNAL_RUN_LAST, |
| 476 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_get_threshold_state), |
| 477 | g_signal_accumulator_true_handled, |
| 478 | NULL, |
| 479 | g_cclosure_marshal_generic, |
| 480 | G_TYPE_BOOLEAN, |
| 481 | 1, |
| 482 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 483 | |
| 484 | /* GObject signals for received D-Bus signals: */ |
| 485 | /** |
| 486 | * SensorIntegerThreshold::warning: |
| 487 | * @object: A #SensorIntegerThreshold. |
| 488 | * |
| 489 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Warning">"Warning"</link> is received. |
| 490 | * |
| 491 | * 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. |
| 492 | */ |
| 493 | g_signal_new ("warning", |
| 494 | G_TYPE_FROM_INTERFACE (iface), |
| 495 | G_SIGNAL_RUN_LAST, |
| 496 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, warning), |
| 497 | NULL, |
| 498 | NULL, |
| 499 | g_cclosure_marshal_generic, |
| 500 | G_TYPE_NONE, |
| 501 | 0); |
| 502 | |
| 503 | /** |
| 504 | * SensorIntegerThreshold::critical: |
| 505 | * @object: A #SensorIntegerThreshold. |
| 506 | * |
| 507 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Critical">"Critical"</link> is received. |
| 508 | * |
| 509 | * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. |
| 510 | */ |
| 511 | g_signal_new ("critical", |
| 512 | G_TYPE_FROM_INTERFACE (iface), |
| 513 | G_SIGNAL_RUN_LAST, |
| 514 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, critical), |
| 515 | NULL, |
| 516 | NULL, |
| 517 | g_cclosure_marshal_generic, |
| 518 | G_TYPE_NONE, |
| 519 | 0); |
| 520 | |
| 521 | /* GObject properties for D-Bus properties: */ |
| 522 | /** |
| 523 | * SensorIntegerThreshold:threshold-lower-warning: |
| 524 | * |
| 525 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_lower_warning">"threshold_lower_warning"</link>. |
| 526 | * |
| 527 | * 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. |
| 528 | */ |
| 529 | g_object_interface_install_property (iface, |
| 530 | g_param_spec_int ("threshold-lower-warning", "threshold_lower_warning", "threshold_lower_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 531 | /** |
| 532 | * SensorIntegerThreshold:threshold-upper-warning: |
| 533 | * |
| 534 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_warning">"threshold_upper_warning"</link>. |
| 535 | * |
| 536 | * 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. |
| 537 | */ |
| 538 | g_object_interface_install_property (iface, |
| 539 | g_param_spec_int ("threshold-upper-warning", "threshold_upper_warning", "threshold_upper_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 540 | /** |
| 541 | * SensorIntegerThreshold:threshold-upper-critical: |
| 542 | * |
| 543 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_critical">"threshold_upper_critical"</link>. |
| 544 | * |
| 545 | * 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. |
| 546 | */ |
| 547 | g_object_interface_install_property (iface, |
| 548 | g_param_spec_int ("threshold-upper-critical", "threshold_upper_critical", "threshold_upper_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 549 | /** |
| 550 | * SensorIntegerThreshold:threshold-state: |
| 551 | * |
| 552 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_state">"threshold_state"</link>. |
| 553 | * |
| 554 | * 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. |
| 555 | */ |
| 556 | g_object_interface_install_property (iface, |
| 557 | g_param_spec_int ("threshold-state", "threshold_state", "threshold_state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * sensor_integer_threshold_get_threshold_lower_warning: (skip) |
| 562 | * @object: A #SensorIntegerThreshold. |
| 563 | * |
| 564 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property. |
| 565 | * |
| 566 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 567 | * |
| 568 | * Returns: The property value. |
| 569 | */ |
| 570 | gint |
| 571 | sensor_integer_threshold_get_threshold_lower_warning (SensorIntegerThreshold *object) |
| 572 | { |
| 573 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_threshold_lower_warning (object); |
| 574 | } |
| 575 | |
| 576 | /** |
| 577 | * sensor_integer_threshold_set_threshold_lower_warning: (skip) |
| 578 | * @object: A #SensorIntegerThreshold. |
| 579 | * @value: The value to set. |
| 580 | * |
| 581 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property to @value. |
| 582 | * |
| 583 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 584 | */ |
| 585 | void |
| 586 | sensor_integer_threshold_set_threshold_lower_warning (SensorIntegerThreshold *object, gint value) |
| 587 | { |
| 588 | g_object_set (G_OBJECT (object), "threshold-lower-warning", value, NULL); |
| 589 | } |
| 590 | |
| 591 | /** |
| 592 | * sensor_integer_threshold_get_threshold_upper_warning: (skip) |
| 593 | * @object: A #SensorIntegerThreshold. |
| 594 | * |
| 595 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property. |
| 596 | * |
| 597 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 598 | * |
| 599 | * Returns: The property value. |
| 600 | */ |
| 601 | gint |
| 602 | sensor_integer_threshold_get_threshold_upper_warning (SensorIntegerThreshold *object) |
| 603 | { |
| 604 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_threshold_upper_warning (object); |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * sensor_integer_threshold_set_threshold_upper_warning: (skip) |
| 609 | * @object: A #SensorIntegerThreshold. |
| 610 | * @value: The value to set. |
| 611 | * |
| 612 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property to @value. |
| 613 | * |
| 614 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 615 | */ |
| 616 | void |
| 617 | sensor_integer_threshold_set_threshold_upper_warning (SensorIntegerThreshold *object, gint value) |
| 618 | { |
| 619 | g_object_set (G_OBJECT (object), "threshold-upper-warning", value, NULL); |
| 620 | } |
| 621 | |
| 622 | /** |
| 623 | * sensor_integer_threshold_get_threshold_upper_critical: (skip) |
| 624 | * @object: A #SensorIntegerThreshold. |
| 625 | * |
| 626 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property. |
| 627 | * |
| 628 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 629 | * |
| 630 | * Returns: The property value. |
| 631 | */ |
| 632 | gint |
| 633 | sensor_integer_threshold_get_threshold_upper_critical (SensorIntegerThreshold *object) |
| 634 | { |
| 635 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_threshold_upper_critical (object); |
| 636 | } |
| 637 | |
| 638 | /** |
| 639 | * sensor_integer_threshold_set_threshold_upper_critical: (skip) |
| 640 | * @object: A #SensorIntegerThreshold. |
| 641 | * @value: The value to set. |
| 642 | * |
| 643 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property to @value. |
| 644 | * |
| 645 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 646 | */ |
| 647 | void |
| 648 | sensor_integer_threshold_set_threshold_upper_critical (SensorIntegerThreshold *object, gint value) |
| 649 | { |
| 650 | g_object_set (G_OBJECT (object), "threshold-upper-critical", value, NULL); |
| 651 | } |
| 652 | |
| 653 | /** |
| 654 | * sensor_integer_threshold_get_threshold_state: (skip) |
| 655 | * @object: A #SensorIntegerThreshold. |
| 656 | * |
| 657 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_state">"threshold_state"</link> D-Bus property. |
| 658 | * |
| 659 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 660 | * |
| 661 | * Returns: The property value. |
| 662 | */ |
| 663 | gint |
| 664 | sensor_integer_threshold_get_threshold_state (SensorIntegerThreshold *object) |
| 665 | { |
| 666 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_threshold_state (object); |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * sensor_integer_threshold_set_threshold_state: (skip) |
| 671 | * @object: A #SensorIntegerThreshold. |
| 672 | * @value: The value to set. |
| 673 | * |
| 674 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.threshold_state">"threshold_state"</link> D-Bus property to @value. |
| 675 | * |
| 676 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 677 | */ |
| 678 | void |
| 679 | sensor_integer_threshold_set_threshold_state (SensorIntegerThreshold *object, gint value) |
| 680 | { |
| 681 | g_object_set (G_OBJECT (object), "threshold-state", value, NULL); |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * sensor_integer_threshold_emit_warning: |
| 686 | * @object: A #SensorIntegerThreshold. |
| 687 | * |
| 688 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Warning">"Warning"</link> D-Bus signal. |
| 689 | */ |
| 690 | void |
| 691 | sensor_integer_threshold_emit_warning ( |
| 692 | SensorIntegerThreshold *object) |
| 693 | { |
| 694 | g_signal_emit_by_name (object, "warning"); |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * sensor_integer_threshold_emit_critical: |
| 699 | * @object: A #SensorIntegerThreshold. |
| 700 | * |
| 701 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Critical">"Critical"</link> D-Bus signal. |
| 702 | */ |
| 703 | void |
| 704 | sensor_integer_threshold_emit_critical ( |
| 705 | SensorIntegerThreshold *object) |
| 706 | { |
| 707 | g_signal_emit_by_name (object, "critical"); |
| 708 | } |
| 709 | |
| 710 | /** |
| 711 | * sensor_integer_threshold_call_set_thresholds: |
| 712 | * @proxy: A #SensorIntegerThresholdProxy. |
| 713 | * @arg_lower_critical: Argument to pass with the method invocation. |
| 714 | * @arg_lower_warning: Argument to pass with the method invocation. |
| 715 | * @arg_upper_warning: Argument to pass with the method invocation. |
| 716 | * @arg_upper_critical: Argument to pass with the method invocation. |
| 717 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 718 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 719 | * @user_data: User data to pass to @callback. |
| 720 | * |
| 721 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method on @proxy. |
| 722 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 723 | * You can then call sensor_integer_threshold_call_set_thresholds_finish() to get the result of the operation. |
| 724 | * |
| 725 | * See sensor_integer_threshold_call_set_thresholds_sync() for the synchronous, blocking version of this method. |
| 726 | */ |
| 727 | void |
| 728 | sensor_integer_threshold_call_set_thresholds ( |
| 729 | SensorIntegerThreshold *proxy, |
| 730 | gint arg_lower_critical, |
| 731 | gint arg_lower_warning, |
| 732 | gint arg_upper_warning, |
| 733 | gint arg_upper_critical, |
| 734 | GCancellable *cancellable, |
| 735 | GAsyncReadyCallback callback, |
| 736 | gpointer user_data) |
| 737 | { |
| 738 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 739 | "setThresholds", |
| 740 | g_variant_new ("(iiii)", |
| 741 | arg_lower_critical, |
| 742 | arg_lower_warning, |
| 743 | arg_upper_warning, |
| 744 | arg_upper_critical), |
| 745 | G_DBUS_CALL_FLAGS_NONE, |
| 746 | -1, |
| 747 | cancellable, |
| 748 | callback, |
| 749 | user_data); |
| 750 | } |
| 751 | |
| 752 | /** |
| 753 | * sensor_integer_threshold_call_set_thresholds_finish: |
| 754 | * @proxy: A #SensorIntegerThresholdProxy. |
| 755 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_set_thresholds(). |
| 756 | * @error: Return location for error or %NULL. |
| 757 | * |
| 758 | * Finishes an operation started with sensor_integer_threshold_call_set_thresholds(). |
| 759 | * |
| 760 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 761 | */ |
| 762 | gboolean |
| 763 | sensor_integer_threshold_call_set_thresholds_finish ( |
| 764 | SensorIntegerThreshold *proxy, |
| 765 | GAsyncResult *res, |
| 766 | GError **error) |
| 767 | { |
| 768 | GVariant *_ret; |
| 769 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 770 | if (_ret == NULL) |
| 771 | goto _out; |
| 772 | g_variant_get (_ret, |
| 773 | "()"); |
| 774 | g_variant_unref (_ret); |
| 775 | _out: |
| 776 | return _ret != NULL; |
| 777 | } |
| 778 | |
| 779 | /** |
| 780 | * sensor_integer_threshold_call_set_thresholds_sync: |
| 781 | * @proxy: A #SensorIntegerThresholdProxy. |
| 782 | * @arg_lower_critical: Argument to pass with the method invocation. |
| 783 | * @arg_lower_warning: Argument to pass with the method invocation. |
| 784 | * @arg_upper_warning: Argument to pass with the method invocation. |
| 785 | * @arg_upper_critical: Argument to pass with the method invocation. |
| 786 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 787 | * @error: Return location for error or %NULL. |
| 788 | * |
| 789 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 790 | * |
| 791 | * See sensor_integer_threshold_call_set_thresholds() for the asynchronous version of this method. |
| 792 | * |
| 793 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 794 | */ |
| 795 | gboolean |
| 796 | sensor_integer_threshold_call_set_thresholds_sync ( |
| 797 | SensorIntegerThreshold *proxy, |
| 798 | gint arg_lower_critical, |
| 799 | gint arg_lower_warning, |
| 800 | gint arg_upper_warning, |
| 801 | gint arg_upper_critical, |
| 802 | GCancellable *cancellable, |
| 803 | GError **error) |
| 804 | { |
| 805 | GVariant *_ret; |
| 806 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 807 | "setThresholds", |
| 808 | g_variant_new ("(iiii)", |
| 809 | arg_lower_critical, |
| 810 | arg_lower_warning, |
| 811 | arg_upper_warning, |
| 812 | arg_upper_critical), |
| 813 | G_DBUS_CALL_FLAGS_NONE, |
| 814 | -1, |
| 815 | cancellable, |
| 816 | error); |
| 817 | if (_ret == NULL) |
| 818 | goto _out; |
| 819 | g_variant_get (_ret, |
| 820 | "()"); |
| 821 | g_variant_unref (_ret); |
| 822 | _out: |
| 823 | return _ret != NULL; |
| 824 | } |
| 825 | |
| 826 | /** |
| 827 | * sensor_integer_threshold_call_get_threshold_state: |
| 828 | * @proxy: A #SensorIntegerThresholdProxy. |
| 829 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 830 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 831 | * @user_data: User data to pass to @callback. |
| 832 | * |
| 833 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getThresholdState">getThresholdState()</link> D-Bus method on @proxy. |
| 834 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 835 | * You can then call sensor_integer_threshold_call_get_threshold_state_finish() to get the result of the operation. |
| 836 | * |
| 837 | * See sensor_integer_threshold_call_get_threshold_state_sync() for the synchronous, blocking version of this method. |
| 838 | */ |
| 839 | void |
| 840 | sensor_integer_threshold_call_get_threshold_state ( |
| 841 | SensorIntegerThreshold *proxy, |
| 842 | GCancellable *cancellable, |
| 843 | GAsyncReadyCallback callback, |
| 844 | gpointer user_data) |
| 845 | { |
| 846 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 847 | "getThresholdState", |
| 848 | g_variant_new ("()"), |
| 849 | G_DBUS_CALL_FLAGS_NONE, |
| 850 | -1, |
| 851 | cancellable, |
| 852 | callback, |
| 853 | user_data); |
| 854 | } |
| 855 | |
| 856 | /** |
| 857 | * sensor_integer_threshold_call_get_threshold_state_finish: |
| 858 | * @proxy: A #SensorIntegerThresholdProxy. |
| 859 | * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore. |
| 860 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_get_threshold_state(). |
| 861 | * @error: Return location for error or %NULL. |
| 862 | * |
| 863 | * Finishes an operation started with sensor_integer_threshold_call_get_threshold_state(). |
| 864 | * |
| 865 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 866 | */ |
| 867 | gboolean |
| 868 | sensor_integer_threshold_call_get_threshold_state_finish ( |
| 869 | SensorIntegerThreshold *proxy, |
| 870 | gint *out_threshold_state, |
| 871 | GAsyncResult *res, |
| 872 | GError **error) |
| 873 | { |
| 874 | GVariant *_ret; |
| 875 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 876 | if (_ret == NULL) |
| 877 | goto _out; |
| 878 | g_variant_get (_ret, |
| 879 | "(i)", |
| 880 | out_threshold_state); |
| 881 | g_variant_unref (_ret); |
| 882 | _out: |
| 883 | return _ret != NULL; |
| 884 | } |
| 885 | |
| 886 | /** |
| 887 | * sensor_integer_threshold_call_get_threshold_state_sync: |
| 888 | * @proxy: A #SensorIntegerThresholdProxy. |
| 889 | * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore. |
| 890 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 891 | * @error: Return location for error or %NULL. |
| 892 | * |
| 893 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getThresholdState">getThresholdState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 894 | * |
| 895 | * See sensor_integer_threshold_call_get_threshold_state() for the asynchronous version of this method. |
| 896 | * |
| 897 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 898 | */ |
| 899 | gboolean |
| 900 | sensor_integer_threshold_call_get_threshold_state_sync ( |
| 901 | SensorIntegerThreshold *proxy, |
| 902 | gint *out_threshold_state, |
| 903 | GCancellable *cancellable, |
| 904 | GError **error) |
| 905 | { |
| 906 | GVariant *_ret; |
| 907 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 908 | "getThresholdState", |
| 909 | g_variant_new ("()"), |
| 910 | G_DBUS_CALL_FLAGS_NONE, |
| 911 | -1, |
| 912 | cancellable, |
| 913 | error); |
| 914 | if (_ret == NULL) |
| 915 | goto _out; |
| 916 | g_variant_get (_ret, |
| 917 | "(i)", |
| 918 | out_threshold_state); |
| 919 | g_variant_unref (_ret); |
| 920 | _out: |
| 921 | return _ret != NULL; |
| 922 | } |
| 923 | |
| 924 | /** |
| 925 | * sensor_integer_threshold_complete_set_thresholds: |
| 926 | * @object: A #SensorIntegerThreshold. |
| 927 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 928 | * |
| 929 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</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. |
| 930 | * |
| 931 | * This method will free @invocation, you cannot use it afterwards. |
| 932 | */ |
| 933 | void |
| 934 | sensor_integer_threshold_complete_set_thresholds ( |
| 935 | SensorIntegerThreshold *object, |
| 936 | GDBusMethodInvocation *invocation) |
| 937 | { |
| 938 | g_dbus_method_invocation_return_value (invocation, |
| 939 | g_variant_new ("()")); |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * sensor_integer_threshold_complete_get_threshold_state: |
| 944 | * @object: A #SensorIntegerThreshold. |
| 945 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 946 | * @threshold_state: Parameter to return. |
| 947 | * |
| 948 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getThresholdState">getThresholdState()</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. |
| 949 | * |
| 950 | * This method will free @invocation, you cannot use it afterwards. |
| 951 | */ |
| 952 | void |
| 953 | sensor_integer_threshold_complete_get_threshold_state ( |
| 954 | SensorIntegerThreshold *object, |
| 955 | GDBusMethodInvocation *invocation, |
| 956 | gint threshold_state) |
| 957 | { |
| 958 | g_dbus_method_invocation_return_value (invocation, |
| 959 | g_variant_new ("(i)", |
| 960 | threshold_state)); |
| 961 | } |
| 962 | |
| 963 | /* ------------------------------------------------------------------------ */ |
| 964 | |
| 965 | /** |
| 966 | * SensorIntegerThresholdProxy: |
| 967 | * |
| 968 | * The #SensorIntegerThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 969 | */ |
| 970 | |
| 971 | /** |
| 972 | * SensorIntegerThresholdProxyClass: |
| 973 | * @parent_class: The parent class. |
| 974 | * |
| 975 | * Class structure for #SensorIntegerThresholdProxy. |
| 976 | */ |
| 977 | |
| 978 | struct _SensorIntegerThresholdProxyPrivate |
| 979 | { |
| 980 | GData *qdata; |
| 981 | }; |
| 982 | |
| 983 | static void sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface); |
| 984 | |
| 985 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 986 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 987 | G_ADD_PRIVATE (SensorIntegerThresholdProxy) |
| 988 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init)); |
| 989 | |
| 990 | #else |
| 991 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 992 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init)); |
| 993 | |
| 994 | #endif |
| 995 | static void |
| 996 | sensor_integer_threshold_proxy_finalize (GObject *object) |
| 997 | { |
| 998 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 999 | g_datalist_clear (&proxy->priv->qdata); |
| 1000 | G_OBJECT_CLASS (sensor_integer_threshold_proxy_parent_class)->finalize (object); |
| 1001 | } |
| 1002 | |
| 1003 | static void |
| 1004 | sensor_integer_threshold_proxy_get_property (GObject *object, |
| 1005 | guint prop_id, |
| 1006 | GValue *value, |
| 1007 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1008 | { |
| 1009 | const _ExtendedGDBusPropertyInfo *info; |
| 1010 | GVariant *variant; |
| 1011 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1012 | info = _sensor_integer_threshold_property_info_pointers[prop_id - 1]; |
| 1013 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1014 | if (info->use_gvariant) |
| 1015 | { |
| 1016 | g_value_set_variant (value, variant); |
| 1017 | } |
| 1018 | else |
| 1019 | { |
| 1020 | if (variant != NULL) |
| 1021 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1022 | } |
| 1023 | if (variant != NULL) |
| 1024 | g_variant_unref (variant); |
| 1025 | } |
| 1026 | |
| 1027 | static void |
| 1028 | sensor_integer_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 1029 | GAsyncResult *res, |
| 1030 | gpointer user_data) |
| 1031 | { |
| 1032 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1033 | GError *error; |
| 1034 | GVariant *_ret; |
| 1035 | error = NULL; |
| 1036 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1037 | if (!_ret) |
| 1038 | { |
| 1039 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerThreshold: %s (%s, %d)", |
| 1040 | info->parent_struct.name, |
| 1041 | error->message, g_quark_to_string (error->domain), error->code); |
| 1042 | g_error_free (error); |
| 1043 | } |
| 1044 | else |
| 1045 | { |
| 1046 | g_variant_unref (_ret); |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | static void |
| 1051 | sensor_integer_threshold_proxy_set_property (GObject *object, |
| 1052 | guint prop_id, |
| 1053 | const GValue *value, |
| 1054 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1055 | { |
| 1056 | const _ExtendedGDBusPropertyInfo *info; |
| 1057 | GVariant *variant; |
| 1058 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1059 | info = _sensor_integer_threshold_property_info_pointers[prop_id - 1]; |
| 1060 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1061 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1062 | "org.freedesktop.DBus.Properties.Set", |
| 1063 | g_variant_new ("(ssv)", "org.openbmc.SensorIntegerThreshold", info->parent_struct.name, variant), |
| 1064 | G_DBUS_CALL_FLAGS_NONE, |
| 1065 | -1, |
| 1066 | NULL, (GAsyncReadyCallback) sensor_integer_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 1067 | g_variant_unref (variant); |
| 1068 | } |
| 1069 | |
| 1070 | static void |
| 1071 | sensor_integer_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 1072 | const gchar *sender_name G_GNUC_UNUSED, |
| 1073 | const gchar *signal_name, |
| 1074 | GVariant *parameters) |
| 1075 | { |
| 1076 | _ExtendedGDBusSignalInfo *info; |
| 1077 | GVariantIter iter; |
| 1078 | GVariant *child; |
| 1079 | GValue *paramv; |
| 1080 | guint num_params; |
| 1081 | guint n; |
| 1082 | guint signal_id; |
| 1083 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, signal_name); |
| 1084 | if (info == NULL) |
| 1085 | return; |
| 1086 | num_params = g_variant_n_children (parameters); |
| 1087 | paramv = g_new0 (GValue, num_params + 1); |
| 1088 | g_value_init (¶mv[0], TYPE_SENSOR_INTEGER_THRESHOLD); |
| 1089 | g_value_set_object (¶mv[0], proxy); |
| 1090 | g_variant_iter_init (&iter, parameters); |
| 1091 | n = 1; |
| 1092 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1093 | { |
| 1094 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1095 | if (arg_info->use_gvariant) |
| 1096 | { |
| 1097 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1098 | g_value_set_variant (¶mv[n], child); |
| 1099 | n++; |
| 1100 | } |
| 1101 | else |
| 1102 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1103 | g_variant_unref (child); |
| 1104 | } |
| 1105 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD); |
| 1106 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1107 | for (n = 0; n < num_params + 1; n++) |
| 1108 | g_value_unset (¶mv[n]); |
| 1109 | g_free (paramv); |
| 1110 | } |
| 1111 | |
| 1112 | static void |
| 1113 | sensor_integer_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 1114 | GVariant *changed_properties, |
| 1115 | const gchar *const *invalidated_properties) |
| 1116 | { |
| 1117 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (_proxy); |
| 1118 | guint n; |
| 1119 | const gchar *key; |
| 1120 | GVariantIter *iter; |
| 1121 | _ExtendedGDBusPropertyInfo *info; |
| 1122 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 1123 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1124 | { |
| 1125 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, key); |
| 1126 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1127 | if (info != NULL) |
| 1128 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1129 | } |
| 1130 | g_variant_iter_free (iter); |
| 1131 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1132 | { |
| 1133 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 1134 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1135 | if (info != NULL) |
| 1136 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | static gint |
| 1141 | sensor_integer_threshold_proxy_get_threshold_lower_warning (SensorIntegerThreshold *object) |
| 1142 | { |
| 1143 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 1144 | GVariant *variant; |
| 1145 | gint value = 0; |
| 1146 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_lower_warning"); |
| 1147 | if (variant != NULL) |
| 1148 | { |
| 1149 | value = g_variant_get_int32 (variant); |
| 1150 | g_variant_unref (variant); |
| 1151 | } |
| 1152 | return value; |
| 1153 | } |
| 1154 | |
| 1155 | static gint |
| 1156 | sensor_integer_threshold_proxy_get_threshold_upper_warning (SensorIntegerThreshold *object) |
| 1157 | { |
| 1158 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 1159 | GVariant *variant; |
| 1160 | gint value = 0; |
| 1161 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_warning"); |
| 1162 | if (variant != NULL) |
| 1163 | { |
| 1164 | value = g_variant_get_int32 (variant); |
| 1165 | g_variant_unref (variant); |
| 1166 | } |
| 1167 | return value; |
| 1168 | } |
| 1169 | |
| 1170 | static gint |
| 1171 | sensor_integer_threshold_proxy_get_threshold_upper_critical (SensorIntegerThreshold *object) |
| 1172 | { |
| 1173 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 1174 | GVariant *variant; |
| 1175 | gint value = 0; |
| 1176 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_critical"); |
| 1177 | if (variant != NULL) |
| 1178 | { |
| 1179 | value = g_variant_get_int32 (variant); |
| 1180 | g_variant_unref (variant); |
| 1181 | } |
| 1182 | return value; |
| 1183 | } |
| 1184 | |
| 1185 | static gint |
| 1186 | sensor_integer_threshold_proxy_get_threshold_state (SensorIntegerThreshold *object) |
| 1187 | { |
| 1188 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 1189 | GVariant *variant; |
| 1190 | gint value = 0; |
| 1191 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_state"); |
| 1192 | if (variant != NULL) |
| 1193 | { |
| 1194 | value = g_variant_get_int32 (variant); |
| 1195 | g_variant_unref (variant); |
| 1196 | } |
| 1197 | return value; |
| 1198 | } |
| 1199 | |
| 1200 | static void |
| 1201 | sensor_integer_threshold_proxy_init (SensorIntegerThresholdProxy *proxy) |
| 1202 | { |
| 1203 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1204 | proxy->priv = sensor_integer_threshold_proxy_get_instance_private (proxy); |
| 1205 | #else |
| 1206 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, SensorIntegerThresholdProxyPrivate); |
| 1207 | #endif |
| 1208 | |
| 1209 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_threshold_interface_info ()); |
| 1210 | } |
| 1211 | |
| 1212 | static void |
| 1213 | sensor_integer_threshold_proxy_class_init (SensorIntegerThresholdProxyClass *klass) |
| 1214 | { |
| 1215 | GObjectClass *gobject_class; |
| 1216 | GDBusProxyClass *proxy_class; |
| 1217 | |
| 1218 | gobject_class = G_OBJECT_CLASS (klass); |
| 1219 | gobject_class->finalize = sensor_integer_threshold_proxy_finalize; |
| 1220 | gobject_class->get_property = sensor_integer_threshold_proxy_get_property; |
| 1221 | gobject_class->set_property = sensor_integer_threshold_proxy_set_property; |
| 1222 | |
| 1223 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 1224 | proxy_class->g_signal = sensor_integer_threshold_proxy_g_signal; |
| 1225 | proxy_class->g_properties_changed = sensor_integer_threshold_proxy_g_properties_changed; |
| 1226 | |
| 1227 | sensor_integer_threshold_override_properties (gobject_class, 1); |
| 1228 | |
| 1229 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1230 | g_type_class_add_private (klass, sizeof (SensorIntegerThresholdProxyPrivate)); |
| 1231 | #endif |
| 1232 | } |
| 1233 | |
| 1234 | static void |
| 1235 | sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface) |
| 1236 | { |
| 1237 | iface->get_threshold_lower_warning = sensor_integer_threshold_proxy_get_threshold_lower_warning; |
| 1238 | iface->get_threshold_upper_warning = sensor_integer_threshold_proxy_get_threshold_upper_warning; |
| 1239 | iface->get_threshold_upper_critical = sensor_integer_threshold_proxy_get_threshold_upper_critical; |
| 1240 | iface->get_threshold_state = sensor_integer_threshold_proxy_get_threshold_state; |
| 1241 | } |
| 1242 | |
| 1243 | /** |
| 1244 | * sensor_integer_threshold_proxy_new: |
| 1245 | * @connection: A #GDBusConnection. |
| 1246 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1247 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1248 | * @object_path: An object path. |
| 1249 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1250 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1251 | * @user_data: User data to pass to @callback. |
| 1252 | * |
| 1253 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. See g_dbus_proxy_new() for more details. |
| 1254 | * |
| 1255 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1256 | * You can then call sensor_integer_threshold_proxy_new_finish() to get the result of the operation. |
| 1257 | * |
| 1258 | * See sensor_integer_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 1259 | */ |
| 1260 | void |
| 1261 | sensor_integer_threshold_proxy_new ( |
| 1262 | GDBusConnection *connection, |
| 1263 | GDBusProxyFlags flags, |
| 1264 | const gchar *name, |
| 1265 | const gchar *object_path, |
| 1266 | GCancellable *cancellable, |
| 1267 | GAsyncReadyCallback callback, |
| 1268 | gpointer user_data) |
| 1269 | { |
| 1270 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_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.SensorIntegerThreshold", NULL); |
| 1271 | } |
| 1272 | |
| 1273 | /** |
| 1274 | * sensor_integer_threshold_proxy_new_finish: |
| 1275 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new(). |
| 1276 | * @error: Return location for error or %NULL |
| 1277 | * |
| 1278 | * Finishes an operation started with sensor_integer_threshold_proxy_new(). |
| 1279 | * |
| 1280 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 1281 | */ |
| 1282 | SensorIntegerThreshold * |
| 1283 | sensor_integer_threshold_proxy_new_finish ( |
| 1284 | GAsyncResult *res, |
| 1285 | GError **error) |
| 1286 | { |
| 1287 | GObject *ret; |
| 1288 | GObject *source_object; |
| 1289 | source_object = g_async_result_get_source_object (res); |
| 1290 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1291 | g_object_unref (source_object); |
| 1292 | if (ret != NULL) |
| 1293 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 1294 | else |
| 1295 | return NULL; |
| 1296 | } |
| 1297 | |
| 1298 | /** |
| 1299 | * sensor_integer_threshold_proxy_new_sync: |
| 1300 | * @connection: A #GDBusConnection. |
| 1301 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1302 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1303 | * @object_path: An object path. |
| 1304 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1305 | * @error: Return location for error or %NULL |
| 1306 | * |
| 1307 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. See g_dbus_proxy_new_sync() for more details. |
| 1308 | * |
| 1309 | * The calling thread is blocked until a reply is received. |
| 1310 | * |
| 1311 | * See sensor_integer_threshold_proxy_new() for the asynchronous version of this constructor. |
| 1312 | * |
| 1313 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 1314 | */ |
| 1315 | SensorIntegerThreshold * |
| 1316 | sensor_integer_threshold_proxy_new_sync ( |
| 1317 | GDBusConnection *connection, |
| 1318 | GDBusProxyFlags flags, |
| 1319 | const gchar *name, |
| 1320 | const gchar *object_path, |
| 1321 | GCancellable *cancellable, |
| 1322 | GError **error) |
| 1323 | { |
| 1324 | GInitable *ret; |
| 1325 | ret = g_initable_new (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerThreshold", NULL); |
| 1326 | if (ret != NULL) |
| 1327 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 1328 | else |
| 1329 | return NULL; |
| 1330 | } |
| 1331 | |
| 1332 | |
| 1333 | /** |
| 1334 | * sensor_integer_threshold_proxy_new_for_bus: |
| 1335 | * @bus_type: A #GBusType. |
| 1336 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1337 | * @name: A bus name (well-known or unique). |
| 1338 | * @object_path: An object path. |
| 1339 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1340 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1341 | * @user_data: User data to pass to @callback. |
| 1342 | * |
| 1343 | * Like sensor_integer_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 1344 | * |
| 1345 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1346 | * You can then call sensor_integer_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 1347 | * |
| 1348 | * See sensor_integer_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 1349 | */ |
| 1350 | void |
| 1351 | sensor_integer_threshold_proxy_new_for_bus ( |
| 1352 | GBusType bus_type, |
| 1353 | GDBusProxyFlags flags, |
| 1354 | const gchar *name, |
| 1355 | const gchar *object_path, |
| 1356 | GCancellable *cancellable, |
| 1357 | GAsyncReadyCallback callback, |
| 1358 | gpointer user_data) |
| 1359 | { |
| 1360 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_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.SensorIntegerThreshold", NULL); |
| 1361 | } |
| 1362 | |
| 1363 | /** |
| 1364 | * sensor_integer_threshold_proxy_new_for_bus_finish: |
| 1365 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new_for_bus(). |
| 1366 | * @error: Return location for error or %NULL |
| 1367 | * |
| 1368 | * Finishes an operation started with sensor_integer_threshold_proxy_new_for_bus(). |
| 1369 | * |
| 1370 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 1371 | */ |
| 1372 | SensorIntegerThreshold * |
| 1373 | sensor_integer_threshold_proxy_new_for_bus_finish ( |
| 1374 | GAsyncResult *res, |
| 1375 | GError **error) |
| 1376 | { |
| 1377 | GObject *ret; |
| 1378 | GObject *source_object; |
| 1379 | source_object = g_async_result_get_source_object (res); |
| 1380 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1381 | g_object_unref (source_object); |
| 1382 | if (ret != NULL) |
| 1383 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 1384 | else |
| 1385 | return NULL; |
| 1386 | } |
| 1387 | |
| 1388 | /** |
| 1389 | * sensor_integer_threshold_proxy_new_for_bus_sync: |
| 1390 | * @bus_type: A #GBusType. |
| 1391 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1392 | * @name: A bus name (well-known or unique). |
| 1393 | * @object_path: An object path. |
| 1394 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1395 | * @error: Return location for error or %NULL |
| 1396 | * |
| 1397 | * Like sensor_integer_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 1398 | * |
| 1399 | * The calling thread is blocked until a reply is received. |
| 1400 | * |
| 1401 | * See sensor_integer_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 1402 | * |
| 1403 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 1404 | */ |
| 1405 | SensorIntegerThreshold * |
| 1406 | sensor_integer_threshold_proxy_new_for_bus_sync ( |
| 1407 | GBusType bus_type, |
| 1408 | GDBusProxyFlags flags, |
| 1409 | const gchar *name, |
| 1410 | const gchar *object_path, |
| 1411 | GCancellable *cancellable, |
| 1412 | GError **error) |
| 1413 | { |
| 1414 | GInitable *ret; |
| 1415 | ret = g_initable_new (TYPE_SENSOR_INTEGER_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.SensorIntegerThreshold", NULL); |
| 1416 | if (ret != NULL) |
| 1417 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 1418 | else |
| 1419 | return NULL; |
| 1420 | } |
| 1421 | |
| 1422 | |
| 1423 | /* ------------------------------------------------------------------------ */ |
| 1424 | |
| 1425 | /** |
| 1426 | * SensorIntegerThresholdSkeleton: |
| 1427 | * |
| 1428 | * The #SensorIntegerThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 1429 | */ |
| 1430 | |
| 1431 | /** |
| 1432 | * SensorIntegerThresholdSkeletonClass: |
| 1433 | * @parent_class: The parent class. |
| 1434 | * |
| 1435 | * Class structure for #SensorIntegerThresholdSkeleton. |
| 1436 | */ |
| 1437 | |
| 1438 | struct _SensorIntegerThresholdSkeletonPrivate |
| 1439 | { |
| 1440 | GValue *properties; |
| 1441 | GList *changed_properties; |
| 1442 | GSource *changed_properties_idle_source; |
| 1443 | GMainContext *context; |
| 1444 | GMutex lock; |
| 1445 | }; |
| 1446 | |
| 1447 | static void |
| 1448 | _sensor_integer_threshold_skeleton_handle_method_call ( |
| 1449 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1450 | const gchar *sender G_GNUC_UNUSED, |
| 1451 | const gchar *object_path G_GNUC_UNUSED, |
| 1452 | const gchar *interface_name, |
| 1453 | const gchar *method_name, |
| 1454 | GVariant *parameters, |
| 1455 | GDBusMethodInvocation *invocation, |
| 1456 | gpointer user_data) |
| 1457 | { |
| 1458 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 1459 | _ExtendedGDBusMethodInfo *info; |
| 1460 | GVariantIter iter; |
| 1461 | GVariant *child; |
| 1462 | GValue *paramv; |
| 1463 | guint num_params; |
| 1464 | guint num_extra; |
| 1465 | guint n; |
| 1466 | guint signal_id; |
| 1467 | GValue return_value = G_VALUE_INIT; |
| 1468 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1469 | g_assert (info != NULL); |
| 1470 | num_params = g_variant_n_children (parameters); |
| 1471 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1472 | n = 0; |
| 1473 | g_value_init (¶mv[n], TYPE_SENSOR_INTEGER_THRESHOLD); |
| 1474 | g_value_set_object (¶mv[n++], skeleton); |
| 1475 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1476 | g_value_set_object (¶mv[n++], invocation); |
| 1477 | if (info->pass_fdlist) |
| 1478 | { |
| 1479 | #ifdef G_OS_UNIX |
| 1480 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1481 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1482 | #else |
| 1483 | g_assert_not_reached (); |
| 1484 | #endif |
| 1485 | } |
| 1486 | g_variant_iter_init (&iter, parameters); |
| 1487 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1488 | { |
| 1489 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1490 | if (arg_info->use_gvariant) |
| 1491 | { |
| 1492 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1493 | g_value_set_variant (¶mv[n], child); |
| 1494 | n++; |
| 1495 | } |
| 1496 | else |
| 1497 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1498 | g_variant_unref (child); |
| 1499 | } |
| 1500 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD); |
| 1501 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1502 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1503 | if (!g_value_get_boolean (&return_value)) |
| 1504 | 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); |
| 1505 | g_value_unset (&return_value); |
| 1506 | for (n = 0; n < num_params + num_extra; n++) |
| 1507 | g_value_unset (¶mv[n]); |
| 1508 | g_free (paramv); |
| 1509 | } |
| 1510 | |
| 1511 | static GVariant * |
| 1512 | _sensor_integer_threshold_skeleton_handle_get_property ( |
| 1513 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1514 | const gchar *sender G_GNUC_UNUSED, |
| 1515 | const gchar *object_path G_GNUC_UNUSED, |
| 1516 | const gchar *interface_name G_GNUC_UNUSED, |
| 1517 | const gchar *property_name, |
| 1518 | GError **error, |
| 1519 | gpointer user_data) |
| 1520 | { |
| 1521 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 1522 | GValue value = G_VALUE_INIT; |
| 1523 | GParamSpec *pspec; |
| 1524 | _ExtendedGDBusPropertyInfo *info; |
| 1525 | GVariant *ret; |
| 1526 | ret = NULL; |
| 1527 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name); |
| 1528 | g_assert (info != NULL); |
| 1529 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1530 | if (pspec == NULL) |
| 1531 | { |
| 1532 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1533 | } |
| 1534 | else |
| 1535 | { |
| 1536 | g_value_init (&value, pspec->value_type); |
| 1537 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1538 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1539 | g_value_unset (&value); |
| 1540 | } |
| 1541 | return ret; |
| 1542 | } |
| 1543 | |
| 1544 | static gboolean |
| 1545 | _sensor_integer_threshold_skeleton_handle_set_property ( |
| 1546 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1547 | const gchar *sender G_GNUC_UNUSED, |
| 1548 | const gchar *object_path G_GNUC_UNUSED, |
| 1549 | const gchar *interface_name G_GNUC_UNUSED, |
| 1550 | const gchar *property_name, |
| 1551 | GVariant *variant, |
| 1552 | GError **error, |
| 1553 | gpointer user_data) |
| 1554 | { |
| 1555 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 1556 | GValue value = G_VALUE_INIT; |
| 1557 | GParamSpec *pspec; |
| 1558 | _ExtendedGDBusPropertyInfo *info; |
| 1559 | gboolean ret; |
| 1560 | ret = FALSE; |
| 1561 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name); |
| 1562 | g_assert (info != NULL); |
| 1563 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1564 | if (pspec == NULL) |
| 1565 | { |
| 1566 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1567 | } |
| 1568 | else |
| 1569 | { |
| 1570 | if (info->use_gvariant) |
| 1571 | g_value_set_variant (&value, variant); |
| 1572 | else |
| 1573 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1574 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1575 | g_value_unset (&value); |
| 1576 | ret = TRUE; |
| 1577 | } |
| 1578 | return ret; |
| 1579 | } |
| 1580 | |
| 1581 | static const GDBusInterfaceVTable _sensor_integer_threshold_skeleton_vtable = |
| 1582 | { |
| 1583 | _sensor_integer_threshold_skeleton_handle_method_call, |
| 1584 | _sensor_integer_threshold_skeleton_handle_get_property, |
| 1585 | _sensor_integer_threshold_skeleton_handle_set_property, |
| 1586 | {NULL} |
| 1587 | }; |
| 1588 | |
| 1589 | static GDBusInterfaceInfo * |
| 1590 | sensor_integer_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1591 | { |
| 1592 | return sensor_integer_threshold_interface_info (); |
| 1593 | } |
| 1594 | |
| 1595 | static GDBusInterfaceVTable * |
| 1596 | sensor_integer_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1597 | { |
| 1598 | return (GDBusInterfaceVTable *) &_sensor_integer_threshold_skeleton_vtable; |
| 1599 | } |
| 1600 | |
| 1601 | static GVariant * |
| 1602 | sensor_integer_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 1603 | { |
| 1604 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton); |
| 1605 | |
| 1606 | GVariantBuilder builder; |
| 1607 | guint n; |
| 1608 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1609 | if (_sensor_integer_threshold_interface_info.parent_struct.properties == NULL) |
| 1610 | goto out; |
| 1611 | for (n = 0; _sensor_integer_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 1612 | { |
| 1613 | GDBusPropertyInfo *info = _sensor_integer_threshold_interface_info.parent_struct.properties[n]; |
| 1614 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1615 | { |
| 1616 | GVariant *value; |
| 1617 | value = _sensor_integer_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.SensorIntegerThreshold", info->name, NULL, skeleton); |
| 1618 | if (value != NULL) |
| 1619 | { |
| 1620 | g_variant_take_ref (value); |
| 1621 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1622 | g_variant_unref (value); |
| 1623 | } |
| 1624 | } |
| 1625 | } |
| 1626 | out: |
| 1627 | return g_variant_builder_end (&builder); |
| 1628 | } |
| 1629 | |
| 1630 | static gboolean _sensor_integer_threshold_emit_changed (gpointer user_data); |
| 1631 | |
| 1632 | static void |
| 1633 | sensor_integer_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 1634 | { |
| 1635 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton); |
| 1636 | gboolean emit_changed = FALSE; |
| 1637 | |
| 1638 | g_mutex_lock (&skeleton->priv->lock); |
| 1639 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1640 | { |
| 1641 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1642 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1643 | emit_changed = TRUE; |
| 1644 | } |
| 1645 | g_mutex_unlock (&skeleton->priv->lock); |
| 1646 | |
| 1647 | if (emit_changed) |
| 1648 | _sensor_integer_threshold_emit_changed (skeleton); |
| 1649 | } |
| 1650 | |
| 1651 | static void |
| 1652 | _sensor_integer_threshold_on_signal_warning ( |
| 1653 | SensorIntegerThreshold *object) |
| 1654 | { |
| 1655 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1656 | |
| 1657 | GList *connections, *l; |
| 1658 | GVariant *signal_variant; |
| 1659 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1660 | |
| 1661 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 1662 | for (l = connections; l != NULL; l = l->next) |
| 1663 | { |
| 1664 | GDBusConnection *connection = l->data; |
| 1665 | g_dbus_connection_emit_signal (connection, |
| 1666 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Warning", |
| 1667 | signal_variant, NULL); |
| 1668 | } |
| 1669 | g_variant_unref (signal_variant); |
| 1670 | g_list_free_full (connections, g_object_unref); |
| 1671 | } |
| 1672 | |
| 1673 | static void |
| 1674 | _sensor_integer_threshold_on_signal_critical ( |
| 1675 | SensorIntegerThreshold *object) |
| 1676 | { |
| 1677 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1678 | |
| 1679 | GList *connections, *l; |
| 1680 | GVariant *signal_variant; |
| 1681 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1682 | |
| 1683 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 1684 | for (l = connections; l != NULL; l = l->next) |
| 1685 | { |
| 1686 | GDBusConnection *connection = l->data; |
| 1687 | g_dbus_connection_emit_signal (connection, |
| 1688 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Critical", |
| 1689 | signal_variant, NULL); |
| 1690 | } |
| 1691 | g_variant_unref (signal_variant); |
| 1692 | g_list_free_full (connections, g_object_unref); |
| 1693 | } |
| 1694 | |
| 1695 | static void sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface); |
| 1696 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1697 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1698 | G_ADD_PRIVATE (SensorIntegerThresholdSkeleton) |
| 1699 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init)); |
| 1700 | |
| 1701 | #else |
| 1702 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1703 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init)); |
| 1704 | |
| 1705 | #endif |
| 1706 | static void |
| 1707 | sensor_integer_threshold_skeleton_finalize (GObject *object) |
| 1708 | { |
| 1709 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1710 | guint n; |
| 1711 | for (n = 0; n < 4; n++) |
| 1712 | g_value_unset (&skeleton->priv->properties[n]); |
| 1713 | g_free (skeleton->priv->properties); |
| 1714 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1715 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1716 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1717 | g_main_context_unref (skeleton->priv->context); |
| 1718 | g_mutex_clear (&skeleton->priv->lock); |
| 1719 | G_OBJECT_CLASS (sensor_integer_threshold_skeleton_parent_class)->finalize (object); |
| 1720 | } |
| 1721 | |
| 1722 | static void |
| 1723 | sensor_integer_threshold_skeleton_get_property (GObject *object, |
| 1724 | guint prop_id, |
| 1725 | GValue *value, |
| 1726 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1727 | { |
| 1728 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1729 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1730 | g_mutex_lock (&skeleton->priv->lock); |
| 1731 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1732 | g_mutex_unlock (&skeleton->priv->lock); |
| 1733 | } |
| 1734 | |
| 1735 | static gboolean |
| 1736 | _sensor_integer_threshold_emit_changed (gpointer user_data) |
| 1737 | { |
| 1738 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 1739 | GList *l; |
| 1740 | GVariantBuilder builder; |
| 1741 | GVariantBuilder invalidated_builder; |
| 1742 | guint num_changes; |
| 1743 | |
| 1744 | g_mutex_lock (&skeleton->priv->lock); |
| 1745 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1746 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1747 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1748 | { |
| 1749 | ChangedProperty *cp = l->data; |
| 1750 | GVariant *variant; |
| 1751 | const GValue *cur_value; |
| 1752 | |
| 1753 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1754 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1755 | { |
| 1756 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1757 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1758 | g_variant_unref (variant); |
| 1759 | num_changes++; |
| 1760 | } |
| 1761 | } |
| 1762 | if (num_changes > 0) |
| 1763 | { |
| 1764 | GList *connections, *ll; |
| 1765 | GVariant *signal_variant; |
| 1766 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerThreshold", |
| 1767 | &builder, &invalidated_builder)); |
| 1768 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1769 | for (ll = connections; ll != NULL; ll = ll->next) |
| 1770 | { |
| 1771 | GDBusConnection *connection = ll->data; |
| 1772 | |
| 1773 | g_dbus_connection_emit_signal (connection, |
| 1774 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 1775 | "org.freedesktop.DBus.Properties", |
| 1776 | "PropertiesChanged", |
| 1777 | signal_variant, |
| 1778 | NULL); |
| 1779 | } |
| 1780 | g_variant_unref (signal_variant); |
| 1781 | g_list_free_full (connections, g_object_unref); |
| 1782 | } |
| 1783 | else |
| 1784 | { |
| 1785 | g_variant_builder_clear (&builder); |
| 1786 | g_variant_builder_clear (&invalidated_builder); |
| 1787 | } |
| 1788 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1789 | skeleton->priv->changed_properties = NULL; |
| 1790 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1791 | g_mutex_unlock (&skeleton->priv->lock); |
| 1792 | return FALSE; |
| 1793 | } |
| 1794 | |
| 1795 | static void |
| 1796 | _sensor_integer_threshold_schedule_emit_changed (SensorIntegerThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 1797 | { |
| 1798 | ChangedProperty *cp; |
| 1799 | GList *l; |
| 1800 | cp = NULL; |
| 1801 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 1802 | { |
| 1803 | ChangedProperty *i_cp = l->data; |
| 1804 | if (i_cp->info == info) |
| 1805 | { |
| 1806 | cp = i_cp; |
| 1807 | break; |
| 1808 | } |
| 1809 | } |
| 1810 | if (cp == NULL) |
| 1811 | { |
| 1812 | cp = g_new0 (ChangedProperty, 1); |
| 1813 | cp->prop_id = prop_id; |
| 1814 | cp->info = info; |
| 1815 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 1816 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 1817 | g_value_copy (orig_value, &cp->orig_value); |
| 1818 | } |
| 1819 | } |
| 1820 | |
| 1821 | static void |
| 1822 | sensor_integer_threshold_skeleton_notify (GObject *object, |
| 1823 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1824 | { |
| 1825 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1826 | g_mutex_lock (&skeleton->priv->lock); |
| 1827 | if (skeleton->priv->changed_properties != NULL && |
| 1828 | skeleton->priv->changed_properties_idle_source == NULL) |
| 1829 | { |
| 1830 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 1831 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 1832 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 1833 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 1834 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 1835 | } |
| 1836 | g_mutex_unlock (&skeleton->priv->lock); |
| 1837 | } |
| 1838 | |
| 1839 | static void |
| 1840 | sensor_integer_threshold_skeleton_set_property (GObject *object, |
| 1841 | guint prop_id, |
| 1842 | const GValue *value, |
| 1843 | GParamSpec *pspec) |
| 1844 | { |
| 1845 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1846 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1847 | g_mutex_lock (&skeleton->priv->lock); |
| 1848 | g_object_freeze_notify (object); |
| 1849 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 1850 | { |
| 1851 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 1852 | _sensor_integer_threshold_schedule_emit_changed (skeleton, _sensor_integer_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 1853 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 1854 | g_object_notify_by_pspec (object, pspec); |
| 1855 | } |
| 1856 | g_mutex_unlock (&skeleton->priv->lock); |
| 1857 | g_object_thaw_notify (object); |
| 1858 | } |
| 1859 | |
| 1860 | static void |
| 1861 | sensor_integer_threshold_skeleton_init (SensorIntegerThresholdSkeleton *skeleton) |
| 1862 | { |
| 1863 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1864 | skeleton->priv = sensor_integer_threshold_skeleton_get_instance_private (skeleton); |
| 1865 | #else |
| 1866 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, SensorIntegerThresholdSkeletonPrivate); |
| 1867 | #endif |
| 1868 | |
| 1869 | g_mutex_init (&skeleton->priv->lock); |
| 1870 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 1871 | skeleton->priv->properties = g_new0 (GValue, 4); |
| 1872 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 1873 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 1874 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 1875 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 1876 | } |
| 1877 | |
| 1878 | static gint |
| 1879 | sensor_integer_threshold_skeleton_get_threshold_lower_warning (SensorIntegerThreshold *object) |
| 1880 | { |
| 1881 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1882 | gint value; |
| 1883 | g_mutex_lock (&skeleton->priv->lock); |
| 1884 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 1885 | g_mutex_unlock (&skeleton->priv->lock); |
| 1886 | return value; |
| 1887 | } |
| 1888 | |
| 1889 | static gint |
| 1890 | sensor_integer_threshold_skeleton_get_threshold_upper_warning (SensorIntegerThreshold *object) |
| 1891 | { |
| 1892 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1893 | gint value; |
| 1894 | g_mutex_lock (&skeleton->priv->lock); |
| 1895 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 1896 | g_mutex_unlock (&skeleton->priv->lock); |
| 1897 | return value; |
| 1898 | } |
| 1899 | |
| 1900 | static gint |
| 1901 | sensor_integer_threshold_skeleton_get_threshold_upper_critical (SensorIntegerThreshold *object) |
| 1902 | { |
| 1903 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1904 | gint value; |
| 1905 | g_mutex_lock (&skeleton->priv->lock); |
| 1906 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 1907 | g_mutex_unlock (&skeleton->priv->lock); |
| 1908 | return value; |
| 1909 | } |
| 1910 | |
| 1911 | static gint |
| 1912 | sensor_integer_threshold_skeleton_get_threshold_state (SensorIntegerThreshold *object) |
| 1913 | { |
| 1914 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 1915 | gint value; |
| 1916 | g_mutex_lock (&skeleton->priv->lock); |
| 1917 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 1918 | g_mutex_unlock (&skeleton->priv->lock); |
| 1919 | return value; |
| 1920 | } |
| 1921 | |
| 1922 | static void |
| 1923 | sensor_integer_threshold_skeleton_class_init (SensorIntegerThresholdSkeletonClass *klass) |
| 1924 | { |
| 1925 | GObjectClass *gobject_class; |
| 1926 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 1927 | |
| 1928 | gobject_class = G_OBJECT_CLASS (klass); |
| 1929 | gobject_class->finalize = sensor_integer_threshold_skeleton_finalize; |
| 1930 | gobject_class->get_property = sensor_integer_threshold_skeleton_get_property; |
| 1931 | gobject_class->set_property = sensor_integer_threshold_skeleton_set_property; |
| 1932 | gobject_class->notify = sensor_integer_threshold_skeleton_notify; |
| 1933 | |
| 1934 | |
| 1935 | sensor_integer_threshold_override_properties (gobject_class, 1); |
| 1936 | |
| 1937 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 1938 | skeleton_class->get_info = sensor_integer_threshold_skeleton_dbus_interface_get_info; |
| 1939 | skeleton_class->get_properties = sensor_integer_threshold_skeleton_dbus_interface_get_properties; |
| 1940 | skeleton_class->flush = sensor_integer_threshold_skeleton_dbus_interface_flush; |
| 1941 | skeleton_class->get_vtable = sensor_integer_threshold_skeleton_dbus_interface_get_vtable; |
| 1942 | |
| 1943 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1944 | g_type_class_add_private (klass, sizeof (SensorIntegerThresholdSkeletonPrivate)); |
| 1945 | #endif |
| 1946 | } |
| 1947 | |
| 1948 | static void |
| 1949 | sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface) |
| 1950 | { |
| 1951 | iface->warning = _sensor_integer_threshold_on_signal_warning; |
| 1952 | iface->critical = _sensor_integer_threshold_on_signal_critical; |
| 1953 | iface->get_threshold_lower_warning = sensor_integer_threshold_skeleton_get_threshold_lower_warning; |
| 1954 | iface->get_threshold_upper_warning = sensor_integer_threshold_skeleton_get_threshold_upper_warning; |
| 1955 | iface->get_threshold_upper_critical = sensor_integer_threshold_skeleton_get_threshold_upper_critical; |
| 1956 | iface->get_threshold_state = sensor_integer_threshold_skeleton_get_threshold_state; |
| 1957 | } |
| 1958 | |
| 1959 | /** |
| 1960 | * sensor_integer_threshold_skeleton_new: |
| 1961 | * |
| 1962 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 1963 | * |
| 1964 | * Returns: (transfer full) (type SensorIntegerThresholdSkeleton): The skeleton object. |
| 1965 | */ |
| 1966 | SensorIntegerThreshold * |
| 1967 | sensor_integer_threshold_skeleton_new (void) |
| 1968 | { |
| 1969 | return SENSOR_INTEGER_THRESHOLD (g_object_new (TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, NULL)); |
| 1970 | } |
| 1971 | |
| 1972 | /* ------------------------------------------------------------------------ |
| 1973 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 1974 | * ------------------------------------------------------------------------ |
| 1975 | */ |
| 1976 | |
| 1977 | /** |
| 1978 | * SECTION:Object |
| 1979 | * @title: Object |
| 1980 | * @short_description: Specialized GDBusObject types |
| 1981 | * |
| 1982 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 1983 | */ |
| 1984 | |
| 1985 | /** |
| 1986 | * Object: |
| 1987 | * |
| 1988 | * The #Object type is a specialized container of interfaces. |
| 1989 | */ |
| 1990 | |
| 1991 | /** |
| 1992 | * ObjectIface: |
| 1993 | * @parent_iface: The parent interface. |
| 1994 | * |
| 1995 | * Virtual table for the #Object interface. |
| 1996 | */ |
| 1997 | |
| 1998 | typedef ObjectIface ObjectInterface; |
| 1999 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 2000 | |
| 2001 | static void |
| 2002 | object_default_init (ObjectIface *iface) |
| 2003 | { |
| 2004 | /** |
| 2005 | * Object:sensor-integer-threshold: |
| 2006 | * |
| 2007 | * The #SensorIntegerThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>, if any. |
| 2008 | * |
| 2009 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 2010 | */ |
| 2011 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer-threshold", "sensor-integer-threshold", "sensor-integer-threshold", TYPE_SENSOR_INTEGER_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 2012 | |
| 2013 | } |
| 2014 | |
| 2015 | /** |
| 2016 | * object_get_sensor_integer_threshold: |
| 2017 | * @object: A #Object. |
| 2018 | * |
| 2019 | * Gets the #SensorIntegerThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> on @object, if any. |
| 2020 | * |
| 2021 | * Returns: (transfer full): A #SensorIntegerThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 2022 | */ |
| 2023 | SensorIntegerThreshold *object_get_sensor_integer_threshold (Object *object) |
| 2024 | { |
| 2025 | GDBusInterface *ret; |
| 2026 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 2027 | if (ret == NULL) |
| 2028 | return NULL; |
| 2029 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 2030 | } |
| 2031 | |
| 2032 | |
| 2033 | /** |
| 2034 | * object_peek_sensor_integer_threshold: (skip) |
| 2035 | * @object: A #Object. |
| 2036 | * |
| 2037 | * Like object_get_sensor_integer_threshold() but doesn't increase the reference count on the returned object. |
| 2038 | * |
| 2039 | * <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> |
| 2040 | * |
| 2041 | * Returns: (transfer none): A #SensorIntegerThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 2042 | */ |
| 2043 | SensorIntegerThreshold *object_peek_sensor_integer_threshold (Object *object) |
| 2044 | { |
| 2045 | GDBusInterface *ret; |
| 2046 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 2047 | if (ret == NULL) |
| 2048 | return NULL; |
| 2049 | g_object_unref (ret); |
| 2050 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 2051 | } |
| 2052 | |
| 2053 | |
| 2054 | static void |
| 2055 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 2056 | { |
| 2057 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 2058 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 2059 | * anything about, for example old generated code in this process talking to |
| 2060 | * newer generated code in the other process. */ |
| 2061 | if (info != NULL) |
| 2062 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 2063 | } |
| 2064 | |
| 2065 | /** |
| 2066 | * ObjectProxy: |
| 2067 | * |
| 2068 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 2069 | */ |
| 2070 | |
| 2071 | /** |
| 2072 | * ObjectProxyClass: |
| 2073 | * @parent_class: The parent class. |
| 2074 | * |
| 2075 | * Class structure for #ObjectProxy. |
| 2076 | */ |
| 2077 | |
| 2078 | static void |
| 2079 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 2080 | { |
| 2081 | } |
| 2082 | |
| 2083 | static void |
| 2084 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 2085 | { |
| 2086 | iface->interface_added = object_notify; |
| 2087 | iface->interface_removed = object_notify; |
| 2088 | } |
| 2089 | |
| 2090 | |
| 2091 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 2092 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 2093 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 2094 | |
| 2095 | static void |
| 2096 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 2097 | { |
| 2098 | } |
| 2099 | |
| 2100 | static void |
| 2101 | object_proxy_set_property (GObject *gobject, |
| 2102 | guint prop_id, |
| 2103 | const GValue *value G_GNUC_UNUSED, |
| 2104 | GParamSpec *pspec) |
| 2105 | { |
| 2106 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 2107 | } |
| 2108 | |
| 2109 | static void |
| 2110 | object_proxy_get_property (GObject *gobject, |
| 2111 | guint prop_id, |
| 2112 | GValue *value, |
| 2113 | GParamSpec *pspec) |
| 2114 | { |
| 2115 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 2116 | GDBusInterface *interface; |
| 2117 | |
| 2118 | switch (prop_id) |
| 2119 | { |
| 2120 | case 1: |
| 2121 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 2122 | g_value_take_object (value, interface); |
| 2123 | break; |
| 2124 | |
| 2125 | default: |
| 2126 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 2127 | break; |
| 2128 | } |
| 2129 | } |
| 2130 | |
| 2131 | static void |
| 2132 | object_proxy_class_init (ObjectProxyClass *klass) |
| 2133 | { |
| 2134 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 2135 | |
| 2136 | gobject_class->set_property = object_proxy_set_property; |
| 2137 | gobject_class->get_property = object_proxy_get_property; |
| 2138 | |
| 2139 | g_object_class_override_property (gobject_class, 1, "sensor-integer-threshold"); |
| 2140 | } |
| 2141 | |
| 2142 | /** |
| 2143 | * object_proxy_new: |
| 2144 | * @connection: A #GDBusConnection. |
| 2145 | * @object_path: An object path. |
| 2146 | * |
| 2147 | * Creates a new proxy object. |
| 2148 | * |
| 2149 | * Returns: (transfer full): The proxy object. |
| 2150 | */ |
| 2151 | ObjectProxy * |
| 2152 | object_proxy_new (GDBusConnection *connection, |
| 2153 | const gchar *object_path) |
| 2154 | { |
| 2155 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 2156 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 2157 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 2158 | } |
| 2159 | |
| 2160 | /** |
| 2161 | * ObjectSkeleton: |
| 2162 | * |
| 2163 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 2164 | */ |
| 2165 | |
| 2166 | /** |
| 2167 | * ObjectSkeletonClass: |
| 2168 | * @parent_class: The parent class. |
| 2169 | * |
| 2170 | * Class structure for #ObjectSkeleton. |
| 2171 | */ |
| 2172 | |
| 2173 | static void |
| 2174 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 2175 | { |
| 2176 | } |
| 2177 | |
| 2178 | |
| 2179 | static void |
| 2180 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 2181 | { |
| 2182 | iface->interface_added = object_notify; |
| 2183 | iface->interface_removed = object_notify; |
| 2184 | } |
| 2185 | |
| 2186 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 2187 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 2188 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 2189 | |
| 2190 | static void |
| 2191 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 2192 | { |
| 2193 | } |
| 2194 | |
| 2195 | static void |
| 2196 | object_skeleton_set_property (GObject *gobject, |
| 2197 | guint prop_id, |
| 2198 | const GValue *value, |
| 2199 | GParamSpec *pspec) |
| 2200 | { |
| 2201 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 2202 | GDBusInterfaceSkeleton *interface; |
| 2203 | |
| 2204 | switch (prop_id) |
| 2205 | { |
| 2206 | case 1: |
| 2207 | interface = g_value_get_object (value); |
| 2208 | if (interface != NULL) |
| 2209 | { |
| 2210 | g_warn_if_fail (IS_SENSOR_INTEGER_THRESHOLD (interface)); |
| 2211 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 2212 | } |
| 2213 | else |
| 2214 | { |
| 2215 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerThreshold"); |
| 2216 | } |
| 2217 | break; |
| 2218 | |
| 2219 | default: |
| 2220 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 2221 | break; |
| 2222 | } |
| 2223 | } |
| 2224 | |
| 2225 | static void |
| 2226 | object_skeleton_get_property (GObject *gobject, |
| 2227 | guint prop_id, |
| 2228 | GValue *value, |
| 2229 | GParamSpec *pspec) |
| 2230 | { |
| 2231 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 2232 | GDBusInterface *interface; |
| 2233 | |
| 2234 | switch (prop_id) |
| 2235 | { |
| 2236 | case 1: |
| 2237 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 2238 | g_value_take_object (value, interface); |
| 2239 | break; |
| 2240 | |
| 2241 | default: |
| 2242 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 2243 | break; |
| 2244 | } |
| 2245 | } |
| 2246 | |
| 2247 | static void |
| 2248 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 2249 | { |
| 2250 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 2251 | |
| 2252 | gobject_class->set_property = object_skeleton_set_property; |
| 2253 | gobject_class->get_property = object_skeleton_get_property; |
| 2254 | |
| 2255 | g_object_class_override_property (gobject_class, 1, "sensor-integer-threshold"); |
| 2256 | } |
| 2257 | |
| 2258 | /** |
| 2259 | * object_skeleton_new: |
| 2260 | * @object_path: An object path. |
| 2261 | * |
| 2262 | * Creates a new skeleton object. |
| 2263 | * |
| 2264 | * Returns: (transfer full): The skeleton object. |
| 2265 | */ |
| 2266 | ObjectSkeleton * |
| 2267 | object_skeleton_new (const gchar *object_path) |
| 2268 | { |
| 2269 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 2270 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 2271 | } |
| 2272 | |
| 2273 | /** |
| 2274 | * object_skeleton_set_sensor_integer_threshold: |
| 2275 | * @object: A #ObjectSkeleton. |
| 2276 | * @interface_: (allow-none): A #SensorIntegerThreshold or %NULL to clear the interface. |
| 2277 | * |
| 2278 | * Sets the #SensorIntegerThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> on @object. |
| 2279 | */ |
| 2280 | void object_skeleton_set_sensor_integer_threshold (ObjectSkeleton *object, SensorIntegerThreshold *interface_) |
| 2281 | { |
| 2282 | g_object_set (G_OBJECT (object), "sensor-integer-threshold", interface_, NULL); |
| 2283 | } |
| 2284 | |
| 2285 | |
| 2286 | /* ------------------------------------------------------------------------ |
| 2287 | * Code for ObjectManager client |
| 2288 | * ------------------------------------------------------------------------ |
| 2289 | */ |
| 2290 | |
| 2291 | /** |
| 2292 | * SECTION:ObjectManagerClient |
| 2293 | * @title: ObjectManagerClient |
| 2294 | * @short_description: Generated GDBusObjectManagerClient type |
| 2295 | * |
| 2296 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 2297 | */ |
| 2298 | |
| 2299 | /** |
| 2300 | * ObjectManagerClient: |
| 2301 | * |
| 2302 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 2303 | */ |
| 2304 | |
| 2305 | /** |
| 2306 | * ObjectManagerClientClass: |
| 2307 | * @parent_class: The parent class. |
| 2308 | * |
| 2309 | * Class structure for #ObjectManagerClient. |
| 2310 | */ |
| 2311 | |
| 2312 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 2313 | |
| 2314 | static void |
| 2315 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 2316 | { |
| 2317 | } |
| 2318 | |
| 2319 | static void |
| 2320 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 2321 | { |
| 2322 | } |
| 2323 | |
| 2324 | /** |
| 2325 | * object_manager_client_get_proxy_type: |
| 2326 | * @manager: A #GDBusObjectManagerClient. |
| 2327 | * @object_path: The object path of the remote object (unused). |
| 2328 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 2329 | * @user_data: User data (unused). |
| 2330 | * |
| 2331 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 2332 | * |
| 2333 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 2334 | */ |
| 2335 | GType |
| 2336 | 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) |
| 2337 | { |
| 2338 | static gsize once_init_value = 0; |
| 2339 | static GHashTable *lookup_hash; |
| 2340 | GType ret; |
| 2341 | |
| 2342 | if (interface_name == NULL) |
| 2343 | return TYPE_OBJECT_PROXY; |
| 2344 | if (g_once_init_enter (&once_init_value)) |
| 2345 | { |
| 2346 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 2347 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY)); |
| 2348 | g_once_init_leave (&once_init_value, 1); |
| 2349 | } |
| 2350 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 2351 | if (ret == (GType) 0) |
| 2352 | ret = G_TYPE_DBUS_PROXY; |
| 2353 | return ret; |
| 2354 | } |
| 2355 | |
| 2356 | /** |
| 2357 | * object_manager_client_new: |
| 2358 | * @connection: A #GDBusConnection. |
| 2359 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 2360 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2361 | * @object_path: An object path. |
| 2362 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2363 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2364 | * @user_data: User data to pass to @callback. |
| 2365 | * |
| 2366 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 2367 | * |
| 2368 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2369 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 2370 | * |
| 2371 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 2372 | */ |
| 2373 | void |
| 2374 | object_manager_client_new ( |
| 2375 | GDBusConnection *connection, |
| 2376 | GDBusObjectManagerClientFlags flags, |
| 2377 | const gchar *name, |
| 2378 | const gchar *object_path, |
| 2379 | GCancellable *cancellable, |
| 2380 | GAsyncReadyCallback callback, |
| 2381 | gpointer user_data) |
| 2382 | { |
| 2383 | 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); |
| 2384 | } |
| 2385 | |
| 2386 | /** |
| 2387 | * object_manager_client_new_finish: |
| 2388 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 2389 | * @error: Return location for error or %NULL |
| 2390 | * |
| 2391 | * Finishes an operation started with object_manager_client_new(). |
| 2392 | * |
| 2393 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 2394 | */ |
| 2395 | GDBusObjectManager * |
| 2396 | object_manager_client_new_finish ( |
| 2397 | GAsyncResult *res, |
| 2398 | GError **error) |
| 2399 | { |
| 2400 | GObject *ret; |
| 2401 | GObject *source_object; |
| 2402 | source_object = g_async_result_get_source_object (res); |
| 2403 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2404 | g_object_unref (source_object); |
| 2405 | if (ret != NULL) |
| 2406 | return G_DBUS_OBJECT_MANAGER (ret); |
| 2407 | else |
| 2408 | return NULL; |
| 2409 | } |
| 2410 | |
| 2411 | /** |
| 2412 | * object_manager_client_new_sync: |
| 2413 | * @connection: A #GDBusConnection. |
| 2414 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 2415 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2416 | * @object_path: An object path. |
| 2417 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2418 | * @error: Return location for error or %NULL |
| 2419 | * |
| 2420 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 2421 | * |
| 2422 | * The calling thread is blocked until a reply is received. |
| 2423 | * |
| 2424 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 2425 | * |
| 2426 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 2427 | */ |
| 2428 | GDBusObjectManager * |
| 2429 | object_manager_client_new_sync ( |
| 2430 | GDBusConnection *connection, |
| 2431 | GDBusObjectManagerClientFlags flags, |
| 2432 | const gchar *name, |
| 2433 | const gchar *object_path, |
| 2434 | GCancellable *cancellable, |
| 2435 | GError **error) |
| 2436 | { |
| 2437 | GInitable *ret; |
| 2438 | 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); |
| 2439 | if (ret != NULL) |
| 2440 | return G_DBUS_OBJECT_MANAGER (ret); |
| 2441 | else |
| 2442 | return NULL; |
| 2443 | } |
| 2444 | |
| 2445 | |
| 2446 | /** |
| 2447 | * object_manager_client_new_for_bus: |
| 2448 | * @bus_type: A #GBusType. |
| 2449 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 2450 | * @name: A bus name (well-known or unique). |
| 2451 | * @object_path: An object path. |
| 2452 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2453 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2454 | * @user_data: User data to pass to @callback. |
| 2455 | * |
| 2456 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 2457 | * |
| 2458 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2459 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 2460 | * |
| 2461 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 2462 | */ |
| 2463 | void |
| 2464 | object_manager_client_new_for_bus ( |
| 2465 | GBusType bus_type, |
| 2466 | GDBusObjectManagerClientFlags flags, |
| 2467 | const gchar *name, |
| 2468 | const gchar *object_path, |
| 2469 | GCancellable *cancellable, |
| 2470 | GAsyncReadyCallback callback, |
| 2471 | gpointer user_data) |
| 2472 | { |
| 2473 | 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); |
| 2474 | } |
| 2475 | |
| 2476 | /** |
| 2477 | * object_manager_client_new_for_bus_finish: |
| 2478 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 2479 | * @error: Return location for error or %NULL |
| 2480 | * |
| 2481 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 2482 | * |
| 2483 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 2484 | */ |
| 2485 | GDBusObjectManager * |
| 2486 | object_manager_client_new_for_bus_finish ( |
| 2487 | GAsyncResult *res, |
| 2488 | GError **error) |
| 2489 | { |
| 2490 | GObject *ret; |
| 2491 | GObject *source_object; |
| 2492 | source_object = g_async_result_get_source_object (res); |
| 2493 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2494 | g_object_unref (source_object); |
| 2495 | if (ret != NULL) |
| 2496 | return G_DBUS_OBJECT_MANAGER (ret); |
| 2497 | else |
| 2498 | return NULL; |
| 2499 | } |
| 2500 | |
| 2501 | /** |
| 2502 | * object_manager_client_new_for_bus_sync: |
| 2503 | * @bus_type: A #GBusType. |
| 2504 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 2505 | * @name: A bus name (well-known or unique). |
| 2506 | * @object_path: An object path. |
| 2507 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2508 | * @error: Return location for error or %NULL |
| 2509 | * |
| 2510 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 2511 | * |
| 2512 | * The calling thread is blocked until a reply is received. |
| 2513 | * |
| 2514 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 2515 | * |
| 2516 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 2517 | */ |
| 2518 | GDBusObjectManager * |
| 2519 | object_manager_client_new_for_bus_sync ( |
| 2520 | GBusType bus_type, |
| 2521 | GDBusObjectManagerClientFlags flags, |
| 2522 | const gchar *name, |
| 2523 | const gchar *object_path, |
| 2524 | GCancellable *cancellable, |
| 2525 | GError **error) |
| 2526 | { |
| 2527 | GInitable *ret; |
| 2528 | 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); |
| 2529 | if (ret != NULL) |
| 2530 | return G_DBUS_OBJECT_MANAGER (ret); |
| 2531 | else |
| 2532 | return NULL; |
| 2533 | } |
| 2534 | |
| 2535 | |