Norman James | e276510 | 2015-08-19 22:00:55 -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.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.SensorInteger |
| 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * SECTION:SensorInteger |
| 158 | * @title: SensorInteger |
| 159 | * @short_description: Generated C code for the org.openbmc.SensorInteger D-Bus interface |
| 160 | * |
| 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface in C. |
| 162 | */ |
| 163 | |
| 164 | /* ---- Introspection data for org.openbmc.SensorInteger ---- */ |
| 165 | |
| 166 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_value_OUT_ARG_value = |
| 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "value", |
| 171 | (gchar *) "i", |
| 172 | NULL |
| 173 | }, |
| 174 | FALSE |
| 175 | }; |
| 176 | |
| 177 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_value_OUT_ARG_pointers[] = |
| 178 | { |
| 179 | &_sensor_integer_method_info_get_value_OUT_ARG_value, |
| 180 | NULL |
| 181 | }; |
| 182 | |
| 183 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_value = |
| 184 | { |
| 185 | { |
| 186 | -1, |
| 187 | (gchar *) "getValue", |
| 188 | NULL, |
| 189 | (GDBusArgInfo **) &_sensor_integer_method_info_get_value_OUT_ARG_pointers, |
| 190 | NULL |
| 191 | }, |
| 192 | "handle-get-value", |
| 193 | FALSE |
| 194 | }; |
| 195 | |
| 196 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_units_OUT_ARG_units = |
| 197 | { |
| 198 | { |
| 199 | -1, |
| 200 | (gchar *) "units", |
| 201 | (gchar *) "s", |
| 202 | NULL |
| 203 | }, |
| 204 | FALSE |
| 205 | }; |
| 206 | |
| 207 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_units_OUT_ARG_pointers[] = |
| 208 | { |
| 209 | &_sensor_integer_method_info_get_units_OUT_ARG_units, |
| 210 | NULL |
| 211 | }; |
| 212 | |
| 213 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_units = |
| 214 | { |
| 215 | { |
| 216 | -1, |
| 217 | (gchar *) "getUnits", |
| 218 | NULL, |
| 219 | (GDBusArgInfo **) &_sensor_integer_method_info_get_units_OUT_ARG_pointers, |
| 220 | NULL |
| 221 | }, |
| 222 | "handle-get-units", |
| 223 | FALSE |
| 224 | }; |
| 225 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 226 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_lower_critical = |
| 227 | { |
| 228 | { |
| 229 | -1, |
| 230 | (gchar *) "lower_critical", |
| 231 | (gchar *) "i", |
| 232 | NULL |
| 233 | }, |
| 234 | FALSE |
| 235 | }; |
| 236 | |
| 237 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_lower_warning = |
| 238 | { |
| 239 | { |
| 240 | -1, |
| 241 | (gchar *) "lower_warning", |
| 242 | (gchar *) "i", |
| 243 | NULL |
| 244 | }, |
| 245 | FALSE |
| 246 | }; |
| 247 | |
| 248 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_upper_warning = |
| 249 | { |
| 250 | { |
| 251 | -1, |
| 252 | (gchar *) "upper_warning", |
| 253 | (gchar *) "i", |
| 254 | NULL |
| 255 | }, |
| 256 | FALSE |
| 257 | }; |
| 258 | |
| 259 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_upper_critical = |
| 260 | { |
| 261 | { |
| 262 | -1, |
| 263 | (gchar *) "upper_critical", |
| 264 | (gchar *) "i", |
| 265 | NULL |
| 266 | }, |
| 267 | FALSE |
| 268 | }; |
| 269 | |
| 270 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_thresholds_IN_ARG_pointers[] = |
| 271 | { |
| 272 | &_sensor_integer_method_info_set_thresholds_IN_ARG_lower_critical, |
| 273 | &_sensor_integer_method_info_set_thresholds_IN_ARG_lower_warning, |
| 274 | &_sensor_integer_method_info_set_thresholds_IN_ARG_upper_warning, |
| 275 | &_sensor_integer_method_info_set_thresholds_IN_ARG_upper_critical, |
| 276 | NULL |
| 277 | }; |
| 278 | |
| 279 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_thresholds = |
| 280 | { |
| 281 | { |
| 282 | -1, |
| 283 | (gchar *) "setThresholds", |
| 284 | (GDBusArgInfo **) &_sensor_integer_method_info_set_thresholds_IN_ARG_pointers, |
| 285 | NULL, |
| 286 | NULL |
| 287 | }, |
| 288 | "handle-set-thresholds", |
| 289 | FALSE |
| 290 | }; |
| 291 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 292 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval = |
| 293 | { |
| 294 | { |
| 295 | -1, |
| 296 | (gchar *) "poll_interval", |
| 297 | (gchar *) "i", |
| 298 | NULL |
| 299 | }, |
| 300 | FALSE |
| 301 | }; |
| 302 | |
| 303 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_poll_interval_IN_ARG_pointers[] = |
| 304 | { |
| 305 | &_sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval, |
| 306 | NULL |
| 307 | }; |
| 308 | |
| 309 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_poll_interval = |
| 310 | { |
| 311 | { |
| 312 | -1, |
| 313 | (gchar *) "setPollInterval", |
| 314 | (GDBusArgInfo **) &_sensor_integer_method_info_set_poll_interval_IN_ARG_pointers, |
| 315 | NULL, |
| 316 | NULL |
| 317 | }, |
| 318 | "handle-set-poll-interval", |
| 319 | FALSE |
| 320 | }; |
| 321 | |
| 322 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_config_data_IN_ARG_config = |
| 323 | { |
| 324 | { |
| 325 | -1, |
| 326 | (gchar *) "config", |
| 327 | (gchar *) "as", |
| 328 | NULL |
| 329 | }, |
| 330 | FALSE |
| 331 | }; |
| 332 | |
| 333 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_config_data_IN_ARG_pointers[] = |
| 334 | { |
| 335 | &_sensor_integer_method_info_set_config_data_IN_ARG_config, |
| 336 | NULL |
| 337 | }; |
| 338 | |
| 339 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_config_data = |
| 340 | { |
| 341 | { |
| 342 | -1, |
| 343 | (gchar *) "setConfigData", |
| 344 | (GDBusArgInfo **) &_sensor_integer_method_info_set_config_data_IN_ARG_pointers, |
| 345 | NULL, |
| 346 | NULL |
| 347 | }, |
| 348 | "handle-set-config-data", |
| 349 | FALSE |
| 350 | }; |
| 351 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 352 | static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_threshold_state_OUT_ARG_threshold_state = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 353 | { |
| 354 | { |
| 355 | -1, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 356 | (gchar *) "threshold_state", |
| 357 | (gchar *) "i", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 358 | NULL |
| 359 | }, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 360 | FALSE |
| 361 | }; |
| 362 | |
| 363 | static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_threshold_state_OUT_ARG_pointers[] = |
| 364 | { |
| 365 | &_sensor_integer_method_info_get_threshold_state_OUT_ARG_threshold_state, |
| 366 | NULL |
| 367 | }; |
| 368 | |
| 369 | static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_threshold_state = |
| 370 | { |
| 371 | { |
| 372 | -1, |
| 373 | (gchar *) "getThresholdState", |
| 374 | NULL, |
| 375 | (GDBusArgInfo **) &_sensor_integer_method_info_get_threshold_state_OUT_ARG_pointers, |
| 376 | NULL |
| 377 | }, |
| 378 | "handle-get-threshold-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 379 | FALSE |
| 380 | }; |
| 381 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 382 | static const _ExtendedGDBusMethodInfo * const _sensor_integer_method_info_pointers[] = |
| 383 | { |
| 384 | &_sensor_integer_method_info_get_value, |
| 385 | &_sensor_integer_method_info_get_units, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 386 | &_sensor_integer_method_info_set_thresholds, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 387 | &_sensor_integer_method_info_set_poll_interval, |
| 388 | &_sensor_integer_method_info_set_config_data, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 389 | &_sensor_integer_method_info_get_threshold_state, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 390 | NULL |
| 391 | }; |
| 392 | |
| 393 | static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_changed_ARG_value = |
| 394 | { |
| 395 | { |
| 396 | -1, |
| 397 | (gchar *) "value", |
| 398 | (gchar *) "i", |
| 399 | NULL |
| 400 | }, |
| 401 | FALSE |
| 402 | }; |
| 403 | |
| 404 | static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_changed_ARG_pointers[] = |
| 405 | { |
| 406 | &_sensor_integer_signal_info_changed_ARG_value, |
| 407 | NULL |
| 408 | }; |
| 409 | |
| 410 | static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_changed = |
| 411 | { |
| 412 | { |
| 413 | -1, |
| 414 | (gchar *) "Changed", |
| 415 | (GDBusArgInfo **) &_sensor_integer_signal_info_changed_ARG_pointers, |
| 416 | NULL |
| 417 | }, |
| 418 | "changed" |
| 419 | }; |
| 420 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 421 | static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_warning = |
| 422 | { |
| 423 | { |
| 424 | -1, |
| 425 | (gchar *) "Warning", |
| 426 | NULL, |
| 427 | NULL |
| 428 | }, |
| 429 | "warning" |
| 430 | }; |
| 431 | |
| 432 | static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_critical = |
| 433 | { |
| 434 | { |
| 435 | -1, |
| 436 | (gchar *) "Critical", |
| 437 | NULL, |
| 438 | NULL |
| 439 | }, |
| 440 | "critical" |
| 441 | }; |
| 442 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 443 | static const _ExtendedGDBusSignalInfo * const _sensor_integer_signal_info_pointers[] = |
| 444 | { |
| 445 | &_sensor_integer_signal_info_changed, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 446 | &_sensor_integer_signal_info_warning, |
| 447 | &_sensor_integer_signal_info_critical, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 448 | NULL |
| 449 | }; |
| 450 | |
| 451 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_value = |
| 452 | { |
| 453 | { |
| 454 | -1, |
| 455 | (gchar *) "value", |
| 456 | (gchar *) "i", |
| 457 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 458 | NULL |
| 459 | }, |
| 460 | "value", |
| 461 | FALSE |
| 462 | }; |
| 463 | |
| 464 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_units = |
| 465 | { |
| 466 | { |
| 467 | -1, |
| 468 | (gchar *) "units", |
| 469 | (gchar *) "s", |
| 470 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 471 | NULL |
| 472 | }, |
| 473 | "units", |
| 474 | FALSE |
| 475 | }; |
| 476 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 477 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_lower_critical = |
| 478 | { |
| 479 | { |
| 480 | -1, |
| 481 | (gchar *) "threshold_lower_critical", |
| 482 | (gchar *) "i", |
| 483 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 484 | NULL |
| 485 | }, |
| 486 | "threshold-lower-critical", |
| 487 | FALSE |
| 488 | }; |
| 489 | |
| 490 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_lower_warning = |
| 491 | { |
| 492 | { |
| 493 | -1, |
| 494 | (gchar *) "threshold_lower_warning", |
| 495 | (gchar *) "i", |
| 496 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 497 | NULL |
| 498 | }, |
| 499 | "threshold-lower-warning", |
| 500 | FALSE |
| 501 | }; |
| 502 | |
| 503 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_upper_warning = |
| 504 | { |
| 505 | { |
| 506 | -1, |
| 507 | (gchar *) "threshold_upper_warning", |
| 508 | (gchar *) "i", |
| 509 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 510 | NULL |
| 511 | }, |
| 512 | "threshold-upper-warning", |
| 513 | FALSE |
| 514 | }; |
| 515 | |
| 516 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_upper_critical = |
| 517 | { |
| 518 | { |
| 519 | -1, |
| 520 | (gchar *) "threshold_upper_critical", |
| 521 | (gchar *) "i", |
| 522 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 523 | NULL |
| 524 | }, |
| 525 | "threshold-upper-critical", |
| 526 | FALSE |
| 527 | }; |
| 528 | |
| 529 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_state = |
| 530 | { |
| 531 | { |
| 532 | -1, |
| 533 | (gchar *) "threshold_state", |
| 534 | (gchar *) "i", |
| 535 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 536 | NULL |
| 537 | }, |
| 538 | "threshold-state", |
| 539 | FALSE |
| 540 | }; |
| 541 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 542 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_poll_interval = |
| 543 | { |
| 544 | { |
| 545 | -1, |
| 546 | (gchar *) "poll_interval", |
| 547 | (gchar *) "i", |
| 548 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 549 | NULL |
| 550 | }, |
| 551 | "poll-interval", |
| 552 | FALSE |
| 553 | }; |
| 554 | |
| 555 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_config_data = |
| 556 | { |
| 557 | { |
| 558 | -1, |
| 559 | (gchar *) "config_data", |
| 560 | (gchar *) "as", |
| 561 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 562 | NULL |
| 563 | }, |
| 564 | "config-data", |
| 565 | FALSE |
| 566 | }; |
| 567 | |
| 568 | static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_changed_tolerance = |
| 569 | { |
| 570 | { |
| 571 | -1, |
| 572 | (gchar *) "changed_tolerance", |
| 573 | (gchar *) "i", |
| 574 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 575 | NULL |
| 576 | }, |
| 577 | "changed-tolerance", |
| 578 | FALSE |
| 579 | }; |
| 580 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 581 | static const _ExtendedGDBusPropertyInfo * const _sensor_integer_property_info_pointers[] = |
| 582 | { |
| 583 | &_sensor_integer_property_info_value, |
| 584 | &_sensor_integer_property_info_units, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 585 | &_sensor_integer_property_info_threshold_lower_critical, |
| 586 | &_sensor_integer_property_info_threshold_lower_warning, |
| 587 | &_sensor_integer_property_info_threshold_upper_warning, |
| 588 | &_sensor_integer_property_info_threshold_upper_critical, |
| 589 | &_sensor_integer_property_info_threshold_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 590 | &_sensor_integer_property_info_poll_interval, |
| 591 | &_sensor_integer_property_info_config_data, |
| 592 | &_sensor_integer_property_info_changed_tolerance, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 593 | NULL |
| 594 | }; |
| 595 | |
| 596 | static const _ExtendedGDBusInterfaceInfo _sensor_integer_interface_info = |
| 597 | { |
| 598 | { |
| 599 | -1, |
| 600 | (gchar *) "org.openbmc.SensorInteger", |
| 601 | (GDBusMethodInfo **) &_sensor_integer_method_info_pointers, |
| 602 | (GDBusSignalInfo **) &_sensor_integer_signal_info_pointers, |
| 603 | (GDBusPropertyInfo **) &_sensor_integer_property_info_pointers, |
| 604 | NULL |
| 605 | }, |
| 606 | "sensor-integer", |
| 607 | }; |
| 608 | |
| 609 | |
| 610 | /** |
| 611 | * sensor_integer_interface_info: |
| 612 | * |
| 613 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface. |
| 614 | * |
| 615 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 616 | */ |
| 617 | GDBusInterfaceInfo * |
| 618 | sensor_integer_interface_info (void) |
| 619 | { |
| 620 | return (GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct; |
| 621 | } |
| 622 | |
| 623 | /** |
| 624 | * sensor_integer_override_properties: |
| 625 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 626 | * @property_id_begin: The property id to assign to the first overridden property. |
| 627 | * |
| 628 | * Overrides all #GObject properties in the #SensorInteger interface for a concrete class. |
| 629 | * The properties are overridden in the order they are defined. |
| 630 | * |
| 631 | * Returns: The last property id. |
| 632 | */ |
| 633 | guint |
| 634 | sensor_integer_override_properties (GObjectClass *klass, guint property_id_begin) |
| 635 | { |
| 636 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 637 | g_object_class_override_property (klass, property_id_begin++, "units"); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 638 | g_object_class_override_property (klass, property_id_begin++, "threshold-lower-critical"); |
| 639 | g_object_class_override_property (klass, property_id_begin++, "threshold-lower-warning"); |
| 640 | g_object_class_override_property (klass, property_id_begin++, "threshold-upper-warning"); |
| 641 | g_object_class_override_property (klass, property_id_begin++, "threshold-upper-critical"); |
| 642 | g_object_class_override_property (klass, property_id_begin++, "threshold-state"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 643 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
| 644 | g_object_class_override_property (klass, property_id_begin++, "config-data"); |
| 645 | g_object_class_override_property (klass, property_id_begin++, "changed-tolerance"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 646 | return property_id_begin - 1; |
| 647 | } |
| 648 | |
| 649 | |
| 650 | |
| 651 | /** |
| 652 | * SensorInteger: |
| 653 | * |
| 654 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. |
| 655 | */ |
| 656 | |
| 657 | /** |
| 658 | * SensorIntegerIface: |
| 659 | * @parent_iface: The parent interface. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 660 | * @handle_get_threshold_state: Handler for the #SensorInteger::handle-get-threshold-state signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 661 | * @handle_get_units: Handler for the #SensorInteger::handle-get-units signal. |
| 662 | * @handle_get_value: Handler for the #SensorInteger::handle-get-value signal. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 663 | * @handle_set_config_data: Handler for the #SensorInteger::handle-set-config-data signal. |
| 664 | * @handle_set_poll_interval: Handler for the #SensorInteger::handle-set-poll-interval signal. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 665 | * @handle_set_thresholds: Handler for the #SensorInteger::handle-set-thresholds signal. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 666 | * @get_changed_tolerance: Getter for the #SensorInteger:changed-tolerance property. |
| 667 | * @get_config_data: Getter for the #SensorInteger:config-data property. |
| 668 | * @get_poll_interval: Getter for the #SensorInteger:poll-interval property. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 669 | * @get_threshold_lower_critical: Getter for the #SensorInteger:threshold-lower-critical property. |
| 670 | * @get_threshold_lower_warning: Getter for the #SensorInteger:threshold-lower-warning property. |
| 671 | * @get_threshold_state: Getter for the #SensorInteger:threshold-state property. |
| 672 | * @get_threshold_upper_critical: Getter for the #SensorInteger:threshold-upper-critical property. |
| 673 | * @get_threshold_upper_warning: Getter for the #SensorInteger:threshold-upper-warning property. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 674 | * @get_units: Getter for the #SensorInteger:units property. |
| 675 | * @get_value: Getter for the #SensorInteger:value property. |
| 676 | * @changed: Handler for the #SensorInteger::changed signal. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 677 | * @critical: Handler for the #SensorInteger::critical signal. |
| 678 | * @warning: Handler for the #SensorInteger::warning signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 679 | * |
| 680 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. |
| 681 | */ |
| 682 | |
| 683 | typedef SensorIntegerIface SensorIntegerInterface; |
| 684 | G_DEFINE_INTERFACE (SensorInteger, sensor_integer, G_TYPE_OBJECT); |
| 685 | |
| 686 | static void |
| 687 | sensor_integer_default_init (SensorIntegerIface *iface) |
| 688 | { |
| 689 | /* GObject signals for incoming D-Bus method calls: */ |
| 690 | /** |
| 691 | * SensorInteger::handle-get-value: |
| 692 | * @object: A #SensorInteger. |
| 693 | * @invocation: A #GDBusMethodInvocation. |
| 694 | * |
| 695 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method. |
| 696 | * |
| 697 | * 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_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 698 | * |
| 699 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 700 | */ |
| 701 | g_signal_new ("handle-get-value", |
| 702 | G_TYPE_FROM_INTERFACE (iface), |
| 703 | G_SIGNAL_RUN_LAST, |
| 704 | G_STRUCT_OFFSET (SensorIntegerIface, handle_get_value), |
| 705 | g_signal_accumulator_true_handled, |
| 706 | NULL, |
| 707 | g_cclosure_marshal_generic, |
| 708 | G_TYPE_BOOLEAN, |
| 709 | 1, |
| 710 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 711 | |
| 712 | /** |
| 713 | * SensorInteger::handle-get-units: |
| 714 | * @object: A #SensorInteger. |
| 715 | * @invocation: A #GDBusMethodInvocation. |
| 716 | * |
| 717 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method. |
| 718 | * |
| 719 | * 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_complete_get_units() 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. |
| 720 | * |
| 721 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 722 | */ |
| 723 | g_signal_new ("handle-get-units", |
| 724 | G_TYPE_FROM_INTERFACE (iface), |
| 725 | G_SIGNAL_RUN_LAST, |
| 726 | G_STRUCT_OFFSET (SensorIntegerIface, handle_get_units), |
| 727 | g_signal_accumulator_true_handled, |
| 728 | NULL, |
| 729 | g_cclosure_marshal_generic, |
| 730 | G_TYPE_BOOLEAN, |
| 731 | 1, |
| 732 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 733 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 734 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 735 | * SensorInteger::handle-set-thresholds: |
| 736 | * @object: A #SensorInteger. |
| 737 | * @invocation: A #GDBusMethodInvocation. |
| 738 | * @arg_lower_critical: Argument passed by remote caller. |
| 739 | * @arg_lower_warning: Argument passed by remote caller. |
| 740 | * @arg_upper_warning: Argument passed by remote caller. |
| 741 | * @arg_upper_critical: Argument passed by remote caller. |
| 742 | * |
| 743 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method. |
| 744 | * |
| 745 | * 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_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. |
| 746 | * |
| 747 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 748 | */ |
| 749 | g_signal_new ("handle-set-thresholds", |
| 750 | G_TYPE_FROM_INTERFACE (iface), |
| 751 | G_SIGNAL_RUN_LAST, |
| 752 | G_STRUCT_OFFSET (SensorIntegerIface, handle_set_thresholds), |
| 753 | g_signal_accumulator_true_handled, |
| 754 | NULL, |
| 755 | g_cclosure_marshal_generic, |
| 756 | G_TYPE_BOOLEAN, |
| 757 | 5, |
| 758 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); |
| 759 | |
| 760 | /** |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 761 | * SensorInteger::handle-set-poll-interval: |
| 762 | * @object: A #SensorInteger. |
| 763 | * @invocation: A #GDBusMethodInvocation. |
| 764 | * @arg_poll_interval: Argument passed by remote caller. |
| 765 | * |
| 766 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method. |
| 767 | * |
| 768 | * 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_complete_set_poll_interval() 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. |
| 769 | * |
| 770 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 771 | */ |
| 772 | g_signal_new ("handle-set-poll-interval", |
| 773 | G_TYPE_FROM_INTERFACE (iface), |
| 774 | G_SIGNAL_RUN_LAST, |
| 775 | G_STRUCT_OFFSET (SensorIntegerIface, handle_set_poll_interval), |
| 776 | g_signal_accumulator_true_handled, |
| 777 | NULL, |
| 778 | g_cclosure_marshal_generic, |
| 779 | G_TYPE_BOOLEAN, |
| 780 | 2, |
| 781 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 782 | |
| 783 | /** |
| 784 | * SensorInteger::handle-set-config-data: |
| 785 | * @object: A #SensorInteger. |
| 786 | * @invocation: A #GDBusMethodInvocation. |
| 787 | * @arg_config: Argument passed by remote caller. |
| 788 | * |
| 789 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method. |
| 790 | * |
| 791 | * 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_complete_set_config_data() 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. |
| 792 | * |
| 793 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 794 | */ |
| 795 | g_signal_new ("handle-set-config-data", |
| 796 | G_TYPE_FROM_INTERFACE (iface), |
| 797 | G_SIGNAL_RUN_LAST, |
| 798 | G_STRUCT_OFFSET (SensorIntegerIface, handle_set_config_data), |
| 799 | g_signal_accumulator_true_handled, |
| 800 | NULL, |
| 801 | g_cclosure_marshal_generic, |
| 802 | G_TYPE_BOOLEAN, |
| 803 | 2, |
| 804 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV); |
| 805 | |
| 806 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 807 | * SensorInteger::handle-get-threshold-state: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 808 | * @object: A #SensorInteger. |
| 809 | * @invocation: A #GDBusMethodInvocation. |
| 810 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 811 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 812 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 813 | * 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_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. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 814 | * |
| 815 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 816 | */ |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 817 | g_signal_new ("handle-get-threshold-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 818 | G_TYPE_FROM_INTERFACE (iface), |
| 819 | G_SIGNAL_RUN_LAST, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 820 | G_STRUCT_OFFSET (SensorIntegerIface, handle_get_threshold_state), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 821 | g_signal_accumulator_true_handled, |
| 822 | NULL, |
| 823 | g_cclosure_marshal_generic, |
| 824 | G_TYPE_BOOLEAN, |
| 825 | 1, |
| 826 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 827 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 828 | /* GObject signals for received D-Bus signals: */ |
| 829 | /** |
| 830 | * SensorInteger::changed: |
| 831 | * @object: A #SensorInteger. |
| 832 | * @arg_value: Argument. |
| 833 | * |
| 834 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> is received. |
| 835 | * |
| 836 | * 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. |
| 837 | */ |
| 838 | g_signal_new ("changed", |
| 839 | G_TYPE_FROM_INTERFACE (iface), |
| 840 | G_SIGNAL_RUN_LAST, |
| 841 | G_STRUCT_OFFSET (SensorIntegerIface, changed), |
| 842 | NULL, |
| 843 | NULL, |
| 844 | g_cclosure_marshal_generic, |
| 845 | G_TYPE_NONE, |
| 846 | 1, G_TYPE_INT); |
| 847 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 848 | /** |
| 849 | * SensorInteger::warning: |
| 850 | * @object: A #SensorInteger. |
| 851 | * |
| 852 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Warning">"Warning"</link> is received. |
| 853 | * |
| 854 | * 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. |
| 855 | */ |
| 856 | g_signal_new ("warning", |
| 857 | G_TYPE_FROM_INTERFACE (iface), |
| 858 | G_SIGNAL_RUN_LAST, |
| 859 | G_STRUCT_OFFSET (SensorIntegerIface, warning), |
| 860 | NULL, |
| 861 | NULL, |
| 862 | g_cclosure_marshal_generic, |
| 863 | G_TYPE_NONE, |
| 864 | 0); |
| 865 | |
| 866 | /** |
| 867 | * SensorInteger::critical: |
| 868 | * @object: A #SensorInteger. |
| 869 | * |
| 870 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Critical">"Critical"</link> is received. |
| 871 | * |
| 872 | * 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. |
| 873 | */ |
| 874 | g_signal_new ("critical", |
| 875 | G_TYPE_FROM_INTERFACE (iface), |
| 876 | G_SIGNAL_RUN_LAST, |
| 877 | G_STRUCT_OFFSET (SensorIntegerIface, critical), |
| 878 | NULL, |
| 879 | NULL, |
| 880 | g_cclosure_marshal_generic, |
| 881 | G_TYPE_NONE, |
| 882 | 0); |
| 883 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 884 | /* GObject properties for D-Bus properties: */ |
| 885 | /** |
| 886 | * SensorInteger:value: |
| 887 | * |
| 888 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link>. |
| 889 | * |
| 890 | * 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. |
| 891 | */ |
| 892 | g_object_interface_install_property (iface, |
| 893 | g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 894 | /** |
| 895 | * SensorInteger:units: |
| 896 | * |
| 897 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link>. |
| 898 | * |
| 899 | * 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. |
| 900 | */ |
| 901 | g_object_interface_install_property (iface, |
| 902 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 903 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 904 | * SensorInteger:threshold-lower-critical: |
| 905 | * |
| 906 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link>. |
| 907 | * |
| 908 | * 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. |
| 909 | */ |
| 910 | g_object_interface_install_property (iface, |
| 911 | g_param_spec_int ("threshold-lower-critical", "threshold_lower_critical", "threshold_lower_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 912 | /** |
| 913 | * SensorInteger:threshold-lower-warning: |
| 914 | * |
| 915 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link>. |
| 916 | * |
| 917 | * 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. |
| 918 | */ |
| 919 | g_object_interface_install_property (iface, |
| 920 | 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)); |
| 921 | /** |
| 922 | * SensorInteger:threshold-upper-warning: |
| 923 | * |
| 924 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link>. |
| 925 | * |
| 926 | * 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. |
| 927 | */ |
| 928 | g_object_interface_install_property (iface, |
| 929 | 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)); |
| 930 | /** |
| 931 | * SensorInteger:threshold-upper-critical: |
| 932 | * |
| 933 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link>. |
| 934 | * |
| 935 | * 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. |
| 936 | */ |
| 937 | g_object_interface_install_property (iface, |
| 938 | 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)); |
| 939 | /** |
| 940 | * SensorInteger:threshold-state: |
| 941 | * |
| 942 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link>. |
| 943 | * |
| 944 | * 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. |
| 945 | */ |
| 946 | g_object_interface_install_property (iface, |
| 947 | g_param_spec_int ("threshold-state", "threshold_state", "threshold_state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 948 | /** |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 949 | * SensorInteger:poll-interval: |
| 950 | * |
| 951 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link>. |
| 952 | * |
| 953 | * 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. |
| 954 | */ |
| 955 | g_object_interface_install_property (iface, |
| 956 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 957 | /** |
| 958 | * SensorInteger:config-data: |
| 959 | * |
| 960 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link>. |
| 961 | * |
| 962 | * 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. |
| 963 | */ |
| 964 | g_object_interface_install_property (iface, |
| 965 | g_param_spec_boxed ("config-data", "config_data", "config_data", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 966 | /** |
| 967 | * SensorInteger:changed-tolerance: |
| 968 | * |
| 969 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.changed_tolerance">"changed_tolerance"</link>. |
| 970 | * |
| 971 | * 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. |
| 972 | */ |
| 973 | g_object_interface_install_property (iface, |
| 974 | g_param_spec_int ("changed-tolerance", "changed_tolerance", "changed_tolerance", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 975 | } |
| 976 | |
| 977 | /** |
| 978 | * sensor_integer_get_value: (skip) |
| 979 | * @object: A #SensorInteger. |
| 980 | * |
| 981 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property. |
| 982 | * |
| 983 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 984 | * |
| 985 | * Returns: The property value. |
| 986 | */ |
| 987 | gint |
| 988 | sensor_integer_get_value (SensorInteger *object) |
| 989 | { |
| 990 | return SENSOR_INTEGER_GET_IFACE (object)->get_value (object); |
| 991 | } |
| 992 | |
| 993 | /** |
| 994 | * sensor_integer_set_value: (skip) |
| 995 | * @object: A #SensorInteger. |
| 996 | * @value: The value to set. |
| 997 | * |
| 998 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property to @value. |
| 999 | * |
| 1000 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1001 | */ |
| 1002 | void |
| 1003 | sensor_integer_set_value (SensorInteger *object, gint value) |
| 1004 | { |
| 1005 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 1006 | } |
| 1007 | |
| 1008 | /** |
| 1009 | * sensor_integer_get_units: (skip) |
| 1010 | * @object: A #SensorInteger. |
| 1011 | * |
| 1012 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property. |
| 1013 | * |
| 1014 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1015 | * |
| 1016 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_dup_units() if on another thread.</warning> |
| 1017 | * |
| 1018 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 1019 | */ |
| 1020 | const gchar * |
| 1021 | sensor_integer_get_units (SensorInteger *object) |
| 1022 | { |
| 1023 | return SENSOR_INTEGER_GET_IFACE (object)->get_units (object); |
| 1024 | } |
| 1025 | |
| 1026 | /** |
| 1027 | * sensor_integer_dup_units: (skip) |
| 1028 | * @object: A #SensorInteger. |
| 1029 | * |
| 1030 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property. |
| 1031 | * |
| 1032 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1033 | * |
| 1034 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 1035 | */ |
| 1036 | gchar * |
| 1037 | sensor_integer_dup_units (SensorInteger *object) |
| 1038 | { |
| 1039 | gchar *value; |
| 1040 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 1041 | return value; |
| 1042 | } |
| 1043 | |
| 1044 | /** |
| 1045 | * sensor_integer_set_units: (skip) |
| 1046 | * @object: A #SensorInteger. |
| 1047 | * @value: The value to set. |
| 1048 | * |
| 1049 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property to @value. |
| 1050 | * |
| 1051 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1052 | */ |
| 1053 | void |
| 1054 | sensor_integer_set_units (SensorInteger *object, const gchar *value) |
| 1055 | { |
| 1056 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 1057 | } |
| 1058 | |
| 1059 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1060 | * sensor_integer_get_threshold_lower_critical: (skip) |
| 1061 | * @object: A #SensorInteger. |
| 1062 | * |
| 1063 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link> D-Bus property. |
| 1064 | * |
| 1065 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1066 | * |
| 1067 | * Returns: The property value. |
| 1068 | */ |
| 1069 | gint |
| 1070 | sensor_integer_get_threshold_lower_critical (SensorInteger *object) |
| 1071 | { |
| 1072 | return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_lower_critical (object); |
| 1073 | } |
| 1074 | |
| 1075 | /** |
| 1076 | * sensor_integer_set_threshold_lower_critical: (skip) |
| 1077 | * @object: A #SensorInteger. |
| 1078 | * @value: The value to set. |
| 1079 | * |
| 1080 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link> D-Bus property to @value. |
| 1081 | * |
| 1082 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1083 | */ |
| 1084 | void |
| 1085 | sensor_integer_set_threshold_lower_critical (SensorInteger *object, gint value) |
| 1086 | { |
| 1087 | g_object_set (G_OBJECT (object), "threshold-lower-critical", value, NULL); |
| 1088 | } |
| 1089 | |
| 1090 | /** |
| 1091 | * sensor_integer_get_threshold_lower_warning: (skip) |
| 1092 | * @object: A #SensorInteger. |
| 1093 | * |
| 1094 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property. |
| 1095 | * |
| 1096 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1097 | * |
| 1098 | * Returns: The property value. |
| 1099 | */ |
| 1100 | gint |
| 1101 | sensor_integer_get_threshold_lower_warning (SensorInteger *object) |
| 1102 | { |
| 1103 | return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_lower_warning (object); |
| 1104 | } |
| 1105 | |
| 1106 | /** |
| 1107 | * sensor_integer_set_threshold_lower_warning: (skip) |
| 1108 | * @object: A #SensorInteger. |
| 1109 | * @value: The value to set. |
| 1110 | * |
| 1111 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property to @value. |
| 1112 | * |
| 1113 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1114 | */ |
| 1115 | void |
| 1116 | sensor_integer_set_threshold_lower_warning (SensorInteger *object, gint value) |
| 1117 | { |
| 1118 | g_object_set (G_OBJECT (object), "threshold-lower-warning", value, NULL); |
| 1119 | } |
| 1120 | |
| 1121 | /** |
| 1122 | * sensor_integer_get_threshold_upper_warning: (skip) |
| 1123 | * @object: A #SensorInteger. |
| 1124 | * |
| 1125 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property. |
| 1126 | * |
| 1127 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1128 | * |
| 1129 | * Returns: The property value. |
| 1130 | */ |
| 1131 | gint |
| 1132 | sensor_integer_get_threshold_upper_warning (SensorInteger *object) |
| 1133 | { |
| 1134 | return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_upper_warning (object); |
| 1135 | } |
| 1136 | |
| 1137 | /** |
| 1138 | * sensor_integer_set_threshold_upper_warning: (skip) |
| 1139 | * @object: A #SensorInteger. |
| 1140 | * @value: The value to set. |
| 1141 | * |
| 1142 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property to @value. |
| 1143 | * |
| 1144 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1145 | */ |
| 1146 | void |
| 1147 | sensor_integer_set_threshold_upper_warning (SensorInteger *object, gint value) |
| 1148 | { |
| 1149 | g_object_set (G_OBJECT (object), "threshold-upper-warning", value, NULL); |
| 1150 | } |
| 1151 | |
| 1152 | /** |
| 1153 | * sensor_integer_get_threshold_upper_critical: (skip) |
| 1154 | * @object: A #SensorInteger. |
| 1155 | * |
| 1156 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property. |
| 1157 | * |
| 1158 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1159 | * |
| 1160 | * Returns: The property value. |
| 1161 | */ |
| 1162 | gint |
| 1163 | sensor_integer_get_threshold_upper_critical (SensorInteger *object) |
| 1164 | { |
| 1165 | return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_upper_critical (object); |
| 1166 | } |
| 1167 | |
| 1168 | /** |
| 1169 | * sensor_integer_set_threshold_upper_critical: (skip) |
| 1170 | * @object: A #SensorInteger. |
| 1171 | * @value: The value to set. |
| 1172 | * |
| 1173 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property to @value. |
| 1174 | * |
| 1175 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1176 | */ |
| 1177 | void |
| 1178 | sensor_integer_set_threshold_upper_critical (SensorInteger *object, gint value) |
| 1179 | { |
| 1180 | g_object_set (G_OBJECT (object), "threshold-upper-critical", value, NULL); |
| 1181 | } |
| 1182 | |
| 1183 | /** |
| 1184 | * sensor_integer_get_threshold_state: (skip) |
| 1185 | * @object: A #SensorInteger. |
| 1186 | * |
| 1187 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link> D-Bus property. |
| 1188 | * |
| 1189 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1190 | * |
| 1191 | * Returns: The property value. |
| 1192 | */ |
| 1193 | gint |
| 1194 | sensor_integer_get_threshold_state (SensorInteger *object) |
| 1195 | { |
| 1196 | return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_state (object); |
| 1197 | } |
| 1198 | |
| 1199 | /** |
| 1200 | * sensor_integer_set_threshold_state: (skip) |
| 1201 | * @object: A #SensorInteger. |
| 1202 | * @value: The value to set. |
| 1203 | * |
| 1204 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link> D-Bus property to @value. |
| 1205 | * |
| 1206 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1207 | */ |
| 1208 | void |
| 1209 | sensor_integer_set_threshold_state (SensorInteger *object, gint value) |
| 1210 | { |
| 1211 | g_object_set (G_OBJECT (object), "threshold-state", value, NULL); |
| 1212 | } |
| 1213 | |
| 1214 | /** |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1215 | * sensor_integer_get_poll_interval: (skip) |
| 1216 | * @object: A #SensorInteger. |
| 1217 | * |
| 1218 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property. |
| 1219 | * |
| 1220 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1221 | * |
| 1222 | * Returns: The property value. |
| 1223 | */ |
| 1224 | gint |
| 1225 | sensor_integer_get_poll_interval (SensorInteger *object) |
| 1226 | { |
| 1227 | return SENSOR_INTEGER_GET_IFACE (object)->get_poll_interval (object); |
| 1228 | } |
| 1229 | |
| 1230 | /** |
| 1231 | * sensor_integer_set_poll_interval: (skip) |
| 1232 | * @object: A #SensorInteger. |
| 1233 | * @value: The value to set. |
| 1234 | * |
| 1235 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property to @value. |
| 1236 | * |
| 1237 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1238 | */ |
| 1239 | void |
| 1240 | sensor_integer_set_poll_interval (SensorInteger *object, gint value) |
| 1241 | { |
| 1242 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * sensor_integer_get_config_data: (skip) |
| 1247 | * @object: A #SensorInteger. |
| 1248 | * |
| 1249 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property. |
| 1250 | * |
| 1251 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1252 | * |
| 1253 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_dup_config_data() if on another thread.</warning> |
| 1254 | * |
| 1255 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 1256 | */ |
| 1257 | const gchar *const * |
| 1258 | sensor_integer_get_config_data (SensorInteger *object) |
| 1259 | { |
| 1260 | return SENSOR_INTEGER_GET_IFACE (object)->get_config_data (object); |
| 1261 | } |
| 1262 | |
| 1263 | /** |
| 1264 | * sensor_integer_dup_config_data: (skip) |
| 1265 | * @object: A #SensorInteger. |
| 1266 | * |
| 1267 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property. |
| 1268 | * |
| 1269 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1270 | * |
| 1271 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). |
| 1272 | */ |
| 1273 | gchar ** |
| 1274 | sensor_integer_dup_config_data (SensorInteger *object) |
| 1275 | { |
| 1276 | gchar **value; |
| 1277 | g_object_get (G_OBJECT (object), "config-data", &value, NULL); |
| 1278 | return value; |
| 1279 | } |
| 1280 | |
| 1281 | /** |
| 1282 | * sensor_integer_set_config_data: (skip) |
| 1283 | * @object: A #SensorInteger. |
| 1284 | * @value: The value to set. |
| 1285 | * |
| 1286 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property to @value. |
| 1287 | * |
| 1288 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1289 | */ |
| 1290 | void |
| 1291 | sensor_integer_set_config_data (SensorInteger *object, const gchar *const *value) |
| 1292 | { |
| 1293 | g_object_set (G_OBJECT (object), "config-data", value, NULL); |
| 1294 | } |
| 1295 | |
| 1296 | /** |
| 1297 | * sensor_integer_get_changed_tolerance: (skip) |
| 1298 | * @object: A #SensorInteger. |
| 1299 | * |
| 1300 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.changed_tolerance">"changed_tolerance"</link> D-Bus property. |
| 1301 | * |
| 1302 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 1303 | * |
| 1304 | * Returns: The property value. |
| 1305 | */ |
| 1306 | gint |
| 1307 | sensor_integer_get_changed_tolerance (SensorInteger *object) |
| 1308 | { |
| 1309 | return SENSOR_INTEGER_GET_IFACE (object)->get_changed_tolerance (object); |
| 1310 | } |
| 1311 | |
| 1312 | /** |
| 1313 | * sensor_integer_set_changed_tolerance: (skip) |
| 1314 | * @object: A #SensorInteger. |
| 1315 | * @value: The value to set. |
| 1316 | * |
| 1317 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.changed_tolerance">"changed_tolerance"</link> D-Bus property to @value. |
| 1318 | * |
| 1319 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 1320 | */ |
| 1321 | void |
| 1322 | sensor_integer_set_changed_tolerance (SensorInteger *object, gint value) |
| 1323 | { |
| 1324 | g_object_set (G_OBJECT (object), "changed-tolerance", value, NULL); |
| 1325 | } |
| 1326 | |
| 1327 | /** |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1328 | * sensor_integer_emit_changed: |
| 1329 | * @object: A #SensorInteger. |
| 1330 | * @arg_value: Argument to pass with the signal. |
| 1331 | * |
| 1332 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> D-Bus signal. |
| 1333 | */ |
| 1334 | void |
| 1335 | sensor_integer_emit_changed ( |
| 1336 | SensorInteger *object, |
| 1337 | gint arg_value) |
| 1338 | { |
| 1339 | g_signal_emit_by_name (object, "changed", arg_value); |
| 1340 | } |
| 1341 | |
| 1342 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1343 | * sensor_integer_emit_warning: |
| 1344 | * @object: A #SensorInteger. |
| 1345 | * |
| 1346 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Warning">"Warning"</link> D-Bus signal. |
| 1347 | */ |
| 1348 | void |
| 1349 | sensor_integer_emit_warning ( |
| 1350 | SensorInteger *object) |
| 1351 | { |
| 1352 | g_signal_emit_by_name (object, "warning"); |
| 1353 | } |
| 1354 | |
| 1355 | /** |
| 1356 | * sensor_integer_emit_critical: |
| 1357 | * @object: A #SensorInteger. |
| 1358 | * |
| 1359 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Critical">"Critical"</link> D-Bus signal. |
| 1360 | */ |
| 1361 | void |
| 1362 | sensor_integer_emit_critical ( |
| 1363 | SensorInteger *object) |
| 1364 | { |
| 1365 | g_signal_emit_by_name (object, "critical"); |
| 1366 | } |
| 1367 | |
| 1368 | /** |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1369 | * sensor_integer_call_get_value: |
| 1370 | * @proxy: A #SensorIntegerProxy. |
| 1371 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1372 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1373 | * @user_data: User data to pass to @callback. |
| 1374 | * |
| 1375 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy. |
| 1376 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1377 | * You can then call sensor_integer_call_get_value_finish() to get the result of the operation. |
| 1378 | * |
| 1379 | * See sensor_integer_call_get_value_sync() for the synchronous, blocking version of this method. |
| 1380 | */ |
| 1381 | void |
| 1382 | sensor_integer_call_get_value ( |
| 1383 | SensorInteger *proxy, |
| 1384 | GCancellable *cancellable, |
| 1385 | GAsyncReadyCallback callback, |
| 1386 | gpointer user_data) |
| 1387 | { |
| 1388 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1389 | "getValue", |
| 1390 | g_variant_new ("()"), |
| 1391 | G_DBUS_CALL_FLAGS_NONE, |
| 1392 | -1, |
| 1393 | cancellable, |
| 1394 | callback, |
| 1395 | user_data); |
| 1396 | } |
| 1397 | |
| 1398 | /** |
| 1399 | * sensor_integer_call_get_value_finish: |
| 1400 | * @proxy: A #SensorIntegerProxy. |
| 1401 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 1402 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_value(). |
| 1403 | * @error: Return location for error or %NULL. |
| 1404 | * |
| 1405 | * Finishes an operation started with sensor_integer_call_get_value(). |
| 1406 | * |
| 1407 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1408 | */ |
| 1409 | gboolean |
| 1410 | sensor_integer_call_get_value_finish ( |
| 1411 | SensorInteger *proxy, |
| 1412 | gint *out_value, |
| 1413 | GAsyncResult *res, |
| 1414 | GError **error) |
| 1415 | { |
| 1416 | GVariant *_ret; |
| 1417 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1418 | if (_ret == NULL) |
| 1419 | goto _out; |
| 1420 | g_variant_get (_ret, |
| 1421 | "(i)", |
| 1422 | out_value); |
| 1423 | g_variant_unref (_ret); |
| 1424 | _out: |
| 1425 | return _ret != NULL; |
| 1426 | } |
| 1427 | |
| 1428 | /** |
| 1429 | * sensor_integer_call_get_value_sync: |
| 1430 | * @proxy: A #SensorIntegerProxy. |
| 1431 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 1432 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1433 | * @error: Return location for error or %NULL. |
| 1434 | * |
| 1435 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 1436 | * |
| 1437 | * See sensor_integer_call_get_value() for the asynchronous version of this method. |
| 1438 | * |
| 1439 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1440 | */ |
| 1441 | gboolean |
| 1442 | sensor_integer_call_get_value_sync ( |
| 1443 | SensorInteger *proxy, |
| 1444 | gint *out_value, |
| 1445 | GCancellable *cancellable, |
| 1446 | GError **error) |
| 1447 | { |
| 1448 | GVariant *_ret; |
| 1449 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1450 | "getValue", |
| 1451 | g_variant_new ("()"), |
| 1452 | G_DBUS_CALL_FLAGS_NONE, |
| 1453 | -1, |
| 1454 | cancellable, |
| 1455 | error); |
| 1456 | if (_ret == NULL) |
| 1457 | goto _out; |
| 1458 | g_variant_get (_ret, |
| 1459 | "(i)", |
| 1460 | out_value); |
| 1461 | g_variant_unref (_ret); |
| 1462 | _out: |
| 1463 | return _ret != NULL; |
| 1464 | } |
| 1465 | |
| 1466 | /** |
| 1467 | * sensor_integer_call_get_units: |
| 1468 | * @proxy: A #SensorIntegerProxy. |
| 1469 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1470 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1471 | * @user_data: User data to pass to @callback. |
| 1472 | * |
| 1473 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy. |
| 1474 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1475 | * You can then call sensor_integer_call_get_units_finish() to get the result of the operation. |
| 1476 | * |
| 1477 | * See sensor_integer_call_get_units_sync() for the synchronous, blocking version of this method. |
| 1478 | */ |
| 1479 | void |
| 1480 | sensor_integer_call_get_units ( |
| 1481 | SensorInteger *proxy, |
| 1482 | GCancellable *cancellable, |
| 1483 | GAsyncReadyCallback callback, |
| 1484 | gpointer user_data) |
| 1485 | { |
| 1486 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1487 | "getUnits", |
| 1488 | g_variant_new ("()"), |
| 1489 | G_DBUS_CALL_FLAGS_NONE, |
| 1490 | -1, |
| 1491 | cancellable, |
| 1492 | callback, |
| 1493 | user_data); |
| 1494 | } |
| 1495 | |
| 1496 | /** |
| 1497 | * sensor_integer_call_get_units_finish: |
| 1498 | * @proxy: A #SensorIntegerProxy. |
| 1499 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 1500 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_units(). |
| 1501 | * @error: Return location for error or %NULL. |
| 1502 | * |
| 1503 | * Finishes an operation started with sensor_integer_call_get_units(). |
| 1504 | * |
| 1505 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1506 | */ |
| 1507 | gboolean |
| 1508 | sensor_integer_call_get_units_finish ( |
| 1509 | SensorInteger *proxy, |
| 1510 | gchar **out_units, |
| 1511 | GAsyncResult *res, |
| 1512 | GError **error) |
| 1513 | { |
| 1514 | GVariant *_ret; |
| 1515 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1516 | if (_ret == NULL) |
| 1517 | goto _out; |
| 1518 | g_variant_get (_ret, |
| 1519 | "(s)", |
| 1520 | out_units); |
| 1521 | g_variant_unref (_ret); |
| 1522 | _out: |
| 1523 | return _ret != NULL; |
| 1524 | } |
| 1525 | |
| 1526 | /** |
| 1527 | * sensor_integer_call_get_units_sync: |
| 1528 | * @proxy: A #SensorIntegerProxy. |
| 1529 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 1530 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1531 | * @error: Return location for error or %NULL. |
| 1532 | * |
| 1533 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 1534 | * |
| 1535 | * See sensor_integer_call_get_units() for the asynchronous version of this method. |
| 1536 | * |
| 1537 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1538 | */ |
| 1539 | gboolean |
| 1540 | sensor_integer_call_get_units_sync ( |
| 1541 | SensorInteger *proxy, |
| 1542 | gchar **out_units, |
| 1543 | GCancellable *cancellable, |
| 1544 | GError **error) |
| 1545 | { |
| 1546 | GVariant *_ret; |
| 1547 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1548 | "getUnits", |
| 1549 | g_variant_new ("()"), |
| 1550 | G_DBUS_CALL_FLAGS_NONE, |
| 1551 | -1, |
| 1552 | cancellable, |
| 1553 | error); |
| 1554 | if (_ret == NULL) |
| 1555 | goto _out; |
| 1556 | g_variant_get (_ret, |
| 1557 | "(s)", |
| 1558 | out_units); |
| 1559 | g_variant_unref (_ret); |
| 1560 | _out: |
| 1561 | return _ret != NULL; |
| 1562 | } |
| 1563 | |
| 1564 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1565 | * sensor_integer_call_set_thresholds: |
| 1566 | * @proxy: A #SensorIntegerProxy. |
| 1567 | * @arg_lower_critical: Argument to pass with the method invocation. |
| 1568 | * @arg_lower_warning: Argument to pass with the method invocation. |
| 1569 | * @arg_upper_warning: Argument to pass with the method invocation. |
| 1570 | * @arg_upper_critical: Argument to pass with the method invocation. |
| 1571 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1572 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1573 | * @user_data: User data to pass to @callback. |
| 1574 | * |
| 1575 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method on @proxy. |
| 1576 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1577 | * You can then call sensor_integer_call_set_thresholds_finish() to get the result of the operation. |
| 1578 | * |
| 1579 | * See sensor_integer_call_set_thresholds_sync() for the synchronous, blocking version of this method. |
| 1580 | */ |
| 1581 | void |
| 1582 | sensor_integer_call_set_thresholds ( |
| 1583 | SensorInteger *proxy, |
| 1584 | gint arg_lower_critical, |
| 1585 | gint arg_lower_warning, |
| 1586 | gint arg_upper_warning, |
| 1587 | gint arg_upper_critical, |
| 1588 | GCancellable *cancellable, |
| 1589 | GAsyncReadyCallback callback, |
| 1590 | gpointer user_data) |
| 1591 | { |
| 1592 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1593 | "setThresholds", |
| 1594 | g_variant_new ("(iiii)", |
| 1595 | arg_lower_critical, |
| 1596 | arg_lower_warning, |
| 1597 | arg_upper_warning, |
| 1598 | arg_upper_critical), |
| 1599 | G_DBUS_CALL_FLAGS_NONE, |
| 1600 | -1, |
| 1601 | cancellable, |
| 1602 | callback, |
| 1603 | user_data); |
| 1604 | } |
| 1605 | |
| 1606 | /** |
| 1607 | * sensor_integer_call_set_thresholds_finish: |
| 1608 | * @proxy: A #SensorIntegerProxy. |
| 1609 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_thresholds(). |
| 1610 | * @error: Return location for error or %NULL. |
| 1611 | * |
| 1612 | * Finishes an operation started with sensor_integer_call_set_thresholds(). |
| 1613 | * |
| 1614 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1615 | */ |
| 1616 | gboolean |
| 1617 | sensor_integer_call_set_thresholds_finish ( |
| 1618 | SensorInteger *proxy, |
| 1619 | GAsyncResult *res, |
| 1620 | GError **error) |
| 1621 | { |
| 1622 | GVariant *_ret; |
| 1623 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1624 | if (_ret == NULL) |
| 1625 | goto _out; |
| 1626 | g_variant_get (_ret, |
| 1627 | "()"); |
| 1628 | g_variant_unref (_ret); |
| 1629 | _out: |
| 1630 | return _ret != NULL; |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * sensor_integer_call_set_thresholds_sync: |
| 1635 | * @proxy: A #SensorIntegerProxy. |
| 1636 | * @arg_lower_critical: Argument to pass with the method invocation. |
| 1637 | * @arg_lower_warning: Argument to pass with the method invocation. |
| 1638 | * @arg_upper_warning: Argument to pass with the method invocation. |
| 1639 | * @arg_upper_critical: Argument to pass with the method invocation. |
| 1640 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1641 | * @error: Return location for error or %NULL. |
| 1642 | * |
| 1643 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 1644 | * |
| 1645 | * See sensor_integer_call_set_thresholds() for the asynchronous version of this method. |
| 1646 | * |
| 1647 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1648 | */ |
| 1649 | gboolean |
| 1650 | sensor_integer_call_set_thresholds_sync ( |
| 1651 | SensorInteger *proxy, |
| 1652 | gint arg_lower_critical, |
| 1653 | gint arg_lower_warning, |
| 1654 | gint arg_upper_warning, |
| 1655 | gint arg_upper_critical, |
| 1656 | GCancellable *cancellable, |
| 1657 | GError **error) |
| 1658 | { |
| 1659 | GVariant *_ret; |
| 1660 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1661 | "setThresholds", |
| 1662 | g_variant_new ("(iiii)", |
| 1663 | arg_lower_critical, |
| 1664 | arg_lower_warning, |
| 1665 | arg_upper_warning, |
| 1666 | arg_upper_critical), |
| 1667 | G_DBUS_CALL_FLAGS_NONE, |
| 1668 | -1, |
| 1669 | cancellable, |
| 1670 | error); |
| 1671 | if (_ret == NULL) |
| 1672 | goto _out; |
| 1673 | g_variant_get (_ret, |
| 1674 | "()"); |
| 1675 | g_variant_unref (_ret); |
| 1676 | _out: |
| 1677 | return _ret != NULL; |
| 1678 | } |
| 1679 | |
| 1680 | /** |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1681 | * sensor_integer_call_set_poll_interval: |
| 1682 | * @proxy: A #SensorIntegerProxy. |
| 1683 | * @arg_poll_interval: Argument to pass with the method invocation. |
| 1684 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1685 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1686 | * @user_data: User data to pass to @callback. |
| 1687 | * |
| 1688 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy. |
| 1689 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1690 | * You can then call sensor_integer_call_set_poll_interval_finish() to get the result of the operation. |
| 1691 | * |
| 1692 | * See sensor_integer_call_set_poll_interval_sync() for the synchronous, blocking version of this method. |
| 1693 | */ |
| 1694 | void |
| 1695 | sensor_integer_call_set_poll_interval ( |
| 1696 | SensorInteger *proxy, |
| 1697 | gint arg_poll_interval, |
| 1698 | GCancellable *cancellable, |
| 1699 | GAsyncReadyCallback callback, |
| 1700 | gpointer user_data) |
| 1701 | { |
| 1702 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1703 | "setPollInterval", |
| 1704 | g_variant_new ("(i)", |
| 1705 | arg_poll_interval), |
| 1706 | G_DBUS_CALL_FLAGS_NONE, |
| 1707 | -1, |
| 1708 | cancellable, |
| 1709 | callback, |
| 1710 | user_data); |
| 1711 | } |
| 1712 | |
| 1713 | /** |
| 1714 | * sensor_integer_call_set_poll_interval_finish: |
| 1715 | * @proxy: A #SensorIntegerProxy. |
| 1716 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_poll_interval(). |
| 1717 | * @error: Return location for error or %NULL. |
| 1718 | * |
| 1719 | * Finishes an operation started with sensor_integer_call_set_poll_interval(). |
| 1720 | * |
| 1721 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1722 | */ |
| 1723 | gboolean |
| 1724 | sensor_integer_call_set_poll_interval_finish ( |
| 1725 | SensorInteger *proxy, |
| 1726 | GAsyncResult *res, |
| 1727 | GError **error) |
| 1728 | { |
| 1729 | GVariant *_ret; |
| 1730 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1731 | if (_ret == NULL) |
| 1732 | goto _out; |
| 1733 | g_variant_get (_ret, |
| 1734 | "()"); |
| 1735 | g_variant_unref (_ret); |
| 1736 | _out: |
| 1737 | return _ret != NULL; |
| 1738 | } |
| 1739 | |
| 1740 | /** |
| 1741 | * sensor_integer_call_set_poll_interval_sync: |
| 1742 | * @proxy: A #SensorIntegerProxy. |
| 1743 | * @arg_poll_interval: Argument to pass with the method invocation. |
| 1744 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1745 | * @error: Return location for error or %NULL. |
| 1746 | * |
| 1747 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 1748 | * |
| 1749 | * See sensor_integer_call_set_poll_interval() for the asynchronous version of this method. |
| 1750 | * |
| 1751 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1752 | */ |
| 1753 | gboolean |
| 1754 | sensor_integer_call_set_poll_interval_sync ( |
| 1755 | SensorInteger *proxy, |
| 1756 | gint arg_poll_interval, |
| 1757 | GCancellable *cancellable, |
| 1758 | GError **error) |
| 1759 | { |
| 1760 | GVariant *_ret; |
| 1761 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1762 | "setPollInterval", |
| 1763 | g_variant_new ("(i)", |
| 1764 | arg_poll_interval), |
| 1765 | G_DBUS_CALL_FLAGS_NONE, |
| 1766 | -1, |
| 1767 | cancellable, |
| 1768 | error); |
| 1769 | if (_ret == NULL) |
| 1770 | goto _out; |
| 1771 | g_variant_get (_ret, |
| 1772 | "()"); |
| 1773 | g_variant_unref (_ret); |
| 1774 | _out: |
| 1775 | return _ret != NULL; |
| 1776 | } |
| 1777 | |
| 1778 | /** |
| 1779 | * sensor_integer_call_set_config_data: |
| 1780 | * @proxy: A #SensorIntegerProxy. |
| 1781 | * @arg_config: Argument to pass with the method invocation. |
| 1782 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1783 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1784 | * @user_data: User data to pass to @callback. |
| 1785 | * |
| 1786 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method on @proxy. |
| 1787 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 1788 | * You can then call sensor_integer_call_set_config_data_finish() to get the result of the operation. |
| 1789 | * |
| 1790 | * See sensor_integer_call_set_config_data_sync() for the synchronous, blocking version of this method. |
| 1791 | */ |
| 1792 | void |
| 1793 | sensor_integer_call_set_config_data ( |
| 1794 | SensorInteger *proxy, |
| 1795 | const gchar *const *arg_config, |
| 1796 | GCancellable *cancellable, |
| 1797 | GAsyncReadyCallback callback, |
| 1798 | gpointer user_data) |
| 1799 | { |
| 1800 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1801 | "setConfigData", |
| 1802 | g_variant_new ("(^as)", |
| 1803 | arg_config), |
| 1804 | G_DBUS_CALL_FLAGS_NONE, |
| 1805 | -1, |
| 1806 | cancellable, |
| 1807 | callback, |
| 1808 | user_data); |
| 1809 | } |
| 1810 | |
| 1811 | /** |
| 1812 | * sensor_integer_call_set_config_data_finish: |
| 1813 | * @proxy: A #SensorIntegerProxy. |
| 1814 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_config_data(). |
| 1815 | * @error: Return location for error or %NULL. |
| 1816 | * |
| 1817 | * Finishes an operation started with sensor_integer_call_set_config_data(). |
| 1818 | * |
| 1819 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1820 | */ |
| 1821 | gboolean |
| 1822 | sensor_integer_call_set_config_data_finish ( |
| 1823 | SensorInteger *proxy, |
| 1824 | GAsyncResult *res, |
| 1825 | GError **error) |
| 1826 | { |
| 1827 | GVariant *_ret; |
| 1828 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1829 | if (_ret == NULL) |
| 1830 | goto _out; |
| 1831 | g_variant_get (_ret, |
| 1832 | "()"); |
| 1833 | g_variant_unref (_ret); |
| 1834 | _out: |
| 1835 | return _ret != NULL; |
| 1836 | } |
| 1837 | |
| 1838 | /** |
| 1839 | * sensor_integer_call_set_config_data_sync: |
| 1840 | * @proxy: A #SensorIntegerProxy. |
| 1841 | * @arg_config: Argument to pass with the method invocation. |
| 1842 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1843 | * @error: Return location for error or %NULL. |
| 1844 | * |
| 1845 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 1846 | * |
| 1847 | * See sensor_integer_call_set_config_data() for the asynchronous version of this method. |
| 1848 | * |
| 1849 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1850 | */ |
| 1851 | gboolean |
| 1852 | sensor_integer_call_set_config_data_sync ( |
| 1853 | SensorInteger *proxy, |
| 1854 | const gchar *const *arg_config, |
| 1855 | GCancellable *cancellable, |
| 1856 | GError **error) |
| 1857 | { |
| 1858 | GVariant *_ret; |
| 1859 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1860 | "setConfigData", |
| 1861 | g_variant_new ("(^as)", |
| 1862 | arg_config), |
| 1863 | G_DBUS_CALL_FLAGS_NONE, |
| 1864 | -1, |
| 1865 | cancellable, |
| 1866 | error); |
| 1867 | if (_ret == NULL) |
| 1868 | goto _out; |
| 1869 | g_variant_get (_ret, |
| 1870 | "()"); |
| 1871 | g_variant_unref (_ret); |
| 1872 | _out: |
| 1873 | return _ret != NULL; |
| 1874 | } |
| 1875 | |
| 1876 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1877 | * sensor_integer_call_get_threshold_state: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1878 | * @proxy: A #SensorIntegerProxy. |
| 1879 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1880 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1881 | * @user_data: User data to pass to @callback. |
| 1882 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1883 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method on @proxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1884 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1885 | * You can then call sensor_integer_call_get_threshold_state_finish() to get the result of the operation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1886 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1887 | * See sensor_integer_call_get_threshold_state_sync() for the synchronous, blocking version of this method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1888 | */ |
| 1889 | void |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1890 | sensor_integer_call_get_threshold_state ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1891 | SensorInteger *proxy, |
| 1892 | GCancellable *cancellable, |
| 1893 | GAsyncReadyCallback callback, |
| 1894 | gpointer user_data) |
| 1895 | { |
| 1896 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1897 | "getThresholdState", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1898 | g_variant_new ("()"), |
| 1899 | G_DBUS_CALL_FLAGS_NONE, |
| 1900 | -1, |
| 1901 | cancellable, |
| 1902 | callback, |
| 1903 | user_data); |
| 1904 | } |
| 1905 | |
| 1906 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1907 | * sensor_integer_call_get_threshold_state_finish: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1908 | * @proxy: A #SensorIntegerProxy. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1909 | * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore. |
| 1910 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_threshold_state(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1911 | * @error: Return location for error or %NULL. |
| 1912 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1913 | * Finishes an operation started with sensor_integer_call_get_threshold_state(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1914 | * |
| 1915 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1916 | */ |
| 1917 | gboolean |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1918 | sensor_integer_call_get_threshold_state_finish ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1919 | SensorInteger *proxy, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1920 | gint *out_threshold_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1921 | GAsyncResult *res, |
| 1922 | GError **error) |
| 1923 | { |
| 1924 | GVariant *_ret; |
| 1925 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1926 | if (_ret == NULL) |
| 1927 | goto _out; |
| 1928 | g_variant_get (_ret, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1929 | "(i)", |
| 1930 | out_threshold_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1931 | g_variant_unref (_ret); |
| 1932 | _out: |
| 1933 | return _ret != NULL; |
| 1934 | } |
| 1935 | |
| 1936 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1937 | * sensor_integer_call_get_threshold_state_sync: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1938 | * @proxy: A #SensorIntegerProxy. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1939 | * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1940 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1941 | * @error: Return location for error or %NULL. |
| 1942 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1943 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1944 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1945 | * See sensor_integer_call_get_threshold_state() for the asynchronous version of this method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1946 | * |
| 1947 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1948 | */ |
| 1949 | gboolean |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1950 | sensor_integer_call_get_threshold_state_sync ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1951 | SensorInteger *proxy, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1952 | gint *out_threshold_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1953 | GCancellable *cancellable, |
| 1954 | GError **error) |
| 1955 | { |
| 1956 | GVariant *_ret; |
| 1957 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1958 | "getThresholdState", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1959 | g_variant_new ("()"), |
| 1960 | G_DBUS_CALL_FLAGS_NONE, |
| 1961 | -1, |
| 1962 | cancellable, |
| 1963 | error); |
| 1964 | if (_ret == NULL) |
| 1965 | goto _out; |
| 1966 | g_variant_get (_ret, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 1967 | "(i)", |
| 1968 | out_threshold_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1969 | g_variant_unref (_ret); |
| 1970 | _out: |
| 1971 | return _ret != NULL; |
| 1972 | } |
| 1973 | |
| 1974 | /** |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1975 | * sensor_integer_complete_get_value: |
| 1976 | * @object: A #SensorInteger. |
| 1977 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1978 | * @value: Parameter to return. |
| 1979 | * |
| 1980 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 1981 | * |
| 1982 | * This method will free @invocation, you cannot use it afterwards. |
| 1983 | */ |
| 1984 | void |
| 1985 | sensor_integer_complete_get_value ( |
| 1986 | SensorInteger *object, |
| 1987 | GDBusMethodInvocation *invocation, |
| 1988 | gint value) |
| 1989 | { |
| 1990 | g_dbus_method_invocation_return_value (invocation, |
| 1991 | g_variant_new ("(i)", |
| 1992 | value)); |
| 1993 | } |
| 1994 | |
| 1995 | /** |
| 1996 | * sensor_integer_complete_get_units: |
| 1997 | * @object: A #SensorInteger. |
| 1998 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1999 | * @units: Parameter to return. |
| 2000 | * |
| 2001 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</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. |
| 2002 | * |
| 2003 | * This method will free @invocation, you cannot use it afterwards. |
| 2004 | */ |
| 2005 | void |
| 2006 | sensor_integer_complete_get_units ( |
| 2007 | SensorInteger *object, |
| 2008 | GDBusMethodInvocation *invocation, |
| 2009 | const gchar *units) |
| 2010 | { |
| 2011 | g_dbus_method_invocation_return_value (invocation, |
| 2012 | g_variant_new ("(s)", |
| 2013 | units)); |
| 2014 | } |
| 2015 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2016 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2017 | * sensor_integer_complete_set_thresholds: |
| 2018 | * @object: A #SensorInteger. |
| 2019 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2020 | * |
| 2021 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.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. |
| 2022 | * |
| 2023 | * This method will free @invocation, you cannot use it afterwards. |
| 2024 | */ |
| 2025 | void |
| 2026 | sensor_integer_complete_set_thresholds ( |
| 2027 | SensorInteger *object, |
| 2028 | GDBusMethodInvocation *invocation) |
| 2029 | { |
| 2030 | g_dbus_method_invocation_return_value (invocation, |
| 2031 | g_variant_new ("()")); |
| 2032 | } |
| 2033 | |
| 2034 | /** |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2035 | * sensor_integer_complete_set_poll_interval: |
| 2036 | * @object: A #SensorInteger. |
| 2037 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2038 | * |
| 2039 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</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. |
| 2040 | * |
| 2041 | * This method will free @invocation, you cannot use it afterwards. |
| 2042 | */ |
| 2043 | void |
| 2044 | sensor_integer_complete_set_poll_interval ( |
| 2045 | SensorInteger *object, |
| 2046 | GDBusMethodInvocation *invocation) |
| 2047 | { |
| 2048 | g_dbus_method_invocation_return_value (invocation, |
| 2049 | g_variant_new ("()")); |
| 2050 | } |
| 2051 | |
| 2052 | /** |
| 2053 | * sensor_integer_complete_set_config_data: |
| 2054 | * @object: A #SensorInteger. |
| 2055 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 2056 | * |
| 2057 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</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. |
| 2058 | * |
| 2059 | * This method will free @invocation, you cannot use it afterwards. |
| 2060 | */ |
| 2061 | void |
| 2062 | sensor_integer_complete_set_config_data ( |
| 2063 | SensorInteger *object, |
| 2064 | GDBusMethodInvocation *invocation) |
| 2065 | { |
| 2066 | g_dbus_method_invocation_return_value (invocation, |
| 2067 | g_variant_new ("()")); |
| 2068 | } |
| 2069 | |
| 2070 | /** |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2071 | * sensor_integer_complete_get_threshold_state: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2072 | * @object: A #SensorInteger. |
| 2073 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2074 | * @threshold_state: Parameter to return. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2075 | * |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2076 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.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. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2077 | * |
| 2078 | * This method will free @invocation, you cannot use it afterwards. |
| 2079 | */ |
| 2080 | void |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2081 | sensor_integer_complete_get_threshold_state ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2082 | SensorInteger *object, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2083 | GDBusMethodInvocation *invocation, |
| 2084 | gint threshold_state) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2085 | { |
| 2086 | g_dbus_method_invocation_return_value (invocation, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2087 | g_variant_new ("(i)", |
| 2088 | threshold_state)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2089 | } |
| 2090 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2091 | /* ------------------------------------------------------------------------ */ |
| 2092 | |
| 2093 | /** |
| 2094 | * SensorIntegerProxy: |
| 2095 | * |
| 2096 | * The #SensorIntegerProxy structure contains only private data and should only be accessed using the provided API. |
| 2097 | */ |
| 2098 | |
| 2099 | /** |
| 2100 | * SensorIntegerProxyClass: |
| 2101 | * @parent_class: The parent class. |
| 2102 | * |
| 2103 | * Class structure for #SensorIntegerProxy. |
| 2104 | */ |
| 2105 | |
| 2106 | struct _SensorIntegerProxyPrivate |
| 2107 | { |
| 2108 | GData *qdata; |
| 2109 | }; |
| 2110 | |
| 2111 | static void sensor_integer_proxy_iface_init (SensorIntegerIface *iface); |
| 2112 | |
| 2113 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2114 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY, |
| 2115 | G_ADD_PRIVATE (SensorIntegerProxy) |
| 2116 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init)); |
| 2117 | |
| 2118 | #else |
| 2119 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY, |
| 2120 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init)); |
| 2121 | |
| 2122 | #endif |
| 2123 | static void |
| 2124 | sensor_integer_proxy_finalize (GObject *object) |
| 2125 | { |
| 2126 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2127 | g_datalist_clear (&proxy->priv->qdata); |
| 2128 | G_OBJECT_CLASS (sensor_integer_proxy_parent_class)->finalize (object); |
| 2129 | } |
| 2130 | |
| 2131 | static void |
| 2132 | sensor_integer_proxy_get_property (GObject *object, |
| 2133 | guint prop_id, |
| 2134 | GValue *value, |
| 2135 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2136 | { |
| 2137 | const _ExtendedGDBusPropertyInfo *info; |
| 2138 | GVariant *variant; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2139 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2140 | info = _sensor_integer_property_info_pointers[prop_id - 1]; |
| 2141 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 2142 | if (info->use_gvariant) |
| 2143 | { |
| 2144 | g_value_set_variant (value, variant); |
| 2145 | } |
| 2146 | else |
| 2147 | { |
| 2148 | if (variant != NULL) |
| 2149 | g_dbus_gvariant_to_gvalue (variant, value); |
| 2150 | } |
| 2151 | if (variant != NULL) |
| 2152 | g_variant_unref (variant); |
| 2153 | } |
| 2154 | |
| 2155 | static void |
| 2156 | sensor_integer_proxy_set_property_cb (GDBusProxy *proxy, |
| 2157 | GAsyncResult *res, |
| 2158 | gpointer user_data) |
| 2159 | { |
| 2160 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 2161 | GError *error; |
| 2162 | GVariant *_ret; |
| 2163 | error = NULL; |
| 2164 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 2165 | if (!_ret) |
| 2166 | { |
| 2167 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorInteger: %s (%s, %d)", |
| 2168 | info->parent_struct.name, |
| 2169 | error->message, g_quark_to_string (error->domain), error->code); |
| 2170 | g_error_free (error); |
| 2171 | } |
| 2172 | else |
| 2173 | { |
| 2174 | g_variant_unref (_ret); |
| 2175 | } |
| 2176 | } |
| 2177 | |
| 2178 | static void |
| 2179 | sensor_integer_proxy_set_property (GObject *object, |
| 2180 | guint prop_id, |
| 2181 | const GValue *value, |
| 2182 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2183 | { |
| 2184 | const _ExtendedGDBusPropertyInfo *info; |
| 2185 | GVariant *variant; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2186 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2187 | info = _sensor_integer_property_info_pointers[prop_id - 1]; |
| 2188 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 2189 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 2190 | "org.freedesktop.DBus.Properties.Set", |
| 2191 | g_variant_new ("(ssv)", "org.openbmc.SensorInteger", info->parent_struct.name, variant), |
| 2192 | G_DBUS_CALL_FLAGS_NONE, |
| 2193 | -1, |
| 2194 | NULL, (GAsyncReadyCallback) sensor_integer_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 2195 | g_variant_unref (variant); |
| 2196 | } |
| 2197 | |
| 2198 | static void |
| 2199 | sensor_integer_proxy_g_signal (GDBusProxy *proxy, |
| 2200 | const gchar *sender_name G_GNUC_UNUSED, |
| 2201 | const gchar *signal_name, |
| 2202 | GVariant *parameters) |
| 2203 | { |
| 2204 | _ExtendedGDBusSignalInfo *info; |
| 2205 | GVariantIter iter; |
| 2206 | GVariant *child; |
| 2207 | GValue *paramv; |
| 2208 | guint num_params; |
| 2209 | guint n; |
| 2210 | guint signal_id; |
| 2211 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, signal_name); |
| 2212 | if (info == NULL) |
| 2213 | return; |
| 2214 | num_params = g_variant_n_children (parameters); |
| 2215 | paramv = g_new0 (GValue, num_params + 1); |
| 2216 | g_value_init (¶mv[0], TYPE_SENSOR_INTEGER); |
| 2217 | g_value_set_object (¶mv[0], proxy); |
| 2218 | g_variant_iter_init (&iter, parameters); |
| 2219 | n = 1; |
| 2220 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 2221 | { |
| 2222 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 2223 | if (arg_info->use_gvariant) |
| 2224 | { |
| 2225 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 2226 | g_value_set_variant (¶mv[n], child); |
| 2227 | n++; |
| 2228 | } |
| 2229 | else |
| 2230 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2231 | g_variant_unref (child); |
| 2232 | } |
| 2233 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER); |
| 2234 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 2235 | for (n = 0; n < num_params + 1; n++) |
| 2236 | g_value_unset (¶mv[n]); |
| 2237 | g_free (paramv); |
| 2238 | } |
| 2239 | |
| 2240 | static void |
| 2241 | sensor_integer_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 2242 | GVariant *changed_properties, |
| 2243 | const gchar *const *invalidated_properties) |
| 2244 | { |
| 2245 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (_proxy); |
| 2246 | guint n; |
| 2247 | const gchar *key; |
| 2248 | GVariantIter *iter; |
| 2249 | _ExtendedGDBusPropertyInfo *info; |
| 2250 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 2251 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 2252 | { |
| 2253 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, key); |
| 2254 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 2255 | if (info != NULL) |
| 2256 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2257 | } |
| 2258 | g_variant_iter_free (iter); |
| 2259 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 2260 | { |
| 2261 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, invalidated_properties[n]); |
| 2262 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 2263 | if (info != NULL) |
| 2264 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 2265 | } |
| 2266 | } |
| 2267 | |
| 2268 | static gint |
| 2269 | sensor_integer_proxy_get_value (SensorInteger *object) |
| 2270 | { |
| 2271 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2272 | GVariant *variant; |
| 2273 | gint value = 0; |
| 2274 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 2275 | if (variant != NULL) |
| 2276 | { |
| 2277 | value = g_variant_get_int32 (variant); |
| 2278 | g_variant_unref (variant); |
| 2279 | } |
| 2280 | return value; |
| 2281 | } |
| 2282 | |
| 2283 | static const gchar * |
| 2284 | sensor_integer_proxy_get_units (SensorInteger *object) |
| 2285 | { |
| 2286 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2287 | GVariant *variant; |
| 2288 | const gchar *value = NULL; |
| 2289 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 2290 | if (variant != NULL) |
| 2291 | { |
| 2292 | value = g_variant_get_string (variant, NULL); |
| 2293 | g_variant_unref (variant); |
| 2294 | } |
| 2295 | return value; |
| 2296 | } |
| 2297 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2298 | static gint |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2299 | sensor_integer_proxy_get_threshold_lower_critical (SensorInteger *object) |
| 2300 | { |
| 2301 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2302 | GVariant *variant; |
| 2303 | gint value = 0; |
| 2304 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_lower_critical"); |
| 2305 | if (variant != NULL) |
| 2306 | { |
| 2307 | value = g_variant_get_int32 (variant); |
| 2308 | g_variant_unref (variant); |
| 2309 | } |
| 2310 | return value; |
| 2311 | } |
| 2312 | |
| 2313 | static gint |
| 2314 | sensor_integer_proxy_get_threshold_lower_warning (SensorInteger *object) |
| 2315 | { |
| 2316 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2317 | GVariant *variant; |
| 2318 | gint value = 0; |
| 2319 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_lower_warning"); |
| 2320 | if (variant != NULL) |
| 2321 | { |
| 2322 | value = g_variant_get_int32 (variant); |
| 2323 | g_variant_unref (variant); |
| 2324 | } |
| 2325 | return value; |
| 2326 | } |
| 2327 | |
| 2328 | static gint |
| 2329 | sensor_integer_proxy_get_threshold_upper_warning (SensorInteger *object) |
| 2330 | { |
| 2331 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2332 | GVariant *variant; |
| 2333 | gint value = 0; |
| 2334 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_warning"); |
| 2335 | if (variant != NULL) |
| 2336 | { |
| 2337 | value = g_variant_get_int32 (variant); |
| 2338 | g_variant_unref (variant); |
| 2339 | } |
| 2340 | return value; |
| 2341 | } |
| 2342 | |
| 2343 | static gint |
| 2344 | sensor_integer_proxy_get_threshold_upper_critical (SensorInteger *object) |
| 2345 | { |
| 2346 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2347 | GVariant *variant; |
| 2348 | gint value = 0; |
| 2349 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_critical"); |
| 2350 | if (variant != NULL) |
| 2351 | { |
| 2352 | value = g_variant_get_int32 (variant); |
| 2353 | g_variant_unref (variant); |
| 2354 | } |
| 2355 | return value; |
| 2356 | } |
| 2357 | |
| 2358 | static gint |
| 2359 | sensor_integer_proxy_get_threshold_state (SensorInteger *object) |
| 2360 | { |
| 2361 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2362 | GVariant *variant; |
| 2363 | gint value = 0; |
| 2364 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_state"); |
| 2365 | if (variant != NULL) |
| 2366 | { |
| 2367 | value = g_variant_get_int32 (variant); |
| 2368 | g_variant_unref (variant); |
| 2369 | } |
| 2370 | return value; |
| 2371 | } |
| 2372 | |
| 2373 | static gint |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2374 | sensor_integer_proxy_get_poll_interval (SensorInteger *object) |
| 2375 | { |
| 2376 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2377 | GVariant *variant; |
| 2378 | gint value = 0; |
| 2379 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 2380 | if (variant != NULL) |
| 2381 | { |
| 2382 | value = g_variant_get_int32 (variant); |
| 2383 | g_variant_unref (variant); |
| 2384 | } |
| 2385 | return value; |
| 2386 | } |
| 2387 | |
| 2388 | static const gchar *const * |
| 2389 | sensor_integer_proxy_get_config_data (SensorInteger *object) |
| 2390 | { |
| 2391 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2392 | GVariant *variant; |
| 2393 | const gchar *const *value = NULL; |
| 2394 | value = g_datalist_get_data (&proxy->priv->qdata, "config_data"); |
| 2395 | if (value != NULL) |
| 2396 | return value; |
| 2397 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "config_data"); |
| 2398 | if (variant != NULL) |
| 2399 | { |
| 2400 | value = g_variant_get_strv (variant, NULL); |
| 2401 | g_datalist_set_data_full (&proxy->priv->qdata, "config_data", (gpointer) value, g_free); |
| 2402 | g_variant_unref (variant); |
| 2403 | } |
| 2404 | return value; |
| 2405 | } |
| 2406 | |
| 2407 | static gint |
| 2408 | sensor_integer_proxy_get_changed_tolerance (SensorInteger *object) |
| 2409 | { |
| 2410 | SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object); |
| 2411 | GVariant *variant; |
| 2412 | gint value = 0; |
| 2413 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "changed_tolerance"); |
| 2414 | if (variant != NULL) |
| 2415 | { |
| 2416 | value = g_variant_get_int32 (variant); |
| 2417 | g_variant_unref (variant); |
| 2418 | } |
| 2419 | return value; |
| 2420 | } |
| 2421 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2422 | static void |
| 2423 | sensor_integer_proxy_init (SensorIntegerProxy *proxy) |
| 2424 | { |
| 2425 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2426 | proxy->priv = sensor_integer_proxy_get_instance_private (proxy); |
| 2427 | #else |
| 2428 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_PROXY, SensorIntegerProxyPrivate); |
| 2429 | #endif |
| 2430 | |
| 2431 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_interface_info ()); |
| 2432 | } |
| 2433 | |
| 2434 | static void |
| 2435 | sensor_integer_proxy_class_init (SensorIntegerProxyClass *klass) |
| 2436 | { |
| 2437 | GObjectClass *gobject_class; |
| 2438 | GDBusProxyClass *proxy_class; |
| 2439 | |
| 2440 | gobject_class = G_OBJECT_CLASS (klass); |
| 2441 | gobject_class->finalize = sensor_integer_proxy_finalize; |
| 2442 | gobject_class->get_property = sensor_integer_proxy_get_property; |
| 2443 | gobject_class->set_property = sensor_integer_proxy_set_property; |
| 2444 | |
| 2445 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 2446 | proxy_class->g_signal = sensor_integer_proxy_g_signal; |
| 2447 | proxy_class->g_properties_changed = sensor_integer_proxy_g_properties_changed; |
| 2448 | |
| 2449 | sensor_integer_override_properties (gobject_class, 1); |
| 2450 | |
| 2451 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 2452 | g_type_class_add_private (klass, sizeof (SensorIntegerProxyPrivate)); |
| 2453 | #endif |
| 2454 | } |
| 2455 | |
| 2456 | static void |
| 2457 | sensor_integer_proxy_iface_init (SensorIntegerIface *iface) |
| 2458 | { |
| 2459 | iface->get_value = sensor_integer_proxy_get_value; |
| 2460 | iface->get_units = sensor_integer_proxy_get_units; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2461 | iface->get_threshold_lower_critical = sensor_integer_proxy_get_threshold_lower_critical; |
| 2462 | iface->get_threshold_lower_warning = sensor_integer_proxy_get_threshold_lower_warning; |
| 2463 | iface->get_threshold_upper_warning = sensor_integer_proxy_get_threshold_upper_warning; |
| 2464 | iface->get_threshold_upper_critical = sensor_integer_proxy_get_threshold_upper_critical; |
| 2465 | iface->get_threshold_state = sensor_integer_proxy_get_threshold_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2466 | iface->get_poll_interval = sensor_integer_proxy_get_poll_interval; |
| 2467 | iface->get_config_data = sensor_integer_proxy_get_config_data; |
| 2468 | iface->get_changed_tolerance = sensor_integer_proxy_get_changed_tolerance; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2469 | } |
| 2470 | |
| 2471 | /** |
| 2472 | * sensor_integer_proxy_new: |
| 2473 | * @connection: A #GDBusConnection. |
| 2474 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2475 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2476 | * @object_path: An object path. |
| 2477 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2478 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2479 | * @user_data: User data to pass to @callback. |
| 2480 | * |
| 2481 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. See g_dbus_proxy_new() for more details. |
| 2482 | * |
| 2483 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2484 | * You can then call sensor_integer_proxy_new_finish() to get the result of the operation. |
| 2485 | * |
| 2486 | * See sensor_integer_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 2487 | */ |
| 2488 | void |
| 2489 | sensor_integer_proxy_new ( |
| 2490 | GDBusConnection *connection, |
| 2491 | GDBusProxyFlags flags, |
| 2492 | const gchar *name, |
| 2493 | const gchar *object_path, |
| 2494 | GCancellable *cancellable, |
| 2495 | GAsyncReadyCallback callback, |
| 2496 | gpointer user_data) |
| 2497 | { |
| 2498 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_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.SensorInteger", NULL); |
| 2499 | } |
| 2500 | |
| 2501 | /** |
| 2502 | * sensor_integer_proxy_new_finish: |
| 2503 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new(). |
| 2504 | * @error: Return location for error or %NULL |
| 2505 | * |
| 2506 | * Finishes an operation started with sensor_integer_proxy_new(). |
| 2507 | * |
| 2508 | * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set. |
| 2509 | */ |
| 2510 | SensorInteger * |
| 2511 | sensor_integer_proxy_new_finish ( |
| 2512 | GAsyncResult *res, |
| 2513 | GError **error) |
| 2514 | { |
| 2515 | GObject *ret; |
| 2516 | GObject *source_object; |
| 2517 | source_object = g_async_result_get_source_object (res); |
| 2518 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2519 | g_object_unref (source_object); |
| 2520 | if (ret != NULL) |
| 2521 | return SENSOR_INTEGER (ret); |
| 2522 | else |
| 2523 | return NULL; |
| 2524 | } |
| 2525 | |
| 2526 | /** |
| 2527 | * sensor_integer_proxy_new_sync: |
| 2528 | * @connection: A #GDBusConnection. |
| 2529 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2530 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 2531 | * @object_path: An object path. |
| 2532 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2533 | * @error: Return location for error or %NULL |
| 2534 | * |
| 2535 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. See g_dbus_proxy_new_sync() for more details. |
| 2536 | * |
| 2537 | * The calling thread is blocked until a reply is received. |
| 2538 | * |
| 2539 | * See sensor_integer_proxy_new() for the asynchronous version of this constructor. |
| 2540 | * |
| 2541 | * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set. |
| 2542 | */ |
| 2543 | SensorInteger * |
| 2544 | sensor_integer_proxy_new_sync ( |
| 2545 | GDBusConnection *connection, |
| 2546 | GDBusProxyFlags flags, |
| 2547 | const gchar *name, |
| 2548 | const gchar *object_path, |
| 2549 | GCancellable *cancellable, |
| 2550 | GError **error) |
| 2551 | { |
| 2552 | GInitable *ret; |
| 2553 | ret = g_initable_new (TYPE_SENSOR_INTEGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL); |
| 2554 | if (ret != NULL) |
| 2555 | return SENSOR_INTEGER (ret); |
| 2556 | else |
| 2557 | return NULL; |
| 2558 | } |
| 2559 | |
| 2560 | |
| 2561 | /** |
| 2562 | * sensor_integer_proxy_new_for_bus: |
| 2563 | * @bus_type: A #GBusType. |
| 2564 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2565 | * @name: A bus name (well-known or unique). |
| 2566 | * @object_path: An object path. |
| 2567 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2568 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 2569 | * @user_data: User data to pass to @callback. |
| 2570 | * |
| 2571 | * Like sensor_integer_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 2572 | * |
| 2573 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 2574 | * You can then call sensor_integer_proxy_new_for_bus_finish() to get the result of the operation. |
| 2575 | * |
| 2576 | * See sensor_integer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 2577 | */ |
| 2578 | void |
| 2579 | sensor_integer_proxy_new_for_bus ( |
| 2580 | GBusType bus_type, |
| 2581 | GDBusProxyFlags flags, |
| 2582 | const gchar *name, |
| 2583 | const gchar *object_path, |
| 2584 | GCancellable *cancellable, |
| 2585 | GAsyncReadyCallback callback, |
| 2586 | gpointer user_data) |
| 2587 | { |
| 2588 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_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.SensorInteger", NULL); |
| 2589 | } |
| 2590 | |
| 2591 | /** |
| 2592 | * sensor_integer_proxy_new_for_bus_finish: |
| 2593 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new_for_bus(). |
| 2594 | * @error: Return location for error or %NULL |
| 2595 | * |
| 2596 | * Finishes an operation started with sensor_integer_proxy_new_for_bus(). |
| 2597 | * |
| 2598 | * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set. |
| 2599 | */ |
| 2600 | SensorInteger * |
| 2601 | sensor_integer_proxy_new_for_bus_finish ( |
| 2602 | GAsyncResult *res, |
| 2603 | GError **error) |
| 2604 | { |
| 2605 | GObject *ret; |
| 2606 | GObject *source_object; |
| 2607 | source_object = g_async_result_get_source_object (res); |
| 2608 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 2609 | g_object_unref (source_object); |
| 2610 | if (ret != NULL) |
| 2611 | return SENSOR_INTEGER (ret); |
| 2612 | else |
| 2613 | return NULL; |
| 2614 | } |
| 2615 | |
| 2616 | /** |
| 2617 | * sensor_integer_proxy_new_for_bus_sync: |
| 2618 | * @bus_type: A #GBusType. |
| 2619 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 2620 | * @name: A bus name (well-known or unique). |
| 2621 | * @object_path: An object path. |
| 2622 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2623 | * @error: Return location for error or %NULL |
| 2624 | * |
| 2625 | * Like sensor_integer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 2626 | * |
| 2627 | * The calling thread is blocked until a reply is received. |
| 2628 | * |
| 2629 | * See sensor_integer_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 2630 | * |
| 2631 | * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set. |
| 2632 | */ |
| 2633 | SensorInteger * |
| 2634 | sensor_integer_proxy_new_for_bus_sync ( |
| 2635 | GBusType bus_type, |
| 2636 | GDBusProxyFlags flags, |
| 2637 | const gchar *name, |
| 2638 | const gchar *object_path, |
| 2639 | GCancellable *cancellable, |
| 2640 | GError **error) |
| 2641 | { |
| 2642 | GInitable *ret; |
| 2643 | ret = g_initable_new (TYPE_SENSOR_INTEGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL); |
| 2644 | if (ret != NULL) |
| 2645 | return SENSOR_INTEGER (ret); |
| 2646 | else |
| 2647 | return NULL; |
| 2648 | } |
| 2649 | |
| 2650 | |
| 2651 | /* ------------------------------------------------------------------------ */ |
| 2652 | |
| 2653 | /** |
| 2654 | * SensorIntegerSkeleton: |
| 2655 | * |
| 2656 | * The #SensorIntegerSkeleton structure contains only private data and should only be accessed using the provided API. |
| 2657 | */ |
| 2658 | |
| 2659 | /** |
| 2660 | * SensorIntegerSkeletonClass: |
| 2661 | * @parent_class: The parent class. |
| 2662 | * |
| 2663 | * Class structure for #SensorIntegerSkeleton. |
| 2664 | */ |
| 2665 | |
| 2666 | struct _SensorIntegerSkeletonPrivate |
| 2667 | { |
| 2668 | GValue *properties; |
| 2669 | GList *changed_properties; |
| 2670 | GSource *changed_properties_idle_source; |
| 2671 | GMainContext *context; |
| 2672 | GMutex lock; |
| 2673 | }; |
| 2674 | |
| 2675 | static void |
| 2676 | _sensor_integer_skeleton_handle_method_call ( |
| 2677 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2678 | const gchar *sender G_GNUC_UNUSED, |
| 2679 | const gchar *object_path G_GNUC_UNUSED, |
| 2680 | const gchar *interface_name, |
| 2681 | const gchar *method_name, |
| 2682 | GVariant *parameters, |
| 2683 | GDBusMethodInvocation *invocation, |
| 2684 | gpointer user_data) |
| 2685 | { |
| 2686 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data); |
| 2687 | _ExtendedGDBusMethodInfo *info; |
| 2688 | GVariantIter iter; |
| 2689 | GVariant *child; |
| 2690 | GValue *paramv; |
| 2691 | guint num_params; |
| 2692 | guint num_extra; |
| 2693 | guint n; |
| 2694 | guint signal_id; |
| 2695 | GValue return_value = G_VALUE_INIT; |
| 2696 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 2697 | g_assert (info != NULL); |
| 2698 | num_params = g_variant_n_children (parameters); |
| 2699 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 2700 | n = 0; |
| 2701 | g_value_init (¶mv[n], TYPE_SENSOR_INTEGER); |
| 2702 | g_value_set_object (¶mv[n++], skeleton); |
| 2703 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 2704 | g_value_set_object (¶mv[n++], invocation); |
| 2705 | if (info->pass_fdlist) |
| 2706 | { |
| 2707 | #ifdef G_OS_UNIX |
| 2708 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 2709 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 2710 | #else |
| 2711 | g_assert_not_reached (); |
| 2712 | #endif |
| 2713 | } |
| 2714 | g_variant_iter_init (&iter, parameters); |
| 2715 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 2716 | { |
| 2717 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 2718 | if (arg_info->use_gvariant) |
| 2719 | { |
| 2720 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 2721 | g_value_set_variant (¶mv[n], child); |
| 2722 | n++; |
| 2723 | } |
| 2724 | else |
| 2725 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 2726 | g_variant_unref (child); |
| 2727 | } |
| 2728 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER); |
| 2729 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 2730 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 2731 | if (!g_value_get_boolean (&return_value)) |
| 2732 | 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); |
| 2733 | g_value_unset (&return_value); |
| 2734 | for (n = 0; n < num_params + num_extra; n++) |
| 2735 | g_value_unset (¶mv[n]); |
| 2736 | g_free (paramv); |
| 2737 | } |
| 2738 | |
| 2739 | static GVariant * |
| 2740 | _sensor_integer_skeleton_handle_get_property ( |
| 2741 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2742 | const gchar *sender G_GNUC_UNUSED, |
| 2743 | const gchar *object_path G_GNUC_UNUSED, |
| 2744 | const gchar *interface_name G_GNUC_UNUSED, |
| 2745 | const gchar *property_name, |
| 2746 | GError **error, |
| 2747 | gpointer user_data) |
| 2748 | { |
| 2749 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data); |
| 2750 | GValue value = G_VALUE_INIT; |
| 2751 | GParamSpec *pspec; |
| 2752 | _ExtendedGDBusPropertyInfo *info; |
| 2753 | GVariant *ret; |
| 2754 | ret = NULL; |
| 2755 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name); |
| 2756 | g_assert (info != NULL); |
| 2757 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 2758 | if (pspec == NULL) |
| 2759 | { |
| 2760 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 2761 | } |
| 2762 | else |
| 2763 | { |
| 2764 | g_value_init (&value, pspec->value_type); |
| 2765 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 2766 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 2767 | g_value_unset (&value); |
| 2768 | } |
| 2769 | return ret; |
| 2770 | } |
| 2771 | |
| 2772 | static gboolean |
| 2773 | _sensor_integer_skeleton_handle_set_property ( |
| 2774 | GDBusConnection *connection G_GNUC_UNUSED, |
| 2775 | const gchar *sender G_GNUC_UNUSED, |
| 2776 | const gchar *object_path G_GNUC_UNUSED, |
| 2777 | const gchar *interface_name G_GNUC_UNUSED, |
| 2778 | const gchar *property_name, |
| 2779 | GVariant *variant, |
| 2780 | GError **error, |
| 2781 | gpointer user_data) |
| 2782 | { |
| 2783 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data); |
| 2784 | GValue value = G_VALUE_INIT; |
| 2785 | GParamSpec *pspec; |
| 2786 | _ExtendedGDBusPropertyInfo *info; |
| 2787 | gboolean ret; |
| 2788 | ret = FALSE; |
| 2789 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name); |
| 2790 | g_assert (info != NULL); |
| 2791 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 2792 | if (pspec == NULL) |
| 2793 | { |
| 2794 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 2795 | } |
| 2796 | else |
| 2797 | { |
| 2798 | if (info->use_gvariant) |
| 2799 | g_value_set_variant (&value, variant); |
| 2800 | else |
| 2801 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 2802 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 2803 | g_value_unset (&value); |
| 2804 | ret = TRUE; |
| 2805 | } |
| 2806 | return ret; |
| 2807 | } |
| 2808 | |
| 2809 | static const GDBusInterfaceVTable _sensor_integer_skeleton_vtable = |
| 2810 | { |
| 2811 | _sensor_integer_skeleton_handle_method_call, |
| 2812 | _sensor_integer_skeleton_handle_get_property, |
| 2813 | _sensor_integer_skeleton_handle_set_property, |
| 2814 | {NULL} |
| 2815 | }; |
| 2816 | |
| 2817 | static GDBusInterfaceInfo * |
| 2818 | sensor_integer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 2819 | { |
| 2820 | return sensor_integer_interface_info (); |
| 2821 | } |
| 2822 | |
| 2823 | static GDBusInterfaceVTable * |
| 2824 | sensor_integer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 2825 | { |
| 2826 | return (GDBusInterfaceVTable *) &_sensor_integer_skeleton_vtable; |
| 2827 | } |
| 2828 | |
| 2829 | static GVariant * |
| 2830 | sensor_integer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 2831 | { |
| 2832 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton); |
| 2833 | |
| 2834 | GVariantBuilder builder; |
| 2835 | guint n; |
| 2836 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 2837 | if (_sensor_integer_interface_info.parent_struct.properties == NULL) |
| 2838 | goto out; |
| 2839 | for (n = 0; _sensor_integer_interface_info.parent_struct.properties[n] != NULL; n++) |
| 2840 | { |
| 2841 | GDBusPropertyInfo *info = _sensor_integer_interface_info.parent_struct.properties[n]; |
| 2842 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 2843 | { |
| 2844 | GVariant *value; |
| 2845 | value = _sensor_integer_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.SensorInteger", info->name, NULL, skeleton); |
| 2846 | if (value != NULL) |
| 2847 | { |
| 2848 | g_variant_take_ref (value); |
| 2849 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 2850 | g_variant_unref (value); |
| 2851 | } |
| 2852 | } |
| 2853 | } |
| 2854 | out: |
| 2855 | return g_variant_builder_end (&builder); |
| 2856 | } |
| 2857 | |
| 2858 | static gboolean _sensor_integer_emit_changed (gpointer user_data); |
| 2859 | |
| 2860 | static void |
| 2861 | sensor_integer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 2862 | { |
| 2863 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton); |
| 2864 | gboolean emit_changed = FALSE; |
| 2865 | |
| 2866 | g_mutex_lock (&skeleton->priv->lock); |
| 2867 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 2868 | { |
| 2869 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 2870 | skeleton->priv->changed_properties_idle_source = NULL; |
| 2871 | emit_changed = TRUE; |
| 2872 | } |
| 2873 | g_mutex_unlock (&skeleton->priv->lock); |
| 2874 | |
| 2875 | if (emit_changed) |
| 2876 | _sensor_integer_emit_changed (skeleton); |
| 2877 | } |
| 2878 | |
| 2879 | static void |
| 2880 | _sensor_integer_on_signal_changed ( |
| 2881 | SensorInteger *object, |
| 2882 | gint arg_value) |
| 2883 | { |
| 2884 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 2885 | |
| 2886 | GList *connections, *l; |
| 2887 | GVariant *signal_variant; |
| 2888 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2889 | |
| 2890 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 2891 | arg_value)); |
| 2892 | for (l = connections; l != NULL; l = l->next) |
| 2893 | { |
| 2894 | GDBusConnection *connection = l->data; |
| 2895 | g_dbus_connection_emit_signal (connection, |
| 2896 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Changed", |
| 2897 | signal_variant, NULL); |
| 2898 | } |
| 2899 | g_variant_unref (signal_variant); |
| 2900 | g_list_free_full (connections, g_object_unref); |
| 2901 | } |
| 2902 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2903 | static void |
| 2904 | _sensor_integer_on_signal_warning ( |
| 2905 | SensorInteger *object) |
| 2906 | { |
| 2907 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 2908 | |
| 2909 | GList *connections, *l; |
| 2910 | GVariant *signal_variant; |
| 2911 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2912 | |
| 2913 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 2914 | for (l = connections; l != NULL; l = l->next) |
| 2915 | { |
| 2916 | GDBusConnection *connection = l->data; |
| 2917 | g_dbus_connection_emit_signal (connection, |
| 2918 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Warning", |
| 2919 | signal_variant, NULL); |
| 2920 | } |
| 2921 | g_variant_unref (signal_variant); |
| 2922 | g_list_free_full (connections, g_object_unref); |
| 2923 | } |
| 2924 | |
| 2925 | static void |
| 2926 | _sensor_integer_on_signal_critical ( |
| 2927 | SensorInteger *object) |
| 2928 | { |
| 2929 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 2930 | |
| 2931 | GList *connections, *l; |
| 2932 | GVariant *signal_variant; |
| 2933 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2934 | |
| 2935 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 2936 | for (l = connections; l != NULL; l = l->next) |
| 2937 | { |
| 2938 | GDBusConnection *connection = l->data; |
| 2939 | g_dbus_connection_emit_signal (connection, |
| 2940 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Critical", |
| 2941 | signal_variant, NULL); |
| 2942 | } |
| 2943 | g_variant_unref (signal_variant); |
| 2944 | g_list_free_full (connections, g_object_unref); |
| 2945 | } |
| 2946 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2947 | static void sensor_integer_skeleton_iface_init (SensorIntegerIface *iface); |
| 2948 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 2949 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 2950 | G_ADD_PRIVATE (SensorIntegerSkeleton) |
| 2951 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init)); |
| 2952 | |
| 2953 | #else |
| 2954 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 2955 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init)); |
| 2956 | |
| 2957 | #endif |
| 2958 | static void |
| 2959 | sensor_integer_skeleton_finalize (GObject *object) |
| 2960 | { |
| 2961 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 2962 | guint n; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2963 | for (n = 0; n < 10; n++) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2964 | g_value_unset (&skeleton->priv->properties[n]); |
| 2965 | g_free (skeleton->priv->properties); |
| 2966 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 2967 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 2968 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 2969 | g_main_context_unref (skeleton->priv->context); |
| 2970 | g_mutex_clear (&skeleton->priv->lock); |
| 2971 | G_OBJECT_CLASS (sensor_integer_skeleton_parent_class)->finalize (object); |
| 2972 | } |
| 2973 | |
| 2974 | static void |
| 2975 | sensor_integer_skeleton_get_property (GObject *object, |
| 2976 | guint prop_id, |
| 2977 | GValue *value, |
| 2978 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2979 | { |
| 2980 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 2981 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2982 | g_mutex_lock (&skeleton->priv->lock); |
| 2983 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 2984 | g_mutex_unlock (&skeleton->priv->lock); |
| 2985 | } |
| 2986 | |
| 2987 | static gboolean |
| 2988 | _sensor_integer_emit_changed (gpointer user_data) |
| 2989 | { |
| 2990 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data); |
| 2991 | GList *l; |
| 2992 | GVariantBuilder builder; |
| 2993 | GVariantBuilder invalidated_builder; |
| 2994 | guint num_changes; |
| 2995 | |
| 2996 | g_mutex_lock (&skeleton->priv->lock); |
| 2997 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 2998 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 2999 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3000 | { |
| 3001 | ChangedProperty *cp = l->data; |
| 3002 | GVariant *variant; |
| 3003 | const GValue *cur_value; |
| 3004 | |
| 3005 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3006 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3007 | { |
| 3008 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3009 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3010 | g_variant_unref (variant); |
| 3011 | num_changes++; |
| 3012 | } |
| 3013 | } |
| 3014 | if (num_changes > 0) |
| 3015 | { |
| 3016 | GList *connections, *ll; |
| 3017 | GVariant *signal_variant; |
| 3018 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorInteger", |
| 3019 | &builder, &invalidated_builder)); |
| 3020 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3021 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3022 | { |
| 3023 | GDBusConnection *connection = ll->data; |
| 3024 | |
| 3025 | g_dbus_connection_emit_signal (connection, |
| 3026 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3027 | "org.freedesktop.DBus.Properties", |
| 3028 | "PropertiesChanged", |
| 3029 | signal_variant, |
| 3030 | NULL); |
| 3031 | } |
| 3032 | g_variant_unref (signal_variant); |
| 3033 | g_list_free_full (connections, g_object_unref); |
| 3034 | } |
| 3035 | else |
| 3036 | { |
| 3037 | g_variant_builder_clear (&builder); |
| 3038 | g_variant_builder_clear (&invalidated_builder); |
| 3039 | } |
| 3040 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3041 | skeleton->priv->changed_properties = NULL; |
| 3042 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3043 | g_mutex_unlock (&skeleton->priv->lock); |
| 3044 | return FALSE; |
| 3045 | } |
| 3046 | |
| 3047 | static void |
| 3048 | _sensor_integer_schedule_emit_changed (SensorIntegerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 3049 | { |
| 3050 | ChangedProperty *cp; |
| 3051 | GList *l; |
| 3052 | cp = NULL; |
| 3053 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 3054 | { |
| 3055 | ChangedProperty *i_cp = l->data; |
| 3056 | if (i_cp->info == info) |
| 3057 | { |
| 3058 | cp = i_cp; |
| 3059 | break; |
| 3060 | } |
| 3061 | } |
| 3062 | if (cp == NULL) |
| 3063 | { |
| 3064 | cp = g_new0 (ChangedProperty, 1); |
| 3065 | cp->prop_id = prop_id; |
| 3066 | cp->info = info; |
| 3067 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 3068 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 3069 | g_value_copy (orig_value, &cp->orig_value); |
| 3070 | } |
| 3071 | } |
| 3072 | |
| 3073 | static void |
| 3074 | sensor_integer_skeleton_notify (GObject *object, |
| 3075 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3076 | { |
| 3077 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3078 | g_mutex_lock (&skeleton->priv->lock); |
| 3079 | if (skeleton->priv->changed_properties != NULL && |
| 3080 | skeleton->priv->changed_properties_idle_source == NULL) |
| 3081 | { |
| 3082 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 3083 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 3084 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 3085 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 3086 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 3087 | } |
| 3088 | g_mutex_unlock (&skeleton->priv->lock); |
| 3089 | } |
| 3090 | |
| 3091 | static void |
| 3092 | sensor_integer_skeleton_set_property (GObject *object, |
| 3093 | guint prop_id, |
| 3094 | const GValue *value, |
| 3095 | GParamSpec *pspec) |
| 3096 | { |
| 3097 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3098 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3099 | g_mutex_lock (&skeleton->priv->lock); |
| 3100 | g_object_freeze_notify (object); |
| 3101 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 3102 | { |
| 3103 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 3104 | _sensor_integer_schedule_emit_changed (skeleton, _sensor_integer_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 3105 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 3106 | g_object_notify_by_pspec (object, pspec); |
| 3107 | } |
| 3108 | g_mutex_unlock (&skeleton->priv->lock); |
| 3109 | g_object_thaw_notify (object); |
| 3110 | } |
| 3111 | |
| 3112 | static void |
| 3113 | sensor_integer_skeleton_init (SensorIntegerSkeleton *skeleton) |
| 3114 | { |
| 3115 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3116 | skeleton->priv = sensor_integer_skeleton_get_instance_private (skeleton); |
| 3117 | #else |
| 3118 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SKELETON, SensorIntegerSkeletonPrivate); |
| 3119 | #endif |
| 3120 | |
| 3121 | g_mutex_init (&skeleton->priv->lock); |
| 3122 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3123 | skeleton->priv->properties = g_new0 (GValue, 10); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3124 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 3125 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3126 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3127 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3128 | g_value_init (&skeleton->priv->properties[4], G_TYPE_INT); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3129 | g_value_init (&skeleton->priv->properties[5], G_TYPE_INT); |
| 3130 | g_value_init (&skeleton->priv->properties[6], G_TYPE_INT); |
| 3131 | g_value_init (&skeleton->priv->properties[7], G_TYPE_INT); |
| 3132 | g_value_init (&skeleton->priv->properties[8], G_TYPE_STRV); |
| 3133 | g_value_init (&skeleton->priv->properties[9], G_TYPE_INT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3134 | } |
| 3135 | |
| 3136 | static gint |
| 3137 | sensor_integer_skeleton_get_value (SensorInteger *object) |
| 3138 | { |
| 3139 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3140 | gint value; |
| 3141 | g_mutex_lock (&skeleton->priv->lock); |
| 3142 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 3143 | g_mutex_unlock (&skeleton->priv->lock); |
| 3144 | return value; |
| 3145 | } |
| 3146 | |
| 3147 | static const gchar * |
| 3148 | sensor_integer_skeleton_get_units (SensorInteger *object) |
| 3149 | { |
| 3150 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3151 | const gchar *value; |
| 3152 | g_mutex_lock (&skeleton->priv->lock); |
| 3153 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 3154 | g_mutex_unlock (&skeleton->priv->lock); |
| 3155 | return value; |
| 3156 | } |
| 3157 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3158 | static gint |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3159 | sensor_integer_skeleton_get_threshold_lower_critical (SensorInteger *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3160 | { |
| 3161 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3162 | gint value; |
| 3163 | g_mutex_lock (&skeleton->priv->lock); |
| 3164 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 3165 | g_mutex_unlock (&skeleton->priv->lock); |
| 3166 | return value; |
| 3167 | } |
| 3168 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3169 | static gint |
| 3170 | sensor_integer_skeleton_get_threshold_lower_warning (SensorInteger *object) |
| 3171 | { |
| 3172 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3173 | gint value; |
| 3174 | g_mutex_lock (&skeleton->priv->lock); |
| 3175 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 3176 | g_mutex_unlock (&skeleton->priv->lock); |
| 3177 | return value; |
| 3178 | } |
| 3179 | |
| 3180 | static gint |
| 3181 | sensor_integer_skeleton_get_threshold_upper_warning (SensorInteger *object) |
| 3182 | { |
| 3183 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3184 | gint value; |
| 3185 | g_mutex_lock (&skeleton->priv->lock); |
| 3186 | value = g_value_get_int (&(skeleton->priv->properties[4])); |
| 3187 | g_mutex_unlock (&skeleton->priv->lock); |
| 3188 | return value; |
| 3189 | } |
| 3190 | |
| 3191 | static gint |
| 3192 | sensor_integer_skeleton_get_threshold_upper_critical (SensorInteger *object) |
| 3193 | { |
| 3194 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3195 | gint value; |
| 3196 | g_mutex_lock (&skeleton->priv->lock); |
| 3197 | value = g_value_get_int (&(skeleton->priv->properties[5])); |
| 3198 | g_mutex_unlock (&skeleton->priv->lock); |
| 3199 | return value; |
| 3200 | } |
| 3201 | |
| 3202 | static gint |
| 3203 | sensor_integer_skeleton_get_threshold_state (SensorInteger *object) |
| 3204 | { |
| 3205 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3206 | gint value; |
| 3207 | g_mutex_lock (&skeleton->priv->lock); |
| 3208 | value = g_value_get_int (&(skeleton->priv->properties[6])); |
| 3209 | g_mutex_unlock (&skeleton->priv->lock); |
| 3210 | return value; |
| 3211 | } |
| 3212 | |
| 3213 | static gint |
| 3214 | sensor_integer_skeleton_get_poll_interval (SensorInteger *object) |
| 3215 | { |
| 3216 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3217 | gint value; |
| 3218 | g_mutex_lock (&skeleton->priv->lock); |
| 3219 | value = g_value_get_int (&(skeleton->priv->properties[7])); |
| 3220 | g_mutex_unlock (&skeleton->priv->lock); |
| 3221 | return value; |
| 3222 | } |
| 3223 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3224 | static const gchar *const * |
| 3225 | sensor_integer_skeleton_get_config_data (SensorInteger *object) |
| 3226 | { |
| 3227 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3228 | const gchar *const *value; |
| 3229 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3230 | value = g_value_get_boxed (&(skeleton->priv->properties[8])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3231 | g_mutex_unlock (&skeleton->priv->lock); |
| 3232 | return value; |
| 3233 | } |
| 3234 | |
| 3235 | static gint |
| 3236 | sensor_integer_skeleton_get_changed_tolerance (SensorInteger *object) |
| 3237 | { |
| 3238 | SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object); |
| 3239 | gint value; |
| 3240 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3241 | value = g_value_get_int (&(skeleton->priv->properties[9])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3242 | g_mutex_unlock (&skeleton->priv->lock); |
| 3243 | return value; |
| 3244 | } |
| 3245 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3246 | static void |
| 3247 | sensor_integer_skeleton_class_init (SensorIntegerSkeletonClass *klass) |
| 3248 | { |
| 3249 | GObjectClass *gobject_class; |
| 3250 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 3251 | |
| 3252 | gobject_class = G_OBJECT_CLASS (klass); |
| 3253 | gobject_class->finalize = sensor_integer_skeleton_finalize; |
| 3254 | gobject_class->get_property = sensor_integer_skeleton_get_property; |
| 3255 | gobject_class->set_property = sensor_integer_skeleton_set_property; |
| 3256 | gobject_class->notify = sensor_integer_skeleton_notify; |
| 3257 | |
| 3258 | |
| 3259 | sensor_integer_override_properties (gobject_class, 1); |
| 3260 | |
| 3261 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 3262 | skeleton_class->get_info = sensor_integer_skeleton_dbus_interface_get_info; |
| 3263 | skeleton_class->get_properties = sensor_integer_skeleton_dbus_interface_get_properties; |
| 3264 | skeleton_class->flush = sensor_integer_skeleton_dbus_interface_flush; |
| 3265 | skeleton_class->get_vtable = sensor_integer_skeleton_dbus_interface_get_vtable; |
| 3266 | |
| 3267 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 3268 | g_type_class_add_private (klass, sizeof (SensorIntegerSkeletonPrivate)); |
| 3269 | #endif |
| 3270 | } |
| 3271 | |
| 3272 | static void |
| 3273 | sensor_integer_skeleton_iface_init (SensorIntegerIface *iface) |
| 3274 | { |
| 3275 | iface->changed = _sensor_integer_on_signal_changed; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3276 | iface->warning = _sensor_integer_on_signal_warning; |
| 3277 | iface->critical = _sensor_integer_on_signal_critical; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3278 | iface->get_value = sensor_integer_skeleton_get_value; |
| 3279 | iface->get_units = sensor_integer_skeleton_get_units; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame^] | 3280 | iface->get_threshold_lower_critical = sensor_integer_skeleton_get_threshold_lower_critical; |
| 3281 | iface->get_threshold_lower_warning = sensor_integer_skeleton_get_threshold_lower_warning; |
| 3282 | iface->get_threshold_upper_warning = sensor_integer_skeleton_get_threshold_upper_warning; |
| 3283 | iface->get_threshold_upper_critical = sensor_integer_skeleton_get_threshold_upper_critical; |
| 3284 | iface->get_threshold_state = sensor_integer_skeleton_get_threshold_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3285 | iface->get_poll_interval = sensor_integer_skeleton_get_poll_interval; |
| 3286 | iface->get_config_data = sensor_integer_skeleton_get_config_data; |
| 3287 | iface->get_changed_tolerance = sensor_integer_skeleton_get_changed_tolerance; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 3288 | } |
| 3289 | |
| 3290 | /** |
| 3291 | * sensor_integer_skeleton_new: |
| 3292 | * |
| 3293 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. |
| 3294 | * |
| 3295 | * Returns: (transfer full) (type SensorIntegerSkeleton): The skeleton object. |
| 3296 | */ |
| 3297 | SensorInteger * |
| 3298 | sensor_integer_skeleton_new (void) |
| 3299 | { |
| 3300 | return SENSOR_INTEGER (g_object_new (TYPE_SENSOR_INTEGER_SKELETON, NULL)); |
| 3301 | } |
| 3302 | |
| 3303 | /* ------------------------------------------------------------------------ |
| 3304 | * Code for interface org.openbmc.SensorString |
| 3305 | * ------------------------------------------------------------------------ |
| 3306 | */ |
| 3307 | |
| 3308 | /** |
| 3309 | * SECTION:SensorString |
| 3310 | * @title: SensorString |
| 3311 | * @short_description: Generated C code for the org.openbmc.SensorString D-Bus interface |
| 3312 | * |
| 3313 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface in C. |
| 3314 | */ |
| 3315 | |
| 3316 | /* ---- Introspection data for org.openbmc.SensorString ---- */ |
| 3317 | |
| 3318 | static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_value_OUT_ARG_value = |
| 3319 | { |
| 3320 | { |
| 3321 | -1, |
| 3322 | (gchar *) "value", |
| 3323 | (gchar *) "s", |
| 3324 | NULL |
| 3325 | }, |
| 3326 | FALSE |
| 3327 | }; |
| 3328 | |
| 3329 | static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_value_OUT_ARG_pointers[] = |
| 3330 | { |
| 3331 | &_sensor_string_method_info_get_value_OUT_ARG_value, |
| 3332 | NULL |
| 3333 | }; |
| 3334 | |
| 3335 | static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_value = |
| 3336 | { |
| 3337 | { |
| 3338 | -1, |
| 3339 | (gchar *) "getValue", |
| 3340 | NULL, |
| 3341 | (GDBusArgInfo **) &_sensor_string_method_info_get_value_OUT_ARG_pointers, |
| 3342 | NULL |
| 3343 | }, |
| 3344 | "handle-get-value", |
| 3345 | FALSE |
| 3346 | }; |
| 3347 | |
| 3348 | static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_units_OUT_ARG_units = |
| 3349 | { |
| 3350 | { |
| 3351 | -1, |
| 3352 | (gchar *) "units", |
| 3353 | (gchar *) "s", |
| 3354 | NULL |
| 3355 | }, |
| 3356 | FALSE |
| 3357 | }; |
| 3358 | |
| 3359 | static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_units_OUT_ARG_pointers[] = |
| 3360 | { |
| 3361 | &_sensor_string_method_info_get_units_OUT_ARG_units, |
| 3362 | NULL |
| 3363 | }; |
| 3364 | |
| 3365 | static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_units = |
| 3366 | { |
| 3367 | { |
| 3368 | -1, |
| 3369 | (gchar *) "getUnits", |
| 3370 | NULL, |
| 3371 | (GDBusArgInfo **) &_sensor_string_method_info_get_units_OUT_ARG_pointers, |
| 3372 | NULL |
| 3373 | }, |
| 3374 | "handle-get-units", |
| 3375 | FALSE |
| 3376 | }; |
| 3377 | |
| 3378 | static const _ExtendedGDBusMethodInfo * const _sensor_string_method_info_pointers[] = |
| 3379 | { |
| 3380 | &_sensor_string_method_info_get_value, |
| 3381 | &_sensor_string_method_info_get_units, |
| 3382 | NULL |
| 3383 | }; |
| 3384 | |
| 3385 | static const _ExtendedGDBusArgInfo _sensor_string_signal_info_changed_ARG_value = |
| 3386 | { |
| 3387 | { |
| 3388 | -1, |
| 3389 | (gchar *) "value", |
| 3390 | (gchar *) "s", |
| 3391 | NULL |
| 3392 | }, |
| 3393 | FALSE |
| 3394 | }; |
| 3395 | |
| 3396 | static const _ExtendedGDBusArgInfo * const _sensor_string_signal_info_changed_ARG_pointers[] = |
| 3397 | { |
| 3398 | &_sensor_string_signal_info_changed_ARG_value, |
| 3399 | NULL |
| 3400 | }; |
| 3401 | |
| 3402 | static const _ExtendedGDBusSignalInfo _sensor_string_signal_info_changed = |
| 3403 | { |
| 3404 | { |
| 3405 | -1, |
| 3406 | (gchar *) "Changed", |
| 3407 | (GDBusArgInfo **) &_sensor_string_signal_info_changed_ARG_pointers, |
| 3408 | NULL |
| 3409 | }, |
| 3410 | "changed" |
| 3411 | }; |
| 3412 | |
| 3413 | static const _ExtendedGDBusSignalInfo * const _sensor_string_signal_info_pointers[] = |
| 3414 | { |
| 3415 | &_sensor_string_signal_info_changed, |
| 3416 | NULL |
| 3417 | }; |
| 3418 | |
| 3419 | static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_value = |
| 3420 | { |
| 3421 | { |
| 3422 | -1, |
| 3423 | (gchar *) "value", |
| 3424 | (gchar *) "i", |
| 3425 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3426 | NULL |
| 3427 | }, |
| 3428 | "value", |
| 3429 | FALSE |
| 3430 | }; |
| 3431 | |
| 3432 | static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_units = |
| 3433 | { |
| 3434 | { |
| 3435 | -1, |
| 3436 | (gchar *) "units", |
| 3437 | (gchar *) "s", |
| 3438 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 3439 | NULL |
| 3440 | }, |
| 3441 | "units", |
| 3442 | FALSE |
| 3443 | }; |
| 3444 | |
| 3445 | static const _ExtendedGDBusPropertyInfo * const _sensor_string_property_info_pointers[] = |
| 3446 | { |
| 3447 | &_sensor_string_property_info_value, |
| 3448 | &_sensor_string_property_info_units, |
| 3449 | NULL |
| 3450 | }; |
| 3451 | |
| 3452 | static const _ExtendedGDBusInterfaceInfo _sensor_string_interface_info = |
| 3453 | { |
| 3454 | { |
| 3455 | -1, |
| 3456 | (gchar *) "org.openbmc.SensorString", |
| 3457 | (GDBusMethodInfo **) &_sensor_string_method_info_pointers, |
| 3458 | (GDBusSignalInfo **) &_sensor_string_signal_info_pointers, |
| 3459 | (GDBusPropertyInfo **) &_sensor_string_property_info_pointers, |
| 3460 | NULL |
| 3461 | }, |
| 3462 | "sensor-string", |
| 3463 | }; |
| 3464 | |
| 3465 | |
| 3466 | /** |
| 3467 | * sensor_string_interface_info: |
| 3468 | * |
| 3469 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface. |
| 3470 | * |
| 3471 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 3472 | */ |
| 3473 | GDBusInterfaceInfo * |
| 3474 | sensor_string_interface_info (void) |
| 3475 | { |
| 3476 | return (GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct; |
| 3477 | } |
| 3478 | |
| 3479 | /** |
| 3480 | * sensor_string_override_properties: |
| 3481 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 3482 | * @property_id_begin: The property id to assign to the first overridden property. |
| 3483 | * |
| 3484 | * Overrides all #GObject properties in the #SensorString interface for a concrete class. |
| 3485 | * The properties are overridden in the order they are defined. |
| 3486 | * |
| 3487 | * Returns: The last property id. |
| 3488 | */ |
| 3489 | guint |
| 3490 | sensor_string_override_properties (GObjectClass *klass, guint property_id_begin) |
| 3491 | { |
| 3492 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 3493 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 3494 | return property_id_begin - 1; |
| 3495 | } |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | /** |
| 3500 | * SensorString: |
| 3501 | * |
| 3502 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. |
| 3503 | */ |
| 3504 | |
| 3505 | /** |
| 3506 | * SensorStringIface: |
| 3507 | * @parent_iface: The parent interface. |
| 3508 | * @handle_get_units: Handler for the #SensorString::handle-get-units signal. |
| 3509 | * @handle_get_value: Handler for the #SensorString::handle-get-value signal. |
| 3510 | * @get_units: Getter for the #SensorString:units property. |
| 3511 | * @get_value: Getter for the #SensorString:value property. |
| 3512 | * @changed: Handler for the #SensorString::changed signal. |
| 3513 | * |
| 3514 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. |
| 3515 | */ |
| 3516 | |
| 3517 | typedef SensorStringIface SensorStringInterface; |
| 3518 | G_DEFINE_INTERFACE (SensorString, sensor_string, G_TYPE_OBJECT); |
| 3519 | |
| 3520 | static void |
| 3521 | sensor_string_default_init (SensorStringIface *iface) |
| 3522 | { |
| 3523 | /* GObject signals for incoming D-Bus method calls: */ |
| 3524 | /** |
| 3525 | * SensorString::handle-get-value: |
| 3526 | * @object: A #SensorString. |
| 3527 | * @invocation: A #GDBusMethodInvocation. |
| 3528 | * |
| 3529 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method. |
| 3530 | * |
| 3531 | * 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_string_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 3532 | * |
| 3533 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3534 | */ |
| 3535 | g_signal_new ("handle-get-value", |
| 3536 | G_TYPE_FROM_INTERFACE (iface), |
| 3537 | G_SIGNAL_RUN_LAST, |
| 3538 | G_STRUCT_OFFSET (SensorStringIface, handle_get_value), |
| 3539 | g_signal_accumulator_true_handled, |
| 3540 | NULL, |
| 3541 | g_cclosure_marshal_generic, |
| 3542 | G_TYPE_BOOLEAN, |
| 3543 | 1, |
| 3544 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3545 | |
| 3546 | /** |
| 3547 | * SensorString::handle-get-units: |
| 3548 | * @object: A #SensorString. |
| 3549 | * @invocation: A #GDBusMethodInvocation. |
| 3550 | * |
| 3551 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method. |
| 3552 | * |
| 3553 | * 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_string_complete_get_units() 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. |
| 3554 | * |
| 3555 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 3556 | */ |
| 3557 | g_signal_new ("handle-get-units", |
| 3558 | G_TYPE_FROM_INTERFACE (iface), |
| 3559 | G_SIGNAL_RUN_LAST, |
| 3560 | G_STRUCT_OFFSET (SensorStringIface, handle_get_units), |
| 3561 | g_signal_accumulator_true_handled, |
| 3562 | NULL, |
| 3563 | g_cclosure_marshal_generic, |
| 3564 | G_TYPE_BOOLEAN, |
| 3565 | 1, |
| 3566 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 3567 | |
| 3568 | /* GObject signals for received D-Bus signals: */ |
| 3569 | /** |
| 3570 | * SensorString::changed: |
| 3571 | * @object: A #SensorString. |
| 3572 | * @arg_value: Argument. |
| 3573 | * |
| 3574 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> is received. |
| 3575 | * |
| 3576 | * 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. |
| 3577 | */ |
| 3578 | g_signal_new ("changed", |
| 3579 | G_TYPE_FROM_INTERFACE (iface), |
| 3580 | G_SIGNAL_RUN_LAST, |
| 3581 | G_STRUCT_OFFSET (SensorStringIface, changed), |
| 3582 | NULL, |
| 3583 | NULL, |
| 3584 | g_cclosure_marshal_generic, |
| 3585 | G_TYPE_NONE, |
| 3586 | 1, G_TYPE_STRING); |
| 3587 | |
| 3588 | /* GObject properties for D-Bus properties: */ |
| 3589 | /** |
| 3590 | * SensorString:value: |
| 3591 | * |
| 3592 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link>. |
| 3593 | * |
| 3594 | * 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. |
| 3595 | */ |
| 3596 | g_object_interface_install_property (iface, |
| 3597 | g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3598 | /** |
| 3599 | * SensorString:units: |
| 3600 | * |
| 3601 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link>. |
| 3602 | * |
| 3603 | * 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. |
| 3604 | */ |
| 3605 | g_object_interface_install_property (iface, |
| 3606 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 3607 | } |
| 3608 | |
| 3609 | /** |
| 3610 | * sensor_string_get_value: (skip) |
| 3611 | * @object: A #SensorString. |
| 3612 | * |
| 3613 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property. |
| 3614 | * |
| 3615 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3616 | * |
| 3617 | * Returns: The property value. |
| 3618 | */ |
| 3619 | gint |
| 3620 | sensor_string_get_value (SensorString *object) |
| 3621 | { |
| 3622 | return SENSOR_STRING_GET_IFACE (object)->get_value (object); |
| 3623 | } |
| 3624 | |
| 3625 | /** |
| 3626 | * sensor_string_set_value: (skip) |
| 3627 | * @object: A #SensorString. |
| 3628 | * @value: The value to set. |
| 3629 | * |
| 3630 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property to @value. |
| 3631 | * |
| 3632 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3633 | */ |
| 3634 | void |
| 3635 | sensor_string_set_value (SensorString *object, gint value) |
| 3636 | { |
| 3637 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 3638 | } |
| 3639 | |
| 3640 | /** |
| 3641 | * sensor_string_get_units: (skip) |
| 3642 | * @object: A #SensorString. |
| 3643 | * |
| 3644 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property. |
| 3645 | * |
| 3646 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3647 | * |
| 3648 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_string_dup_units() if on another thread.</warning> |
| 3649 | * |
| 3650 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 3651 | */ |
| 3652 | const gchar * |
| 3653 | sensor_string_get_units (SensorString *object) |
| 3654 | { |
| 3655 | return SENSOR_STRING_GET_IFACE (object)->get_units (object); |
| 3656 | } |
| 3657 | |
| 3658 | /** |
| 3659 | * sensor_string_dup_units: (skip) |
| 3660 | * @object: A #SensorString. |
| 3661 | * |
| 3662 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property. |
| 3663 | * |
| 3664 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 3665 | * |
| 3666 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 3667 | */ |
| 3668 | gchar * |
| 3669 | sensor_string_dup_units (SensorString *object) |
| 3670 | { |
| 3671 | gchar *value; |
| 3672 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 3673 | return value; |
| 3674 | } |
| 3675 | |
| 3676 | /** |
| 3677 | * sensor_string_set_units: (skip) |
| 3678 | * @object: A #SensorString. |
| 3679 | * @value: The value to set. |
| 3680 | * |
| 3681 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property to @value. |
| 3682 | * |
| 3683 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 3684 | */ |
| 3685 | void |
| 3686 | sensor_string_set_units (SensorString *object, const gchar *value) |
| 3687 | { |
| 3688 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 3689 | } |
| 3690 | |
| 3691 | /** |
| 3692 | * sensor_string_emit_changed: |
| 3693 | * @object: A #SensorString. |
| 3694 | * @arg_value: Argument to pass with the signal. |
| 3695 | * |
| 3696 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> D-Bus signal. |
| 3697 | */ |
| 3698 | void |
| 3699 | sensor_string_emit_changed ( |
| 3700 | SensorString *object, |
| 3701 | const gchar *arg_value) |
| 3702 | { |
| 3703 | g_signal_emit_by_name (object, "changed", arg_value); |
| 3704 | } |
| 3705 | |
| 3706 | /** |
| 3707 | * sensor_string_call_get_value: |
| 3708 | * @proxy: A #SensorStringProxy. |
| 3709 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3710 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 3711 | * @user_data: User data to pass to @callback. |
| 3712 | * |
| 3713 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy. |
| 3714 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 3715 | * You can then call sensor_string_call_get_value_finish() to get the result of the operation. |
| 3716 | * |
| 3717 | * See sensor_string_call_get_value_sync() for the synchronous, blocking version of this method. |
| 3718 | */ |
| 3719 | void |
| 3720 | sensor_string_call_get_value ( |
| 3721 | SensorString *proxy, |
| 3722 | GCancellable *cancellable, |
| 3723 | GAsyncReadyCallback callback, |
| 3724 | gpointer user_data) |
| 3725 | { |
| 3726 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 3727 | "getValue", |
| 3728 | g_variant_new ("()"), |
| 3729 | G_DBUS_CALL_FLAGS_NONE, |
| 3730 | -1, |
| 3731 | cancellable, |
| 3732 | callback, |
| 3733 | user_data); |
| 3734 | } |
| 3735 | |
| 3736 | /** |
| 3737 | * sensor_string_call_get_value_finish: |
| 3738 | * @proxy: A #SensorStringProxy. |
| 3739 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 3740 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_value(). |
| 3741 | * @error: Return location for error or %NULL. |
| 3742 | * |
| 3743 | * Finishes an operation started with sensor_string_call_get_value(). |
| 3744 | * |
| 3745 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3746 | */ |
| 3747 | gboolean |
| 3748 | sensor_string_call_get_value_finish ( |
| 3749 | SensorString *proxy, |
| 3750 | gchar **out_value, |
| 3751 | GAsyncResult *res, |
| 3752 | GError **error) |
| 3753 | { |
| 3754 | GVariant *_ret; |
| 3755 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3756 | if (_ret == NULL) |
| 3757 | goto _out; |
| 3758 | g_variant_get (_ret, |
| 3759 | "(s)", |
| 3760 | out_value); |
| 3761 | g_variant_unref (_ret); |
| 3762 | _out: |
| 3763 | return _ret != NULL; |
| 3764 | } |
| 3765 | |
| 3766 | /** |
| 3767 | * sensor_string_call_get_value_sync: |
| 3768 | * @proxy: A #SensorStringProxy. |
| 3769 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 3770 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3771 | * @error: Return location for error or %NULL. |
| 3772 | * |
| 3773 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 3774 | * |
| 3775 | * See sensor_string_call_get_value() for the asynchronous version of this method. |
| 3776 | * |
| 3777 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3778 | */ |
| 3779 | gboolean |
| 3780 | sensor_string_call_get_value_sync ( |
| 3781 | SensorString *proxy, |
| 3782 | gchar **out_value, |
| 3783 | GCancellable *cancellable, |
| 3784 | GError **error) |
| 3785 | { |
| 3786 | GVariant *_ret; |
| 3787 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3788 | "getValue", |
| 3789 | g_variant_new ("()"), |
| 3790 | G_DBUS_CALL_FLAGS_NONE, |
| 3791 | -1, |
| 3792 | cancellable, |
| 3793 | error); |
| 3794 | if (_ret == NULL) |
| 3795 | goto _out; |
| 3796 | g_variant_get (_ret, |
| 3797 | "(s)", |
| 3798 | out_value); |
| 3799 | g_variant_unref (_ret); |
| 3800 | _out: |
| 3801 | return _ret != NULL; |
| 3802 | } |
| 3803 | |
| 3804 | /** |
| 3805 | * sensor_string_call_get_units: |
| 3806 | * @proxy: A #SensorStringProxy. |
| 3807 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3808 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 3809 | * @user_data: User data to pass to @callback. |
| 3810 | * |
| 3811 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy. |
| 3812 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 3813 | * You can then call sensor_string_call_get_units_finish() to get the result of the operation. |
| 3814 | * |
| 3815 | * See sensor_string_call_get_units_sync() for the synchronous, blocking version of this method. |
| 3816 | */ |
| 3817 | void |
| 3818 | sensor_string_call_get_units ( |
| 3819 | SensorString *proxy, |
| 3820 | GCancellable *cancellable, |
| 3821 | GAsyncReadyCallback callback, |
| 3822 | gpointer user_data) |
| 3823 | { |
| 3824 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 3825 | "getUnits", |
| 3826 | g_variant_new ("()"), |
| 3827 | G_DBUS_CALL_FLAGS_NONE, |
| 3828 | -1, |
| 3829 | cancellable, |
| 3830 | callback, |
| 3831 | user_data); |
| 3832 | } |
| 3833 | |
| 3834 | /** |
| 3835 | * sensor_string_call_get_units_finish: |
| 3836 | * @proxy: A #SensorStringProxy. |
| 3837 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 3838 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_units(). |
| 3839 | * @error: Return location for error or %NULL. |
| 3840 | * |
| 3841 | * Finishes an operation started with sensor_string_call_get_units(). |
| 3842 | * |
| 3843 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3844 | */ |
| 3845 | gboolean |
| 3846 | sensor_string_call_get_units_finish ( |
| 3847 | SensorString *proxy, |
| 3848 | gchar **out_units, |
| 3849 | GAsyncResult *res, |
| 3850 | GError **error) |
| 3851 | { |
| 3852 | GVariant *_ret; |
| 3853 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 3854 | if (_ret == NULL) |
| 3855 | goto _out; |
| 3856 | g_variant_get (_ret, |
| 3857 | "(s)", |
| 3858 | out_units); |
| 3859 | g_variant_unref (_ret); |
| 3860 | _out: |
| 3861 | return _ret != NULL; |
| 3862 | } |
| 3863 | |
| 3864 | /** |
| 3865 | * sensor_string_call_get_units_sync: |
| 3866 | * @proxy: A #SensorStringProxy. |
| 3867 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 3868 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3869 | * @error: Return location for error or %NULL. |
| 3870 | * |
| 3871 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 3872 | * |
| 3873 | * See sensor_string_call_get_units() for the asynchronous version of this method. |
| 3874 | * |
| 3875 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 3876 | */ |
| 3877 | gboolean |
| 3878 | sensor_string_call_get_units_sync ( |
| 3879 | SensorString *proxy, |
| 3880 | gchar **out_units, |
| 3881 | GCancellable *cancellable, |
| 3882 | GError **error) |
| 3883 | { |
| 3884 | GVariant *_ret; |
| 3885 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 3886 | "getUnits", |
| 3887 | g_variant_new ("()"), |
| 3888 | G_DBUS_CALL_FLAGS_NONE, |
| 3889 | -1, |
| 3890 | cancellable, |
| 3891 | error); |
| 3892 | if (_ret == NULL) |
| 3893 | goto _out; |
| 3894 | g_variant_get (_ret, |
| 3895 | "(s)", |
| 3896 | out_units); |
| 3897 | g_variant_unref (_ret); |
| 3898 | _out: |
| 3899 | return _ret != NULL; |
| 3900 | } |
| 3901 | |
| 3902 | /** |
| 3903 | * sensor_string_complete_get_value: |
| 3904 | * @object: A #SensorString. |
| 3905 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3906 | * @value: Parameter to return. |
| 3907 | * |
| 3908 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 3909 | * |
| 3910 | * This method will free @invocation, you cannot use it afterwards. |
| 3911 | */ |
| 3912 | void |
| 3913 | sensor_string_complete_get_value ( |
| 3914 | SensorString *object, |
| 3915 | GDBusMethodInvocation *invocation, |
| 3916 | const gchar *value) |
| 3917 | { |
| 3918 | g_dbus_method_invocation_return_value (invocation, |
| 3919 | g_variant_new ("(s)", |
| 3920 | value)); |
| 3921 | } |
| 3922 | |
| 3923 | /** |
| 3924 | * sensor_string_complete_get_units: |
| 3925 | * @object: A #SensorString. |
| 3926 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 3927 | * @units: Parameter to return. |
| 3928 | * |
| 3929 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 3930 | * |
| 3931 | * This method will free @invocation, you cannot use it afterwards. |
| 3932 | */ |
| 3933 | void |
| 3934 | sensor_string_complete_get_units ( |
| 3935 | SensorString *object, |
| 3936 | GDBusMethodInvocation *invocation, |
| 3937 | const gchar *units) |
| 3938 | { |
| 3939 | g_dbus_method_invocation_return_value (invocation, |
| 3940 | g_variant_new ("(s)", |
| 3941 | units)); |
| 3942 | } |
| 3943 | |
| 3944 | /* ------------------------------------------------------------------------ */ |
| 3945 | |
| 3946 | /** |
| 3947 | * SensorStringProxy: |
| 3948 | * |
| 3949 | * The #SensorStringProxy structure contains only private data and should only be accessed using the provided API. |
| 3950 | */ |
| 3951 | |
| 3952 | /** |
| 3953 | * SensorStringProxyClass: |
| 3954 | * @parent_class: The parent class. |
| 3955 | * |
| 3956 | * Class structure for #SensorStringProxy. |
| 3957 | */ |
| 3958 | |
| 3959 | struct _SensorStringProxyPrivate |
| 3960 | { |
| 3961 | GData *qdata; |
| 3962 | }; |
| 3963 | |
| 3964 | static void sensor_string_proxy_iface_init (SensorStringIface *iface); |
| 3965 | |
| 3966 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3967 | G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY, |
| 3968 | G_ADD_PRIVATE (SensorStringProxy) |
| 3969 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init)); |
| 3970 | |
| 3971 | #else |
| 3972 | G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY, |
| 3973 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init)); |
| 3974 | |
| 3975 | #endif |
| 3976 | static void |
| 3977 | sensor_string_proxy_finalize (GObject *object) |
| 3978 | { |
| 3979 | SensorStringProxy *proxy = SENSOR_STRING_PROXY (object); |
| 3980 | g_datalist_clear (&proxy->priv->qdata); |
| 3981 | G_OBJECT_CLASS (sensor_string_proxy_parent_class)->finalize (object); |
| 3982 | } |
| 3983 | |
| 3984 | static void |
| 3985 | sensor_string_proxy_get_property (GObject *object, |
| 3986 | guint prop_id, |
| 3987 | GValue *value, |
| 3988 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3989 | { |
| 3990 | const _ExtendedGDBusPropertyInfo *info; |
| 3991 | GVariant *variant; |
| 3992 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 3993 | info = _sensor_string_property_info_pointers[prop_id - 1]; |
| 3994 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3995 | if (info->use_gvariant) |
| 3996 | { |
| 3997 | g_value_set_variant (value, variant); |
| 3998 | } |
| 3999 | else |
| 4000 | { |
| 4001 | if (variant != NULL) |
| 4002 | g_dbus_gvariant_to_gvalue (variant, value); |
| 4003 | } |
| 4004 | if (variant != NULL) |
| 4005 | g_variant_unref (variant); |
| 4006 | } |
| 4007 | |
| 4008 | static void |
| 4009 | sensor_string_proxy_set_property_cb (GDBusProxy *proxy, |
| 4010 | GAsyncResult *res, |
| 4011 | gpointer user_data) |
| 4012 | { |
| 4013 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 4014 | GError *error; |
| 4015 | GVariant *_ret; |
| 4016 | error = NULL; |
| 4017 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 4018 | if (!_ret) |
| 4019 | { |
| 4020 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorString: %s (%s, %d)", |
| 4021 | info->parent_struct.name, |
| 4022 | error->message, g_quark_to_string (error->domain), error->code); |
| 4023 | g_error_free (error); |
| 4024 | } |
| 4025 | else |
| 4026 | { |
| 4027 | g_variant_unref (_ret); |
| 4028 | } |
| 4029 | } |
| 4030 | |
| 4031 | static void |
| 4032 | sensor_string_proxy_set_property (GObject *object, |
| 4033 | guint prop_id, |
| 4034 | const GValue *value, |
| 4035 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4036 | { |
| 4037 | const _ExtendedGDBusPropertyInfo *info; |
| 4038 | GVariant *variant; |
| 4039 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4040 | info = _sensor_string_property_info_pointers[prop_id - 1]; |
| 4041 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4042 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 4043 | "org.freedesktop.DBus.Properties.Set", |
| 4044 | g_variant_new ("(ssv)", "org.openbmc.SensorString", info->parent_struct.name, variant), |
| 4045 | G_DBUS_CALL_FLAGS_NONE, |
| 4046 | -1, |
| 4047 | NULL, (GAsyncReadyCallback) sensor_string_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 4048 | g_variant_unref (variant); |
| 4049 | } |
| 4050 | |
| 4051 | static void |
| 4052 | sensor_string_proxy_g_signal (GDBusProxy *proxy, |
| 4053 | const gchar *sender_name G_GNUC_UNUSED, |
| 4054 | const gchar *signal_name, |
| 4055 | GVariant *parameters) |
| 4056 | { |
| 4057 | _ExtendedGDBusSignalInfo *info; |
| 4058 | GVariantIter iter; |
| 4059 | GVariant *child; |
| 4060 | GValue *paramv; |
| 4061 | guint num_params; |
| 4062 | guint n; |
| 4063 | guint signal_id; |
| 4064 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, signal_name); |
| 4065 | if (info == NULL) |
| 4066 | return; |
| 4067 | num_params = g_variant_n_children (parameters); |
| 4068 | paramv = g_new0 (GValue, num_params + 1); |
| 4069 | g_value_init (¶mv[0], TYPE_SENSOR_STRING); |
| 4070 | g_value_set_object (¶mv[0], proxy); |
| 4071 | g_variant_iter_init (&iter, parameters); |
| 4072 | n = 1; |
| 4073 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4074 | { |
| 4075 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 4076 | if (arg_info->use_gvariant) |
| 4077 | { |
| 4078 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4079 | g_value_set_variant (¶mv[n], child); |
| 4080 | n++; |
| 4081 | } |
| 4082 | else |
| 4083 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4084 | g_variant_unref (child); |
| 4085 | } |
| 4086 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING); |
| 4087 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 4088 | for (n = 0; n < num_params + 1; n++) |
| 4089 | g_value_unset (¶mv[n]); |
| 4090 | g_free (paramv); |
| 4091 | } |
| 4092 | |
| 4093 | static void |
| 4094 | sensor_string_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 4095 | GVariant *changed_properties, |
| 4096 | const gchar *const *invalidated_properties) |
| 4097 | { |
| 4098 | SensorStringProxy *proxy = SENSOR_STRING_PROXY (_proxy); |
| 4099 | guint n; |
| 4100 | const gchar *key; |
| 4101 | GVariantIter *iter; |
| 4102 | _ExtendedGDBusPropertyInfo *info; |
| 4103 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 4104 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 4105 | { |
| 4106 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, key); |
| 4107 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 4108 | if (info != NULL) |
| 4109 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4110 | } |
| 4111 | g_variant_iter_free (iter); |
| 4112 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 4113 | { |
| 4114 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, invalidated_properties[n]); |
| 4115 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 4116 | if (info != NULL) |
| 4117 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4118 | } |
| 4119 | } |
| 4120 | |
| 4121 | static gint |
| 4122 | sensor_string_proxy_get_value (SensorString *object) |
| 4123 | { |
| 4124 | SensorStringProxy *proxy = SENSOR_STRING_PROXY (object); |
| 4125 | GVariant *variant; |
| 4126 | gint value = 0; |
| 4127 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 4128 | if (variant != NULL) |
| 4129 | { |
| 4130 | value = g_variant_get_int32 (variant); |
| 4131 | g_variant_unref (variant); |
| 4132 | } |
| 4133 | return value; |
| 4134 | } |
| 4135 | |
| 4136 | static const gchar * |
| 4137 | sensor_string_proxy_get_units (SensorString *object) |
| 4138 | { |
| 4139 | SensorStringProxy *proxy = SENSOR_STRING_PROXY (object); |
| 4140 | GVariant *variant; |
| 4141 | const gchar *value = NULL; |
| 4142 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 4143 | if (variant != NULL) |
| 4144 | { |
| 4145 | value = g_variant_get_string (variant, NULL); |
| 4146 | g_variant_unref (variant); |
| 4147 | } |
| 4148 | return value; |
| 4149 | } |
| 4150 | |
| 4151 | static void |
| 4152 | sensor_string_proxy_init (SensorStringProxy *proxy) |
| 4153 | { |
| 4154 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4155 | proxy->priv = sensor_string_proxy_get_instance_private (proxy); |
| 4156 | #else |
| 4157 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_STRING_PROXY, SensorStringProxyPrivate); |
| 4158 | #endif |
| 4159 | |
| 4160 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_string_interface_info ()); |
| 4161 | } |
| 4162 | |
| 4163 | static void |
| 4164 | sensor_string_proxy_class_init (SensorStringProxyClass *klass) |
| 4165 | { |
| 4166 | GObjectClass *gobject_class; |
| 4167 | GDBusProxyClass *proxy_class; |
| 4168 | |
| 4169 | gobject_class = G_OBJECT_CLASS (klass); |
| 4170 | gobject_class->finalize = sensor_string_proxy_finalize; |
| 4171 | gobject_class->get_property = sensor_string_proxy_get_property; |
| 4172 | gobject_class->set_property = sensor_string_proxy_set_property; |
| 4173 | |
| 4174 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 4175 | proxy_class->g_signal = sensor_string_proxy_g_signal; |
| 4176 | proxy_class->g_properties_changed = sensor_string_proxy_g_properties_changed; |
| 4177 | |
| 4178 | sensor_string_override_properties (gobject_class, 1); |
| 4179 | |
| 4180 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4181 | g_type_class_add_private (klass, sizeof (SensorStringProxyPrivate)); |
| 4182 | #endif |
| 4183 | } |
| 4184 | |
| 4185 | static void |
| 4186 | sensor_string_proxy_iface_init (SensorStringIface *iface) |
| 4187 | { |
| 4188 | iface->get_value = sensor_string_proxy_get_value; |
| 4189 | iface->get_units = sensor_string_proxy_get_units; |
| 4190 | } |
| 4191 | |
| 4192 | /** |
| 4193 | * sensor_string_proxy_new: |
| 4194 | * @connection: A #GDBusConnection. |
| 4195 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4196 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4197 | * @object_path: An object path. |
| 4198 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4199 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4200 | * @user_data: User data to pass to @callback. |
| 4201 | * |
| 4202 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. See g_dbus_proxy_new() for more details. |
| 4203 | * |
| 4204 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4205 | * You can then call sensor_string_proxy_new_finish() to get the result of the operation. |
| 4206 | * |
| 4207 | * See sensor_string_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 4208 | */ |
| 4209 | void |
| 4210 | sensor_string_proxy_new ( |
| 4211 | GDBusConnection *connection, |
| 4212 | GDBusProxyFlags flags, |
| 4213 | const gchar *name, |
| 4214 | const gchar *object_path, |
| 4215 | GCancellable *cancellable, |
| 4216 | GAsyncReadyCallback callback, |
| 4217 | gpointer user_data) |
| 4218 | { |
| 4219 | g_async_initable_new_async (TYPE_SENSOR_STRING_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.SensorString", NULL); |
| 4220 | } |
| 4221 | |
| 4222 | /** |
| 4223 | * sensor_string_proxy_new_finish: |
| 4224 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new(). |
| 4225 | * @error: Return location for error or %NULL |
| 4226 | * |
| 4227 | * Finishes an operation started with sensor_string_proxy_new(). |
| 4228 | * |
| 4229 | * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set. |
| 4230 | */ |
| 4231 | SensorString * |
| 4232 | sensor_string_proxy_new_finish ( |
| 4233 | GAsyncResult *res, |
| 4234 | GError **error) |
| 4235 | { |
| 4236 | GObject *ret; |
| 4237 | GObject *source_object; |
| 4238 | source_object = g_async_result_get_source_object (res); |
| 4239 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4240 | g_object_unref (source_object); |
| 4241 | if (ret != NULL) |
| 4242 | return SENSOR_STRING (ret); |
| 4243 | else |
| 4244 | return NULL; |
| 4245 | } |
| 4246 | |
| 4247 | /** |
| 4248 | * sensor_string_proxy_new_sync: |
| 4249 | * @connection: A #GDBusConnection. |
| 4250 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4251 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4252 | * @object_path: An object path. |
| 4253 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4254 | * @error: Return location for error or %NULL |
| 4255 | * |
| 4256 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. See g_dbus_proxy_new_sync() for more details. |
| 4257 | * |
| 4258 | * The calling thread is blocked until a reply is received. |
| 4259 | * |
| 4260 | * See sensor_string_proxy_new() for the asynchronous version of this constructor. |
| 4261 | * |
| 4262 | * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set. |
| 4263 | */ |
| 4264 | SensorString * |
| 4265 | sensor_string_proxy_new_sync ( |
| 4266 | GDBusConnection *connection, |
| 4267 | GDBusProxyFlags flags, |
| 4268 | const gchar *name, |
| 4269 | const gchar *object_path, |
| 4270 | GCancellable *cancellable, |
| 4271 | GError **error) |
| 4272 | { |
| 4273 | GInitable *ret; |
| 4274 | ret = g_initable_new (TYPE_SENSOR_STRING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL); |
| 4275 | if (ret != NULL) |
| 4276 | return SENSOR_STRING (ret); |
| 4277 | else |
| 4278 | return NULL; |
| 4279 | } |
| 4280 | |
| 4281 | |
| 4282 | /** |
| 4283 | * sensor_string_proxy_new_for_bus: |
| 4284 | * @bus_type: A #GBusType. |
| 4285 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4286 | * @name: A bus name (well-known or unique). |
| 4287 | * @object_path: An object path. |
| 4288 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4289 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4290 | * @user_data: User data to pass to @callback. |
| 4291 | * |
| 4292 | * Like sensor_string_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 4293 | * |
| 4294 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4295 | * You can then call sensor_string_proxy_new_for_bus_finish() to get the result of the operation. |
| 4296 | * |
| 4297 | * See sensor_string_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 4298 | */ |
| 4299 | void |
| 4300 | sensor_string_proxy_new_for_bus ( |
| 4301 | GBusType bus_type, |
| 4302 | GDBusProxyFlags flags, |
| 4303 | const gchar *name, |
| 4304 | const gchar *object_path, |
| 4305 | GCancellable *cancellable, |
| 4306 | GAsyncReadyCallback callback, |
| 4307 | gpointer user_data) |
| 4308 | { |
| 4309 | g_async_initable_new_async (TYPE_SENSOR_STRING_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.SensorString", NULL); |
| 4310 | } |
| 4311 | |
| 4312 | /** |
| 4313 | * sensor_string_proxy_new_for_bus_finish: |
| 4314 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new_for_bus(). |
| 4315 | * @error: Return location for error or %NULL |
| 4316 | * |
| 4317 | * Finishes an operation started with sensor_string_proxy_new_for_bus(). |
| 4318 | * |
| 4319 | * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set. |
| 4320 | */ |
| 4321 | SensorString * |
| 4322 | sensor_string_proxy_new_for_bus_finish ( |
| 4323 | GAsyncResult *res, |
| 4324 | GError **error) |
| 4325 | { |
| 4326 | GObject *ret; |
| 4327 | GObject *source_object; |
| 4328 | source_object = g_async_result_get_source_object (res); |
| 4329 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4330 | g_object_unref (source_object); |
| 4331 | if (ret != NULL) |
| 4332 | return SENSOR_STRING (ret); |
| 4333 | else |
| 4334 | return NULL; |
| 4335 | } |
| 4336 | |
| 4337 | /** |
| 4338 | * sensor_string_proxy_new_for_bus_sync: |
| 4339 | * @bus_type: A #GBusType. |
| 4340 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4341 | * @name: A bus name (well-known or unique). |
| 4342 | * @object_path: An object path. |
| 4343 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4344 | * @error: Return location for error or %NULL |
| 4345 | * |
| 4346 | * Like sensor_string_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 4347 | * |
| 4348 | * The calling thread is blocked until a reply is received. |
| 4349 | * |
| 4350 | * See sensor_string_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 4351 | * |
| 4352 | * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set. |
| 4353 | */ |
| 4354 | SensorString * |
| 4355 | sensor_string_proxy_new_for_bus_sync ( |
| 4356 | GBusType bus_type, |
| 4357 | GDBusProxyFlags flags, |
| 4358 | const gchar *name, |
| 4359 | const gchar *object_path, |
| 4360 | GCancellable *cancellable, |
| 4361 | GError **error) |
| 4362 | { |
| 4363 | GInitable *ret; |
| 4364 | ret = g_initable_new (TYPE_SENSOR_STRING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL); |
| 4365 | if (ret != NULL) |
| 4366 | return SENSOR_STRING (ret); |
| 4367 | else |
| 4368 | return NULL; |
| 4369 | } |
| 4370 | |
| 4371 | |
| 4372 | /* ------------------------------------------------------------------------ */ |
| 4373 | |
| 4374 | /** |
| 4375 | * SensorStringSkeleton: |
| 4376 | * |
| 4377 | * The #SensorStringSkeleton structure contains only private data and should only be accessed using the provided API. |
| 4378 | */ |
| 4379 | |
| 4380 | /** |
| 4381 | * SensorStringSkeletonClass: |
| 4382 | * @parent_class: The parent class. |
| 4383 | * |
| 4384 | * Class structure for #SensorStringSkeleton. |
| 4385 | */ |
| 4386 | |
| 4387 | struct _SensorStringSkeletonPrivate |
| 4388 | { |
| 4389 | GValue *properties; |
| 4390 | GList *changed_properties; |
| 4391 | GSource *changed_properties_idle_source; |
| 4392 | GMainContext *context; |
| 4393 | GMutex lock; |
| 4394 | }; |
| 4395 | |
| 4396 | static void |
| 4397 | _sensor_string_skeleton_handle_method_call ( |
| 4398 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4399 | const gchar *sender G_GNUC_UNUSED, |
| 4400 | const gchar *object_path G_GNUC_UNUSED, |
| 4401 | const gchar *interface_name, |
| 4402 | const gchar *method_name, |
| 4403 | GVariant *parameters, |
| 4404 | GDBusMethodInvocation *invocation, |
| 4405 | gpointer user_data) |
| 4406 | { |
| 4407 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data); |
| 4408 | _ExtendedGDBusMethodInfo *info; |
| 4409 | GVariantIter iter; |
| 4410 | GVariant *child; |
| 4411 | GValue *paramv; |
| 4412 | guint num_params; |
| 4413 | guint num_extra; |
| 4414 | guint n; |
| 4415 | guint signal_id; |
| 4416 | GValue return_value = G_VALUE_INIT; |
| 4417 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 4418 | g_assert (info != NULL); |
| 4419 | num_params = g_variant_n_children (parameters); |
| 4420 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 4421 | n = 0; |
| 4422 | g_value_init (¶mv[n], TYPE_SENSOR_STRING); |
| 4423 | g_value_set_object (¶mv[n++], skeleton); |
| 4424 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 4425 | g_value_set_object (¶mv[n++], invocation); |
| 4426 | if (info->pass_fdlist) |
| 4427 | { |
| 4428 | #ifdef G_OS_UNIX |
| 4429 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 4430 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 4431 | #else |
| 4432 | g_assert_not_reached (); |
| 4433 | #endif |
| 4434 | } |
| 4435 | g_variant_iter_init (&iter, parameters); |
| 4436 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4437 | { |
| 4438 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 4439 | if (arg_info->use_gvariant) |
| 4440 | { |
| 4441 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4442 | g_value_set_variant (¶mv[n], child); |
| 4443 | n++; |
| 4444 | } |
| 4445 | else |
| 4446 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4447 | g_variant_unref (child); |
| 4448 | } |
| 4449 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING); |
| 4450 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 4451 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 4452 | if (!g_value_get_boolean (&return_value)) |
| 4453 | 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); |
| 4454 | g_value_unset (&return_value); |
| 4455 | for (n = 0; n < num_params + num_extra; n++) |
| 4456 | g_value_unset (¶mv[n]); |
| 4457 | g_free (paramv); |
| 4458 | } |
| 4459 | |
| 4460 | static GVariant * |
| 4461 | _sensor_string_skeleton_handle_get_property ( |
| 4462 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4463 | const gchar *sender G_GNUC_UNUSED, |
| 4464 | const gchar *object_path G_GNUC_UNUSED, |
| 4465 | const gchar *interface_name G_GNUC_UNUSED, |
| 4466 | const gchar *property_name, |
| 4467 | GError **error, |
| 4468 | gpointer user_data) |
| 4469 | { |
| 4470 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data); |
| 4471 | GValue value = G_VALUE_INIT; |
| 4472 | GParamSpec *pspec; |
| 4473 | _ExtendedGDBusPropertyInfo *info; |
| 4474 | GVariant *ret; |
| 4475 | ret = NULL; |
| 4476 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name); |
| 4477 | g_assert (info != NULL); |
| 4478 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4479 | if (pspec == NULL) |
| 4480 | { |
| 4481 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4482 | } |
| 4483 | else |
| 4484 | { |
| 4485 | g_value_init (&value, pspec->value_type); |
| 4486 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4487 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4488 | g_value_unset (&value); |
| 4489 | } |
| 4490 | return ret; |
| 4491 | } |
| 4492 | |
| 4493 | static gboolean |
| 4494 | _sensor_string_skeleton_handle_set_property ( |
| 4495 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4496 | const gchar *sender G_GNUC_UNUSED, |
| 4497 | const gchar *object_path G_GNUC_UNUSED, |
| 4498 | const gchar *interface_name G_GNUC_UNUSED, |
| 4499 | const gchar *property_name, |
| 4500 | GVariant *variant, |
| 4501 | GError **error, |
| 4502 | gpointer user_data) |
| 4503 | { |
| 4504 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data); |
| 4505 | GValue value = G_VALUE_INIT; |
| 4506 | GParamSpec *pspec; |
| 4507 | _ExtendedGDBusPropertyInfo *info; |
| 4508 | gboolean ret; |
| 4509 | ret = FALSE; |
| 4510 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name); |
| 4511 | g_assert (info != NULL); |
| 4512 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4513 | if (pspec == NULL) |
| 4514 | { |
| 4515 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4516 | } |
| 4517 | else |
| 4518 | { |
| 4519 | if (info->use_gvariant) |
| 4520 | g_value_set_variant (&value, variant); |
| 4521 | else |
| 4522 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 4523 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4524 | g_value_unset (&value); |
| 4525 | ret = TRUE; |
| 4526 | } |
| 4527 | return ret; |
| 4528 | } |
| 4529 | |
| 4530 | static const GDBusInterfaceVTable _sensor_string_skeleton_vtable = |
| 4531 | { |
| 4532 | _sensor_string_skeleton_handle_method_call, |
| 4533 | _sensor_string_skeleton_handle_get_property, |
| 4534 | _sensor_string_skeleton_handle_set_property, |
| 4535 | {NULL} |
| 4536 | }; |
| 4537 | |
| 4538 | static GDBusInterfaceInfo * |
| 4539 | sensor_string_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4540 | { |
| 4541 | return sensor_string_interface_info (); |
| 4542 | } |
| 4543 | |
| 4544 | static GDBusInterfaceVTable * |
| 4545 | sensor_string_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4546 | { |
| 4547 | return (GDBusInterfaceVTable *) &_sensor_string_skeleton_vtable; |
| 4548 | } |
| 4549 | |
| 4550 | static GVariant * |
| 4551 | sensor_string_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 4552 | { |
| 4553 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton); |
| 4554 | |
| 4555 | GVariantBuilder builder; |
| 4556 | guint n; |
| 4557 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4558 | if (_sensor_string_interface_info.parent_struct.properties == NULL) |
| 4559 | goto out; |
| 4560 | for (n = 0; _sensor_string_interface_info.parent_struct.properties[n] != NULL; n++) |
| 4561 | { |
| 4562 | GDBusPropertyInfo *info = _sensor_string_interface_info.parent_struct.properties[n]; |
| 4563 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 4564 | { |
| 4565 | GVariant *value; |
| 4566 | value = _sensor_string_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.SensorString", info->name, NULL, skeleton); |
| 4567 | if (value != NULL) |
| 4568 | { |
| 4569 | g_variant_take_ref (value); |
| 4570 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 4571 | g_variant_unref (value); |
| 4572 | } |
| 4573 | } |
| 4574 | } |
| 4575 | out: |
| 4576 | return g_variant_builder_end (&builder); |
| 4577 | } |
| 4578 | |
| 4579 | static gboolean _sensor_string_emit_changed (gpointer user_data); |
| 4580 | |
| 4581 | static void |
| 4582 | sensor_string_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 4583 | { |
| 4584 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton); |
| 4585 | gboolean emit_changed = FALSE; |
| 4586 | |
| 4587 | g_mutex_lock (&skeleton->priv->lock); |
| 4588 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4589 | { |
| 4590 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4591 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4592 | emit_changed = TRUE; |
| 4593 | } |
| 4594 | g_mutex_unlock (&skeleton->priv->lock); |
| 4595 | |
| 4596 | if (emit_changed) |
| 4597 | _sensor_string_emit_changed (skeleton); |
| 4598 | } |
| 4599 | |
| 4600 | static void |
| 4601 | _sensor_string_on_signal_changed ( |
| 4602 | SensorString *object, |
| 4603 | const gchar *arg_value) |
| 4604 | { |
| 4605 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4606 | |
| 4607 | GList *connections, *l; |
| 4608 | GVariant *signal_variant; |
| 4609 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4610 | |
| 4611 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 4612 | arg_value)); |
| 4613 | for (l = connections; l != NULL; l = l->next) |
| 4614 | { |
| 4615 | GDBusConnection *connection = l->data; |
| 4616 | g_dbus_connection_emit_signal (connection, |
| 4617 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorString", "Changed", |
| 4618 | signal_variant, NULL); |
| 4619 | } |
| 4620 | g_variant_unref (signal_variant); |
| 4621 | g_list_free_full (connections, g_object_unref); |
| 4622 | } |
| 4623 | |
| 4624 | static void sensor_string_skeleton_iface_init (SensorStringIface *iface); |
| 4625 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4626 | G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4627 | G_ADD_PRIVATE (SensorStringSkeleton) |
| 4628 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init)); |
| 4629 | |
| 4630 | #else |
| 4631 | G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4632 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init)); |
| 4633 | |
| 4634 | #endif |
| 4635 | static void |
| 4636 | sensor_string_skeleton_finalize (GObject *object) |
| 4637 | { |
| 4638 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4639 | guint n; |
| 4640 | for (n = 0; n < 2; n++) |
| 4641 | g_value_unset (&skeleton->priv->properties[n]); |
| 4642 | g_free (skeleton->priv->properties); |
| 4643 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4644 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4645 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4646 | g_main_context_unref (skeleton->priv->context); |
| 4647 | g_mutex_clear (&skeleton->priv->lock); |
| 4648 | G_OBJECT_CLASS (sensor_string_skeleton_parent_class)->finalize (object); |
| 4649 | } |
| 4650 | |
| 4651 | static void |
| 4652 | sensor_string_skeleton_get_property (GObject *object, |
| 4653 | guint prop_id, |
| 4654 | GValue *value, |
| 4655 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4656 | { |
| 4657 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4658 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4659 | g_mutex_lock (&skeleton->priv->lock); |
| 4660 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 4661 | g_mutex_unlock (&skeleton->priv->lock); |
| 4662 | } |
| 4663 | |
| 4664 | static gboolean |
| 4665 | _sensor_string_emit_changed (gpointer user_data) |
| 4666 | { |
| 4667 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data); |
| 4668 | GList *l; |
| 4669 | GVariantBuilder builder; |
| 4670 | GVariantBuilder invalidated_builder; |
| 4671 | guint num_changes; |
| 4672 | |
| 4673 | g_mutex_lock (&skeleton->priv->lock); |
| 4674 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4675 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 4676 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 4677 | { |
| 4678 | ChangedProperty *cp = l->data; |
| 4679 | GVariant *variant; |
| 4680 | const GValue *cur_value; |
| 4681 | |
| 4682 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 4683 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 4684 | { |
| 4685 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 4686 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 4687 | g_variant_unref (variant); |
| 4688 | num_changes++; |
| 4689 | } |
| 4690 | } |
| 4691 | if (num_changes > 0) |
| 4692 | { |
| 4693 | GList *connections, *ll; |
| 4694 | GVariant *signal_variant; |
| 4695 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorString", |
| 4696 | &builder, &invalidated_builder)); |
| 4697 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4698 | for (ll = connections; ll != NULL; ll = ll->next) |
| 4699 | { |
| 4700 | GDBusConnection *connection = ll->data; |
| 4701 | |
| 4702 | g_dbus_connection_emit_signal (connection, |
| 4703 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 4704 | "org.freedesktop.DBus.Properties", |
| 4705 | "PropertiesChanged", |
| 4706 | signal_variant, |
| 4707 | NULL); |
| 4708 | } |
| 4709 | g_variant_unref (signal_variant); |
| 4710 | g_list_free_full (connections, g_object_unref); |
| 4711 | } |
| 4712 | else |
| 4713 | { |
| 4714 | g_variant_builder_clear (&builder); |
| 4715 | g_variant_builder_clear (&invalidated_builder); |
| 4716 | } |
| 4717 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4718 | skeleton->priv->changed_properties = NULL; |
| 4719 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4720 | g_mutex_unlock (&skeleton->priv->lock); |
| 4721 | return FALSE; |
| 4722 | } |
| 4723 | |
| 4724 | static void |
| 4725 | _sensor_string_schedule_emit_changed (SensorStringSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 4726 | { |
| 4727 | ChangedProperty *cp; |
| 4728 | GList *l; |
| 4729 | cp = NULL; |
| 4730 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 4731 | { |
| 4732 | ChangedProperty *i_cp = l->data; |
| 4733 | if (i_cp->info == info) |
| 4734 | { |
| 4735 | cp = i_cp; |
| 4736 | break; |
| 4737 | } |
| 4738 | } |
| 4739 | if (cp == NULL) |
| 4740 | { |
| 4741 | cp = g_new0 (ChangedProperty, 1); |
| 4742 | cp->prop_id = prop_id; |
| 4743 | cp->info = info; |
| 4744 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 4745 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 4746 | g_value_copy (orig_value, &cp->orig_value); |
| 4747 | } |
| 4748 | } |
| 4749 | |
| 4750 | static void |
| 4751 | sensor_string_skeleton_notify (GObject *object, |
| 4752 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4753 | { |
| 4754 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4755 | g_mutex_lock (&skeleton->priv->lock); |
| 4756 | if (skeleton->priv->changed_properties != NULL && |
| 4757 | skeleton->priv->changed_properties_idle_source == NULL) |
| 4758 | { |
| 4759 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 4760 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 4761 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_string_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 4762 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 4763 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 4764 | } |
| 4765 | g_mutex_unlock (&skeleton->priv->lock); |
| 4766 | } |
| 4767 | |
| 4768 | static void |
| 4769 | sensor_string_skeleton_set_property (GObject *object, |
| 4770 | guint prop_id, |
| 4771 | const GValue *value, |
| 4772 | GParamSpec *pspec) |
| 4773 | { |
| 4774 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4775 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4776 | g_mutex_lock (&skeleton->priv->lock); |
| 4777 | g_object_freeze_notify (object); |
| 4778 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 4779 | { |
| 4780 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 4781 | _sensor_string_schedule_emit_changed (skeleton, _sensor_string_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 4782 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 4783 | g_object_notify_by_pspec (object, pspec); |
| 4784 | } |
| 4785 | g_mutex_unlock (&skeleton->priv->lock); |
| 4786 | g_object_thaw_notify (object); |
| 4787 | } |
| 4788 | |
| 4789 | static void |
| 4790 | sensor_string_skeleton_init (SensorStringSkeleton *skeleton) |
| 4791 | { |
| 4792 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4793 | skeleton->priv = sensor_string_skeleton_get_instance_private (skeleton); |
| 4794 | #else |
| 4795 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_STRING_SKELETON, SensorStringSkeletonPrivate); |
| 4796 | #endif |
| 4797 | |
| 4798 | g_mutex_init (&skeleton->priv->lock); |
| 4799 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 4800 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 4801 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 4802 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 4803 | } |
| 4804 | |
| 4805 | static gint |
| 4806 | sensor_string_skeleton_get_value (SensorString *object) |
| 4807 | { |
| 4808 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4809 | gint value; |
| 4810 | g_mutex_lock (&skeleton->priv->lock); |
| 4811 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 4812 | g_mutex_unlock (&skeleton->priv->lock); |
| 4813 | return value; |
| 4814 | } |
| 4815 | |
| 4816 | static const gchar * |
| 4817 | sensor_string_skeleton_get_units (SensorString *object) |
| 4818 | { |
| 4819 | SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object); |
| 4820 | const gchar *value; |
| 4821 | g_mutex_lock (&skeleton->priv->lock); |
| 4822 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 4823 | g_mutex_unlock (&skeleton->priv->lock); |
| 4824 | return value; |
| 4825 | } |
| 4826 | |
| 4827 | static void |
| 4828 | sensor_string_skeleton_class_init (SensorStringSkeletonClass *klass) |
| 4829 | { |
| 4830 | GObjectClass *gobject_class; |
| 4831 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 4832 | |
| 4833 | gobject_class = G_OBJECT_CLASS (klass); |
| 4834 | gobject_class->finalize = sensor_string_skeleton_finalize; |
| 4835 | gobject_class->get_property = sensor_string_skeleton_get_property; |
| 4836 | gobject_class->set_property = sensor_string_skeleton_set_property; |
| 4837 | gobject_class->notify = sensor_string_skeleton_notify; |
| 4838 | |
| 4839 | |
| 4840 | sensor_string_override_properties (gobject_class, 1); |
| 4841 | |
| 4842 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 4843 | skeleton_class->get_info = sensor_string_skeleton_dbus_interface_get_info; |
| 4844 | skeleton_class->get_properties = sensor_string_skeleton_dbus_interface_get_properties; |
| 4845 | skeleton_class->flush = sensor_string_skeleton_dbus_interface_flush; |
| 4846 | skeleton_class->get_vtable = sensor_string_skeleton_dbus_interface_get_vtable; |
| 4847 | |
| 4848 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4849 | g_type_class_add_private (klass, sizeof (SensorStringSkeletonPrivate)); |
| 4850 | #endif |
| 4851 | } |
| 4852 | |
| 4853 | static void |
| 4854 | sensor_string_skeleton_iface_init (SensorStringIface *iface) |
| 4855 | { |
| 4856 | iface->changed = _sensor_string_on_signal_changed; |
| 4857 | iface->get_value = sensor_string_skeleton_get_value; |
| 4858 | iface->get_units = sensor_string_skeleton_get_units; |
| 4859 | } |
| 4860 | |
| 4861 | /** |
| 4862 | * sensor_string_skeleton_new: |
| 4863 | * |
| 4864 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. |
| 4865 | * |
| 4866 | * Returns: (transfer full) (type SensorStringSkeleton): The skeleton object. |
| 4867 | */ |
| 4868 | SensorString * |
| 4869 | sensor_string_skeleton_new (void) |
| 4870 | { |
| 4871 | return SENSOR_STRING (g_object_new (TYPE_SENSOR_STRING_SKELETON, NULL)); |
| 4872 | } |
| 4873 | |
| 4874 | /* ------------------------------------------------------------------------ |
| 4875 | * Code for interface org.openbmc.SensorIntegerSettable |
| 4876 | * ------------------------------------------------------------------------ |
| 4877 | */ |
| 4878 | |
| 4879 | /** |
| 4880 | * SECTION:SensorIntegerSettable |
| 4881 | * @title: SensorIntegerSettable |
| 4882 | * @short_description: Generated C code for the org.openbmc.SensorIntegerSettable D-Bus interface |
| 4883 | * |
| 4884 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> D-Bus interface in C. |
| 4885 | */ |
| 4886 | |
| 4887 | /* ---- Introspection data for org.openbmc.SensorIntegerSettable ---- */ |
| 4888 | |
| 4889 | static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_get_value_OUT_ARG_value = |
| 4890 | { |
| 4891 | { |
| 4892 | -1, |
| 4893 | (gchar *) "value", |
| 4894 | (gchar *) "i", |
| 4895 | NULL |
| 4896 | }, |
| 4897 | FALSE |
| 4898 | }; |
| 4899 | |
| 4900 | static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_get_value_OUT_ARG_pointers[] = |
| 4901 | { |
| 4902 | &_sensor_integer_settable_method_info_get_value_OUT_ARG_value, |
| 4903 | NULL |
| 4904 | }; |
| 4905 | |
| 4906 | static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_get_value = |
| 4907 | { |
| 4908 | { |
| 4909 | -1, |
| 4910 | (gchar *) "getValue", |
| 4911 | NULL, |
| 4912 | (GDBusArgInfo **) &_sensor_integer_settable_method_info_get_value_OUT_ARG_pointers, |
| 4913 | NULL |
| 4914 | }, |
| 4915 | "handle-get-value", |
| 4916 | FALSE |
| 4917 | }; |
| 4918 | |
| 4919 | static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_set_value_IN_ARG_value = |
| 4920 | { |
| 4921 | { |
| 4922 | -1, |
| 4923 | (gchar *) "value", |
| 4924 | (gchar *) "i", |
| 4925 | NULL |
| 4926 | }, |
| 4927 | FALSE |
| 4928 | }; |
| 4929 | |
| 4930 | static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_set_value_IN_ARG_pointers[] = |
| 4931 | { |
| 4932 | &_sensor_integer_settable_method_info_set_value_IN_ARG_value, |
| 4933 | NULL |
| 4934 | }; |
| 4935 | |
| 4936 | static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_set_value = |
| 4937 | { |
| 4938 | { |
| 4939 | -1, |
| 4940 | (gchar *) "setValue", |
| 4941 | (GDBusArgInfo **) &_sensor_integer_settable_method_info_set_value_IN_ARG_pointers, |
| 4942 | NULL, |
| 4943 | NULL |
| 4944 | }, |
| 4945 | "handle-set-value", |
| 4946 | FALSE |
| 4947 | }; |
| 4948 | |
| 4949 | static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_get_units_OUT_ARG_units = |
| 4950 | { |
| 4951 | { |
| 4952 | -1, |
| 4953 | (gchar *) "units", |
| 4954 | (gchar *) "s", |
| 4955 | NULL |
| 4956 | }, |
| 4957 | FALSE |
| 4958 | }; |
| 4959 | |
| 4960 | static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_get_units_OUT_ARG_pointers[] = |
| 4961 | { |
| 4962 | &_sensor_integer_settable_method_info_get_units_OUT_ARG_units, |
| 4963 | NULL |
| 4964 | }; |
| 4965 | |
| 4966 | static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_get_units = |
| 4967 | { |
| 4968 | { |
| 4969 | -1, |
| 4970 | (gchar *) "getUnits", |
| 4971 | NULL, |
| 4972 | (GDBusArgInfo **) &_sensor_integer_settable_method_info_get_units_OUT_ARG_pointers, |
| 4973 | NULL |
| 4974 | }, |
| 4975 | "handle-get-units", |
| 4976 | FALSE |
| 4977 | }; |
| 4978 | |
| 4979 | static const _ExtendedGDBusMethodInfo * const _sensor_integer_settable_method_info_pointers[] = |
| 4980 | { |
| 4981 | &_sensor_integer_settable_method_info_get_value, |
| 4982 | &_sensor_integer_settable_method_info_set_value, |
| 4983 | &_sensor_integer_settable_method_info_get_units, |
| 4984 | NULL |
| 4985 | }; |
| 4986 | |
| 4987 | static const _ExtendedGDBusArgInfo _sensor_integer_settable_signal_info_changed_ARG_value = |
| 4988 | { |
| 4989 | { |
| 4990 | -1, |
| 4991 | (gchar *) "value", |
| 4992 | (gchar *) "i", |
| 4993 | NULL |
| 4994 | }, |
| 4995 | FALSE |
| 4996 | }; |
| 4997 | |
| 4998 | static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_signal_info_changed_ARG_pointers[] = |
| 4999 | { |
| 5000 | &_sensor_integer_settable_signal_info_changed_ARG_value, |
| 5001 | NULL |
| 5002 | }; |
| 5003 | |
| 5004 | static const _ExtendedGDBusSignalInfo _sensor_integer_settable_signal_info_changed = |
| 5005 | { |
| 5006 | { |
| 5007 | -1, |
| 5008 | (gchar *) "Changed", |
| 5009 | (GDBusArgInfo **) &_sensor_integer_settable_signal_info_changed_ARG_pointers, |
| 5010 | NULL |
| 5011 | }, |
| 5012 | "changed" |
| 5013 | }; |
| 5014 | |
| 5015 | static const _ExtendedGDBusSignalInfo * const _sensor_integer_settable_signal_info_pointers[] = |
| 5016 | { |
| 5017 | &_sensor_integer_settable_signal_info_changed, |
| 5018 | NULL |
| 5019 | }; |
| 5020 | |
| 5021 | static const _ExtendedGDBusPropertyInfo _sensor_integer_settable_property_info_value = |
| 5022 | { |
| 5023 | { |
| 5024 | -1, |
| 5025 | (gchar *) "value", |
| 5026 | (gchar *) "i", |
| 5027 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5028 | NULL |
| 5029 | }, |
| 5030 | "value", |
| 5031 | FALSE |
| 5032 | }; |
| 5033 | |
| 5034 | static const _ExtendedGDBusPropertyInfo _sensor_integer_settable_property_info_units = |
| 5035 | { |
| 5036 | { |
| 5037 | -1, |
| 5038 | (gchar *) "units", |
| 5039 | (gchar *) "s", |
| 5040 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5041 | NULL |
| 5042 | }, |
| 5043 | "units", |
| 5044 | FALSE |
| 5045 | }; |
| 5046 | |
| 5047 | static const _ExtendedGDBusPropertyInfo * const _sensor_integer_settable_property_info_pointers[] = |
| 5048 | { |
| 5049 | &_sensor_integer_settable_property_info_value, |
| 5050 | &_sensor_integer_settable_property_info_units, |
| 5051 | NULL |
| 5052 | }; |
| 5053 | |
| 5054 | static const _ExtendedGDBusInterfaceInfo _sensor_integer_settable_interface_info = |
| 5055 | { |
| 5056 | { |
| 5057 | -1, |
| 5058 | (gchar *) "org.openbmc.SensorIntegerSettable", |
| 5059 | (GDBusMethodInfo **) &_sensor_integer_settable_method_info_pointers, |
| 5060 | (GDBusSignalInfo **) &_sensor_integer_settable_signal_info_pointers, |
| 5061 | (GDBusPropertyInfo **) &_sensor_integer_settable_property_info_pointers, |
| 5062 | NULL |
| 5063 | }, |
| 5064 | "sensor-integer-settable", |
| 5065 | }; |
| 5066 | |
| 5067 | |
| 5068 | /** |
| 5069 | * sensor_integer_settable_interface_info: |
| 5070 | * |
| 5071 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> D-Bus interface. |
| 5072 | * |
| 5073 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 5074 | */ |
| 5075 | GDBusInterfaceInfo * |
| 5076 | sensor_integer_settable_interface_info (void) |
| 5077 | { |
| 5078 | return (GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct; |
| 5079 | } |
| 5080 | |
| 5081 | /** |
| 5082 | * sensor_integer_settable_override_properties: |
| 5083 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 5084 | * @property_id_begin: The property id to assign to the first overridden property. |
| 5085 | * |
| 5086 | * Overrides all #GObject properties in the #SensorIntegerSettable interface for a concrete class. |
| 5087 | * The properties are overridden in the order they are defined. |
| 5088 | * |
| 5089 | * Returns: The last property id. |
| 5090 | */ |
| 5091 | guint |
| 5092 | sensor_integer_settable_override_properties (GObjectClass *klass, guint property_id_begin) |
| 5093 | { |
| 5094 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 5095 | g_object_class_override_property (klass, property_id_begin++, "units"); |
| 5096 | return property_id_begin - 1; |
| 5097 | } |
| 5098 | |
| 5099 | |
| 5100 | |
| 5101 | /** |
| 5102 | * SensorIntegerSettable: |
| 5103 | * |
| 5104 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. |
| 5105 | */ |
| 5106 | |
| 5107 | /** |
| 5108 | * SensorIntegerSettableIface: |
| 5109 | * @parent_iface: The parent interface. |
| 5110 | * @handle_get_units: Handler for the #SensorIntegerSettable::handle-get-units signal. |
| 5111 | * @handle_get_value: Handler for the #SensorIntegerSettable::handle-get-value signal. |
| 5112 | * @handle_set_value: Handler for the #SensorIntegerSettable::handle-set-value signal. |
| 5113 | * @get_units: Getter for the #SensorIntegerSettable:units property. |
| 5114 | * @get_value: Getter for the #SensorIntegerSettable:value property. |
| 5115 | * @changed: Handler for the #SensorIntegerSettable::changed signal. |
| 5116 | * |
| 5117 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. |
| 5118 | */ |
| 5119 | |
| 5120 | typedef SensorIntegerSettableIface SensorIntegerSettableInterface; |
| 5121 | G_DEFINE_INTERFACE (SensorIntegerSettable, sensor_integer_settable, G_TYPE_OBJECT); |
| 5122 | |
| 5123 | static void |
| 5124 | sensor_integer_settable_default_init (SensorIntegerSettableIface *iface) |
| 5125 | { |
| 5126 | /* GObject signals for incoming D-Bus method calls: */ |
| 5127 | /** |
| 5128 | * SensorIntegerSettable::handle-get-value: |
| 5129 | * @object: A #SensorIntegerSettable. |
| 5130 | * @invocation: A #GDBusMethodInvocation. |
| 5131 | * |
| 5132 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method. |
| 5133 | * |
| 5134 | * 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_settable_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 5135 | * |
| 5136 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 5137 | */ |
| 5138 | g_signal_new ("handle-get-value", |
| 5139 | G_TYPE_FROM_INTERFACE (iface), |
| 5140 | G_SIGNAL_RUN_LAST, |
| 5141 | G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_get_value), |
| 5142 | g_signal_accumulator_true_handled, |
| 5143 | NULL, |
| 5144 | g_cclosure_marshal_generic, |
| 5145 | G_TYPE_BOOLEAN, |
| 5146 | 1, |
| 5147 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 5148 | |
| 5149 | /** |
| 5150 | * SensorIntegerSettable::handle-set-value: |
| 5151 | * @object: A #SensorIntegerSettable. |
| 5152 | * @invocation: A #GDBusMethodInvocation. |
| 5153 | * @arg_value: Argument passed by remote caller. |
| 5154 | * |
| 5155 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method. |
| 5156 | * |
| 5157 | * 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_settable_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
| 5158 | * |
| 5159 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 5160 | */ |
| 5161 | g_signal_new ("handle-set-value", |
| 5162 | G_TYPE_FROM_INTERFACE (iface), |
| 5163 | G_SIGNAL_RUN_LAST, |
| 5164 | G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_set_value), |
| 5165 | g_signal_accumulator_true_handled, |
| 5166 | NULL, |
| 5167 | g_cclosure_marshal_generic, |
| 5168 | G_TYPE_BOOLEAN, |
| 5169 | 2, |
| 5170 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 5171 | |
| 5172 | /** |
| 5173 | * SensorIntegerSettable::handle-get-units: |
| 5174 | * @object: A #SensorIntegerSettable. |
| 5175 | * @invocation: A #GDBusMethodInvocation. |
| 5176 | * |
| 5177 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method. |
| 5178 | * |
| 5179 | * 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_settable_complete_get_units() 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. |
| 5180 | * |
| 5181 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 5182 | */ |
| 5183 | g_signal_new ("handle-get-units", |
| 5184 | G_TYPE_FROM_INTERFACE (iface), |
| 5185 | G_SIGNAL_RUN_LAST, |
| 5186 | G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_get_units), |
| 5187 | g_signal_accumulator_true_handled, |
| 5188 | NULL, |
| 5189 | g_cclosure_marshal_generic, |
| 5190 | G_TYPE_BOOLEAN, |
| 5191 | 1, |
| 5192 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 5193 | |
| 5194 | /* GObject signals for received D-Bus signals: */ |
| 5195 | /** |
| 5196 | * SensorIntegerSettable::changed: |
| 5197 | * @object: A #SensorIntegerSettable. |
| 5198 | * @arg_value: Argument. |
| 5199 | * |
| 5200 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerSettable.Changed">"Changed"</link> is received. |
| 5201 | * |
| 5202 | * 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. |
| 5203 | */ |
| 5204 | g_signal_new ("changed", |
| 5205 | G_TYPE_FROM_INTERFACE (iface), |
| 5206 | G_SIGNAL_RUN_LAST, |
| 5207 | G_STRUCT_OFFSET (SensorIntegerSettableIface, changed), |
| 5208 | NULL, |
| 5209 | NULL, |
| 5210 | g_cclosure_marshal_generic, |
| 5211 | G_TYPE_NONE, |
| 5212 | 1, G_TYPE_INT); |
| 5213 | |
| 5214 | /* GObject properties for D-Bus properties: */ |
| 5215 | /** |
| 5216 | * SensorIntegerSettable:value: |
| 5217 | * |
| 5218 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link>. |
| 5219 | * |
| 5220 | * 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. |
| 5221 | */ |
| 5222 | g_object_interface_install_property (iface, |
| 5223 | g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5224 | /** |
| 5225 | * SensorIntegerSettable:units: |
| 5226 | * |
| 5227 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link>. |
| 5228 | * |
| 5229 | * 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. |
| 5230 | */ |
| 5231 | g_object_interface_install_property (iface, |
| 5232 | g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5233 | } |
| 5234 | |
| 5235 | /** |
| 5236 | * sensor_integer_settable_get_value: (skip) |
| 5237 | * @object: A #SensorIntegerSettable. |
| 5238 | * |
| 5239 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link> D-Bus property. |
| 5240 | * |
| 5241 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5242 | * |
| 5243 | * Returns: The property value. |
| 5244 | */ |
| 5245 | gint |
| 5246 | sensor_integer_settable_get_value (SensorIntegerSettable *object) |
| 5247 | { |
| 5248 | return SENSOR_INTEGER_SETTABLE_GET_IFACE (object)->get_value (object); |
| 5249 | } |
| 5250 | |
| 5251 | /** |
| 5252 | * sensor_integer_settable_set_value: (skip) |
| 5253 | * @object: A #SensorIntegerSettable. |
| 5254 | * @value: The value to set. |
| 5255 | * |
| 5256 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link> D-Bus property to @value. |
| 5257 | * |
| 5258 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 5259 | */ |
| 5260 | void |
| 5261 | sensor_integer_settable_set_value (SensorIntegerSettable *object, gint value) |
| 5262 | { |
| 5263 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 5264 | } |
| 5265 | |
| 5266 | /** |
| 5267 | * sensor_integer_settable_get_units: (skip) |
| 5268 | * @object: A #SensorIntegerSettable. |
| 5269 | * |
| 5270 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property. |
| 5271 | * |
| 5272 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5273 | * |
| 5274 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_settable_dup_units() if on another thread.</warning> |
| 5275 | * |
| 5276 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5277 | */ |
| 5278 | const gchar * |
| 5279 | sensor_integer_settable_get_units (SensorIntegerSettable *object) |
| 5280 | { |
| 5281 | return SENSOR_INTEGER_SETTABLE_GET_IFACE (object)->get_units (object); |
| 5282 | } |
| 5283 | |
| 5284 | /** |
| 5285 | * sensor_integer_settable_dup_units: (skip) |
| 5286 | * @object: A #SensorIntegerSettable. |
| 5287 | * |
| 5288 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property. |
| 5289 | * |
| 5290 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5291 | * |
| 5292 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 5293 | */ |
| 5294 | gchar * |
| 5295 | sensor_integer_settable_dup_units (SensorIntegerSettable *object) |
| 5296 | { |
| 5297 | gchar *value; |
| 5298 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 5299 | return value; |
| 5300 | } |
| 5301 | |
| 5302 | /** |
| 5303 | * sensor_integer_settable_set_units: (skip) |
| 5304 | * @object: A #SensorIntegerSettable. |
| 5305 | * @value: The value to set. |
| 5306 | * |
| 5307 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property to @value. |
| 5308 | * |
| 5309 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 5310 | */ |
| 5311 | void |
| 5312 | sensor_integer_settable_set_units (SensorIntegerSettable *object, const gchar *value) |
| 5313 | { |
| 5314 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 5315 | } |
| 5316 | |
| 5317 | /** |
| 5318 | * sensor_integer_settable_emit_changed: |
| 5319 | * @object: A #SensorIntegerSettable. |
| 5320 | * @arg_value: Argument to pass with the signal. |
| 5321 | * |
| 5322 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerSettable.Changed">"Changed"</link> D-Bus signal. |
| 5323 | */ |
| 5324 | void |
| 5325 | sensor_integer_settable_emit_changed ( |
| 5326 | SensorIntegerSettable *object, |
| 5327 | gint arg_value) |
| 5328 | { |
| 5329 | g_signal_emit_by_name (object, "changed", arg_value); |
| 5330 | } |
| 5331 | |
| 5332 | /** |
| 5333 | * sensor_integer_settable_call_get_value: |
| 5334 | * @proxy: A #SensorIntegerSettableProxy. |
| 5335 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5336 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 5337 | * @user_data: User data to pass to @callback. |
| 5338 | * |
| 5339 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method on @proxy. |
| 5340 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5341 | * You can then call sensor_integer_settable_call_get_value_finish() to get the result of the operation. |
| 5342 | * |
| 5343 | * See sensor_integer_settable_call_get_value_sync() for the synchronous, blocking version of this method. |
| 5344 | */ |
| 5345 | void |
| 5346 | sensor_integer_settable_call_get_value ( |
| 5347 | SensorIntegerSettable *proxy, |
| 5348 | GCancellable *cancellable, |
| 5349 | GAsyncReadyCallback callback, |
| 5350 | gpointer user_data) |
| 5351 | { |
| 5352 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5353 | "getValue", |
| 5354 | g_variant_new ("()"), |
| 5355 | G_DBUS_CALL_FLAGS_NONE, |
| 5356 | -1, |
| 5357 | cancellable, |
| 5358 | callback, |
| 5359 | user_data); |
| 5360 | } |
| 5361 | |
| 5362 | /** |
| 5363 | * sensor_integer_settable_call_get_value_finish: |
| 5364 | * @proxy: A #SensorIntegerSettableProxy. |
| 5365 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 5366 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_get_value(). |
| 5367 | * @error: Return location for error or %NULL. |
| 5368 | * |
| 5369 | * Finishes an operation started with sensor_integer_settable_call_get_value(). |
| 5370 | * |
| 5371 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5372 | */ |
| 5373 | gboolean |
| 5374 | sensor_integer_settable_call_get_value_finish ( |
| 5375 | SensorIntegerSettable *proxy, |
| 5376 | gint *out_value, |
| 5377 | GAsyncResult *res, |
| 5378 | GError **error) |
| 5379 | { |
| 5380 | GVariant *_ret; |
| 5381 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5382 | if (_ret == NULL) |
| 5383 | goto _out; |
| 5384 | g_variant_get (_ret, |
| 5385 | "(i)", |
| 5386 | out_value); |
| 5387 | g_variant_unref (_ret); |
| 5388 | _out: |
| 5389 | return _ret != NULL; |
| 5390 | } |
| 5391 | |
| 5392 | /** |
| 5393 | * sensor_integer_settable_call_get_value_sync: |
| 5394 | * @proxy: A #SensorIntegerSettableProxy. |
| 5395 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 5396 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5397 | * @error: Return location for error or %NULL. |
| 5398 | * |
| 5399 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 5400 | * |
| 5401 | * See sensor_integer_settable_call_get_value() for the asynchronous version of this method. |
| 5402 | * |
| 5403 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5404 | */ |
| 5405 | gboolean |
| 5406 | sensor_integer_settable_call_get_value_sync ( |
| 5407 | SensorIntegerSettable *proxy, |
| 5408 | gint *out_value, |
| 5409 | GCancellable *cancellable, |
| 5410 | GError **error) |
| 5411 | { |
| 5412 | GVariant *_ret; |
| 5413 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5414 | "getValue", |
| 5415 | g_variant_new ("()"), |
| 5416 | G_DBUS_CALL_FLAGS_NONE, |
| 5417 | -1, |
| 5418 | cancellable, |
| 5419 | error); |
| 5420 | if (_ret == NULL) |
| 5421 | goto _out; |
| 5422 | g_variant_get (_ret, |
| 5423 | "(i)", |
| 5424 | out_value); |
| 5425 | g_variant_unref (_ret); |
| 5426 | _out: |
| 5427 | return _ret != NULL; |
| 5428 | } |
| 5429 | |
| 5430 | /** |
| 5431 | * sensor_integer_settable_call_set_value: |
| 5432 | * @proxy: A #SensorIntegerSettableProxy. |
| 5433 | * @arg_value: Argument to pass with the method invocation. |
| 5434 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5435 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 5436 | * @user_data: User data to pass to @callback. |
| 5437 | * |
| 5438 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method on @proxy. |
| 5439 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5440 | * You can then call sensor_integer_settable_call_set_value_finish() to get the result of the operation. |
| 5441 | * |
| 5442 | * See sensor_integer_settable_call_set_value_sync() for the synchronous, blocking version of this method. |
| 5443 | */ |
| 5444 | void |
| 5445 | sensor_integer_settable_call_set_value ( |
| 5446 | SensorIntegerSettable *proxy, |
| 5447 | gint arg_value, |
| 5448 | GCancellable *cancellable, |
| 5449 | GAsyncReadyCallback callback, |
| 5450 | gpointer user_data) |
| 5451 | { |
| 5452 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5453 | "setValue", |
| 5454 | g_variant_new ("(i)", |
| 5455 | arg_value), |
| 5456 | G_DBUS_CALL_FLAGS_NONE, |
| 5457 | -1, |
| 5458 | cancellable, |
| 5459 | callback, |
| 5460 | user_data); |
| 5461 | } |
| 5462 | |
| 5463 | /** |
| 5464 | * sensor_integer_settable_call_set_value_finish: |
| 5465 | * @proxy: A #SensorIntegerSettableProxy. |
| 5466 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_set_value(). |
| 5467 | * @error: Return location for error or %NULL. |
| 5468 | * |
| 5469 | * Finishes an operation started with sensor_integer_settable_call_set_value(). |
| 5470 | * |
| 5471 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5472 | */ |
| 5473 | gboolean |
| 5474 | sensor_integer_settable_call_set_value_finish ( |
| 5475 | SensorIntegerSettable *proxy, |
| 5476 | GAsyncResult *res, |
| 5477 | GError **error) |
| 5478 | { |
| 5479 | GVariant *_ret; |
| 5480 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5481 | if (_ret == NULL) |
| 5482 | goto _out; |
| 5483 | g_variant_get (_ret, |
| 5484 | "()"); |
| 5485 | g_variant_unref (_ret); |
| 5486 | _out: |
| 5487 | return _ret != NULL; |
| 5488 | } |
| 5489 | |
| 5490 | /** |
| 5491 | * sensor_integer_settable_call_set_value_sync: |
| 5492 | * @proxy: A #SensorIntegerSettableProxy. |
| 5493 | * @arg_value: Argument to pass with the method invocation. |
| 5494 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5495 | * @error: Return location for error or %NULL. |
| 5496 | * |
| 5497 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 5498 | * |
| 5499 | * See sensor_integer_settable_call_set_value() for the asynchronous version of this method. |
| 5500 | * |
| 5501 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5502 | */ |
| 5503 | gboolean |
| 5504 | sensor_integer_settable_call_set_value_sync ( |
| 5505 | SensorIntegerSettable *proxy, |
| 5506 | gint arg_value, |
| 5507 | GCancellable *cancellable, |
| 5508 | GError **error) |
| 5509 | { |
| 5510 | GVariant *_ret; |
| 5511 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5512 | "setValue", |
| 5513 | g_variant_new ("(i)", |
| 5514 | arg_value), |
| 5515 | G_DBUS_CALL_FLAGS_NONE, |
| 5516 | -1, |
| 5517 | cancellable, |
| 5518 | error); |
| 5519 | if (_ret == NULL) |
| 5520 | goto _out; |
| 5521 | g_variant_get (_ret, |
| 5522 | "()"); |
| 5523 | g_variant_unref (_ret); |
| 5524 | _out: |
| 5525 | return _ret != NULL; |
| 5526 | } |
| 5527 | |
| 5528 | /** |
| 5529 | * sensor_integer_settable_call_get_units: |
| 5530 | * @proxy: A #SensorIntegerSettableProxy. |
| 5531 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5532 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 5533 | * @user_data: User data to pass to @callback. |
| 5534 | * |
| 5535 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method on @proxy. |
| 5536 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5537 | * You can then call sensor_integer_settable_call_get_units_finish() to get the result of the operation. |
| 5538 | * |
| 5539 | * See sensor_integer_settable_call_get_units_sync() for the synchronous, blocking version of this method. |
| 5540 | */ |
| 5541 | void |
| 5542 | sensor_integer_settable_call_get_units ( |
| 5543 | SensorIntegerSettable *proxy, |
| 5544 | GCancellable *cancellable, |
| 5545 | GAsyncReadyCallback callback, |
| 5546 | gpointer user_data) |
| 5547 | { |
| 5548 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5549 | "getUnits", |
| 5550 | g_variant_new ("()"), |
| 5551 | G_DBUS_CALL_FLAGS_NONE, |
| 5552 | -1, |
| 5553 | cancellable, |
| 5554 | callback, |
| 5555 | user_data); |
| 5556 | } |
| 5557 | |
| 5558 | /** |
| 5559 | * sensor_integer_settable_call_get_units_finish: |
| 5560 | * @proxy: A #SensorIntegerSettableProxy. |
| 5561 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 5562 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_get_units(). |
| 5563 | * @error: Return location for error or %NULL. |
| 5564 | * |
| 5565 | * Finishes an operation started with sensor_integer_settable_call_get_units(). |
| 5566 | * |
| 5567 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5568 | */ |
| 5569 | gboolean |
| 5570 | sensor_integer_settable_call_get_units_finish ( |
| 5571 | SensorIntegerSettable *proxy, |
| 5572 | gchar **out_units, |
| 5573 | GAsyncResult *res, |
| 5574 | GError **error) |
| 5575 | { |
| 5576 | GVariant *_ret; |
| 5577 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5578 | if (_ret == NULL) |
| 5579 | goto _out; |
| 5580 | g_variant_get (_ret, |
| 5581 | "(s)", |
| 5582 | out_units); |
| 5583 | g_variant_unref (_ret); |
| 5584 | _out: |
| 5585 | return _ret != NULL; |
| 5586 | } |
| 5587 | |
| 5588 | /** |
| 5589 | * sensor_integer_settable_call_get_units_sync: |
| 5590 | * @proxy: A #SensorIntegerSettableProxy. |
| 5591 | * @out_units: (out): Return location for return parameter or %NULL to ignore. |
| 5592 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5593 | * @error: Return location for error or %NULL. |
| 5594 | * |
| 5595 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 5596 | * |
| 5597 | * See sensor_integer_settable_call_get_units() for the asynchronous version of this method. |
| 5598 | * |
| 5599 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 5600 | */ |
| 5601 | gboolean |
| 5602 | sensor_integer_settable_call_get_units_sync ( |
| 5603 | SensorIntegerSettable *proxy, |
| 5604 | gchar **out_units, |
| 5605 | GCancellable *cancellable, |
| 5606 | GError **error) |
| 5607 | { |
| 5608 | GVariant *_ret; |
| 5609 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5610 | "getUnits", |
| 5611 | g_variant_new ("()"), |
| 5612 | G_DBUS_CALL_FLAGS_NONE, |
| 5613 | -1, |
| 5614 | cancellable, |
| 5615 | error); |
| 5616 | if (_ret == NULL) |
| 5617 | goto _out; |
| 5618 | g_variant_get (_ret, |
| 5619 | "(s)", |
| 5620 | out_units); |
| 5621 | g_variant_unref (_ret); |
| 5622 | _out: |
| 5623 | return _ret != NULL; |
| 5624 | } |
| 5625 | |
| 5626 | /** |
| 5627 | * sensor_integer_settable_complete_get_value: |
| 5628 | * @object: A #SensorIntegerSettable. |
| 5629 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5630 | * @value: Parameter to return. |
| 5631 | * |
| 5632 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 5633 | * |
| 5634 | * This method will free @invocation, you cannot use it afterwards. |
| 5635 | */ |
| 5636 | void |
| 5637 | sensor_integer_settable_complete_get_value ( |
| 5638 | SensorIntegerSettable *object, |
| 5639 | GDBusMethodInvocation *invocation, |
| 5640 | gint value) |
| 5641 | { |
| 5642 | g_dbus_method_invocation_return_value (invocation, |
| 5643 | g_variant_new ("(i)", |
| 5644 | value)); |
| 5645 | } |
| 5646 | |
| 5647 | /** |
| 5648 | * sensor_integer_settable_complete_set_value: |
| 5649 | * @object: A #SensorIntegerSettable. |
| 5650 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5651 | * |
| 5652 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
| 5653 | * |
| 5654 | * This method will free @invocation, you cannot use it afterwards. |
| 5655 | */ |
| 5656 | void |
| 5657 | sensor_integer_settable_complete_set_value ( |
| 5658 | SensorIntegerSettable *object, |
| 5659 | GDBusMethodInvocation *invocation) |
| 5660 | { |
| 5661 | g_dbus_method_invocation_return_value (invocation, |
| 5662 | g_variant_new ("()")); |
| 5663 | } |
| 5664 | |
| 5665 | /** |
| 5666 | * sensor_integer_settable_complete_get_units: |
| 5667 | * @object: A #SensorIntegerSettable. |
| 5668 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 5669 | * @units: Parameter to return. |
| 5670 | * |
| 5671 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</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. |
| 5672 | * |
| 5673 | * This method will free @invocation, you cannot use it afterwards. |
| 5674 | */ |
| 5675 | void |
| 5676 | sensor_integer_settable_complete_get_units ( |
| 5677 | SensorIntegerSettable *object, |
| 5678 | GDBusMethodInvocation *invocation, |
| 5679 | const gchar *units) |
| 5680 | { |
| 5681 | g_dbus_method_invocation_return_value (invocation, |
| 5682 | g_variant_new ("(s)", |
| 5683 | units)); |
| 5684 | } |
| 5685 | |
| 5686 | /* ------------------------------------------------------------------------ */ |
| 5687 | |
| 5688 | /** |
| 5689 | * SensorIntegerSettableProxy: |
| 5690 | * |
| 5691 | * The #SensorIntegerSettableProxy structure contains only private data and should only be accessed using the provided API. |
| 5692 | */ |
| 5693 | |
| 5694 | /** |
| 5695 | * SensorIntegerSettableProxyClass: |
| 5696 | * @parent_class: The parent class. |
| 5697 | * |
| 5698 | * Class structure for #SensorIntegerSettableProxy. |
| 5699 | */ |
| 5700 | |
| 5701 | struct _SensorIntegerSettableProxyPrivate |
| 5702 | { |
| 5703 | GData *qdata; |
| 5704 | }; |
| 5705 | |
| 5706 | static void sensor_integer_settable_proxy_iface_init (SensorIntegerSettableIface *iface); |
| 5707 | |
| 5708 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5709 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableProxy, sensor_integer_settable_proxy, G_TYPE_DBUS_PROXY, |
| 5710 | G_ADD_PRIVATE (SensorIntegerSettableProxy) |
| 5711 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_proxy_iface_init)); |
| 5712 | |
| 5713 | #else |
| 5714 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableProxy, sensor_integer_settable_proxy, G_TYPE_DBUS_PROXY, |
| 5715 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_proxy_iface_init)); |
| 5716 | |
| 5717 | #endif |
| 5718 | static void |
| 5719 | sensor_integer_settable_proxy_finalize (GObject *object) |
| 5720 | { |
| 5721 | SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object); |
| 5722 | g_datalist_clear (&proxy->priv->qdata); |
| 5723 | G_OBJECT_CLASS (sensor_integer_settable_proxy_parent_class)->finalize (object); |
| 5724 | } |
| 5725 | |
| 5726 | static void |
| 5727 | sensor_integer_settable_proxy_get_property (GObject *object, |
| 5728 | guint prop_id, |
| 5729 | GValue *value, |
| 5730 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5731 | { |
| 5732 | const _ExtendedGDBusPropertyInfo *info; |
| 5733 | GVariant *variant; |
| 5734 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5735 | info = _sensor_integer_settable_property_info_pointers[prop_id - 1]; |
| 5736 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5737 | if (info->use_gvariant) |
| 5738 | { |
| 5739 | g_value_set_variant (value, variant); |
| 5740 | } |
| 5741 | else |
| 5742 | { |
| 5743 | if (variant != NULL) |
| 5744 | g_dbus_gvariant_to_gvalue (variant, value); |
| 5745 | } |
| 5746 | if (variant != NULL) |
| 5747 | g_variant_unref (variant); |
| 5748 | } |
| 5749 | |
| 5750 | static void |
| 5751 | sensor_integer_settable_proxy_set_property_cb (GDBusProxy *proxy, |
| 5752 | GAsyncResult *res, |
| 5753 | gpointer user_data) |
| 5754 | { |
| 5755 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5756 | GError *error; |
| 5757 | GVariant *_ret; |
| 5758 | error = NULL; |
| 5759 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5760 | if (!_ret) |
| 5761 | { |
| 5762 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerSettable: %s (%s, %d)", |
| 5763 | info->parent_struct.name, |
| 5764 | error->message, g_quark_to_string (error->domain), error->code); |
| 5765 | g_error_free (error); |
| 5766 | } |
| 5767 | else |
| 5768 | { |
| 5769 | g_variant_unref (_ret); |
| 5770 | } |
| 5771 | } |
| 5772 | |
| 5773 | static void |
| 5774 | sensor_integer_settable_proxy_set_property (GObject *object, |
| 5775 | guint prop_id, |
| 5776 | const GValue *value, |
| 5777 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5778 | { |
| 5779 | const _ExtendedGDBusPropertyInfo *info; |
| 5780 | GVariant *variant; |
| 5781 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5782 | info = _sensor_integer_settable_property_info_pointers[prop_id - 1]; |
| 5783 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5784 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5785 | "org.freedesktop.DBus.Properties.Set", |
| 5786 | g_variant_new ("(ssv)", "org.openbmc.SensorIntegerSettable", info->parent_struct.name, variant), |
| 5787 | G_DBUS_CALL_FLAGS_NONE, |
| 5788 | -1, |
| 5789 | NULL, (GAsyncReadyCallback) sensor_integer_settable_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5790 | g_variant_unref (variant); |
| 5791 | } |
| 5792 | |
| 5793 | static void |
| 5794 | sensor_integer_settable_proxy_g_signal (GDBusProxy *proxy, |
| 5795 | const gchar *sender_name G_GNUC_UNUSED, |
| 5796 | const gchar *signal_name, |
| 5797 | GVariant *parameters) |
| 5798 | { |
| 5799 | _ExtendedGDBusSignalInfo *info; |
| 5800 | GVariantIter iter; |
| 5801 | GVariant *child; |
| 5802 | GValue *paramv; |
| 5803 | guint num_params; |
| 5804 | guint n; |
| 5805 | guint signal_id; |
| 5806 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, signal_name); |
| 5807 | if (info == NULL) |
| 5808 | return; |
| 5809 | num_params = g_variant_n_children (parameters); |
| 5810 | paramv = g_new0 (GValue, num_params + 1); |
| 5811 | g_value_init (¶mv[0], TYPE_SENSOR_INTEGER_SETTABLE); |
| 5812 | g_value_set_object (¶mv[0], proxy); |
| 5813 | g_variant_iter_init (&iter, parameters); |
| 5814 | n = 1; |
| 5815 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5816 | { |
| 5817 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5818 | if (arg_info->use_gvariant) |
| 5819 | { |
| 5820 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5821 | g_value_set_variant (¶mv[n], child); |
| 5822 | n++; |
| 5823 | } |
| 5824 | else |
| 5825 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5826 | g_variant_unref (child); |
| 5827 | } |
| 5828 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_SETTABLE); |
| 5829 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5830 | for (n = 0; n < num_params + 1; n++) |
| 5831 | g_value_unset (¶mv[n]); |
| 5832 | g_free (paramv); |
| 5833 | } |
| 5834 | |
| 5835 | static void |
| 5836 | sensor_integer_settable_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5837 | GVariant *changed_properties, |
| 5838 | const gchar *const *invalidated_properties) |
| 5839 | { |
| 5840 | SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (_proxy); |
| 5841 | guint n; |
| 5842 | const gchar *key; |
| 5843 | GVariantIter *iter; |
| 5844 | _ExtendedGDBusPropertyInfo *info; |
| 5845 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 5846 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5847 | { |
| 5848 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, key); |
| 5849 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5850 | if (info != NULL) |
| 5851 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5852 | } |
| 5853 | g_variant_iter_free (iter); |
| 5854 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5855 | { |
| 5856 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, invalidated_properties[n]); |
| 5857 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5858 | if (info != NULL) |
| 5859 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5860 | } |
| 5861 | } |
| 5862 | |
| 5863 | static gint |
| 5864 | sensor_integer_settable_proxy_get_value (SensorIntegerSettable *object) |
| 5865 | { |
| 5866 | SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object); |
| 5867 | GVariant *variant; |
| 5868 | gint value = 0; |
| 5869 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
| 5870 | if (variant != NULL) |
| 5871 | { |
| 5872 | value = g_variant_get_int32 (variant); |
| 5873 | g_variant_unref (variant); |
| 5874 | } |
| 5875 | return value; |
| 5876 | } |
| 5877 | |
| 5878 | static const gchar * |
| 5879 | sensor_integer_settable_proxy_get_units (SensorIntegerSettable *object) |
| 5880 | { |
| 5881 | SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object); |
| 5882 | GVariant *variant; |
| 5883 | const gchar *value = NULL; |
| 5884 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 5885 | if (variant != NULL) |
| 5886 | { |
| 5887 | value = g_variant_get_string (variant, NULL); |
| 5888 | g_variant_unref (variant); |
| 5889 | } |
| 5890 | return value; |
| 5891 | } |
| 5892 | |
| 5893 | static void |
| 5894 | sensor_integer_settable_proxy_init (SensorIntegerSettableProxy *proxy) |
| 5895 | { |
| 5896 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5897 | proxy->priv = sensor_integer_settable_proxy_get_instance_private (proxy); |
| 5898 | #else |
| 5899 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_SETTABLE_PROXY, SensorIntegerSettableProxyPrivate); |
| 5900 | #endif |
| 5901 | |
| 5902 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_settable_interface_info ()); |
| 5903 | } |
| 5904 | |
| 5905 | static void |
| 5906 | sensor_integer_settable_proxy_class_init (SensorIntegerSettableProxyClass *klass) |
| 5907 | { |
| 5908 | GObjectClass *gobject_class; |
| 5909 | GDBusProxyClass *proxy_class; |
| 5910 | |
| 5911 | gobject_class = G_OBJECT_CLASS (klass); |
| 5912 | gobject_class->finalize = sensor_integer_settable_proxy_finalize; |
| 5913 | gobject_class->get_property = sensor_integer_settable_proxy_get_property; |
| 5914 | gobject_class->set_property = sensor_integer_settable_proxy_set_property; |
| 5915 | |
| 5916 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 5917 | proxy_class->g_signal = sensor_integer_settable_proxy_g_signal; |
| 5918 | proxy_class->g_properties_changed = sensor_integer_settable_proxy_g_properties_changed; |
| 5919 | |
| 5920 | sensor_integer_settable_override_properties (gobject_class, 1); |
| 5921 | |
| 5922 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5923 | g_type_class_add_private (klass, sizeof (SensorIntegerSettableProxyPrivate)); |
| 5924 | #endif |
| 5925 | } |
| 5926 | |
| 5927 | static void |
| 5928 | sensor_integer_settable_proxy_iface_init (SensorIntegerSettableIface *iface) |
| 5929 | { |
| 5930 | iface->get_value = sensor_integer_settable_proxy_get_value; |
| 5931 | iface->get_units = sensor_integer_settable_proxy_get_units; |
| 5932 | } |
| 5933 | |
| 5934 | /** |
| 5935 | * sensor_integer_settable_proxy_new: |
| 5936 | * @connection: A #GDBusConnection. |
| 5937 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5938 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5939 | * @object_path: An object path. |
| 5940 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5941 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5942 | * @user_data: User data to pass to @callback. |
| 5943 | * |
| 5944 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. See g_dbus_proxy_new() for more details. |
| 5945 | * |
| 5946 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5947 | * You can then call sensor_integer_settable_proxy_new_finish() to get the result of the operation. |
| 5948 | * |
| 5949 | * See sensor_integer_settable_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 5950 | */ |
| 5951 | void |
| 5952 | sensor_integer_settable_proxy_new ( |
| 5953 | GDBusConnection *connection, |
| 5954 | GDBusProxyFlags flags, |
| 5955 | const gchar *name, |
| 5956 | const gchar *object_path, |
| 5957 | GCancellable *cancellable, |
| 5958 | GAsyncReadyCallback callback, |
| 5959 | gpointer user_data) |
| 5960 | { |
| 5961 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_SETTABLE_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.SensorIntegerSettable", NULL); |
| 5962 | } |
| 5963 | |
| 5964 | /** |
| 5965 | * sensor_integer_settable_proxy_new_finish: |
| 5966 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_proxy_new(). |
| 5967 | * @error: Return location for error or %NULL |
| 5968 | * |
| 5969 | * Finishes an operation started with sensor_integer_settable_proxy_new(). |
| 5970 | * |
| 5971 | * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set. |
| 5972 | */ |
| 5973 | SensorIntegerSettable * |
| 5974 | sensor_integer_settable_proxy_new_finish ( |
| 5975 | GAsyncResult *res, |
| 5976 | GError **error) |
| 5977 | { |
| 5978 | GObject *ret; |
| 5979 | GObject *source_object; |
| 5980 | source_object = g_async_result_get_source_object (res); |
| 5981 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5982 | g_object_unref (source_object); |
| 5983 | if (ret != NULL) |
| 5984 | return SENSOR_INTEGER_SETTABLE (ret); |
| 5985 | else |
| 5986 | return NULL; |
| 5987 | } |
| 5988 | |
| 5989 | /** |
| 5990 | * sensor_integer_settable_proxy_new_sync: |
| 5991 | * @connection: A #GDBusConnection. |
| 5992 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5993 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5994 | * @object_path: An object path. |
| 5995 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5996 | * @error: Return location for error or %NULL |
| 5997 | * |
| 5998 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. See g_dbus_proxy_new_sync() for more details. |
| 5999 | * |
| 6000 | * The calling thread is blocked until a reply is received. |
| 6001 | * |
| 6002 | * See sensor_integer_settable_proxy_new() for the asynchronous version of this constructor. |
| 6003 | * |
| 6004 | * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set. |
| 6005 | */ |
| 6006 | SensorIntegerSettable * |
| 6007 | sensor_integer_settable_proxy_new_sync ( |
| 6008 | GDBusConnection *connection, |
| 6009 | GDBusProxyFlags flags, |
| 6010 | const gchar *name, |
| 6011 | const gchar *object_path, |
| 6012 | GCancellable *cancellable, |
| 6013 | GError **error) |
| 6014 | { |
| 6015 | GInitable *ret; |
| 6016 | ret = g_initable_new (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL); |
| 6017 | if (ret != NULL) |
| 6018 | return SENSOR_INTEGER_SETTABLE (ret); |
| 6019 | else |
| 6020 | return NULL; |
| 6021 | } |
| 6022 | |
| 6023 | |
| 6024 | /** |
| 6025 | * sensor_integer_settable_proxy_new_for_bus: |
| 6026 | * @bus_type: A #GBusType. |
| 6027 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6028 | * @name: A bus name (well-known or unique). |
| 6029 | * @object_path: An object path. |
| 6030 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6031 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 6032 | * @user_data: User data to pass to @callback. |
| 6033 | * |
| 6034 | * Like sensor_integer_settable_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 6035 | * |
| 6036 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 6037 | * You can then call sensor_integer_settable_proxy_new_for_bus_finish() to get the result of the operation. |
| 6038 | * |
| 6039 | * See sensor_integer_settable_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 6040 | */ |
| 6041 | void |
| 6042 | sensor_integer_settable_proxy_new_for_bus ( |
| 6043 | GBusType bus_type, |
| 6044 | GDBusProxyFlags flags, |
| 6045 | const gchar *name, |
| 6046 | const gchar *object_path, |
| 6047 | GCancellable *cancellable, |
| 6048 | GAsyncReadyCallback callback, |
| 6049 | gpointer user_data) |
| 6050 | { |
| 6051 | g_async_initable_new_async (TYPE_SENSOR_INTEGER_SETTABLE_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.SensorIntegerSettable", NULL); |
| 6052 | } |
| 6053 | |
| 6054 | /** |
| 6055 | * sensor_integer_settable_proxy_new_for_bus_finish: |
| 6056 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_proxy_new_for_bus(). |
| 6057 | * @error: Return location for error or %NULL |
| 6058 | * |
| 6059 | * Finishes an operation started with sensor_integer_settable_proxy_new_for_bus(). |
| 6060 | * |
| 6061 | * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set. |
| 6062 | */ |
| 6063 | SensorIntegerSettable * |
| 6064 | sensor_integer_settable_proxy_new_for_bus_finish ( |
| 6065 | GAsyncResult *res, |
| 6066 | GError **error) |
| 6067 | { |
| 6068 | GObject *ret; |
| 6069 | GObject *source_object; |
| 6070 | source_object = g_async_result_get_source_object (res); |
| 6071 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6072 | g_object_unref (source_object); |
| 6073 | if (ret != NULL) |
| 6074 | return SENSOR_INTEGER_SETTABLE (ret); |
| 6075 | else |
| 6076 | return NULL; |
| 6077 | } |
| 6078 | |
| 6079 | /** |
| 6080 | * sensor_integer_settable_proxy_new_for_bus_sync: |
| 6081 | * @bus_type: A #GBusType. |
| 6082 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 6083 | * @name: A bus name (well-known or unique). |
| 6084 | * @object_path: An object path. |
| 6085 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 6086 | * @error: Return location for error or %NULL |
| 6087 | * |
| 6088 | * Like sensor_integer_settable_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 6089 | * |
| 6090 | * The calling thread is blocked until a reply is received. |
| 6091 | * |
| 6092 | * See sensor_integer_settable_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 6093 | * |
| 6094 | * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set. |
| 6095 | */ |
| 6096 | SensorIntegerSettable * |
| 6097 | sensor_integer_settable_proxy_new_for_bus_sync ( |
| 6098 | GBusType bus_type, |
| 6099 | GDBusProxyFlags flags, |
| 6100 | const gchar *name, |
| 6101 | const gchar *object_path, |
| 6102 | GCancellable *cancellable, |
| 6103 | GError **error) |
| 6104 | { |
| 6105 | GInitable *ret; |
| 6106 | ret = g_initable_new (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL); |
| 6107 | if (ret != NULL) |
| 6108 | return SENSOR_INTEGER_SETTABLE (ret); |
| 6109 | else |
| 6110 | return NULL; |
| 6111 | } |
| 6112 | |
| 6113 | |
| 6114 | /* ------------------------------------------------------------------------ */ |
| 6115 | |
| 6116 | /** |
| 6117 | * SensorIntegerSettableSkeleton: |
| 6118 | * |
| 6119 | * The #SensorIntegerSettableSkeleton structure contains only private data and should only be accessed using the provided API. |
| 6120 | */ |
| 6121 | |
| 6122 | /** |
| 6123 | * SensorIntegerSettableSkeletonClass: |
| 6124 | * @parent_class: The parent class. |
| 6125 | * |
| 6126 | * Class structure for #SensorIntegerSettableSkeleton. |
| 6127 | */ |
| 6128 | |
| 6129 | struct _SensorIntegerSettableSkeletonPrivate |
| 6130 | { |
| 6131 | GValue *properties; |
| 6132 | GList *changed_properties; |
| 6133 | GSource *changed_properties_idle_source; |
| 6134 | GMainContext *context; |
| 6135 | GMutex lock; |
| 6136 | }; |
| 6137 | |
| 6138 | static void |
| 6139 | _sensor_integer_settable_skeleton_handle_method_call ( |
| 6140 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6141 | const gchar *sender G_GNUC_UNUSED, |
| 6142 | const gchar *object_path G_GNUC_UNUSED, |
| 6143 | const gchar *interface_name, |
| 6144 | const gchar *method_name, |
| 6145 | GVariant *parameters, |
| 6146 | GDBusMethodInvocation *invocation, |
| 6147 | gpointer user_data) |
| 6148 | { |
| 6149 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data); |
| 6150 | _ExtendedGDBusMethodInfo *info; |
| 6151 | GVariantIter iter; |
| 6152 | GVariant *child; |
| 6153 | GValue *paramv; |
| 6154 | guint num_params; |
| 6155 | guint num_extra; |
| 6156 | guint n; |
| 6157 | guint signal_id; |
| 6158 | GValue return_value = G_VALUE_INIT; |
| 6159 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 6160 | g_assert (info != NULL); |
| 6161 | num_params = g_variant_n_children (parameters); |
| 6162 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 6163 | n = 0; |
| 6164 | g_value_init (¶mv[n], TYPE_SENSOR_INTEGER_SETTABLE); |
| 6165 | g_value_set_object (¶mv[n++], skeleton); |
| 6166 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 6167 | g_value_set_object (¶mv[n++], invocation); |
| 6168 | if (info->pass_fdlist) |
| 6169 | { |
| 6170 | #ifdef G_OS_UNIX |
| 6171 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 6172 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 6173 | #else |
| 6174 | g_assert_not_reached (); |
| 6175 | #endif |
| 6176 | } |
| 6177 | g_variant_iter_init (&iter, parameters); |
| 6178 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 6179 | { |
| 6180 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 6181 | if (arg_info->use_gvariant) |
| 6182 | { |
| 6183 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 6184 | g_value_set_variant (¶mv[n], child); |
| 6185 | n++; |
| 6186 | } |
| 6187 | else |
| 6188 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 6189 | g_variant_unref (child); |
| 6190 | } |
| 6191 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_SETTABLE); |
| 6192 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 6193 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 6194 | if (!g_value_get_boolean (&return_value)) |
| 6195 | 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); |
| 6196 | g_value_unset (&return_value); |
| 6197 | for (n = 0; n < num_params + num_extra; n++) |
| 6198 | g_value_unset (¶mv[n]); |
| 6199 | g_free (paramv); |
| 6200 | } |
| 6201 | |
| 6202 | static GVariant * |
| 6203 | _sensor_integer_settable_skeleton_handle_get_property ( |
| 6204 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6205 | const gchar *sender G_GNUC_UNUSED, |
| 6206 | const gchar *object_path G_GNUC_UNUSED, |
| 6207 | const gchar *interface_name G_GNUC_UNUSED, |
| 6208 | const gchar *property_name, |
| 6209 | GError **error, |
| 6210 | gpointer user_data) |
| 6211 | { |
| 6212 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data); |
| 6213 | GValue value = G_VALUE_INIT; |
| 6214 | GParamSpec *pspec; |
| 6215 | _ExtendedGDBusPropertyInfo *info; |
| 6216 | GVariant *ret; |
| 6217 | ret = NULL; |
| 6218 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, property_name); |
| 6219 | g_assert (info != NULL); |
| 6220 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6221 | if (pspec == NULL) |
| 6222 | { |
| 6223 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6224 | } |
| 6225 | else |
| 6226 | { |
| 6227 | g_value_init (&value, pspec->value_type); |
| 6228 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6229 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6230 | g_value_unset (&value); |
| 6231 | } |
| 6232 | return ret; |
| 6233 | } |
| 6234 | |
| 6235 | static gboolean |
| 6236 | _sensor_integer_settable_skeleton_handle_set_property ( |
| 6237 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6238 | const gchar *sender G_GNUC_UNUSED, |
| 6239 | const gchar *object_path G_GNUC_UNUSED, |
| 6240 | const gchar *interface_name G_GNUC_UNUSED, |
| 6241 | const gchar *property_name, |
| 6242 | GVariant *variant, |
| 6243 | GError **error, |
| 6244 | gpointer user_data) |
| 6245 | { |
| 6246 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data); |
| 6247 | GValue value = G_VALUE_INIT; |
| 6248 | GParamSpec *pspec; |
| 6249 | _ExtendedGDBusPropertyInfo *info; |
| 6250 | gboolean ret; |
| 6251 | ret = FALSE; |
| 6252 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, property_name); |
| 6253 | g_assert (info != NULL); |
| 6254 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6255 | if (pspec == NULL) |
| 6256 | { |
| 6257 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6258 | } |
| 6259 | else |
| 6260 | { |
| 6261 | if (info->use_gvariant) |
| 6262 | g_value_set_variant (&value, variant); |
| 6263 | else |
| 6264 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 6265 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6266 | g_value_unset (&value); |
| 6267 | ret = TRUE; |
| 6268 | } |
| 6269 | return ret; |
| 6270 | } |
| 6271 | |
| 6272 | static const GDBusInterfaceVTable _sensor_integer_settable_skeleton_vtable = |
| 6273 | { |
| 6274 | _sensor_integer_settable_skeleton_handle_method_call, |
| 6275 | _sensor_integer_settable_skeleton_handle_get_property, |
| 6276 | _sensor_integer_settable_skeleton_handle_set_property, |
| 6277 | {NULL} |
| 6278 | }; |
| 6279 | |
| 6280 | static GDBusInterfaceInfo * |
| 6281 | sensor_integer_settable_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6282 | { |
| 6283 | return sensor_integer_settable_interface_info (); |
| 6284 | } |
| 6285 | |
| 6286 | static GDBusInterfaceVTable * |
| 6287 | sensor_integer_settable_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6288 | { |
| 6289 | return (GDBusInterfaceVTable *) &_sensor_integer_settable_skeleton_vtable; |
| 6290 | } |
| 6291 | |
| 6292 | static GVariant * |
| 6293 | sensor_integer_settable_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 6294 | { |
| 6295 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (_skeleton); |
| 6296 | |
| 6297 | GVariantBuilder builder; |
| 6298 | guint n; |
| 6299 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6300 | if (_sensor_integer_settable_interface_info.parent_struct.properties == NULL) |
| 6301 | goto out; |
| 6302 | for (n = 0; _sensor_integer_settable_interface_info.parent_struct.properties[n] != NULL; n++) |
| 6303 | { |
| 6304 | GDBusPropertyInfo *info = _sensor_integer_settable_interface_info.parent_struct.properties[n]; |
| 6305 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 6306 | { |
| 6307 | GVariant *value; |
| 6308 | value = _sensor_integer_settable_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.SensorIntegerSettable", info->name, NULL, skeleton); |
| 6309 | if (value != NULL) |
| 6310 | { |
| 6311 | g_variant_take_ref (value); |
| 6312 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 6313 | g_variant_unref (value); |
| 6314 | } |
| 6315 | } |
| 6316 | } |
| 6317 | out: |
| 6318 | return g_variant_builder_end (&builder); |
| 6319 | } |
| 6320 | |
| 6321 | static gboolean _sensor_integer_settable_emit_changed (gpointer user_data); |
| 6322 | |
| 6323 | static void |
| 6324 | sensor_integer_settable_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 6325 | { |
| 6326 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (_skeleton); |
| 6327 | gboolean emit_changed = FALSE; |
| 6328 | |
| 6329 | g_mutex_lock (&skeleton->priv->lock); |
| 6330 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6331 | { |
| 6332 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6333 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6334 | emit_changed = TRUE; |
| 6335 | } |
| 6336 | g_mutex_unlock (&skeleton->priv->lock); |
| 6337 | |
| 6338 | if (emit_changed) |
| 6339 | _sensor_integer_settable_emit_changed (skeleton); |
| 6340 | } |
| 6341 | |
| 6342 | static void |
| 6343 | _sensor_integer_settable_on_signal_changed ( |
| 6344 | SensorIntegerSettable *object, |
| 6345 | gint arg_value) |
| 6346 | { |
| 6347 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6348 | |
| 6349 | GList *connections, *l; |
| 6350 | GVariant *signal_variant; |
| 6351 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6352 | |
| 6353 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
| 6354 | arg_value)); |
| 6355 | for (l = connections; l != NULL; l = l->next) |
| 6356 | { |
| 6357 | GDBusConnection *connection = l->data; |
| 6358 | g_dbus_connection_emit_signal (connection, |
| 6359 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerSettable", "Changed", |
| 6360 | signal_variant, NULL); |
| 6361 | } |
| 6362 | g_variant_unref (signal_variant); |
| 6363 | g_list_free_full (connections, g_object_unref); |
| 6364 | } |
| 6365 | |
| 6366 | static void sensor_integer_settable_skeleton_iface_init (SensorIntegerSettableIface *iface); |
| 6367 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6368 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableSkeleton, sensor_integer_settable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6369 | G_ADD_PRIVATE (SensorIntegerSettableSkeleton) |
| 6370 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_skeleton_iface_init)); |
| 6371 | |
| 6372 | #else |
| 6373 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableSkeleton, sensor_integer_settable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6374 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_skeleton_iface_init)); |
| 6375 | |
| 6376 | #endif |
| 6377 | static void |
| 6378 | sensor_integer_settable_skeleton_finalize (GObject *object) |
| 6379 | { |
| 6380 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6381 | guint n; |
| 6382 | for (n = 0; n < 2; n++) |
| 6383 | g_value_unset (&skeleton->priv->properties[n]); |
| 6384 | g_free (skeleton->priv->properties); |
| 6385 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6386 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6387 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6388 | g_main_context_unref (skeleton->priv->context); |
| 6389 | g_mutex_clear (&skeleton->priv->lock); |
| 6390 | G_OBJECT_CLASS (sensor_integer_settable_skeleton_parent_class)->finalize (object); |
| 6391 | } |
| 6392 | |
| 6393 | static void |
| 6394 | sensor_integer_settable_skeleton_get_property (GObject *object, |
| 6395 | guint prop_id, |
| 6396 | GValue *value, |
| 6397 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6398 | { |
| 6399 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6400 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6401 | g_mutex_lock (&skeleton->priv->lock); |
| 6402 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 6403 | g_mutex_unlock (&skeleton->priv->lock); |
| 6404 | } |
| 6405 | |
| 6406 | static gboolean |
| 6407 | _sensor_integer_settable_emit_changed (gpointer user_data) |
| 6408 | { |
| 6409 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data); |
| 6410 | GList *l; |
| 6411 | GVariantBuilder builder; |
| 6412 | GVariantBuilder invalidated_builder; |
| 6413 | guint num_changes; |
| 6414 | |
| 6415 | g_mutex_lock (&skeleton->priv->lock); |
| 6416 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6417 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6418 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 6419 | { |
| 6420 | ChangedProperty *cp = l->data; |
| 6421 | GVariant *variant; |
| 6422 | const GValue *cur_value; |
| 6423 | |
| 6424 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 6425 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 6426 | { |
| 6427 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 6428 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 6429 | g_variant_unref (variant); |
| 6430 | num_changes++; |
| 6431 | } |
| 6432 | } |
| 6433 | if (num_changes > 0) |
| 6434 | { |
| 6435 | GList *connections, *ll; |
| 6436 | GVariant *signal_variant; |
| 6437 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerSettable", |
| 6438 | &builder, &invalidated_builder)); |
| 6439 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6440 | for (ll = connections; ll != NULL; ll = ll->next) |
| 6441 | { |
| 6442 | GDBusConnection *connection = ll->data; |
| 6443 | |
| 6444 | g_dbus_connection_emit_signal (connection, |
| 6445 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6446 | "org.freedesktop.DBus.Properties", |
| 6447 | "PropertiesChanged", |
| 6448 | signal_variant, |
| 6449 | NULL); |
| 6450 | } |
| 6451 | g_variant_unref (signal_variant); |
| 6452 | g_list_free_full (connections, g_object_unref); |
| 6453 | } |
| 6454 | else |
| 6455 | { |
| 6456 | g_variant_builder_clear (&builder); |
| 6457 | g_variant_builder_clear (&invalidated_builder); |
| 6458 | } |
| 6459 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6460 | skeleton->priv->changed_properties = NULL; |
| 6461 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6462 | g_mutex_unlock (&skeleton->priv->lock); |
| 6463 | return FALSE; |
| 6464 | } |
| 6465 | |
| 6466 | static void |
| 6467 | _sensor_integer_settable_schedule_emit_changed (SensorIntegerSettableSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6468 | { |
| 6469 | ChangedProperty *cp; |
| 6470 | GList *l; |
| 6471 | cp = NULL; |
| 6472 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 6473 | { |
| 6474 | ChangedProperty *i_cp = l->data; |
| 6475 | if (i_cp->info == info) |
| 6476 | { |
| 6477 | cp = i_cp; |
| 6478 | break; |
| 6479 | } |
| 6480 | } |
| 6481 | if (cp == NULL) |
| 6482 | { |
| 6483 | cp = g_new0 (ChangedProperty, 1); |
| 6484 | cp->prop_id = prop_id; |
| 6485 | cp->info = info; |
| 6486 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 6487 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 6488 | g_value_copy (orig_value, &cp->orig_value); |
| 6489 | } |
| 6490 | } |
| 6491 | |
| 6492 | static void |
| 6493 | sensor_integer_settable_skeleton_notify (GObject *object, |
| 6494 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6495 | { |
| 6496 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6497 | g_mutex_lock (&skeleton->priv->lock); |
| 6498 | if (skeleton->priv->changed_properties != NULL && |
| 6499 | skeleton->priv->changed_properties_idle_source == NULL) |
| 6500 | { |
| 6501 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 6502 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 6503 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_settable_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 6504 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 6505 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 6506 | } |
| 6507 | g_mutex_unlock (&skeleton->priv->lock); |
| 6508 | } |
| 6509 | |
| 6510 | static void |
| 6511 | sensor_integer_settable_skeleton_set_property (GObject *object, |
| 6512 | guint prop_id, |
| 6513 | const GValue *value, |
| 6514 | GParamSpec *pspec) |
| 6515 | { |
| 6516 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6517 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6518 | g_mutex_lock (&skeleton->priv->lock); |
| 6519 | g_object_freeze_notify (object); |
| 6520 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 6521 | { |
| 6522 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 6523 | _sensor_integer_settable_schedule_emit_changed (skeleton, _sensor_integer_settable_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 6524 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 6525 | g_object_notify_by_pspec (object, pspec); |
| 6526 | } |
| 6527 | g_mutex_unlock (&skeleton->priv->lock); |
| 6528 | g_object_thaw_notify (object); |
| 6529 | } |
| 6530 | |
| 6531 | static void |
| 6532 | sensor_integer_settable_skeleton_init (SensorIntegerSettableSkeleton *skeleton) |
| 6533 | { |
| 6534 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6535 | skeleton->priv = sensor_integer_settable_skeleton_get_instance_private (skeleton); |
| 6536 | #else |
| 6537 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SETTABLE_SKELETON, SensorIntegerSettableSkeletonPrivate); |
| 6538 | #endif |
| 6539 | |
| 6540 | g_mutex_init (&skeleton->priv->lock); |
| 6541 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 6542 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 6543 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 6544 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 6545 | } |
| 6546 | |
| 6547 | static gint |
| 6548 | sensor_integer_settable_skeleton_get_value (SensorIntegerSettable *object) |
| 6549 | { |
| 6550 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6551 | gint value; |
| 6552 | g_mutex_lock (&skeleton->priv->lock); |
| 6553 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 6554 | g_mutex_unlock (&skeleton->priv->lock); |
| 6555 | return value; |
| 6556 | } |
| 6557 | |
| 6558 | static const gchar * |
| 6559 | sensor_integer_settable_skeleton_get_units (SensorIntegerSettable *object) |
| 6560 | { |
| 6561 | SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object); |
| 6562 | const gchar *value; |
| 6563 | g_mutex_lock (&skeleton->priv->lock); |
| 6564 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 6565 | g_mutex_unlock (&skeleton->priv->lock); |
| 6566 | return value; |
| 6567 | } |
| 6568 | |
| 6569 | static void |
| 6570 | sensor_integer_settable_skeleton_class_init (SensorIntegerSettableSkeletonClass *klass) |
| 6571 | { |
| 6572 | GObjectClass *gobject_class; |
| 6573 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 6574 | |
| 6575 | gobject_class = G_OBJECT_CLASS (klass); |
| 6576 | gobject_class->finalize = sensor_integer_settable_skeleton_finalize; |
| 6577 | gobject_class->get_property = sensor_integer_settable_skeleton_get_property; |
| 6578 | gobject_class->set_property = sensor_integer_settable_skeleton_set_property; |
| 6579 | gobject_class->notify = sensor_integer_settable_skeleton_notify; |
| 6580 | |
| 6581 | |
| 6582 | sensor_integer_settable_override_properties (gobject_class, 1); |
| 6583 | |
| 6584 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 6585 | skeleton_class->get_info = sensor_integer_settable_skeleton_dbus_interface_get_info; |
| 6586 | skeleton_class->get_properties = sensor_integer_settable_skeleton_dbus_interface_get_properties; |
| 6587 | skeleton_class->flush = sensor_integer_settable_skeleton_dbus_interface_flush; |
| 6588 | skeleton_class->get_vtable = sensor_integer_settable_skeleton_dbus_interface_get_vtable; |
| 6589 | |
| 6590 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6591 | g_type_class_add_private (klass, sizeof (SensorIntegerSettableSkeletonPrivate)); |
| 6592 | #endif |
| 6593 | } |
| 6594 | |
| 6595 | static void |
| 6596 | sensor_integer_settable_skeleton_iface_init (SensorIntegerSettableIface *iface) |
| 6597 | { |
| 6598 | iface->changed = _sensor_integer_settable_on_signal_changed; |
| 6599 | iface->get_value = sensor_integer_settable_skeleton_get_value; |
| 6600 | iface->get_units = sensor_integer_settable_skeleton_get_units; |
| 6601 | } |
| 6602 | |
| 6603 | /** |
| 6604 | * sensor_integer_settable_skeleton_new: |
| 6605 | * |
| 6606 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. |
| 6607 | * |
| 6608 | * Returns: (transfer full) (type SensorIntegerSettableSkeleton): The skeleton object. |
| 6609 | */ |
| 6610 | SensorIntegerSettable * |
| 6611 | sensor_integer_settable_skeleton_new (void) |
| 6612 | { |
| 6613 | return SENSOR_INTEGER_SETTABLE (g_object_new (TYPE_SENSOR_INTEGER_SETTABLE_SKELETON, NULL)); |
| 6614 | } |
| 6615 | |
| 6616 | /* ------------------------------------------------------------------------ |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 6617 | * Code for interface org.openbmc.SensorIntegerThreshold |
| 6618 | * ------------------------------------------------------------------------ |
| 6619 | */ |
| 6620 | |
| 6621 | /** |
| 6622 | * SECTION:SensorIntegerThreshold |
| 6623 | * @title: SensorIntegerThreshold |
| 6624 | * @short_description: Generated C code for the org.openbmc.SensorIntegerThreshold D-Bus interface |
| 6625 | * |
| 6626 | * 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. |
| 6627 | */ |
| 6628 | |
| 6629 | /* ---- Introspection data for org.openbmc.SensorIntegerThreshold ---- */ |
| 6630 | |
| 6631 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_check_IN_ARG_value = |
| 6632 | { |
| 6633 | { |
| 6634 | -1, |
| 6635 | (gchar *) "value", |
| 6636 | (gchar *) "i", |
| 6637 | NULL |
| 6638 | }, |
| 6639 | FALSE |
| 6640 | }; |
| 6641 | |
| 6642 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_check_IN_ARG_pointers[] = |
| 6643 | { |
| 6644 | &_sensor_integer_threshold_method_info_check_IN_ARG_value, |
| 6645 | NULL |
| 6646 | }; |
| 6647 | |
| 6648 | static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_check = |
| 6649 | { |
| 6650 | { |
| 6651 | -1, |
| 6652 | (gchar *) "check", |
| 6653 | (GDBusArgInfo **) &_sensor_integer_threshold_method_info_check_IN_ARG_pointers, |
| 6654 | NULL, |
| 6655 | NULL |
| 6656 | }, |
| 6657 | "handle-check", |
| 6658 | FALSE |
| 6659 | }; |
| 6660 | |
| 6661 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_upper = |
| 6662 | { |
| 6663 | { |
| 6664 | -1, |
| 6665 | (gchar *) "critical_upper", |
| 6666 | (gchar *) "i", |
| 6667 | NULL |
| 6668 | }, |
| 6669 | FALSE |
| 6670 | }; |
| 6671 | |
| 6672 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_lower = |
| 6673 | { |
| 6674 | { |
| 6675 | -1, |
| 6676 | (gchar *) "critical_lower", |
| 6677 | (gchar *) "i", |
| 6678 | NULL |
| 6679 | }, |
| 6680 | FALSE |
| 6681 | }; |
| 6682 | |
| 6683 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_upper = |
| 6684 | { |
| 6685 | { |
| 6686 | -1, |
| 6687 | (gchar *) "warning_upper", |
| 6688 | (gchar *) "i", |
| 6689 | NULL |
| 6690 | }, |
| 6691 | FALSE |
| 6692 | }; |
| 6693 | |
| 6694 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_lower = |
| 6695 | { |
| 6696 | { |
| 6697 | -1, |
| 6698 | (gchar *) "warning_lower", |
| 6699 | (gchar *) "i", |
| 6700 | NULL |
| 6701 | }, |
| 6702 | FALSE |
| 6703 | }; |
| 6704 | |
| 6705 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers[] = |
| 6706 | { |
| 6707 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_upper, |
| 6708 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_lower, |
| 6709 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_upper, |
| 6710 | &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_lower, |
| 6711 | NULL |
| 6712 | }; |
| 6713 | |
| 6714 | static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_set_thresholds = |
| 6715 | { |
| 6716 | { |
| 6717 | -1, |
| 6718 | (gchar *) "setThresholds", |
| 6719 | (GDBusArgInfo **) &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers, |
| 6720 | NULL, |
| 6721 | NULL |
| 6722 | }, |
| 6723 | "handle-set-thresholds", |
| 6724 | FALSE |
| 6725 | }; |
| 6726 | |
| 6727 | static const _ExtendedGDBusMethodInfo * const _sensor_integer_threshold_method_info_pointers[] = |
| 6728 | { |
| 6729 | &_sensor_integer_threshold_method_info_check, |
| 6730 | &_sensor_integer_threshold_method_info_set_thresholds, |
| 6731 | NULL |
| 6732 | }; |
| 6733 | |
| 6734 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_signal_info_critical_ARG_over = |
| 6735 | { |
| 6736 | { |
| 6737 | -1, |
| 6738 | (gchar *) "over", |
| 6739 | (gchar *) "b", |
| 6740 | NULL |
| 6741 | }, |
| 6742 | FALSE |
| 6743 | }; |
| 6744 | |
| 6745 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_signal_info_critical_ARG_pointers[] = |
| 6746 | { |
| 6747 | &_sensor_integer_threshold_signal_info_critical_ARG_over, |
| 6748 | NULL |
| 6749 | }; |
| 6750 | |
| 6751 | static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_critical = |
| 6752 | { |
| 6753 | { |
| 6754 | -1, |
| 6755 | (gchar *) "critical", |
| 6756 | (GDBusArgInfo **) &_sensor_integer_threshold_signal_info_critical_ARG_pointers, |
| 6757 | NULL |
| 6758 | }, |
| 6759 | "critical" |
| 6760 | }; |
| 6761 | |
| 6762 | static const _ExtendedGDBusArgInfo _sensor_integer_threshold_signal_info_warning_ARG_over = |
| 6763 | { |
| 6764 | { |
| 6765 | -1, |
| 6766 | (gchar *) "over", |
| 6767 | (gchar *) "b", |
| 6768 | NULL |
| 6769 | }, |
| 6770 | FALSE |
| 6771 | }; |
| 6772 | |
| 6773 | static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_signal_info_warning_ARG_pointers[] = |
| 6774 | { |
| 6775 | &_sensor_integer_threshold_signal_info_warning_ARG_over, |
| 6776 | NULL |
| 6777 | }; |
| 6778 | |
| 6779 | static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_warning = |
| 6780 | { |
| 6781 | { |
| 6782 | -1, |
| 6783 | (gchar *) "warning", |
| 6784 | (GDBusArgInfo **) &_sensor_integer_threshold_signal_info_warning_ARG_pointers, |
| 6785 | NULL |
| 6786 | }, |
| 6787 | "warning" |
| 6788 | }; |
| 6789 | |
| 6790 | static const _ExtendedGDBusSignalInfo * const _sensor_integer_threshold_signal_info_pointers[] = |
| 6791 | { |
| 6792 | &_sensor_integer_threshold_signal_info_critical, |
| 6793 | &_sensor_integer_threshold_signal_info_warning, |
| 6794 | NULL |
| 6795 | }; |
| 6796 | |
| 6797 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_critical_upper = |
| 6798 | { |
| 6799 | { |
| 6800 | -1, |
| 6801 | (gchar *) "critical_upper", |
| 6802 | (gchar *) "i", |
| 6803 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 6804 | NULL |
| 6805 | }, |
| 6806 | "critical-upper", |
| 6807 | FALSE |
| 6808 | }; |
| 6809 | |
| 6810 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_critical_lower = |
| 6811 | { |
| 6812 | { |
| 6813 | -1, |
| 6814 | (gchar *) "critical_lower", |
| 6815 | (gchar *) "i", |
| 6816 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 6817 | NULL |
| 6818 | }, |
| 6819 | "critical-lower", |
| 6820 | FALSE |
| 6821 | }; |
| 6822 | |
| 6823 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_warning_upper = |
| 6824 | { |
| 6825 | { |
| 6826 | -1, |
| 6827 | (gchar *) "warning_upper", |
| 6828 | (gchar *) "i", |
| 6829 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 6830 | NULL |
| 6831 | }, |
| 6832 | "warning-upper", |
| 6833 | FALSE |
| 6834 | }; |
| 6835 | |
| 6836 | static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_warning_lower = |
| 6837 | { |
| 6838 | { |
| 6839 | -1, |
| 6840 | (gchar *) "warning_lower", |
| 6841 | (gchar *) "i", |
| 6842 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 6843 | NULL |
| 6844 | }, |
| 6845 | "warning-lower", |
| 6846 | FALSE |
| 6847 | }; |
| 6848 | |
| 6849 | static const _ExtendedGDBusPropertyInfo * const _sensor_integer_threshold_property_info_pointers[] = |
| 6850 | { |
| 6851 | &_sensor_integer_threshold_property_info_critical_upper, |
| 6852 | &_sensor_integer_threshold_property_info_critical_lower, |
| 6853 | &_sensor_integer_threshold_property_info_warning_upper, |
| 6854 | &_sensor_integer_threshold_property_info_warning_lower, |
| 6855 | NULL |
| 6856 | }; |
| 6857 | |
| 6858 | static const _ExtendedGDBusInterfaceInfo _sensor_integer_threshold_interface_info = |
| 6859 | { |
| 6860 | { |
| 6861 | -1, |
| 6862 | (gchar *) "org.openbmc.SensorIntegerThreshold", |
| 6863 | (GDBusMethodInfo **) &_sensor_integer_threshold_method_info_pointers, |
| 6864 | (GDBusSignalInfo **) &_sensor_integer_threshold_signal_info_pointers, |
| 6865 | (GDBusPropertyInfo **) &_sensor_integer_threshold_property_info_pointers, |
| 6866 | NULL |
| 6867 | }, |
| 6868 | "sensor-integer-threshold", |
| 6869 | }; |
| 6870 | |
| 6871 | |
| 6872 | /** |
| 6873 | * sensor_integer_threshold_interface_info: |
| 6874 | * |
| 6875 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface. |
| 6876 | * |
| 6877 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 6878 | */ |
| 6879 | GDBusInterfaceInfo * |
| 6880 | sensor_integer_threshold_interface_info (void) |
| 6881 | { |
| 6882 | return (GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct; |
| 6883 | } |
| 6884 | |
| 6885 | /** |
| 6886 | * sensor_integer_threshold_override_properties: |
| 6887 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 6888 | * @property_id_begin: The property id to assign to the first overridden property. |
| 6889 | * |
| 6890 | * Overrides all #GObject properties in the #SensorIntegerThreshold interface for a concrete class. |
| 6891 | * The properties are overridden in the order they are defined. |
| 6892 | * |
| 6893 | * Returns: The last property id. |
| 6894 | */ |
| 6895 | guint |
| 6896 | sensor_integer_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
| 6897 | { |
| 6898 | g_object_class_override_property (klass, property_id_begin++, "critical-upper"); |
| 6899 | g_object_class_override_property (klass, property_id_begin++, "critical-lower"); |
| 6900 | g_object_class_override_property (klass, property_id_begin++, "warning-upper"); |
| 6901 | g_object_class_override_property (klass, property_id_begin++, "warning-lower"); |
| 6902 | return property_id_begin - 1; |
| 6903 | } |
| 6904 | |
| 6905 | |
| 6906 | |
| 6907 | /** |
| 6908 | * SensorIntegerThreshold: |
| 6909 | * |
| 6910 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 6911 | */ |
| 6912 | |
| 6913 | /** |
| 6914 | * SensorIntegerThresholdIface: |
| 6915 | * @parent_iface: The parent interface. |
| 6916 | * @handle_check: Handler for the #SensorIntegerThreshold::handle-check signal. |
| 6917 | * @handle_set_thresholds: Handler for the #SensorIntegerThreshold::handle-set-thresholds signal. |
| 6918 | * @get_critical_lower: Getter for the #SensorIntegerThreshold:critical-lower property. |
| 6919 | * @get_critical_upper: Getter for the #SensorIntegerThreshold:critical-upper property. |
| 6920 | * @get_warning_lower: Getter for the #SensorIntegerThreshold:warning-lower property. |
| 6921 | * @get_warning_upper: Getter for the #SensorIntegerThreshold:warning-upper property. |
| 6922 | * @critical: Handler for the #SensorIntegerThreshold::critical signal. |
| 6923 | * @warning: Handler for the #SensorIntegerThreshold::warning signal. |
| 6924 | * |
| 6925 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 6926 | */ |
| 6927 | |
| 6928 | typedef SensorIntegerThresholdIface SensorIntegerThresholdInterface; |
| 6929 | G_DEFINE_INTERFACE (SensorIntegerThreshold, sensor_integer_threshold, G_TYPE_OBJECT); |
| 6930 | |
| 6931 | static void |
| 6932 | sensor_integer_threshold_default_init (SensorIntegerThresholdIface *iface) |
| 6933 | { |
| 6934 | /* GObject signals for incoming D-Bus method calls: */ |
| 6935 | /** |
| 6936 | * SensorIntegerThreshold::handle-check: |
| 6937 | * @object: A #SensorIntegerThreshold. |
| 6938 | * @invocation: A #GDBusMethodInvocation. |
| 6939 | * @arg_value: Argument passed by remote caller. |
| 6940 | * |
| 6941 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method. |
| 6942 | * |
| 6943 | * 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_check() 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. |
| 6944 | * |
| 6945 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 6946 | */ |
| 6947 | g_signal_new ("handle-check", |
| 6948 | G_TYPE_FROM_INTERFACE (iface), |
| 6949 | G_SIGNAL_RUN_LAST, |
| 6950 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_check), |
| 6951 | g_signal_accumulator_true_handled, |
| 6952 | NULL, |
| 6953 | g_cclosure_marshal_generic, |
| 6954 | G_TYPE_BOOLEAN, |
| 6955 | 2, |
| 6956 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); |
| 6957 | |
| 6958 | /** |
| 6959 | * SensorIntegerThreshold::handle-set-thresholds: |
| 6960 | * @object: A #SensorIntegerThreshold. |
| 6961 | * @invocation: A #GDBusMethodInvocation. |
| 6962 | * @arg_critical_upper: Argument passed by remote caller. |
| 6963 | * @arg_critical_lower: Argument passed by remote caller. |
| 6964 | * @arg_warning_upper: Argument passed by remote caller. |
| 6965 | * @arg_warning_lower: Argument passed by remote caller. |
| 6966 | * |
| 6967 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method. |
| 6968 | * |
| 6969 | * 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. |
| 6970 | * |
| 6971 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 6972 | */ |
| 6973 | g_signal_new ("handle-set-thresholds", |
| 6974 | G_TYPE_FROM_INTERFACE (iface), |
| 6975 | G_SIGNAL_RUN_LAST, |
| 6976 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_set_thresholds), |
| 6977 | g_signal_accumulator_true_handled, |
| 6978 | NULL, |
| 6979 | g_cclosure_marshal_generic, |
| 6980 | G_TYPE_BOOLEAN, |
| 6981 | 5, |
| 6982 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); |
| 6983 | |
| 6984 | /* GObject signals for received D-Bus signals: */ |
| 6985 | /** |
| 6986 | * SensorIntegerThreshold::critical: |
| 6987 | * @object: A #SensorIntegerThreshold. |
| 6988 | * @arg_over: Argument. |
| 6989 | * |
| 6990 | * 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. |
| 6991 | * |
| 6992 | * 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. |
| 6993 | */ |
| 6994 | g_signal_new ("critical", |
| 6995 | G_TYPE_FROM_INTERFACE (iface), |
| 6996 | G_SIGNAL_RUN_LAST, |
| 6997 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, critical), |
| 6998 | NULL, |
| 6999 | NULL, |
| 7000 | g_cclosure_marshal_generic, |
| 7001 | G_TYPE_NONE, |
| 7002 | 1, G_TYPE_BOOLEAN); |
| 7003 | |
| 7004 | /** |
| 7005 | * SensorIntegerThreshold::warning: |
| 7006 | * @object: A #SensorIntegerThreshold. |
| 7007 | * @arg_over: Argument. |
| 7008 | * |
| 7009 | * 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. |
| 7010 | * |
| 7011 | * 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. |
| 7012 | */ |
| 7013 | g_signal_new ("warning", |
| 7014 | G_TYPE_FROM_INTERFACE (iface), |
| 7015 | G_SIGNAL_RUN_LAST, |
| 7016 | G_STRUCT_OFFSET (SensorIntegerThresholdIface, warning), |
| 7017 | NULL, |
| 7018 | NULL, |
| 7019 | g_cclosure_marshal_generic, |
| 7020 | G_TYPE_NONE, |
| 7021 | 1, G_TYPE_BOOLEAN); |
| 7022 | |
| 7023 | /* GObject properties for D-Bus properties: */ |
| 7024 | /** |
| 7025 | * SensorIntegerThreshold:critical-upper: |
| 7026 | * |
| 7027 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link>. |
| 7028 | * |
| 7029 | * 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. |
| 7030 | */ |
| 7031 | g_object_interface_install_property (iface, |
| 7032 | g_param_spec_int ("critical-upper", "critical_upper", "critical_upper", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7033 | /** |
| 7034 | * SensorIntegerThreshold:critical-lower: |
| 7035 | * |
| 7036 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link>. |
| 7037 | * |
| 7038 | * 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. |
| 7039 | */ |
| 7040 | g_object_interface_install_property (iface, |
| 7041 | g_param_spec_int ("critical-lower", "critical_lower", "critical_lower", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7042 | /** |
| 7043 | * SensorIntegerThreshold:warning-upper: |
| 7044 | * |
| 7045 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link>. |
| 7046 | * |
| 7047 | * 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. |
| 7048 | */ |
| 7049 | g_object_interface_install_property (iface, |
| 7050 | g_param_spec_int ("warning-upper", "warning_upper", "warning_upper", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7051 | /** |
| 7052 | * SensorIntegerThreshold:warning-lower: |
| 7053 | * |
| 7054 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link>. |
| 7055 | * |
| 7056 | * 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. |
| 7057 | */ |
| 7058 | g_object_interface_install_property (iface, |
| 7059 | g_param_spec_int ("warning-lower", "warning_lower", "warning_lower", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 7060 | } |
| 7061 | |
| 7062 | /** |
| 7063 | * sensor_integer_threshold_get_critical_upper: (skip) |
| 7064 | * @object: A #SensorIntegerThreshold. |
| 7065 | * |
| 7066 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link> D-Bus property. |
| 7067 | * |
| 7068 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7069 | * |
| 7070 | * Returns: The property value. |
| 7071 | */ |
| 7072 | gint |
| 7073 | sensor_integer_threshold_get_critical_upper (SensorIntegerThreshold *object) |
| 7074 | { |
| 7075 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_critical_upper (object); |
| 7076 | } |
| 7077 | |
| 7078 | /** |
| 7079 | * sensor_integer_threshold_set_critical_upper: (skip) |
| 7080 | * @object: A #SensorIntegerThreshold. |
| 7081 | * @value: The value to set. |
| 7082 | * |
| 7083 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link> D-Bus property to @value. |
| 7084 | * |
| 7085 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7086 | */ |
| 7087 | void |
| 7088 | sensor_integer_threshold_set_critical_upper (SensorIntegerThreshold *object, gint value) |
| 7089 | { |
| 7090 | g_object_set (G_OBJECT (object), "critical-upper", value, NULL); |
| 7091 | } |
| 7092 | |
| 7093 | /** |
| 7094 | * sensor_integer_threshold_get_critical_lower: (skip) |
| 7095 | * @object: A #SensorIntegerThreshold. |
| 7096 | * |
| 7097 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link> D-Bus property. |
| 7098 | * |
| 7099 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7100 | * |
| 7101 | * Returns: The property value. |
| 7102 | */ |
| 7103 | gint |
| 7104 | sensor_integer_threshold_get_critical_lower (SensorIntegerThreshold *object) |
| 7105 | { |
| 7106 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_critical_lower (object); |
| 7107 | } |
| 7108 | |
| 7109 | /** |
| 7110 | * sensor_integer_threshold_set_critical_lower: (skip) |
| 7111 | * @object: A #SensorIntegerThreshold. |
| 7112 | * @value: The value to set. |
| 7113 | * |
| 7114 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link> D-Bus property to @value. |
| 7115 | * |
| 7116 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7117 | */ |
| 7118 | void |
| 7119 | sensor_integer_threshold_set_critical_lower (SensorIntegerThreshold *object, gint value) |
| 7120 | { |
| 7121 | g_object_set (G_OBJECT (object), "critical-lower", value, NULL); |
| 7122 | } |
| 7123 | |
| 7124 | /** |
| 7125 | * sensor_integer_threshold_get_warning_upper: (skip) |
| 7126 | * @object: A #SensorIntegerThreshold. |
| 7127 | * |
| 7128 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link> D-Bus property. |
| 7129 | * |
| 7130 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7131 | * |
| 7132 | * Returns: The property value. |
| 7133 | */ |
| 7134 | gint |
| 7135 | sensor_integer_threshold_get_warning_upper (SensorIntegerThreshold *object) |
| 7136 | { |
| 7137 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_warning_upper (object); |
| 7138 | } |
| 7139 | |
| 7140 | /** |
| 7141 | * sensor_integer_threshold_set_warning_upper: (skip) |
| 7142 | * @object: A #SensorIntegerThreshold. |
| 7143 | * @value: The value to set. |
| 7144 | * |
| 7145 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link> D-Bus property to @value. |
| 7146 | * |
| 7147 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7148 | */ |
| 7149 | void |
| 7150 | sensor_integer_threshold_set_warning_upper (SensorIntegerThreshold *object, gint value) |
| 7151 | { |
| 7152 | g_object_set (G_OBJECT (object), "warning-upper", value, NULL); |
| 7153 | } |
| 7154 | |
| 7155 | /** |
| 7156 | * sensor_integer_threshold_get_warning_lower: (skip) |
| 7157 | * @object: A #SensorIntegerThreshold. |
| 7158 | * |
| 7159 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link> D-Bus property. |
| 7160 | * |
| 7161 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 7162 | * |
| 7163 | * Returns: The property value. |
| 7164 | */ |
| 7165 | gint |
| 7166 | sensor_integer_threshold_get_warning_lower (SensorIntegerThreshold *object) |
| 7167 | { |
| 7168 | return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_warning_lower (object); |
| 7169 | } |
| 7170 | |
| 7171 | /** |
| 7172 | * sensor_integer_threshold_set_warning_lower: (skip) |
| 7173 | * @object: A #SensorIntegerThreshold. |
| 7174 | * @value: The value to set. |
| 7175 | * |
| 7176 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link> D-Bus property to @value. |
| 7177 | * |
| 7178 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 7179 | */ |
| 7180 | void |
| 7181 | sensor_integer_threshold_set_warning_lower (SensorIntegerThreshold *object, gint value) |
| 7182 | { |
| 7183 | g_object_set (G_OBJECT (object), "warning-lower", value, NULL); |
| 7184 | } |
| 7185 | |
| 7186 | /** |
| 7187 | * sensor_integer_threshold_emit_critical: |
| 7188 | * @object: A #SensorIntegerThreshold. |
| 7189 | * @arg_over: Argument to pass with the signal. |
| 7190 | * |
| 7191 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.critical">"critical"</link> D-Bus signal. |
| 7192 | */ |
| 7193 | void |
| 7194 | sensor_integer_threshold_emit_critical ( |
| 7195 | SensorIntegerThreshold *object, |
| 7196 | gboolean arg_over) |
| 7197 | { |
| 7198 | g_signal_emit_by_name (object, "critical", arg_over); |
| 7199 | } |
| 7200 | |
| 7201 | /** |
| 7202 | * sensor_integer_threshold_emit_warning: |
| 7203 | * @object: A #SensorIntegerThreshold. |
| 7204 | * @arg_over: Argument to pass with the signal. |
| 7205 | * |
| 7206 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.warning">"warning"</link> D-Bus signal. |
| 7207 | */ |
| 7208 | void |
| 7209 | sensor_integer_threshold_emit_warning ( |
| 7210 | SensorIntegerThreshold *object, |
| 7211 | gboolean arg_over) |
| 7212 | { |
| 7213 | g_signal_emit_by_name (object, "warning", arg_over); |
| 7214 | } |
| 7215 | |
| 7216 | /** |
| 7217 | * sensor_integer_threshold_call_check: |
| 7218 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7219 | * @arg_value: Argument to pass with the method invocation. |
| 7220 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7221 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 7222 | * @user_data: User data to pass to @callback. |
| 7223 | * |
| 7224 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method on @proxy. |
| 7225 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7226 | * You can then call sensor_integer_threshold_call_check_finish() to get the result of the operation. |
| 7227 | * |
| 7228 | * See sensor_integer_threshold_call_check_sync() for the synchronous, blocking version of this method. |
| 7229 | */ |
| 7230 | void |
| 7231 | sensor_integer_threshold_call_check ( |
| 7232 | SensorIntegerThreshold *proxy, |
| 7233 | gint arg_value, |
| 7234 | GCancellable *cancellable, |
| 7235 | GAsyncReadyCallback callback, |
| 7236 | gpointer user_data) |
| 7237 | { |
| 7238 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 7239 | "check", |
| 7240 | g_variant_new ("(i)", |
| 7241 | arg_value), |
| 7242 | G_DBUS_CALL_FLAGS_NONE, |
| 7243 | -1, |
| 7244 | cancellable, |
| 7245 | callback, |
| 7246 | user_data); |
| 7247 | } |
| 7248 | |
| 7249 | /** |
| 7250 | * sensor_integer_threshold_call_check_finish: |
| 7251 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7252 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_check(). |
| 7253 | * @error: Return location for error or %NULL. |
| 7254 | * |
| 7255 | * Finishes an operation started with sensor_integer_threshold_call_check(). |
| 7256 | * |
| 7257 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 7258 | */ |
| 7259 | gboolean |
| 7260 | sensor_integer_threshold_call_check_finish ( |
| 7261 | SensorIntegerThreshold *proxy, |
| 7262 | GAsyncResult *res, |
| 7263 | GError **error) |
| 7264 | { |
| 7265 | GVariant *_ret; |
| 7266 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 7267 | if (_ret == NULL) |
| 7268 | goto _out; |
| 7269 | g_variant_get (_ret, |
| 7270 | "()"); |
| 7271 | g_variant_unref (_ret); |
| 7272 | _out: |
| 7273 | return _ret != NULL; |
| 7274 | } |
| 7275 | |
| 7276 | /** |
| 7277 | * sensor_integer_threshold_call_check_sync: |
| 7278 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7279 | * @arg_value: Argument to pass with the method invocation. |
| 7280 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7281 | * @error: Return location for error or %NULL. |
| 7282 | * |
| 7283 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
| 7284 | * |
| 7285 | * See sensor_integer_threshold_call_check() for the asynchronous version of this method. |
| 7286 | * |
| 7287 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 7288 | */ |
| 7289 | gboolean |
| 7290 | sensor_integer_threshold_call_check_sync ( |
| 7291 | SensorIntegerThreshold *proxy, |
| 7292 | gint arg_value, |
| 7293 | GCancellable *cancellable, |
| 7294 | GError **error) |
| 7295 | { |
| 7296 | GVariant *_ret; |
| 7297 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 7298 | "check", |
| 7299 | g_variant_new ("(i)", |
| 7300 | arg_value), |
| 7301 | G_DBUS_CALL_FLAGS_NONE, |
| 7302 | -1, |
| 7303 | cancellable, |
| 7304 | error); |
| 7305 | if (_ret == NULL) |
| 7306 | goto _out; |
| 7307 | g_variant_get (_ret, |
| 7308 | "()"); |
| 7309 | g_variant_unref (_ret); |
| 7310 | _out: |
| 7311 | return _ret != NULL; |
| 7312 | } |
| 7313 | |
| 7314 | /** |
| 7315 | * sensor_integer_threshold_call_set_thresholds: |
| 7316 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7317 | * @arg_critical_upper: Argument to pass with the method invocation. |
| 7318 | * @arg_critical_lower: Argument to pass with the method invocation. |
| 7319 | * @arg_warning_upper: Argument to pass with the method invocation. |
| 7320 | * @arg_warning_lower: Argument to pass with the method invocation. |
| 7321 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7322 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 7323 | * @user_data: User data to pass to @callback. |
| 7324 | * |
| 7325 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method on @proxy. |
| 7326 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7327 | * You can then call sensor_integer_threshold_call_set_thresholds_finish() to get the result of the operation. |
| 7328 | * |
| 7329 | * See sensor_integer_threshold_call_set_thresholds_sync() for the synchronous, blocking version of this method. |
| 7330 | */ |
| 7331 | void |
| 7332 | sensor_integer_threshold_call_set_thresholds ( |
| 7333 | SensorIntegerThreshold *proxy, |
| 7334 | gint arg_critical_upper, |
| 7335 | gint arg_critical_lower, |
| 7336 | gint arg_warning_upper, |
| 7337 | gint arg_warning_lower, |
| 7338 | GCancellable *cancellable, |
| 7339 | GAsyncReadyCallback callback, |
| 7340 | gpointer user_data) |
| 7341 | { |
| 7342 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 7343 | "setThresholds", |
| 7344 | g_variant_new ("(iiii)", |
| 7345 | arg_critical_upper, |
| 7346 | arg_critical_lower, |
| 7347 | arg_warning_upper, |
| 7348 | arg_warning_lower), |
| 7349 | G_DBUS_CALL_FLAGS_NONE, |
| 7350 | -1, |
| 7351 | cancellable, |
| 7352 | callback, |
| 7353 | user_data); |
| 7354 | } |
| 7355 | |
| 7356 | /** |
| 7357 | * sensor_integer_threshold_call_set_thresholds_finish: |
| 7358 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7359 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_set_thresholds(). |
| 7360 | * @error: Return location for error or %NULL. |
| 7361 | * |
| 7362 | * Finishes an operation started with sensor_integer_threshold_call_set_thresholds(). |
| 7363 | * |
| 7364 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 7365 | */ |
| 7366 | gboolean |
| 7367 | sensor_integer_threshold_call_set_thresholds_finish ( |
| 7368 | SensorIntegerThreshold *proxy, |
| 7369 | GAsyncResult *res, |
| 7370 | GError **error) |
| 7371 | { |
| 7372 | GVariant *_ret; |
| 7373 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 7374 | if (_ret == NULL) |
| 7375 | goto _out; |
| 7376 | g_variant_get (_ret, |
| 7377 | "()"); |
| 7378 | g_variant_unref (_ret); |
| 7379 | _out: |
| 7380 | return _ret != NULL; |
| 7381 | } |
| 7382 | |
| 7383 | /** |
| 7384 | * sensor_integer_threshold_call_set_thresholds_sync: |
| 7385 | * @proxy: A #SensorIntegerThresholdProxy. |
| 7386 | * @arg_critical_upper: Argument to pass with the method invocation. |
| 7387 | * @arg_critical_lower: Argument to pass with the method invocation. |
| 7388 | * @arg_warning_upper: Argument to pass with the method invocation. |
| 7389 | * @arg_warning_lower: Argument to pass with the method invocation. |
| 7390 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7391 | * @error: Return location for error or %NULL. |
| 7392 | * |
| 7393 | * 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. |
| 7394 | * |
| 7395 | * See sensor_integer_threshold_call_set_thresholds() for the asynchronous version of this method. |
| 7396 | * |
| 7397 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 7398 | */ |
| 7399 | gboolean |
| 7400 | sensor_integer_threshold_call_set_thresholds_sync ( |
| 7401 | SensorIntegerThreshold *proxy, |
| 7402 | gint arg_critical_upper, |
| 7403 | gint arg_critical_lower, |
| 7404 | gint arg_warning_upper, |
| 7405 | gint arg_warning_lower, |
| 7406 | GCancellable *cancellable, |
| 7407 | GError **error) |
| 7408 | { |
| 7409 | GVariant *_ret; |
| 7410 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 7411 | "setThresholds", |
| 7412 | g_variant_new ("(iiii)", |
| 7413 | arg_critical_upper, |
| 7414 | arg_critical_lower, |
| 7415 | arg_warning_upper, |
| 7416 | arg_warning_lower), |
| 7417 | G_DBUS_CALL_FLAGS_NONE, |
| 7418 | -1, |
| 7419 | cancellable, |
| 7420 | error); |
| 7421 | if (_ret == NULL) |
| 7422 | goto _out; |
| 7423 | g_variant_get (_ret, |
| 7424 | "()"); |
| 7425 | g_variant_unref (_ret); |
| 7426 | _out: |
| 7427 | return _ret != NULL; |
| 7428 | } |
| 7429 | |
| 7430 | /** |
| 7431 | * sensor_integer_threshold_complete_check: |
| 7432 | * @object: A #SensorIntegerThreshold. |
| 7433 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 7434 | * |
| 7435 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</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. |
| 7436 | * |
| 7437 | * This method will free @invocation, you cannot use it afterwards. |
| 7438 | */ |
| 7439 | void |
| 7440 | sensor_integer_threshold_complete_check ( |
| 7441 | SensorIntegerThreshold *object, |
| 7442 | GDBusMethodInvocation *invocation) |
| 7443 | { |
| 7444 | g_dbus_method_invocation_return_value (invocation, |
| 7445 | g_variant_new ("()")); |
| 7446 | } |
| 7447 | |
| 7448 | /** |
| 7449 | * sensor_integer_threshold_complete_set_thresholds: |
| 7450 | * @object: A #SensorIntegerThreshold. |
| 7451 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 7452 | * |
| 7453 | * 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. |
| 7454 | * |
| 7455 | * This method will free @invocation, you cannot use it afterwards. |
| 7456 | */ |
| 7457 | void |
| 7458 | sensor_integer_threshold_complete_set_thresholds ( |
| 7459 | SensorIntegerThreshold *object, |
| 7460 | GDBusMethodInvocation *invocation) |
| 7461 | { |
| 7462 | g_dbus_method_invocation_return_value (invocation, |
| 7463 | g_variant_new ("()")); |
| 7464 | } |
| 7465 | |
| 7466 | /* ------------------------------------------------------------------------ */ |
| 7467 | |
| 7468 | /** |
| 7469 | * SensorIntegerThresholdProxy: |
| 7470 | * |
| 7471 | * The #SensorIntegerThresholdProxy structure contains only private data and should only be accessed using the provided API. |
| 7472 | */ |
| 7473 | |
| 7474 | /** |
| 7475 | * SensorIntegerThresholdProxyClass: |
| 7476 | * @parent_class: The parent class. |
| 7477 | * |
| 7478 | * Class structure for #SensorIntegerThresholdProxy. |
| 7479 | */ |
| 7480 | |
| 7481 | struct _SensorIntegerThresholdProxyPrivate |
| 7482 | { |
| 7483 | GData *qdata; |
| 7484 | }; |
| 7485 | |
| 7486 | static void sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface); |
| 7487 | |
| 7488 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7489 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 7490 | G_ADD_PRIVATE (SensorIntegerThresholdProxy) |
| 7491 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init)); |
| 7492 | |
| 7493 | #else |
| 7494 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 7495 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init)); |
| 7496 | |
| 7497 | #endif |
| 7498 | static void |
| 7499 | sensor_integer_threshold_proxy_finalize (GObject *object) |
| 7500 | { |
| 7501 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 7502 | g_datalist_clear (&proxy->priv->qdata); |
| 7503 | G_OBJECT_CLASS (sensor_integer_threshold_proxy_parent_class)->finalize (object); |
| 7504 | } |
| 7505 | |
| 7506 | static void |
| 7507 | sensor_integer_threshold_proxy_get_property (GObject *object, |
| 7508 | guint prop_id, |
| 7509 | GValue *value, |
| 7510 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7511 | { |
| 7512 | const _ExtendedGDBusPropertyInfo *info; |
| 7513 | GVariant *variant; |
| 7514 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 7515 | info = _sensor_integer_threshold_property_info_pointers[prop_id - 1]; |
| 7516 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 7517 | if (info->use_gvariant) |
| 7518 | { |
| 7519 | g_value_set_variant (value, variant); |
| 7520 | } |
| 7521 | else |
| 7522 | { |
| 7523 | if (variant != NULL) |
| 7524 | g_dbus_gvariant_to_gvalue (variant, value); |
| 7525 | } |
| 7526 | if (variant != NULL) |
| 7527 | g_variant_unref (variant); |
| 7528 | } |
| 7529 | |
| 7530 | static void |
| 7531 | sensor_integer_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
| 7532 | GAsyncResult *res, |
| 7533 | gpointer user_data) |
| 7534 | { |
| 7535 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 7536 | GError *error; |
| 7537 | GVariant *_ret; |
| 7538 | error = NULL; |
| 7539 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 7540 | if (!_ret) |
| 7541 | { |
| 7542 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerThreshold: %s (%s, %d)", |
| 7543 | info->parent_struct.name, |
| 7544 | error->message, g_quark_to_string (error->domain), error->code); |
| 7545 | g_error_free (error); |
| 7546 | } |
| 7547 | else |
| 7548 | { |
| 7549 | g_variant_unref (_ret); |
| 7550 | } |
| 7551 | } |
| 7552 | |
| 7553 | static void |
| 7554 | sensor_integer_threshold_proxy_set_property (GObject *object, |
| 7555 | guint prop_id, |
| 7556 | const GValue *value, |
| 7557 | GParamSpec *pspec G_GNUC_UNUSED) |
| 7558 | { |
| 7559 | const _ExtendedGDBusPropertyInfo *info; |
| 7560 | GVariant *variant; |
| 7561 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 7562 | info = _sensor_integer_threshold_property_info_pointers[prop_id - 1]; |
| 7563 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 7564 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 7565 | "org.freedesktop.DBus.Properties.Set", |
| 7566 | g_variant_new ("(ssv)", "org.openbmc.SensorIntegerThreshold", info->parent_struct.name, variant), |
| 7567 | G_DBUS_CALL_FLAGS_NONE, |
| 7568 | -1, |
| 7569 | NULL, (GAsyncReadyCallback) sensor_integer_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 7570 | g_variant_unref (variant); |
| 7571 | } |
| 7572 | |
| 7573 | static void |
| 7574 | sensor_integer_threshold_proxy_g_signal (GDBusProxy *proxy, |
| 7575 | const gchar *sender_name G_GNUC_UNUSED, |
| 7576 | const gchar *signal_name, |
| 7577 | GVariant *parameters) |
| 7578 | { |
| 7579 | _ExtendedGDBusSignalInfo *info; |
| 7580 | GVariantIter iter; |
| 7581 | GVariant *child; |
| 7582 | GValue *paramv; |
| 7583 | guint num_params; |
| 7584 | guint n; |
| 7585 | guint signal_id; |
| 7586 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, signal_name); |
| 7587 | if (info == NULL) |
| 7588 | return; |
| 7589 | num_params = g_variant_n_children (parameters); |
| 7590 | paramv = g_new0 (GValue, num_params + 1); |
| 7591 | g_value_init (¶mv[0], TYPE_SENSOR_INTEGER_THRESHOLD); |
| 7592 | g_value_set_object (¶mv[0], proxy); |
| 7593 | g_variant_iter_init (&iter, parameters); |
| 7594 | n = 1; |
| 7595 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7596 | { |
| 7597 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 7598 | if (arg_info->use_gvariant) |
| 7599 | { |
| 7600 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7601 | g_value_set_variant (¶mv[n], child); |
| 7602 | n++; |
| 7603 | } |
| 7604 | else |
| 7605 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 7606 | g_variant_unref (child); |
| 7607 | } |
| 7608 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD); |
| 7609 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 7610 | for (n = 0; n < num_params + 1; n++) |
| 7611 | g_value_unset (¶mv[n]); |
| 7612 | g_free (paramv); |
| 7613 | } |
| 7614 | |
| 7615 | static void |
| 7616 | sensor_integer_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 7617 | GVariant *changed_properties, |
| 7618 | const gchar *const *invalidated_properties) |
| 7619 | { |
| 7620 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (_proxy); |
| 7621 | guint n; |
| 7622 | const gchar *key; |
| 7623 | GVariantIter *iter; |
| 7624 | _ExtendedGDBusPropertyInfo *info; |
| 7625 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 7626 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 7627 | { |
| 7628 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, key); |
| 7629 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 7630 | if (info != NULL) |
| 7631 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7632 | } |
| 7633 | g_variant_iter_free (iter); |
| 7634 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 7635 | { |
| 7636 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, invalidated_properties[n]); |
| 7637 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 7638 | if (info != NULL) |
| 7639 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 7640 | } |
| 7641 | } |
| 7642 | |
| 7643 | static gint |
| 7644 | sensor_integer_threshold_proxy_get_critical_upper (SensorIntegerThreshold *object) |
| 7645 | { |
| 7646 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 7647 | GVariant *variant; |
| 7648 | gint value = 0; |
| 7649 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "critical_upper"); |
| 7650 | if (variant != NULL) |
| 7651 | { |
| 7652 | value = g_variant_get_int32 (variant); |
| 7653 | g_variant_unref (variant); |
| 7654 | } |
| 7655 | return value; |
| 7656 | } |
| 7657 | |
| 7658 | static gint |
| 7659 | sensor_integer_threshold_proxy_get_critical_lower (SensorIntegerThreshold *object) |
| 7660 | { |
| 7661 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 7662 | GVariant *variant; |
| 7663 | gint value = 0; |
| 7664 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "critical_lower"); |
| 7665 | if (variant != NULL) |
| 7666 | { |
| 7667 | value = g_variant_get_int32 (variant); |
| 7668 | g_variant_unref (variant); |
| 7669 | } |
| 7670 | return value; |
| 7671 | } |
| 7672 | |
| 7673 | static gint |
| 7674 | sensor_integer_threshold_proxy_get_warning_upper (SensorIntegerThreshold *object) |
| 7675 | { |
| 7676 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 7677 | GVariant *variant; |
| 7678 | gint value = 0; |
| 7679 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "warning_upper"); |
| 7680 | if (variant != NULL) |
| 7681 | { |
| 7682 | value = g_variant_get_int32 (variant); |
| 7683 | g_variant_unref (variant); |
| 7684 | } |
| 7685 | return value; |
| 7686 | } |
| 7687 | |
| 7688 | static gint |
| 7689 | sensor_integer_threshold_proxy_get_warning_lower (SensorIntegerThreshold *object) |
| 7690 | { |
| 7691 | SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object); |
| 7692 | GVariant *variant; |
| 7693 | gint value = 0; |
| 7694 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "warning_lower"); |
| 7695 | if (variant != NULL) |
| 7696 | { |
| 7697 | value = g_variant_get_int32 (variant); |
| 7698 | g_variant_unref (variant); |
| 7699 | } |
| 7700 | return value; |
| 7701 | } |
| 7702 | |
| 7703 | static void |
| 7704 | sensor_integer_threshold_proxy_init (SensorIntegerThresholdProxy *proxy) |
| 7705 | { |
| 7706 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 7707 | proxy->priv = sensor_integer_threshold_proxy_get_instance_private (proxy); |
| 7708 | #else |
| 7709 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, SensorIntegerThresholdProxyPrivate); |
| 7710 | #endif |
| 7711 | |
| 7712 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_threshold_interface_info ()); |
| 7713 | } |
| 7714 | |
| 7715 | static void |
| 7716 | sensor_integer_threshold_proxy_class_init (SensorIntegerThresholdProxyClass *klass) |
| 7717 | { |
| 7718 | GObjectClass *gobject_class; |
| 7719 | GDBusProxyClass *proxy_class; |
| 7720 | |
| 7721 | gobject_class = G_OBJECT_CLASS (klass); |
| 7722 | gobject_class->finalize = sensor_integer_threshold_proxy_finalize; |
| 7723 | gobject_class->get_property = sensor_integer_threshold_proxy_get_property; |
| 7724 | gobject_class->set_property = sensor_integer_threshold_proxy_set_property; |
| 7725 | |
| 7726 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 7727 | proxy_class->g_signal = sensor_integer_threshold_proxy_g_signal; |
| 7728 | proxy_class->g_properties_changed = sensor_integer_threshold_proxy_g_properties_changed; |
| 7729 | |
| 7730 | sensor_integer_threshold_override_properties (gobject_class, 1); |
| 7731 | |
| 7732 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 7733 | g_type_class_add_private (klass, sizeof (SensorIntegerThresholdProxyPrivate)); |
| 7734 | #endif |
| 7735 | } |
| 7736 | |
| 7737 | static void |
| 7738 | sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface) |
| 7739 | { |
| 7740 | iface->get_critical_upper = sensor_integer_threshold_proxy_get_critical_upper; |
| 7741 | iface->get_critical_lower = sensor_integer_threshold_proxy_get_critical_lower; |
| 7742 | iface->get_warning_upper = sensor_integer_threshold_proxy_get_warning_upper; |
| 7743 | iface->get_warning_lower = sensor_integer_threshold_proxy_get_warning_lower; |
| 7744 | } |
| 7745 | |
| 7746 | /** |
| 7747 | * sensor_integer_threshold_proxy_new: |
| 7748 | * @connection: A #GDBusConnection. |
| 7749 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7750 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7751 | * @object_path: An object path. |
| 7752 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7753 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7754 | * @user_data: User data to pass to @callback. |
| 7755 | * |
| 7756 | * 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. |
| 7757 | * |
| 7758 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7759 | * You can then call sensor_integer_threshold_proxy_new_finish() to get the result of the operation. |
| 7760 | * |
| 7761 | * See sensor_integer_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 7762 | */ |
| 7763 | void |
| 7764 | sensor_integer_threshold_proxy_new ( |
| 7765 | GDBusConnection *connection, |
| 7766 | GDBusProxyFlags flags, |
| 7767 | const gchar *name, |
| 7768 | const gchar *object_path, |
| 7769 | GCancellable *cancellable, |
| 7770 | GAsyncReadyCallback callback, |
| 7771 | gpointer user_data) |
| 7772 | { |
| 7773 | 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); |
| 7774 | } |
| 7775 | |
| 7776 | /** |
| 7777 | * sensor_integer_threshold_proxy_new_finish: |
| 7778 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new(). |
| 7779 | * @error: Return location for error or %NULL |
| 7780 | * |
| 7781 | * Finishes an operation started with sensor_integer_threshold_proxy_new(). |
| 7782 | * |
| 7783 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7784 | */ |
| 7785 | SensorIntegerThreshold * |
| 7786 | sensor_integer_threshold_proxy_new_finish ( |
| 7787 | GAsyncResult *res, |
| 7788 | GError **error) |
| 7789 | { |
| 7790 | GObject *ret; |
| 7791 | GObject *source_object; |
| 7792 | source_object = g_async_result_get_source_object (res); |
| 7793 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7794 | g_object_unref (source_object); |
| 7795 | if (ret != NULL) |
| 7796 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 7797 | else |
| 7798 | return NULL; |
| 7799 | } |
| 7800 | |
| 7801 | /** |
| 7802 | * sensor_integer_threshold_proxy_new_sync: |
| 7803 | * @connection: A #GDBusConnection. |
| 7804 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7805 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7806 | * @object_path: An object path. |
| 7807 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7808 | * @error: Return location for error or %NULL |
| 7809 | * |
| 7810 | * 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. |
| 7811 | * |
| 7812 | * The calling thread is blocked until a reply is received. |
| 7813 | * |
| 7814 | * See sensor_integer_threshold_proxy_new() for the asynchronous version of this constructor. |
| 7815 | * |
| 7816 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7817 | */ |
| 7818 | SensorIntegerThreshold * |
| 7819 | sensor_integer_threshold_proxy_new_sync ( |
| 7820 | GDBusConnection *connection, |
| 7821 | GDBusProxyFlags flags, |
| 7822 | const gchar *name, |
| 7823 | const gchar *object_path, |
| 7824 | GCancellable *cancellable, |
| 7825 | GError **error) |
| 7826 | { |
| 7827 | GInitable *ret; |
| 7828 | 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); |
| 7829 | if (ret != NULL) |
| 7830 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 7831 | else |
| 7832 | return NULL; |
| 7833 | } |
| 7834 | |
| 7835 | |
| 7836 | /** |
| 7837 | * sensor_integer_threshold_proxy_new_for_bus: |
| 7838 | * @bus_type: A #GBusType. |
| 7839 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7840 | * @name: A bus name (well-known or unique). |
| 7841 | * @object_path: An object path. |
| 7842 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7843 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7844 | * @user_data: User data to pass to @callback. |
| 7845 | * |
| 7846 | * Like sensor_integer_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 7847 | * |
| 7848 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 7849 | * You can then call sensor_integer_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
| 7850 | * |
| 7851 | * See sensor_integer_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 7852 | */ |
| 7853 | void |
| 7854 | sensor_integer_threshold_proxy_new_for_bus ( |
| 7855 | GBusType bus_type, |
| 7856 | GDBusProxyFlags flags, |
| 7857 | const gchar *name, |
| 7858 | const gchar *object_path, |
| 7859 | GCancellable *cancellable, |
| 7860 | GAsyncReadyCallback callback, |
| 7861 | gpointer user_data) |
| 7862 | { |
| 7863 | 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); |
| 7864 | } |
| 7865 | |
| 7866 | /** |
| 7867 | * sensor_integer_threshold_proxy_new_for_bus_finish: |
| 7868 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new_for_bus(). |
| 7869 | * @error: Return location for error or %NULL |
| 7870 | * |
| 7871 | * Finishes an operation started with sensor_integer_threshold_proxy_new_for_bus(). |
| 7872 | * |
| 7873 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7874 | */ |
| 7875 | SensorIntegerThreshold * |
| 7876 | sensor_integer_threshold_proxy_new_for_bus_finish ( |
| 7877 | GAsyncResult *res, |
| 7878 | GError **error) |
| 7879 | { |
| 7880 | GObject *ret; |
| 7881 | GObject *source_object; |
| 7882 | source_object = g_async_result_get_source_object (res); |
| 7883 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7884 | g_object_unref (source_object); |
| 7885 | if (ret != NULL) |
| 7886 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 7887 | else |
| 7888 | return NULL; |
| 7889 | } |
| 7890 | |
| 7891 | /** |
| 7892 | * sensor_integer_threshold_proxy_new_for_bus_sync: |
| 7893 | * @bus_type: A #GBusType. |
| 7894 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 7895 | * @name: A bus name (well-known or unique). |
| 7896 | * @object_path: An object path. |
| 7897 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7898 | * @error: Return location for error or %NULL |
| 7899 | * |
| 7900 | * Like sensor_integer_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 7901 | * |
| 7902 | * The calling thread is blocked until a reply is received. |
| 7903 | * |
| 7904 | * See sensor_integer_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 7905 | * |
| 7906 | * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set. |
| 7907 | */ |
| 7908 | SensorIntegerThreshold * |
| 7909 | sensor_integer_threshold_proxy_new_for_bus_sync ( |
| 7910 | GBusType bus_type, |
| 7911 | GDBusProxyFlags flags, |
| 7912 | const gchar *name, |
| 7913 | const gchar *object_path, |
| 7914 | GCancellable *cancellable, |
| 7915 | GError **error) |
| 7916 | { |
| 7917 | GInitable *ret; |
| 7918 | 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); |
| 7919 | if (ret != NULL) |
| 7920 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 7921 | else |
| 7922 | return NULL; |
| 7923 | } |
| 7924 | |
| 7925 | |
| 7926 | /* ------------------------------------------------------------------------ */ |
| 7927 | |
| 7928 | /** |
| 7929 | * SensorIntegerThresholdSkeleton: |
| 7930 | * |
| 7931 | * The #SensorIntegerThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
| 7932 | */ |
| 7933 | |
| 7934 | /** |
| 7935 | * SensorIntegerThresholdSkeletonClass: |
| 7936 | * @parent_class: The parent class. |
| 7937 | * |
| 7938 | * Class structure for #SensorIntegerThresholdSkeleton. |
| 7939 | */ |
| 7940 | |
| 7941 | struct _SensorIntegerThresholdSkeletonPrivate |
| 7942 | { |
| 7943 | GValue *properties; |
| 7944 | GList *changed_properties; |
| 7945 | GSource *changed_properties_idle_source; |
| 7946 | GMainContext *context; |
| 7947 | GMutex lock; |
| 7948 | }; |
| 7949 | |
| 7950 | static void |
| 7951 | _sensor_integer_threshold_skeleton_handle_method_call ( |
| 7952 | GDBusConnection *connection G_GNUC_UNUSED, |
| 7953 | const gchar *sender G_GNUC_UNUSED, |
| 7954 | const gchar *object_path G_GNUC_UNUSED, |
| 7955 | const gchar *interface_name, |
| 7956 | const gchar *method_name, |
| 7957 | GVariant *parameters, |
| 7958 | GDBusMethodInvocation *invocation, |
| 7959 | gpointer user_data) |
| 7960 | { |
| 7961 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 7962 | _ExtendedGDBusMethodInfo *info; |
| 7963 | GVariantIter iter; |
| 7964 | GVariant *child; |
| 7965 | GValue *paramv; |
| 7966 | guint num_params; |
| 7967 | guint num_extra; |
| 7968 | guint n; |
| 7969 | guint signal_id; |
| 7970 | GValue return_value = G_VALUE_INIT; |
| 7971 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 7972 | g_assert (info != NULL); |
| 7973 | num_params = g_variant_n_children (parameters); |
| 7974 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 7975 | n = 0; |
| 7976 | g_value_init (¶mv[n], TYPE_SENSOR_INTEGER_THRESHOLD); |
| 7977 | g_value_set_object (¶mv[n++], skeleton); |
| 7978 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 7979 | g_value_set_object (¶mv[n++], invocation); |
| 7980 | if (info->pass_fdlist) |
| 7981 | { |
| 7982 | #ifdef G_OS_UNIX |
| 7983 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 7984 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 7985 | #else |
| 7986 | g_assert_not_reached (); |
| 7987 | #endif |
| 7988 | } |
| 7989 | g_variant_iter_init (&iter, parameters); |
| 7990 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 7991 | { |
| 7992 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 7993 | if (arg_info->use_gvariant) |
| 7994 | { |
| 7995 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 7996 | g_value_set_variant (¶mv[n], child); |
| 7997 | n++; |
| 7998 | } |
| 7999 | else |
| 8000 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 8001 | g_variant_unref (child); |
| 8002 | } |
| 8003 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD); |
| 8004 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 8005 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 8006 | if (!g_value_get_boolean (&return_value)) |
| 8007 | 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); |
| 8008 | g_value_unset (&return_value); |
| 8009 | for (n = 0; n < num_params + num_extra; n++) |
| 8010 | g_value_unset (¶mv[n]); |
| 8011 | g_free (paramv); |
| 8012 | } |
| 8013 | |
| 8014 | static GVariant * |
| 8015 | _sensor_integer_threshold_skeleton_handle_get_property ( |
| 8016 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8017 | const gchar *sender G_GNUC_UNUSED, |
| 8018 | const gchar *object_path G_GNUC_UNUSED, |
| 8019 | const gchar *interface_name G_GNUC_UNUSED, |
| 8020 | const gchar *property_name, |
| 8021 | GError **error, |
| 8022 | gpointer user_data) |
| 8023 | { |
| 8024 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 8025 | GValue value = G_VALUE_INIT; |
| 8026 | GParamSpec *pspec; |
| 8027 | _ExtendedGDBusPropertyInfo *info; |
| 8028 | GVariant *ret; |
| 8029 | ret = NULL; |
| 8030 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name); |
| 8031 | g_assert (info != NULL); |
| 8032 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8033 | if (pspec == NULL) |
| 8034 | { |
| 8035 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8036 | } |
| 8037 | else |
| 8038 | { |
| 8039 | g_value_init (&value, pspec->value_type); |
| 8040 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8041 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 8042 | g_value_unset (&value); |
| 8043 | } |
| 8044 | return ret; |
| 8045 | } |
| 8046 | |
| 8047 | static gboolean |
| 8048 | _sensor_integer_threshold_skeleton_handle_set_property ( |
| 8049 | GDBusConnection *connection G_GNUC_UNUSED, |
| 8050 | const gchar *sender G_GNUC_UNUSED, |
| 8051 | const gchar *object_path G_GNUC_UNUSED, |
| 8052 | const gchar *interface_name G_GNUC_UNUSED, |
| 8053 | const gchar *property_name, |
| 8054 | GVariant *variant, |
| 8055 | GError **error, |
| 8056 | gpointer user_data) |
| 8057 | { |
| 8058 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 8059 | GValue value = G_VALUE_INIT; |
| 8060 | GParamSpec *pspec; |
| 8061 | _ExtendedGDBusPropertyInfo *info; |
| 8062 | gboolean ret; |
| 8063 | ret = FALSE; |
| 8064 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name); |
| 8065 | g_assert (info != NULL); |
| 8066 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 8067 | if (pspec == NULL) |
| 8068 | { |
| 8069 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 8070 | } |
| 8071 | else |
| 8072 | { |
| 8073 | if (info->use_gvariant) |
| 8074 | g_value_set_variant (&value, variant); |
| 8075 | else |
| 8076 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 8077 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 8078 | g_value_unset (&value); |
| 8079 | ret = TRUE; |
| 8080 | } |
| 8081 | return ret; |
| 8082 | } |
| 8083 | |
| 8084 | static const GDBusInterfaceVTable _sensor_integer_threshold_skeleton_vtable = |
| 8085 | { |
| 8086 | _sensor_integer_threshold_skeleton_handle_method_call, |
| 8087 | _sensor_integer_threshold_skeleton_handle_get_property, |
| 8088 | _sensor_integer_threshold_skeleton_handle_set_property, |
| 8089 | {NULL} |
| 8090 | }; |
| 8091 | |
| 8092 | static GDBusInterfaceInfo * |
| 8093 | sensor_integer_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8094 | { |
| 8095 | return sensor_integer_threshold_interface_info (); |
| 8096 | } |
| 8097 | |
| 8098 | static GDBusInterfaceVTable * |
| 8099 | sensor_integer_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 8100 | { |
| 8101 | return (GDBusInterfaceVTable *) &_sensor_integer_threshold_skeleton_vtable; |
| 8102 | } |
| 8103 | |
| 8104 | static GVariant * |
| 8105 | sensor_integer_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 8106 | { |
| 8107 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton); |
| 8108 | |
| 8109 | GVariantBuilder builder; |
| 8110 | guint n; |
| 8111 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8112 | if (_sensor_integer_threshold_interface_info.parent_struct.properties == NULL) |
| 8113 | goto out; |
| 8114 | for (n = 0; _sensor_integer_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
| 8115 | { |
| 8116 | GDBusPropertyInfo *info = _sensor_integer_threshold_interface_info.parent_struct.properties[n]; |
| 8117 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 8118 | { |
| 8119 | GVariant *value; |
| 8120 | 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); |
| 8121 | if (value != NULL) |
| 8122 | { |
| 8123 | g_variant_take_ref (value); |
| 8124 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 8125 | g_variant_unref (value); |
| 8126 | } |
| 8127 | } |
| 8128 | } |
| 8129 | out: |
| 8130 | return g_variant_builder_end (&builder); |
| 8131 | } |
| 8132 | |
| 8133 | static gboolean _sensor_integer_threshold_emit_changed (gpointer user_data); |
| 8134 | |
| 8135 | static void |
| 8136 | sensor_integer_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 8137 | { |
| 8138 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton); |
| 8139 | gboolean emit_changed = FALSE; |
| 8140 | |
| 8141 | g_mutex_lock (&skeleton->priv->lock); |
| 8142 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8143 | { |
| 8144 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8145 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8146 | emit_changed = TRUE; |
| 8147 | } |
| 8148 | g_mutex_unlock (&skeleton->priv->lock); |
| 8149 | |
| 8150 | if (emit_changed) |
| 8151 | _sensor_integer_threshold_emit_changed (skeleton); |
| 8152 | } |
| 8153 | |
| 8154 | static void |
| 8155 | _sensor_integer_threshold_on_signal_critical ( |
| 8156 | SensorIntegerThreshold *object, |
| 8157 | gboolean arg_over) |
| 8158 | { |
| 8159 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8160 | |
| 8161 | GList *connections, *l; |
| 8162 | GVariant *signal_variant; |
| 8163 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8164 | |
| 8165 | signal_variant = g_variant_ref_sink (g_variant_new ("(b)", |
| 8166 | arg_over)); |
| 8167 | for (l = connections; l != NULL; l = l->next) |
| 8168 | { |
| 8169 | GDBusConnection *connection = l->data; |
| 8170 | g_dbus_connection_emit_signal (connection, |
| 8171 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "critical", |
| 8172 | signal_variant, NULL); |
| 8173 | } |
| 8174 | g_variant_unref (signal_variant); |
| 8175 | g_list_free_full (connections, g_object_unref); |
| 8176 | } |
| 8177 | |
| 8178 | static void |
| 8179 | _sensor_integer_threshold_on_signal_warning ( |
| 8180 | SensorIntegerThreshold *object, |
| 8181 | gboolean arg_over) |
| 8182 | { |
| 8183 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8184 | |
| 8185 | GList *connections, *l; |
| 8186 | GVariant *signal_variant; |
| 8187 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8188 | |
| 8189 | signal_variant = g_variant_ref_sink (g_variant_new ("(b)", |
| 8190 | arg_over)); |
| 8191 | for (l = connections; l != NULL; l = l->next) |
| 8192 | { |
| 8193 | GDBusConnection *connection = l->data; |
| 8194 | g_dbus_connection_emit_signal (connection, |
| 8195 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "warning", |
| 8196 | signal_variant, NULL); |
| 8197 | } |
| 8198 | g_variant_unref (signal_variant); |
| 8199 | g_list_free_full (connections, g_object_unref); |
| 8200 | } |
| 8201 | |
| 8202 | static void sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface); |
| 8203 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8204 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8205 | G_ADD_PRIVATE (SensorIntegerThresholdSkeleton) |
| 8206 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init)); |
| 8207 | |
| 8208 | #else |
| 8209 | G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 8210 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init)); |
| 8211 | |
| 8212 | #endif |
| 8213 | static void |
| 8214 | sensor_integer_threshold_skeleton_finalize (GObject *object) |
| 8215 | { |
| 8216 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8217 | guint n; |
| 8218 | for (n = 0; n < 4; n++) |
| 8219 | g_value_unset (&skeleton->priv->properties[n]); |
| 8220 | g_free (skeleton->priv->properties); |
| 8221 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8222 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 8223 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 8224 | g_main_context_unref (skeleton->priv->context); |
| 8225 | g_mutex_clear (&skeleton->priv->lock); |
| 8226 | G_OBJECT_CLASS (sensor_integer_threshold_skeleton_parent_class)->finalize (object); |
| 8227 | } |
| 8228 | |
| 8229 | static void |
| 8230 | sensor_integer_threshold_skeleton_get_property (GObject *object, |
| 8231 | guint prop_id, |
| 8232 | GValue *value, |
| 8233 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8234 | { |
| 8235 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8236 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 8237 | g_mutex_lock (&skeleton->priv->lock); |
| 8238 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 8239 | g_mutex_unlock (&skeleton->priv->lock); |
| 8240 | } |
| 8241 | |
| 8242 | static gboolean |
| 8243 | _sensor_integer_threshold_emit_changed (gpointer user_data) |
| 8244 | { |
| 8245 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data); |
| 8246 | GList *l; |
| 8247 | GVariantBuilder builder; |
| 8248 | GVariantBuilder invalidated_builder; |
| 8249 | guint num_changes; |
| 8250 | |
| 8251 | g_mutex_lock (&skeleton->priv->lock); |
| 8252 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 8253 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 8254 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 8255 | { |
| 8256 | ChangedProperty *cp = l->data; |
| 8257 | GVariant *variant; |
| 8258 | const GValue *cur_value; |
| 8259 | |
| 8260 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 8261 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 8262 | { |
| 8263 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 8264 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 8265 | g_variant_unref (variant); |
| 8266 | num_changes++; |
| 8267 | } |
| 8268 | } |
| 8269 | if (num_changes > 0) |
| 8270 | { |
| 8271 | GList *connections, *ll; |
| 8272 | GVariant *signal_variant; |
| 8273 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerThreshold", |
| 8274 | &builder, &invalidated_builder)); |
| 8275 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 8276 | for (ll = connections; ll != NULL; ll = ll->next) |
| 8277 | { |
| 8278 | GDBusConnection *connection = ll->data; |
| 8279 | |
| 8280 | g_dbus_connection_emit_signal (connection, |
| 8281 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 8282 | "org.freedesktop.DBus.Properties", |
| 8283 | "PropertiesChanged", |
| 8284 | signal_variant, |
| 8285 | NULL); |
| 8286 | } |
| 8287 | g_variant_unref (signal_variant); |
| 8288 | g_list_free_full (connections, g_object_unref); |
| 8289 | } |
| 8290 | else |
| 8291 | { |
| 8292 | g_variant_builder_clear (&builder); |
| 8293 | g_variant_builder_clear (&invalidated_builder); |
| 8294 | } |
| 8295 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 8296 | skeleton->priv->changed_properties = NULL; |
| 8297 | skeleton->priv->changed_properties_idle_source = NULL; |
| 8298 | g_mutex_unlock (&skeleton->priv->lock); |
| 8299 | return FALSE; |
| 8300 | } |
| 8301 | |
| 8302 | static void |
| 8303 | _sensor_integer_threshold_schedule_emit_changed (SensorIntegerThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 8304 | { |
| 8305 | ChangedProperty *cp; |
| 8306 | GList *l; |
| 8307 | cp = NULL; |
| 8308 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 8309 | { |
| 8310 | ChangedProperty *i_cp = l->data; |
| 8311 | if (i_cp->info == info) |
| 8312 | { |
| 8313 | cp = i_cp; |
| 8314 | break; |
| 8315 | } |
| 8316 | } |
| 8317 | if (cp == NULL) |
| 8318 | { |
| 8319 | cp = g_new0 (ChangedProperty, 1); |
| 8320 | cp->prop_id = prop_id; |
| 8321 | cp->info = info; |
| 8322 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 8323 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 8324 | g_value_copy (orig_value, &cp->orig_value); |
| 8325 | } |
| 8326 | } |
| 8327 | |
| 8328 | static void |
| 8329 | sensor_integer_threshold_skeleton_notify (GObject *object, |
| 8330 | GParamSpec *pspec G_GNUC_UNUSED) |
| 8331 | { |
| 8332 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8333 | g_mutex_lock (&skeleton->priv->lock); |
| 8334 | if (skeleton->priv->changed_properties != NULL && |
| 8335 | skeleton->priv->changed_properties_idle_source == NULL) |
| 8336 | { |
| 8337 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 8338 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 8339 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 8340 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 8341 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 8342 | } |
| 8343 | g_mutex_unlock (&skeleton->priv->lock); |
| 8344 | } |
| 8345 | |
| 8346 | static void |
| 8347 | sensor_integer_threshold_skeleton_set_property (GObject *object, |
| 8348 | guint prop_id, |
| 8349 | const GValue *value, |
| 8350 | GParamSpec *pspec) |
| 8351 | { |
| 8352 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8353 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 8354 | g_mutex_lock (&skeleton->priv->lock); |
| 8355 | g_object_freeze_notify (object); |
| 8356 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 8357 | { |
| 8358 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 8359 | _sensor_integer_threshold_schedule_emit_changed (skeleton, _sensor_integer_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 8360 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 8361 | g_object_notify_by_pspec (object, pspec); |
| 8362 | } |
| 8363 | g_mutex_unlock (&skeleton->priv->lock); |
| 8364 | g_object_thaw_notify (object); |
| 8365 | } |
| 8366 | |
| 8367 | static void |
| 8368 | sensor_integer_threshold_skeleton_init (SensorIntegerThresholdSkeleton *skeleton) |
| 8369 | { |
| 8370 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 8371 | skeleton->priv = sensor_integer_threshold_skeleton_get_instance_private (skeleton); |
| 8372 | #else |
| 8373 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, SensorIntegerThresholdSkeletonPrivate); |
| 8374 | #endif |
| 8375 | |
| 8376 | g_mutex_init (&skeleton->priv->lock); |
| 8377 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 8378 | skeleton->priv->properties = g_new0 (GValue, 4); |
| 8379 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); |
| 8380 | g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); |
| 8381 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
| 8382 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
| 8383 | } |
| 8384 | |
| 8385 | static gint |
| 8386 | sensor_integer_threshold_skeleton_get_critical_upper (SensorIntegerThreshold *object) |
| 8387 | { |
| 8388 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8389 | gint value; |
| 8390 | g_mutex_lock (&skeleton->priv->lock); |
| 8391 | value = g_value_get_int (&(skeleton->priv->properties[0])); |
| 8392 | g_mutex_unlock (&skeleton->priv->lock); |
| 8393 | return value; |
| 8394 | } |
| 8395 | |
| 8396 | static gint |
| 8397 | sensor_integer_threshold_skeleton_get_critical_lower (SensorIntegerThreshold *object) |
| 8398 | { |
| 8399 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8400 | gint value; |
| 8401 | g_mutex_lock (&skeleton->priv->lock); |
| 8402 | value = g_value_get_int (&(skeleton->priv->properties[1])); |
| 8403 | g_mutex_unlock (&skeleton->priv->lock); |
| 8404 | return value; |
| 8405 | } |
| 8406 | |
| 8407 | static gint |
| 8408 | sensor_integer_threshold_skeleton_get_warning_upper (SensorIntegerThreshold *object) |
| 8409 | { |
| 8410 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8411 | gint value; |
| 8412 | g_mutex_lock (&skeleton->priv->lock); |
| 8413 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 8414 | g_mutex_unlock (&skeleton->priv->lock); |
| 8415 | return value; |
| 8416 | } |
| 8417 | |
| 8418 | static gint |
| 8419 | sensor_integer_threshold_skeleton_get_warning_lower (SensorIntegerThreshold *object) |
| 8420 | { |
| 8421 | SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object); |
| 8422 | gint value; |
| 8423 | g_mutex_lock (&skeleton->priv->lock); |
| 8424 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 8425 | g_mutex_unlock (&skeleton->priv->lock); |
| 8426 | return value; |
| 8427 | } |
| 8428 | |
| 8429 | static void |
| 8430 | sensor_integer_threshold_skeleton_class_init (SensorIntegerThresholdSkeletonClass *klass) |
| 8431 | { |
| 8432 | GObjectClass *gobject_class; |
| 8433 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 8434 | |
| 8435 | gobject_class = G_OBJECT_CLASS (klass); |
| 8436 | gobject_class->finalize = sensor_integer_threshold_skeleton_finalize; |
| 8437 | gobject_class->get_property = sensor_integer_threshold_skeleton_get_property; |
| 8438 | gobject_class->set_property = sensor_integer_threshold_skeleton_set_property; |
| 8439 | gobject_class->notify = sensor_integer_threshold_skeleton_notify; |
| 8440 | |
| 8441 | |
| 8442 | sensor_integer_threshold_override_properties (gobject_class, 1); |
| 8443 | |
| 8444 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 8445 | skeleton_class->get_info = sensor_integer_threshold_skeleton_dbus_interface_get_info; |
| 8446 | skeleton_class->get_properties = sensor_integer_threshold_skeleton_dbus_interface_get_properties; |
| 8447 | skeleton_class->flush = sensor_integer_threshold_skeleton_dbus_interface_flush; |
| 8448 | skeleton_class->get_vtable = sensor_integer_threshold_skeleton_dbus_interface_get_vtable; |
| 8449 | |
| 8450 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 8451 | g_type_class_add_private (klass, sizeof (SensorIntegerThresholdSkeletonPrivate)); |
| 8452 | #endif |
| 8453 | } |
| 8454 | |
| 8455 | static void |
| 8456 | sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface) |
| 8457 | { |
| 8458 | iface->critical = _sensor_integer_threshold_on_signal_critical; |
| 8459 | iface->warning = _sensor_integer_threshold_on_signal_warning; |
| 8460 | iface->get_critical_upper = sensor_integer_threshold_skeleton_get_critical_upper; |
| 8461 | iface->get_critical_lower = sensor_integer_threshold_skeleton_get_critical_lower; |
| 8462 | iface->get_warning_upper = sensor_integer_threshold_skeleton_get_warning_upper; |
| 8463 | iface->get_warning_lower = sensor_integer_threshold_skeleton_get_warning_lower; |
| 8464 | } |
| 8465 | |
| 8466 | /** |
| 8467 | * sensor_integer_threshold_skeleton_new: |
| 8468 | * |
| 8469 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. |
| 8470 | * |
| 8471 | * Returns: (transfer full) (type SensorIntegerThresholdSkeleton): The skeleton object. |
| 8472 | */ |
| 8473 | SensorIntegerThreshold * |
| 8474 | sensor_integer_threshold_skeleton_new (void) |
| 8475 | { |
| 8476 | return SENSOR_INTEGER_THRESHOLD (g_object_new (TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, NULL)); |
| 8477 | } |
| 8478 | |
| 8479 | /* ------------------------------------------------------------------------ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8480 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 8481 | * ------------------------------------------------------------------------ |
| 8482 | */ |
| 8483 | |
| 8484 | /** |
| 8485 | * SECTION:Object |
| 8486 | * @title: Object |
| 8487 | * @short_description: Specialized GDBusObject types |
| 8488 | * |
| 8489 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 8490 | */ |
| 8491 | |
| 8492 | /** |
| 8493 | * Object: |
| 8494 | * |
| 8495 | * The #Object type is a specialized container of interfaces. |
| 8496 | */ |
| 8497 | |
| 8498 | /** |
| 8499 | * ObjectIface: |
| 8500 | * @parent_iface: The parent interface. |
| 8501 | * |
| 8502 | * Virtual table for the #Object interface. |
| 8503 | */ |
| 8504 | |
| 8505 | typedef ObjectIface ObjectInterface; |
| 8506 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 8507 | |
| 8508 | static void |
| 8509 | object_default_init (ObjectIface *iface) |
| 8510 | { |
| 8511 | /** |
| 8512 | * Object:sensor-integer: |
| 8513 | * |
| 8514 | * The #SensorInteger instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>, if any. |
| 8515 | * |
| 8516 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 8517 | */ |
| 8518 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer", "sensor-integer", "sensor-integer", TYPE_SENSOR_INTEGER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 8519 | |
| 8520 | /** |
| 8521 | * Object:sensor-string: |
| 8522 | * |
| 8523 | * The #SensorString instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>, if any. |
| 8524 | * |
| 8525 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 8526 | */ |
| 8527 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-string", "sensor-string", "sensor-string", TYPE_SENSOR_STRING, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 8528 | |
| 8529 | /** |
| 8530 | * Object:sensor-integer-settable: |
| 8531 | * |
| 8532 | * The #SensorIntegerSettable instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>, if any. |
| 8533 | * |
| 8534 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 8535 | */ |
| 8536 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer-settable", "sensor-integer-settable", "sensor-integer-settable", TYPE_SENSOR_INTEGER_SETTABLE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 8537 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8538 | /** |
| 8539 | * Object:sensor-integer-threshold: |
| 8540 | * |
| 8541 | * 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. |
| 8542 | * |
| 8543 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 8544 | */ |
| 8545 | 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)); |
| 8546 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8547 | } |
| 8548 | |
| 8549 | /** |
| 8550 | * object_get_sensor_integer: |
| 8551 | * @object: A #Object. |
| 8552 | * |
| 8553 | * Gets the #SensorInteger instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> on @object, if any. |
| 8554 | * |
| 8555 | * Returns: (transfer full): A #SensorInteger that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 8556 | */ |
| 8557 | SensorInteger *object_get_sensor_integer (Object *object) |
| 8558 | { |
| 8559 | GDBusInterface *ret; |
| 8560 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger"); |
| 8561 | if (ret == NULL) |
| 8562 | return NULL; |
| 8563 | return SENSOR_INTEGER (ret); |
| 8564 | } |
| 8565 | |
| 8566 | /** |
| 8567 | * object_get_sensor_string: |
| 8568 | * @object: A #Object. |
| 8569 | * |
| 8570 | * Gets the #SensorString instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> on @object, if any. |
| 8571 | * |
| 8572 | * Returns: (transfer full): A #SensorString that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 8573 | */ |
| 8574 | SensorString *object_get_sensor_string (Object *object) |
| 8575 | { |
| 8576 | GDBusInterface *ret; |
| 8577 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString"); |
| 8578 | if (ret == NULL) |
| 8579 | return NULL; |
| 8580 | return SENSOR_STRING (ret); |
| 8581 | } |
| 8582 | |
| 8583 | /** |
| 8584 | * object_get_sensor_integer_settable: |
| 8585 | * @object: A #Object. |
| 8586 | * |
| 8587 | * Gets the #SensorIntegerSettable instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> on @object, if any. |
| 8588 | * |
| 8589 | * Returns: (transfer full): A #SensorIntegerSettable that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 8590 | */ |
| 8591 | SensorIntegerSettable *object_get_sensor_integer_settable (Object *object) |
| 8592 | { |
| 8593 | GDBusInterface *ret; |
| 8594 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable"); |
| 8595 | if (ret == NULL) |
| 8596 | return NULL; |
| 8597 | return SENSOR_INTEGER_SETTABLE (ret); |
| 8598 | } |
| 8599 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8600 | /** |
| 8601 | * object_get_sensor_integer_threshold: |
| 8602 | * @object: A #Object. |
| 8603 | * |
| 8604 | * 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. |
| 8605 | * |
| 8606 | * Returns: (transfer full): A #SensorIntegerThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 8607 | */ |
| 8608 | SensorIntegerThreshold *object_get_sensor_integer_threshold (Object *object) |
| 8609 | { |
| 8610 | GDBusInterface *ret; |
| 8611 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 8612 | if (ret == NULL) |
| 8613 | return NULL; |
| 8614 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 8615 | } |
| 8616 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8617 | |
| 8618 | /** |
| 8619 | * object_peek_sensor_integer: (skip) |
| 8620 | * @object: A #Object. |
| 8621 | * |
| 8622 | * Like object_get_sensor_integer() but doesn't increase the reference count on the returned object. |
| 8623 | * |
| 8624 | * <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> |
| 8625 | * |
| 8626 | * Returns: (transfer none): A #SensorInteger or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 8627 | */ |
| 8628 | SensorInteger *object_peek_sensor_integer (Object *object) |
| 8629 | { |
| 8630 | GDBusInterface *ret; |
| 8631 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger"); |
| 8632 | if (ret == NULL) |
| 8633 | return NULL; |
| 8634 | g_object_unref (ret); |
| 8635 | return SENSOR_INTEGER (ret); |
| 8636 | } |
| 8637 | |
| 8638 | /** |
| 8639 | * object_peek_sensor_string: (skip) |
| 8640 | * @object: A #Object. |
| 8641 | * |
| 8642 | * Like object_get_sensor_string() but doesn't increase the reference count on the returned object. |
| 8643 | * |
| 8644 | * <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> |
| 8645 | * |
| 8646 | * Returns: (transfer none): A #SensorString or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 8647 | */ |
| 8648 | SensorString *object_peek_sensor_string (Object *object) |
| 8649 | { |
| 8650 | GDBusInterface *ret; |
| 8651 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString"); |
| 8652 | if (ret == NULL) |
| 8653 | return NULL; |
| 8654 | g_object_unref (ret); |
| 8655 | return SENSOR_STRING (ret); |
| 8656 | } |
| 8657 | |
| 8658 | /** |
| 8659 | * object_peek_sensor_integer_settable: (skip) |
| 8660 | * @object: A #Object. |
| 8661 | * |
| 8662 | * Like object_get_sensor_integer_settable() but doesn't increase the reference count on the returned object. |
| 8663 | * |
| 8664 | * <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> |
| 8665 | * |
| 8666 | * Returns: (transfer none): A #SensorIntegerSettable or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 8667 | */ |
| 8668 | SensorIntegerSettable *object_peek_sensor_integer_settable (Object *object) |
| 8669 | { |
| 8670 | GDBusInterface *ret; |
| 8671 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable"); |
| 8672 | if (ret == NULL) |
| 8673 | return NULL; |
| 8674 | g_object_unref (ret); |
| 8675 | return SENSOR_INTEGER_SETTABLE (ret); |
| 8676 | } |
| 8677 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8678 | /** |
| 8679 | * object_peek_sensor_integer_threshold: (skip) |
| 8680 | * @object: A #Object. |
| 8681 | * |
| 8682 | * Like object_get_sensor_integer_threshold() but doesn't increase the reference count on the returned object. |
| 8683 | * |
| 8684 | * <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> |
| 8685 | * |
| 8686 | * 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. |
| 8687 | */ |
| 8688 | SensorIntegerThreshold *object_peek_sensor_integer_threshold (Object *object) |
| 8689 | { |
| 8690 | GDBusInterface *ret; |
| 8691 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 8692 | if (ret == NULL) |
| 8693 | return NULL; |
| 8694 | g_object_unref (ret); |
| 8695 | return SENSOR_INTEGER_THRESHOLD (ret); |
| 8696 | } |
| 8697 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8698 | |
| 8699 | static void |
| 8700 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 8701 | { |
| 8702 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 8703 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 8704 | * anything about, for example old generated code in this process talking to |
| 8705 | * newer generated code in the other process. */ |
| 8706 | if (info != NULL) |
| 8707 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 8708 | } |
| 8709 | |
| 8710 | /** |
| 8711 | * ObjectProxy: |
| 8712 | * |
| 8713 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 8714 | */ |
| 8715 | |
| 8716 | /** |
| 8717 | * ObjectProxyClass: |
| 8718 | * @parent_class: The parent class. |
| 8719 | * |
| 8720 | * Class structure for #ObjectProxy. |
| 8721 | */ |
| 8722 | |
| 8723 | static void |
| 8724 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 8725 | { |
| 8726 | } |
| 8727 | |
| 8728 | static void |
| 8729 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 8730 | { |
| 8731 | iface->interface_added = object_notify; |
| 8732 | iface->interface_removed = object_notify; |
| 8733 | } |
| 8734 | |
| 8735 | |
| 8736 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 8737 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 8738 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 8739 | |
| 8740 | static void |
| 8741 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 8742 | { |
| 8743 | } |
| 8744 | |
| 8745 | static void |
| 8746 | object_proxy_set_property (GObject *gobject, |
| 8747 | guint prop_id, |
| 8748 | const GValue *value G_GNUC_UNUSED, |
| 8749 | GParamSpec *pspec) |
| 8750 | { |
| 8751 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 8752 | } |
| 8753 | |
| 8754 | static void |
| 8755 | object_proxy_get_property (GObject *gobject, |
| 8756 | guint prop_id, |
| 8757 | GValue *value, |
| 8758 | GParamSpec *pspec) |
| 8759 | { |
| 8760 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 8761 | GDBusInterface *interface; |
| 8762 | |
| 8763 | switch (prop_id) |
| 8764 | { |
| 8765 | case 1: |
| 8766 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger"); |
| 8767 | g_value_take_object (value, interface); |
| 8768 | break; |
| 8769 | |
| 8770 | case 2: |
| 8771 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString"); |
| 8772 | g_value_take_object (value, interface); |
| 8773 | break; |
| 8774 | |
| 8775 | case 3: |
| 8776 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable"); |
| 8777 | g_value_take_object (value, interface); |
| 8778 | break; |
| 8779 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8780 | case 4: |
| 8781 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 8782 | g_value_take_object (value, interface); |
| 8783 | break; |
| 8784 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8785 | default: |
| 8786 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 8787 | break; |
| 8788 | } |
| 8789 | } |
| 8790 | |
| 8791 | static void |
| 8792 | object_proxy_class_init (ObjectProxyClass *klass) |
| 8793 | { |
| 8794 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 8795 | |
| 8796 | gobject_class->set_property = object_proxy_set_property; |
| 8797 | gobject_class->get_property = object_proxy_get_property; |
| 8798 | |
| 8799 | g_object_class_override_property (gobject_class, 1, "sensor-integer"); |
| 8800 | g_object_class_override_property (gobject_class, 2, "sensor-string"); |
| 8801 | g_object_class_override_property (gobject_class, 3, "sensor-integer-settable"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8802 | g_object_class_override_property (gobject_class, 4, "sensor-integer-threshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8803 | } |
| 8804 | |
| 8805 | /** |
| 8806 | * object_proxy_new: |
| 8807 | * @connection: A #GDBusConnection. |
| 8808 | * @object_path: An object path. |
| 8809 | * |
| 8810 | * Creates a new proxy object. |
| 8811 | * |
| 8812 | * Returns: (transfer full): The proxy object. |
| 8813 | */ |
| 8814 | ObjectProxy * |
| 8815 | object_proxy_new (GDBusConnection *connection, |
| 8816 | const gchar *object_path) |
| 8817 | { |
| 8818 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 8819 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 8820 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 8821 | } |
| 8822 | |
| 8823 | /** |
| 8824 | * ObjectSkeleton: |
| 8825 | * |
| 8826 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 8827 | */ |
| 8828 | |
| 8829 | /** |
| 8830 | * ObjectSkeletonClass: |
| 8831 | * @parent_class: The parent class. |
| 8832 | * |
| 8833 | * Class structure for #ObjectSkeleton. |
| 8834 | */ |
| 8835 | |
| 8836 | static void |
| 8837 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 8838 | { |
| 8839 | } |
| 8840 | |
| 8841 | |
| 8842 | static void |
| 8843 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 8844 | { |
| 8845 | iface->interface_added = object_notify; |
| 8846 | iface->interface_removed = object_notify; |
| 8847 | } |
| 8848 | |
| 8849 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 8850 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 8851 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 8852 | |
| 8853 | static void |
| 8854 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 8855 | { |
| 8856 | } |
| 8857 | |
| 8858 | static void |
| 8859 | object_skeleton_set_property (GObject *gobject, |
| 8860 | guint prop_id, |
| 8861 | const GValue *value, |
| 8862 | GParamSpec *pspec) |
| 8863 | { |
| 8864 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 8865 | GDBusInterfaceSkeleton *interface; |
| 8866 | |
| 8867 | switch (prop_id) |
| 8868 | { |
| 8869 | case 1: |
| 8870 | interface = g_value_get_object (value); |
| 8871 | if (interface != NULL) |
| 8872 | { |
| 8873 | g_warn_if_fail (IS_SENSOR_INTEGER (interface)); |
| 8874 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 8875 | } |
| 8876 | else |
| 8877 | { |
| 8878 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorInteger"); |
| 8879 | } |
| 8880 | break; |
| 8881 | |
| 8882 | case 2: |
| 8883 | interface = g_value_get_object (value); |
| 8884 | if (interface != NULL) |
| 8885 | { |
| 8886 | g_warn_if_fail (IS_SENSOR_STRING (interface)); |
| 8887 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 8888 | } |
| 8889 | else |
| 8890 | { |
| 8891 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorString"); |
| 8892 | } |
| 8893 | break; |
| 8894 | |
| 8895 | case 3: |
| 8896 | interface = g_value_get_object (value); |
| 8897 | if (interface != NULL) |
| 8898 | { |
| 8899 | g_warn_if_fail (IS_SENSOR_INTEGER_SETTABLE (interface)); |
| 8900 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 8901 | } |
| 8902 | else |
| 8903 | { |
| 8904 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerSettable"); |
| 8905 | } |
| 8906 | break; |
| 8907 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8908 | case 4: |
| 8909 | interface = g_value_get_object (value); |
| 8910 | if (interface != NULL) |
| 8911 | { |
| 8912 | g_warn_if_fail (IS_SENSOR_INTEGER_THRESHOLD (interface)); |
| 8913 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 8914 | } |
| 8915 | else |
| 8916 | { |
| 8917 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerThreshold"); |
| 8918 | } |
| 8919 | break; |
| 8920 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8921 | default: |
| 8922 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 8923 | break; |
| 8924 | } |
| 8925 | } |
| 8926 | |
| 8927 | static void |
| 8928 | object_skeleton_get_property (GObject *gobject, |
| 8929 | guint prop_id, |
| 8930 | GValue *value, |
| 8931 | GParamSpec *pspec) |
| 8932 | { |
| 8933 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 8934 | GDBusInterface *interface; |
| 8935 | |
| 8936 | switch (prop_id) |
| 8937 | { |
| 8938 | case 1: |
| 8939 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger"); |
| 8940 | g_value_take_object (value, interface); |
| 8941 | break; |
| 8942 | |
| 8943 | case 2: |
| 8944 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString"); |
| 8945 | g_value_take_object (value, interface); |
| 8946 | break; |
| 8947 | |
| 8948 | case 3: |
| 8949 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable"); |
| 8950 | g_value_take_object (value, interface); |
| 8951 | break; |
| 8952 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8953 | case 4: |
| 8954 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold"); |
| 8955 | g_value_take_object (value, interface); |
| 8956 | break; |
| 8957 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8958 | default: |
| 8959 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 8960 | break; |
| 8961 | } |
| 8962 | } |
| 8963 | |
| 8964 | static void |
| 8965 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 8966 | { |
| 8967 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 8968 | |
| 8969 | gobject_class->set_property = object_skeleton_set_property; |
| 8970 | gobject_class->get_property = object_skeleton_get_property; |
| 8971 | |
| 8972 | g_object_class_override_property (gobject_class, 1, "sensor-integer"); |
| 8973 | g_object_class_override_property (gobject_class, 2, "sensor-string"); |
| 8974 | g_object_class_override_property (gobject_class, 3, "sensor-integer-settable"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 8975 | g_object_class_override_property (gobject_class, 4, "sensor-integer-threshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 8976 | } |
| 8977 | |
| 8978 | /** |
| 8979 | * object_skeleton_new: |
| 8980 | * @object_path: An object path. |
| 8981 | * |
| 8982 | * Creates a new skeleton object. |
| 8983 | * |
| 8984 | * Returns: (transfer full): The skeleton object. |
| 8985 | */ |
| 8986 | ObjectSkeleton * |
| 8987 | object_skeleton_new (const gchar *object_path) |
| 8988 | { |
| 8989 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 8990 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 8991 | } |
| 8992 | |
| 8993 | /** |
| 8994 | * object_skeleton_set_sensor_integer: |
| 8995 | * @object: A #ObjectSkeleton. |
| 8996 | * @interface_: (allow-none): A #SensorInteger or %NULL to clear the interface. |
| 8997 | * |
| 8998 | * Sets the #SensorInteger instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> on @object. |
| 8999 | */ |
| 9000 | void object_skeleton_set_sensor_integer (ObjectSkeleton *object, SensorInteger *interface_) |
| 9001 | { |
| 9002 | g_object_set (G_OBJECT (object), "sensor-integer", interface_, NULL); |
| 9003 | } |
| 9004 | |
| 9005 | /** |
| 9006 | * object_skeleton_set_sensor_string: |
| 9007 | * @object: A #ObjectSkeleton. |
| 9008 | * @interface_: (allow-none): A #SensorString or %NULL to clear the interface. |
| 9009 | * |
| 9010 | * Sets the #SensorString instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> on @object. |
| 9011 | */ |
| 9012 | void object_skeleton_set_sensor_string (ObjectSkeleton *object, SensorString *interface_) |
| 9013 | { |
| 9014 | g_object_set (G_OBJECT (object), "sensor-string", interface_, NULL); |
| 9015 | } |
| 9016 | |
| 9017 | /** |
| 9018 | * object_skeleton_set_sensor_integer_settable: |
| 9019 | * @object: A #ObjectSkeleton. |
| 9020 | * @interface_: (allow-none): A #SensorIntegerSettable or %NULL to clear the interface. |
| 9021 | * |
| 9022 | * Sets the #SensorIntegerSettable instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> on @object. |
| 9023 | */ |
| 9024 | void object_skeleton_set_sensor_integer_settable (ObjectSkeleton *object, SensorIntegerSettable *interface_) |
| 9025 | { |
| 9026 | g_object_set (G_OBJECT (object), "sensor-integer-settable", interface_, NULL); |
| 9027 | } |
| 9028 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 9029 | /** |
| 9030 | * object_skeleton_set_sensor_integer_threshold: |
| 9031 | * @object: A #ObjectSkeleton. |
| 9032 | * @interface_: (allow-none): A #SensorIntegerThreshold or %NULL to clear the interface. |
| 9033 | * |
| 9034 | * 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. |
| 9035 | */ |
| 9036 | void object_skeleton_set_sensor_integer_threshold (ObjectSkeleton *object, SensorIntegerThreshold *interface_) |
| 9037 | { |
| 9038 | g_object_set (G_OBJECT (object), "sensor-integer-threshold", interface_, NULL); |
| 9039 | } |
| 9040 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 9041 | |
| 9042 | /* ------------------------------------------------------------------------ |
| 9043 | * Code for ObjectManager client |
| 9044 | * ------------------------------------------------------------------------ |
| 9045 | */ |
| 9046 | |
| 9047 | /** |
| 9048 | * SECTION:ObjectManagerClient |
| 9049 | * @title: ObjectManagerClient |
| 9050 | * @short_description: Generated GDBusObjectManagerClient type |
| 9051 | * |
| 9052 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 9053 | */ |
| 9054 | |
| 9055 | /** |
| 9056 | * ObjectManagerClient: |
| 9057 | * |
| 9058 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 9059 | */ |
| 9060 | |
| 9061 | /** |
| 9062 | * ObjectManagerClientClass: |
| 9063 | * @parent_class: The parent class. |
| 9064 | * |
| 9065 | * Class structure for #ObjectManagerClient. |
| 9066 | */ |
| 9067 | |
| 9068 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 9069 | |
| 9070 | static void |
| 9071 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 9072 | { |
| 9073 | } |
| 9074 | |
| 9075 | static void |
| 9076 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 9077 | { |
| 9078 | } |
| 9079 | |
| 9080 | /** |
| 9081 | * object_manager_client_get_proxy_type: |
| 9082 | * @manager: A #GDBusObjectManagerClient. |
| 9083 | * @object_path: The object path of the remote object (unused). |
| 9084 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 9085 | * @user_data: User data (unused). |
| 9086 | * |
| 9087 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 9088 | * |
| 9089 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 9090 | */ |
| 9091 | GType |
| 9092 | 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) |
| 9093 | { |
| 9094 | static gsize once_init_value = 0; |
| 9095 | static GHashTable *lookup_hash; |
| 9096 | GType ret; |
| 9097 | |
| 9098 | if (interface_name == NULL) |
| 9099 | return TYPE_OBJECT_PROXY; |
| 9100 | if (g_once_init_enter (&once_init_value)) |
| 9101 | { |
| 9102 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 9103 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorInteger", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_PROXY)); |
| 9104 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorString", GSIZE_TO_POINTER (TYPE_SENSOR_STRING_PROXY)); |
| 9105 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerSettable", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_SETTABLE_PROXY)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 9106 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 9107 | g_once_init_leave (&once_init_value, 1); |
| 9108 | } |
| 9109 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 9110 | if (ret == (GType) 0) |
| 9111 | ret = G_TYPE_DBUS_PROXY; |
| 9112 | return ret; |
| 9113 | } |
| 9114 | |
| 9115 | /** |
| 9116 | * object_manager_client_new: |
| 9117 | * @connection: A #GDBusConnection. |
| 9118 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 9119 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9120 | * @object_path: An object path. |
| 9121 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9122 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9123 | * @user_data: User data to pass to @callback. |
| 9124 | * |
| 9125 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 9126 | * |
| 9127 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 9128 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 9129 | * |
| 9130 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 9131 | */ |
| 9132 | void |
| 9133 | object_manager_client_new ( |
| 9134 | GDBusConnection *connection, |
| 9135 | GDBusObjectManagerClientFlags flags, |
| 9136 | const gchar *name, |
| 9137 | const gchar *object_path, |
| 9138 | GCancellable *cancellable, |
| 9139 | GAsyncReadyCallback callback, |
| 9140 | gpointer user_data) |
| 9141 | { |
| 9142 | 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); |
| 9143 | } |
| 9144 | |
| 9145 | /** |
| 9146 | * object_manager_client_new_finish: |
| 9147 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 9148 | * @error: Return location for error or %NULL |
| 9149 | * |
| 9150 | * Finishes an operation started with object_manager_client_new(). |
| 9151 | * |
| 9152 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 9153 | */ |
| 9154 | GDBusObjectManager * |
| 9155 | object_manager_client_new_finish ( |
| 9156 | GAsyncResult *res, |
| 9157 | GError **error) |
| 9158 | { |
| 9159 | GObject *ret; |
| 9160 | GObject *source_object; |
| 9161 | source_object = g_async_result_get_source_object (res); |
| 9162 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9163 | g_object_unref (source_object); |
| 9164 | if (ret != NULL) |
| 9165 | return G_DBUS_OBJECT_MANAGER (ret); |
| 9166 | else |
| 9167 | return NULL; |
| 9168 | } |
| 9169 | |
| 9170 | /** |
| 9171 | * object_manager_client_new_sync: |
| 9172 | * @connection: A #GDBusConnection. |
| 9173 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 9174 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 9175 | * @object_path: An object path. |
| 9176 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9177 | * @error: Return location for error or %NULL |
| 9178 | * |
| 9179 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 9180 | * |
| 9181 | * The calling thread is blocked until a reply is received. |
| 9182 | * |
| 9183 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 9184 | * |
| 9185 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 9186 | */ |
| 9187 | GDBusObjectManager * |
| 9188 | object_manager_client_new_sync ( |
| 9189 | GDBusConnection *connection, |
| 9190 | GDBusObjectManagerClientFlags flags, |
| 9191 | const gchar *name, |
| 9192 | const gchar *object_path, |
| 9193 | GCancellable *cancellable, |
| 9194 | GError **error) |
| 9195 | { |
| 9196 | GInitable *ret; |
| 9197 | 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); |
| 9198 | if (ret != NULL) |
| 9199 | return G_DBUS_OBJECT_MANAGER (ret); |
| 9200 | else |
| 9201 | return NULL; |
| 9202 | } |
| 9203 | |
| 9204 | |
| 9205 | /** |
| 9206 | * object_manager_client_new_for_bus: |
| 9207 | * @bus_type: A #GBusType. |
| 9208 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 9209 | * @name: A bus name (well-known or unique). |
| 9210 | * @object_path: An object path. |
| 9211 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9212 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 9213 | * @user_data: User data to pass to @callback. |
| 9214 | * |
| 9215 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 9216 | * |
| 9217 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 9218 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 9219 | * |
| 9220 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 9221 | */ |
| 9222 | void |
| 9223 | object_manager_client_new_for_bus ( |
| 9224 | GBusType bus_type, |
| 9225 | GDBusObjectManagerClientFlags flags, |
| 9226 | const gchar *name, |
| 9227 | const gchar *object_path, |
| 9228 | GCancellable *cancellable, |
| 9229 | GAsyncReadyCallback callback, |
| 9230 | gpointer user_data) |
| 9231 | { |
| 9232 | 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); |
| 9233 | } |
| 9234 | |
| 9235 | /** |
| 9236 | * object_manager_client_new_for_bus_finish: |
| 9237 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 9238 | * @error: Return location for error or %NULL |
| 9239 | * |
| 9240 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 9241 | * |
| 9242 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 9243 | */ |
| 9244 | GDBusObjectManager * |
| 9245 | object_manager_client_new_for_bus_finish ( |
| 9246 | GAsyncResult *res, |
| 9247 | GError **error) |
| 9248 | { |
| 9249 | GObject *ret; |
| 9250 | GObject *source_object; |
| 9251 | source_object = g_async_result_get_source_object (res); |
| 9252 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 9253 | g_object_unref (source_object); |
| 9254 | if (ret != NULL) |
| 9255 | return G_DBUS_OBJECT_MANAGER (ret); |
| 9256 | else |
| 9257 | return NULL; |
| 9258 | } |
| 9259 | |
| 9260 | /** |
| 9261 | * object_manager_client_new_for_bus_sync: |
| 9262 | * @bus_type: A #GBusType. |
| 9263 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 9264 | * @name: A bus name (well-known or unique). |
| 9265 | * @object_path: An object path. |
| 9266 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 9267 | * @error: Return location for error or %NULL |
| 9268 | * |
| 9269 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 9270 | * |
| 9271 | * The calling thread is blocked until a reply is received. |
| 9272 | * |
| 9273 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 9274 | * |
| 9275 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 9276 | */ |
| 9277 | GDBusObjectManager * |
| 9278 | object_manager_client_new_for_bus_sync ( |
| 9279 | GBusType bus_type, |
| 9280 | GDBusObjectManagerClientFlags flags, |
| 9281 | const gchar *name, |
| 9282 | const gchar *object_path, |
| 9283 | GCancellable *cancellable, |
| 9284 | GError **error) |
| 9285 | { |
| 9286 | GInitable *ret; |
| 9287 | 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); |
| 9288 | if (ret != NULL) |
| 9289 | return G_DBUS_OBJECT_MANAGER (ret); |
| 9290 | else |
| 9291 | return NULL; |
| 9292 | } |
| 9293 | |
| 9294 | |