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 | /* ------------------------------------------------------------------------ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 152 | * Code for interface org.openbmc.SensorValue |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 153 | * ------------------------------------------------------------------------ |
| 154 | */ |
| 155 | |
| 156 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 157 | * SECTION:SensorValue |
| 158 | * @title: SensorValue |
| 159 | * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 160 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface in C. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 162 | */ |
| 163 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 164 | /* ---- Introspection data for org.openbmc.SensorValue ---- */ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 165 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 166 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 167 | { |
| 168 | { |
| 169 | -1, |
| 170 | (gchar *) "init", |
| 171 | NULL, |
| 172 | NULL, |
| 173 | NULL |
| 174 | }, |
| 175 | "handle-init", |
| 176 | FALSE |
| 177 | }; |
| 178 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 179 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 180 | { |
| 181 | { |
| 182 | -1, |
| 183 | (gchar *) "value", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 184 | (gchar *) "v", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 185 | NULL |
| 186 | }, |
| 187 | FALSE |
| 188 | }; |
| 189 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 190 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 191 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 192 | &_sensor_value_method_info_get_value_OUT_ARG_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 193 | NULL |
| 194 | }; |
| 195 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 196 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 197 | { |
| 198 | { |
| 199 | -1, |
| 200 | (gchar *) "getValue", |
| 201 | NULL, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 202 | (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 203 | NULL |
| 204 | }, |
| 205 | "handle-get-value", |
| 206 | FALSE |
| 207 | }; |
| 208 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 209 | static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 210 | { |
| 211 | { |
| 212 | -1, |
| 213 | (gchar *) "value", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 214 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 215 | NULL |
| 216 | }, |
| 217 | FALSE |
| 218 | }; |
| 219 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 220 | static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 221 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 222 | &_sensor_value_method_info_set_value_IN_ARG_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 223 | NULL |
| 224 | }; |
| 225 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 226 | static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 227 | { |
| 228 | { |
| 229 | -1, |
| 230 | (gchar *) "setValue", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 231 | (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 232 | NULL, |
| 233 | NULL |
| 234 | }, |
| 235 | "handle-set-value", |
| 236 | FALSE |
| 237 | }; |
| 238 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 239 | static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 240 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 241 | &_sensor_value_method_info_init, |
| 242 | &_sensor_value_method_info_get_value, |
| 243 | &_sensor_value_method_info_set_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 244 | NULL |
| 245 | }; |
| 246 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 247 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 248 | { |
| 249 | { |
| 250 | -1, |
| 251 | (gchar *) "value", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 252 | (gchar *) "v", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 253 | NULL |
| 254 | }, |
| 255 | FALSE |
| 256 | }; |
| 257 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 258 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 259 | { |
| 260 | { |
| 261 | -1, |
| 262 | (gchar *) "units", |
| 263 | (gchar *) "s", |
| 264 | NULL |
| 265 | }, |
| 266 | FALSE |
| 267 | }; |
| 268 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 269 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 270 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 271 | &_sensor_value_signal_info_changed_ARG_value, |
| 272 | &_sensor_value_signal_info_changed_ARG_units, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 273 | NULL |
| 274 | }; |
| 275 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 276 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 277 | { |
| 278 | { |
| 279 | -1, |
| 280 | (gchar *) "Changed", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 281 | (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 282 | NULL |
| 283 | }, |
| 284 | "changed" |
| 285 | }; |
| 286 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 287 | static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 288 | { |
| 289 | { |
| 290 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 291 | (gchar *) "bus_name", |
| 292 | (gchar *) "s", |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 293 | NULL |
| 294 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 295 | FALSE |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 296 | }; |
| 297 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 298 | static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 299 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 300 | &_sensor_value_signal_info_heartbeat_ARG_bus_name, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 301 | NULL |
| 302 | }; |
| 303 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 304 | static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 305 | { |
| 306 | { |
| 307 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 308 | (gchar *) "Heartbeat", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 309 | (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 310 | NULL |
| 311 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 312 | "heartbeat" |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 313 | }; |
| 314 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 315 | static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 316 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 317 | &_sensor_value_signal_info_changed, |
| 318 | &_sensor_value_signal_info_heartbeat, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 319 | NULL |
| 320 | }; |
| 321 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 322 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 323 | { |
| 324 | { |
| 325 | -1, |
| 326 | (gchar *) "value", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 327 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 328 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 329 | NULL |
| 330 | }, |
| 331 | "value", |
| 332 | FALSE |
| 333 | }; |
| 334 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 335 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 336 | { |
| 337 | { |
| 338 | -1, |
| 339 | (gchar *) "units", |
| 340 | (gchar *) "s", |
| 341 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 342 | NULL |
| 343 | }, |
| 344 | "units", |
| 345 | FALSE |
| 346 | }; |
| 347 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 348 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 349 | { |
| 350 | { |
| 351 | -1, |
| 352 | (gchar *) "poll_interval", |
| 353 | (gchar *) "i", |
| 354 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 355 | NULL |
| 356 | }, |
| 357 | "poll-interval", |
| 358 | FALSE |
| 359 | }; |
| 360 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 361 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 362 | { |
| 363 | { |
| 364 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 365 | (gchar *) "heatbeat", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 366 | (gchar *) "i", |
| 367 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 368 | NULL |
| 369 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 370 | "heatbeat", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 371 | FALSE |
| 372 | }; |
| 373 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 374 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 375 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 376 | &_sensor_value_property_info_value, |
| 377 | &_sensor_value_property_info_units, |
| 378 | &_sensor_value_property_info_poll_interval, |
| 379 | &_sensor_value_property_info_heatbeat, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 380 | NULL |
| 381 | }; |
| 382 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 383 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 384 | { |
| 385 | { |
| 386 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 387 | (gchar *) "org.openbmc.SensorValue", |
| 388 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 389 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 390 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 391 | NULL |
| 392 | }, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 393 | "sensor-value", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 394 | }; |
| 395 | |
| 396 | |
| 397 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 398 | * sensor_value_interface_info: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 399 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 400 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 401 | * |
| 402 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 403 | */ |
| 404 | GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 405 | sensor_value_interface_info (void) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 406 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 407 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 411 | * sensor_value_override_properties: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 412 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 413 | * @property_id_begin: The property id to assign to the first overridden property. |
| 414 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 415 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 416 | * The properties are overridden in the order they are defined. |
| 417 | * |
| 418 | * Returns: The last property id. |
| 419 | */ |
| 420 | guint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 421 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 422 | { |
| 423 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 424 | g_object_class_override_property (klass, property_id_begin++, "units"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 425 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 426 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 427 | return property_id_begin - 1; |
| 428 | } |
| 429 | |
| 430 | |
| 431 | |
| 432 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 433 | * SensorValue: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 434 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 435 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 436 | */ |
| 437 | |
| 438 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 439 | * SensorValueIface: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 440 | * @parent_iface: The parent interface. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 441 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 442 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
| 443 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
| 444 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
| 445 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
| 446 | * @get_units: Getter for the #SensorValue:units property. |
| 447 | * @get_value: Getter for the #SensorValue:value property. |
| 448 | * @changed: Handler for the #SensorValue::changed signal. |
| 449 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 450 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 451 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 452 | */ |
| 453 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 454 | typedef SensorValueIface SensorValueInterface; |
| 455 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 456 | |
| 457 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 458 | sensor_value_default_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 459 | { |
| 460 | /* GObject signals for incoming D-Bus method calls: */ |
| 461 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 462 | * SensorValue::handle-init: |
| 463 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 464 | * @invocation: A #GDBusMethodInvocation. |
| 465 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 466 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 467 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 468 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 469 | * |
| 470 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 471 | */ |
| 472 | g_signal_new ("handle-init", |
| 473 | G_TYPE_FROM_INTERFACE (iface), |
| 474 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 475 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 476 | g_signal_accumulator_true_handled, |
| 477 | NULL, |
| 478 | g_cclosure_marshal_generic, |
| 479 | G_TYPE_BOOLEAN, |
| 480 | 1, |
| 481 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 482 | |
| 483 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 484 | * SensorValue::handle-get-value: |
| 485 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 486 | * @invocation: A #GDBusMethodInvocation. |
| 487 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 488 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 489 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 490 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 491 | * |
| 492 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 493 | */ |
| 494 | g_signal_new ("handle-get-value", |
| 495 | G_TYPE_FROM_INTERFACE (iface), |
| 496 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 497 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 498 | g_signal_accumulator_true_handled, |
| 499 | NULL, |
| 500 | g_cclosure_marshal_generic, |
| 501 | G_TYPE_BOOLEAN, |
| 502 | 1, |
| 503 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 504 | |
| 505 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 506 | * SensorValue::handle-set-value: |
| 507 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 508 | * @invocation: A #GDBusMethodInvocation. |
| 509 | * @arg_value: Argument passed by remote caller. |
| 510 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 511 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 512 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 513 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 514 | * |
| 515 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 516 | */ |
| 517 | g_signal_new ("handle-set-value", |
| 518 | G_TYPE_FROM_INTERFACE (iface), |
| 519 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 520 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 521 | g_signal_accumulator_true_handled, |
| 522 | NULL, |
| 523 | g_cclosure_marshal_generic, |
| 524 | G_TYPE_BOOLEAN, |
| 525 | 2, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 526 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 527 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 528 | /* GObject signals for received D-Bus signals: */ |
| 529 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 530 | * SensorValue::changed: |
| 531 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 532 | * @arg_value: Argument. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 533 | * @arg_units: Argument. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 534 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 535 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> is received. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 536 | * |
| 537 | * 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. |
| 538 | */ |
| 539 | g_signal_new ("changed", |
| 540 | G_TYPE_FROM_INTERFACE (iface), |
| 541 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 542 | G_STRUCT_OFFSET (SensorValueIface, changed), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 543 | NULL, |
| 544 | NULL, |
| 545 | g_cclosure_marshal_generic, |
| 546 | G_TYPE_NONE, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 547 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 548 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 549 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 550 | * SensorValue::heartbeat: |
| 551 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 552 | * @arg_bus_name: Argument. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 553 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 554 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> is received. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 555 | * |
| 556 | * 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. |
| 557 | */ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 558 | g_signal_new ("heartbeat", |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 559 | G_TYPE_FROM_INTERFACE (iface), |
| 560 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 561 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 562 | NULL, |
| 563 | NULL, |
| 564 | g_cclosure_marshal_generic, |
| 565 | G_TYPE_NONE, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 566 | 1, G_TYPE_STRING); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 567 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 568 | /* GObject properties for D-Bus properties: */ |
| 569 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 570 | * SensorValue:value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 571 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 572 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 573 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 574 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 575 | */ |
| 576 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 577 | g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 578 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 579 | * SensorValue:units: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 580 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 581 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 582 | * |
| 583 | * 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. |
| 584 | */ |
| 585 | g_object_interface_install_property (iface, |
| 586 | 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] | 587 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 588 | * SensorValue:poll-interval: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 589 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 590 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 591 | * |
| 592 | * 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. |
| 593 | */ |
| 594 | g_object_interface_install_property (iface, |
| 595 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 596 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 597 | * SensorValue:heatbeat: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 598 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 599 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 600 | * |
| 601 | * 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. |
| 602 | */ |
| 603 | g_object_interface_install_property (iface, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 604 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 608 | * sensor_value_get_value: (skip) |
| 609 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 610 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 611 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 612 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 613 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 614 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 615 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning> |
| 616 | * |
| 617 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 618 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 619 | GVariant * |
| 620 | sensor_value_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 621 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 622 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 626 | * sensor_value_dup_value: (skip) |
| 627 | * @object: A #SensorValue. |
| 628 | * |
| 629 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 630 | * |
| 631 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 632 | * |
| 633 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 634 | */ |
| 635 | GVariant * |
| 636 | sensor_value_dup_value (SensorValue *object) |
| 637 | { |
| 638 | GVariant *value; |
| 639 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 640 | return value; |
| 641 | } |
| 642 | |
| 643 | /** |
| 644 | * sensor_value_set_value: (skip) |
| 645 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 646 | * @value: The value to set. |
| 647 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 648 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 649 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 650 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 651 | */ |
| 652 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 653 | sensor_value_set_value (SensorValue *object, GVariant *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 654 | { |
| 655 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 656 | } |
| 657 | |
| 658 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 659 | * sensor_value_get_units: (skip) |
| 660 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 661 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 662 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 663 | * |
| 664 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 665 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 666 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning> |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 667 | * |
| 668 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 669 | */ |
| 670 | const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 671 | sensor_value_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 672 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 673 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 677 | * sensor_value_dup_units: (skip) |
| 678 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 679 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 680 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 681 | * |
| 682 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 683 | * |
| 684 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 685 | */ |
| 686 | gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 687 | sensor_value_dup_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 688 | { |
| 689 | gchar *value; |
| 690 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 691 | return value; |
| 692 | } |
| 693 | |
| 694 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 695 | * sensor_value_set_units: (skip) |
| 696 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 697 | * @value: The value to set. |
| 698 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 699 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 700 | * |
| 701 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 702 | */ |
| 703 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 704 | sensor_value_set_units (SensorValue *object, const gchar *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 705 | { |
| 706 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 707 | } |
| 708 | |
| 709 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 710 | * sensor_value_get_poll_interval: (skip) |
| 711 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 712 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 713 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 714 | * |
| 715 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 716 | * |
| 717 | * Returns: The property value. |
| 718 | */ |
| 719 | gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 720 | sensor_value_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 721 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 722 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 726 | * sensor_value_set_poll_interval: (skip) |
| 727 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 728 | * @value: The value to set. |
| 729 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 730 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 731 | * |
| 732 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 733 | */ |
| 734 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 735 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 736 | { |
| 737 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 738 | } |
| 739 | |
| 740 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 741 | * sensor_value_get_heatbeat: (skip) |
| 742 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 743 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 744 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 745 | * |
| 746 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 747 | * |
| 748 | * Returns: The property value. |
| 749 | */ |
| 750 | gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 751 | sensor_value_get_heatbeat (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 752 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 753 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 757 | * sensor_value_set_heatbeat: (skip) |
| 758 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 759 | * @value: The value to set. |
| 760 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 761 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 762 | * |
| 763 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 764 | */ |
| 765 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 766 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 767 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 768 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 772 | * sensor_value_emit_changed: |
| 773 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 774 | * @arg_value: Argument to pass with the signal. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 775 | * @arg_units: Argument to pass with the signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 776 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 777 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 778 | */ |
| 779 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 780 | sensor_value_emit_changed ( |
| 781 | SensorValue *object, |
| 782 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 783 | const gchar *arg_units) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 784 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 785 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 789 | * sensor_value_emit_heartbeat: |
| 790 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 791 | * @arg_bus_name: Argument to pass with the signal. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 792 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 793 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 794 | */ |
| 795 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 796 | sensor_value_emit_heartbeat ( |
| 797 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 798 | const gchar *arg_bus_name) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 799 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 800 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 801 | } |
| 802 | |
| 803 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 804 | * sensor_value_call_init: |
| 805 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 806 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 807 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 808 | * @user_data: User data to pass to @callback. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 809 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 810 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 811 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 812 | * You can then call sensor_value_call_init_finish() to get the result of the operation. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 813 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 814 | * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 815 | */ |
| 816 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 817 | sensor_value_call_init ( |
| 818 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 819 | GCancellable *cancellable, |
| 820 | GAsyncReadyCallback callback, |
| 821 | gpointer user_data) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 822 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 823 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 824 | "init", |
| 825 | g_variant_new ("()"), |
| 826 | G_DBUS_CALL_FLAGS_NONE, |
| 827 | -1, |
| 828 | cancellable, |
| 829 | callback, |
| 830 | user_data); |
| 831 | } |
| 832 | |
| 833 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 834 | * sensor_value_call_init_finish: |
| 835 | * @proxy: A #SensorValueProxy. |
| 836 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 837 | * @error: Return location for error or %NULL. |
| 838 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 839 | * Finishes an operation started with sensor_value_call_init(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 840 | * |
| 841 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 842 | */ |
| 843 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 844 | sensor_value_call_init_finish ( |
| 845 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 846 | GAsyncResult *res, |
| 847 | GError **error) |
| 848 | { |
| 849 | GVariant *_ret; |
| 850 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 851 | if (_ret == NULL) |
| 852 | goto _out; |
| 853 | g_variant_get (_ret, |
| 854 | "()"); |
| 855 | g_variant_unref (_ret); |
| 856 | _out: |
| 857 | return _ret != NULL; |
| 858 | } |
| 859 | |
| 860 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 861 | * sensor_value_call_init_sync: |
| 862 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 863 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 864 | * @error: Return location for error or %NULL. |
| 865 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 866 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 867 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 868 | * See sensor_value_call_init() for the asynchronous version of this method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 869 | * |
| 870 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 871 | */ |
| 872 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 873 | sensor_value_call_init_sync ( |
| 874 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 875 | GCancellable *cancellable, |
| 876 | GError **error) |
| 877 | { |
| 878 | GVariant *_ret; |
| 879 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 880 | "init", |
| 881 | g_variant_new ("()"), |
| 882 | G_DBUS_CALL_FLAGS_NONE, |
| 883 | -1, |
| 884 | cancellable, |
| 885 | error); |
| 886 | if (_ret == NULL) |
| 887 | goto _out; |
| 888 | g_variant_get (_ret, |
| 889 | "()"); |
| 890 | g_variant_unref (_ret); |
| 891 | _out: |
| 892 | return _ret != NULL; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 893 | } |
| 894 | |
| 895 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 896 | * sensor_value_call_get_value: |
| 897 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 898 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 899 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 900 | * @user_data: User data to pass to @callback. |
| 901 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 902 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 903 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 904 | * You can then call sensor_value_call_get_value_finish() to get the result of the operation. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 905 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 906 | * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 907 | */ |
| 908 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 909 | sensor_value_call_get_value ( |
| 910 | SensorValue *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 911 | GCancellable *cancellable, |
| 912 | GAsyncReadyCallback callback, |
| 913 | gpointer user_data) |
| 914 | { |
| 915 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 916 | "getValue", |
| 917 | g_variant_new ("()"), |
| 918 | G_DBUS_CALL_FLAGS_NONE, |
| 919 | -1, |
| 920 | cancellable, |
| 921 | callback, |
| 922 | user_data); |
| 923 | } |
| 924 | |
| 925 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 926 | * sensor_value_call_get_value_finish: |
| 927 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 928 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 929 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 930 | * @error: Return location for error or %NULL. |
| 931 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 932 | * Finishes an operation started with sensor_value_call_get_value(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 933 | * |
| 934 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 935 | */ |
| 936 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 937 | sensor_value_call_get_value_finish ( |
| 938 | SensorValue *proxy, |
| 939 | GVariant **out_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 940 | GAsyncResult *res, |
| 941 | GError **error) |
| 942 | { |
| 943 | GVariant *_ret; |
| 944 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 945 | if (_ret == NULL) |
| 946 | goto _out; |
| 947 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 948 | "(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 949 | out_value); |
| 950 | g_variant_unref (_ret); |
| 951 | _out: |
| 952 | return _ret != NULL; |
| 953 | } |
| 954 | |
| 955 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 956 | * sensor_value_call_get_value_sync: |
| 957 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 958 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 959 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 960 | * @error: Return location for error or %NULL. |
| 961 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 962 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 963 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 964 | * See sensor_value_call_get_value() for the asynchronous version of this method. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 965 | * |
| 966 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 967 | */ |
| 968 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 969 | sensor_value_call_get_value_sync ( |
| 970 | SensorValue *proxy, |
| 971 | GVariant **out_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 972 | GCancellable *cancellable, |
| 973 | GError **error) |
| 974 | { |
| 975 | GVariant *_ret; |
| 976 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 977 | "getValue", |
| 978 | g_variant_new ("()"), |
| 979 | G_DBUS_CALL_FLAGS_NONE, |
| 980 | -1, |
| 981 | cancellable, |
| 982 | error); |
| 983 | if (_ret == NULL) |
| 984 | goto _out; |
| 985 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 986 | "(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 987 | out_value); |
| 988 | g_variant_unref (_ret); |
| 989 | _out: |
| 990 | return _ret != NULL; |
| 991 | } |
| 992 | |
| 993 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 994 | * sensor_value_call_set_value: |
| 995 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 996 | * @arg_value: Argument to pass with the method invocation. |
| 997 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 998 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 999 | * @user_data: User data to pass to @callback. |
| 1000 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1001 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1002 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1003 | * You can then call sensor_value_call_set_value_finish() to get the result of the operation. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1004 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1005 | * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1006 | */ |
| 1007 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1008 | sensor_value_call_set_value ( |
| 1009 | SensorValue *proxy, |
| 1010 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1011 | GCancellable *cancellable, |
| 1012 | GAsyncReadyCallback callback, |
| 1013 | gpointer user_data) |
| 1014 | { |
| 1015 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1016 | "setValue", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1017 | g_variant_new ("(@v)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1018 | arg_value), |
| 1019 | G_DBUS_CALL_FLAGS_NONE, |
| 1020 | -1, |
| 1021 | cancellable, |
| 1022 | callback, |
| 1023 | user_data); |
| 1024 | } |
| 1025 | |
| 1026 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1027 | * sensor_value_call_set_value_finish: |
| 1028 | * @proxy: A #SensorValueProxy. |
| 1029 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1030 | * @error: Return location for error or %NULL. |
| 1031 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1032 | * Finishes an operation started with sensor_value_call_set_value(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1033 | * |
| 1034 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1035 | */ |
| 1036 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1037 | sensor_value_call_set_value_finish ( |
| 1038 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1039 | GAsyncResult *res, |
| 1040 | GError **error) |
| 1041 | { |
| 1042 | GVariant *_ret; |
| 1043 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1044 | if (_ret == NULL) |
| 1045 | goto _out; |
| 1046 | g_variant_get (_ret, |
| 1047 | "()"); |
| 1048 | g_variant_unref (_ret); |
| 1049 | _out: |
| 1050 | return _ret != NULL; |
| 1051 | } |
| 1052 | |
| 1053 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1054 | * sensor_value_call_set_value_sync: |
| 1055 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1056 | * @arg_value: Argument to pass with the method invocation. |
| 1057 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1058 | * @error: Return location for error or %NULL. |
| 1059 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1060 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1061 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1062 | * See sensor_value_call_set_value() for the asynchronous version of this method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1063 | * |
| 1064 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1065 | */ |
| 1066 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1067 | sensor_value_call_set_value_sync ( |
| 1068 | SensorValue *proxy, |
| 1069 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1070 | GCancellable *cancellable, |
| 1071 | GError **error) |
| 1072 | { |
| 1073 | GVariant *_ret; |
| 1074 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1075 | "setValue", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1076 | g_variant_new ("(@v)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1077 | arg_value), |
| 1078 | G_DBUS_CALL_FLAGS_NONE, |
| 1079 | -1, |
| 1080 | cancellable, |
| 1081 | error); |
| 1082 | if (_ret == NULL) |
| 1083 | goto _out; |
| 1084 | g_variant_get (_ret, |
| 1085 | "()"); |
| 1086 | g_variant_unref (_ret); |
| 1087 | _out: |
| 1088 | return _ret != NULL; |
| 1089 | } |
| 1090 | |
| 1091 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1092 | * sensor_value_complete_init: |
| 1093 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1094 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1095 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1096 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1097 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1098 | * This method will free @invocation, you cannot use it afterwards. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1099 | */ |
| 1100 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1101 | sensor_value_complete_init ( |
| 1102 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1103 | GDBusMethodInvocation *invocation) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1104 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1105 | g_dbus_method_invocation_return_value (invocation, |
| 1106 | g_variant_new ("()")); |
Norman James | e759492 | 2015-08-27 14:25:24 -0500 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1110 | * sensor_value_complete_get_value: |
| 1111 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1112 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1113 | * @value: Parameter to return. |
| 1114 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1115 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1116 | * |
| 1117 | * This method will free @invocation, you cannot use it afterwards. |
| 1118 | */ |
| 1119 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1120 | sensor_value_complete_get_value ( |
| 1121 | SensorValue *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1122 | GDBusMethodInvocation *invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1123 | GVariant *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1124 | { |
| 1125 | g_dbus_method_invocation_return_value (invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1126 | g_variant_new ("(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1127 | value)); |
| 1128 | } |
| 1129 | |
| 1130 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1131 | * sensor_value_complete_set_value: |
| 1132 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1133 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1134 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1135 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1136 | * |
| 1137 | * This method will free @invocation, you cannot use it afterwards. |
| 1138 | */ |
| 1139 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1140 | sensor_value_complete_set_value ( |
| 1141 | SensorValue *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1142 | GDBusMethodInvocation *invocation) |
| 1143 | { |
| 1144 | g_dbus_method_invocation_return_value (invocation, |
| 1145 | g_variant_new ("()")); |
| 1146 | } |
| 1147 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1148 | /* ------------------------------------------------------------------------ */ |
| 1149 | |
| 1150 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1151 | * SensorValueProxy: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1152 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1153 | * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1154 | */ |
| 1155 | |
| 1156 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1157 | * SensorValueProxyClass: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1158 | * @parent_class: The parent class. |
| 1159 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1160 | * Class structure for #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1161 | */ |
| 1162 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1163 | struct _SensorValueProxyPrivate |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1164 | { |
| 1165 | GData *qdata; |
| 1166 | }; |
| 1167 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1168 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1169 | |
| 1170 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1171 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 1172 | G_ADD_PRIVATE (SensorValueProxy) |
| 1173 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1174 | |
| 1175 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1176 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 1177 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1178 | |
| 1179 | #endif |
| 1180 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1181 | sensor_value_proxy_finalize (GObject *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1182 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1183 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1184 | g_datalist_clear (&proxy->priv->qdata); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1185 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1186 | } |
| 1187 | |
| 1188 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1189 | sensor_value_proxy_get_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1190 | guint prop_id, |
| 1191 | GValue *value, |
| 1192 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1193 | { |
| 1194 | const _ExtendedGDBusPropertyInfo *info; |
| 1195 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1196 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1197 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1198 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1199 | if (info->use_gvariant) |
| 1200 | { |
| 1201 | g_value_set_variant (value, variant); |
| 1202 | } |
| 1203 | else |
| 1204 | { |
| 1205 | if (variant != NULL) |
| 1206 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1207 | } |
| 1208 | if (variant != NULL) |
| 1209 | g_variant_unref (variant); |
| 1210 | } |
| 1211 | |
| 1212 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1213 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1214 | GAsyncResult *res, |
| 1215 | gpointer user_data) |
| 1216 | { |
| 1217 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1218 | GError *error; |
| 1219 | GVariant *_ret; |
| 1220 | error = NULL; |
| 1221 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1222 | if (!_ret) |
| 1223 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1224 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1225 | info->parent_struct.name, |
| 1226 | error->message, g_quark_to_string (error->domain), error->code); |
| 1227 | g_error_free (error); |
| 1228 | } |
| 1229 | else |
| 1230 | { |
| 1231 | g_variant_unref (_ret); |
| 1232 | } |
| 1233 | } |
| 1234 | |
| 1235 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1236 | sensor_value_proxy_set_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1237 | guint prop_id, |
| 1238 | const GValue *value, |
| 1239 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1240 | { |
| 1241 | const _ExtendedGDBusPropertyInfo *info; |
| 1242 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1243 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1244 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1245 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1246 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1247 | "org.freedesktop.DBus.Properties.Set", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1248 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1249 | G_DBUS_CALL_FLAGS_NONE, |
| 1250 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1251 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1252 | g_variant_unref (variant); |
| 1253 | } |
| 1254 | |
| 1255 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1256 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1257 | const gchar *sender_name G_GNUC_UNUSED, |
| 1258 | const gchar *signal_name, |
| 1259 | GVariant *parameters) |
| 1260 | { |
| 1261 | _ExtendedGDBusSignalInfo *info; |
| 1262 | GVariantIter iter; |
| 1263 | GVariant *child; |
| 1264 | GValue *paramv; |
| 1265 | guint num_params; |
| 1266 | guint n; |
| 1267 | guint signal_id; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1268 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1269 | if (info == NULL) |
| 1270 | return; |
| 1271 | num_params = g_variant_n_children (parameters); |
| 1272 | paramv = g_new0 (GValue, num_params + 1); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1273 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1274 | g_value_set_object (¶mv[0], proxy); |
| 1275 | g_variant_iter_init (&iter, parameters); |
| 1276 | n = 1; |
| 1277 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1278 | { |
| 1279 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1280 | if (arg_info->use_gvariant) |
| 1281 | { |
| 1282 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1283 | g_value_set_variant (¶mv[n], child); |
| 1284 | n++; |
| 1285 | } |
| 1286 | else |
| 1287 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1288 | g_variant_unref (child); |
| 1289 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1290 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1291 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1292 | for (n = 0; n < num_params + 1; n++) |
| 1293 | g_value_unset (¶mv[n]); |
| 1294 | g_free (paramv); |
| 1295 | } |
| 1296 | |
| 1297 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1298 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1299 | GVariant *changed_properties, |
| 1300 | const gchar *const *invalidated_properties) |
| 1301 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1302 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1303 | guint n; |
| 1304 | const gchar *key; |
| 1305 | GVariantIter *iter; |
| 1306 | _ExtendedGDBusPropertyInfo *info; |
| 1307 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 1308 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1309 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1310 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1311 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1312 | if (info != NULL) |
| 1313 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1314 | } |
| 1315 | g_variant_iter_free (iter); |
| 1316 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1317 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1318 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1319 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1320 | if (info != NULL) |
| 1321 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1322 | } |
| 1323 | } |
| 1324 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1325 | static GVariant * |
| 1326 | sensor_value_proxy_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1327 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1328 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1329 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1330 | GVariant *value = NULL; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1331 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1332 | value = variant; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1333 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1334 | g_variant_unref (variant); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1335 | return value; |
| 1336 | } |
| 1337 | |
| 1338 | static const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1339 | sensor_value_proxy_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1340 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1341 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1342 | GVariant *variant; |
| 1343 | const gchar *value = NULL; |
| 1344 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 1345 | if (variant != NULL) |
| 1346 | { |
| 1347 | value = g_variant_get_string (variant, NULL); |
| 1348 | g_variant_unref (variant); |
| 1349 | } |
| 1350 | return value; |
| 1351 | } |
| 1352 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1353 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1354 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1355 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1356 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1357 | GVariant *variant; |
| 1358 | gint value = 0; |
| 1359 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 1360 | if (variant != NULL) |
| 1361 | { |
| 1362 | value = g_variant_get_int32 (variant); |
| 1363 | g_variant_unref (variant); |
| 1364 | } |
| 1365 | return value; |
| 1366 | } |
| 1367 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1368 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1369 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1370 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1371 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1372 | GVariant *variant; |
| 1373 | gint value = 0; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1374 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1375 | if (variant != NULL) |
| 1376 | { |
| 1377 | value = g_variant_get_int32 (variant); |
| 1378 | g_variant_unref (variant); |
| 1379 | } |
| 1380 | return value; |
| 1381 | } |
| 1382 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1383 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1384 | sensor_value_proxy_init (SensorValueProxy *proxy) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1385 | { |
| 1386 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1387 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1388 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1389 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1390 | #endif |
| 1391 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1392 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1393 | } |
| 1394 | |
| 1395 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1396 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1397 | { |
| 1398 | GObjectClass *gobject_class; |
| 1399 | GDBusProxyClass *proxy_class; |
| 1400 | |
| 1401 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1402 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 1403 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 1404 | gobject_class->set_property = sensor_value_proxy_set_property; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1405 | |
| 1406 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1407 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 1408 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1409 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1410 | sensor_value_override_properties (gobject_class, 1); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1411 | |
| 1412 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1413 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1414 | #endif |
| 1415 | } |
| 1416 | |
| 1417 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1418 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1419 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1420 | iface->get_value = sensor_value_proxy_get_value; |
| 1421 | iface->get_units = sensor_value_proxy_get_units; |
| 1422 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 1423 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1424 | } |
| 1425 | |
| 1426 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1427 | * sensor_value_proxy_new: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1428 | * @connection: A #GDBusConnection. |
| 1429 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1430 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1431 | * @object_path: An object path. |
| 1432 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1433 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1434 | * @user_data: User data to pass to @callback. |
| 1435 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1436 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new() for more details. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1437 | * |
| 1438 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1439 | * You can then call sensor_value_proxy_new_finish() to get the result of the operation. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1440 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1441 | * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1442 | */ |
| 1443 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1444 | sensor_value_proxy_new ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1445 | GDBusConnection *connection, |
| 1446 | GDBusProxyFlags flags, |
| 1447 | const gchar *name, |
| 1448 | const gchar *object_path, |
| 1449 | GCancellable *cancellable, |
| 1450 | GAsyncReadyCallback callback, |
| 1451 | gpointer user_data) |
| 1452 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1453 | g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1454 | } |
| 1455 | |
| 1456 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1457 | * sensor_value_proxy_new_finish: |
| 1458 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1459 | * @error: Return location for error or %NULL |
| 1460 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1461 | * Finishes an operation started with sensor_value_proxy_new(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1462 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1463 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1464 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1465 | SensorValue * |
| 1466 | sensor_value_proxy_new_finish ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1467 | GAsyncResult *res, |
| 1468 | GError **error) |
| 1469 | { |
| 1470 | GObject *ret; |
| 1471 | GObject *source_object; |
| 1472 | source_object = g_async_result_get_source_object (res); |
| 1473 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1474 | g_object_unref (source_object); |
| 1475 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1476 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1477 | else |
| 1478 | return NULL; |
| 1479 | } |
| 1480 | |
| 1481 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1482 | * sensor_value_proxy_new_sync: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1483 | * @connection: A #GDBusConnection. |
| 1484 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1485 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1486 | * @object_path: An object path. |
| 1487 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1488 | * @error: Return location for error or %NULL |
| 1489 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1490 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new_sync() for more details. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1491 | * |
| 1492 | * The calling thread is blocked until a reply is received. |
| 1493 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1494 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1495 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1496 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1497 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1498 | SensorValue * |
| 1499 | sensor_value_proxy_new_sync ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1500 | GDBusConnection *connection, |
| 1501 | GDBusProxyFlags flags, |
| 1502 | const gchar *name, |
| 1503 | const gchar *object_path, |
| 1504 | GCancellable *cancellable, |
| 1505 | GError **error) |
| 1506 | { |
| 1507 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1508 | ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1509 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1510 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1511 | else |
| 1512 | return NULL; |
| 1513 | } |
| 1514 | |
| 1515 | |
| 1516 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1517 | * sensor_value_proxy_new_for_bus: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1518 | * @bus_type: A #GBusType. |
| 1519 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1520 | * @name: A bus name (well-known or unique). |
| 1521 | * @object_path: An object path. |
| 1522 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1523 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1524 | * @user_data: User data to pass to @callback. |
| 1525 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1526 | * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1527 | * |
| 1528 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1529 | * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1530 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1531 | * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1532 | */ |
| 1533 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1534 | sensor_value_proxy_new_for_bus ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1535 | GBusType bus_type, |
| 1536 | GDBusProxyFlags flags, |
| 1537 | const gchar *name, |
| 1538 | const gchar *object_path, |
| 1539 | GCancellable *cancellable, |
| 1540 | GAsyncReadyCallback callback, |
| 1541 | gpointer user_data) |
| 1542 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1543 | g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1547 | * sensor_value_proxy_new_for_bus_finish: |
| 1548 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1549 | * @error: Return location for error or %NULL |
| 1550 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1551 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1552 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1553 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1554 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1555 | SensorValue * |
| 1556 | sensor_value_proxy_new_for_bus_finish ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1557 | GAsyncResult *res, |
| 1558 | GError **error) |
| 1559 | { |
| 1560 | GObject *ret; |
| 1561 | GObject *source_object; |
| 1562 | source_object = g_async_result_get_source_object (res); |
| 1563 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1564 | g_object_unref (source_object); |
| 1565 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1566 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1567 | else |
| 1568 | return NULL; |
| 1569 | } |
| 1570 | |
| 1571 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1572 | * sensor_value_proxy_new_for_bus_sync: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1573 | * @bus_type: A #GBusType. |
| 1574 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1575 | * @name: A bus name (well-known or unique). |
| 1576 | * @object_path: An object path. |
| 1577 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1578 | * @error: Return location for error or %NULL |
| 1579 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1580 | * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1581 | * |
| 1582 | * The calling thread is blocked until a reply is received. |
| 1583 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1584 | * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1585 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1586 | * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1587 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1588 | SensorValue * |
| 1589 | sensor_value_proxy_new_for_bus_sync ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1590 | GBusType bus_type, |
| 1591 | GDBusProxyFlags flags, |
| 1592 | const gchar *name, |
| 1593 | const gchar *object_path, |
| 1594 | GCancellable *cancellable, |
| 1595 | GError **error) |
| 1596 | { |
| 1597 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1598 | ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1599 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1600 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1601 | else |
| 1602 | return NULL; |
| 1603 | } |
| 1604 | |
| 1605 | |
| 1606 | /* ------------------------------------------------------------------------ */ |
| 1607 | |
| 1608 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1609 | * SensorValueSkeleton: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1610 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1611 | * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1612 | */ |
| 1613 | |
| 1614 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1615 | * SensorValueSkeletonClass: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1616 | * @parent_class: The parent class. |
| 1617 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1618 | * Class structure for #SensorValueSkeleton. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1619 | */ |
| 1620 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1621 | struct _SensorValueSkeletonPrivate |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1622 | { |
| 1623 | GValue *properties; |
| 1624 | GList *changed_properties; |
| 1625 | GSource *changed_properties_idle_source; |
| 1626 | GMainContext *context; |
| 1627 | GMutex lock; |
| 1628 | }; |
| 1629 | |
| 1630 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1631 | _sensor_value_skeleton_handle_method_call ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1632 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1633 | const gchar *sender G_GNUC_UNUSED, |
| 1634 | const gchar *object_path G_GNUC_UNUSED, |
| 1635 | const gchar *interface_name, |
| 1636 | const gchar *method_name, |
| 1637 | GVariant *parameters, |
| 1638 | GDBusMethodInvocation *invocation, |
| 1639 | gpointer user_data) |
| 1640 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1641 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1642 | _ExtendedGDBusMethodInfo *info; |
| 1643 | GVariantIter iter; |
| 1644 | GVariant *child; |
| 1645 | GValue *paramv; |
| 1646 | guint num_params; |
| 1647 | guint num_extra; |
| 1648 | guint n; |
| 1649 | guint signal_id; |
| 1650 | GValue return_value = G_VALUE_INIT; |
| 1651 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1652 | g_assert (info != NULL); |
| 1653 | num_params = g_variant_n_children (parameters); |
| 1654 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1655 | n = 0; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1656 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1657 | g_value_set_object (¶mv[n++], skeleton); |
| 1658 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1659 | g_value_set_object (¶mv[n++], invocation); |
| 1660 | if (info->pass_fdlist) |
| 1661 | { |
| 1662 | #ifdef G_OS_UNIX |
| 1663 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1664 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1665 | #else |
| 1666 | g_assert_not_reached (); |
| 1667 | #endif |
| 1668 | } |
| 1669 | g_variant_iter_init (&iter, parameters); |
| 1670 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1671 | { |
| 1672 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1673 | if (arg_info->use_gvariant) |
| 1674 | { |
| 1675 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1676 | g_value_set_variant (¶mv[n], child); |
| 1677 | n++; |
| 1678 | } |
| 1679 | else |
| 1680 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1681 | g_variant_unref (child); |
| 1682 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1683 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1684 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1685 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1686 | if (!g_value_get_boolean (&return_value)) |
| 1687 | 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); |
| 1688 | g_value_unset (&return_value); |
| 1689 | for (n = 0; n < num_params + num_extra; n++) |
| 1690 | g_value_unset (¶mv[n]); |
| 1691 | g_free (paramv); |
| 1692 | } |
| 1693 | |
| 1694 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1695 | _sensor_value_skeleton_handle_get_property ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1696 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1697 | const gchar *sender G_GNUC_UNUSED, |
| 1698 | const gchar *object_path G_GNUC_UNUSED, |
| 1699 | const gchar *interface_name G_GNUC_UNUSED, |
| 1700 | const gchar *property_name, |
| 1701 | GError **error, |
| 1702 | gpointer user_data) |
| 1703 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1704 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1705 | GValue value = G_VALUE_INIT; |
| 1706 | GParamSpec *pspec; |
| 1707 | _ExtendedGDBusPropertyInfo *info; |
| 1708 | GVariant *ret; |
| 1709 | ret = NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1710 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1711 | g_assert (info != NULL); |
| 1712 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1713 | if (pspec == NULL) |
| 1714 | { |
| 1715 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1716 | } |
| 1717 | else |
| 1718 | { |
| 1719 | g_value_init (&value, pspec->value_type); |
| 1720 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1721 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1722 | g_value_unset (&value); |
| 1723 | } |
| 1724 | return ret; |
| 1725 | } |
| 1726 | |
| 1727 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1728 | _sensor_value_skeleton_handle_set_property ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1729 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1730 | const gchar *sender G_GNUC_UNUSED, |
| 1731 | const gchar *object_path G_GNUC_UNUSED, |
| 1732 | const gchar *interface_name G_GNUC_UNUSED, |
| 1733 | const gchar *property_name, |
| 1734 | GVariant *variant, |
| 1735 | GError **error, |
| 1736 | gpointer user_data) |
| 1737 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1738 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1739 | GValue value = G_VALUE_INIT; |
| 1740 | GParamSpec *pspec; |
| 1741 | _ExtendedGDBusPropertyInfo *info; |
| 1742 | gboolean ret; |
| 1743 | ret = FALSE; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1744 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1745 | g_assert (info != NULL); |
| 1746 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1747 | if (pspec == NULL) |
| 1748 | { |
| 1749 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1750 | } |
| 1751 | else |
| 1752 | { |
| 1753 | if (info->use_gvariant) |
| 1754 | g_value_set_variant (&value, variant); |
| 1755 | else |
| 1756 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1757 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1758 | g_value_unset (&value); |
| 1759 | ret = TRUE; |
| 1760 | } |
| 1761 | return ret; |
| 1762 | } |
| 1763 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1764 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1765 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1766 | _sensor_value_skeleton_handle_method_call, |
| 1767 | _sensor_value_skeleton_handle_get_property, |
| 1768 | _sensor_value_skeleton_handle_set_property, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1769 | {NULL} |
| 1770 | }; |
| 1771 | |
| 1772 | static GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1773 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1774 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1775 | return sensor_value_interface_info (); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1776 | } |
| 1777 | |
| 1778 | static GDBusInterfaceVTable * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1779 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1780 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1781 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1782 | } |
| 1783 | |
| 1784 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1785 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1786 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1787 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1788 | |
| 1789 | GVariantBuilder builder; |
| 1790 | guint n; |
| 1791 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1792 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1793 | goto out; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1794 | for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1795 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1796 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1797 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1798 | { |
| 1799 | GVariant *value; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1800 | value = _sensor_value_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", info->name, NULL, skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1801 | if (value != NULL) |
| 1802 | { |
| 1803 | g_variant_take_ref (value); |
| 1804 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1805 | g_variant_unref (value); |
| 1806 | } |
| 1807 | } |
| 1808 | } |
| 1809 | out: |
| 1810 | return g_variant_builder_end (&builder); |
| 1811 | } |
| 1812 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1813 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1814 | |
| 1815 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1816 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1817 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1818 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1819 | gboolean emit_changed = FALSE; |
| 1820 | |
| 1821 | g_mutex_lock (&skeleton->priv->lock); |
| 1822 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1823 | { |
| 1824 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1825 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1826 | emit_changed = TRUE; |
| 1827 | } |
| 1828 | g_mutex_unlock (&skeleton->priv->lock); |
| 1829 | |
| 1830 | if (emit_changed) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1831 | _sensor_value_emit_changed (skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1832 | } |
| 1833 | |
| 1834 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1835 | _sensor_value_on_signal_changed ( |
| 1836 | SensorValue *object, |
| 1837 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1838 | const gchar *arg_units) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1839 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1840 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1841 | |
| 1842 | GList *connections, *l; |
| 1843 | GVariant *signal_variant; |
| 1844 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1845 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1846 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1847 | arg_value, |
| 1848 | arg_units)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1849 | for (l = connections; l != NULL; l = l->next) |
| 1850 | { |
| 1851 | GDBusConnection *connection = l->data; |
| 1852 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1853 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1854 | signal_variant, NULL); |
| 1855 | } |
| 1856 | g_variant_unref (signal_variant); |
| 1857 | g_list_free_full (connections, g_object_unref); |
| 1858 | } |
| 1859 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1860 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1861 | _sensor_value_on_signal_heartbeat ( |
| 1862 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1863 | const gchar *arg_bus_name) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1864 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1865 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1866 | |
| 1867 | GList *connections, *l; |
| 1868 | GVariant *signal_variant; |
| 1869 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1870 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1871 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 1872 | arg_bus_name)); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1873 | for (l = connections; l != NULL; l = l->next) |
| 1874 | { |
| 1875 | GDBusConnection *connection = l->data; |
| 1876 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1877 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1878 | signal_variant, NULL); |
| 1879 | } |
| 1880 | g_variant_unref (signal_variant); |
| 1881 | g_list_free_full (connections, g_object_unref); |
| 1882 | } |
| 1883 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1884 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1885 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1886 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1887 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 1888 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1889 | |
| 1890 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1891 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1892 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1893 | |
| 1894 | #endif |
| 1895 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1896 | sensor_value_skeleton_finalize (GObject *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1897 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1898 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1899 | guint n; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1900 | for (n = 0; n < 4; n++) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1901 | g_value_unset (&skeleton->priv->properties[n]); |
| 1902 | g_free (skeleton->priv->properties); |
| 1903 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1904 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1905 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1906 | g_main_context_unref (skeleton->priv->context); |
| 1907 | g_mutex_clear (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1908 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1909 | } |
| 1910 | |
| 1911 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1912 | sensor_value_skeleton_get_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1913 | guint prop_id, |
| 1914 | GValue *value, |
| 1915 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1916 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1917 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1918 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1919 | g_mutex_lock (&skeleton->priv->lock); |
| 1920 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1921 | g_mutex_unlock (&skeleton->priv->lock); |
| 1922 | } |
| 1923 | |
| 1924 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1925 | _sensor_value_emit_changed (gpointer user_data) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1926 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1927 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1928 | GList *l; |
| 1929 | GVariantBuilder builder; |
| 1930 | GVariantBuilder invalidated_builder; |
| 1931 | guint num_changes; |
| 1932 | |
| 1933 | g_mutex_lock (&skeleton->priv->lock); |
| 1934 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1935 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1936 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1937 | { |
| 1938 | ChangedProperty *cp = l->data; |
| 1939 | GVariant *variant; |
| 1940 | const GValue *cur_value; |
| 1941 | |
| 1942 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1943 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1944 | { |
| 1945 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1946 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1947 | g_variant_unref (variant); |
| 1948 | num_changes++; |
| 1949 | } |
| 1950 | } |
| 1951 | if (num_changes > 0) |
| 1952 | { |
| 1953 | GList *connections, *ll; |
| 1954 | GVariant *signal_variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1955 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1956 | &builder, &invalidated_builder)); |
| 1957 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1958 | for (ll = connections; ll != NULL; ll = ll->next) |
| 1959 | { |
| 1960 | GDBusConnection *connection = ll->data; |
| 1961 | |
| 1962 | g_dbus_connection_emit_signal (connection, |
| 1963 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 1964 | "org.freedesktop.DBus.Properties", |
| 1965 | "PropertiesChanged", |
| 1966 | signal_variant, |
| 1967 | NULL); |
| 1968 | } |
| 1969 | g_variant_unref (signal_variant); |
| 1970 | g_list_free_full (connections, g_object_unref); |
| 1971 | } |
| 1972 | else |
| 1973 | { |
| 1974 | g_variant_builder_clear (&builder); |
| 1975 | g_variant_builder_clear (&invalidated_builder); |
| 1976 | } |
| 1977 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1978 | skeleton->priv->changed_properties = NULL; |
| 1979 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1980 | g_mutex_unlock (&skeleton->priv->lock); |
| 1981 | return FALSE; |
| 1982 | } |
| 1983 | |
| 1984 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 1985 | _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1986 | { |
| 1987 | ChangedProperty *cp; |
| 1988 | GList *l; |
| 1989 | cp = NULL; |
| 1990 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 1991 | { |
| 1992 | ChangedProperty *i_cp = l->data; |
| 1993 | if (i_cp->info == info) |
| 1994 | { |
| 1995 | cp = i_cp; |
| 1996 | break; |
| 1997 | } |
| 1998 | } |
| 1999 | if (cp == NULL) |
| 2000 | { |
| 2001 | cp = g_new0 (ChangedProperty, 1); |
| 2002 | cp->prop_id = prop_id; |
| 2003 | cp->info = info; |
| 2004 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 2005 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 2006 | g_value_copy (orig_value, &cp->orig_value); |
| 2007 | } |
| 2008 | } |
| 2009 | |
| 2010 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2011 | sensor_value_skeleton_notify (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2012 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2013 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2014 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2015 | g_mutex_lock (&skeleton->priv->lock); |
| 2016 | if (skeleton->priv->changed_properties != NULL && |
| 2017 | skeleton->priv->changed_properties_idle_source == NULL) |
| 2018 | { |
| 2019 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 2020 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2021 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2022 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 2023 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 2024 | } |
| 2025 | g_mutex_unlock (&skeleton->priv->lock); |
| 2026 | } |
| 2027 | |
| 2028 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2029 | sensor_value_skeleton_set_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2030 | guint prop_id, |
| 2031 | const GValue *value, |
| 2032 | GParamSpec *pspec) |
| 2033 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2034 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2035 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2036 | g_mutex_lock (&skeleton->priv->lock); |
| 2037 | g_object_freeze_notify (object); |
| 2038 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 2039 | { |
| 2040 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2041 | _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2042 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 2043 | g_object_notify_by_pspec (object, pspec); |
| 2044 | } |
| 2045 | g_mutex_unlock (&skeleton->priv->lock); |
| 2046 | g_object_thaw_notify (object); |
| 2047 | } |
| 2048 | |
| 2049 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2050 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2051 | { |
| 2052 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2053 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2054 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2055 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2056 | #endif |
| 2057 | |
| 2058 | g_mutex_init (&skeleton->priv->lock); |
| 2059 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2060 | skeleton->priv->properties = g_new0 (GValue, 4); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2061 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2062 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2063 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2064 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2065 | } |
| 2066 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2067 | static GVariant * |
| 2068 | sensor_value_skeleton_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2069 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2070 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 2071 | GVariant *value; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2072 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2073 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2074 | g_mutex_unlock (&skeleton->priv->lock); |
| 2075 | return value; |
| 2076 | } |
| 2077 | |
| 2078 | static const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2079 | sensor_value_skeleton_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2080 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2081 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2082 | const gchar *value; |
| 2083 | g_mutex_lock (&skeleton->priv->lock); |
| 2084 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 2085 | g_mutex_unlock (&skeleton->priv->lock); |
| 2086 | return value; |
| 2087 | } |
| 2088 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2089 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2090 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2091 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2092 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2093 | gint value; |
| 2094 | g_mutex_lock (&skeleton->priv->lock); |
| 2095 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 2096 | g_mutex_unlock (&skeleton->priv->lock); |
| 2097 | return value; |
| 2098 | } |
| 2099 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2100 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2101 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2102 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2103 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2104 | gint value; |
| 2105 | g_mutex_lock (&skeleton->priv->lock); |
| 2106 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 2107 | g_mutex_unlock (&skeleton->priv->lock); |
| 2108 | return value; |
| 2109 | } |
| 2110 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2111 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2112 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2113 | { |
| 2114 | GObjectClass *gobject_class; |
| 2115 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 2116 | |
| 2117 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2118 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 2119 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 2120 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 2121 | gobject_class->notify = sensor_value_skeleton_notify; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2122 | |
| 2123 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2124 | sensor_value_override_properties (gobject_class, 1); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2125 | |
| 2126 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2127 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 2128 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 2129 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 2130 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2131 | |
| 2132 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2133 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2134 | #endif |
| 2135 | } |
| 2136 | |
| 2137 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2138 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2139 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2140 | iface->changed = _sensor_value_on_signal_changed; |
| 2141 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 2142 | iface->get_value = sensor_value_skeleton_get_value; |
| 2143 | iface->get_units = sensor_value_skeleton_get_units; |
| 2144 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 2145 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2146 | } |
| 2147 | |
| 2148 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2149 | * sensor_value_skeleton_new: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2150 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2151 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2152 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2153 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2154 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2155 | SensorValue * |
| 2156 | sensor_value_skeleton_new (void) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2157 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2158 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2159 | } |
| 2160 | |
| 2161 | /* ------------------------------------------------------------------------ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2162 | * Code for interface org.openbmc.SensorThreshold |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2163 | * ------------------------------------------------------------------------ |
| 2164 | */ |
| 2165 | |
| 2166 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2167 | * SECTION:SensorThreshold |
| 2168 | * @title: SensorThreshold |
| 2169 | * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2170 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2171 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface in C. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2172 | */ |
| 2173 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2174 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2175 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2176 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2177 | { |
| 2178 | { |
| 2179 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2180 | (gchar *) "state", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2181 | (gchar *) "y", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2182 | NULL |
| 2183 | }, |
| 2184 | FALSE |
| 2185 | }; |
| 2186 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2187 | static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2188 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2189 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2190 | NULL |
| 2191 | }; |
| 2192 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2193 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2194 | { |
| 2195 | { |
| 2196 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2197 | (gchar *) "getState", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2198 | NULL, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2199 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2200 | NULL |
| 2201 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2202 | "handle-get-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2203 | FALSE |
| 2204 | }; |
| 2205 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2206 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2207 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2208 | &_sensor_threshold_method_info_get_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2209 | NULL |
| 2210 | }; |
| 2211 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2212 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2213 | { |
| 2214 | { |
| 2215 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2216 | (gchar *) "Warning", |
| 2217 | NULL, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2218 | NULL |
| 2219 | }, |
| 2220 | "warning" |
| 2221 | }; |
| 2222 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2223 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2224 | { |
| 2225 | { |
| 2226 | -1, |
| 2227 | (gchar *) "Critical", |
| 2228 | NULL, |
| 2229 | NULL |
| 2230 | }, |
| 2231 | "critical" |
| 2232 | }; |
| 2233 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2234 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2235 | { |
| 2236 | { |
| 2237 | -1, |
| 2238 | (gchar *) "Normal", |
| 2239 | NULL, |
| 2240 | NULL |
| 2241 | }, |
| 2242 | "normal" |
| 2243 | }; |
| 2244 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2245 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2246 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2247 | &_sensor_threshold_signal_info_warning, |
| 2248 | &_sensor_threshold_signal_info_critical, |
| 2249 | &_sensor_threshold_signal_info_normal, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2250 | NULL |
| 2251 | }; |
| 2252 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2253 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2254 | { |
| 2255 | { |
| 2256 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2257 | (gchar *) "lower_critical", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2258 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2259 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2260 | NULL |
| 2261 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2262 | "lower-critical", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2263 | FALSE |
| 2264 | }; |
| 2265 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2266 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2267 | { |
| 2268 | { |
| 2269 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2270 | (gchar *) "lower_warning", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2271 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2272 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2273 | NULL |
| 2274 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2275 | "lower-warning", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2276 | FALSE |
| 2277 | }; |
| 2278 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2279 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2280 | { |
| 2281 | { |
| 2282 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2283 | (gchar *) "upper_warning", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2284 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2285 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2286 | NULL |
| 2287 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2288 | "upper-warning", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2289 | FALSE |
| 2290 | }; |
| 2291 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2292 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2293 | { |
| 2294 | { |
| 2295 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2296 | (gchar *) "upper_critical", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2297 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2298 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2299 | NULL |
| 2300 | }, |
| 2301 | "upper-critical", |
| 2302 | FALSE |
| 2303 | }; |
| 2304 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2305 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2306 | { |
| 2307 | { |
| 2308 | -1, |
| 2309 | (gchar *) "state", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2310 | (gchar *) "y", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2311 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2312 | NULL |
| 2313 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2314 | "state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2315 | FALSE |
| 2316 | }; |
| 2317 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2318 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2319 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2320 | &_sensor_threshold_property_info_lower_critical, |
| 2321 | &_sensor_threshold_property_info_lower_warning, |
| 2322 | &_sensor_threshold_property_info_upper_warning, |
| 2323 | &_sensor_threshold_property_info_upper_critical, |
| 2324 | &_sensor_threshold_property_info_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2325 | NULL |
| 2326 | }; |
| 2327 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2328 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2329 | { |
| 2330 | { |
| 2331 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2332 | (gchar *) "org.openbmc.SensorThreshold", |
| 2333 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 2334 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 2335 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2336 | NULL |
| 2337 | }, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2338 | "sensor-threshold", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2339 | }; |
| 2340 | |
| 2341 | |
| 2342 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2343 | * sensor_threshold_interface_info: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2344 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2345 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2346 | * |
| 2347 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 2348 | */ |
| 2349 | GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2350 | sensor_threshold_interface_info (void) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2351 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2352 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2353 | } |
| 2354 | |
| 2355 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2356 | * sensor_threshold_override_properties: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2357 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 2358 | * @property_id_begin: The property id to assign to the first overridden property. |
| 2359 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2360 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2361 | * The properties are overridden in the order they are defined. |
| 2362 | * |
| 2363 | * Returns: The last property id. |
| 2364 | */ |
| 2365 | guint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2366 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2367 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2368 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 2369 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 2370 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 2371 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 2372 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2373 | return property_id_begin - 1; |
| 2374 | } |
| 2375 | |
| 2376 | |
| 2377 | |
| 2378 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2379 | * SensorThreshold: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2380 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2381 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2382 | */ |
| 2383 | |
| 2384 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2385 | * SensorThresholdIface: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2386 | * @parent_iface: The parent interface. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2387 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 2388 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 2389 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 2390 | * @get_state: Getter for the #SensorThreshold:state property. |
| 2391 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 2392 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 2393 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 2394 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 2395 | * @warning: Handler for the #SensorThreshold::warning signal. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2396 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2397 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2398 | */ |
| 2399 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2400 | typedef SensorThresholdIface SensorThresholdInterface; |
| 2401 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2402 | |
| 2403 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2404 | sensor_threshold_default_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2405 | { |
| 2406 | /* GObject signals for incoming D-Bus method calls: */ |
| 2407 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2408 | * SensorThreshold::handle-get-state: |
| 2409 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2410 | * @invocation: A #GDBusMethodInvocation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2411 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2412 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2413 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2414 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_threshold_complete_get_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2415 | * |
| 2416 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2417 | */ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2418 | g_signal_new ("handle-get-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2419 | G_TYPE_FROM_INTERFACE (iface), |
| 2420 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2421 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2422 | g_signal_accumulator_true_handled, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2423 | NULL, |
| 2424 | g_cclosure_marshal_generic, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2425 | G_TYPE_BOOLEAN, |
| 2426 | 1, |
| 2427 | G_TYPE_DBUS_METHOD_INVOCATION); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2428 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2429 | /* GObject signals for received D-Bus signals: */ |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2430 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2431 | * SensorThreshold::warning: |
| 2432 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2433 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2434 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> is received. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2435 | * |
| 2436 | * 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. |
| 2437 | */ |
| 2438 | g_signal_new ("warning", |
| 2439 | G_TYPE_FROM_INTERFACE (iface), |
| 2440 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2441 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2442 | NULL, |
| 2443 | NULL, |
| 2444 | g_cclosure_marshal_generic, |
| 2445 | G_TYPE_NONE, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2446 | 0); |
| 2447 | |
| 2448 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2449 | * SensorThreshold::critical: |
| 2450 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2451 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2452 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> is received. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2453 | * |
| 2454 | * 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. |
| 2455 | */ |
| 2456 | g_signal_new ("critical", |
| 2457 | G_TYPE_FROM_INTERFACE (iface), |
| 2458 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2459 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2460 | NULL, |
| 2461 | NULL, |
| 2462 | g_cclosure_marshal_generic, |
| 2463 | G_TYPE_NONE, |
| 2464 | 0); |
| 2465 | |
| 2466 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2467 | * SensorThreshold::normal: |
| 2468 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2469 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2470 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> is received. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2471 | * |
| 2472 | * 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. |
| 2473 | */ |
| 2474 | g_signal_new ("normal", |
| 2475 | G_TYPE_FROM_INTERFACE (iface), |
| 2476 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2477 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2478 | NULL, |
| 2479 | NULL, |
| 2480 | g_cclosure_marshal_generic, |
| 2481 | G_TYPE_NONE, |
| 2482 | 0); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2483 | |
| 2484 | /* GObject properties for D-Bus properties: */ |
| 2485 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2486 | * SensorThreshold:lower-critical: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2487 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2488 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2489 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2490 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2491 | */ |
| 2492 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2493 | g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2494 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2495 | * SensorThreshold:lower-warning: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2496 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2497 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2498 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2499 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2500 | */ |
| 2501 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2502 | g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2503 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2504 | * SensorThreshold:upper-warning: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2505 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2506 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2507 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2508 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2509 | */ |
| 2510 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2511 | g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2512 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2513 | * SensorThreshold:upper-critical: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2514 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2515 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2516 | * |
| 2517 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
| 2518 | */ |
| 2519 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2520 | g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2521 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2522 | * SensorThreshold:state: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2523 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2524 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2525 | * |
| 2526 | * 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. |
| 2527 | */ |
| 2528 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2529 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2530 | } |
| 2531 | |
| 2532 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2533 | * sensor_threshold_get_lower_critical: (skip) |
| 2534 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2535 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2536 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2537 | * |
| 2538 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2539 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2540 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_critical() if on another thread.</warning> |
| 2541 | * |
| 2542 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2543 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2544 | GVariant * |
| 2545 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2546 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2547 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2548 | } |
| 2549 | |
| 2550 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2551 | * sensor_threshold_dup_lower_critical: (skip) |
| 2552 | * @object: A #SensorThreshold. |
| 2553 | * |
| 2554 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 2555 | * |
| 2556 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2557 | * |
| 2558 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2559 | */ |
| 2560 | GVariant * |
| 2561 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 2562 | { |
| 2563 | GVariant *value; |
| 2564 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 2565 | return value; |
| 2566 | } |
| 2567 | |
| 2568 | /** |
| 2569 | * sensor_threshold_set_lower_critical: (skip) |
| 2570 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2571 | * @value: The value to set. |
| 2572 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2573 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2574 | * |
| 2575 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2576 | */ |
| 2577 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2578 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2579 | { |
| 2580 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 2581 | } |
| 2582 | |
| 2583 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2584 | * sensor_threshold_get_lower_warning: (skip) |
| 2585 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2586 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2587 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2588 | * |
| 2589 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2590 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2591 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_warning() if on another thread.</warning> |
| 2592 | * |
| 2593 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2594 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2595 | GVariant * |
| 2596 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2597 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2598 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2599 | } |
| 2600 | |
| 2601 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2602 | * sensor_threshold_dup_lower_warning: (skip) |
| 2603 | * @object: A #SensorThreshold. |
| 2604 | * |
| 2605 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 2606 | * |
| 2607 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2608 | * |
| 2609 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2610 | */ |
| 2611 | GVariant * |
| 2612 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 2613 | { |
| 2614 | GVariant *value; |
| 2615 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 2616 | return value; |
| 2617 | } |
| 2618 | |
| 2619 | /** |
| 2620 | * sensor_threshold_set_lower_warning: (skip) |
| 2621 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2622 | * @value: The value to set. |
| 2623 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2624 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2625 | * |
| 2626 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2627 | */ |
| 2628 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2629 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2630 | { |
| 2631 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 2632 | } |
| 2633 | |
| 2634 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2635 | * sensor_threshold_get_upper_warning: (skip) |
| 2636 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2637 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2638 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2639 | * |
| 2640 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2641 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2642 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_warning() if on another thread.</warning> |
| 2643 | * |
| 2644 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2645 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2646 | GVariant * |
| 2647 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2648 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2649 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2650 | } |
| 2651 | |
| 2652 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2653 | * sensor_threshold_dup_upper_warning: (skip) |
| 2654 | * @object: A #SensorThreshold. |
| 2655 | * |
| 2656 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 2657 | * |
| 2658 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2659 | * |
| 2660 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2661 | */ |
| 2662 | GVariant * |
| 2663 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 2664 | { |
| 2665 | GVariant *value; |
| 2666 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 2667 | return value; |
| 2668 | } |
| 2669 | |
| 2670 | /** |
| 2671 | * sensor_threshold_set_upper_warning: (skip) |
| 2672 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2673 | * @value: The value to set. |
| 2674 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2675 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2676 | * |
| 2677 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2678 | */ |
| 2679 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2680 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2681 | { |
| 2682 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 2683 | } |
| 2684 | |
| 2685 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2686 | * sensor_threshold_get_upper_critical: (skip) |
| 2687 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2688 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2689 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2690 | * |
| 2691 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2692 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2693 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_critical() if on another thread.</warning> |
| 2694 | * |
| 2695 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2696 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2697 | GVariant * |
| 2698 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2699 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2700 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2701 | } |
| 2702 | |
| 2703 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2704 | * sensor_threshold_dup_upper_critical: (skip) |
| 2705 | * @object: A #SensorThreshold. |
| 2706 | * |
| 2707 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 2708 | * |
| 2709 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2710 | * |
| 2711 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2712 | */ |
| 2713 | GVariant * |
| 2714 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 2715 | { |
| 2716 | GVariant *value; |
| 2717 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 2718 | return value; |
| 2719 | } |
| 2720 | |
| 2721 | /** |
| 2722 | * sensor_threshold_set_upper_critical: (skip) |
| 2723 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2724 | * @value: The value to set. |
| 2725 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2726 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2727 | * |
| 2728 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2729 | */ |
| 2730 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2731 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2732 | { |
| 2733 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 2734 | } |
| 2735 | |
| 2736 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2737 | * sensor_threshold_get_state: (skip) |
| 2738 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2739 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2740 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2741 | * |
| 2742 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2743 | * |
| 2744 | * Returns: The property value. |
| 2745 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2746 | guchar |
| 2747 | sensor_threshold_get_state (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2748 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2749 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2750 | } |
| 2751 | |
| 2752 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2753 | * sensor_threshold_set_state: (skip) |
| 2754 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2755 | * @value: The value to set. |
| 2756 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2757 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2758 | * |
| 2759 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2760 | */ |
| 2761 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2762 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2763 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2764 | g_object_set (G_OBJECT (object), "state", value, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2765 | } |
| 2766 | |
| 2767 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2768 | * sensor_threshold_emit_warning: |
| 2769 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2770 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2771 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2772 | */ |
| 2773 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2774 | sensor_threshold_emit_warning ( |
| 2775 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2776 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2777 | g_signal_emit_by_name (object, "warning"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2781 | * sensor_threshold_emit_critical: |
| 2782 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2783 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2784 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2785 | */ |
| 2786 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2787 | sensor_threshold_emit_critical ( |
| 2788 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2789 | { |
| 2790 | g_signal_emit_by_name (object, "critical"); |
| 2791 | } |
| 2792 | |
| 2793 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2794 | * sensor_threshold_emit_normal: |
| 2795 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2796 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2797 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2798 | */ |
| 2799 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2800 | sensor_threshold_emit_normal ( |
| 2801 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2802 | { |
| 2803 | g_signal_emit_by_name (object, "normal"); |
| 2804 | } |
| 2805 | |
| 2806 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2807 | * sensor_threshold_call_get_state: |
| 2808 | * @proxy: A #SensorThresholdProxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2809 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2810 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2811 | * @user_data: User data to pass to @callback. |
| 2812 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2813 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2814 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2815 | * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2816 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2817 | * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2818 | */ |
| 2819 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2820 | sensor_threshold_call_get_state ( |
| 2821 | SensorThreshold *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2822 | GCancellable *cancellable, |
| 2823 | GAsyncReadyCallback callback, |
| 2824 | gpointer user_data) |
| 2825 | { |
| 2826 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2827 | "getState", |
| 2828 | g_variant_new ("()"), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2829 | G_DBUS_CALL_FLAGS_NONE, |
| 2830 | -1, |
| 2831 | cancellable, |
| 2832 | callback, |
| 2833 | user_data); |
| 2834 | } |
| 2835 | |
| 2836 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2837 | * sensor_threshold_call_get_state_finish: |
| 2838 | * @proxy: A #SensorThresholdProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2839 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2840 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2841 | * @error: Return location for error or %NULL. |
| 2842 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2843 | * Finishes an operation started with sensor_threshold_call_get_state(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2844 | * |
| 2845 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2846 | */ |
| 2847 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2848 | sensor_threshold_call_get_state_finish ( |
| 2849 | SensorThreshold *proxy, |
| 2850 | guchar *out_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2851 | GAsyncResult *res, |
| 2852 | GError **error) |
| 2853 | { |
| 2854 | GVariant *_ret; |
| 2855 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2856 | if (_ret == NULL) |
| 2857 | goto _out; |
| 2858 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2859 | "(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2860 | out_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2861 | g_variant_unref (_ret); |
| 2862 | _out: |
| 2863 | return _ret != NULL; |
| 2864 | } |
| 2865 | |
| 2866 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2867 | * sensor_threshold_call_get_state_sync: |
| 2868 | * @proxy: A #SensorThresholdProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2869 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2870 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2871 | * @error: Return location for error or %NULL. |
| 2872 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2873 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2874 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2875 | * See sensor_threshold_call_get_state() for the asynchronous version of this method. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2876 | * |
| 2877 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2878 | */ |
| 2879 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2880 | sensor_threshold_call_get_state_sync ( |
| 2881 | SensorThreshold *proxy, |
| 2882 | guchar *out_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2883 | GCancellable *cancellable, |
| 2884 | GError **error) |
| 2885 | { |
| 2886 | GVariant *_ret; |
| 2887 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2888 | "getState", |
| 2889 | g_variant_new ("()"), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2890 | G_DBUS_CALL_FLAGS_NONE, |
| 2891 | -1, |
| 2892 | cancellable, |
| 2893 | error); |
| 2894 | if (_ret == NULL) |
| 2895 | goto _out; |
| 2896 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2897 | "(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2898 | out_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2899 | g_variant_unref (_ret); |
| 2900 | _out: |
| 2901 | return _ret != NULL; |
| 2902 | } |
| 2903 | |
| 2904 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2905 | * sensor_threshold_complete_get_state: |
| 2906 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2907 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2908 | * @state: Parameter to return. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2909 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2910 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2911 | * |
| 2912 | * This method will free @invocation, you cannot use it afterwards. |
| 2913 | */ |
| 2914 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2915 | sensor_threshold_complete_get_state ( |
| 2916 | SensorThreshold *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2917 | GDBusMethodInvocation *invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2918 | guchar state) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2919 | { |
| 2920 | g_dbus_method_invocation_return_value (invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2921 | g_variant_new ("(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2922 | state)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2923 | } |
| 2924 | |
| 2925 | /* ------------------------------------------------------------------------ */ |
| 2926 | |
| 2927 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2928 | * SensorThresholdProxy: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2929 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2930 | * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2931 | */ |
| 2932 | |
| 2933 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2934 | * SensorThresholdProxyClass: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2935 | * @parent_class: The parent class. |
| 2936 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2937 | * Class structure for #SensorThresholdProxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2938 | */ |
| 2939 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2940 | struct _SensorThresholdProxyPrivate |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2941 | { |
| 2942 | GData *qdata; |
| 2943 | }; |
| 2944 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2945 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2946 | |
| 2947 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2948 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 2949 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 2950 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2951 | |
| 2952 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2953 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 2954 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2955 | |
| 2956 | #endif |
| 2957 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2958 | sensor_threshold_proxy_finalize (GObject *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2959 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2960 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2961 | g_datalist_clear (&proxy->priv->qdata); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2962 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2963 | } |
| 2964 | |
| 2965 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2966 | sensor_threshold_proxy_get_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2967 | guint prop_id, |
| 2968 | GValue *value, |
| 2969 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2970 | { |
| 2971 | const _ExtendedGDBusPropertyInfo *info; |
| 2972 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2973 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2974 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2975 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 2976 | if (info->use_gvariant) |
| 2977 | { |
| 2978 | g_value_set_variant (value, variant); |
| 2979 | } |
| 2980 | else |
| 2981 | { |
| 2982 | if (variant != NULL) |
| 2983 | g_dbus_gvariant_to_gvalue (variant, value); |
| 2984 | } |
| 2985 | if (variant != NULL) |
| 2986 | g_variant_unref (variant); |
| 2987 | } |
| 2988 | |
| 2989 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 2990 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2991 | GAsyncResult *res, |
| 2992 | gpointer user_data) |
| 2993 | { |
| 2994 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 2995 | GError *error; |
| 2996 | GVariant *_ret; |
| 2997 | error = NULL; |
| 2998 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 2999 | if (!_ret) |
| 3000 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3001 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3002 | info->parent_struct.name, |
| 3003 | error->message, g_quark_to_string (error->domain), error->code); |
| 3004 | g_error_free (error); |
| 3005 | } |
| 3006 | else |
| 3007 | { |
| 3008 | g_variant_unref (_ret); |
| 3009 | } |
| 3010 | } |
| 3011 | |
| 3012 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3013 | sensor_threshold_proxy_set_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3014 | guint prop_id, |
| 3015 | const GValue *value, |
| 3016 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3017 | { |
| 3018 | const _ExtendedGDBusPropertyInfo *info; |
| 3019 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3020 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3021 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3022 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3023 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 3024 | "org.freedesktop.DBus.Properties.Set", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3025 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3026 | G_DBUS_CALL_FLAGS_NONE, |
| 3027 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3028 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3029 | g_variant_unref (variant); |
| 3030 | } |
| 3031 | |
| 3032 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3033 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3034 | const gchar *sender_name G_GNUC_UNUSED, |
| 3035 | const gchar *signal_name, |
| 3036 | GVariant *parameters) |
| 3037 | { |
| 3038 | _ExtendedGDBusSignalInfo *info; |
| 3039 | GVariantIter iter; |
| 3040 | GVariant *child; |
| 3041 | GValue *paramv; |
| 3042 | guint num_params; |
| 3043 | guint n; |
| 3044 | guint signal_id; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3045 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3046 | if (info == NULL) |
| 3047 | return; |
| 3048 | num_params = g_variant_n_children (parameters); |
| 3049 | paramv = g_new0 (GValue, num_params + 1); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3050 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3051 | g_value_set_object (¶mv[0], proxy); |
| 3052 | g_variant_iter_init (&iter, parameters); |
| 3053 | n = 1; |
| 3054 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3055 | { |
| 3056 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 3057 | if (arg_info->use_gvariant) |
| 3058 | { |
| 3059 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3060 | g_value_set_variant (¶mv[n], child); |
| 3061 | n++; |
| 3062 | } |
| 3063 | else |
| 3064 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3065 | g_variant_unref (child); |
| 3066 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3067 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3068 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 3069 | for (n = 0; n < num_params + 1; n++) |
| 3070 | g_value_unset (¶mv[n]); |
| 3071 | g_free (paramv); |
| 3072 | } |
| 3073 | |
| 3074 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3075 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3076 | GVariant *changed_properties, |
| 3077 | const gchar *const *invalidated_properties) |
| 3078 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3079 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3080 | guint n; |
| 3081 | const gchar *key; |
| 3082 | GVariantIter *iter; |
| 3083 | _ExtendedGDBusPropertyInfo *info; |
| 3084 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 3085 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 3086 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3087 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3088 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 3089 | if (info != NULL) |
| 3090 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3091 | } |
| 3092 | g_variant_iter_free (iter); |
| 3093 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 3094 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3095 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3096 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 3097 | if (info != NULL) |
| 3098 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3099 | } |
| 3100 | } |
| 3101 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3102 | static GVariant * |
| 3103 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3104 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3105 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3106 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3107 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3108 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3109 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3110 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3111 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3112 | return value; |
| 3113 | } |
| 3114 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3115 | static GVariant * |
| 3116 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3117 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3118 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3119 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3120 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3121 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3122 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3123 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3124 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3125 | return value; |
| 3126 | } |
| 3127 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3128 | static GVariant * |
| 3129 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3130 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3131 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3132 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3133 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3134 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3135 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3136 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3137 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3138 | return value; |
| 3139 | } |
| 3140 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3141 | static GVariant * |
| 3142 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3143 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3144 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3145 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3146 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3147 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3148 | value = variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3149 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3150 | g_variant_unref (variant); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3151 | return value; |
| 3152 | } |
| 3153 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3154 | static guchar |
| 3155 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3156 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3157 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3158 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3159 | guchar value = 0; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3160 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3161 | if (variant != NULL) |
| 3162 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3163 | value = g_variant_get_byte (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3164 | g_variant_unref (variant); |
| 3165 | } |
| 3166 | return value; |
| 3167 | } |
| 3168 | |
| 3169 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3170 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3171 | { |
| 3172 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3173 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3174 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3175 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3176 | #endif |
| 3177 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3178 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3179 | } |
| 3180 | |
| 3181 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3182 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3183 | { |
| 3184 | GObjectClass *gobject_class; |
| 3185 | GDBusProxyClass *proxy_class; |
| 3186 | |
| 3187 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3188 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 3189 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 3190 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3191 | |
| 3192 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3193 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 3194 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3195 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3196 | sensor_threshold_override_properties (gobject_class, 1); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3197 | |
| 3198 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3199 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3200 | #endif |
| 3201 | } |
| 3202 | |
| 3203 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3204 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3205 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3206 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 3207 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 3208 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 3209 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 3210 | iface->get_state = sensor_threshold_proxy_get_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3211 | } |
| 3212 | |
| 3213 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3214 | * sensor_threshold_proxy_new: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3215 | * @connection: A #GDBusConnection. |
| 3216 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3217 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3218 | * @object_path: An object path. |
| 3219 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3220 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3221 | * @user_data: User data to pass to @callback. |
| 3222 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3223 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new() for more details. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3224 | * |
| 3225 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3226 | * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3227 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3228 | * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3229 | */ |
| 3230 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3231 | sensor_threshold_proxy_new ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3232 | GDBusConnection *connection, |
| 3233 | GDBusProxyFlags flags, |
| 3234 | const gchar *name, |
| 3235 | const gchar *object_path, |
| 3236 | GCancellable *cancellable, |
| 3237 | GAsyncReadyCallback callback, |
| 3238 | gpointer user_data) |
| 3239 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3240 | g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3241 | } |
| 3242 | |
| 3243 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3244 | * sensor_threshold_proxy_new_finish: |
| 3245 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3246 | * @error: Return location for error or %NULL |
| 3247 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3248 | * Finishes an operation started with sensor_threshold_proxy_new(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3249 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3250 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3251 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3252 | SensorThreshold * |
| 3253 | sensor_threshold_proxy_new_finish ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3254 | GAsyncResult *res, |
| 3255 | GError **error) |
| 3256 | { |
| 3257 | GObject *ret; |
| 3258 | GObject *source_object; |
| 3259 | source_object = g_async_result_get_source_object (res); |
| 3260 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3261 | g_object_unref (source_object); |
| 3262 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3263 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3264 | else |
| 3265 | return NULL; |
| 3266 | } |
| 3267 | |
| 3268 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3269 | * sensor_threshold_proxy_new_sync: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3270 | * @connection: A #GDBusConnection. |
| 3271 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3272 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3273 | * @object_path: An object path. |
| 3274 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3275 | * @error: Return location for error or %NULL |
| 3276 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3277 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new_sync() for more details. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3278 | * |
| 3279 | * The calling thread is blocked until a reply is received. |
| 3280 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3281 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3282 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3283 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3284 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3285 | SensorThreshold * |
| 3286 | sensor_threshold_proxy_new_sync ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3287 | GDBusConnection *connection, |
| 3288 | GDBusProxyFlags flags, |
| 3289 | const gchar *name, |
| 3290 | const gchar *object_path, |
| 3291 | GCancellable *cancellable, |
| 3292 | GError **error) |
| 3293 | { |
| 3294 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3295 | ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3296 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3297 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3298 | else |
| 3299 | return NULL; |
| 3300 | } |
| 3301 | |
| 3302 | |
| 3303 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3304 | * sensor_threshold_proxy_new_for_bus: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3305 | * @bus_type: A #GBusType. |
| 3306 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3307 | * @name: A bus name (well-known or unique). |
| 3308 | * @object_path: An object path. |
| 3309 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3310 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3311 | * @user_data: User data to pass to @callback. |
| 3312 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3313 | * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3314 | * |
| 3315 | * When the operation is finished, @callback will be invoked 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 | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3316 | * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3317 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3318 | * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3319 | */ |
| 3320 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3321 | sensor_threshold_proxy_new_for_bus ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3322 | GBusType bus_type, |
| 3323 | GDBusProxyFlags flags, |
| 3324 | const gchar *name, |
| 3325 | const gchar *object_path, |
| 3326 | GCancellable *cancellable, |
| 3327 | GAsyncReadyCallback callback, |
| 3328 | gpointer user_data) |
| 3329 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3330 | g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3331 | } |
| 3332 | |
| 3333 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3334 | * sensor_threshold_proxy_new_for_bus_finish: |
| 3335 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3336 | * @error: Return location for error or %NULL |
| 3337 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3338 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3339 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3340 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3341 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3342 | SensorThreshold * |
| 3343 | sensor_threshold_proxy_new_for_bus_finish ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3344 | GAsyncResult *res, |
| 3345 | GError **error) |
| 3346 | { |
| 3347 | GObject *ret; |
| 3348 | GObject *source_object; |
| 3349 | source_object = g_async_result_get_source_object (res); |
| 3350 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3351 | g_object_unref (source_object); |
| 3352 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3353 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3354 | else |
| 3355 | return NULL; |
| 3356 | } |
| 3357 | |
| 3358 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3359 | * sensor_threshold_proxy_new_for_bus_sync: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3360 | * @bus_type: A #GBusType. |
| 3361 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3362 | * @name: A bus name (well-known or unique). |
| 3363 | * @object_path: An object path. |
| 3364 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3365 | * @error: Return location for error or %NULL |
| 3366 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3367 | * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3368 | * |
| 3369 | * The calling thread is blocked until a reply is received. |
| 3370 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3371 | * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3372 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3373 | * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3374 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3375 | SensorThreshold * |
| 3376 | sensor_threshold_proxy_new_for_bus_sync ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3377 | GBusType bus_type, |
| 3378 | GDBusProxyFlags flags, |
| 3379 | const gchar *name, |
| 3380 | const gchar *object_path, |
| 3381 | GCancellable *cancellable, |
| 3382 | GError **error) |
| 3383 | { |
| 3384 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3385 | ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3386 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3387 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3388 | else |
| 3389 | return NULL; |
| 3390 | } |
| 3391 | |
| 3392 | |
| 3393 | /* ------------------------------------------------------------------------ */ |
| 3394 | |
| 3395 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3396 | * SensorThresholdSkeleton: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3397 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3398 | * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3399 | */ |
| 3400 | |
| 3401 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3402 | * SensorThresholdSkeletonClass: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3403 | * @parent_class: The parent class. |
| 3404 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3405 | * Class structure for #SensorThresholdSkeleton. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3406 | */ |
| 3407 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3408 | struct _SensorThresholdSkeletonPrivate |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3409 | { |
| 3410 | GValue *properties; |
| 3411 | GList *changed_properties; |
| 3412 | GSource *changed_properties_idle_source; |
| 3413 | GMainContext *context; |
| 3414 | GMutex lock; |
| 3415 | }; |
| 3416 | |
| 3417 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3418 | _sensor_threshold_skeleton_handle_method_call ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3419 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3420 | const gchar *sender G_GNUC_UNUSED, |
| 3421 | const gchar *object_path G_GNUC_UNUSED, |
| 3422 | const gchar *interface_name, |
| 3423 | const gchar *method_name, |
| 3424 | GVariant *parameters, |
| 3425 | GDBusMethodInvocation *invocation, |
| 3426 | gpointer user_data) |
| 3427 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3428 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3429 | _ExtendedGDBusMethodInfo *info; |
| 3430 | GVariantIter iter; |
| 3431 | GVariant *child; |
| 3432 | GValue *paramv; |
| 3433 | guint num_params; |
| 3434 | guint num_extra; |
| 3435 | guint n; |
| 3436 | guint signal_id; |
| 3437 | GValue return_value = G_VALUE_INIT; |
| 3438 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 3439 | g_assert (info != NULL); |
| 3440 | num_params = g_variant_n_children (parameters); |
| 3441 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 3442 | n = 0; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3443 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3444 | g_value_set_object (¶mv[n++], skeleton); |
| 3445 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 3446 | g_value_set_object (¶mv[n++], invocation); |
| 3447 | if (info->pass_fdlist) |
| 3448 | { |
| 3449 | #ifdef G_OS_UNIX |
| 3450 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 3451 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 3452 | #else |
| 3453 | g_assert_not_reached (); |
| 3454 | #endif |
| 3455 | } |
| 3456 | g_variant_iter_init (&iter, parameters); |
| 3457 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3458 | { |
| 3459 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 3460 | if (arg_info->use_gvariant) |
| 3461 | { |
| 3462 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3463 | g_value_set_variant (¶mv[n], child); |
| 3464 | n++; |
| 3465 | } |
| 3466 | else |
| 3467 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3468 | g_variant_unref (child); |
| 3469 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3470 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3471 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 3472 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 3473 | if (!g_value_get_boolean (&return_value)) |
| 3474 | 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); |
| 3475 | g_value_unset (&return_value); |
| 3476 | for (n = 0; n < num_params + num_extra; n++) |
| 3477 | g_value_unset (¶mv[n]); |
| 3478 | g_free (paramv); |
| 3479 | } |
| 3480 | |
| 3481 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3482 | _sensor_threshold_skeleton_handle_get_property ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3483 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3484 | const gchar *sender G_GNUC_UNUSED, |
| 3485 | const gchar *object_path G_GNUC_UNUSED, |
| 3486 | const gchar *interface_name G_GNUC_UNUSED, |
| 3487 | const gchar *property_name, |
| 3488 | GError **error, |
| 3489 | gpointer user_data) |
| 3490 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3491 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3492 | GValue value = G_VALUE_INIT; |
| 3493 | GParamSpec *pspec; |
| 3494 | _ExtendedGDBusPropertyInfo *info; |
| 3495 | GVariant *ret; |
| 3496 | ret = NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3497 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3498 | g_assert (info != NULL); |
| 3499 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3500 | if (pspec == NULL) |
| 3501 | { |
| 3502 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3503 | } |
| 3504 | else |
| 3505 | { |
| 3506 | g_value_init (&value, pspec->value_type); |
| 3507 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3508 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3509 | g_value_unset (&value); |
| 3510 | } |
| 3511 | return ret; |
| 3512 | } |
| 3513 | |
| 3514 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3515 | _sensor_threshold_skeleton_handle_set_property ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3516 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3517 | const gchar *sender G_GNUC_UNUSED, |
| 3518 | const gchar *object_path G_GNUC_UNUSED, |
| 3519 | const gchar *interface_name G_GNUC_UNUSED, |
| 3520 | const gchar *property_name, |
| 3521 | GVariant *variant, |
| 3522 | GError **error, |
| 3523 | gpointer user_data) |
| 3524 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3525 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3526 | GValue value = G_VALUE_INIT; |
| 3527 | GParamSpec *pspec; |
| 3528 | _ExtendedGDBusPropertyInfo *info; |
| 3529 | gboolean ret; |
| 3530 | ret = FALSE; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3531 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3532 | g_assert (info != NULL); |
| 3533 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3534 | if (pspec == NULL) |
| 3535 | { |
| 3536 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3537 | } |
| 3538 | else |
| 3539 | { |
| 3540 | if (info->use_gvariant) |
| 3541 | g_value_set_variant (&value, variant); |
| 3542 | else |
| 3543 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 3544 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3545 | g_value_unset (&value); |
| 3546 | ret = TRUE; |
| 3547 | } |
| 3548 | return ret; |
| 3549 | } |
| 3550 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3551 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3552 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3553 | _sensor_threshold_skeleton_handle_method_call, |
| 3554 | _sensor_threshold_skeleton_handle_get_property, |
| 3555 | _sensor_threshold_skeleton_handle_set_property, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3556 | {NULL} |
| 3557 | }; |
| 3558 | |
| 3559 | static GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3560 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3561 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3562 | return sensor_threshold_interface_info (); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | static GDBusInterfaceVTable * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3566 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3567 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3568 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3569 | } |
| 3570 | |
| 3571 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3572 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3573 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3574 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3575 | |
| 3576 | GVariantBuilder builder; |
| 3577 | guint n; |
| 3578 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3579 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3580 | goto out; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3581 | for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3582 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3583 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3584 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3585 | { |
| 3586 | GVariant *value; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3587 | value = _sensor_threshold_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", info->name, NULL, skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3588 | if (value != NULL) |
| 3589 | { |
| 3590 | g_variant_take_ref (value); |
| 3591 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3592 | g_variant_unref (value); |
| 3593 | } |
| 3594 | } |
| 3595 | } |
| 3596 | out: |
| 3597 | return g_variant_builder_end (&builder); |
| 3598 | } |
| 3599 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3600 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3601 | |
| 3602 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3603 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3604 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3605 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3606 | gboolean emit_changed = FALSE; |
| 3607 | |
| 3608 | g_mutex_lock (&skeleton->priv->lock); |
| 3609 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3610 | { |
| 3611 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3612 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3613 | emit_changed = TRUE; |
| 3614 | } |
| 3615 | g_mutex_unlock (&skeleton->priv->lock); |
| 3616 | |
| 3617 | if (emit_changed) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3618 | _sensor_threshold_emit_changed (skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3619 | } |
| 3620 | |
| 3621 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3622 | _sensor_threshold_on_signal_warning ( |
| 3623 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3624 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3625 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3626 | |
| 3627 | GList *connections, *l; |
| 3628 | GVariant *signal_variant; |
| 3629 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3630 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3631 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3632 | for (l = connections; l != NULL; l = l->next) |
| 3633 | { |
| 3634 | GDBusConnection *connection = l->data; |
| 3635 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3636 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3637 | signal_variant, NULL); |
| 3638 | } |
| 3639 | g_variant_unref (signal_variant); |
| 3640 | g_list_free_full (connections, g_object_unref); |
| 3641 | } |
| 3642 | |
| 3643 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3644 | _sensor_threshold_on_signal_critical ( |
| 3645 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3646 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3647 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3648 | |
| 3649 | GList *connections, *l; |
| 3650 | GVariant *signal_variant; |
| 3651 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3652 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3653 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3654 | for (l = connections; l != NULL; l = l->next) |
| 3655 | { |
| 3656 | GDBusConnection *connection = l->data; |
| 3657 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3658 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3659 | signal_variant, NULL); |
| 3660 | } |
| 3661 | g_variant_unref (signal_variant); |
| 3662 | g_list_free_full (connections, g_object_unref); |
| 3663 | } |
| 3664 | |
| 3665 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3666 | _sensor_threshold_on_signal_normal ( |
| 3667 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3668 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3669 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3670 | |
| 3671 | GList *connections, *l; |
| 3672 | GVariant *signal_variant; |
| 3673 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3674 | |
| 3675 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 3676 | for (l = connections; l != NULL; l = l->next) |
| 3677 | { |
| 3678 | GDBusConnection *connection = l->data; |
| 3679 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3680 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3681 | signal_variant, NULL); |
| 3682 | } |
| 3683 | g_variant_unref (signal_variant); |
| 3684 | g_list_free_full (connections, g_object_unref); |
| 3685 | } |
| 3686 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3687 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3688 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3689 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3690 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 3691 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3692 | |
| 3693 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3694 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3695 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3696 | |
| 3697 | #endif |
| 3698 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3699 | sensor_threshold_skeleton_finalize (GObject *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3700 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3701 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3702 | guint n; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3703 | for (n = 0; n < 5; n++) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3704 | g_value_unset (&skeleton->priv->properties[n]); |
| 3705 | g_free (skeleton->priv->properties); |
| 3706 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3707 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3708 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3709 | g_main_context_unref (skeleton->priv->context); |
| 3710 | g_mutex_clear (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3711 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3712 | } |
| 3713 | |
| 3714 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3715 | sensor_threshold_skeleton_get_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3716 | guint prop_id, |
| 3717 | GValue *value, |
| 3718 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3719 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3720 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3721 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3722 | g_mutex_lock (&skeleton->priv->lock); |
| 3723 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 3724 | g_mutex_unlock (&skeleton->priv->lock); |
| 3725 | } |
| 3726 | |
| 3727 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3728 | _sensor_threshold_emit_changed (gpointer user_data) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3729 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3730 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3731 | GList *l; |
| 3732 | GVariantBuilder builder; |
| 3733 | GVariantBuilder invalidated_builder; |
| 3734 | guint num_changes; |
| 3735 | |
| 3736 | g_mutex_lock (&skeleton->priv->lock); |
| 3737 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3738 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 3739 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3740 | { |
| 3741 | ChangedProperty *cp = l->data; |
| 3742 | GVariant *variant; |
| 3743 | const GValue *cur_value; |
| 3744 | |
| 3745 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3746 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3747 | { |
| 3748 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3749 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3750 | g_variant_unref (variant); |
| 3751 | num_changes++; |
| 3752 | } |
| 3753 | } |
| 3754 | if (num_changes > 0) |
| 3755 | { |
| 3756 | GList *connections, *ll; |
| 3757 | GVariant *signal_variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3758 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3759 | &builder, &invalidated_builder)); |
| 3760 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3761 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3762 | { |
| 3763 | GDBusConnection *connection = ll->data; |
| 3764 | |
| 3765 | g_dbus_connection_emit_signal (connection, |
| 3766 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3767 | "org.freedesktop.DBus.Properties", |
| 3768 | "PropertiesChanged", |
| 3769 | signal_variant, |
| 3770 | NULL); |
| 3771 | } |
| 3772 | g_variant_unref (signal_variant); |
| 3773 | g_list_free_full (connections, g_object_unref); |
| 3774 | } |
| 3775 | else |
| 3776 | { |
| 3777 | g_variant_builder_clear (&builder); |
| 3778 | g_variant_builder_clear (&invalidated_builder); |
| 3779 | } |
| 3780 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3781 | skeleton->priv->changed_properties = NULL; |
| 3782 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3783 | g_mutex_unlock (&skeleton->priv->lock); |
| 3784 | return FALSE; |
| 3785 | } |
| 3786 | |
| 3787 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3788 | _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3789 | { |
| 3790 | ChangedProperty *cp; |
| 3791 | GList *l; |
| 3792 | cp = NULL; |
| 3793 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 3794 | { |
| 3795 | ChangedProperty *i_cp = l->data; |
| 3796 | if (i_cp->info == info) |
| 3797 | { |
| 3798 | cp = i_cp; |
| 3799 | break; |
| 3800 | } |
| 3801 | } |
| 3802 | if (cp == NULL) |
| 3803 | { |
| 3804 | cp = g_new0 (ChangedProperty, 1); |
| 3805 | cp->prop_id = prop_id; |
| 3806 | cp->info = info; |
| 3807 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 3808 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 3809 | g_value_copy (orig_value, &cp->orig_value); |
| 3810 | } |
| 3811 | } |
| 3812 | |
| 3813 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3814 | sensor_threshold_skeleton_notify (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3815 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3816 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3817 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3818 | g_mutex_lock (&skeleton->priv->lock); |
| 3819 | if (skeleton->priv->changed_properties != NULL && |
| 3820 | skeleton->priv->changed_properties_idle_source == NULL) |
| 3821 | { |
| 3822 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 3823 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3824 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3825 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 3826 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 3827 | } |
| 3828 | g_mutex_unlock (&skeleton->priv->lock); |
| 3829 | } |
| 3830 | |
| 3831 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3832 | sensor_threshold_skeleton_set_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3833 | guint prop_id, |
| 3834 | const GValue *value, |
| 3835 | GParamSpec *pspec) |
| 3836 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3837 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3838 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3839 | g_mutex_lock (&skeleton->priv->lock); |
| 3840 | g_object_freeze_notify (object); |
| 3841 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 3842 | { |
| 3843 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3844 | _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3845 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 3846 | g_object_notify_by_pspec (object, pspec); |
| 3847 | } |
| 3848 | g_mutex_unlock (&skeleton->priv->lock); |
| 3849 | g_object_thaw_notify (object); |
| 3850 | } |
| 3851 | |
| 3852 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3853 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3854 | { |
| 3855 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3856 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3857 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3858 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3859 | #endif |
| 3860 | |
| 3861 | g_mutex_init (&skeleton->priv->lock); |
| 3862 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3863 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3864 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 3865 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 3866 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 3867 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 3868 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3869 | } |
| 3870 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3871 | static GVariant * |
| 3872 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3873 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3874 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3875 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3876 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3877 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3878 | g_mutex_unlock (&skeleton->priv->lock); |
| 3879 | return value; |
| 3880 | } |
| 3881 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3882 | static GVariant * |
| 3883 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3884 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3885 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3886 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3887 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3888 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3889 | g_mutex_unlock (&skeleton->priv->lock); |
| 3890 | return value; |
| 3891 | } |
| 3892 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3893 | static GVariant * |
| 3894 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3895 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3896 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3897 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3898 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3899 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3900 | g_mutex_unlock (&skeleton->priv->lock); |
| 3901 | return value; |
| 3902 | } |
| 3903 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3904 | static GVariant * |
| 3905 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3906 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3907 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3908 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3909 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3910 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3911 | g_mutex_unlock (&skeleton->priv->lock); |
| 3912 | return value; |
| 3913 | } |
| 3914 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3915 | static guchar |
| 3916 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3917 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3918 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3919 | guchar value; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3920 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3921 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3922 | g_mutex_unlock (&skeleton->priv->lock); |
| 3923 | return value; |
| 3924 | } |
| 3925 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3926 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3927 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3928 | { |
| 3929 | GObjectClass *gobject_class; |
| 3930 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 3931 | |
| 3932 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3933 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 3934 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 3935 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 3936 | gobject_class->notify = sensor_threshold_skeleton_notify; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3937 | |
| 3938 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3939 | sensor_threshold_override_properties (gobject_class, 1); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3940 | |
| 3941 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3942 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 3943 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 3944 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 3945 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3946 | |
| 3947 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3948 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3949 | #endif |
| 3950 | } |
| 3951 | |
| 3952 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3953 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3954 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3955 | iface->warning = _sensor_threshold_on_signal_warning; |
| 3956 | iface->critical = _sensor_threshold_on_signal_critical; |
| 3957 | iface->normal = _sensor_threshold_on_signal_normal; |
| 3958 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 3959 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 3960 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 3961 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 3962 | iface->get_state = sensor_threshold_skeleton_get_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3963 | } |
| 3964 | |
| 3965 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3966 | * sensor_threshold_skeleton_new: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3967 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3968 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3969 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3970 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3971 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3972 | SensorThreshold * |
| 3973 | sensor_threshold_skeleton_new (void) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3974 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 3975 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3976 | } |
| 3977 | |
| 3978 | /* ------------------------------------------------------------------------ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3979 | * Code for interface org.openbmc.SensorI2c |
| 3980 | * ------------------------------------------------------------------------ |
| 3981 | */ |
| 3982 | |
| 3983 | /** |
| 3984 | * SECTION:SensorI2c |
| 3985 | * @title: SensorI2c |
| 3986 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 3987 | * |
| 3988 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C. |
| 3989 | */ |
| 3990 | |
| 3991 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 3992 | |
| 3993 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 3994 | { |
| 3995 | { |
| 3996 | -1, |
| 3997 | (gchar *) "dev_path", |
| 3998 | (gchar *) "s", |
| 3999 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4000 | NULL |
| 4001 | }, |
| 4002 | "dev-path", |
| 4003 | FALSE |
| 4004 | }; |
| 4005 | |
| 4006 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 4007 | { |
| 4008 | { |
| 4009 | -1, |
| 4010 | (gchar *) "address", |
| 4011 | (gchar *) "s", |
| 4012 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4013 | NULL |
| 4014 | }, |
| 4015 | "address", |
| 4016 | FALSE |
| 4017 | }; |
| 4018 | |
| 4019 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 4020 | { |
| 4021 | &_sensor_i2c_property_info_dev_path, |
| 4022 | &_sensor_i2c_property_info_address, |
| 4023 | NULL |
| 4024 | }; |
| 4025 | |
| 4026 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 4027 | { |
| 4028 | { |
| 4029 | -1, |
| 4030 | (gchar *) "org.openbmc.SensorI2c", |
| 4031 | NULL, |
| 4032 | NULL, |
| 4033 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 4034 | NULL |
| 4035 | }, |
| 4036 | "sensor-i2c", |
| 4037 | }; |
| 4038 | |
| 4039 | |
| 4040 | /** |
| 4041 | * sensor_i2c_interface_info: |
| 4042 | * |
| 4043 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 4044 | * |
| 4045 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 4046 | */ |
| 4047 | GDBusInterfaceInfo * |
| 4048 | sensor_i2c_interface_info (void) |
| 4049 | { |
| 4050 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 4051 | } |
| 4052 | |
| 4053 | /** |
| 4054 | * sensor_i2c_override_properties: |
| 4055 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 4056 | * @property_id_begin: The property id to assign to the first overridden property. |
| 4057 | * |
| 4058 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 4059 | * The properties are overridden in the order they are defined. |
| 4060 | * |
| 4061 | * Returns: The last property id. |
| 4062 | */ |
| 4063 | guint |
| 4064 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 4065 | { |
| 4066 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 4067 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 4068 | return property_id_begin - 1; |
| 4069 | } |
| 4070 | |
| 4071 | |
| 4072 | |
| 4073 | /** |
| 4074 | * SensorI2c: |
| 4075 | * |
| 4076 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 4077 | */ |
| 4078 | |
| 4079 | /** |
| 4080 | * SensorI2cIface: |
| 4081 | * @parent_iface: The parent interface. |
| 4082 | * @get_address: Getter for the #SensorI2c:address property. |
| 4083 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 4084 | * |
| 4085 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 4086 | */ |
| 4087 | |
| 4088 | typedef SensorI2cIface SensorI2cInterface; |
| 4089 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 4090 | |
| 4091 | static void |
| 4092 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 4093 | { |
| 4094 | /* GObject properties for D-Bus properties: */ |
| 4095 | /** |
| 4096 | * SensorI2c:dev-path: |
| 4097 | * |
| 4098 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 4099 | * |
| 4100 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
| 4101 | */ |
| 4102 | g_object_interface_install_property (iface, |
| 4103 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4104 | /** |
| 4105 | * SensorI2c:address: |
| 4106 | * |
| 4107 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 4108 | * |
| 4109 | * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. |
| 4110 | */ |
| 4111 | g_object_interface_install_property (iface, |
| 4112 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4113 | } |
| 4114 | |
| 4115 | /** |
| 4116 | * sensor_i2c_get_dev_path: (skip) |
| 4117 | * @object: A #SensorI2c. |
| 4118 | * |
| 4119 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 4120 | * |
| 4121 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4122 | * |
| 4123 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_dev_path() if on another thread.</warning> |
| 4124 | * |
| 4125 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4126 | */ |
| 4127 | const gchar * |
| 4128 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 4129 | { |
| 4130 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 4131 | } |
| 4132 | |
| 4133 | /** |
| 4134 | * sensor_i2c_dup_dev_path: (skip) |
| 4135 | * @object: A #SensorI2c. |
| 4136 | * |
| 4137 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 4138 | * |
| 4139 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4140 | * |
| 4141 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4142 | */ |
| 4143 | gchar * |
| 4144 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 4145 | { |
| 4146 | gchar *value; |
| 4147 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 4148 | return value; |
| 4149 | } |
| 4150 | |
| 4151 | /** |
| 4152 | * sensor_i2c_set_dev_path: (skip) |
| 4153 | * @object: A #SensorI2c. |
| 4154 | * @value: The value to set. |
| 4155 | * |
| 4156 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 4157 | * |
| 4158 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4159 | */ |
| 4160 | void |
| 4161 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 4162 | { |
| 4163 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 4164 | } |
| 4165 | |
| 4166 | /** |
| 4167 | * sensor_i2c_get_address: (skip) |
| 4168 | * @object: A #SensorI2c. |
| 4169 | * |
| 4170 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 4171 | * |
| 4172 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4173 | * |
| 4174 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_address() if on another thread.</warning> |
| 4175 | * |
| 4176 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4177 | */ |
| 4178 | const gchar * |
| 4179 | sensor_i2c_get_address (SensorI2c *object) |
| 4180 | { |
| 4181 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 4182 | } |
| 4183 | |
| 4184 | /** |
| 4185 | * sensor_i2c_dup_address: (skip) |
| 4186 | * @object: A #SensorI2c. |
| 4187 | * |
| 4188 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 4189 | * |
| 4190 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4191 | * |
| 4192 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4193 | */ |
| 4194 | gchar * |
| 4195 | sensor_i2c_dup_address (SensorI2c *object) |
| 4196 | { |
| 4197 | gchar *value; |
| 4198 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 4199 | return value; |
| 4200 | } |
| 4201 | |
| 4202 | /** |
| 4203 | * sensor_i2c_set_address: (skip) |
| 4204 | * @object: A #SensorI2c. |
| 4205 | * @value: The value to set. |
| 4206 | * |
| 4207 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 4208 | * |
| 4209 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4210 | */ |
| 4211 | void |
| 4212 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 4213 | { |
| 4214 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 4215 | } |
| 4216 | |
| 4217 | /* ------------------------------------------------------------------------ */ |
| 4218 | |
| 4219 | /** |
| 4220 | * SensorI2cProxy: |
| 4221 | * |
| 4222 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 4223 | */ |
| 4224 | |
| 4225 | /** |
| 4226 | * SensorI2cProxyClass: |
| 4227 | * @parent_class: The parent class. |
| 4228 | * |
| 4229 | * Class structure for #SensorI2cProxy. |
| 4230 | */ |
| 4231 | |
| 4232 | struct _SensorI2cProxyPrivate |
| 4233 | { |
| 4234 | GData *qdata; |
| 4235 | }; |
| 4236 | |
| 4237 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 4238 | |
| 4239 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4240 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 4241 | G_ADD_PRIVATE (SensorI2cProxy) |
| 4242 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 4243 | |
| 4244 | #else |
| 4245 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 4246 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 4247 | |
| 4248 | #endif |
| 4249 | static void |
| 4250 | sensor_i2c_proxy_finalize (GObject *object) |
| 4251 | { |
| 4252 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4253 | g_datalist_clear (&proxy->priv->qdata); |
| 4254 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 4255 | } |
| 4256 | |
| 4257 | static void |
| 4258 | sensor_i2c_proxy_get_property (GObject *object, |
| 4259 | guint prop_id, |
| 4260 | GValue *value, |
| 4261 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4262 | { |
| 4263 | const _ExtendedGDBusPropertyInfo *info; |
| 4264 | GVariant *variant; |
| 4265 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4266 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 4267 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 4268 | if (info->use_gvariant) |
| 4269 | { |
| 4270 | g_value_set_variant (value, variant); |
| 4271 | } |
| 4272 | else |
| 4273 | { |
| 4274 | if (variant != NULL) |
| 4275 | g_dbus_gvariant_to_gvalue (variant, value); |
| 4276 | } |
| 4277 | if (variant != NULL) |
| 4278 | g_variant_unref (variant); |
| 4279 | } |
| 4280 | |
| 4281 | static void |
| 4282 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 4283 | GAsyncResult *res, |
| 4284 | gpointer user_data) |
| 4285 | { |
| 4286 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 4287 | GError *error; |
| 4288 | GVariant *_ret; |
| 4289 | error = NULL; |
| 4290 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 4291 | if (!_ret) |
| 4292 | { |
| 4293 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 4294 | info->parent_struct.name, |
| 4295 | error->message, g_quark_to_string (error->domain), error->code); |
| 4296 | g_error_free (error); |
| 4297 | } |
| 4298 | else |
| 4299 | { |
| 4300 | g_variant_unref (_ret); |
| 4301 | } |
| 4302 | } |
| 4303 | |
| 4304 | static void |
| 4305 | sensor_i2c_proxy_set_property (GObject *object, |
| 4306 | guint prop_id, |
| 4307 | const GValue *value, |
| 4308 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4309 | { |
| 4310 | const _ExtendedGDBusPropertyInfo *info; |
| 4311 | GVariant *variant; |
| 4312 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4313 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 4314 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4315 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 4316 | "org.freedesktop.DBus.Properties.Set", |
| 4317 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 4318 | G_DBUS_CALL_FLAGS_NONE, |
| 4319 | -1, |
| 4320 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 4321 | g_variant_unref (variant); |
| 4322 | } |
| 4323 | |
| 4324 | static void |
| 4325 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 4326 | const gchar *sender_name G_GNUC_UNUSED, |
| 4327 | const gchar *signal_name, |
| 4328 | GVariant *parameters) |
| 4329 | { |
| 4330 | _ExtendedGDBusSignalInfo *info; |
| 4331 | GVariantIter iter; |
| 4332 | GVariant *child; |
| 4333 | GValue *paramv; |
| 4334 | guint num_params; |
| 4335 | guint n; |
| 4336 | guint signal_id; |
| 4337 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 4338 | if (info == NULL) |
| 4339 | return; |
| 4340 | num_params = g_variant_n_children (parameters); |
| 4341 | paramv = g_new0 (GValue, num_params + 1); |
| 4342 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 4343 | g_value_set_object (¶mv[0], proxy); |
| 4344 | g_variant_iter_init (&iter, parameters); |
| 4345 | n = 1; |
| 4346 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4347 | { |
| 4348 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 4349 | if (arg_info->use_gvariant) |
| 4350 | { |
| 4351 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4352 | g_value_set_variant (¶mv[n], child); |
| 4353 | n++; |
| 4354 | } |
| 4355 | else |
| 4356 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4357 | g_variant_unref (child); |
| 4358 | } |
| 4359 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 4360 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 4361 | for (n = 0; n < num_params + 1; n++) |
| 4362 | g_value_unset (¶mv[n]); |
| 4363 | g_free (paramv); |
| 4364 | } |
| 4365 | |
| 4366 | static void |
| 4367 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 4368 | GVariant *changed_properties, |
| 4369 | const gchar *const *invalidated_properties) |
| 4370 | { |
| 4371 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 4372 | guint n; |
| 4373 | const gchar *key; |
| 4374 | GVariantIter *iter; |
| 4375 | _ExtendedGDBusPropertyInfo *info; |
| 4376 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 4377 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 4378 | { |
| 4379 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 4380 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 4381 | if (info != NULL) |
| 4382 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4383 | } |
| 4384 | g_variant_iter_free (iter); |
| 4385 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 4386 | { |
| 4387 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 4388 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 4389 | if (info != NULL) |
| 4390 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4391 | } |
| 4392 | } |
| 4393 | |
| 4394 | static const gchar * |
| 4395 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 4396 | { |
| 4397 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4398 | GVariant *variant; |
| 4399 | const gchar *value = NULL; |
| 4400 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 4401 | if (variant != NULL) |
| 4402 | { |
| 4403 | value = g_variant_get_string (variant, NULL); |
| 4404 | g_variant_unref (variant); |
| 4405 | } |
| 4406 | return value; |
| 4407 | } |
| 4408 | |
| 4409 | static const gchar * |
| 4410 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 4411 | { |
| 4412 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4413 | GVariant *variant; |
| 4414 | const gchar *value = NULL; |
| 4415 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 4416 | if (variant != NULL) |
| 4417 | { |
| 4418 | value = g_variant_get_string (variant, NULL); |
| 4419 | g_variant_unref (variant); |
| 4420 | } |
| 4421 | return value; |
| 4422 | } |
| 4423 | |
| 4424 | static void |
| 4425 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 4426 | { |
| 4427 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4428 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 4429 | #else |
| 4430 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 4431 | #endif |
| 4432 | |
| 4433 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 4434 | } |
| 4435 | |
| 4436 | static void |
| 4437 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 4438 | { |
| 4439 | GObjectClass *gobject_class; |
| 4440 | GDBusProxyClass *proxy_class; |
| 4441 | |
| 4442 | gobject_class = G_OBJECT_CLASS (klass); |
| 4443 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 4444 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 4445 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 4446 | |
| 4447 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 4448 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 4449 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 4450 | |
| 4451 | sensor_i2c_override_properties (gobject_class, 1); |
| 4452 | |
| 4453 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4454 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 4455 | #endif |
| 4456 | } |
| 4457 | |
| 4458 | static void |
| 4459 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 4460 | { |
| 4461 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 4462 | iface->get_address = sensor_i2c_proxy_get_address; |
| 4463 | } |
| 4464 | |
| 4465 | /** |
| 4466 | * sensor_i2c_proxy_new: |
| 4467 | * @connection: A #GDBusConnection. |
| 4468 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4469 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4470 | * @object_path: An object path. |
| 4471 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4472 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4473 | * @user_data: User data to pass to @callback. |
| 4474 | * |
| 4475 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details. |
| 4476 | * |
| 4477 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4478 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 4479 | * |
| 4480 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 4481 | */ |
| 4482 | void |
| 4483 | sensor_i2c_proxy_new ( |
| 4484 | GDBusConnection *connection, |
| 4485 | GDBusProxyFlags flags, |
| 4486 | const gchar *name, |
| 4487 | const gchar *object_path, |
| 4488 | GCancellable *cancellable, |
| 4489 | GAsyncReadyCallback callback, |
| 4490 | gpointer user_data) |
| 4491 | { |
| 4492 | g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); |
| 4493 | } |
| 4494 | |
| 4495 | /** |
| 4496 | * sensor_i2c_proxy_new_finish: |
| 4497 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 4498 | * @error: Return location for error or %NULL |
| 4499 | * |
| 4500 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 4501 | * |
| 4502 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4503 | */ |
| 4504 | SensorI2c * |
| 4505 | sensor_i2c_proxy_new_finish ( |
| 4506 | GAsyncResult *res, |
| 4507 | GError **error) |
| 4508 | { |
| 4509 | GObject *ret; |
| 4510 | GObject *source_object; |
| 4511 | source_object = g_async_result_get_source_object (res); |
| 4512 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4513 | g_object_unref (source_object); |
| 4514 | if (ret != NULL) |
| 4515 | return SENSOR_I2C (ret); |
| 4516 | else |
| 4517 | return NULL; |
| 4518 | } |
| 4519 | |
| 4520 | /** |
| 4521 | * sensor_i2c_proxy_new_sync: |
| 4522 | * @connection: A #GDBusConnection. |
| 4523 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4524 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4525 | * @object_path: An object path. |
| 4526 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4527 | * @error: Return location for error or %NULL |
| 4528 | * |
| 4529 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details. |
| 4530 | * |
| 4531 | * The calling thread is blocked until a reply is received. |
| 4532 | * |
| 4533 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 4534 | * |
| 4535 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4536 | */ |
| 4537 | SensorI2c * |
| 4538 | sensor_i2c_proxy_new_sync ( |
| 4539 | GDBusConnection *connection, |
| 4540 | GDBusProxyFlags flags, |
| 4541 | const gchar *name, |
| 4542 | const gchar *object_path, |
| 4543 | GCancellable *cancellable, |
| 4544 | GError **error) |
| 4545 | { |
| 4546 | GInitable *ret; |
| 4547 | ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); |
| 4548 | if (ret != NULL) |
| 4549 | return SENSOR_I2C (ret); |
| 4550 | else |
| 4551 | return NULL; |
| 4552 | } |
| 4553 | |
| 4554 | |
| 4555 | /** |
| 4556 | * sensor_i2c_proxy_new_for_bus: |
| 4557 | * @bus_type: A #GBusType. |
| 4558 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4559 | * @name: A bus name (well-known or unique). |
| 4560 | * @object_path: An object path. |
| 4561 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4562 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4563 | * @user_data: User data to pass to @callback. |
| 4564 | * |
| 4565 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 4566 | * |
| 4567 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 4568 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 4569 | * |
| 4570 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 4571 | */ |
| 4572 | void |
| 4573 | sensor_i2c_proxy_new_for_bus ( |
| 4574 | GBusType bus_type, |
| 4575 | GDBusProxyFlags flags, |
| 4576 | const gchar *name, |
| 4577 | const gchar *object_path, |
| 4578 | GCancellable *cancellable, |
| 4579 | GAsyncReadyCallback callback, |
| 4580 | gpointer user_data) |
| 4581 | { |
| 4582 | g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); |
| 4583 | } |
| 4584 | |
| 4585 | /** |
| 4586 | * sensor_i2c_proxy_new_for_bus_finish: |
| 4587 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 4588 | * @error: Return location for error or %NULL |
| 4589 | * |
| 4590 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 4591 | * |
| 4592 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4593 | */ |
| 4594 | SensorI2c * |
| 4595 | sensor_i2c_proxy_new_for_bus_finish ( |
| 4596 | GAsyncResult *res, |
| 4597 | GError **error) |
| 4598 | { |
| 4599 | GObject *ret; |
| 4600 | GObject *source_object; |
| 4601 | source_object = g_async_result_get_source_object (res); |
| 4602 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4603 | g_object_unref (source_object); |
| 4604 | if (ret != NULL) |
| 4605 | return SENSOR_I2C (ret); |
| 4606 | else |
| 4607 | return NULL; |
| 4608 | } |
| 4609 | |
| 4610 | /** |
| 4611 | * sensor_i2c_proxy_new_for_bus_sync: |
| 4612 | * @bus_type: A #GBusType. |
| 4613 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4614 | * @name: A bus name (well-known or unique). |
| 4615 | * @object_path: An object path. |
| 4616 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4617 | * @error: Return location for error or %NULL |
| 4618 | * |
| 4619 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 4620 | * |
| 4621 | * The calling thread is blocked until a reply is received. |
| 4622 | * |
| 4623 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 4624 | * |
| 4625 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4626 | */ |
| 4627 | SensorI2c * |
| 4628 | sensor_i2c_proxy_new_for_bus_sync ( |
| 4629 | GBusType bus_type, |
| 4630 | GDBusProxyFlags flags, |
| 4631 | const gchar *name, |
| 4632 | const gchar *object_path, |
| 4633 | GCancellable *cancellable, |
| 4634 | GError **error) |
| 4635 | { |
| 4636 | GInitable *ret; |
| 4637 | ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); |
| 4638 | if (ret != NULL) |
| 4639 | return SENSOR_I2C (ret); |
| 4640 | else |
| 4641 | return NULL; |
| 4642 | } |
| 4643 | |
| 4644 | |
| 4645 | /* ------------------------------------------------------------------------ */ |
| 4646 | |
| 4647 | /** |
| 4648 | * SensorI2cSkeleton: |
| 4649 | * |
| 4650 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 4651 | */ |
| 4652 | |
| 4653 | /** |
| 4654 | * SensorI2cSkeletonClass: |
| 4655 | * @parent_class: The parent class. |
| 4656 | * |
| 4657 | * Class structure for #SensorI2cSkeleton. |
| 4658 | */ |
| 4659 | |
| 4660 | struct _SensorI2cSkeletonPrivate |
| 4661 | { |
| 4662 | GValue *properties; |
| 4663 | GList *changed_properties; |
| 4664 | GSource *changed_properties_idle_source; |
| 4665 | GMainContext *context; |
| 4666 | GMutex lock; |
| 4667 | }; |
| 4668 | |
| 4669 | static void |
| 4670 | _sensor_i2c_skeleton_handle_method_call ( |
| 4671 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4672 | const gchar *sender G_GNUC_UNUSED, |
| 4673 | const gchar *object_path G_GNUC_UNUSED, |
| 4674 | const gchar *interface_name, |
| 4675 | const gchar *method_name, |
| 4676 | GVariant *parameters, |
| 4677 | GDBusMethodInvocation *invocation, |
| 4678 | gpointer user_data) |
| 4679 | { |
| 4680 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4681 | _ExtendedGDBusMethodInfo *info; |
| 4682 | GVariantIter iter; |
| 4683 | GVariant *child; |
| 4684 | GValue *paramv; |
| 4685 | guint num_params; |
| 4686 | guint num_extra; |
| 4687 | guint n; |
| 4688 | guint signal_id; |
| 4689 | GValue return_value = G_VALUE_INIT; |
| 4690 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 4691 | g_assert (info != NULL); |
| 4692 | num_params = g_variant_n_children (parameters); |
| 4693 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 4694 | n = 0; |
| 4695 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 4696 | g_value_set_object (¶mv[n++], skeleton); |
| 4697 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 4698 | g_value_set_object (¶mv[n++], invocation); |
| 4699 | if (info->pass_fdlist) |
| 4700 | { |
| 4701 | #ifdef G_OS_UNIX |
| 4702 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 4703 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 4704 | #else |
| 4705 | g_assert_not_reached (); |
| 4706 | #endif |
| 4707 | } |
| 4708 | g_variant_iter_init (&iter, parameters); |
| 4709 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4710 | { |
| 4711 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 4712 | if (arg_info->use_gvariant) |
| 4713 | { |
| 4714 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4715 | g_value_set_variant (¶mv[n], child); |
| 4716 | n++; |
| 4717 | } |
| 4718 | else |
| 4719 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4720 | g_variant_unref (child); |
| 4721 | } |
| 4722 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 4723 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 4724 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 4725 | if (!g_value_get_boolean (&return_value)) |
| 4726 | 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); |
| 4727 | g_value_unset (&return_value); |
| 4728 | for (n = 0; n < num_params + num_extra; n++) |
| 4729 | g_value_unset (¶mv[n]); |
| 4730 | g_free (paramv); |
| 4731 | } |
| 4732 | |
| 4733 | static GVariant * |
| 4734 | _sensor_i2c_skeleton_handle_get_property ( |
| 4735 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4736 | const gchar *sender G_GNUC_UNUSED, |
| 4737 | const gchar *object_path G_GNUC_UNUSED, |
| 4738 | const gchar *interface_name G_GNUC_UNUSED, |
| 4739 | const gchar *property_name, |
| 4740 | GError **error, |
| 4741 | gpointer user_data) |
| 4742 | { |
| 4743 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4744 | GValue value = G_VALUE_INIT; |
| 4745 | GParamSpec *pspec; |
| 4746 | _ExtendedGDBusPropertyInfo *info; |
| 4747 | GVariant *ret; |
| 4748 | ret = NULL; |
| 4749 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 4750 | g_assert (info != NULL); |
| 4751 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4752 | if (pspec == NULL) |
| 4753 | { |
| 4754 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4755 | } |
| 4756 | else |
| 4757 | { |
| 4758 | g_value_init (&value, pspec->value_type); |
| 4759 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4760 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4761 | g_value_unset (&value); |
| 4762 | } |
| 4763 | return ret; |
| 4764 | } |
| 4765 | |
| 4766 | static gboolean |
| 4767 | _sensor_i2c_skeleton_handle_set_property ( |
| 4768 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4769 | const gchar *sender G_GNUC_UNUSED, |
| 4770 | const gchar *object_path G_GNUC_UNUSED, |
| 4771 | const gchar *interface_name G_GNUC_UNUSED, |
| 4772 | const gchar *property_name, |
| 4773 | GVariant *variant, |
| 4774 | GError **error, |
| 4775 | gpointer user_data) |
| 4776 | { |
| 4777 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4778 | GValue value = G_VALUE_INIT; |
| 4779 | GParamSpec *pspec; |
| 4780 | _ExtendedGDBusPropertyInfo *info; |
| 4781 | gboolean ret; |
| 4782 | ret = FALSE; |
| 4783 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 4784 | g_assert (info != NULL); |
| 4785 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4786 | if (pspec == NULL) |
| 4787 | { |
| 4788 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4789 | } |
| 4790 | else |
| 4791 | { |
| 4792 | if (info->use_gvariant) |
| 4793 | g_value_set_variant (&value, variant); |
| 4794 | else |
| 4795 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 4796 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4797 | g_value_unset (&value); |
| 4798 | ret = TRUE; |
| 4799 | } |
| 4800 | return ret; |
| 4801 | } |
| 4802 | |
| 4803 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 4804 | { |
| 4805 | _sensor_i2c_skeleton_handle_method_call, |
| 4806 | _sensor_i2c_skeleton_handle_get_property, |
| 4807 | _sensor_i2c_skeleton_handle_set_property, |
| 4808 | {NULL} |
| 4809 | }; |
| 4810 | |
| 4811 | static GDBusInterfaceInfo * |
| 4812 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4813 | { |
| 4814 | return sensor_i2c_interface_info (); |
| 4815 | } |
| 4816 | |
| 4817 | static GDBusInterfaceVTable * |
| 4818 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4819 | { |
| 4820 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 4821 | } |
| 4822 | |
| 4823 | static GVariant * |
| 4824 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 4825 | { |
| 4826 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 4827 | |
| 4828 | GVariantBuilder builder; |
| 4829 | guint n; |
| 4830 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4831 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 4832 | goto out; |
| 4833 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 4834 | { |
| 4835 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 4836 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 4837 | { |
| 4838 | GVariant *value; |
| 4839 | value = _sensor_i2c_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorI2c", info->name, NULL, skeleton); |
| 4840 | if (value != NULL) |
| 4841 | { |
| 4842 | g_variant_take_ref (value); |
| 4843 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 4844 | g_variant_unref (value); |
| 4845 | } |
| 4846 | } |
| 4847 | } |
| 4848 | out: |
| 4849 | return g_variant_builder_end (&builder); |
| 4850 | } |
| 4851 | |
| 4852 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 4853 | |
| 4854 | static void |
| 4855 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 4856 | { |
| 4857 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 4858 | gboolean emit_changed = FALSE; |
| 4859 | |
| 4860 | g_mutex_lock (&skeleton->priv->lock); |
| 4861 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4862 | { |
| 4863 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4864 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4865 | emit_changed = TRUE; |
| 4866 | } |
| 4867 | g_mutex_unlock (&skeleton->priv->lock); |
| 4868 | |
| 4869 | if (emit_changed) |
| 4870 | _sensor_i2c_emit_changed (skeleton); |
| 4871 | } |
| 4872 | |
| 4873 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 4874 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4875 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4876 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 4877 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 4878 | |
| 4879 | #else |
| 4880 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4881 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 4882 | |
| 4883 | #endif |
| 4884 | static void |
| 4885 | sensor_i2c_skeleton_finalize (GObject *object) |
| 4886 | { |
| 4887 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 4888 | guint n; |
| 4889 | for (n = 0; n < 2; n++) |
| 4890 | g_value_unset (&skeleton->priv->properties[n]); |
| 4891 | g_free (skeleton->priv->properties); |
| 4892 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4893 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4894 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4895 | g_main_context_unref (skeleton->priv->context); |
| 4896 | g_mutex_clear (&skeleton->priv->lock); |
| 4897 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 4898 | } |
| 4899 | |
| 4900 | static void |
| 4901 | sensor_i2c_skeleton_get_property (GObject *object, |
| 4902 | guint prop_id, |
| 4903 | GValue *value, |
| 4904 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4905 | { |
| 4906 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 4907 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4908 | g_mutex_lock (&skeleton->priv->lock); |
| 4909 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 4910 | g_mutex_unlock (&skeleton->priv->lock); |
| 4911 | } |
| 4912 | |
| 4913 | static gboolean |
| 4914 | _sensor_i2c_emit_changed (gpointer user_data) |
| 4915 | { |
| 4916 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4917 | GList *l; |
| 4918 | GVariantBuilder builder; |
| 4919 | GVariantBuilder invalidated_builder; |
| 4920 | guint num_changes; |
| 4921 | |
| 4922 | g_mutex_lock (&skeleton->priv->lock); |
| 4923 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4924 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 4925 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 4926 | { |
| 4927 | ChangedProperty *cp = l->data; |
| 4928 | GVariant *variant; |
| 4929 | const GValue *cur_value; |
| 4930 | |
| 4931 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 4932 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 4933 | { |
| 4934 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 4935 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 4936 | g_variant_unref (variant); |
| 4937 | num_changes++; |
| 4938 | } |
| 4939 | } |
| 4940 | if (num_changes > 0) |
| 4941 | { |
| 4942 | GList *connections, *ll; |
| 4943 | GVariant *signal_variant; |
| 4944 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 4945 | &builder, &invalidated_builder)); |
| 4946 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4947 | for (ll = connections; ll != NULL; ll = ll->next) |
| 4948 | { |
| 4949 | GDBusConnection *connection = ll->data; |
| 4950 | |
| 4951 | g_dbus_connection_emit_signal (connection, |
| 4952 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 4953 | "org.freedesktop.DBus.Properties", |
| 4954 | "PropertiesChanged", |
| 4955 | signal_variant, |
| 4956 | NULL); |
| 4957 | } |
| 4958 | g_variant_unref (signal_variant); |
| 4959 | g_list_free_full (connections, g_object_unref); |
| 4960 | } |
| 4961 | else |
| 4962 | { |
| 4963 | g_variant_builder_clear (&builder); |
| 4964 | g_variant_builder_clear (&invalidated_builder); |
| 4965 | } |
| 4966 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4967 | skeleton->priv->changed_properties = NULL; |
| 4968 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4969 | g_mutex_unlock (&skeleton->priv->lock); |
| 4970 | return FALSE; |
| 4971 | } |
| 4972 | |
| 4973 | static void |
| 4974 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 4975 | { |
| 4976 | ChangedProperty *cp; |
| 4977 | GList *l; |
| 4978 | cp = NULL; |
| 4979 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 4980 | { |
| 4981 | ChangedProperty *i_cp = l->data; |
| 4982 | if (i_cp->info == info) |
| 4983 | { |
| 4984 | cp = i_cp; |
| 4985 | break; |
| 4986 | } |
| 4987 | } |
| 4988 | if (cp == NULL) |
| 4989 | { |
| 4990 | cp = g_new0 (ChangedProperty, 1); |
| 4991 | cp->prop_id = prop_id; |
| 4992 | cp->info = info; |
| 4993 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 4994 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 4995 | g_value_copy (orig_value, &cp->orig_value); |
| 4996 | } |
| 4997 | } |
| 4998 | |
| 4999 | static void |
| 5000 | sensor_i2c_skeleton_notify (GObject *object, |
| 5001 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5002 | { |
| 5003 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5004 | g_mutex_lock (&skeleton->priv->lock); |
| 5005 | if (skeleton->priv->changed_properties != NULL && |
| 5006 | skeleton->priv->changed_properties_idle_source == NULL) |
| 5007 | { |
| 5008 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 5009 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 5010 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 5011 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 5012 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 5013 | } |
| 5014 | g_mutex_unlock (&skeleton->priv->lock); |
| 5015 | } |
| 5016 | |
| 5017 | static void |
| 5018 | sensor_i2c_skeleton_set_property (GObject *object, |
| 5019 | guint prop_id, |
| 5020 | const GValue *value, |
| 5021 | GParamSpec *pspec) |
| 5022 | { |
| 5023 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5024 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5025 | g_mutex_lock (&skeleton->priv->lock); |
| 5026 | g_object_freeze_notify (object); |
| 5027 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 5028 | { |
| 5029 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 5030 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 5031 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 5032 | g_object_notify_by_pspec (object, pspec); |
| 5033 | } |
| 5034 | g_mutex_unlock (&skeleton->priv->lock); |
| 5035 | g_object_thaw_notify (object); |
| 5036 | } |
| 5037 | |
| 5038 | static void |
| 5039 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 5040 | { |
| 5041 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5042 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 5043 | #else |
| 5044 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 5045 | #endif |
| 5046 | |
| 5047 | g_mutex_init (&skeleton->priv->lock); |
| 5048 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 5049 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 5050 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 5051 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 5052 | } |
| 5053 | |
| 5054 | static const gchar * |
| 5055 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 5056 | { |
| 5057 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5058 | const gchar *value; |
| 5059 | g_mutex_lock (&skeleton->priv->lock); |
| 5060 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 5061 | g_mutex_unlock (&skeleton->priv->lock); |
| 5062 | return value; |
| 5063 | } |
| 5064 | |
| 5065 | static const gchar * |
| 5066 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 5067 | { |
| 5068 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5069 | const gchar *value; |
| 5070 | g_mutex_lock (&skeleton->priv->lock); |
| 5071 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 5072 | g_mutex_unlock (&skeleton->priv->lock); |
| 5073 | return value; |
| 5074 | } |
| 5075 | |
| 5076 | static void |
| 5077 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 5078 | { |
| 5079 | GObjectClass *gobject_class; |
| 5080 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 5081 | |
| 5082 | gobject_class = G_OBJECT_CLASS (klass); |
| 5083 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 5084 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 5085 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 5086 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 5087 | |
| 5088 | |
| 5089 | sensor_i2c_override_properties (gobject_class, 1); |
| 5090 | |
| 5091 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 5092 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 5093 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 5094 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 5095 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 5096 | |
| 5097 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5098 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 5099 | #endif |
| 5100 | } |
| 5101 | |
| 5102 | static void |
| 5103 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 5104 | { |
| 5105 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 5106 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 5107 | } |
| 5108 | |
| 5109 | /** |
| 5110 | * sensor_i2c_skeleton_new: |
| 5111 | * |
| 5112 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 5113 | * |
| 5114 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 5115 | */ |
| 5116 | SensorI2c * |
| 5117 | sensor_i2c_skeleton_new (void) |
| 5118 | { |
| 5119 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 5120 | } |
| 5121 | |
| 5122 | /* ------------------------------------------------------------------------ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5123 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 5124 | * ------------------------------------------------------------------------ |
| 5125 | */ |
| 5126 | |
| 5127 | /** |
| 5128 | * SECTION:Object |
| 5129 | * @title: Object |
| 5130 | * @short_description: Specialized GDBusObject types |
| 5131 | * |
| 5132 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 5133 | */ |
| 5134 | |
| 5135 | /** |
| 5136 | * Object: |
| 5137 | * |
| 5138 | * The #Object type is a specialized container of interfaces. |
| 5139 | */ |
| 5140 | |
| 5141 | /** |
| 5142 | * ObjectIface: |
| 5143 | * @parent_iface: The parent interface. |
| 5144 | * |
| 5145 | * Virtual table for the #Object interface. |
| 5146 | */ |
| 5147 | |
| 5148 | typedef ObjectIface ObjectInterface; |
| 5149 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 5150 | |
| 5151 | static void |
| 5152 | object_default_init (ObjectIface *iface) |
| 5153 | { |
| 5154 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5155 | * Object:sensor-value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5156 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5157 | * The #SensorValue instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>, if any. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5158 | * |
| 5159 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 5160 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5161 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5162 | |
| 5163 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5164 | * Object:sensor-threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5165 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5166 | * The #SensorThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>, if any. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5167 | * |
| 5168 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 5169 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5170 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5171 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5172 | /** |
| 5173 | * Object:sensor-i2c: |
| 5174 | * |
| 5175 | * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any. |
| 5176 | * |
| 5177 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 5178 | */ |
| 5179 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 5180 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5181 | } |
| 5182 | |
| 5183 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5184 | * object_get_sensor_value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5185 | * @object: A #Object. |
| 5186 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5187 | * Gets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object, if any. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5188 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5189 | * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5190 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5191 | SensorValue *object_get_sensor_value (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5192 | { |
| 5193 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5194 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5195 | if (ret == NULL) |
| 5196 | return NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5197 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5198 | } |
| 5199 | |
| 5200 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5201 | * object_get_sensor_threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5202 | * @object: A #Object. |
| 5203 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5204 | * Gets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object, if any. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5205 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5206 | * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5207 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5208 | SensorThreshold *object_get_sensor_threshold (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5209 | { |
| 5210 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5211 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5212 | if (ret == NULL) |
| 5213 | return NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5214 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5215 | } |
| 5216 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5217 | /** |
| 5218 | * object_get_sensor_i2c: |
| 5219 | * @object: A #Object. |
| 5220 | * |
| 5221 | * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any. |
| 5222 | * |
| 5223 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 5224 | */ |
| 5225 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 5226 | { |
| 5227 | GDBusInterface *ret; |
| 5228 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 5229 | if (ret == NULL) |
| 5230 | return NULL; |
| 5231 | return SENSOR_I2C (ret); |
| 5232 | } |
| 5233 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5234 | |
| 5235 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5236 | * object_peek_sensor_value: (skip) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5237 | * @object: A #Object. |
| 5238 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5239 | * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5240 | * |
| 5241 | * <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> |
| 5242 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5243 | * Returns: (transfer none): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5244 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5245 | SensorValue *object_peek_sensor_value (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5246 | { |
| 5247 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5248 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5249 | if (ret == NULL) |
| 5250 | return NULL; |
| 5251 | g_object_unref (ret); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5252 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5253 | } |
| 5254 | |
| 5255 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5256 | * object_peek_sensor_threshold: (skip) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5257 | * @object: A #Object. |
| 5258 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5259 | * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5260 | * |
| 5261 | * <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> |
| 5262 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5263 | * Returns: (transfer none): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5264 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5265 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5266 | { |
| 5267 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5268 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5269 | if (ret == NULL) |
| 5270 | return NULL; |
| 5271 | g_object_unref (ret); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5272 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5273 | } |
| 5274 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5275 | /** |
| 5276 | * object_peek_sensor_i2c: (skip) |
| 5277 | * @object: A #Object. |
| 5278 | * |
| 5279 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 5280 | * |
| 5281 | * <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> |
| 5282 | * |
| 5283 | * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 5284 | */ |
| 5285 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 5286 | { |
| 5287 | GDBusInterface *ret; |
| 5288 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 5289 | if (ret == NULL) |
| 5290 | return NULL; |
| 5291 | g_object_unref (ret); |
| 5292 | return SENSOR_I2C (ret); |
| 5293 | } |
| 5294 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5295 | |
| 5296 | static void |
| 5297 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 5298 | { |
| 5299 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 5300 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 5301 | * anything about, for example old generated code in this process talking to |
| 5302 | * newer generated code in the other process. */ |
| 5303 | if (info != NULL) |
| 5304 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 5305 | } |
| 5306 | |
| 5307 | /** |
| 5308 | * ObjectProxy: |
| 5309 | * |
| 5310 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 5311 | */ |
| 5312 | |
| 5313 | /** |
| 5314 | * ObjectProxyClass: |
| 5315 | * @parent_class: The parent class. |
| 5316 | * |
| 5317 | * Class structure for #ObjectProxy. |
| 5318 | */ |
| 5319 | |
| 5320 | static void |
| 5321 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 5322 | { |
| 5323 | } |
| 5324 | |
| 5325 | static void |
| 5326 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 5327 | { |
| 5328 | iface->interface_added = object_notify; |
| 5329 | iface->interface_removed = object_notify; |
| 5330 | } |
| 5331 | |
| 5332 | |
| 5333 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 5334 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 5335 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 5336 | |
| 5337 | static void |
| 5338 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 5339 | { |
| 5340 | } |
| 5341 | |
| 5342 | static void |
| 5343 | object_proxy_set_property (GObject *gobject, |
| 5344 | guint prop_id, |
| 5345 | const GValue *value G_GNUC_UNUSED, |
| 5346 | GParamSpec *pspec) |
| 5347 | { |
| 5348 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 5349 | } |
| 5350 | |
| 5351 | static void |
| 5352 | object_proxy_get_property (GObject *gobject, |
| 5353 | guint prop_id, |
| 5354 | GValue *value, |
| 5355 | GParamSpec *pspec) |
| 5356 | { |
| 5357 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 5358 | GDBusInterface *interface; |
| 5359 | |
| 5360 | switch (prop_id) |
| 5361 | { |
| 5362 | case 1: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5363 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5364 | g_value_take_object (value, interface); |
| 5365 | break; |
| 5366 | |
| 5367 | case 2: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5368 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5369 | g_value_take_object (value, interface); |
| 5370 | break; |
| 5371 | |
| 5372 | case 3: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5373 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5374 | g_value_take_object (value, interface); |
| 5375 | break; |
| 5376 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5377 | default: |
| 5378 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 5379 | break; |
| 5380 | } |
| 5381 | } |
| 5382 | |
| 5383 | static void |
| 5384 | object_proxy_class_init (ObjectProxyClass *klass) |
| 5385 | { |
| 5386 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 5387 | |
| 5388 | gobject_class->set_property = object_proxy_set_property; |
| 5389 | gobject_class->get_property = object_proxy_get_property; |
| 5390 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5391 | g_object_class_override_property (gobject_class, 1, "sensor-value"); |
| 5392 | g_object_class_override_property (gobject_class, 2, "sensor-threshold"); |
| 5393 | g_object_class_override_property (gobject_class, 3, "sensor-i2c"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5394 | } |
| 5395 | |
| 5396 | /** |
| 5397 | * object_proxy_new: |
| 5398 | * @connection: A #GDBusConnection. |
| 5399 | * @object_path: An object path. |
| 5400 | * |
| 5401 | * Creates a new proxy object. |
| 5402 | * |
| 5403 | * Returns: (transfer full): The proxy object. |
| 5404 | */ |
| 5405 | ObjectProxy * |
| 5406 | object_proxy_new (GDBusConnection *connection, |
| 5407 | const gchar *object_path) |
| 5408 | { |
| 5409 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 5410 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 5411 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 5412 | } |
| 5413 | |
| 5414 | /** |
| 5415 | * ObjectSkeleton: |
| 5416 | * |
| 5417 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 5418 | */ |
| 5419 | |
| 5420 | /** |
| 5421 | * ObjectSkeletonClass: |
| 5422 | * @parent_class: The parent class. |
| 5423 | * |
| 5424 | * Class structure for #ObjectSkeleton. |
| 5425 | */ |
| 5426 | |
| 5427 | static void |
| 5428 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 5429 | { |
| 5430 | } |
| 5431 | |
| 5432 | |
| 5433 | static void |
| 5434 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 5435 | { |
| 5436 | iface->interface_added = object_notify; |
| 5437 | iface->interface_removed = object_notify; |
| 5438 | } |
| 5439 | |
| 5440 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 5441 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 5442 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 5443 | |
| 5444 | static void |
| 5445 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 5446 | { |
| 5447 | } |
| 5448 | |
| 5449 | static void |
| 5450 | object_skeleton_set_property (GObject *gobject, |
| 5451 | guint prop_id, |
| 5452 | const GValue *value, |
| 5453 | GParamSpec *pspec) |
| 5454 | { |
| 5455 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 5456 | GDBusInterfaceSkeleton *interface; |
| 5457 | |
| 5458 | switch (prop_id) |
| 5459 | { |
| 5460 | case 1: |
| 5461 | interface = g_value_get_object (value); |
| 5462 | if (interface != NULL) |
| 5463 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5464 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5465 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 5466 | } |
| 5467 | else |
| 5468 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5469 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5470 | } |
| 5471 | break; |
| 5472 | |
| 5473 | case 2: |
| 5474 | interface = g_value_get_object (value); |
| 5475 | if (interface != NULL) |
| 5476 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5477 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5478 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 5479 | } |
| 5480 | else |
| 5481 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5482 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5483 | } |
| 5484 | break; |
| 5485 | |
| 5486 | case 3: |
| 5487 | interface = g_value_get_object (value); |
| 5488 | if (interface != NULL) |
| 5489 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5490 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5491 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 5492 | } |
| 5493 | else |
| 5494 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5495 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5496 | } |
| 5497 | break; |
| 5498 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5499 | default: |
| 5500 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 5501 | break; |
| 5502 | } |
| 5503 | } |
| 5504 | |
| 5505 | static void |
| 5506 | object_skeleton_get_property (GObject *gobject, |
| 5507 | guint prop_id, |
| 5508 | GValue *value, |
| 5509 | GParamSpec *pspec) |
| 5510 | { |
| 5511 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 5512 | GDBusInterface *interface; |
| 5513 | |
| 5514 | switch (prop_id) |
| 5515 | { |
| 5516 | case 1: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5517 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5518 | g_value_take_object (value, interface); |
| 5519 | break; |
| 5520 | |
| 5521 | case 2: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5522 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5523 | g_value_take_object (value, interface); |
| 5524 | break; |
| 5525 | |
| 5526 | case 3: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5527 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5528 | g_value_take_object (value, interface); |
| 5529 | break; |
| 5530 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5531 | default: |
| 5532 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 5533 | break; |
| 5534 | } |
| 5535 | } |
| 5536 | |
| 5537 | static void |
| 5538 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 5539 | { |
| 5540 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 5541 | |
| 5542 | gobject_class->set_property = object_skeleton_set_property; |
| 5543 | gobject_class->get_property = object_skeleton_get_property; |
| 5544 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5545 | g_object_class_override_property (gobject_class, 1, "sensor-value"); |
| 5546 | g_object_class_override_property (gobject_class, 2, "sensor-threshold"); |
| 5547 | g_object_class_override_property (gobject_class, 3, "sensor-i2c"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5548 | } |
| 5549 | |
| 5550 | /** |
| 5551 | * object_skeleton_new: |
| 5552 | * @object_path: An object path. |
| 5553 | * |
| 5554 | * Creates a new skeleton object. |
| 5555 | * |
| 5556 | * Returns: (transfer full): The skeleton object. |
| 5557 | */ |
| 5558 | ObjectSkeleton * |
| 5559 | object_skeleton_new (const gchar *object_path) |
| 5560 | { |
| 5561 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 5562 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 5563 | } |
| 5564 | |
| 5565 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5566 | * object_skeleton_set_sensor_value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5567 | * @object: A #ObjectSkeleton. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5568 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5569 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5570 | * Sets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5571 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5572 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5573 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5574 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5575 | } |
| 5576 | |
| 5577 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5578 | * object_skeleton_set_sensor_threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5579 | * @object: A #ObjectSkeleton. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5580 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5581 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5582 | * Sets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5583 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5584 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5585 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5586 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 5587 | } |
| 5588 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5589 | /** |
| 5590 | * object_skeleton_set_sensor_i2c: |
| 5591 | * @object: A #ObjectSkeleton. |
| 5592 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 5593 | * |
| 5594 | * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object. |
| 5595 | */ |
| 5596 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 5597 | { |
| 5598 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 5599 | } |
| 5600 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5601 | |
| 5602 | /* ------------------------------------------------------------------------ |
| 5603 | * Code for ObjectManager client |
| 5604 | * ------------------------------------------------------------------------ |
| 5605 | */ |
| 5606 | |
| 5607 | /** |
| 5608 | * SECTION:ObjectManagerClient |
| 5609 | * @title: ObjectManagerClient |
| 5610 | * @short_description: Generated GDBusObjectManagerClient type |
| 5611 | * |
| 5612 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 5613 | */ |
| 5614 | |
| 5615 | /** |
| 5616 | * ObjectManagerClient: |
| 5617 | * |
| 5618 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 5619 | */ |
| 5620 | |
| 5621 | /** |
| 5622 | * ObjectManagerClientClass: |
| 5623 | * @parent_class: The parent class. |
| 5624 | * |
| 5625 | * Class structure for #ObjectManagerClient. |
| 5626 | */ |
| 5627 | |
| 5628 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 5629 | |
| 5630 | static void |
| 5631 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 5632 | { |
| 5633 | } |
| 5634 | |
| 5635 | static void |
| 5636 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 5637 | { |
| 5638 | } |
| 5639 | |
| 5640 | /** |
| 5641 | * object_manager_client_get_proxy_type: |
| 5642 | * @manager: A #GDBusObjectManagerClient. |
| 5643 | * @object_path: The object path of the remote object (unused). |
| 5644 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 5645 | * @user_data: User data (unused). |
| 5646 | * |
| 5647 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 5648 | * |
| 5649 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 5650 | */ |
| 5651 | GType |
| 5652 | 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) |
| 5653 | { |
| 5654 | static gsize once_init_value = 0; |
| 5655 | static GHashTable *lookup_hash; |
| 5656 | GType ret; |
| 5657 | |
| 5658 | if (interface_name == NULL) |
| 5659 | return TYPE_OBJECT_PROXY; |
| 5660 | if (g_once_init_enter (&once_init_value)) |
| 5661 | { |
| 5662 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame^] | 5663 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); |
| 5664 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 5665 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 5666 | g_once_init_leave (&once_init_value, 1); |
| 5667 | } |
| 5668 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 5669 | if (ret == (GType) 0) |
| 5670 | ret = G_TYPE_DBUS_PROXY; |
| 5671 | return ret; |
| 5672 | } |
| 5673 | |
| 5674 | /** |
| 5675 | * object_manager_client_new: |
| 5676 | * @connection: A #GDBusConnection. |
| 5677 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 5678 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5679 | * @object_path: An object path. |
| 5680 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5681 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5682 | * @user_data: User data to pass to @callback. |
| 5683 | * |
| 5684 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 5685 | * |
| 5686 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5687 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 5688 | * |
| 5689 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 5690 | */ |
| 5691 | void |
| 5692 | object_manager_client_new ( |
| 5693 | GDBusConnection *connection, |
| 5694 | GDBusObjectManagerClientFlags flags, |
| 5695 | const gchar *name, |
| 5696 | const gchar *object_path, |
| 5697 | GCancellable *cancellable, |
| 5698 | GAsyncReadyCallback callback, |
| 5699 | gpointer user_data) |
| 5700 | { |
| 5701 | 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); |
| 5702 | } |
| 5703 | |
| 5704 | /** |
| 5705 | * object_manager_client_new_finish: |
| 5706 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 5707 | * @error: Return location for error or %NULL |
| 5708 | * |
| 5709 | * Finishes an operation started with object_manager_client_new(). |
| 5710 | * |
| 5711 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 5712 | */ |
| 5713 | GDBusObjectManager * |
| 5714 | object_manager_client_new_finish ( |
| 5715 | GAsyncResult *res, |
| 5716 | GError **error) |
| 5717 | { |
| 5718 | GObject *ret; |
| 5719 | GObject *source_object; |
| 5720 | source_object = g_async_result_get_source_object (res); |
| 5721 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5722 | g_object_unref (source_object); |
| 5723 | if (ret != NULL) |
| 5724 | return G_DBUS_OBJECT_MANAGER (ret); |
| 5725 | else |
| 5726 | return NULL; |
| 5727 | } |
| 5728 | |
| 5729 | /** |
| 5730 | * object_manager_client_new_sync: |
| 5731 | * @connection: A #GDBusConnection. |
| 5732 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 5733 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5734 | * @object_path: An object path. |
| 5735 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5736 | * @error: Return location for error or %NULL |
| 5737 | * |
| 5738 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 5739 | * |
| 5740 | * The calling thread is blocked until a reply is received. |
| 5741 | * |
| 5742 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 5743 | * |
| 5744 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 5745 | */ |
| 5746 | GDBusObjectManager * |
| 5747 | object_manager_client_new_sync ( |
| 5748 | GDBusConnection *connection, |
| 5749 | GDBusObjectManagerClientFlags flags, |
| 5750 | const gchar *name, |
| 5751 | const gchar *object_path, |
| 5752 | GCancellable *cancellable, |
| 5753 | GError **error) |
| 5754 | { |
| 5755 | GInitable *ret; |
| 5756 | 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); |
| 5757 | if (ret != NULL) |
| 5758 | return G_DBUS_OBJECT_MANAGER (ret); |
| 5759 | else |
| 5760 | return NULL; |
| 5761 | } |
| 5762 | |
| 5763 | |
| 5764 | /** |
| 5765 | * object_manager_client_new_for_bus: |
| 5766 | * @bus_type: A #GBusType. |
| 5767 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 5768 | * @name: A bus name (well-known or unique). |
| 5769 | * @object_path: An object path. |
| 5770 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5771 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5772 | * @user_data: User data to pass to @callback. |
| 5773 | * |
| 5774 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 5775 | * |
| 5776 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
| 5777 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 5778 | * |
| 5779 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 5780 | */ |
| 5781 | void |
| 5782 | object_manager_client_new_for_bus ( |
| 5783 | GBusType bus_type, |
| 5784 | GDBusObjectManagerClientFlags flags, |
| 5785 | const gchar *name, |
| 5786 | const gchar *object_path, |
| 5787 | GCancellable *cancellable, |
| 5788 | GAsyncReadyCallback callback, |
| 5789 | gpointer user_data) |
| 5790 | { |
| 5791 | 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); |
| 5792 | } |
| 5793 | |
| 5794 | /** |
| 5795 | * object_manager_client_new_for_bus_finish: |
| 5796 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 5797 | * @error: Return location for error or %NULL |
| 5798 | * |
| 5799 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 5800 | * |
| 5801 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 5802 | */ |
| 5803 | GDBusObjectManager * |
| 5804 | object_manager_client_new_for_bus_finish ( |
| 5805 | GAsyncResult *res, |
| 5806 | GError **error) |
| 5807 | { |
| 5808 | GObject *ret; |
| 5809 | GObject *source_object; |
| 5810 | source_object = g_async_result_get_source_object (res); |
| 5811 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5812 | g_object_unref (source_object); |
| 5813 | if (ret != NULL) |
| 5814 | return G_DBUS_OBJECT_MANAGER (ret); |
| 5815 | else |
| 5816 | return NULL; |
| 5817 | } |
| 5818 | |
| 5819 | /** |
| 5820 | * object_manager_client_new_for_bus_sync: |
| 5821 | * @bus_type: A #GBusType. |
| 5822 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 5823 | * @name: A bus name (well-known or unique). |
| 5824 | * @object_path: An object path. |
| 5825 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5826 | * @error: Return location for error or %NULL |
| 5827 | * |
| 5828 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 5829 | * |
| 5830 | * The calling thread is blocked until a reply is received. |
| 5831 | * |
| 5832 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 5833 | * |
| 5834 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 5835 | */ |
| 5836 | GDBusObjectManager * |
| 5837 | object_manager_client_new_for_bus_sync ( |
| 5838 | GBusType bus_type, |
| 5839 | GDBusObjectManagerClientFlags flags, |
| 5840 | const gchar *name, |
| 5841 | const gchar *object_path, |
| 5842 | GCancellable *cancellable, |
| 5843 | GError **error) |
| 5844 | { |
| 5845 | GInitable *ret; |
| 5846 | 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); |
| 5847 | if (ret != NULL) |
| 5848 | return G_DBUS_OBJECT_MANAGER (ret); |
| 5849 | else |
| 5850 | return NULL; |
| 5851 | } |
| 5852 | |
| 5853 | |