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 | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 328 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
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", |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 354 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 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 | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 374 | static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = |
| 375 | { |
| 376 | { |
| 377 | -1, |
| 378 | (gchar *) "settable", |
| 379 | (gchar *) "b", |
| 380 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 381 | NULL |
| 382 | }, |
| 383 | "settable", |
| 384 | FALSE |
| 385 | }; |
| 386 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 387 | static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 388 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 389 | &_sensor_value_property_info_value, |
| 390 | &_sensor_value_property_info_units, |
| 391 | &_sensor_value_property_info_poll_interval, |
| 392 | &_sensor_value_property_info_heatbeat, |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 393 | &_sensor_value_property_info_settable, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 394 | NULL |
| 395 | }; |
| 396 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 397 | static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 398 | { |
| 399 | { |
| 400 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 401 | (gchar *) "org.openbmc.SensorValue", |
| 402 | (GDBusMethodInfo **) &_sensor_value_method_info_pointers, |
| 403 | (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, |
| 404 | (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 405 | NULL |
| 406 | }, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 407 | "sensor-value", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 408 | }; |
| 409 | |
| 410 | |
| 411 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 412 | * sensor_value_interface_info: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 413 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 414 | * 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] | 415 | * |
| 416 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 417 | */ |
| 418 | GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 419 | sensor_value_interface_info (void) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 420 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 421 | return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 425 | * sensor_value_override_properties: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 426 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 427 | * @property_id_begin: The property id to assign to the first overridden property. |
| 428 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 429 | * Overrides all #GObject properties in the #SensorValue interface for a concrete class. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 430 | * The properties are overridden in the order they are defined. |
| 431 | * |
| 432 | * Returns: The last property id. |
| 433 | */ |
| 434 | guint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 435 | sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 436 | { |
| 437 | g_object_class_override_property (klass, property_id_begin++, "value"); |
| 438 | g_object_class_override_property (klass, property_id_begin++, "units"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 439 | g_object_class_override_property (klass, property_id_begin++, "poll-interval"); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 440 | g_object_class_override_property (klass, property_id_begin++, "heatbeat"); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 441 | g_object_class_override_property (klass, property_id_begin++, "settable"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 442 | return property_id_begin - 1; |
| 443 | } |
| 444 | |
| 445 | |
| 446 | |
| 447 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 448 | * SensorValue: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 449 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 450 | * 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] | 451 | */ |
| 452 | |
| 453 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 454 | * SensorValueIface: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 455 | * @parent_iface: The parent interface. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 456 | * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. |
| 457 | * @handle_init: Handler for the #SensorValue::handle-init signal. |
| 458 | * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. |
| 459 | * @get_heatbeat: Getter for the #SensorValue:heatbeat property. |
| 460 | * @get_poll_interval: Getter for the #SensorValue:poll-interval property. |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 461 | * @get_settable: Getter for the #SensorValue:settable property. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 462 | * @get_units: Getter for the #SensorValue:units property. |
| 463 | * @get_value: Getter for the #SensorValue:value property. |
| 464 | * @changed: Handler for the #SensorValue::changed signal. |
| 465 | * @heartbeat: Handler for the #SensorValue::heartbeat signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 466 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 467 | * 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] | 468 | */ |
| 469 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 470 | typedef SensorValueIface SensorValueInterface; |
| 471 | G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 472 | |
| 473 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 474 | sensor_value_default_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 475 | { |
| 476 | /* GObject signals for incoming D-Bus method calls: */ |
| 477 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 478 | * SensorValue::handle-init: |
| 479 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 480 | * @invocation: A #GDBusMethodInvocation. |
| 481 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 482 | * 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] | 483 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 484 | * 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] | 485 | * |
| 486 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 487 | */ |
| 488 | g_signal_new ("handle-init", |
| 489 | G_TYPE_FROM_INTERFACE (iface), |
| 490 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 491 | G_STRUCT_OFFSET (SensorValueIface, handle_init), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 492 | g_signal_accumulator_true_handled, |
| 493 | NULL, |
| 494 | g_cclosure_marshal_generic, |
| 495 | G_TYPE_BOOLEAN, |
| 496 | 1, |
| 497 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 498 | |
| 499 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 500 | * SensorValue::handle-get-value: |
| 501 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 502 | * @invocation: A #GDBusMethodInvocation. |
| 503 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 504 | * 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] | 505 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 506 | * 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] | 507 | * |
| 508 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 509 | */ |
| 510 | g_signal_new ("handle-get-value", |
| 511 | G_TYPE_FROM_INTERFACE (iface), |
| 512 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 513 | G_STRUCT_OFFSET (SensorValueIface, handle_get_value), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 514 | g_signal_accumulator_true_handled, |
| 515 | NULL, |
| 516 | g_cclosure_marshal_generic, |
| 517 | G_TYPE_BOOLEAN, |
| 518 | 1, |
| 519 | G_TYPE_DBUS_METHOD_INVOCATION); |
| 520 | |
| 521 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 522 | * SensorValue::handle-set-value: |
| 523 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 524 | * @invocation: A #GDBusMethodInvocation. |
| 525 | * @arg_value: Argument passed by remote caller. |
| 526 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 527 | * 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] | 528 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 529 | * 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] | 530 | * |
| 531 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
| 532 | */ |
| 533 | g_signal_new ("handle-set-value", |
| 534 | G_TYPE_FROM_INTERFACE (iface), |
| 535 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 536 | G_STRUCT_OFFSET (SensorValueIface, handle_set_value), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 537 | g_signal_accumulator_true_handled, |
| 538 | NULL, |
| 539 | g_cclosure_marshal_generic, |
| 540 | G_TYPE_BOOLEAN, |
| 541 | 2, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 542 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 543 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 544 | /* GObject signals for received D-Bus signals: */ |
| 545 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 546 | * SensorValue::changed: |
| 547 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 548 | * @arg_value: Argument. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 549 | * @arg_units: Argument. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 550 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 551 | * 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] | 552 | * |
| 553 | * 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. |
| 554 | */ |
| 555 | g_signal_new ("changed", |
| 556 | G_TYPE_FROM_INTERFACE (iface), |
| 557 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 558 | G_STRUCT_OFFSET (SensorValueIface, changed), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 559 | NULL, |
| 560 | NULL, |
| 561 | g_cclosure_marshal_generic, |
| 562 | G_TYPE_NONE, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 563 | 2, G_TYPE_VARIANT, G_TYPE_STRING); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 564 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 565 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 566 | * SensorValue::heartbeat: |
| 567 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 568 | * @arg_bus_name: Argument. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 569 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 570 | * 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] | 571 | * |
| 572 | * 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. |
| 573 | */ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 574 | g_signal_new ("heartbeat", |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 575 | G_TYPE_FROM_INTERFACE (iface), |
| 576 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 577 | G_STRUCT_OFFSET (SensorValueIface, heartbeat), |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 578 | NULL, |
| 579 | NULL, |
| 580 | g_cclosure_marshal_generic, |
| 581 | G_TYPE_NONE, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 582 | 1, G_TYPE_STRING); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 583 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 584 | /* GObject properties for D-Bus properties: */ |
| 585 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 586 | * SensorValue:value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 587 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 588 | * 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] | 589 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 590 | * 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. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 591 | */ |
| 592 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 593 | 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] | 594 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 595 | * SensorValue:units: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 596 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 597 | * 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] | 598 | * |
| 599 | * 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. |
| 600 | */ |
| 601 | g_object_interface_install_property (iface, |
| 602 | 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] | 603 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 604 | * SensorValue:poll-interval: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 605 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 606 | * 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] | 607 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 608 | * 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] | 609 | */ |
| 610 | g_object_interface_install_property (iface, |
| 611 | g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 612 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 613 | * SensorValue:heatbeat: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 614 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 615 | * 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] | 616 | * |
| 617 | * 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. |
| 618 | */ |
| 619 | g_object_interface_install_property (iface, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 620 | g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 621 | /** |
| 622 | * SensorValue:settable: |
| 623 | * |
| 624 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. |
| 625 | * |
| 626 | * 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. |
| 627 | */ |
| 628 | g_object_interface_install_property (iface, |
| 629 | g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 630 | } |
| 631 | |
| 632 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 633 | * sensor_value_get_value: (skip) |
| 634 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 635 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 636 | * 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] | 637 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 638 | * Since this D-Bus property is readable, 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] | 639 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 640 | * <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> |
| 641 | * |
| 642 | * 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] | 643 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 644 | GVariant * |
| 645 | sensor_value_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 646 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 647 | return SENSOR_VALUE_GET_IFACE (object)->get_value (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 648 | } |
| 649 | |
| 650 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 651 | * sensor_value_dup_value: (skip) |
| 652 | * @object: A #SensorValue. |
| 653 | * |
| 654 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. |
| 655 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 656 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 657 | * |
| 658 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 659 | */ |
| 660 | GVariant * |
| 661 | sensor_value_dup_value (SensorValue *object) |
| 662 | { |
| 663 | GVariant *value; |
| 664 | g_object_get (G_OBJECT (object), "value", &value, NULL); |
| 665 | return value; |
| 666 | } |
| 667 | |
| 668 | /** |
| 669 | * sensor_value_set_value: (skip) |
| 670 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 671 | * @value: The value to set. |
| 672 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 673 | * 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] | 674 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 675 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 676 | */ |
| 677 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 678 | sensor_value_set_value (SensorValue *object, GVariant *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 679 | { |
| 680 | g_object_set (G_OBJECT (object), "value", value, NULL); |
| 681 | } |
| 682 | |
| 683 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 684 | * sensor_value_get_units: (skip) |
| 685 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 686 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 687 | * 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] | 688 | * |
| 689 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 690 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 691 | * <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] | 692 | * |
| 693 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 694 | */ |
| 695 | const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 696 | sensor_value_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 697 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 698 | return SENSOR_VALUE_GET_IFACE (object)->get_units (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 702 | * sensor_value_dup_units: (skip) |
| 703 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 704 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 705 | * 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] | 706 | * |
| 707 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 708 | * |
| 709 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 710 | */ |
| 711 | gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 712 | sensor_value_dup_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 713 | { |
| 714 | gchar *value; |
| 715 | g_object_get (G_OBJECT (object), "units", &value, NULL); |
| 716 | return value; |
| 717 | } |
| 718 | |
| 719 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 720 | * sensor_value_set_units: (skip) |
| 721 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 722 | * @value: The value to set. |
| 723 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 724 | * 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] | 725 | * |
| 726 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 727 | */ |
| 728 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 729 | sensor_value_set_units (SensorValue *object, const gchar *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 730 | { |
| 731 | g_object_set (G_OBJECT (object), "units", value, NULL); |
| 732 | } |
| 733 | |
| 734 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 735 | * sensor_value_get_poll_interval: (skip) |
| 736 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 737 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 738 | * 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] | 739 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 740 | * 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 | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 741 | * |
| 742 | * Returns: The property value. |
| 743 | */ |
| 744 | gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 745 | sensor_value_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 746 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 747 | return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 748 | } |
| 749 | |
| 750 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 751 | * sensor_value_set_poll_interval: (skip) |
| 752 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 753 | * @value: The value to set. |
| 754 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 755 | * 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] | 756 | * |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 757 | * 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 | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 758 | */ |
| 759 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 760 | sensor_value_set_poll_interval (SensorValue *object, gint value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 761 | { |
| 762 | g_object_set (G_OBJECT (object), "poll-interval", value, NULL); |
| 763 | } |
| 764 | |
| 765 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 766 | * sensor_value_get_heatbeat: (skip) |
| 767 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 768 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 769 | * 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] | 770 | * |
| 771 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 772 | * |
| 773 | * Returns: The property value. |
| 774 | */ |
| 775 | gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 776 | sensor_value_get_heatbeat (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 777 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 778 | return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 782 | * sensor_value_set_heatbeat: (skip) |
| 783 | * @object: A #SensorValue. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 784 | * @value: The value to set. |
| 785 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 786 | * 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] | 787 | * |
| 788 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 789 | */ |
| 790 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 791 | sensor_value_set_heatbeat (SensorValue *object, gint value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 792 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 793 | g_object_set (G_OBJECT (object), "heatbeat", value, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | /** |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 797 | * sensor_value_get_settable: (skip) |
| 798 | * @object: A #SensorValue. |
| 799 | * |
| 800 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. |
| 801 | * |
| 802 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 803 | * |
| 804 | * Returns: The property value. |
| 805 | */ |
| 806 | gboolean |
| 807 | sensor_value_get_settable (SensorValue *object) |
| 808 | { |
| 809 | return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); |
| 810 | } |
| 811 | |
| 812 | /** |
| 813 | * sensor_value_set_settable: (skip) |
| 814 | * @object: A #SensorValue. |
| 815 | * @value: The value to set. |
| 816 | * |
| 817 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. |
| 818 | * |
| 819 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 820 | */ |
| 821 | void |
| 822 | sensor_value_set_settable (SensorValue *object, gboolean value) |
| 823 | { |
| 824 | g_object_set (G_OBJECT (object), "settable", value, NULL); |
| 825 | } |
| 826 | |
| 827 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 828 | * sensor_value_emit_changed: |
| 829 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 830 | * @arg_value: Argument to pass with the signal. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 831 | * @arg_units: Argument to pass with the signal. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 832 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 833 | * 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] | 834 | */ |
| 835 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 836 | sensor_value_emit_changed ( |
| 837 | SensorValue *object, |
| 838 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 839 | const gchar *arg_units) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 840 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 841 | g_signal_emit_by_name (object, "changed", arg_value, arg_units); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 842 | } |
| 843 | |
| 844 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 845 | * sensor_value_emit_heartbeat: |
| 846 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 847 | * @arg_bus_name: Argument to pass with the signal. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 848 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 849 | * 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] | 850 | */ |
| 851 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 852 | sensor_value_emit_heartbeat ( |
| 853 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 854 | const gchar *arg_bus_name) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 855 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 856 | g_signal_emit_by_name (object, "heartbeat", arg_bus_name); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 860 | * sensor_value_call_init: |
| 861 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 862 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 863 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 864 | * @user_data: User data to pass to @callback. |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 865 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 866 | * 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] | 867 | * 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] | 868 | * 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] | 869 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 870 | * 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] | 871 | */ |
| 872 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 873 | sensor_value_call_init ( |
| 874 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 875 | GCancellable *cancellable, |
| 876 | GAsyncReadyCallback callback, |
| 877 | gpointer user_data) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 878 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 879 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 880 | "init", |
| 881 | g_variant_new ("()"), |
| 882 | G_DBUS_CALL_FLAGS_NONE, |
| 883 | -1, |
| 884 | cancellable, |
| 885 | callback, |
| 886 | user_data); |
| 887 | } |
| 888 | |
| 889 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 890 | * sensor_value_call_init_finish: |
| 891 | * @proxy: A #SensorValueProxy. |
| 892 | * @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] | 893 | * @error: Return location for error or %NULL. |
| 894 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 895 | * Finishes an operation started with sensor_value_call_init(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 896 | * |
| 897 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 898 | */ |
| 899 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 900 | sensor_value_call_init_finish ( |
| 901 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 902 | GAsyncResult *res, |
| 903 | GError **error) |
| 904 | { |
| 905 | GVariant *_ret; |
| 906 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 907 | if (_ret == NULL) |
| 908 | goto _out; |
| 909 | g_variant_get (_ret, |
| 910 | "()"); |
| 911 | g_variant_unref (_ret); |
| 912 | _out: |
| 913 | return _ret != NULL; |
| 914 | } |
| 915 | |
| 916 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 917 | * sensor_value_call_init_sync: |
| 918 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 919 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 920 | * @error: Return location for error or %NULL. |
| 921 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 922 | * 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] | 923 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 924 | * See sensor_value_call_init() for the asynchronous version of this method. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 925 | * |
| 926 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 927 | */ |
| 928 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 929 | sensor_value_call_init_sync ( |
| 930 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 931 | GCancellable *cancellable, |
| 932 | GError **error) |
| 933 | { |
| 934 | GVariant *_ret; |
| 935 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 936 | "init", |
| 937 | g_variant_new ("()"), |
| 938 | G_DBUS_CALL_FLAGS_NONE, |
| 939 | -1, |
| 940 | cancellable, |
| 941 | error); |
| 942 | if (_ret == NULL) |
| 943 | goto _out; |
| 944 | g_variant_get (_ret, |
| 945 | "()"); |
| 946 | g_variant_unref (_ret); |
| 947 | _out: |
| 948 | return _ret != NULL; |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 949 | } |
| 950 | |
| 951 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 952 | * sensor_value_call_get_value: |
| 953 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 954 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 955 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 956 | * @user_data: User data to pass to @callback. |
| 957 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 958 | * 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] | 959 | * 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] | 960 | * 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] | 961 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 962 | * 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] | 963 | */ |
| 964 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 965 | sensor_value_call_get_value ( |
| 966 | SensorValue *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 967 | GCancellable *cancellable, |
| 968 | GAsyncReadyCallback callback, |
| 969 | gpointer user_data) |
| 970 | { |
| 971 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 972 | "getValue", |
| 973 | g_variant_new ("()"), |
| 974 | G_DBUS_CALL_FLAGS_NONE, |
| 975 | -1, |
| 976 | cancellable, |
| 977 | callback, |
| 978 | user_data); |
| 979 | } |
| 980 | |
| 981 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 982 | * sensor_value_call_get_value_finish: |
| 983 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 984 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 985 | * @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] | 986 | * @error: Return location for error or %NULL. |
| 987 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 988 | * Finishes an operation started with sensor_value_call_get_value(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 989 | * |
| 990 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 991 | */ |
| 992 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 993 | sensor_value_call_get_value_finish ( |
| 994 | SensorValue *proxy, |
| 995 | GVariant **out_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 996 | GAsyncResult *res, |
| 997 | GError **error) |
| 998 | { |
| 999 | GVariant *_ret; |
| 1000 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1001 | if (_ret == NULL) |
| 1002 | goto _out; |
| 1003 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1004 | "(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1005 | out_value); |
| 1006 | g_variant_unref (_ret); |
| 1007 | _out: |
| 1008 | return _ret != NULL; |
| 1009 | } |
| 1010 | |
| 1011 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1012 | * sensor_value_call_get_value_sync: |
| 1013 | * @proxy: A #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1014 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
| 1015 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1016 | * @error: Return location for error or %NULL. |
| 1017 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1018 | * 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] | 1019 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1020 | * 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] | 1021 | * |
| 1022 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1023 | */ |
| 1024 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1025 | sensor_value_call_get_value_sync ( |
| 1026 | SensorValue *proxy, |
| 1027 | GVariant **out_value, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1028 | GCancellable *cancellable, |
| 1029 | GError **error) |
| 1030 | { |
| 1031 | GVariant *_ret; |
| 1032 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1033 | "getValue", |
| 1034 | g_variant_new ("()"), |
| 1035 | G_DBUS_CALL_FLAGS_NONE, |
| 1036 | -1, |
| 1037 | cancellable, |
| 1038 | error); |
| 1039 | if (_ret == NULL) |
| 1040 | goto _out; |
| 1041 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1042 | "(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1043 | out_value); |
| 1044 | g_variant_unref (_ret); |
| 1045 | _out: |
| 1046 | return _ret != NULL; |
| 1047 | } |
| 1048 | |
| 1049 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1050 | * sensor_value_call_set_value: |
| 1051 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1052 | * @arg_value: Argument to pass with the method invocation. |
| 1053 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1054 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 1055 | * @user_data: User data to pass to @callback. |
| 1056 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1057 | * 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] | 1058 | * 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] | 1059 | * 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] | 1060 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1061 | * 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] | 1062 | */ |
| 1063 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1064 | sensor_value_call_set_value ( |
| 1065 | SensorValue *proxy, |
| 1066 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1067 | GCancellable *cancellable, |
| 1068 | GAsyncReadyCallback callback, |
| 1069 | gpointer user_data) |
| 1070 | { |
| 1071 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 1072 | "setValue", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1073 | g_variant_new ("(@v)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1074 | arg_value), |
| 1075 | G_DBUS_CALL_FLAGS_NONE, |
| 1076 | -1, |
| 1077 | cancellable, |
| 1078 | callback, |
| 1079 | user_data); |
| 1080 | } |
| 1081 | |
| 1082 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1083 | * sensor_value_call_set_value_finish: |
| 1084 | * @proxy: A #SensorValueProxy. |
| 1085 | * @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] | 1086 | * @error: Return location for error or %NULL. |
| 1087 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1088 | * Finishes an operation started with sensor_value_call_set_value(). |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1089 | * |
| 1090 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1091 | */ |
| 1092 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1093 | sensor_value_call_set_value_finish ( |
| 1094 | SensorValue *proxy, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1095 | GAsyncResult *res, |
| 1096 | GError **error) |
| 1097 | { |
| 1098 | GVariant *_ret; |
| 1099 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 1100 | if (_ret == NULL) |
| 1101 | goto _out; |
| 1102 | g_variant_get (_ret, |
| 1103 | "()"); |
| 1104 | g_variant_unref (_ret); |
| 1105 | _out: |
| 1106 | return _ret != NULL; |
| 1107 | } |
| 1108 | |
| 1109 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1110 | * sensor_value_call_set_value_sync: |
| 1111 | * @proxy: A #SensorValueProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1112 | * @arg_value: Argument to pass with the method invocation. |
| 1113 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1114 | * @error: Return location for error or %NULL. |
| 1115 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1116 | * 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] | 1117 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1118 | * 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] | 1119 | * |
| 1120 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 1121 | */ |
| 1122 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1123 | sensor_value_call_set_value_sync ( |
| 1124 | SensorValue *proxy, |
| 1125 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1126 | GCancellable *cancellable, |
| 1127 | GError **error) |
| 1128 | { |
| 1129 | GVariant *_ret; |
| 1130 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 1131 | "setValue", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1132 | g_variant_new ("(@v)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1133 | arg_value), |
| 1134 | G_DBUS_CALL_FLAGS_NONE, |
| 1135 | -1, |
| 1136 | cancellable, |
| 1137 | error); |
| 1138 | if (_ret == NULL) |
| 1139 | goto _out; |
| 1140 | g_variant_get (_ret, |
| 1141 | "()"); |
| 1142 | g_variant_unref (_ret); |
| 1143 | _out: |
| 1144 | return _ret != NULL; |
| 1145 | } |
| 1146 | |
| 1147 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1148 | * sensor_value_complete_init: |
| 1149 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1150 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1151 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1152 | * 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] | 1153 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1154 | * This method will free @invocation, you cannot use it afterwards. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1155 | */ |
| 1156 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1157 | sensor_value_complete_init ( |
| 1158 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1159 | GDBusMethodInvocation *invocation) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1160 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1161 | g_dbus_method_invocation_return_value (invocation, |
| 1162 | g_variant_new ("()")); |
Norman James | e759492 | 2015-08-27 14:25:24 -0500 | [diff] [blame] | 1163 | } |
| 1164 | |
| 1165 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1166 | * sensor_value_complete_get_value: |
| 1167 | * @object: A #SensorValue. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1168 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1169 | * @value: Parameter to return. |
| 1170 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1171 | * 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] | 1172 | * |
| 1173 | * This method will free @invocation, you cannot use it afterwards. |
| 1174 | */ |
| 1175 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1176 | sensor_value_complete_get_value ( |
| 1177 | SensorValue *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1178 | GDBusMethodInvocation *invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1179 | GVariant *value) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1180 | { |
| 1181 | g_dbus_method_invocation_return_value (invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1182 | g_variant_new ("(@v)", |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1183 | value)); |
| 1184 | } |
| 1185 | |
| 1186 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1187 | * sensor_value_complete_set_value: |
| 1188 | * @object: A #SensorValue. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1189 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
| 1190 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1191 | * 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] | 1192 | * |
| 1193 | * This method will free @invocation, you cannot use it afterwards. |
| 1194 | */ |
| 1195 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1196 | sensor_value_complete_set_value ( |
| 1197 | SensorValue *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1198 | GDBusMethodInvocation *invocation) |
| 1199 | { |
| 1200 | g_dbus_method_invocation_return_value (invocation, |
| 1201 | g_variant_new ("()")); |
| 1202 | } |
| 1203 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1204 | /* ------------------------------------------------------------------------ */ |
| 1205 | |
| 1206 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1207 | * SensorValueProxy: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1208 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1209 | * 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] | 1210 | */ |
| 1211 | |
| 1212 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1213 | * SensorValueProxyClass: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1214 | * @parent_class: The parent class. |
| 1215 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1216 | * Class structure for #SensorValueProxy. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1217 | */ |
| 1218 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1219 | struct _SensorValueProxyPrivate |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1220 | { |
| 1221 | GData *qdata; |
| 1222 | }; |
| 1223 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1224 | static void sensor_value_proxy_iface_init (SensorValueIface *iface); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1225 | |
| 1226 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1227 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 1228 | G_ADD_PRIVATE (SensorValueProxy) |
| 1229 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1230 | |
| 1231 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1232 | G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, |
| 1233 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1234 | |
| 1235 | #endif |
| 1236 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1237 | sensor_value_proxy_finalize (GObject *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1238 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1239 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1240 | g_datalist_clear (&proxy->priv->qdata); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1241 | G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1242 | } |
| 1243 | |
| 1244 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1245 | sensor_value_proxy_get_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1246 | guint prop_id, |
| 1247 | GValue *value, |
| 1248 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1249 | { |
| 1250 | const _ExtendedGDBusPropertyInfo *info; |
| 1251 | GVariant *variant; |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1252 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1253 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1254 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1255 | if (info->use_gvariant) |
| 1256 | { |
| 1257 | g_value_set_variant (value, variant); |
| 1258 | } |
| 1259 | else |
| 1260 | { |
| 1261 | if (variant != NULL) |
| 1262 | g_dbus_gvariant_to_gvalue (variant, value); |
| 1263 | } |
| 1264 | if (variant != NULL) |
| 1265 | g_variant_unref (variant); |
| 1266 | } |
| 1267 | |
| 1268 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1269 | sensor_value_proxy_set_property_cb (GDBusProxy *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1270 | GAsyncResult *res, |
| 1271 | gpointer user_data) |
| 1272 | { |
| 1273 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1274 | GError *error; |
| 1275 | GVariant *_ret; |
| 1276 | error = NULL; |
| 1277 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1278 | if (!_ret) |
| 1279 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1280 | 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] | 1281 | info->parent_struct.name, |
| 1282 | error->message, g_quark_to_string (error->domain), error->code); |
| 1283 | g_error_free (error); |
| 1284 | } |
| 1285 | else |
| 1286 | { |
| 1287 | g_variant_unref (_ret); |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1292 | sensor_value_proxy_set_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1293 | guint prop_id, |
| 1294 | const GValue *value, |
| 1295 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1296 | { |
| 1297 | const _ExtendedGDBusPropertyInfo *info; |
| 1298 | GVariant *variant; |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1299 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1300 | info = _sensor_value_property_info_pointers[prop_id - 1]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1301 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1302 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1303 | "org.freedesktop.DBus.Properties.Set", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1304 | g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1305 | G_DBUS_CALL_FLAGS_NONE, |
| 1306 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1307 | NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1308 | g_variant_unref (variant); |
| 1309 | } |
| 1310 | |
| 1311 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1312 | sensor_value_proxy_g_signal (GDBusProxy *proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1313 | const gchar *sender_name G_GNUC_UNUSED, |
| 1314 | const gchar *signal_name, |
| 1315 | GVariant *parameters) |
| 1316 | { |
| 1317 | _ExtendedGDBusSignalInfo *info; |
| 1318 | GVariantIter iter; |
| 1319 | GVariant *child; |
| 1320 | GValue *paramv; |
| 1321 | guint num_params; |
| 1322 | guint n; |
| 1323 | guint signal_id; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1324 | 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] | 1325 | if (info == NULL) |
| 1326 | return; |
| 1327 | num_params = g_variant_n_children (parameters); |
| 1328 | paramv = g_new0 (GValue, num_params + 1); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1329 | g_value_init (¶mv[0], TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1330 | g_value_set_object (¶mv[0], proxy); |
| 1331 | g_variant_iter_init (&iter, parameters); |
| 1332 | n = 1; |
| 1333 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1334 | { |
| 1335 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1336 | if (arg_info->use_gvariant) |
| 1337 | { |
| 1338 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1339 | g_value_set_variant (¶mv[n], child); |
| 1340 | n++; |
| 1341 | } |
| 1342 | else |
| 1343 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1344 | g_variant_unref (child); |
| 1345 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1346 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1347 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1348 | for (n = 0; n < num_params + 1; n++) |
| 1349 | g_value_unset (¶mv[n]); |
| 1350 | g_free (paramv); |
| 1351 | } |
| 1352 | |
| 1353 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1354 | sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1355 | GVariant *changed_properties, |
| 1356 | const gchar *const *invalidated_properties) |
| 1357 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1358 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1359 | guint n; |
| 1360 | const gchar *key; |
| 1361 | GVariantIter *iter; |
| 1362 | _ExtendedGDBusPropertyInfo *info; |
| 1363 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 1364 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1365 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1366 | 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] | 1367 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1368 | if (info != NULL) |
| 1369 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1370 | } |
| 1371 | g_variant_iter_free (iter); |
| 1372 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1373 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1374 | 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] | 1375 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1376 | if (info != NULL) |
| 1377 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1378 | } |
| 1379 | } |
| 1380 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1381 | static GVariant * |
| 1382 | sensor_value_proxy_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1383 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1384 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1385 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1386 | GVariant *value = NULL; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1387 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1388 | value = variant; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1389 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1390 | g_variant_unref (variant); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1391 | return value; |
| 1392 | } |
| 1393 | |
| 1394 | static const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1395 | sensor_value_proxy_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1396 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1397 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1398 | GVariant *variant; |
| 1399 | const gchar *value = NULL; |
| 1400 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); |
| 1401 | if (variant != NULL) |
| 1402 | { |
| 1403 | value = g_variant_get_string (variant, NULL); |
| 1404 | g_variant_unref (variant); |
| 1405 | } |
| 1406 | return value; |
| 1407 | } |
| 1408 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1409 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1410 | sensor_value_proxy_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1411 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1412 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1413 | GVariant *variant; |
| 1414 | gint value = 0; |
| 1415 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); |
| 1416 | if (variant != NULL) |
| 1417 | { |
| 1418 | value = g_variant_get_int32 (variant); |
| 1419 | g_variant_unref (variant); |
| 1420 | } |
| 1421 | return value; |
| 1422 | } |
| 1423 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1424 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1425 | sensor_value_proxy_get_heatbeat (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1426 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1427 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1428 | GVariant *variant; |
| 1429 | gint value = 0; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1430 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 1431 | if (variant != NULL) |
| 1432 | { |
| 1433 | value = g_variant_get_int32 (variant); |
| 1434 | g_variant_unref (variant); |
| 1435 | } |
| 1436 | return value; |
| 1437 | } |
| 1438 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1439 | static gboolean |
| 1440 | sensor_value_proxy_get_settable (SensorValue *object) |
| 1441 | { |
| 1442 | SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); |
| 1443 | GVariant *variant; |
| 1444 | gboolean value = 0; |
| 1445 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); |
| 1446 | if (variant != NULL) |
| 1447 | { |
| 1448 | value = g_variant_get_boolean (variant); |
| 1449 | g_variant_unref (variant); |
| 1450 | } |
| 1451 | return value; |
| 1452 | } |
| 1453 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1454 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1455 | sensor_value_proxy_init (SensorValueProxy *proxy) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1456 | { |
| 1457 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1458 | proxy->priv = sensor_value_proxy_get_instance_private (proxy); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1459 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1460 | 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] | 1461 | #endif |
| 1462 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1463 | 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] | 1464 | } |
| 1465 | |
| 1466 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1467 | sensor_value_proxy_class_init (SensorValueProxyClass *klass) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1468 | { |
| 1469 | GObjectClass *gobject_class; |
| 1470 | GDBusProxyClass *proxy_class; |
| 1471 | |
| 1472 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1473 | gobject_class->finalize = sensor_value_proxy_finalize; |
| 1474 | gobject_class->get_property = sensor_value_proxy_get_property; |
| 1475 | gobject_class->set_property = sensor_value_proxy_set_property; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1476 | |
| 1477 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1478 | proxy_class->g_signal = sensor_value_proxy_g_signal; |
| 1479 | proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1480 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1481 | sensor_value_override_properties (gobject_class, 1); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1482 | |
| 1483 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1484 | g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1485 | #endif |
| 1486 | } |
| 1487 | |
| 1488 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1489 | sensor_value_proxy_iface_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1490 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1491 | iface->get_value = sensor_value_proxy_get_value; |
| 1492 | iface->get_units = sensor_value_proxy_get_units; |
| 1493 | iface->get_poll_interval = sensor_value_proxy_get_poll_interval; |
| 1494 | iface->get_heatbeat = sensor_value_proxy_get_heatbeat; |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1495 | iface->get_settable = sensor_value_proxy_get_settable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1496 | } |
| 1497 | |
| 1498 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1499 | * sensor_value_proxy_new: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1500 | * @connection: A #GDBusConnection. |
| 1501 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1502 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1503 | * @object_path: An object path. |
| 1504 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1505 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1506 | * @user_data: User data to pass to @callback. |
| 1507 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1508 | * 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] | 1509 | * |
| 1510 | * 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] | 1511 | * 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] | 1512 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1513 | * 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] | 1514 | */ |
| 1515 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1516 | sensor_value_proxy_new ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1517 | GDBusConnection *connection, |
| 1518 | GDBusProxyFlags flags, |
| 1519 | const gchar *name, |
| 1520 | const gchar *object_path, |
| 1521 | GCancellable *cancellable, |
| 1522 | GAsyncReadyCallback callback, |
| 1523 | gpointer user_data) |
| 1524 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1525 | 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] | 1526 | } |
| 1527 | |
| 1528 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1529 | * sensor_value_proxy_new_finish: |
| 1530 | * @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] | 1531 | * @error: Return location for error or %NULL |
| 1532 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1533 | * Finishes an operation started with sensor_value_proxy_new(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1534 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1535 | * 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] | 1536 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1537 | SensorValue * |
| 1538 | sensor_value_proxy_new_finish ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1539 | GAsyncResult *res, |
| 1540 | GError **error) |
| 1541 | { |
| 1542 | GObject *ret; |
| 1543 | GObject *source_object; |
| 1544 | source_object = g_async_result_get_source_object (res); |
| 1545 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1546 | g_object_unref (source_object); |
| 1547 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1548 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1549 | else |
| 1550 | return NULL; |
| 1551 | } |
| 1552 | |
| 1553 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1554 | * sensor_value_proxy_new_sync: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1555 | * @connection: A #GDBusConnection. |
| 1556 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1557 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 1558 | * @object_path: An object path. |
| 1559 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1560 | * @error: Return location for error or %NULL |
| 1561 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1562 | * 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] | 1563 | * |
| 1564 | * The calling thread is blocked until a reply is received. |
| 1565 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1566 | * See sensor_value_proxy_new() for the asynchronous version of this constructor. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1567 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1568 | * 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] | 1569 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1570 | SensorValue * |
| 1571 | sensor_value_proxy_new_sync ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1572 | GDBusConnection *connection, |
| 1573 | GDBusProxyFlags flags, |
| 1574 | const gchar *name, |
| 1575 | const gchar *object_path, |
| 1576 | GCancellable *cancellable, |
| 1577 | GError **error) |
| 1578 | { |
| 1579 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1580 | 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] | 1581 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1582 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1583 | else |
| 1584 | return NULL; |
| 1585 | } |
| 1586 | |
| 1587 | |
| 1588 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1589 | * sensor_value_proxy_new_for_bus: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1590 | * @bus_type: A #GBusType. |
| 1591 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1592 | * @name: A bus name (well-known or unique). |
| 1593 | * @object_path: An object path. |
| 1594 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1595 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 1596 | * @user_data: User data to pass to @callback. |
| 1597 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1598 | * 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] | 1599 | * |
| 1600 | * 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] | 1601 | * 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] | 1602 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1603 | * 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] | 1604 | */ |
| 1605 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1606 | sensor_value_proxy_new_for_bus ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1607 | GBusType bus_type, |
| 1608 | GDBusProxyFlags flags, |
| 1609 | const gchar *name, |
| 1610 | const gchar *object_path, |
| 1611 | GCancellable *cancellable, |
| 1612 | GAsyncReadyCallback callback, |
| 1613 | gpointer user_data) |
| 1614 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1615 | 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] | 1616 | } |
| 1617 | |
| 1618 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1619 | * sensor_value_proxy_new_for_bus_finish: |
| 1620 | * @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] | 1621 | * @error: Return location for error or %NULL |
| 1622 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1623 | * Finishes an operation started with sensor_value_proxy_new_for_bus(). |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1624 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1625 | * 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] | 1626 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1627 | SensorValue * |
| 1628 | sensor_value_proxy_new_for_bus_finish ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1629 | GAsyncResult *res, |
| 1630 | GError **error) |
| 1631 | { |
| 1632 | GObject *ret; |
| 1633 | GObject *source_object; |
| 1634 | source_object = g_async_result_get_source_object (res); |
| 1635 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1636 | g_object_unref (source_object); |
| 1637 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1638 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1639 | else |
| 1640 | return NULL; |
| 1641 | } |
| 1642 | |
| 1643 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1644 | * sensor_value_proxy_new_for_bus_sync: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1645 | * @bus_type: A #GBusType. |
| 1646 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 1647 | * @name: A bus name (well-known or unique). |
| 1648 | * @object_path: An object path. |
| 1649 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 1650 | * @error: Return location for error or %NULL |
| 1651 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1652 | * 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] | 1653 | * |
| 1654 | * The calling thread is blocked until a reply is received. |
| 1655 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1656 | * 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] | 1657 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1658 | * 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] | 1659 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1660 | SensorValue * |
| 1661 | sensor_value_proxy_new_for_bus_sync ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1662 | GBusType bus_type, |
| 1663 | GDBusProxyFlags flags, |
| 1664 | const gchar *name, |
| 1665 | const gchar *object_path, |
| 1666 | GCancellable *cancellable, |
| 1667 | GError **error) |
| 1668 | { |
| 1669 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1670 | 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] | 1671 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1672 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1673 | else |
| 1674 | return NULL; |
| 1675 | } |
| 1676 | |
| 1677 | |
| 1678 | /* ------------------------------------------------------------------------ */ |
| 1679 | |
| 1680 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1681 | * SensorValueSkeleton: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1682 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1683 | * 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] | 1684 | */ |
| 1685 | |
| 1686 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1687 | * SensorValueSkeletonClass: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1688 | * @parent_class: The parent class. |
| 1689 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1690 | * Class structure for #SensorValueSkeleton. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1691 | */ |
| 1692 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1693 | struct _SensorValueSkeletonPrivate |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1694 | { |
| 1695 | GValue *properties; |
| 1696 | GList *changed_properties; |
| 1697 | GSource *changed_properties_idle_source; |
| 1698 | GMainContext *context; |
| 1699 | GMutex lock; |
| 1700 | }; |
| 1701 | |
| 1702 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1703 | _sensor_value_skeleton_handle_method_call ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1704 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1705 | const gchar *sender G_GNUC_UNUSED, |
| 1706 | const gchar *object_path G_GNUC_UNUSED, |
| 1707 | const gchar *interface_name, |
| 1708 | const gchar *method_name, |
| 1709 | GVariant *parameters, |
| 1710 | GDBusMethodInvocation *invocation, |
| 1711 | gpointer user_data) |
| 1712 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1713 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1714 | _ExtendedGDBusMethodInfo *info; |
| 1715 | GVariantIter iter; |
| 1716 | GVariant *child; |
| 1717 | GValue *paramv; |
| 1718 | guint num_params; |
| 1719 | guint num_extra; |
| 1720 | guint n; |
| 1721 | guint signal_id; |
| 1722 | GValue return_value = G_VALUE_INIT; |
| 1723 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1724 | g_assert (info != NULL); |
| 1725 | num_params = g_variant_n_children (parameters); |
| 1726 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1727 | n = 0; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1728 | g_value_init (¶mv[n], TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1729 | g_value_set_object (¶mv[n++], skeleton); |
| 1730 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1731 | g_value_set_object (¶mv[n++], invocation); |
| 1732 | if (info->pass_fdlist) |
| 1733 | { |
| 1734 | #ifdef G_OS_UNIX |
| 1735 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1736 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1737 | #else |
| 1738 | g_assert_not_reached (); |
| 1739 | #endif |
| 1740 | } |
| 1741 | g_variant_iter_init (&iter, parameters); |
| 1742 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1743 | { |
| 1744 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1745 | if (arg_info->use_gvariant) |
| 1746 | { |
| 1747 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1748 | g_value_set_variant (¶mv[n], child); |
| 1749 | n++; |
| 1750 | } |
| 1751 | else |
| 1752 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1753 | g_variant_unref (child); |
| 1754 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1755 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1756 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1757 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1758 | if (!g_value_get_boolean (&return_value)) |
| 1759 | 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); |
| 1760 | g_value_unset (&return_value); |
| 1761 | for (n = 0; n < num_params + num_extra; n++) |
| 1762 | g_value_unset (¶mv[n]); |
| 1763 | g_free (paramv); |
| 1764 | } |
| 1765 | |
| 1766 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1767 | _sensor_value_skeleton_handle_get_property ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1768 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1769 | const gchar *sender G_GNUC_UNUSED, |
| 1770 | const gchar *object_path G_GNUC_UNUSED, |
| 1771 | const gchar *interface_name G_GNUC_UNUSED, |
| 1772 | const gchar *property_name, |
| 1773 | GError **error, |
| 1774 | gpointer user_data) |
| 1775 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1776 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1777 | GValue value = G_VALUE_INIT; |
| 1778 | GParamSpec *pspec; |
| 1779 | _ExtendedGDBusPropertyInfo *info; |
| 1780 | GVariant *ret; |
| 1781 | ret = NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1782 | 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] | 1783 | g_assert (info != NULL); |
| 1784 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1785 | if (pspec == NULL) |
| 1786 | { |
| 1787 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1788 | } |
| 1789 | else |
| 1790 | { |
| 1791 | g_value_init (&value, pspec->value_type); |
| 1792 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1793 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1794 | g_value_unset (&value); |
| 1795 | } |
| 1796 | return ret; |
| 1797 | } |
| 1798 | |
| 1799 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1800 | _sensor_value_skeleton_handle_set_property ( |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1801 | GDBusConnection *connection G_GNUC_UNUSED, |
| 1802 | const gchar *sender G_GNUC_UNUSED, |
| 1803 | const gchar *object_path G_GNUC_UNUSED, |
| 1804 | const gchar *interface_name G_GNUC_UNUSED, |
| 1805 | const gchar *property_name, |
| 1806 | GVariant *variant, |
| 1807 | GError **error, |
| 1808 | gpointer user_data) |
| 1809 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1810 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1811 | GValue value = G_VALUE_INIT; |
| 1812 | GParamSpec *pspec; |
| 1813 | _ExtendedGDBusPropertyInfo *info; |
| 1814 | gboolean ret; |
| 1815 | ret = FALSE; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1816 | 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] | 1817 | g_assert (info != NULL); |
| 1818 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1819 | if (pspec == NULL) |
| 1820 | { |
| 1821 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1822 | } |
| 1823 | else |
| 1824 | { |
| 1825 | if (info->use_gvariant) |
| 1826 | g_value_set_variant (&value, variant); |
| 1827 | else |
| 1828 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 1829 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1830 | g_value_unset (&value); |
| 1831 | ret = TRUE; |
| 1832 | } |
| 1833 | return ret; |
| 1834 | } |
| 1835 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1836 | static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1837 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1838 | _sensor_value_skeleton_handle_method_call, |
| 1839 | _sensor_value_skeleton_handle_get_property, |
| 1840 | _sensor_value_skeleton_handle_set_property, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1841 | {NULL} |
| 1842 | }; |
| 1843 | |
| 1844 | static GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1845 | sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1846 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1847 | return sensor_value_interface_info (); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1848 | } |
| 1849 | |
| 1850 | static GDBusInterfaceVTable * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1851 | sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1852 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1853 | return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1854 | } |
| 1855 | |
| 1856 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1857 | sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1858 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1859 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1860 | |
| 1861 | GVariantBuilder builder; |
| 1862 | guint n; |
| 1863 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1864 | if (_sensor_value_interface_info.parent_struct.properties == NULL) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1865 | goto out; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1866 | 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] | 1867 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1868 | GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1869 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1870 | { |
| 1871 | GVariant *value; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1872 | 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] | 1873 | if (value != NULL) |
| 1874 | { |
| 1875 | g_variant_take_ref (value); |
| 1876 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1877 | g_variant_unref (value); |
| 1878 | } |
| 1879 | } |
| 1880 | } |
| 1881 | out: |
| 1882 | return g_variant_builder_end (&builder); |
| 1883 | } |
| 1884 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1885 | static gboolean _sensor_value_emit_changed (gpointer user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1886 | |
| 1887 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1888 | sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1889 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1890 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1891 | gboolean emit_changed = FALSE; |
| 1892 | |
| 1893 | g_mutex_lock (&skeleton->priv->lock); |
| 1894 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1895 | { |
| 1896 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1897 | skeleton->priv->changed_properties_idle_source = NULL; |
| 1898 | emit_changed = TRUE; |
| 1899 | } |
| 1900 | g_mutex_unlock (&skeleton->priv->lock); |
| 1901 | |
| 1902 | if (emit_changed) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1903 | _sensor_value_emit_changed (skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1904 | } |
| 1905 | |
| 1906 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1907 | _sensor_value_on_signal_changed ( |
| 1908 | SensorValue *object, |
| 1909 | GVariant *arg_value, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1910 | const gchar *arg_units) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1911 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1912 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1913 | |
| 1914 | GList *connections, *l; |
| 1915 | GVariant *signal_variant; |
| 1916 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1917 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1918 | signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1919 | arg_value, |
| 1920 | arg_units)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1921 | for (l = connections; l != NULL; l = l->next) |
| 1922 | { |
| 1923 | GDBusConnection *connection = l->data; |
| 1924 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1925 | 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] | 1926 | signal_variant, NULL); |
| 1927 | } |
| 1928 | g_variant_unref (signal_variant); |
| 1929 | g_list_free_full (connections, g_object_unref); |
| 1930 | } |
| 1931 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1932 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1933 | _sensor_value_on_signal_heartbeat ( |
| 1934 | SensorValue *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1935 | const gchar *arg_bus_name) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1936 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1937 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1938 | |
| 1939 | GList *connections, *l; |
| 1940 | GVariant *signal_variant; |
| 1941 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1942 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 1943 | signal_variant = g_variant_ref_sink (g_variant_new ("(s)", |
| 1944 | arg_bus_name)); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 1945 | for (l = connections; l != NULL; l = l->next) |
| 1946 | { |
| 1947 | GDBusConnection *connection = l->data; |
| 1948 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1949 | 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] | 1950 | signal_variant, NULL); |
| 1951 | } |
| 1952 | g_variant_unref (signal_variant); |
| 1953 | g_list_free_full (connections, g_object_unref); |
| 1954 | } |
| 1955 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1956 | static void sensor_value_skeleton_iface_init (SensorValueIface *iface); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1957 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1958 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1959 | G_ADD_PRIVATE (SensorValueSkeleton) |
| 1960 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1961 | |
| 1962 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1963 | G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1964 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1965 | |
| 1966 | #endif |
| 1967 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1968 | sensor_value_skeleton_finalize (GObject *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1969 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1970 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1971 | guint n; |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1972 | for (n = 0; n < 5; n++) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1973 | g_value_unset (&skeleton->priv->properties[n]); |
| 1974 | g_free (skeleton->priv->properties); |
| 1975 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1976 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1977 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1978 | g_main_context_unref (skeleton->priv->context); |
| 1979 | g_mutex_clear (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1980 | G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1981 | } |
| 1982 | |
| 1983 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1984 | sensor_value_skeleton_get_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1985 | guint prop_id, |
| 1986 | GValue *value, |
| 1987 | GParamSpec *pspec G_GNUC_UNUSED) |
| 1988 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1989 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 1990 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1991 | g_mutex_lock (&skeleton->priv->lock); |
| 1992 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1993 | g_mutex_unlock (&skeleton->priv->lock); |
| 1994 | } |
| 1995 | |
| 1996 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1997 | _sensor_value_emit_changed (gpointer user_data) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1998 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 1999 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2000 | GList *l; |
| 2001 | GVariantBuilder builder; |
| 2002 | GVariantBuilder invalidated_builder; |
| 2003 | guint num_changes; |
| 2004 | |
| 2005 | g_mutex_lock (&skeleton->priv->lock); |
| 2006 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 2007 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 2008 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 2009 | { |
| 2010 | ChangedProperty *cp = l->data; |
| 2011 | GVariant *variant; |
| 2012 | const GValue *cur_value; |
| 2013 | |
| 2014 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 2015 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 2016 | { |
| 2017 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 2018 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 2019 | g_variant_unref (variant); |
| 2020 | num_changes++; |
| 2021 | } |
| 2022 | } |
| 2023 | if (num_changes > 0) |
| 2024 | { |
| 2025 | GList *connections, *ll; |
| 2026 | GVariant *signal_variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2027 | 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] | 2028 | &builder, &invalidated_builder)); |
| 2029 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 2030 | for (ll = connections; ll != NULL; ll = ll->next) |
| 2031 | { |
| 2032 | GDBusConnection *connection = ll->data; |
| 2033 | |
| 2034 | g_dbus_connection_emit_signal (connection, |
| 2035 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 2036 | "org.freedesktop.DBus.Properties", |
| 2037 | "PropertiesChanged", |
| 2038 | signal_variant, |
| 2039 | NULL); |
| 2040 | } |
| 2041 | g_variant_unref (signal_variant); |
| 2042 | g_list_free_full (connections, g_object_unref); |
| 2043 | } |
| 2044 | else |
| 2045 | { |
| 2046 | g_variant_builder_clear (&builder); |
| 2047 | g_variant_builder_clear (&invalidated_builder); |
| 2048 | } |
| 2049 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 2050 | skeleton->priv->changed_properties = NULL; |
| 2051 | skeleton->priv->changed_properties_idle_source = NULL; |
| 2052 | g_mutex_unlock (&skeleton->priv->lock); |
| 2053 | return FALSE; |
| 2054 | } |
| 2055 | |
| 2056 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2057 | _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] | 2058 | { |
| 2059 | ChangedProperty *cp; |
| 2060 | GList *l; |
| 2061 | cp = NULL; |
| 2062 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 2063 | { |
| 2064 | ChangedProperty *i_cp = l->data; |
| 2065 | if (i_cp->info == info) |
| 2066 | { |
| 2067 | cp = i_cp; |
| 2068 | break; |
| 2069 | } |
| 2070 | } |
| 2071 | if (cp == NULL) |
| 2072 | { |
| 2073 | cp = g_new0 (ChangedProperty, 1); |
| 2074 | cp->prop_id = prop_id; |
| 2075 | cp->info = info; |
| 2076 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 2077 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 2078 | g_value_copy (orig_value, &cp->orig_value); |
| 2079 | } |
| 2080 | } |
| 2081 | |
| 2082 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2083 | sensor_value_skeleton_notify (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2084 | GParamSpec *pspec G_GNUC_UNUSED) |
| 2085 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2086 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2087 | g_mutex_lock (&skeleton->priv->lock); |
| 2088 | if (skeleton->priv->changed_properties != NULL && |
| 2089 | skeleton->priv->changed_properties_idle_source == NULL) |
| 2090 | { |
| 2091 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 2092 | 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] | 2093 | 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] | 2094 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 2095 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 2096 | } |
| 2097 | g_mutex_unlock (&skeleton->priv->lock); |
| 2098 | } |
| 2099 | |
| 2100 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2101 | sensor_value_skeleton_set_property (GObject *object, |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2102 | guint prop_id, |
| 2103 | const GValue *value, |
| 2104 | GParamSpec *pspec) |
| 2105 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2106 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 2107 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2108 | g_mutex_lock (&skeleton->priv->lock); |
| 2109 | g_object_freeze_notify (object); |
| 2110 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 2111 | { |
| 2112 | 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] | 2113 | _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] | 2114 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 2115 | g_object_notify_by_pspec (object, pspec); |
| 2116 | } |
| 2117 | g_mutex_unlock (&skeleton->priv->lock); |
| 2118 | g_object_thaw_notify (object); |
| 2119 | } |
| 2120 | |
| 2121 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2122 | sensor_value_skeleton_init (SensorValueSkeleton *skeleton) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2123 | { |
| 2124 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2125 | skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2126 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2127 | 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] | 2128 | #endif |
| 2129 | |
| 2130 | g_mutex_init (&skeleton->priv->lock); |
| 2131 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 2132 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2133 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2134 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2135 | g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2136 | g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 2137 | g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2138 | } |
| 2139 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2140 | static GVariant * |
| 2141 | sensor_value_skeleton_get_value (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2142 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2143 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 2144 | GVariant *value; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2145 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2146 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2147 | g_mutex_unlock (&skeleton->priv->lock); |
| 2148 | return value; |
| 2149 | } |
| 2150 | |
| 2151 | static const gchar * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2152 | sensor_value_skeleton_get_units (SensorValue *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2153 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2154 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2155 | const gchar *value; |
| 2156 | g_mutex_lock (&skeleton->priv->lock); |
| 2157 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 2158 | g_mutex_unlock (&skeleton->priv->lock); |
| 2159 | return value; |
| 2160 | } |
| 2161 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2162 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2163 | sensor_value_skeleton_get_poll_interval (SensorValue *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2164 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2165 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2166 | gint value; |
| 2167 | g_mutex_lock (&skeleton->priv->lock); |
| 2168 | value = g_value_get_int (&(skeleton->priv->properties[2])); |
| 2169 | g_mutex_unlock (&skeleton->priv->lock); |
| 2170 | return value; |
| 2171 | } |
| 2172 | |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2173 | static gint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2174 | sensor_value_skeleton_get_heatbeat (SensorValue *object) |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2175 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2176 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
Norman James | 3f97c5d | 2015-08-26 17:44:14 -0500 | [diff] [blame] | 2177 | gint value; |
| 2178 | g_mutex_lock (&skeleton->priv->lock); |
| 2179 | value = g_value_get_int (&(skeleton->priv->properties[3])); |
| 2180 | g_mutex_unlock (&skeleton->priv->lock); |
| 2181 | return value; |
| 2182 | } |
| 2183 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 2184 | static gboolean |
| 2185 | sensor_value_skeleton_get_settable (SensorValue *object) |
| 2186 | { |
| 2187 | SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); |
| 2188 | gboolean value; |
| 2189 | g_mutex_lock (&skeleton->priv->lock); |
| 2190 | value = g_value_get_boolean (&(skeleton->priv->properties[4])); |
| 2191 | g_mutex_unlock (&skeleton->priv->lock); |
| 2192 | return value; |
| 2193 | } |
| 2194 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2195 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2196 | sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2197 | { |
| 2198 | GObjectClass *gobject_class; |
| 2199 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 2200 | |
| 2201 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2202 | gobject_class->finalize = sensor_value_skeleton_finalize; |
| 2203 | gobject_class->get_property = sensor_value_skeleton_get_property; |
| 2204 | gobject_class->set_property = sensor_value_skeleton_set_property; |
| 2205 | gobject_class->notify = sensor_value_skeleton_notify; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2206 | |
| 2207 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2208 | sensor_value_override_properties (gobject_class, 1); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2209 | |
| 2210 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2211 | skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; |
| 2212 | skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; |
| 2213 | skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; |
| 2214 | skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2215 | |
| 2216 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2217 | g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2218 | #endif |
| 2219 | } |
| 2220 | |
| 2221 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2222 | sensor_value_skeleton_iface_init (SensorValueIface *iface) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2223 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2224 | iface->changed = _sensor_value_on_signal_changed; |
| 2225 | iface->heartbeat = _sensor_value_on_signal_heartbeat; |
| 2226 | iface->get_value = sensor_value_skeleton_get_value; |
| 2227 | iface->get_units = sensor_value_skeleton_get_units; |
| 2228 | iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; |
| 2229 | iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 2230 | iface->get_settable = sensor_value_skeleton_get_settable; |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2231 | } |
| 2232 | |
| 2233 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2234 | * sensor_value_skeleton_new: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2235 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2236 | * 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] | 2237 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2238 | * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2239 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2240 | SensorValue * |
| 2241 | sensor_value_skeleton_new (void) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2242 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2243 | return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2244 | } |
| 2245 | |
| 2246 | /* ------------------------------------------------------------------------ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2247 | * Code for interface org.openbmc.SensorThreshold |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2248 | * ------------------------------------------------------------------------ |
| 2249 | */ |
| 2250 | |
| 2251 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2252 | * SECTION:SensorThreshold |
| 2253 | * @title: SensorThreshold |
| 2254 | * @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] | 2255 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2256 | * 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] | 2257 | */ |
| 2258 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2259 | /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 2260 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2261 | static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2262 | { |
| 2263 | { |
| 2264 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2265 | (gchar *) "state", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2266 | (gchar *) "y", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2267 | NULL |
| 2268 | }, |
| 2269 | FALSE |
| 2270 | }; |
| 2271 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2272 | 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] | 2273 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2274 | &_sensor_threshold_method_info_get_state_OUT_ARG_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2275 | NULL |
| 2276 | }; |
| 2277 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2278 | static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2279 | { |
| 2280 | { |
| 2281 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2282 | (gchar *) "getState", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2283 | NULL, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2284 | (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2285 | NULL |
| 2286 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2287 | "handle-get-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2288 | FALSE |
| 2289 | }; |
| 2290 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2291 | static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2292 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2293 | &_sensor_threshold_method_info_get_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2294 | NULL |
| 2295 | }; |
| 2296 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2297 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2298 | { |
| 2299 | { |
| 2300 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2301 | (gchar *) "Warning", |
| 2302 | NULL, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2303 | NULL |
| 2304 | }, |
| 2305 | "warning" |
| 2306 | }; |
| 2307 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2308 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2309 | { |
| 2310 | { |
| 2311 | -1, |
| 2312 | (gchar *) "Critical", |
| 2313 | NULL, |
| 2314 | NULL |
| 2315 | }, |
| 2316 | "critical" |
| 2317 | }; |
| 2318 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2319 | static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2320 | { |
| 2321 | { |
| 2322 | -1, |
| 2323 | (gchar *) "Normal", |
| 2324 | NULL, |
| 2325 | NULL |
| 2326 | }, |
| 2327 | "normal" |
| 2328 | }; |
| 2329 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2330 | static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2331 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2332 | &_sensor_threshold_signal_info_warning, |
| 2333 | &_sensor_threshold_signal_info_critical, |
| 2334 | &_sensor_threshold_signal_info_normal, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2335 | NULL |
| 2336 | }; |
| 2337 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2338 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2339 | { |
| 2340 | { |
| 2341 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2342 | (gchar *) "lower_critical", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2343 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2344 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2345 | NULL |
| 2346 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2347 | "lower-critical", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2348 | FALSE |
| 2349 | }; |
| 2350 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2351 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2352 | { |
| 2353 | { |
| 2354 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2355 | (gchar *) "lower_warning", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2356 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2357 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2358 | NULL |
| 2359 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2360 | "lower-warning", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2361 | FALSE |
| 2362 | }; |
| 2363 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2364 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2365 | { |
| 2366 | { |
| 2367 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2368 | (gchar *) "upper_warning", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2369 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2370 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2371 | NULL |
| 2372 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2373 | "upper-warning", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2374 | FALSE |
| 2375 | }; |
| 2376 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2377 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2378 | { |
| 2379 | { |
| 2380 | -1, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2381 | (gchar *) "upper_critical", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2382 | (gchar *) "v", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2383 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 2384 | NULL |
| 2385 | }, |
| 2386 | "upper-critical", |
| 2387 | FALSE |
| 2388 | }; |
| 2389 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2390 | static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2391 | { |
| 2392 | { |
| 2393 | -1, |
| 2394 | (gchar *) "state", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2395 | (gchar *) "y", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2396 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2397 | NULL |
| 2398 | }, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2399 | "state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2400 | FALSE |
| 2401 | }; |
| 2402 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2403 | static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2404 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2405 | &_sensor_threshold_property_info_lower_critical, |
| 2406 | &_sensor_threshold_property_info_lower_warning, |
| 2407 | &_sensor_threshold_property_info_upper_warning, |
| 2408 | &_sensor_threshold_property_info_upper_critical, |
| 2409 | &_sensor_threshold_property_info_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2410 | NULL |
| 2411 | }; |
| 2412 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2413 | static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2414 | { |
| 2415 | { |
| 2416 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2417 | (gchar *) "org.openbmc.SensorThreshold", |
| 2418 | (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, |
| 2419 | (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, |
| 2420 | (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2421 | NULL |
| 2422 | }, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2423 | "sensor-threshold", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2424 | }; |
| 2425 | |
| 2426 | |
| 2427 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2428 | * sensor_threshold_interface_info: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2429 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2430 | * 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] | 2431 | * |
| 2432 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 2433 | */ |
| 2434 | GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2435 | sensor_threshold_interface_info (void) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2436 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2437 | return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2438 | } |
| 2439 | |
| 2440 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2441 | * sensor_threshold_override_properties: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2442 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 2443 | * @property_id_begin: The property id to assign to the first overridden property. |
| 2444 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2445 | * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2446 | * The properties are overridden in the order they are defined. |
| 2447 | * |
| 2448 | * Returns: The last property id. |
| 2449 | */ |
| 2450 | guint |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2451 | sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2452 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2453 | g_object_class_override_property (klass, property_id_begin++, "lower-critical"); |
| 2454 | g_object_class_override_property (klass, property_id_begin++, "lower-warning"); |
| 2455 | g_object_class_override_property (klass, property_id_begin++, "upper-warning"); |
| 2456 | g_object_class_override_property (klass, property_id_begin++, "upper-critical"); |
| 2457 | g_object_class_override_property (klass, property_id_begin++, "state"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2458 | return property_id_begin - 1; |
| 2459 | } |
| 2460 | |
| 2461 | |
| 2462 | |
| 2463 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2464 | * SensorThreshold: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2465 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2466 | * 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] | 2467 | */ |
| 2468 | |
| 2469 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2470 | * SensorThresholdIface: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2471 | * @parent_iface: The parent interface. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2472 | * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. |
| 2473 | * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. |
| 2474 | * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. |
| 2475 | * @get_state: Getter for the #SensorThreshold:state property. |
| 2476 | * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. |
| 2477 | * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. |
| 2478 | * @critical: Handler for the #SensorThreshold::critical signal. |
| 2479 | * @normal: Handler for the #SensorThreshold::normal signal. |
| 2480 | * @warning: Handler for the #SensorThreshold::warning signal. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2481 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2482 | * 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] | 2483 | */ |
| 2484 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2485 | typedef SensorThresholdIface SensorThresholdInterface; |
| 2486 | G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2487 | |
| 2488 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2489 | sensor_threshold_default_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2490 | { |
| 2491 | /* GObject signals for incoming D-Bus method calls: */ |
| 2492 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2493 | * SensorThreshold::handle-get-state: |
| 2494 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2495 | * @invocation: A #GDBusMethodInvocation. |
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 | * 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] | 2498 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2499 | * 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] | 2500 | * |
| 2501 | * 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] | 2502 | */ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2503 | g_signal_new ("handle-get-state", |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2504 | G_TYPE_FROM_INTERFACE (iface), |
| 2505 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2506 | G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2507 | g_signal_accumulator_true_handled, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2508 | NULL, |
| 2509 | g_cclosure_marshal_generic, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2510 | G_TYPE_BOOLEAN, |
| 2511 | 1, |
| 2512 | G_TYPE_DBUS_METHOD_INVOCATION); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2513 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2514 | /* GObject signals for received D-Bus signals: */ |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2515 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2516 | * SensorThreshold::warning: |
| 2517 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2518 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2519 | * 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] | 2520 | * |
| 2521 | * 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. |
| 2522 | */ |
| 2523 | g_signal_new ("warning", |
| 2524 | G_TYPE_FROM_INTERFACE (iface), |
| 2525 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2526 | G_STRUCT_OFFSET (SensorThresholdIface, warning), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2527 | NULL, |
| 2528 | NULL, |
| 2529 | g_cclosure_marshal_generic, |
| 2530 | G_TYPE_NONE, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2531 | 0); |
| 2532 | |
| 2533 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2534 | * SensorThreshold::critical: |
| 2535 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2536 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2537 | * 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] | 2538 | * |
| 2539 | * 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. |
| 2540 | */ |
| 2541 | g_signal_new ("critical", |
| 2542 | G_TYPE_FROM_INTERFACE (iface), |
| 2543 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2544 | G_STRUCT_OFFSET (SensorThresholdIface, critical), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2545 | NULL, |
| 2546 | NULL, |
| 2547 | g_cclosure_marshal_generic, |
| 2548 | G_TYPE_NONE, |
| 2549 | 0); |
| 2550 | |
| 2551 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2552 | * SensorThreshold::normal: |
| 2553 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2554 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2555 | * 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] | 2556 | * |
| 2557 | * 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. |
| 2558 | */ |
| 2559 | g_signal_new ("normal", |
| 2560 | G_TYPE_FROM_INTERFACE (iface), |
| 2561 | G_SIGNAL_RUN_LAST, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2562 | G_STRUCT_OFFSET (SensorThresholdIface, normal), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2563 | NULL, |
| 2564 | NULL, |
| 2565 | g_cclosure_marshal_generic, |
| 2566 | G_TYPE_NONE, |
| 2567 | 0); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2568 | |
| 2569 | /* GObject properties for D-Bus properties: */ |
| 2570 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2571 | * SensorThreshold:lower-critical: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2572 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2573 | * 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] | 2574 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2575 | * 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] | 2576 | */ |
| 2577 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2578 | 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] | 2579 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2580 | * SensorThreshold:lower-warning: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2581 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2582 | * 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] | 2583 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2584 | * 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] | 2585 | */ |
| 2586 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2587 | 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] | 2588 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2589 | * SensorThreshold:upper-warning: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2590 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2591 | * 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] | 2592 | * |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2593 | * 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] | 2594 | */ |
| 2595 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2596 | 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] | 2597 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2598 | * SensorThreshold:upper-critical: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2599 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2600 | * 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] | 2601 | * |
| 2602 | * 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. |
| 2603 | */ |
| 2604 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2605 | 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] | 2606 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2607 | * SensorThreshold:state: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2608 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2609 | * 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] | 2610 | * |
| 2611 | * 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. |
| 2612 | */ |
| 2613 | g_object_interface_install_property (iface, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2614 | 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] | 2615 | } |
| 2616 | |
| 2617 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2618 | * sensor_threshold_get_lower_critical: (skip) |
| 2619 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2620 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2621 | * 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] | 2622 | * |
| 2623 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2624 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2625 | * <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> |
| 2626 | * |
| 2627 | * 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] | 2628 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2629 | GVariant * |
| 2630 | sensor_threshold_get_lower_critical (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2631 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2632 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2633 | } |
| 2634 | |
| 2635 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2636 | * sensor_threshold_dup_lower_critical: (skip) |
| 2637 | * @object: A #SensorThreshold. |
| 2638 | * |
| 2639 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. |
| 2640 | * |
| 2641 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2642 | * |
| 2643 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2644 | */ |
| 2645 | GVariant * |
| 2646 | sensor_threshold_dup_lower_critical (SensorThreshold *object) |
| 2647 | { |
| 2648 | GVariant *value; |
| 2649 | g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); |
| 2650 | return value; |
| 2651 | } |
| 2652 | |
| 2653 | /** |
| 2654 | * sensor_threshold_set_lower_critical: (skip) |
| 2655 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2656 | * @value: The value to set. |
| 2657 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2658 | * 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] | 2659 | * |
| 2660 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2661 | */ |
| 2662 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2663 | sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2664 | { |
| 2665 | g_object_set (G_OBJECT (object), "lower-critical", value, NULL); |
| 2666 | } |
| 2667 | |
| 2668 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2669 | * sensor_threshold_get_lower_warning: (skip) |
| 2670 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2671 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2672 | * 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] | 2673 | * |
| 2674 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2675 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2676 | * <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> |
| 2677 | * |
| 2678 | * 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] | 2679 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2680 | GVariant * |
| 2681 | sensor_threshold_get_lower_warning (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2682 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2683 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2684 | } |
| 2685 | |
| 2686 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2687 | * sensor_threshold_dup_lower_warning: (skip) |
| 2688 | * @object: A #SensorThreshold. |
| 2689 | * |
| 2690 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. |
| 2691 | * |
| 2692 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2693 | * |
| 2694 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2695 | */ |
| 2696 | GVariant * |
| 2697 | sensor_threshold_dup_lower_warning (SensorThreshold *object) |
| 2698 | { |
| 2699 | GVariant *value; |
| 2700 | g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); |
| 2701 | return value; |
| 2702 | } |
| 2703 | |
| 2704 | /** |
| 2705 | * sensor_threshold_set_lower_warning: (skip) |
| 2706 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2707 | * @value: The value to set. |
| 2708 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2709 | * 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] | 2710 | * |
| 2711 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2712 | */ |
| 2713 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2714 | sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2715 | { |
| 2716 | g_object_set (G_OBJECT (object), "lower-warning", value, NULL); |
| 2717 | } |
| 2718 | |
| 2719 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2720 | * sensor_threshold_get_upper_warning: (skip) |
| 2721 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2722 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2723 | * 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] | 2724 | * |
| 2725 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2726 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2727 | * <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> |
| 2728 | * |
| 2729 | * 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] | 2730 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2731 | GVariant * |
| 2732 | sensor_threshold_get_upper_warning (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2733 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2734 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2735 | } |
| 2736 | |
| 2737 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2738 | * sensor_threshold_dup_upper_warning: (skip) |
| 2739 | * @object: A #SensorThreshold. |
| 2740 | * |
| 2741 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. |
| 2742 | * |
| 2743 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2744 | * |
| 2745 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2746 | */ |
| 2747 | GVariant * |
| 2748 | sensor_threshold_dup_upper_warning (SensorThreshold *object) |
| 2749 | { |
| 2750 | GVariant *value; |
| 2751 | g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); |
| 2752 | return value; |
| 2753 | } |
| 2754 | |
| 2755 | /** |
| 2756 | * sensor_threshold_set_upper_warning: (skip) |
| 2757 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2758 | * @value: The value to set. |
| 2759 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2760 | * 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] | 2761 | * |
| 2762 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2763 | */ |
| 2764 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2765 | sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2766 | { |
| 2767 | g_object_set (G_OBJECT (object), "upper-warning", value, NULL); |
| 2768 | } |
| 2769 | |
| 2770 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2771 | * sensor_threshold_get_upper_critical: (skip) |
| 2772 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2773 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2774 | * 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] | 2775 | * |
| 2776 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2777 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2778 | * <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> |
| 2779 | * |
| 2780 | * 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] | 2781 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2782 | GVariant * |
| 2783 | sensor_threshold_get_upper_critical (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2784 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2785 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2786 | } |
| 2787 | |
| 2788 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2789 | * sensor_threshold_dup_upper_critical: (skip) |
| 2790 | * @object: A #SensorThreshold. |
| 2791 | * |
| 2792 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. |
| 2793 | * |
| 2794 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2795 | * |
| 2796 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 2797 | */ |
| 2798 | GVariant * |
| 2799 | sensor_threshold_dup_upper_critical (SensorThreshold *object) |
| 2800 | { |
| 2801 | GVariant *value; |
| 2802 | g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); |
| 2803 | return value; |
| 2804 | } |
| 2805 | |
| 2806 | /** |
| 2807 | * sensor_threshold_set_upper_critical: (skip) |
| 2808 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2809 | * @value: The value to set. |
| 2810 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2811 | * 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] | 2812 | * |
| 2813 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 2814 | */ |
| 2815 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2816 | sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2817 | { |
| 2818 | g_object_set (G_OBJECT (object), "upper-critical", value, NULL); |
| 2819 | } |
| 2820 | |
| 2821 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2822 | * sensor_threshold_get_state: (skip) |
| 2823 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2824 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2825 | * 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] | 2826 | * |
| 2827 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 2828 | * |
| 2829 | * Returns: The property value. |
| 2830 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2831 | guchar |
| 2832 | sensor_threshold_get_state (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2833 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2834 | return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2835 | } |
| 2836 | |
| 2837 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2838 | * sensor_threshold_set_state: (skip) |
| 2839 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2840 | * @value: The value to set. |
| 2841 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2842 | * 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] | 2843 | * |
| 2844 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 2845 | */ |
| 2846 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2847 | sensor_threshold_set_state (SensorThreshold *object, guchar value) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2848 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2849 | g_object_set (G_OBJECT (object), "state", value, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2850 | } |
| 2851 | |
| 2852 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2853 | * sensor_threshold_emit_warning: |
| 2854 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2855 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2856 | * 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] | 2857 | */ |
| 2858 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2859 | sensor_threshold_emit_warning ( |
| 2860 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2861 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2862 | g_signal_emit_by_name (object, "warning"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2863 | } |
| 2864 | |
| 2865 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2866 | * sensor_threshold_emit_critical: |
| 2867 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2868 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2869 | * 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] | 2870 | */ |
| 2871 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2872 | sensor_threshold_emit_critical ( |
| 2873 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2874 | { |
| 2875 | g_signal_emit_by_name (object, "critical"); |
| 2876 | } |
| 2877 | |
| 2878 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2879 | * sensor_threshold_emit_normal: |
| 2880 | * @object: A #SensorThreshold. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2881 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2882 | * 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] | 2883 | */ |
| 2884 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2885 | sensor_threshold_emit_normal ( |
| 2886 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2887 | { |
| 2888 | g_signal_emit_by_name (object, "normal"); |
| 2889 | } |
| 2890 | |
| 2891 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2892 | * sensor_threshold_call_get_state: |
| 2893 | * @proxy: A #SensorThresholdProxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2894 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2895 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
| 2896 | * @user_data: User data to pass to @callback. |
| 2897 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2898 | * 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] | 2899 | * 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] | 2900 | * 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] | 2901 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2902 | * 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] | 2903 | */ |
| 2904 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2905 | sensor_threshold_call_get_state ( |
| 2906 | SensorThreshold *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2907 | GCancellable *cancellable, |
| 2908 | GAsyncReadyCallback callback, |
| 2909 | gpointer user_data) |
| 2910 | { |
| 2911 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2912 | "getState", |
| 2913 | g_variant_new ("()"), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2914 | G_DBUS_CALL_FLAGS_NONE, |
| 2915 | -1, |
| 2916 | cancellable, |
| 2917 | callback, |
| 2918 | user_data); |
| 2919 | } |
| 2920 | |
| 2921 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2922 | * sensor_threshold_call_get_state_finish: |
| 2923 | * @proxy: A #SensorThresholdProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2924 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2925 | * @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] | 2926 | * @error: Return location for error or %NULL. |
| 2927 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2928 | * Finishes an operation started with sensor_threshold_call_get_state(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2929 | * |
| 2930 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2931 | */ |
| 2932 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2933 | sensor_threshold_call_get_state_finish ( |
| 2934 | SensorThreshold *proxy, |
| 2935 | guchar *out_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2936 | GAsyncResult *res, |
| 2937 | GError **error) |
| 2938 | { |
| 2939 | GVariant *_ret; |
| 2940 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 2941 | if (_ret == NULL) |
| 2942 | goto _out; |
| 2943 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2944 | "(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2945 | out_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2946 | g_variant_unref (_ret); |
| 2947 | _out: |
| 2948 | return _ret != NULL; |
| 2949 | } |
| 2950 | |
| 2951 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2952 | * sensor_threshold_call_get_state_sync: |
| 2953 | * @proxy: A #SensorThresholdProxy. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2954 | * @out_state: (out): Return location for return parameter or %NULL to ignore. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2955 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 2956 | * @error: Return location for error or %NULL. |
| 2957 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2958 | * 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] | 2959 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2960 | * 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] | 2961 | * |
| 2962 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
| 2963 | */ |
| 2964 | gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2965 | sensor_threshold_call_get_state_sync ( |
| 2966 | SensorThreshold *proxy, |
| 2967 | guchar *out_state, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2968 | GCancellable *cancellable, |
| 2969 | GError **error) |
| 2970 | { |
| 2971 | GVariant *_ret; |
| 2972 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2973 | "getState", |
| 2974 | g_variant_new ("()"), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2975 | G_DBUS_CALL_FLAGS_NONE, |
| 2976 | -1, |
| 2977 | cancellable, |
| 2978 | error); |
| 2979 | if (_ret == NULL) |
| 2980 | goto _out; |
| 2981 | g_variant_get (_ret, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2982 | "(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2983 | out_state); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2984 | g_variant_unref (_ret); |
| 2985 | _out: |
| 2986 | return _ret != NULL; |
| 2987 | } |
| 2988 | |
| 2989 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2990 | * sensor_threshold_complete_get_state: |
| 2991 | * @object: A #SensorThreshold. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2992 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 2993 | * @state: Parameter to return. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 2994 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 2995 | * 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] | 2996 | * |
| 2997 | * This method will free @invocation, you cannot use it afterwards. |
| 2998 | */ |
| 2999 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3000 | sensor_threshold_complete_get_state ( |
| 3001 | SensorThreshold *object, |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3002 | GDBusMethodInvocation *invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3003 | guchar state) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3004 | { |
| 3005 | g_dbus_method_invocation_return_value (invocation, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3006 | g_variant_new ("(y)", |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3007 | state)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3008 | } |
| 3009 | |
| 3010 | /* ------------------------------------------------------------------------ */ |
| 3011 | |
| 3012 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3013 | * SensorThresholdProxy: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3014 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3015 | * 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] | 3016 | */ |
| 3017 | |
| 3018 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3019 | * SensorThresholdProxyClass: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3020 | * @parent_class: The parent class. |
| 3021 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3022 | * Class structure for #SensorThresholdProxy. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3023 | */ |
| 3024 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3025 | struct _SensorThresholdProxyPrivate |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3026 | { |
| 3027 | GData *qdata; |
| 3028 | }; |
| 3029 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3030 | static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3031 | |
| 3032 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3033 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 3034 | G_ADD_PRIVATE (SensorThresholdProxy) |
| 3035 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3036 | |
| 3037 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3038 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, |
| 3039 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3040 | |
| 3041 | #endif |
| 3042 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3043 | sensor_threshold_proxy_finalize (GObject *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3044 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3045 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3046 | g_datalist_clear (&proxy->priv->qdata); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3047 | G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3048 | } |
| 3049 | |
| 3050 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3051 | sensor_threshold_proxy_get_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3052 | guint prop_id, |
| 3053 | GValue *value, |
| 3054 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3055 | { |
| 3056 | const _ExtendedGDBusPropertyInfo *info; |
| 3057 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3058 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3059 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3060 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3061 | if (info->use_gvariant) |
| 3062 | { |
| 3063 | g_value_set_variant (value, variant); |
| 3064 | } |
| 3065 | else |
| 3066 | { |
| 3067 | if (variant != NULL) |
| 3068 | g_dbus_gvariant_to_gvalue (variant, value); |
| 3069 | } |
| 3070 | if (variant != NULL) |
| 3071 | g_variant_unref (variant); |
| 3072 | } |
| 3073 | |
| 3074 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3075 | sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3076 | GAsyncResult *res, |
| 3077 | gpointer user_data) |
| 3078 | { |
| 3079 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 3080 | GError *error; |
| 3081 | GVariant *_ret; |
| 3082 | error = NULL; |
| 3083 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 3084 | if (!_ret) |
| 3085 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3086 | 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] | 3087 | info->parent_struct.name, |
| 3088 | error->message, g_quark_to_string (error->domain), error->code); |
| 3089 | g_error_free (error); |
| 3090 | } |
| 3091 | else |
| 3092 | { |
| 3093 | g_variant_unref (_ret); |
| 3094 | } |
| 3095 | } |
| 3096 | |
| 3097 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3098 | sensor_threshold_proxy_set_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3099 | guint prop_id, |
| 3100 | const GValue *value, |
| 3101 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3102 | { |
| 3103 | const _ExtendedGDBusPropertyInfo *info; |
| 3104 | GVariant *variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3105 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3106 | info = _sensor_threshold_property_info_pointers[prop_id - 1]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3107 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3108 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 3109 | "org.freedesktop.DBus.Properties.Set", |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3110 | g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3111 | G_DBUS_CALL_FLAGS_NONE, |
| 3112 | -1, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3113 | NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3114 | g_variant_unref (variant); |
| 3115 | } |
| 3116 | |
| 3117 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3118 | sensor_threshold_proxy_g_signal (GDBusProxy *proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3119 | const gchar *sender_name G_GNUC_UNUSED, |
| 3120 | const gchar *signal_name, |
| 3121 | GVariant *parameters) |
| 3122 | { |
| 3123 | _ExtendedGDBusSignalInfo *info; |
| 3124 | GVariantIter iter; |
| 3125 | GVariant *child; |
| 3126 | GValue *paramv; |
| 3127 | guint num_params; |
| 3128 | guint n; |
| 3129 | guint signal_id; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3130 | 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] | 3131 | if (info == NULL) |
| 3132 | return; |
| 3133 | num_params = g_variant_n_children (parameters); |
| 3134 | paramv = g_new0 (GValue, num_params + 1); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3135 | g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3136 | g_value_set_object (¶mv[0], proxy); |
| 3137 | g_variant_iter_init (&iter, parameters); |
| 3138 | n = 1; |
| 3139 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3140 | { |
| 3141 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 3142 | if (arg_info->use_gvariant) |
| 3143 | { |
| 3144 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3145 | g_value_set_variant (¶mv[n], child); |
| 3146 | n++; |
| 3147 | } |
| 3148 | else |
| 3149 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3150 | g_variant_unref (child); |
| 3151 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3152 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3153 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 3154 | for (n = 0; n < num_params + 1; n++) |
| 3155 | g_value_unset (¶mv[n]); |
| 3156 | g_free (paramv); |
| 3157 | } |
| 3158 | |
| 3159 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3160 | sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3161 | GVariant *changed_properties, |
| 3162 | const gchar *const *invalidated_properties) |
| 3163 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3164 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3165 | guint n; |
| 3166 | const gchar *key; |
| 3167 | GVariantIter *iter; |
| 3168 | _ExtendedGDBusPropertyInfo *info; |
| 3169 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 3170 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 3171 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3172 | 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] | 3173 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 3174 | if (info != NULL) |
| 3175 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3176 | } |
| 3177 | g_variant_iter_free (iter); |
| 3178 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 3179 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3180 | 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] | 3181 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 3182 | if (info != NULL) |
| 3183 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3184 | } |
| 3185 | } |
| 3186 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3187 | static GVariant * |
| 3188 | sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3189 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3190 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3191 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3192 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3193 | 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] | 3194 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3195 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3196 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3197 | return value; |
| 3198 | } |
| 3199 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3200 | static GVariant * |
| 3201 | sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3202 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3203 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3204 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3205 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3206 | 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] | 3207 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3208 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3209 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3210 | return value; |
| 3211 | } |
| 3212 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3213 | static GVariant * |
| 3214 | sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3215 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3216 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3217 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3218 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3219 | 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] | 3220 | value = variant; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3221 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3222 | g_variant_unref (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3223 | return value; |
| 3224 | } |
| 3225 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3226 | static GVariant * |
| 3227 | sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3228 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3229 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3230 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3231 | GVariant *value = NULL; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3232 | 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] | 3233 | value = variant; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3234 | if (variant != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3235 | g_variant_unref (variant); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3236 | return value; |
| 3237 | } |
| 3238 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3239 | static guchar |
| 3240 | sensor_threshold_proxy_get_state (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3241 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3242 | SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3243 | GVariant *variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3244 | guchar value = 0; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3245 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3246 | if (variant != NULL) |
| 3247 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3248 | value = g_variant_get_byte (variant); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3249 | g_variant_unref (variant); |
| 3250 | } |
| 3251 | return value; |
| 3252 | } |
| 3253 | |
| 3254 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3255 | sensor_threshold_proxy_init (SensorThresholdProxy *proxy) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3256 | { |
| 3257 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3258 | proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3259 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3260 | 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] | 3261 | #endif |
| 3262 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3263 | 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] | 3264 | } |
| 3265 | |
| 3266 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3267 | sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3268 | { |
| 3269 | GObjectClass *gobject_class; |
| 3270 | GDBusProxyClass *proxy_class; |
| 3271 | |
| 3272 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3273 | gobject_class->finalize = sensor_threshold_proxy_finalize; |
| 3274 | gobject_class->get_property = sensor_threshold_proxy_get_property; |
| 3275 | gobject_class->set_property = sensor_threshold_proxy_set_property; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3276 | |
| 3277 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3278 | proxy_class->g_signal = sensor_threshold_proxy_g_signal; |
| 3279 | proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3280 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3281 | sensor_threshold_override_properties (gobject_class, 1); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3282 | |
| 3283 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3284 | g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3285 | #endif |
| 3286 | } |
| 3287 | |
| 3288 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3289 | sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3290 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3291 | iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; |
| 3292 | iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; |
| 3293 | iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; |
| 3294 | iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; |
| 3295 | iface->get_state = sensor_threshold_proxy_get_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3296 | } |
| 3297 | |
| 3298 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3299 | * sensor_threshold_proxy_new: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3300 | * @connection: A #GDBusConnection. |
| 3301 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3302 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3303 | * @object_path: An object path. |
| 3304 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3305 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3306 | * @user_data: User data to pass to @callback. |
| 3307 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3308 | * 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] | 3309 | * |
| 3310 | * 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] | 3311 | * 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] | 3312 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3313 | * 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] | 3314 | */ |
| 3315 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3316 | sensor_threshold_proxy_new ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3317 | GDBusConnection *connection, |
| 3318 | GDBusProxyFlags flags, |
| 3319 | const gchar *name, |
| 3320 | const gchar *object_path, |
| 3321 | GCancellable *cancellable, |
| 3322 | GAsyncReadyCallback callback, |
| 3323 | gpointer user_data) |
| 3324 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3325 | 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] | 3326 | } |
| 3327 | |
| 3328 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3329 | * sensor_threshold_proxy_new_finish: |
| 3330 | * @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] | 3331 | * @error: Return location for error or %NULL |
| 3332 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3333 | * Finishes an operation started with sensor_threshold_proxy_new(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3334 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3335 | * 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] | 3336 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3337 | SensorThreshold * |
| 3338 | sensor_threshold_proxy_new_finish ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3339 | GAsyncResult *res, |
| 3340 | GError **error) |
| 3341 | { |
| 3342 | GObject *ret; |
| 3343 | GObject *source_object; |
| 3344 | source_object = g_async_result_get_source_object (res); |
| 3345 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3346 | g_object_unref (source_object); |
| 3347 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3348 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3349 | else |
| 3350 | return NULL; |
| 3351 | } |
| 3352 | |
| 3353 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3354 | * sensor_threshold_proxy_new_sync: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3355 | * @connection: A #GDBusConnection. |
| 3356 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3357 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 3358 | * @object_path: An object path. |
| 3359 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3360 | * @error: Return location for error or %NULL |
| 3361 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3362 | * 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] | 3363 | * |
| 3364 | * The calling thread is blocked until a reply is received. |
| 3365 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3366 | * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3367 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3368 | * 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] | 3369 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3370 | SensorThreshold * |
| 3371 | sensor_threshold_proxy_new_sync ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3372 | GDBusConnection *connection, |
| 3373 | GDBusProxyFlags flags, |
| 3374 | const gchar *name, |
| 3375 | const gchar *object_path, |
| 3376 | GCancellable *cancellable, |
| 3377 | GError **error) |
| 3378 | { |
| 3379 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3380 | 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] | 3381 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3382 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3383 | else |
| 3384 | return NULL; |
| 3385 | } |
| 3386 | |
| 3387 | |
| 3388 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3389 | * sensor_threshold_proxy_new_for_bus: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3390 | * @bus_type: A #GBusType. |
| 3391 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3392 | * @name: A bus name (well-known or unique). |
| 3393 | * @object_path: An object path. |
| 3394 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3395 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 3396 | * @user_data: User data to pass to @callback. |
| 3397 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3398 | * 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] | 3399 | * |
| 3400 | * 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] | 3401 | * 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] | 3402 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3403 | * 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] | 3404 | */ |
| 3405 | void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3406 | sensor_threshold_proxy_new_for_bus ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3407 | GBusType bus_type, |
| 3408 | GDBusProxyFlags flags, |
| 3409 | const gchar *name, |
| 3410 | const gchar *object_path, |
| 3411 | GCancellable *cancellable, |
| 3412 | GAsyncReadyCallback callback, |
| 3413 | gpointer user_data) |
| 3414 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3415 | 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] | 3416 | } |
| 3417 | |
| 3418 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3419 | * sensor_threshold_proxy_new_for_bus_finish: |
| 3420 | * @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] | 3421 | * @error: Return location for error or %NULL |
| 3422 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3423 | * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3424 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3425 | * 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] | 3426 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3427 | SensorThreshold * |
| 3428 | sensor_threshold_proxy_new_for_bus_finish ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3429 | GAsyncResult *res, |
| 3430 | GError **error) |
| 3431 | { |
| 3432 | GObject *ret; |
| 3433 | GObject *source_object; |
| 3434 | source_object = g_async_result_get_source_object (res); |
| 3435 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3436 | g_object_unref (source_object); |
| 3437 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3438 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3439 | else |
| 3440 | return NULL; |
| 3441 | } |
| 3442 | |
| 3443 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3444 | * sensor_threshold_proxy_new_for_bus_sync: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3445 | * @bus_type: A #GBusType. |
| 3446 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 3447 | * @name: A bus name (well-known or unique). |
| 3448 | * @object_path: An object path. |
| 3449 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 3450 | * @error: Return location for error or %NULL |
| 3451 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3452 | * 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] | 3453 | * |
| 3454 | * The calling thread is blocked until a reply is received. |
| 3455 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3456 | * 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] | 3457 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3458 | * 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] | 3459 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3460 | SensorThreshold * |
| 3461 | sensor_threshold_proxy_new_for_bus_sync ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3462 | GBusType bus_type, |
| 3463 | GDBusProxyFlags flags, |
| 3464 | const gchar *name, |
| 3465 | const gchar *object_path, |
| 3466 | GCancellable *cancellable, |
| 3467 | GError **error) |
| 3468 | { |
| 3469 | GInitable *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3470 | 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] | 3471 | if (ret != NULL) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3472 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3473 | else |
| 3474 | return NULL; |
| 3475 | } |
| 3476 | |
| 3477 | |
| 3478 | /* ------------------------------------------------------------------------ */ |
| 3479 | |
| 3480 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3481 | * SensorThresholdSkeleton: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3482 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3483 | * 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] | 3484 | */ |
| 3485 | |
| 3486 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3487 | * SensorThresholdSkeletonClass: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3488 | * @parent_class: The parent class. |
| 3489 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3490 | * Class structure for #SensorThresholdSkeleton. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3491 | */ |
| 3492 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3493 | struct _SensorThresholdSkeletonPrivate |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3494 | { |
| 3495 | GValue *properties; |
| 3496 | GList *changed_properties; |
| 3497 | GSource *changed_properties_idle_source; |
| 3498 | GMainContext *context; |
| 3499 | GMutex lock; |
| 3500 | }; |
| 3501 | |
| 3502 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3503 | _sensor_threshold_skeleton_handle_method_call ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3504 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3505 | const gchar *sender G_GNUC_UNUSED, |
| 3506 | const gchar *object_path G_GNUC_UNUSED, |
| 3507 | const gchar *interface_name, |
| 3508 | const gchar *method_name, |
| 3509 | GVariant *parameters, |
| 3510 | GDBusMethodInvocation *invocation, |
| 3511 | gpointer user_data) |
| 3512 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3513 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3514 | _ExtendedGDBusMethodInfo *info; |
| 3515 | GVariantIter iter; |
| 3516 | GVariant *child; |
| 3517 | GValue *paramv; |
| 3518 | guint num_params; |
| 3519 | guint num_extra; |
| 3520 | guint n; |
| 3521 | guint signal_id; |
| 3522 | GValue return_value = G_VALUE_INIT; |
| 3523 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 3524 | g_assert (info != NULL); |
| 3525 | num_params = g_variant_n_children (parameters); |
| 3526 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 3527 | n = 0; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3528 | g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3529 | g_value_set_object (¶mv[n++], skeleton); |
| 3530 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 3531 | g_value_set_object (¶mv[n++], invocation); |
| 3532 | if (info->pass_fdlist) |
| 3533 | { |
| 3534 | #ifdef G_OS_UNIX |
| 3535 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 3536 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 3537 | #else |
| 3538 | g_assert_not_reached (); |
| 3539 | #endif |
| 3540 | } |
| 3541 | g_variant_iter_init (&iter, parameters); |
| 3542 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3543 | { |
| 3544 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 3545 | if (arg_info->use_gvariant) |
| 3546 | { |
| 3547 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3548 | g_value_set_variant (¶mv[n], child); |
| 3549 | n++; |
| 3550 | } |
| 3551 | else |
| 3552 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3553 | g_variant_unref (child); |
| 3554 | } |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3555 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3556 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 3557 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 3558 | if (!g_value_get_boolean (&return_value)) |
| 3559 | 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); |
| 3560 | g_value_unset (&return_value); |
| 3561 | for (n = 0; n < num_params + num_extra; n++) |
| 3562 | g_value_unset (¶mv[n]); |
| 3563 | g_free (paramv); |
| 3564 | } |
| 3565 | |
| 3566 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3567 | _sensor_threshold_skeleton_handle_get_property ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3568 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3569 | const gchar *sender G_GNUC_UNUSED, |
| 3570 | const gchar *object_path G_GNUC_UNUSED, |
| 3571 | const gchar *interface_name G_GNUC_UNUSED, |
| 3572 | const gchar *property_name, |
| 3573 | GError **error, |
| 3574 | gpointer user_data) |
| 3575 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3576 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3577 | GValue value = G_VALUE_INIT; |
| 3578 | GParamSpec *pspec; |
| 3579 | _ExtendedGDBusPropertyInfo *info; |
| 3580 | GVariant *ret; |
| 3581 | ret = NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3582 | 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] | 3583 | g_assert (info != NULL); |
| 3584 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3585 | if (pspec == NULL) |
| 3586 | { |
| 3587 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3588 | } |
| 3589 | else |
| 3590 | { |
| 3591 | g_value_init (&value, pspec->value_type); |
| 3592 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3593 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3594 | g_value_unset (&value); |
| 3595 | } |
| 3596 | return ret; |
| 3597 | } |
| 3598 | |
| 3599 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3600 | _sensor_threshold_skeleton_handle_set_property ( |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3601 | GDBusConnection *connection G_GNUC_UNUSED, |
| 3602 | const gchar *sender G_GNUC_UNUSED, |
| 3603 | const gchar *object_path G_GNUC_UNUSED, |
| 3604 | const gchar *interface_name G_GNUC_UNUSED, |
| 3605 | const gchar *property_name, |
| 3606 | GVariant *variant, |
| 3607 | GError **error, |
| 3608 | gpointer user_data) |
| 3609 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3610 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3611 | GValue value = G_VALUE_INIT; |
| 3612 | GParamSpec *pspec; |
| 3613 | _ExtendedGDBusPropertyInfo *info; |
| 3614 | gboolean ret; |
| 3615 | ret = FALSE; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3616 | 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] | 3617 | g_assert (info != NULL); |
| 3618 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3619 | if (pspec == NULL) |
| 3620 | { |
| 3621 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3622 | } |
| 3623 | else |
| 3624 | { |
| 3625 | if (info->use_gvariant) |
| 3626 | g_value_set_variant (&value, variant); |
| 3627 | else |
| 3628 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 3629 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3630 | g_value_unset (&value); |
| 3631 | ret = TRUE; |
| 3632 | } |
| 3633 | return ret; |
| 3634 | } |
| 3635 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3636 | static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3637 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3638 | _sensor_threshold_skeleton_handle_method_call, |
| 3639 | _sensor_threshold_skeleton_handle_get_property, |
| 3640 | _sensor_threshold_skeleton_handle_set_property, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3641 | {NULL} |
| 3642 | }; |
| 3643 | |
| 3644 | static GDBusInterfaceInfo * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3645 | sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
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 | return sensor_threshold_interface_info (); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3648 | } |
| 3649 | |
| 3650 | static GDBusInterfaceVTable * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3651 | sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3652 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3653 | return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3654 | } |
| 3655 | |
| 3656 | static GVariant * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3657 | sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3658 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3659 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3660 | |
| 3661 | GVariantBuilder builder; |
| 3662 | guint n; |
| 3663 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3664 | if (_sensor_threshold_interface_info.parent_struct.properties == NULL) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3665 | goto out; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3666 | 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] | 3667 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3668 | GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3669 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3670 | { |
| 3671 | GVariant *value; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3672 | 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] | 3673 | if (value != NULL) |
| 3674 | { |
| 3675 | g_variant_take_ref (value); |
| 3676 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3677 | g_variant_unref (value); |
| 3678 | } |
| 3679 | } |
| 3680 | } |
| 3681 | out: |
| 3682 | return g_variant_builder_end (&builder); |
| 3683 | } |
| 3684 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3685 | static gboolean _sensor_threshold_emit_changed (gpointer user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3686 | |
| 3687 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3688 | sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3689 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3690 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3691 | gboolean emit_changed = FALSE; |
| 3692 | |
| 3693 | g_mutex_lock (&skeleton->priv->lock); |
| 3694 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3695 | { |
| 3696 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3697 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3698 | emit_changed = TRUE; |
| 3699 | } |
| 3700 | g_mutex_unlock (&skeleton->priv->lock); |
| 3701 | |
| 3702 | if (emit_changed) |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3703 | _sensor_threshold_emit_changed (skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3704 | } |
| 3705 | |
| 3706 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3707 | _sensor_threshold_on_signal_warning ( |
| 3708 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3709 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3710 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3711 | |
| 3712 | GList *connections, *l; |
| 3713 | GVariant *signal_variant; |
| 3714 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3715 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3716 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3717 | for (l = connections; l != NULL; l = l->next) |
| 3718 | { |
| 3719 | GDBusConnection *connection = l->data; |
| 3720 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3721 | 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] | 3722 | signal_variant, NULL); |
| 3723 | } |
| 3724 | g_variant_unref (signal_variant); |
| 3725 | g_list_free_full (connections, g_object_unref); |
| 3726 | } |
| 3727 | |
| 3728 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3729 | _sensor_threshold_on_signal_critical ( |
| 3730 | SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3731 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3732 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3733 | |
| 3734 | GList *connections, *l; |
| 3735 | GVariant *signal_variant; |
| 3736 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3737 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3738 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3739 | for (l = connections; l != NULL; l = l->next) |
| 3740 | { |
| 3741 | GDBusConnection *connection = l->data; |
| 3742 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3743 | 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] | 3744 | signal_variant, NULL); |
| 3745 | } |
| 3746 | g_variant_unref (signal_variant); |
| 3747 | g_list_free_full (connections, g_object_unref); |
| 3748 | } |
| 3749 | |
| 3750 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3751 | _sensor_threshold_on_signal_normal ( |
| 3752 | SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3753 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3754 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3755 | |
| 3756 | GList *connections, *l; |
| 3757 | GVariant *signal_variant; |
| 3758 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3759 | |
| 3760 | signal_variant = g_variant_ref_sink (g_variant_new ("()")); |
| 3761 | for (l = connections; l != NULL; l = l->next) |
| 3762 | { |
| 3763 | GDBusConnection *connection = l->data; |
| 3764 | g_dbus_connection_emit_signal (connection, |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3765 | 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] | 3766 | signal_variant, NULL); |
| 3767 | } |
| 3768 | g_variant_unref (signal_variant); |
| 3769 | g_list_free_full (connections, g_object_unref); |
| 3770 | } |
| 3771 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3772 | static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3773 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3774 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3775 | G_ADD_PRIVATE (SensorThresholdSkeleton) |
| 3776 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3777 | |
| 3778 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3779 | G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3780 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3781 | |
| 3782 | #endif |
| 3783 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3784 | sensor_threshold_skeleton_finalize (GObject *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3785 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3786 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3787 | guint n; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3788 | for (n = 0; n < 5; n++) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3789 | g_value_unset (&skeleton->priv->properties[n]); |
| 3790 | g_free (skeleton->priv->properties); |
| 3791 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3792 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3793 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3794 | g_main_context_unref (skeleton->priv->context); |
| 3795 | g_mutex_clear (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3796 | G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3797 | } |
| 3798 | |
| 3799 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3800 | sensor_threshold_skeleton_get_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3801 | guint prop_id, |
| 3802 | GValue *value, |
| 3803 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3804 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3805 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3806 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3807 | g_mutex_lock (&skeleton->priv->lock); |
| 3808 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 3809 | g_mutex_unlock (&skeleton->priv->lock); |
| 3810 | } |
| 3811 | |
| 3812 | static gboolean |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3813 | _sensor_threshold_emit_changed (gpointer user_data) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3814 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3815 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3816 | GList *l; |
| 3817 | GVariantBuilder builder; |
| 3818 | GVariantBuilder invalidated_builder; |
| 3819 | guint num_changes; |
| 3820 | |
| 3821 | g_mutex_lock (&skeleton->priv->lock); |
| 3822 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3823 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 3824 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 3825 | { |
| 3826 | ChangedProperty *cp = l->data; |
| 3827 | GVariant *variant; |
| 3828 | const GValue *cur_value; |
| 3829 | |
| 3830 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 3831 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 3832 | { |
| 3833 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 3834 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 3835 | g_variant_unref (variant); |
| 3836 | num_changes++; |
| 3837 | } |
| 3838 | } |
| 3839 | if (num_changes > 0) |
| 3840 | { |
| 3841 | GList *connections, *ll; |
| 3842 | GVariant *signal_variant; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3843 | 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] | 3844 | &builder, &invalidated_builder)); |
| 3845 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3846 | for (ll = connections; ll != NULL; ll = ll->next) |
| 3847 | { |
| 3848 | GDBusConnection *connection = ll->data; |
| 3849 | |
| 3850 | g_dbus_connection_emit_signal (connection, |
| 3851 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 3852 | "org.freedesktop.DBus.Properties", |
| 3853 | "PropertiesChanged", |
| 3854 | signal_variant, |
| 3855 | NULL); |
| 3856 | } |
| 3857 | g_variant_unref (signal_variant); |
| 3858 | g_list_free_full (connections, g_object_unref); |
| 3859 | } |
| 3860 | else |
| 3861 | { |
| 3862 | g_variant_builder_clear (&builder); |
| 3863 | g_variant_builder_clear (&invalidated_builder); |
| 3864 | } |
| 3865 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 3866 | skeleton->priv->changed_properties = NULL; |
| 3867 | skeleton->priv->changed_properties_idle_source = NULL; |
| 3868 | g_mutex_unlock (&skeleton->priv->lock); |
| 3869 | return FALSE; |
| 3870 | } |
| 3871 | |
| 3872 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3873 | _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] | 3874 | { |
| 3875 | ChangedProperty *cp; |
| 3876 | GList *l; |
| 3877 | cp = NULL; |
| 3878 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 3879 | { |
| 3880 | ChangedProperty *i_cp = l->data; |
| 3881 | if (i_cp->info == info) |
| 3882 | { |
| 3883 | cp = i_cp; |
| 3884 | break; |
| 3885 | } |
| 3886 | } |
| 3887 | if (cp == NULL) |
| 3888 | { |
| 3889 | cp = g_new0 (ChangedProperty, 1); |
| 3890 | cp->prop_id = prop_id; |
| 3891 | cp->info = info; |
| 3892 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 3893 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 3894 | g_value_copy (orig_value, &cp->orig_value); |
| 3895 | } |
| 3896 | } |
| 3897 | |
| 3898 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3899 | sensor_threshold_skeleton_notify (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3900 | GParamSpec *pspec G_GNUC_UNUSED) |
| 3901 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3902 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3903 | g_mutex_lock (&skeleton->priv->lock); |
| 3904 | if (skeleton->priv->changed_properties != NULL && |
| 3905 | skeleton->priv->changed_properties_idle_source == NULL) |
| 3906 | { |
| 3907 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 3908 | 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] | 3909 | 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] | 3910 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 3911 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 3912 | } |
| 3913 | g_mutex_unlock (&skeleton->priv->lock); |
| 3914 | } |
| 3915 | |
| 3916 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3917 | sensor_threshold_skeleton_set_property (GObject *object, |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3918 | guint prop_id, |
| 3919 | const GValue *value, |
| 3920 | GParamSpec *pspec) |
| 3921 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3922 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3923 | g_assert (prop_id != 0 && prop_id - 1 < 5); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3924 | g_mutex_lock (&skeleton->priv->lock); |
| 3925 | g_object_freeze_notify (object); |
| 3926 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 3927 | { |
| 3928 | 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] | 3929 | _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] | 3930 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 3931 | g_object_notify_by_pspec (object, pspec); |
| 3932 | } |
| 3933 | g_mutex_unlock (&skeleton->priv->lock); |
| 3934 | g_object_thaw_notify (object); |
| 3935 | } |
| 3936 | |
| 3937 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3938 | sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3939 | { |
| 3940 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3941 | skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3942 | #else |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3943 | 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] | 3944 | #endif |
| 3945 | |
| 3946 | g_mutex_init (&skeleton->priv->lock); |
| 3947 | skeleton->priv->context = g_main_context_ref_thread_default (); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 3948 | skeleton->priv->properties = g_new0 (GValue, 5); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3949 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 3950 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
| 3951 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
| 3952 | g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); |
| 3953 | g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3954 | } |
| 3955 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3956 | static GVariant * |
| 3957 | sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3958 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3959 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3960 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3961 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3962 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3963 | g_mutex_unlock (&skeleton->priv->lock); |
| 3964 | return value; |
| 3965 | } |
| 3966 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3967 | static GVariant * |
| 3968 | sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) |
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 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3971 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3972 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3973 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3974 | g_mutex_unlock (&skeleton->priv->lock); |
| 3975 | return value; |
| 3976 | } |
| 3977 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3978 | static GVariant * |
| 3979 | sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3980 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3981 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3982 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3983 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3984 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3985 | g_mutex_unlock (&skeleton->priv->lock); |
| 3986 | return value; |
| 3987 | } |
| 3988 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3989 | static GVariant * |
| 3990 | sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3991 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3992 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 3993 | GVariant *value; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3994 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 3995 | value = g_value_get_variant (&(skeleton->priv->properties[3])); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 3996 | g_mutex_unlock (&skeleton->priv->lock); |
| 3997 | return value; |
| 3998 | } |
| 3999 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4000 | static guchar |
| 4001 | sensor_threshold_skeleton_get_state (SensorThreshold *object) |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 4002 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4003 | SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); |
| 4004 | guchar value; |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 4005 | g_mutex_lock (&skeleton->priv->lock); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4006 | value = g_value_get_uchar (&(skeleton->priv->properties[4])); |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 4007 | g_mutex_unlock (&skeleton->priv->lock); |
| 4008 | return value; |
| 4009 | } |
| 4010 | |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4011 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4012 | sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4013 | { |
| 4014 | GObjectClass *gobject_class; |
| 4015 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 4016 | |
| 4017 | gobject_class = G_OBJECT_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4018 | gobject_class->finalize = sensor_threshold_skeleton_finalize; |
| 4019 | gobject_class->get_property = sensor_threshold_skeleton_get_property; |
| 4020 | gobject_class->set_property = sensor_threshold_skeleton_set_property; |
| 4021 | gobject_class->notify = sensor_threshold_skeleton_notify; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4022 | |
| 4023 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4024 | sensor_threshold_override_properties (gobject_class, 1); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4025 | |
| 4026 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4027 | skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; |
| 4028 | skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; |
| 4029 | skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; |
| 4030 | skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4031 | |
| 4032 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4033 | g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4034 | #endif |
| 4035 | } |
| 4036 | |
| 4037 | static void |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4038 | sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4039 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4040 | iface->warning = _sensor_threshold_on_signal_warning; |
| 4041 | iface->critical = _sensor_threshold_on_signal_critical; |
| 4042 | iface->normal = _sensor_threshold_on_signal_normal; |
| 4043 | iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; |
| 4044 | iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; |
| 4045 | iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; |
| 4046 | iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; |
| 4047 | iface->get_state = sensor_threshold_skeleton_get_state; |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4048 | } |
| 4049 | |
| 4050 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4051 | * sensor_threshold_skeleton_new: |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4052 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4053 | * 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] | 4054 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4055 | * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4056 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4057 | SensorThreshold * |
| 4058 | sensor_threshold_skeleton_new (void) |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4059 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 4060 | return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 4061 | } |
| 4062 | |
| 4063 | /* ------------------------------------------------------------------------ |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 4064 | * Code for interface org.openbmc.SensorI2c |
| 4065 | * ------------------------------------------------------------------------ |
| 4066 | */ |
| 4067 | |
| 4068 | /** |
| 4069 | * SECTION:SensorI2c |
| 4070 | * @title: SensorI2c |
| 4071 | * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface |
| 4072 | * |
| 4073 | * 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. |
| 4074 | */ |
| 4075 | |
| 4076 | /* ---- Introspection data for org.openbmc.SensorI2c ---- */ |
| 4077 | |
| 4078 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = |
| 4079 | { |
| 4080 | { |
| 4081 | -1, |
| 4082 | (gchar *) "dev_path", |
| 4083 | (gchar *) "s", |
| 4084 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4085 | NULL |
| 4086 | }, |
| 4087 | "dev-path", |
| 4088 | FALSE |
| 4089 | }; |
| 4090 | |
| 4091 | static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = |
| 4092 | { |
| 4093 | { |
| 4094 | -1, |
| 4095 | (gchar *) "address", |
| 4096 | (gchar *) "s", |
| 4097 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, |
| 4098 | NULL |
| 4099 | }, |
| 4100 | "address", |
| 4101 | FALSE |
| 4102 | }; |
| 4103 | |
| 4104 | static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = |
| 4105 | { |
| 4106 | &_sensor_i2c_property_info_dev_path, |
| 4107 | &_sensor_i2c_property_info_address, |
| 4108 | NULL |
| 4109 | }; |
| 4110 | |
| 4111 | static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = |
| 4112 | { |
| 4113 | { |
| 4114 | -1, |
| 4115 | (gchar *) "org.openbmc.SensorI2c", |
| 4116 | NULL, |
| 4117 | NULL, |
| 4118 | (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, |
| 4119 | NULL |
| 4120 | }, |
| 4121 | "sensor-i2c", |
| 4122 | }; |
| 4123 | |
| 4124 | |
| 4125 | /** |
| 4126 | * sensor_i2c_interface_info: |
| 4127 | * |
| 4128 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. |
| 4129 | * |
| 4130 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 4131 | */ |
| 4132 | GDBusInterfaceInfo * |
| 4133 | sensor_i2c_interface_info (void) |
| 4134 | { |
| 4135 | return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; |
| 4136 | } |
| 4137 | |
| 4138 | /** |
| 4139 | * sensor_i2c_override_properties: |
| 4140 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 4141 | * @property_id_begin: The property id to assign to the first overridden property. |
| 4142 | * |
| 4143 | * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. |
| 4144 | * The properties are overridden in the order they are defined. |
| 4145 | * |
| 4146 | * Returns: The last property id. |
| 4147 | */ |
| 4148 | guint |
| 4149 | sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) |
| 4150 | { |
| 4151 | g_object_class_override_property (klass, property_id_begin++, "dev-path"); |
| 4152 | g_object_class_override_property (klass, property_id_begin++, "address"); |
| 4153 | return property_id_begin - 1; |
| 4154 | } |
| 4155 | |
| 4156 | |
| 4157 | |
| 4158 | /** |
| 4159 | * SensorI2c: |
| 4160 | * |
| 4161 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 4162 | */ |
| 4163 | |
| 4164 | /** |
| 4165 | * SensorI2cIface: |
| 4166 | * @parent_iface: The parent interface. |
| 4167 | * @get_address: Getter for the #SensorI2c:address property. |
| 4168 | * @get_dev_path: Getter for the #SensorI2c:dev-path property. |
| 4169 | * |
| 4170 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 4171 | */ |
| 4172 | |
| 4173 | typedef SensorI2cIface SensorI2cInterface; |
| 4174 | G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); |
| 4175 | |
| 4176 | static void |
| 4177 | sensor_i2c_default_init (SensorI2cIface *iface) |
| 4178 | { |
| 4179 | /* GObject properties for D-Bus properties: */ |
| 4180 | /** |
| 4181 | * SensorI2c:dev-path: |
| 4182 | * |
| 4183 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. |
| 4184 | * |
| 4185 | * 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. |
| 4186 | */ |
| 4187 | g_object_interface_install_property (iface, |
| 4188 | g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4189 | /** |
| 4190 | * SensorI2c:address: |
| 4191 | * |
| 4192 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. |
| 4193 | * |
| 4194 | * 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. |
| 4195 | */ |
| 4196 | g_object_interface_install_property (iface, |
| 4197 | g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4198 | } |
| 4199 | |
| 4200 | /** |
| 4201 | * sensor_i2c_get_dev_path: (skip) |
| 4202 | * @object: A #SensorI2c. |
| 4203 | * |
| 4204 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 4205 | * |
| 4206 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4207 | * |
| 4208 | * <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> |
| 4209 | * |
| 4210 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4211 | */ |
| 4212 | const gchar * |
| 4213 | sensor_i2c_get_dev_path (SensorI2c *object) |
| 4214 | { |
| 4215 | return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); |
| 4216 | } |
| 4217 | |
| 4218 | /** |
| 4219 | * sensor_i2c_dup_dev_path: (skip) |
| 4220 | * @object: A #SensorI2c. |
| 4221 | * |
| 4222 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. |
| 4223 | * |
| 4224 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4225 | * |
| 4226 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4227 | */ |
| 4228 | gchar * |
| 4229 | sensor_i2c_dup_dev_path (SensorI2c *object) |
| 4230 | { |
| 4231 | gchar *value; |
| 4232 | g_object_get (G_OBJECT (object), "dev-path", &value, NULL); |
| 4233 | return value; |
| 4234 | } |
| 4235 | |
| 4236 | /** |
| 4237 | * sensor_i2c_set_dev_path: (skip) |
| 4238 | * @object: A #SensorI2c. |
| 4239 | * @value: The value to set. |
| 4240 | * |
| 4241 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. |
| 4242 | * |
| 4243 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4244 | */ |
| 4245 | void |
| 4246 | sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) |
| 4247 | { |
| 4248 | g_object_set (G_OBJECT (object), "dev-path", value, NULL); |
| 4249 | } |
| 4250 | |
| 4251 | /** |
| 4252 | * sensor_i2c_get_address: (skip) |
| 4253 | * @object: A #SensorI2c. |
| 4254 | * |
| 4255 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 4256 | * |
| 4257 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4258 | * |
| 4259 | * <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> |
| 4260 | * |
| 4261 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 4262 | */ |
| 4263 | const gchar * |
| 4264 | sensor_i2c_get_address (SensorI2c *object) |
| 4265 | { |
| 4266 | return SENSOR_I2C_GET_IFACE (object)->get_address (object); |
| 4267 | } |
| 4268 | |
| 4269 | /** |
| 4270 | * sensor_i2c_dup_address: (skip) |
| 4271 | * @object: A #SensorI2c. |
| 4272 | * |
| 4273 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. |
| 4274 | * |
| 4275 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4276 | * |
| 4277 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
| 4278 | */ |
| 4279 | gchar * |
| 4280 | sensor_i2c_dup_address (SensorI2c *object) |
| 4281 | { |
| 4282 | gchar *value; |
| 4283 | g_object_get (G_OBJECT (object), "address", &value, NULL); |
| 4284 | return value; |
| 4285 | } |
| 4286 | |
| 4287 | /** |
| 4288 | * sensor_i2c_set_address: (skip) |
| 4289 | * @object: A #SensorI2c. |
| 4290 | * @value: The value to set. |
| 4291 | * |
| 4292 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. |
| 4293 | * |
| 4294 | * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. |
| 4295 | */ |
| 4296 | void |
| 4297 | sensor_i2c_set_address (SensorI2c *object, const gchar *value) |
| 4298 | { |
| 4299 | g_object_set (G_OBJECT (object), "address", value, NULL); |
| 4300 | } |
| 4301 | |
| 4302 | /* ------------------------------------------------------------------------ */ |
| 4303 | |
| 4304 | /** |
| 4305 | * SensorI2cProxy: |
| 4306 | * |
| 4307 | * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. |
| 4308 | */ |
| 4309 | |
| 4310 | /** |
| 4311 | * SensorI2cProxyClass: |
| 4312 | * @parent_class: The parent class. |
| 4313 | * |
| 4314 | * Class structure for #SensorI2cProxy. |
| 4315 | */ |
| 4316 | |
| 4317 | struct _SensorI2cProxyPrivate |
| 4318 | { |
| 4319 | GData *qdata; |
| 4320 | }; |
| 4321 | |
| 4322 | static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); |
| 4323 | |
| 4324 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4325 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 4326 | G_ADD_PRIVATE (SensorI2cProxy) |
| 4327 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 4328 | |
| 4329 | #else |
| 4330 | G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, |
| 4331 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); |
| 4332 | |
| 4333 | #endif |
| 4334 | static void |
| 4335 | sensor_i2c_proxy_finalize (GObject *object) |
| 4336 | { |
| 4337 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4338 | g_datalist_clear (&proxy->priv->qdata); |
| 4339 | G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); |
| 4340 | } |
| 4341 | |
| 4342 | static void |
| 4343 | sensor_i2c_proxy_get_property (GObject *object, |
| 4344 | guint prop_id, |
| 4345 | GValue *value, |
| 4346 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4347 | { |
| 4348 | const _ExtendedGDBusPropertyInfo *info; |
| 4349 | GVariant *variant; |
| 4350 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4351 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 4352 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 4353 | if (info->use_gvariant) |
| 4354 | { |
| 4355 | g_value_set_variant (value, variant); |
| 4356 | } |
| 4357 | else |
| 4358 | { |
| 4359 | if (variant != NULL) |
| 4360 | g_dbus_gvariant_to_gvalue (variant, value); |
| 4361 | } |
| 4362 | if (variant != NULL) |
| 4363 | g_variant_unref (variant); |
| 4364 | } |
| 4365 | |
| 4366 | static void |
| 4367 | sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, |
| 4368 | GAsyncResult *res, |
| 4369 | gpointer user_data) |
| 4370 | { |
| 4371 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 4372 | GError *error; |
| 4373 | GVariant *_ret; |
| 4374 | error = NULL; |
| 4375 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 4376 | if (!_ret) |
| 4377 | { |
| 4378 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", |
| 4379 | info->parent_struct.name, |
| 4380 | error->message, g_quark_to_string (error->domain), error->code); |
| 4381 | g_error_free (error); |
| 4382 | } |
| 4383 | else |
| 4384 | { |
| 4385 | g_variant_unref (_ret); |
| 4386 | } |
| 4387 | } |
| 4388 | |
| 4389 | static void |
| 4390 | sensor_i2c_proxy_set_property (GObject *object, |
| 4391 | guint prop_id, |
| 4392 | const GValue *value, |
| 4393 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4394 | { |
| 4395 | const _ExtendedGDBusPropertyInfo *info; |
| 4396 | GVariant *variant; |
| 4397 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4398 | info = _sensor_i2c_property_info_pointers[prop_id - 1]; |
| 4399 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4400 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 4401 | "org.freedesktop.DBus.Properties.Set", |
| 4402 | g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), |
| 4403 | G_DBUS_CALL_FLAGS_NONE, |
| 4404 | -1, |
| 4405 | NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 4406 | g_variant_unref (variant); |
| 4407 | } |
| 4408 | |
| 4409 | static void |
| 4410 | sensor_i2c_proxy_g_signal (GDBusProxy *proxy, |
| 4411 | const gchar *sender_name G_GNUC_UNUSED, |
| 4412 | const gchar *signal_name, |
| 4413 | GVariant *parameters) |
| 4414 | { |
| 4415 | _ExtendedGDBusSignalInfo *info; |
| 4416 | GVariantIter iter; |
| 4417 | GVariant *child; |
| 4418 | GValue *paramv; |
| 4419 | guint num_params; |
| 4420 | guint n; |
| 4421 | guint signal_id; |
| 4422 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); |
| 4423 | if (info == NULL) |
| 4424 | return; |
| 4425 | num_params = g_variant_n_children (parameters); |
| 4426 | paramv = g_new0 (GValue, num_params + 1); |
| 4427 | g_value_init (¶mv[0], TYPE_SENSOR_I2C); |
| 4428 | g_value_set_object (¶mv[0], proxy); |
| 4429 | g_variant_iter_init (&iter, parameters); |
| 4430 | n = 1; |
| 4431 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4432 | { |
| 4433 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 4434 | if (arg_info->use_gvariant) |
| 4435 | { |
| 4436 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4437 | g_value_set_variant (¶mv[n], child); |
| 4438 | n++; |
| 4439 | } |
| 4440 | else |
| 4441 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4442 | g_variant_unref (child); |
| 4443 | } |
| 4444 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 4445 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 4446 | for (n = 0; n < num_params + 1; n++) |
| 4447 | g_value_unset (¶mv[n]); |
| 4448 | g_free (paramv); |
| 4449 | } |
| 4450 | |
| 4451 | static void |
| 4452 | sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 4453 | GVariant *changed_properties, |
| 4454 | const gchar *const *invalidated_properties) |
| 4455 | { |
| 4456 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); |
| 4457 | guint n; |
| 4458 | const gchar *key; |
| 4459 | GVariantIter *iter; |
| 4460 | _ExtendedGDBusPropertyInfo *info; |
| 4461 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 4462 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 4463 | { |
| 4464 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); |
| 4465 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 4466 | if (info != NULL) |
| 4467 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4468 | } |
| 4469 | g_variant_iter_free (iter); |
| 4470 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 4471 | { |
| 4472 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); |
| 4473 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 4474 | if (info != NULL) |
| 4475 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 4476 | } |
| 4477 | } |
| 4478 | |
| 4479 | static const gchar * |
| 4480 | sensor_i2c_proxy_get_dev_path (SensorI2c *object) |
| 4481 | { |
| 4482 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4483 | GVariant *variant; |
| 4484 | const gchar *value = NULL; |
| 4485 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); |
| 4486 | if (variant != NULL) |
| 4487 | { |
| 4488 | value = g_variant_get_string (variant, NULL); |
| 4489 | g_variant_unref (variant); |
| 4490 | } |
| 4491 | return value; |
| 4492 | } |
| 4493 | |
| 4494 | static const gchar * |
| 4495 | sensor_i2c_proxy_get_address (SensorI2c *object) |
| 4496 | { |
| 4497 | SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); |
| 4498 | GVariant *variant; |
| 4499 | const gchar *value = NULL; |
| 4500 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); |
| 4501 | if (variant != NULL) |
| 4502 | { |
| 4503 | value = g_variant_get_string (variant, NULL); |
| 4504 | g_variant_unref (variant); |
| 4505 | } |
| 4506 | return value; |
| 4507 | } |
| 4508 | |
| 4509 | static void |
| 4510 | sensor_i2c_proxy_init (SensorI2cProxy *proxy) |
| 4511 | { |
| 4512 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4513 | proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); |
| 4514 | #else |
| 4515 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); |
| 4516 | #endif |
| 4517 | |
| 4518 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); |
| 4519 | } |
| 4520 | |
| 4521 | static void |
| 4522 | sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) |
| 4523 | { |
| 4524 | GObjectClass *gobject_class; |
| 4525 | GDBusProxyClass *proxy_class; |
| 4526 | |
| 4527 | gobject_class = G_OBJECT_CLASS (klass); |
| 4528 | gobject_class->finalize = sensor_i2c_proxy_finalize; |
| 4529 | gobject_class->get_property = sensor_i2c_proxy_get_property; |
| 4530 | gobject_class->set_property = sensor_i2c_proxy_set_property; |
| 4531 | |
| 4532 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 4533 | proxy_class->g_signal = sensor_i2c_proxy_g_signal; |
| 4534 | proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; |
| 4535 | |
| 4536 | sensor_i2c_override_properties (gobject_class, 1); |
| 4537 | |
| 4538 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4539 | g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); |
| 4540 | #endif |
| 4541 | } |
| 4542 | |
| 4543 | static void |
| 4544 | sensor_i2c_proxy_iface_init (SensorI2cIface *iface) |
| 4545 | { |
| 4546 | iface->get_dev_path = sensor_i2c_proxy_get_dev_path; |
| 4547 | iface->get_address = sensor_i2c_proxy_get_address; |
| 4548 | } |
| 4549 | |
| 4550 | /** |
| 4551 | * sensor_i2c_proxy_new: |
| 4552 | * @connection: A #GDBusConnection. |
| 4553 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4554 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4555 | * @object_path: An object path. |
| 4556 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4557 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4558 | * @user_data: User data to pass to @callback. |
| 4559 | * |
| 4560 | * 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. |
| 4561 | * |
| 4562 | * 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. |
| 4563 | * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. |
| 4564 | * |
| 4565 | * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 4566 | */ |
| 4567 | void |
| 4568 | sensor_i2c_proxy_new ( |
| 4569 | GDBusConnection *connection, |
| 4570 | GDBusProxyFlags flags, |
| 4571 | const gchar *name, |
| 4572 | const gchar *object_path, |
| 4573 | GCancellable *cancellable, |
| 4574 | GAsyncReadyCallback callback, |
| 4575 | gpointer user_data) |
| 4576 | { |
| 4577 | 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); |
| 4578 | } |
| 4579 | |
| 4580 | /** |
| 4581 | * sensor_i2c_proxy_new_finish: |
| 4582 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). |
| 4583 | * @error: Return location for error or %NULL |
| 4584 | * |
| 4585 | * Finishes an operation started with sensor_i2c_proxy_new(). |
| 4586 | * |
| 4587 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4588 | */ |
| 4589 | SensorI2c * |
| 4590 | sensor_i2c_proxy_new_finish ( |
| 4591 | GAsyncResult *res, |
| 4592 | GError **error) |
| 4593 | { |
| 4594 | GObject *ret; |
| 4595 | GObject *source_object; |
| 4596 | source_object = g_async_result_get_source_object (res); |
| 4597 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4598 | g_object_unref (source_object); |
| 4599 | if (ret != NULL) |
| 4600 | return SENSOR_I2C (ret); |
| 4601 | else |
| 4602 | return NULL; |
| 4603 | } |
| 4604 | |
| 4605 | /** |
| 4606 | * sensor_i2c_proxy_new_sync: |
| 4607 | * @connection: A #GDBusConnection. |
| 4608 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4609 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 4610 | * @object_path: An object path. |
| 4611 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4612 | * @error: Return location for error or %NULL |
| 4613 | * |
| 4614 | * 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. |
| 4615 | * |
| 4616 | * The calling thread is blocked until a reply is received. |
| 4617 | * |
| 4618 | * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. |
| 4619 | * |
| 4620 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4621 | */ |
| 4622 | SensorI2c * |
| 4623 | sensor_i2c_proxy_new_sync ( |
| 4624 | GDBusConnection *connection, |
| 4625 | GDBusProxyFlags flags, |
| 4626 | const gchar *name, |
| 4627 | const gchar *object_path, |
| 4628 | GCancellable *cancellable, |
| 4629 | GError **error) |
| 4630 | { |
| 4631 | GInitable *ret; |
| 4632 | 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); |
| 4633 | if (ret != NULL) |
| 4634 | return SENSOR_I2C (ret); |
| 4635 | else |
| 4636 | return NULL; |
| 4637 | } |
| 4638 | |
| 4639 | |
| 4640 | /** |
| 4641 | * sensor_i2c_proxy_new_for_bus: |
| 4642 | * @bus_type: A #GBusType. |
| 4643 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4644 | * @name: A bus name (well-known or unique). |
| 4645 | * @object_path: An object path. |
| 4646 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4647 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 4648 | * @user_data: User data to pass to @callback. |
| 4649 | * |
| 4650 | * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 4651 | * |
| 4652 | * 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. |
| 4653 | * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. |
| 4654 | * |
| 4655 | * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 4656 | */ |
| 4657 | void |
| 4658 | sensor_i2c_proxy_new_for_bus ( |
| 4659 | GBusType bus_type, |
| 4660 | GDBusProxyFlags flags, |
| 4661 | const gchar *name, |
| 4662 | const gchar *object_path, |
| 4663 | GCancellable *cancellable, |
| 4664 | GAsyncReadyCallback callback, |
| 4665 | gpointer user_data) |
| 4666 | { |
| 4667 | 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); |
| 4668 | } |
| 4669 | |
| 4670 | /** |
| 4671 | * sensor_i2c_proxy_new_for_bus_finish: |
| 4672 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). |
| 4673 | * @error: Return location for error or %NULL |
| 4674 | * |
| 4675 | * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). |
| 4676 | * |
| 4677 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4678 | */ |
| 4679 | SensorI2c * |
| 4680 | sensor_i2c_proxy_new_for_bus_finish ( |
| 4681 | GAsyncResult *res, |
| 4682 | GError **error) |
| 4683 | { |
| 4684 | GObject *ret; |
| 4685 | GObject *source_object; |
| 4686 | source_object = g_async_result_get_source_object (res); |
| 4687 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 4688 | g_object_unref (source_object); |
| 4689 | if (ret != NULL) |
| 4690 | return SENSOR_I2C (ret); |
| 4691 | else |
| 4692 | return NULL; |
| 4693 | } |
| 4694 | |
| 4695 | /** |
| 4696 | * sensor_i2c_proxy_new_for_bus_sync: |
| 4697 | * @bus_type: A #GBusType. |
| 4698 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 4699 | * @name: A bus name (well-known or unique). |
| 4700 | * @object_path: An object path. |
| 4701 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 4702 | * @error: Return location for error or %NULL |
| 4703 | * |
| 4704 | * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 4705 | * |
| 4706 | * The calling thread is blocked until a reply is received. |
| 4707 | * |
| 4708 | * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 4709 | * |
| 4710 | * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. |
| 4711 | */ |
| 4712 | SensorI2c * |
| 4713 | sensor_i2c_proxy_new_for_bus_sync ( |
| 4714 | GBusType bus_type, |
| 4715 | GDBusProxyFlags flags, |
| 4716 | const gchar *name, |
| 4717 | const gchar *object_path, |
| 4718 | GCancellable *cancellable, |
| 4719 | GError **error) |
| 4720 | { |
| 4721 | GInitable *ret; |
| 4722 | 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); |
| 4723 | if (ret != NULL) |
| 4724 | return SENSOR_I2C (ret); |
| 4725 | else |
| 4726 | return NULL; |
| 4727 | } |
| 4728 | |
| 4729 | |
| 4730 | /* ------------------------------------------------------------------------ */ |
| 4731 | |
| 4732 | /** |
| 4733 | * SensorI2cSkeleton: |
| 4734 | * |
| 4735 | * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. |
| 4736 | */ |
| 4737 | |
| 4738 | /** |
| 4739 | * SensorI2cSkeletonClass: |
| 4740 | * @parent_class: The parent class. |
| 4741 | * |
| 4742 | * Class structure for #SensorI2cSkeleton. |
| 4743 | */ |
| 4744 | |
| 4745 | struct _SensorI2cSkeletonPrivate |
| 4746 | { |
| 4747 | GValue *properties; |
| 4748 | GList *changed_properties; |
| 4749 | GSource *changed_properties_idle_source; |
| 4750 | GMainContext *context; |
| 4751 | GMutex lock; |
| 4752 | }; |
| 4753 | |
| 4754 | static void |
| 4755 | _sensor_i2c_skeleton_handle_method_call ( |
| 4756 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4757 | const gchar *sender G_GNUC_UNUSED, |
| 4758 | const gchar *object_path G_GNUC_UNUSED, |
| 4759 | const gchar *interface_name, |
| 4760 | const gchar *method_name, |
| 4761 | GVariant *parameters, |
| 4762 | GDBusMethodInvocation *invocation, |
| 4763 | gpointer user_data) |
| 4764 | { |
| 4765 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4766 | _ExtendedGDBusMethodInfo *info; |
| 4767 | GVariantIter iter; |
| 4768 | GVariant *child; |
| 4769 | GValue *paramv; |
| 4770 | guint num_params; |
| 4771 | guint num_extra; |
| 4772 | guint n; |
| 4773 | guint signal_id; |
| 4774 | GValue return_value = G_VALUE_INIT; |
| 4775 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 4776 | g_assert (info != NULL); |
| 4777 | num_params = g_variant_n_children (parameters); |
| 4778 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 4779 | n = 0; |
| 4780 | g_value_init (¶mv[n], TYPE_SENSOR_I2C); |
| 4781 | g_value_set_object (¶mv[n++], skeleton); |
| 4782 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 4783 | g_value_set_object (¶mv[n++], invocation); |
| 4784 | if (info->pass_fdlist) |
| 4785 | { |
| 4786 | #ifdef G_OS_UNIX |
| 4787 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 4788 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 4789 | #else |
| 4790 | g_assert_not_reached (); |
| 4791 | #endif |
| 4792 | } |
| 4793 | g_variant_iter_init (&iter, parameters); |
| 4794 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 4795 | { |
| 4796 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 4797 | if (arg_info->use_gvariant) |
| 4798 | { |
| 4799 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 4800 | g_value_set_variant (¶mv[n], child); |
| 4801 | n++; |
| 4802 | } |
| 4803 | else |
| 4804 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 4805 | g_variant_unref (child); |
| 4806 | } |
| 4807 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); |
| 4808 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 4809 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 4810 | if (!g_value_get_boolean (&return_value)) |
| 4811 | 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); |
| 4812 | g_value_unset (&return_value); |
| 4813 | for (n = 0; n < num_params + num_extra; n++) |
| 4814 | g_value_unset (¶mv[n]); |
| 4815 | g_free (paramv); |
| 4816 | } |
| 4817 | |
| 4818 | static GVariant * |
| 4819 | _sensor_i2c_skeleton_handle_get_property ( |
| 4820 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4821 | const gchar *sender G_GNUC_UNUSED, |
| 4822 | const gchar *object_path G_GNUC_UNUSED, |
| 4823 | const gchar *interface_name G_GNUC_UNUSED, |
| 4824 | const gchar *property_name, |
| 4825 | GError **error, |
| 4826 | gpointer user_data) |
| 4827 | { |
| 4828 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4829 | GValue value = G_VALUE_INIT; |
| 4830 | GParamSpec *pspec; |
| 4831 | _ExtendedGDBusPropertyInfo *info; |
| 4832 | GVariant *ret; |
| 4833 | ret = NULL; |
| 4834 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 4835 | g_assert (info != NULL); |
| 4836 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4837 | if (pspec == NULL) |
| 4838 | { |
| 4839 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4840 | } |
| 4841 | else |
| 4842 | { |
| 4843 | g_value_init (&value, pspec->value_type); |
| 4844 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4845 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 4846 | g_value_unset (&value); |
| 4847 | } |
| 4848 | return ret; |
| 4849 | } |
| 4850 | |
| 4851 | static gboolean |
| 4852 | _sensor_i2c_skeleton_handle_set_property ( |
| 4853 | GDBusConnection *connection G_GNUC_UNUSED, |
| 4854 | const gchar *sender G_GNUC_UNUSED, |
| 4855 | const gchar *object_path G_GNUC_UNUSED, |
| 4856 | const gchar *interface_name G_GNUC_UNUSED, |
| 4857 | const gchar *property_name, |
| 4858 | GVariant *variant, |
| 4859 | GError **error, |
| 4860 | gpointer user_data) |
| 4861 | { |
| 4862 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 4863 | GValue value = G_VALUE_INIT; |
| 4864 | GParamSpec *pspec; |
| 4865 | _ExtendedGDBusPropertyInfo *info; |
| 4866 | gboolean ret; |
| 4867 | ret = FALSE; |
| 4868 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); |
| 4869 | g_assert (info != NULL); |
| 4870 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 4871 | if (pspec == NULL) |
| 4872 | { |
| 4873 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 4874 | } |
| 4875 | else |
| 4876 | { |
| 4877 | if (info->use_gvariant) |
| 4878 | g_value_set_variant (&value, variant); |
| 4879 | else |
| 4880 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 4881 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 4882 | g_value_unset (&value); |
| 4883 | ret = TRUE; |
| 4884 | } |
| 4885 | return ret; |
| 4886 | } |
| 4887 | |
| 4888 | static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = |
| 4889 | { |
| 4890 | _sensor_i2c_skeleton_handle_method_call, |
| 4891 | _sensor_i2c_skeleton_handle_get_property, |
| 4892 | _sensor_i2c_skeleton_handle_set_property, |
| 4893 | {NULL} |
| 4894 | }; |
| 4895 | |
| 4896 | static GDBusInterfaceInfo * |
| 4897 | sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4898 | { |
| 4899 | return sensor_i2c_interface_info (); |
| 4900 | } |
| 4901 | |
| 4902 | static GDBusInterfaceVTable * |
| 4903 | sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 4904 | { |
| 4905 | return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; |
| 4906 | } |
| 4907 | |
| 4908 | static GVariant * |
| 4909 | sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 4910 | { |
| 4911 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 4912 | |
| 4913 | GVariantBuilder builder; |
| 4914 | guint n; |
| 4915 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4916 | if (_sensor_i2c_interface_info.parent_struct.properties == NULL) |
| 4917 | goto out; |
| 4918 | for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) |
| 4919 | { |
| 4920 | GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; |
| 4921 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 4922 | { |
| 4923 | GVariant *value; |
| 4924 | 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); |
| 4925 | if (value != NULL) |
| 4926 | { |
| 4927 | g_variant_take_ref (value); |
| 4928 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 4929 | g_variant_unref (value); |
| 4930 | } |
| 4931 | } |
| 4932 | } |
| 4933 | out: |
| 4934 | return g_variant_builder_end (&builder); |
| 4935 | } |
| 4936 | |
| 4937 | static gboolean _sensor_i2c_emit_changed (gpointer user_data); |
| 4938 | |
| 4939 | static void |
| 4940 | sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 4941 | { |
| 4942 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); |
| 4943 | gboolean emit_changed = FALSE; |
| 4944 | |
| 4945 | g_mutex_lock (&skeleton->priv->lock); |
| 4946 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4947 | { |
| 4948 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4949 | skeleton->priv->changed_properties_idle_source = NULL; |
| 4950 | emit_changed = TRUE; |
| 4951 | } |
| 4952 | g_mutex_unlock (&skeleton->priv->lock); |
| 4953 | |
| 4954 | if (emit_changed) |
| 4955 | _sensor_i2c_emit_changed (skeleton); |
| 4956 | } |
| 4957 | |
| 4958 | static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); |
| 4959 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4960 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4961 | G_ADD_PRIVATE (SensorI2cSkeleton) |
| 4962 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 4963 | |
| 4964 | #else |
| 4965 | G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 4966 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); |
| 4967 | |
| 4968 | #endif |
| 4969 | static void |
| 4970 | sensor_i2c_skeleton_finalize (GObject *object) |
| 4971 | { |
| 4972 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 4973 | guint n; |
| 4974 | for (n = 0; n < 2; n++) |
| 4975 | g_value_unset (&skeleton->priv->properties[n]); |
| 4976 | g_free (skeleton->priv->properties); |
| 4977 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4978 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4979 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4980 | g_main_context_unref (skeleton->priv->context); |
| 4981 | g_mutex_clear (&skeleton->priv->lock); |
| 4982 | G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); |
| 4983 | } |
| 4984 | |
| 4985 | static void |
| 4986 | sensor_i2c_skeleton_get_property (GObject *object, |
| 4987 | guint prop_id, |
| 4988 | GValue *value, |
| 4989 | GParamSpec *pspec G_GNUC_UNUSED) |
| 4990 | { |
| 4991 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 4992 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 4993 | g_mutex_lock (&skeleton->priv->lock); |
| 4994 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 4995 | g_mutex_unlock (&skeleton->priv->lock); |
| 4996 | } |
| 4997 | |
| 4998 | static gboolean |
| 4999 | _sensor_i2c_emit_changed (gpointer user_data) |
| 5000 | { |
| 5001 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); |
| 5002 | GList *l; |
| 5003 | GVariantBuilder builder; |
| 5004 | GVariantBuilder invalidated_builder; |
| 5005 | guint num_changes; |
| 5006 | |
| 5007 | g_mutex_lock (&skeleton->priv->lock); |
| 5008 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 5009 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 5010 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 5011 | { |
| 5012 | ChangedProperty *cp = l->data; |
| 5013 | GVariant *variant; |
| 5014 | const GValue *cur_value; |
| 5015 | |
| 5016 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 5017 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 5018 | { |
| 5019 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 5020 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 5021 | g_variant_unref (variant); |
| 5022 | num_changes++; |
| 5023 | } |
| 5024 | } |
| 5025 | if (num_changes > 0) |
| 5026 | { |
| 5027 | GList *connections, *ll; |
| 5028 | GVariant *signal_variant; |
| 5029 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", |
| 5030 | &builder, &invalidated_builder)); |
| 5031 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 5032 | for (ll = connections; ll != NULL; ll = ll->next) |
| 5033 | { |
| 5034 | GDBusConnection *connection = ll->data; |
| 5035 | |
| 5036 | g_dbus_connection_emit_signal (connection, |
| 5037 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 5038 | "org.freedesktop.DBus.Properties", |
| 5039 | "PropertiesChanged", |
| 5040 | signal_variant, |
| 5041 | NULL); |
| 5042 | } |
| 5043 | g_variant_unref (signal_variant); |
| 5044 | g_list_free_full (connections, g_object_unref); |
| 5045 | } |
| 5046 | else |
| 5047 | { |
| 5048 | g_variant_builder_clear (&builder); |
| 5049 | g_variant_builder_clear (&invalidated_builder); |
| 5050 | } |
| 5051 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 5052 | skeleton->priv->changed_properties = NULL; |
| 5053 | skeleton->priv->changed_properties_idle_source = NULL; |
| 5054 | g_mutex_unlock (&skeleton->priv->lock); |
| 5055 | return FALSE; |
| 5056 | } |
| 5057 | |
| 5058 | static void |
| 5059 | _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 5060 | { |
| 5061 | ChangedProperty *cp; |
| 5062 | GList *l; |
| 5063 | cp = NULL; |
| 5064 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 5065 | { |
| 5066 | ChangedProperty *i_cp = l->data; |
| 5067 | if (i_cp->info == info) |
| 5068 | { |
| 5069 | cp = i_cp; |
| 5070 | break; |
| 5071 | } |
| 5072 | } |
| 5073 | if (cp == NULL) |
| 5074 | { |
| 5075 | cp = g_new0 (ChangedProperty, 1); |
| 5076 | cp->prop_id = prop_id; |
| 5077 | cp->info = info; |
| 5078 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 5079 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 5080 | g_value_copy (orig_value, &cp->orig_value); |
| 5081 | } |
| 5082 | } |
| 5083 | |
| 5084 | static void |
| 5085 | sensor_i2c_skeleton_notify (GObject *object, |
| 5086 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5087 | { |
| 5088 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5089 | g_mutex_lock (&skeleton->priv->lock); |
| 5090 | if (skeleton->priv->changed_properties != NULL && |
| 5091 | skeleton->priv->changed_properties_idle_source == NULL) |
| 5092 | { |
| 5093 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 5094 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 5095 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 5096 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 5097 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 5098 | } |
| 5099 | g_mutex_unlock (&skeleton->priv->lock); |
| 5100 | } |
| 5101 | |
| 5102 | static void |
| 5103 | sensor_i2c_skeleton_set_property (GObject *object, |
| 5104 | guint prop_id, |
| 5105 | const GValue *value, |
| 5106 | GParamSpec *pspec) |
| 5107 | { |
| 5108 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5109 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5110 | g_mutex_lock (&skeleton->priv->lock); |
| 5111 | g_object_freeze_notify (object); |
| 5112 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 5113 | { |
| 5114 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 5115 | _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 5116 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 5117 | g_object_notify_by_pspec (object, pspec); |
| 5118 | } |
| 5119 | g_mutex_unlock (&skeleton->priv->lock); |
| 5120 | g_object_thaw_notify (object); |
| 5121 | } |
| 5122 | |
| 5123 | static void |
| 5124 | sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) |
| 5125 | { |
| 5126 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5127 | skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); |
| 5128 | #else |
| 5129 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); |
| 5130 | #endif |
| 5131 | |
| 5132 | g_mutex_init (&skeleton->priv->lock); |
| 5133 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 5134 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 5135 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 5136 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 5137 | } |
| 5138 | |
| 5139 | static const gchar * |
| 5140 | sensor_i2c_skeleton_get_dev_path (SensorI2c *object) |
| 5141 | { |
| 5142 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5143 | const gchar *value; |
| 5144 | g_mutex_lock (&skeleton->priv->lock); |
| 5145 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
| 5146 | g_mutex_unlock (&skeleton->priv->lock); |
| 5147 | return value; |
| 5148 | } |
| 5149 | |
| 5150 | static const gchar * |
| 5151 | sensor_i2c_skeleton_get_address (SensorI2c *object) |
| 5152 | { |
| 5153 | SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); |
| 5154 | const gchar *value; |
| 5155 | g_mutex_lock (&skeleton->priv->lock); |
| 5156 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
| 5157 | g_mutex_unlock (&skeleton->priv->lock); |
| 5158 | return value; |
| 5159 | } |
| 5160 | |
| 5161 | static void |
| 5162 | sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) |
| 5163 | { |
| 5164 | GObjectClass *gobject_class; |
| 5165 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 5166 | |
| 5167 | gobject_class = G_OBJECT_CLASS (klass); |
| 5168 | gobject_class->finalize = sensor_i2c_skeleton_finalize; |
| 5169 | gobject_class->get_property = sensor_i2c_skeleton_get_property; |
| 5170 | gobject_class->set_property = sensor_i2c_skeleton_set_property; |
| 5171 | gobject_class->notify = sensor_i2c_skeleton_notify; |
| 5172 | |
| 5173 | |
| 5174 | sensor_i2c_override_properties (gobject_class, 1); |
| 5175 | |
| 5176 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 5177 | skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; |
| 5178 | skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; |
| 5179 | skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; |
| 5180 | skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; |
| 5181 | |
| 5182 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5183 | g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); |
| 5184 | #endif |
| 5185 | } |
| 5186 | |
| 5187 | static void |
| 5188 | sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) |
| 5189 | { |
| 5190 | iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; |
| 5191 | iface->get_address = sensor_i2c_skeleton_get_address; |
| 5192 | } |
| 5193 | |
| 5194 | /** |
| 5195 | * sensor_i2c_skeleton_new: |
| 5196 | * |
| 5197 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. |
| 5198 | * |
| 5199 | * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. |
| 5200 | */ |
| 5201 | SensorI2c * |
| 5202 | sensor_i2c_skeleton_new (void) |
| 5203 | { |
| 5204 | return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); |
| 5205 | } |
| 5206 | |
| 5207 | /* ------------------------------------------------------------------------ |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 5208 | * Code for interface org.openbmc.SensorMatch |
| 5209 | * ------------------------------------------------------------------------ |
| 5210 | */ |
| 5211 | |
| 5212 | /** |
| 5213 | * SECTION:SensorMatch |
| 5214 | * @title: SensorMatch |
| 5215 | * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface |
| 5216 | * |
| 5217 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C. |
| 5218 | */ |
| 5219 | |
| 5220 | /* ---- Introspection data for org.openbmc.SensorMatch ---- */ |
| 5221 | |
| 5222 | static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = |
| 5223 | { |
| 5224 | { |
| 5225 | -1, |
| 5226 | (gchar *) "state", |
| 5227 | (gchar *) "y", |
| 5228 | NULL |
| 5229 | }, |
| 5230 | FALSE |
| 5231 | }; |
| 5232 | |
| 5233 | static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = |
| 5234 | { |
| 5235 | &_sensor_match_signal_info_sensor_match_ARG_state, |
| 5236 | NULL |
| 5237 | }; |
| 5238 | |
| 5239 | static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = |
| 5240 | { |
| 5241 | { |
| 5242 | -1, |
| 5243 | (gchar *) "SensorMatch", |
| 5244 | (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, |
| 5245 | NULL |
| 5246 | }, |
| 5247 | "sensor-match" |
| 5248 | }; |
| 5249 | |
| 5250 | static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = |
| 5251 | { |
| 5252 | &_sensor_match_signal_info_sensor_match, |
| 5253 | NULL |
| 5254 | }; |
| 5255 | |
| 5256 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = |
| 5257 | { |
| 5258 | { |
| 5259 | -1, |
| 5260 | (gchar *) "match_value", |
| 5261 | (gchar *) "v", |
| 5262 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5263 | NULL |
| 5264 | }, |
| 5265 | "match-value", |
| 5266 | FALSE |
| 5267 | }; |
| 5268 | |
| 5269 | static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = |
| 5270 | { |
| 5271 | { |
| 5272 | -1, |
| 5273 | (gchar *) "state", |
| 5274 | (gchar *) "y", |
| 5275 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 5276 | NULL |
| 5277 | }, |
| 5278 | "state", |
| 5279 | FALSE |
| 5280 | }; |
| 5281 | |
| 5282 | static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = |
| 5283 | { |
| 5284 | &_sensor_match_property_info_match_value, |
| 5285 | &_sensor_match_property_info_state, |
| 5286 | NULL |
| 5287 | }; |
| 5288 | |
| 5289 | static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = |
| 5290 | { |
| 5291 | { |
| 5292 | -1, |
| 5293 | (gchar *) "org.openbmc.SensorMatch", |
| 5294 | NULL, |
| 5295 | (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, |
| 5296 | (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, |
| 5297 | NULL |
| 5298 | }, |
| 5299 | "sensor-match", |
| 5300 | }; |
| 5301 | |
| 5302 | |
| 5303 | /** |
| 5304 | * sensor_match_interface_info: |
| 5305 | * |
| 5306 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. |
| 5307 | * |
| 5308 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
| 5309 | */ |
| 5310 | GDBusInterfaceInfo * |
| 5311 | sensor_match_interface_info (void) |
| 5312 | { |
| 5313 | return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; |
| 5314 | } |
| 5315 | |
| 5316 | /** |
| 5317 | * sensor_match_override_properties: |
| 5318 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
| 5319 | * @property_id_begin: The property id to assign to the first overridden property. |
| 5320 | * |
| 5321 | * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. |
| 5322 | * The properties are overridden in the order they are defined. |
| 5323 | * |
| 5324 | * Returns: The last property id. |
| 5325 | */ |
| 5326 | guint |
| 5327 | sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) |
| 5328 | { |
| 5329 | g_object_class_override_property (klass, property_id_begin++, "match-value"); |
| 5330 | g_object_class_override_property (klass, property_id_begin++, "state"); |
| 5331 | return property_id_begin - 1; |
| 5332 | } |
| 5333 | |
| 5334 | |
| 5335 | |
| 5336 | /** |
| 5337 | * SensorMatch: |
| 5338 | * |
| 5339 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 5340 | */ |
| 5341 | |
| 5342 | /** |
| 5343 | * SensorMatchIface: |
| 5344 | * @parent_iface: The parent interface. |
| 5345 | * @get_match_value: Getter for the #SensorMatch:match-value property. |
| 5346 | * @get_state: Getter for the #SensorMatch:state property. |
| 5347 | * @sensor_match: Handler for the #SensorMatch::sensor-match signal. |
| 5348 | * |
| 5349 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 5350 | */ |
| 5351 | |
| 5352 | typedef SensorMatchIface SensorMatchInterface; |
| 5353 | G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); |
| 5354 | |
| 5355 | static void |
| 5356 | sensor_match_default_init (SensorMatchIface *iface) |
| 5357 | { |
| 5358 | /* GObject signals for received D-Bus signals: */ |
| 5359 | /** |
| 5360 | * SensorMatch::sensor-match: |
| 5361 | * @object: A #SensorMatch. |
| 5362 | * @arg_state: Argument. |
| 5363 | * |
| 5364 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received. |
| 5365 | * |
| 5366 | * 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. |
| 5367 | */ |
| 5368 | g_signal_new ("sensor-match", |
| 5369 | G_TYPE_FROM_INTERFACE (iface), |
| 5370 | G_SIGNAL_RUN_LAST, |
| 5371 | G_STRUCT_OFFSET (SensorMatchIface, sensor_match), |
| 5372 | NULL, |
| 5373 | NULL, |
| 5374 | g_cclosure_marshal_generic, |
| 5375 | G_TYPE_NONE, |
| 5376 | 1, G_TYPE_UCHAR); |
| 5377 | |
| 5378 | /* GObject properties for D-Bus properties: */ |
| 5379 | /** |
| 5380 | * SensorMatch:match-value: |
| 5381 | * |
| 5382 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. |
| 5383 | * |
| 5384 | * 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. |
| 5385 | */ |
| 5386 | g_object_interface_install_property (iface, |
| 5387 | g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5388 | /** |
| 5389 | * SensorMatch:state: |
| 5390 | * |
| 5391 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. |
| 5392 | * |
| 5393 | * 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. |
| 5394 | */ |
| 5395 | g_object_interface_install_property (iface, |
| 5396 | g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 5397 | } |
| 5398 | |
| 5399 | /** |
| 5400 | * sensor_match_get_match_value: (skip) |
| 5401 | * @object: A #SensorMatch. |
| 5402 | * |
| 5403 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 5404 | * |
| 5405 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5406 | * |
| 5407 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.</warning> |
| 5408 | * |
| 5409 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
| 5410 | */ |
| 5411 | GVariant * |
| 5412 | sensor_match_get_match_value (SensorMatch *object) |
| 5413 | { |
| 5414 | return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); |
| 5415 | } |
| 5416 | |
| 5417 | /** |
| 5418 | * sensor_match_dup_match_value: (skip) |
| 5419 | * @object: A #SensorMatch. |
| 5420 | * |
| 5421 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. |
| 5422 | * |
| 5423 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5424 | * |
| 5425 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). |
| 5426 | */ |
| 5427 | GVariant * |
| 5428 | sensor_match_dup_match_value (SensorMatch *object) |
| 5429 | { |
| 5430 | GVariant *value; |
| 5431 | g_object_get (G_OBJECT (object), "match-value", &value, NULL); |
| 5432 | return value; |
| 5433 | } |
| 5434 | |
| 5435 | /** |
| 5436 | * sensor_match_set_match_value: (skip) |
| 5437 | * @object: A #SensorMatch. |
| 5438 | * @value: The value to set. |
| 5439 | * |
| 5440 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. |
| 5441 | * |
| 5442 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 5443 | */ |
| 5444 | void |
| 5445 | sensor_match_set_match_value (SensorMatch *object, GVariant *value) |
| 5446 | { |
| 5447 | g_object_set (G_OBJECT (object), "match-value", value, NULL); |
| 5448 | } |
| 5449 | |
| 5450 | /** |
| 5451 | * sensor_match_get_state: (skip) |
| 5452 | * @object: A #SensorMatch. |
| 5453 | * |
| 5454 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. |
| 5455 | * |
| 5456 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
| 5457 | * |
| 5458 | * Returns: The property value. |
| 5459 | */ |
| 5460 | guchar |
| 5461 | sensor_match_get_state (SensorMatch *object) |
| 5462 | { |
| 5463 | return SENSOR_MATCH_GET_IFACE (object)->get_state (object); |
| 5464 | } |
| 5465 | |
| 5466 | /** |
| 5467 | * sensor_match_set_state: (skip) |
| 5468 | * @object: A #SensorMatch. |
| 5469 | * @value: The value to set. |
| 5470 | * |
| 5471 | * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. |
| 5472 | * |
| 5473 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
| 5474 | */ |
| 5475 | void |
| 5476 | sensor_match_set_state (SensorMatch *object, guchar value) |
| 5477 | { |
| 5478 | g_object_set (G_OBJECT (object), "state", value, NULL); |
| 5479 | } |
| 5480 | |
| 5481 | /** |
| 5482 | * sensor_match_emit_sensor_match: |
| 5483 | * @object: A #SensorMatch. |
| 5484 | * @arg_state: Argument to pass with the signal. |
| 5485 | * |
| 5486 | * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. |
| 5487 | */ |
| 5488 | void |
| 5489 | sensor_match_emit_sensor_match ( |
| 5490 | SensorMatch *object, |
| 5491 | guchar arg_state) |
| 5492 | { |
| 5493 | g_signal_emit_by_name (object, "sensor-match", arg_state); |
| 5494 | } |
| 5495 | |
| 5496 | /* ------------------------------------------------------------------------ */ |
| 5497 | |
| 5498 | /** |
| 5499 | * SensorMatchProxy: |
| 5500 | * |
| 5501 | * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. |
| 5502 | */ |
| 5503 | |
| 5504 | /** |
| 5505 | * SensorMatchProxyClass: |
| 5506 | * @parent_class: The parent class. |
| 5507 | * |
| 5508 | * Class structure for #SensorMatchProxy. |
| 5509 | */ |
| 5510 | |
| 5511 | struct _SensorMatchProxyPrivate |
| 5512 | { |
| 5513 | GData *qdata; |
| 5514 | }; |
| 5515 | |
| 5516 | static void sensor_match_proxy_iface_init (SensorMatchIface *iface); |
| 5517 | |
| 5518 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5519 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 5520 | G_ADD_PRIVATE (SensorMatchProxy) |
| 5521 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 5522 | |
| 5523 | #else |
| 5524 | G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, |
| 5525 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); |
| 5526 | |
| 5527 | #endif |
| 5528 | static void |
| 5529 | sensor_match_proxy_finalize (GObject *object) |
| 5530 | { |
| 5531 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 5532 | g_datalist_clear (&proxy->priv->qdata); |
| 5533 | G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); |
| 5534 | } |
| 5535 | |
| 5536 | static void |
| 5537 | sensor_match_proxy_get_property (GObject *object, |
| 5538 | guint prop_id, |
| 5539 | GValue *value, |
| 5540 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5541 | { |
| 5542 | const _ExtendedGDBusPropertyInfo *info; |
| 5543 | GVariant *variant; |
| 5544 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5545 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 5546 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5547 | if (info->use_gvariant) |
| 5548 | { |
| 5549 | g_value_set_variant (value, variant); |
| 5550 | } |
| 5551 | else |
| 5552 | { |
| 5553 | if (variant != NULL) |
| 5554 | g_dbus_gvariant_to_gvalue (variant, value); |
| 5555 | } |
| 5556 | if (variant != NULL) |
| 5557 | g_variant_unref (variant); |
| 5558 | } |
| 5559 | |
| 5560 | static void |
| 5561 | sensor_match_proxy_set_property_cb (GDBusProxy *proxy, |
| 5562 | GAsyncResult *res, |
| 5563 | gpointer user_data) |
| 5564 | { |
| 5565 | const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5566 | GError *error; |
| 5567 | GVariant *_ret; |
| 5568 | error = NULL; |
| 5569 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5570 | if (!_ret) |
| 5571 | { |
| 5572 | g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", |
| 5573 | info->parent_struct.name, |
| 5574 | error->message, g_quark_to_string (error->domain), error->code); |
| 5575 | g_error_free (error); |
| 5576 | } |
| 5577 | else |
| 5578 | { |
| 5579 | g_variant_unref (_ret); |
| 5580 | } |
| 5581 | } |
| 5582 | |
| 5583 | static void |
| 5584 | sensor_match_proxy_set_property (GObject *object, |
| 5585 | guint prop_id, |
| 5586 | const GValue *value, |
| 5587 | GParamSpec *pspec G_GNUC_UNUSED) |
| 5588 | { |
| 5589 | const _ExtendedGDBusPropertyInfo *info; |
| 5590 | GVariant *variant; |
| 5591 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5592 | info = _sensor_match_property_info_pointers[prop_id - 1]; |
| 5593 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5594 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5595 | "org.freedesktop.DBus.Properties.Set", |
| 5596 | g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), |
| 5597 | G_DBUS_CALL_FLAGS_NONE, |
| 5598 | -1, |
| 5599 | NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5600 | g_variant_unref (variant); |
| 5601 | } |
| 5602 | |
| 5603 | static void |
| 5604 | sensor_match_proxy_g_signal (GDBusProxy *proxy, |
| 5605 | const gchar *sender_name G_GNUC_UNUSED, |
| 5606 | const gchar *signal_name, |
| 5607 | GVariant *parameters) |
| 5608 | { |
| 5609 | _ExtendedGDBusSignalInfo *info; |
| 5610 | GVariantIter iter; |
| 5611 | GVariant *child; |
| 5612 | GValue *paramv; |
| 5613 | guint num_params; |
| 5614 | guint n; |
| 5615 | guint signal_id; |
| 5616 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); |
| 5617 | if (info == NULL) |
| 5618 | return; |
| 5619 | num_params = g_variant_n_children (parameters); |
| 5620 | paramv = g_new0 (GValue, num_params + 1); |
| 5621 | g_value_init (¶mv[0], TYPE_SENSOR_MATCH); |
| 5622 | g_value_set_object (¶mv[0], proxy); |
| 5623 | g_variant_iter_init (&iter, parameters); |
| 5624 | n = 1; |
| 5625 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5626 | { |
| 5627 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5628 | if (arg_info->use_gvariant) |
| 5629 | { |
| 5630 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5631 | g_value_set_variant (¶mv[n], child); |
| 5632 | n++; |
| 5633 | } |
| 5634 | else |
| 5635 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5636 | g_variant_unref (child); |
| 5637 | } |
| 5638 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 5639 | g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5640 | for (n = 0; n < num_params + 1; n++) |
| 5641 | g_value_unset (¶mv[n]); |
| 5642 | g_free (paramv); |
| 5643 | } |
| 5644 | |
| 5645 | static void |
| 5646 | sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5647 | GVariant *changed_properties, |
| 5648 | const gchar *const *invalidated_properties) |
| 5649 | { |
| 5650 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); |
| 5651 | guint n; |
| 5652 | const gchar *key; |
| 5653 | GVariantIter *iter; |
| 5654 | _ExtendedGDBusPropertyInfo *info; |
| 5655 | g_variant_get (changed_properties, "a{sv}", &iter); |
| 5656 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5657 | { |
| 5658 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); |
| 5659 | g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5660 | if (info != NULL) |
| 5661 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5662 | } |
| 5663 | g_variant_iter_free (iter); |
| 5664 | for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5665 | { |
| 5666 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); |
| 5667 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5668 | if (info != NULL) |
| 5669 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5670 | } |
| 5671 | } |
| 5672 | |
| 5673 | static GVariant * |
| 5674 | sensor_match_proxy_get_match_value (SensorMatch *object) |
| 5675 | { |
| 5676 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 5677 | GVariant *variant; |
| 5678 | GVariant *value = NULL; |
| 5679 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); |
| 5680 | value = variant; |
| 5681 | if (variant != NULL) |
| 5682 | g_variant_unref (variant); |
| 5683 | return value; |
| 5684 | } |
| 5685 | |
| 5686 | static guchar |
| 5687 | sensor_match_proxy_get_state (SensorMatch *object) |
| 5688 | { |
| 5689 | SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); |
| 5690 | GVariant *variant; |
| 5691 | guchar value = 0; |
| 5692 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); |
| 5693 | if (variant != NULL) |
| 5694 | { |
| 5695 | value = g_variant_get_byte (variant); |
| 5696 | g_variant_unref (variant); |
| 5697 | } |
| 5698 | return value; |
| 5699 | } |
| 5700 | |
| 5701 | static void |
| 5702 | sensor_match_proxy_init (SensorMatchProxy *proxy) |
| 5703 | { |
| 5704 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5705 | proxy->priv = sensor_match_proxy_get_instance_private (proxy); |
| 5706 | #else |
| 5707 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); |
| 5708 | #endif |
| 5709 | |
| 5710 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); |
| 5711 | } |
| 5712 | |
| 5713 | static void |
| 5714 | sensor_match_proxy_class_init (SensorMatchProxyClass *klass) |
| 5715 | { |
| 5716 | GObjectClass *gobject_class; |
| 5717 | GDBusProxyClass *proxy_class; |
| 5718 | |
| 5719 | gobject_class = G_OBJECT_CLASS (klass); |
| 5720 | gobject_class->finalize = sensor_match_proxy_finalize; |
| 5721 | gobject_class->get_property = sensor_match_proxy_get_property; |
| 5722 | gobject_class->set_property = sensor_match_proxy_set_property; |
| 5723 | |
| 5724 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 5725 | proxy_class->g_signal = sensor_match_proxy_g_signal; |
| 5726 | proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; |
| 5727 | |
| 5728 | sensor_match_override_properties (gobject_class, 1); |
| 5729 | |
| 5730 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5731 | g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); |
| 5732 | #endif |
| 5733 | } |
| 5734 | |
| 5735 | static void |
| 5736 | sensor_match_proxy_iface_init (SensorMatchIface *iface) |
| 5737 | { |
| 5738 | iface->get_match_value = sensor_match_proxy_get_match_value; |
| 5739 | iface->get_state = sensor_match_proxy_get_state; |
| 5740 | } |
| 5741 | |
| 5742 | /** |
| 5743 | * sensor_match_proxy_new: |
| 5744 | * @connection: A #GDBusConnection. |
| 5745 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5746 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5747 | * @object_path: An object path. |
| 5748 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5749 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5750 | * @user_data: User data to pass to @callback. |
| 5751 | * |
| 5752 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details. |
| 5753 | * |
| 5754 | * 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. |
| 5755 | * You can then call sensor_match_proxy_new_finish() to get the result of the operation. |
| 5756 | * |
| 5757 | * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. |
| 5758 | */ |
| 5759 | void |
| 5760 | sensor_match_proxy_new ( |
| 5761 | GDBusConnection *connection, |
| 5762 | GDBusProxyFlags flags, |
| 5763 | const gchar *name, |
| 5764 | const gchar *object_path, |
| 5765 | GCancellable *cancellable, |
| 5766 | GAsyncReadyCallback callback, |
| 5767 | gpointer user_data) |
| 5768 | { |
| 5769 | g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); |
| 5770 | } |
| 5771 | |
| 5772 | /** |
| 5773 | * sensor_match_proxy_new_finish: |
| 5774 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). |
| 5775 | * @error: Return location for error or %NULL |
| 5776 | * |
| 5777 | * Finishes an operation started with sensor_match_proxy_new(). |
| 5778 | * |
| 5779 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 5780 | */ |
| 5781 | SensorMatch * |
| 5782 | sensor_match_proxy_new_finish ( |
| 5783 | GAsyncResult *res, |
| 5784 | GError **error) |
| 5785 | { |
| 5786 | GObject *ret; |
| 5787 | GObject *source_object; |
| 5788 | source_object = g_async_result_get_source_object (res); |
| 5789 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5790 | g_object_unref (source_object); |
| 5791 | if (ret != NULL) |
| 5792 | return SENSOR_MATCH (ret); |
| 5793 | else |
| 5794 | return NULL; |
| 5795 | } |
| 5796 | |
| 5797 | /** |
| 5798 | * sensor_match_proxy_new_sync: |
| 5799 | * @connection: A #GDBusConnection. |
| 5800 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5801 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 5802 | * @object_path: An object path. |
| 5803 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5804 | * @error: Return location for error or %NULL |
| 5805 | * |
| 5806 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details. |
| 5807 | * |
| 5808 | * The calling thread is blocked until a reply is received. |
| 5809 | * |
| 5810 | * See sensor_match_proxy_new() for the asynchronous version of this constructor. |
| 5811 | * |
| 5812 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 5813 | */ |
| 5814 | SensorMatch * |
| 5815 | sensor_match_proxy_new_sync ( |
| 5816 | GDBusConnection *connection, |
| 5817 | GDBusProxyFlags flags, |
| 5818 | const gchar *name, |
| 5819 | const gchar *object_path, |
| 5820 | GCancellable *cancellable, |
| 5821 | GError **error) |
| 5822 | { |
| 5823 | GInitable *ret; |
| 5824 | ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); |
| 5825 | if (ret != NULL) |
| 5826 | return SENSOR_MATCH (ret); |
| 5827 | else |
| 5828 | return NULL; |
| 5829 | } |
| 5830 | |
| 5831 | |
| 5832 | /** |
| 5833 | * sensor_match_proxy_new_for_bus: |
| 5834 | * @bus_type: A #GBusType. |
| 5835 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5836 | * @name: A bus name (well-known or unique). |
| 5837 | * @object_path: An object path. |
| 5838 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5839 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 5840 | * @user_data: User data to pass to @callback. |
| 5841 | * |
| 5842 | * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
| 5843 | * |
| 5844 | * 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. |
| 5845 | * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. |
| 5846 | * |
| 5847 | * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 5848 | */ |
| 5849 | void |
| 5850 | sensor_match_proxy_new_for_bus ( |
| 5851 | GBusType bus_type, |
| 5852 | GDBusProxyFlags flags, |
| 5853 | const gchar *name, |
| 5854 | const gchar *object_path, |
| 5855 | GCancellable *cancellable, |
| 5856 | GAsyncReadyCallback callback, |
| 5857 | gpointer user_data) |
| 5858 | { |
| 5859 | g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); |
| 5860 | } |
| 5861 | |
| 5862 | /** |
| 5863 | * sensor_match_proxy_new_for_bus_finish: |
| 5864 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). |
| 5865 | * @error: Return location for error or %NULL |
| 5866 | * |
| 5867 | * Finishes an operation started with sensor_match_proxy_new_for_bus(). |
| 5868 | * |
| 5869 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 5870 | */ |
| 5871 | SensorMatch * |
| 5872 | sensor_match_proxy_new_for_bus_finish ( |
| 5873 | GAsyncResult *res, |
| 5874 | GError **error) |
| 5875 | { |
| 5876 | GObject *ret; |
| 5877 | GObject *source_object; |
| 5878 | source_object = g_async_result_get_source_object (res); |
| 5879 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5880 | g_object_unref (source_object); |
| 5881 | if (ret != NULL) |
| 5882 | return SENSOR_MATCH (ret); |
| 5883 | else |
| 5884 | return NULL; |
| 5885 | } |
| 5886 | |
| 5887 | /** |
| 5888 | * sensor_match_proxy_new_for_bus_sync: |
| 5889 | * @bus_type: A #GBusType. |
| 5890 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
| 5891 | * @name: A bus name (well-known or unique). |
| 5892 | * @object_path: An object path. |
| 5893 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 5894 | * @error: Return location for error or %NULL |
| 5895 | * |
| 5896 | * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 5897 | * |
| 5898 | * The calling thread is blocked until a reply is received. |
| 5899 | * |
| 5900 | * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. |
| 5901 | * |
| 5902 | * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. |
| 5903 | */ |
| 5904 | SensorMatch * |
| 5905 | sensor_match_proxy_new_for_bus_sync ( |
| 5906 | GBusType bus_type, |
| 5907 | GDBusProxyFlags flags, |
| 5908 | const gchar *name, |
| 5909 | const gchar *object_path, |
| 5910 | GCancellable *cancellable, |
| 5911 | GError **error) |
| 5912 | { |
| 5913 | GInitable *ret; |
| 5914 | ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); |
| 5915 | if (ret != NULL) |
| 5916 | return SENSOR_MATCH (ret); |
| 5917 | else |
| 5918 | return NULL; |
| 5919 | } |
| 5920 | |
| 5921 | |
| 5922 | /* ------------------------------------------------------------------------ */ |
| 5923 | |
| 5924 | /** |
| 5925 | * SensorMatchSkeleton: |
| 5926 | * |
| 5927 | * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. |
| 5928 | */ |
| 5929 | |
| 5930 | /** |
| 5931 | * SensorMatchSkeletonClass: |
| 5932 | * @parent_class: The parent class. |
| 5933 | * |
| 5934 | * Class structure for #SensorMatchSkeleton. |
| 5935 | */ |
| 5936 | |
| 5937 | struct _SensorMatchSkeletonPrivate |
| 5938 | { |
| 5939 | GValue *properties; |
| 5940 | GList *changed_properties; |
| 5941 | GSource *changed_properties_idle_source; |
| 5942 | GMainContext *context; |
| 5943 | GMutex lock; |
| 5944 | }; |
| 5945 | |
| 5946 | static void |
| 5947 | _sensor_match_skeleton_handle_method_call ( |
| 5948 | GDBusConnection *connection G_GNUC_UNUSED, |
| 5949 | const gchar *sender G_GNUC_UNUSED, |
| 5950 | const gchar *object_path G_GNUC_UNUSED, |
| 5951 | const gchar *interface_name, |
| 5952 | const gchar *method_name, |
| 5953 | GVariant *parameters, |
| 5954 | GDBusMethodInvocation *invocation, |
| 5955 | gpointer user_data) |
| 5956 | { |
| 5957 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 5958 | _ExtendedGDBusMethodInfo *info; |
| 5959 | GVariantIter iter; |
| 5960 | GVariant *child; |
| 5961 | GValue *paramv; |
| 5962 | guint num_params; |
| 5963 | guint num_extra; |
| 5964 | guint n; |
| 5965 | guint signal_id; |
| 5966 | GValue return_value = G_VALUE_INIT; |
| 5967 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 5968 | g_assert (info != NULL); |
| 5969 | num_params = g_variant_n_children (parameters); |
| 5970 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 5971 | n = 0; |
| 5972 | g_value_init (¶mv[n], TYPE_SENSOR_MATCH); |
| 5973 | g_value_set_object (¶mv[n++], skeleton); |
| 5974 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 5975 | g_value_set_object (¶mv[n++], invocation); |
| 5976 | if (info->pass_fdlist) |
| 5977 | { |
| 5978 | #ifdef G_OS_UNIX |
| 5979 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 5980 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 5981 | #else |
| 5982 | g_assert_not_reached (); |
| 5983 | #endif |
| 5984 | } |
| 5985 | g_variant_iter_init (&iter, parameters); |
| 5986 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5987 | { |
| 5988 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 5989 | if (arg_info->use_gvariant) |
| 5990 | { |
| 5991 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5992 | g_value_set_variant (¶mv[n], child); |
| 5993 | n++; |
| 5994 | } |
| 5995 | else |
| 5996 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5997 | g_variant_unref (child); |
| 5998 | } |
| 5999 | signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); |
| 6000 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 6001 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 6002 | if (!g_value_get_boolean (&return_value)) |
| 6003 | 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); |
| 6004 | g_value_unset (&return_value); |
| 6005 | for (n = 0; n < num_params + num_extra; n++) |
| 6006 | g_value_unset (¶mv[n]); |
| 6007 | g_free (paramv); |
| 6008 | } |
| 6009 | |
| 6010 | static GVariant * |
| 6011 | _sensor_match_skeleton_handle_get_property ( |
| 6012 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6013 | const gchar *sender G_GNUC_UNUSED, |
| 6014 | const gchar *object_path G_GNUC_UNUSED, |
| 6015 | const gchar *interface_name G_GNUC_UNUSED, |
| 6016 | const gchar *property_name, |
| 6017 | GError **error, |
| 6018 | gpointer user_data) |
| 6019 | { |
| 6020 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 6021 | GValue value = G_VALUE_INIT; |
| 6022 | GParamSpec *pspec; |
| 6023 | _ExtendedGDBusPropertyInfo *info; |
| 6024 | GVariant *ret; |
| 6025 | ret = NULL; |
| 6026 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 6027 | g_assert (info != NULL); |
| 6028 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6029 | if (pspec == NULL) |
| 6030 | { |
| 6031 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6032 | } |
| 6033 | else |
| 6034 | { |
| 6035 | g_value_init (&value, pspec->value_type); |
| 6036 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6037 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 6038 | g_value_unset (&value); |
| 6039 | } |
| 6040 | return ret; |
| 6041 | } |
| 6042 | |
| 6043 | static gboolean |
| 6044 | _sensor_match_skeleton_handle_set_property ( |
| 6045 | GDBusConnection *connection G_GNUC_UNUSED, |
| 6046 | const gchar *sender G_GNUC_UNUSED, |
| 6047 | const gchar *object_path G_GNUC_UNUSED, |
| 6048 | const gchar *interface_name G_GNUC_UNUSED, |
| 6049 | const gchar *property_name, |
| 6050 | GVariant *variant, |
| 6051 | GError **error, |
| 6052 | gpointer user_data) |
| 6053 | { |
| 6054 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 6055 | GValue value = G_VALUE_INIT; |
| 6056 | GParamSpec *pspec; |
| 6057 | _ExtendedGDBusPropertyInfo *info; |
| 6058 | gboolean ret; |
| 6059 | ret = FALSE; |
| 6060 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); |
| 6061 | g_assert (info != NULL); |
| 6062 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6063 | if (pspec == NULL) |
| 6064 | { |
| 6065 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6066 | } |
| 6067 | else |
| 6068 | { |
| 6069 | if (info->use_gvariant) |
| 6070 | g_value_set_variant (&value, variant); |
| 6071 | else |
| 6072 | g_dbus_gvariant_to_gvalue (variant, &value); |
| 6073 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6074 | g_value_unset (&value); |
| 6075 | ret = TRUE; |
| 6076 | } |
| 6077 | return ret; |
| 6078 | } |
| 6079 | |
| 6080 | static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = |
| 6081 | { |
| 6082 | _sensor_match_skeleton_handle_method_call, |
| 6083 | _sensor_match_skeleton_handle_get_property, |
| 6084 | _sensor_match_skeleton_handle_set_property, |
| 6085 | {NULL} |
| 6086 | }; |
| 6087 | |
| 6088 | static GDBusInterfaceInfo * |
| 6089 | sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6090 | { |
| 6091 | return sensor_match_interface_info (); |
| 6092 | } |
| 6093 | |
| 6094 | static GDBusInterfaceVTable * |
| 6095 | sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6096 | { |
| 6097 | return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; |
| 6098 | } |
| 6099 | |
| 6100 | static GVariant * |
| 6101 | sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 6102 | { |
| 6103 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 6104 | |
| 6105 | GVariantBuilder builder; |
| 6106 | guint n; |
| 6107 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6108 | if (_sensor_match_interface_info.parent_struct.properties == NULL) |
| 6109 | goto out; |
| 6110 | for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) |
| 6111 | { |
| 6112 | GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; |
| 6113 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 6114 | { |
| 6115 | GVariant *value; |
| 6116 | value = _sensor_match_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", info->name, NULL, skeleton); |
| 6117 | if (value != NULL) |
| 6118 | { |
| 6119 | g_variant_take_ref (value); |
| 6120 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 6121 | g_variant_unref (value); |
| 6122 | } |
| 6123 | } |
| 6124 | } |
| 6125 | out: |
| 6126 | return g_variant_builder_end (&builder); |
| 6127 | } |
| 6128 | |
| 6129 | static gboolean _sensor_match_emit_changed (gpointer user_data); |
| 6130 | |
| 6131 | static void |
| 6132 | sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 6133 | { |
| 6134 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); |
| 6135 | gboolean emit_changed = FALSE; |
| 6136 | |
| 6137 | g_mutex_lock (&skeleton->priv->lock); |
| 6138 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6139 | { |
| 6140 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6141 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6142 | emit_changed = TRUE; |
| 6143 | } |
| 6144 | g_mutex_unlock (&skeleton->priv->lock); |
| 6145 | |
| 6146 | if (emit_changed) |
| 6147 | _sensor_match_emit_changed (skeleton); |
| 6148 | } |
| 6149 | |
| 6150 | static void |
| 6151 | _sensor_match_on_signal_sensor_match ( |
| 6152 | SensorMatch *object, |
| 6153 | guchar arg_state) |
| 6154 | { |
| 6155 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6156 | |
| 6157 | GList *connections, *l; |
| 6158 | GVariant *signal_variant; |
| 6159 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6160 | |
| 6161 | signal_variant = g_variant_ref_sink (g_variant_new ("(y)", |
| 6162 | arg_state)); |
| 6163 | for (l = connections; l != NULL; l = l->next) |
| 6164 | { |
| 6165 | GDBusConnection *connection = l->data; |
| 6166 | g_dbus_connection_emit_signal (connection, |
| 6167 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", |
| 6168 | signal_variant, NULL); |
| 6169 | } |
| 6170 | g_variant_unref (signal_variant); |
| 6171 | g_list_free_full (connections, g_object_unref); |
| 6172 | } |
| 6173 | |
| 6174 | static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); |
| 6175 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6176 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6177 | G_ADD_PRIVATE (SensorMatchSkeleton) |
| 6178 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 6179 | |
| 6180 | #else |
| 6181 | G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6182 | G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); |
| 6183 | |
| 6184 | #endif |
| 6185 | static void |
| 6186 | sensor_match_skeleton_finalize (GObject *object) |
| 6187 | { |
| 6188 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6189 | guint n; |
| 6190 | for (n = 0; n < 2; n++) |
| 6191 | g_value_unset (&skeleton->priv->properties[n]); |
| 6192 | g_free (skeleton->priv->properties); |
| 6193 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6194 | if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6195 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6196 | g_main_context_unref (skeleton->priv->context); |
| 6197 | g_mutex_clear (&skeleton->priv->lock); |
| 6198 | G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); |
| 6199 | } |
| 6200 | |
| 6201 | static void |
| 6202 | sensor_match_skeleton_get_property (GObject *object, |
| 6203 | guint prop_id, |
| 6204 | GValue *value, |
| 6205 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6206 | { |
| 6207 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6208 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6209 | g_mutex_lock (&skeleton->priv->lock); |
| 6210 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 6211 | g_mutex_unlock (&skeleton->priv->lock); |
| 6212 | } |
| 6213 | |
| 6214 | static gboolean |
| 6215 | _sensor_match_emit_changed (gpointer user_data) |
| 6216 | { |
| 6217 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); |
| 6218 | GList *l; |
| 6219 | GVariantBuilder builder; |
| 6220 | GVariantBuilder invalidated_builder; |
| 6221 | guint num_changes; |
| 6222 | |
| 6223 | g_mutex_lock (&skeleton->priv->lock); |
| 6224 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6225 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6226 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 6227 | { |
| 6228 | ChangedProperty *cp = l->data; |
| 6229 | GVariant *variant; |
| 6230 | const GValue *cur_value; |
| 6231 | |
| 6232 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 6233 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 6234 | { |
| 6235 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 6236 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 6237 | g_variant_unref (variant); |
| 6238 | num_changes++; |
| 6239 | } |
| 6240 | } |
| 6241 | if (num_changes > 0) |
| 6242 | { |
| 6243 | GList *connections, *ll; |
| 6244 | GVariant *signal_variant; |
| 6245 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", |
| 6246 | &builder, &invalidated_builder)); |
| 6247 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6248 | for (ll = connections; ll != NULL; ll = ll->next) |
| 6249 | { |
| 6250 | GDBusConnection *connection = ll->data; |
| 6251 | |
| 6252 | g_dbus_connection_emit_signal (connection, |
| 6253 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6254 | "org.freedesktop.DBus.Properties", |
| 6255 | "PropertiesChanged", |
| 6256 | signal_variant, |
| 6257 | NULL); |
| 6258 | } |
| 6259 | g_variant_unref (signal_variant); |
| 6260 | g_list_free_full (connections, g_object_unref); |
| 6261 | } |
| 6262 | else |
| 6263 | { |
| 6264 | g_variant_builder_clear (&builder); |
| 6265 | g_variant_builder_clear (&invalidated_builder); |
| 6266 | } |
| 6267 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6268 | skeleton->priv->changed_properties = NULL; |
| 6269 | skeleton->priv->changed_properties_idle_source = NULL; |
| 6270 | g_mutex_unlock (&skeleton->priv->lock); |
| 6271 | return FALSE; |
| 6272 | } |
| 6273 | |
| 6274 | static void |
| 6275 | _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6276 | { |
| 6277 | ChangedProperty *cp; |
| 6278 | GList *l; |
| 6279 | cp = NULL; |
| 6280 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 6281 | { |
| 6282 | ChangedProperty *i_cp = l->data; |
| 6283 | if (i_cp->info == info) |
| 6284 | { |
| 6285 | cp = i_cp; |
| 6286 | break; |
| 6287 | } |
| 6288 | } |
| 6289 | if (cp == NULL) |
| 6290 | { |
| 6291 | cp = g_new0 (ChangedProperty, 1); |
| 6292 | cp->prop_id = prop_id; |
| 6293 | cp->info = info; |
| 6294 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 6295 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 6296 | g_value_copy (orig_value, &cp->orig_value); |
| 6297 | } |
| 6298 | } |
| 6299 | |
| 6300 | static void |
| 6301 | sensor_match_skeleton_notify (GObject *object, |
| 6302 | GParamSpec *pspec G_GNUC_UNUSED) |
| 6303 | { |
| 6304 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6305 | g_mutex_lock (&skeleton->priv->lock); |
| 6306 | if (skeleton->priv->changed_properties != NULL && |
| 6307 | skeleton->priv->changed_properties_idle_source == NULL) |
| 6308 | { |
| 6309 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 6310 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 6311 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 6312 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 6313 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 6314 | } |
| 6315 | g_mutex_unlock (&skeleton->priv->lock); |
| 6316 | } |
| 6317 | |
| 6318 | static void |
| 6319 | sensor_match_skeleton_set_property (GObject *object, |
| 6320 | guint prop_id, |
| 6321 | const GValue *value, |
| 6322 | GParamSpec *pspec) |
| 6323 | { |
| 6324 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6325 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6326 | g_mutex_lock (&skeleton->priv->lock); |
| 6327 | g_object_freeze_notify (object); |
| 6328 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 6329 | { |
| 6330 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
| 6331 | _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 6332 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 6333 | g_object_notify_by_pspec (object, pspec); |
| 6334 | } |
| 6335 | g_mutex_unlock (&skeleton->priv->lock); |
| 6336 | g_object_thaw_notify (object); |
| 6337 | } |
| 6338 | |
| 6339 | static void |
| 6340 | sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) |
| 6341 | { |
| 6342 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6343 | skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); |
| 6344 | #else |
| 6345 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); |
| 6346 | #endif |
| 6347 | |
| 6348 | g_mutex_init (&skeleton->priv->lock); |
| 6349 | skeleton->priv->context = g_main_context_ref_thread_default (); |
| 6350 | skeleton->priv->properties = g_new0 (GValue, 2); |
| 6351 | g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); |
| 6352 | g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); |
| 6353 | } |
| 6354 | |
| 6355 | static GVariant * |
| 6356 | sensor_match_skeleton_get_match_value (SensorMatch *object) |
| 6357 | { |
| 6358 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6359 | GVariant *value; |
| 6360 | g_mutex_lock (&skeleton->priv->lock); |
| 6361 | value = g_value_get_variant (&(skeleton->priv->properties[0])); |
| 6362 | g_mutex_unlock (&skeleton->priv->lock); |
| 6363 | return value; |
| 6364 | } |
| 6365 | |
| 6366 | static guchar |
| 6367 | sensor_match_skeleton_get_state (SensorMatch *object) |
| 6368 | { |
| 6369 | SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); |
| 6370 | guchar value; |
| 6371 | g_mutex_lock (&skeleton->priv->lock); |
| 6372 | value = g_value_get_uchar (&(skeleton->priv->properties[1])); |
| 6373 | g_mutex_unlock (&skeleton->priv->lock); |
| 6374 | return value; |
| 6375 | } |
| 6376 | |
| 6377 | static void |
| 6378 | sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) |
| 6379 | { |
| 6380 | GObjectClass *gobject_class; |
| 6381 | GDBusInterfaceSkeletonClass *skeleton_class; |
| 6382 | |
| 6383 | gobject_class = G_OBJECT_CLASS (klass); |
| 6384 | gobject_class->finalize = sensor_match_skeleton_finalize; |
| 6385 | gobject_class->get_property = sensor_match_skeleton_get_property; |
| 6386 | gobject_class->set_property = sensor_match_skeleton_set_property; |
| 6387 | gobject_class->notify = sensor_match_skeleton_notify; |
| 6388 | |
| 6389 | |
| 6390 | sensor_match_override_properties (gobject_class, 1); |
| 6391 | |
| 6392 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 6393 | skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; |
| 6394 | skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; |
| 6395 | skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; |
| 6396 | skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; |
| 6397 | |
| 6398 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6399 | g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); |
| 6400 | #endif |
| 6401 | } |
| 6402 | |
| 6403 | static void |
| 6404 | sensor_match_skeleton_iface_init (SensorMatchIface *iface) |
| 6405 | { |
| 6406 | iface->sensor_match = _sensor_match_on_signal_sensor_match; |
| 6407 | iface->get_match_value = sensor_match_skeleton_get_match_value; |
| 6408 | iface->get_state = sensor_match_skeleton_get_state; |
| 6409 | } |
| 6410 | |
| 6411 | /** |
| 6412 | * sensor_match_skeleton_new: |
| 6413 | * |
| 6414 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. |
| 6415 | * |
| 6416 | * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. |
| 6417 | */ |
| 6418 | SensorMatch * |
| 6419 | sensor_match_skeleton_new (void) |
| 6420 | { |
| 6421 | return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); |
| 6422 | } |
| 6423 | |
| 6424 | /* ------------------------------------------------------------------------ |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6425 | * Code for Object, ObjectProxy and ObjectSkeleton |
| 6426 | * ------------------------------------------------------------------------ |
| 6427 | */ |
| 6428 | |
| 6429 | /** |
| 6430 | * SECTION:Object |
| 6431 | * @title: Object |
| 6432 | * @short_description: Specialized GDBusObject types |
| 6433 | * |
| 6434 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. |
| 6435 | */ |
| 6436 | |
| 6437 | /** |
| 6438 | * Object: |
| 6439 | * |
| 6440 | * The #Object type is a specialized container of interfaces. |
| 6441 | */ |
| 6442 | |
| 6443 | /** |
| 6444 | * ObjectIface: |
| 6445 | * @parent_iface: The parent interface. |
| 6446 | * |
| 6447 | * Virtual table for the #Object interface. |
| 6448 | */ |
| 6449 | |
| 6450 | typedef ObjectIface ObjectInterface; |
| 6451 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); |
| 6452 | |
| 6453 | static void |
| 6454 | object_default_init (ObjectIface *iface) |
| 6455 | { |
| 6456 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6457 | * Object:sensor-value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6458 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6459 | * 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] | 6460 | * |
| 6461 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 6462 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6463 | 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] | 6464 | |
| 6465 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6466 | * Object:sensor-threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6467 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6468 | * 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] | 6469 | * |
| 6470 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 6471 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6472 | 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] | 6473 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6474 | /** |
| 6475 | * Object:sensor-i2c: |
| 6476 | * |
| 6477 | * 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. |
| 6478 | * |
| 6479 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 6480 | */ |
| 6481 | 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)); |
| 6482 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6483 | /** |
| 6484 | * Object:sensor-match: |
| 6485 | * |
| 6486 | * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any. |
| 6487 | * |
| 6488 | * Connect to the #GObject::notify signal to get informed of property changes. |
| 6489 | */ |
| 6490 | g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); |
| 6491 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6492 | } |
| 6493 | |
| 6494 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6495 | * object_get_sensor_value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6496 | * @object: A #Object. |
| 6497 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6498 | * 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] | 6499 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6500 | * 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] | 6501 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6502 | SensorValue *object_get_sensor_value (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6503 | { |
| 6504 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6505 | 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] | 6506 | if (ret == NULL) |
| 6507 | return NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6508 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6509 | } |
| 6510 | |
| 6511 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6512 | * object_get_sensor_threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6513 | * @object: A #Object. |
| 6514 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6515 | * 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] | 6516 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6517 | * 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] | 6518 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6519 | SensorThreshold *object_get_sensor_threshold (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6520 | { |
| 6521 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6522 | 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] | 6523 | if (ret == NULL) |
| 6524 | return NULL; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6525 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 6526 | } |
| 6527 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6528 | /** |
| 6529 | * object_get_sensor_i2c: |
| 6530 | * @object: A #Object. |
| 6531 | * |
| 6532 | * 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. |
| 6533 | * |
| 6534 | * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 6535 | */ |
| 6536 | SensorI2c *object_get_sensor_i2c (Object *object) |
| 6537 | { |
| 6538 | GDBusInterface *ret; |
| 6539 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 6540 | if (ret == NULL) |
| 6541 | return NULL; |
| 6542 | return SENSOR_I2C (ret); |
| 6543 | } |
| 6544 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6545 | /** |
| 6546 | * object_get_sensor_match: |
| 6547 | * @object: A #Object. |
| 6548 | * |
| 6549 | * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any. |
| 6550 | * |
| 6551 | * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. |
| 6552 | */ |
| 6553 | SensorMatch *object_get_sensor_match (Object *object) |
| 6554 | { |
| 6555 | GDBusInterface *ret; |
| 6556 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 6557 | if (ret == NULL) |
| 6558 | return NULL; |
| 6559 | return SENSOR_MATCH (ret); |
| 6560 | } |
| 6561 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6562 | |
| 6563 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6564 | * object_peek_sensor_value: (skip) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6565 | * @object: A #Object. |
| 6566 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6567 | * 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] | 6568 | * |
| 6569 | * <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> |
| 6570 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6571 | * 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] | 6572 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6573 | SensorValue *object_peek_sensor_value (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6574 | { |
| 6575 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6576 | 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] | 6577 | if (ret == NULL) |
| 6578 | return NULL; |
| 6579 | g_object_unref (ret); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6580 | return SENSOR_VALUE (ret); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6581 | } |
| 6582 | |
| 6583 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6584 | * object_peek_sensor_threshold: (skip) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6585 | * @object: A #Object. |
| 6586 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6587 | * 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] | 6588 | * |
| 6589 | * <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> |
| 6590 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6591 | * 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] | 6592 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6593 | SensorThreshold *object_peek_sensor_threshold (Object *object) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6594 | { |
| 6595 | GDBusInterface *ret; |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6596 | 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] | 6597 | if (ret == NULL) |
| 6598 | return NULL; |
| 6599 | g_object_unref (ret); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6600 | return SENSOR_THRESHOLD (ret); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 6601 | } |
| 6602 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6603 | /** |
| 6604 | * object_peek_sensor_i2c: (skip) |
| 6605 | * @object: A #Object. |
| 6606 | * |
| 6607 | * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. |
| 6608 | * |
| 6609 | * <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> |
| 6610 | * |
| 6611 | * 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. |
| 6612 | */ |
| 6613 | SensorI2c *object_peek_sensor_i2c (Object *object) |
| 6614 | { |
| 6615 | GDBusInterface *ret; |
| 6616 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); |
| 6617 | if (ret == NULL) |
| 6618 | return NULL; |
| 6619 | g_object_unref (ret); |
| 6620 | return SENSOR_I2C (ret); |
| 6621 | } |
| 6622 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6623 | /** |
| 6624 | * object_peek_sensor_match: (skip) |
| 6625 | * @object: A #Object. |
| 6626 | * |
| 6627 | * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. |
| 6628 | * |
| 6629 | * <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> |
| 6630 | * |
| 6631 | * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. |
| 6632 | */ |
| 6633 | SensorMatch *object_peek_sensor_match (Object *object) |
| 6634 | { |
| 6635 | GDBusInterface *ret; |
| 6636 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 6637 | if (ret == NULL) |
| 6638 | return NULL; |
| 6639 | g_object_unref (ret); |
| 6640 | return SENSOR_MATCH (ret); |
| 6641 | } |
| 6642 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6643 | |
| 6644 | static void |
| 6645 | object_notify (GDBusObject *object, GDBusInterface *interface) |
| 6646 | { |
| 6647 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 6648 | /* info can be NULL if the other end is using a D-Bus interface we don't know |
| 6649 | * anything about, for example old generated code in this process talking to |
| 6650 | * newer generated code in the other process. */ |
| 6651 | if (info != NULL) |
| 6652 | g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 6653 | } |
| 6654 | |
| 6655 | /** |
| 6656 | * ObjectProxy: |
| 6657 | * |
| 6658 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. |
| 6659 | */ |
| 6660 | |
| 6661 | /** |
| 6662 | * ObjectProxyClass: |
| 6663 | * @parent_class: The parent class. |
| 6664 | * |
| 6665 | * Class structure for #ObjectProxy. |
| 6666 | */ |
| 6667 | |
| 6668 | static void |
| 6669 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 6670 | { |
| 6671 | } |
| 6672 | |
| 6673 | static void |
| 6674 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 6675 | { |
| 6676 | iface->interface_added = object_notify; |
| 6677 | iface->interface_removed = object_notify; |
| 6678 | } |
| 6679 | |
| 6680 | |
| 6681 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 6682 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) |
| 6683 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); |
| 6684 | |
| 6685 | static void |
| 6686 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) |
| 6687 | { |
| 6688 | } |
| 6689 | |
| 6690 | static void |
| 6691 | object_proxy_set_property (GObject *gobject, |
| 6692 | guint prop_id, |
| 6693 | const GValue *value G_GNUC_UNUSED, |
| 6694 | GParamSpec *pspec) |
| 6695 | { |
| 6696 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6697 | } |
| 6698 | |
| 6699 | static void |
| 6700 | object_proxy_get_property (GObject *gobject, |
| 6701 | guint prop_id, |
| 6702 | GValue *value, |
| 6703 | GParamSpec *pspec) |
| 6704 | { |
| 6705 | ObjectProxy *object = OBJECT_PROXY (gobject); |
| 6706 | GDBusInterface *interface; |
| 6707 | |
| 6708 | switch (prop_id) |
| 6709 | { |
| 6710 | case 1: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6711 | 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] | 6712 | g_value_take_object (value, interface); |
| 6713 | break; |
| 6714 | |
| 6715 | case 2: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6716 | 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] | 6717 | g_value_take_object (value, interface); |
| 6718 | break; |
| 6719 | |
| 6720 | case 3: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6721 | 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] | 6722 | g_value_take_object (value, interface); |
| 6723 | break; |
| 6724 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6725 | case 4: |
| 6726 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 6727 | g_value_take_object (value, interface); |
| 6728 | break; |
| 6729 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6730 | default: |
| 6731 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6732 | break; |
| 6733 | } |
| 6734 | } |
| 6735 | |
| 6736 | static void |
| 6737 | object_proxy_class_init (ObjectProxyClass *klass) |
| 6738 | { |
| 6739 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 6740 | |
| 6741 | gobject_class->set_property = object_proxy_set_property; |
| 6742 | gobject_class->get_property = object_proxy_get_property; |
| 6743 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6744 | g_object_class_override_property (gobject_class, 1, "sensor-value"); |
| 6745 | g_object_class_override_property (gobject_class, 2, "sensor-threshold"); |
| 6746 | g_object_class_override_property (gobject_class, 3, "sensor-i2c"); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6747 | g_object_class_override_property (gobject_class, 4, "sensor-match"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6748 | } |
| 6749 | |
| 6750 | /** |
| 6751 | * object_proxy_new: |
| 6752 | * @connection: A #GDBusConnection. |
| 6753 | * @object_path: An object path. |
| 6754 | * |
| 6755 | * Creates a new proxy object. |
| 6756 | * |
| 6757 | * Returns: (transfer full): The proxy object. |
| 6758 | */ |
| 6759 | ObjectProxy * |
| 6760 | object_proxy_new (GDBusConnection *connection, |
| 6761 | const gchar *object_path) |
| 6762 | { |
| 6763 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 6764 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 6765 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 6766 | } |
| 6767 | |
| 6768 | /** |
| 6769 | * ObjectSkeleton: |
| 6770 | * |
| 6771 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. |
| 6772 | */ |
| 6773 | |
| 6774 | /** |
| 6775 | * ObjectSkeletonClass: |
| 6776 | * @parent_class: The parent class. |
| 6777 | * |
| 6778 | * Class structure for #ObjectSkeleton. |
| 6779 | */ |
| 6780 | |
| 6781 | static void |
| 6782 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) |
| 6783 | { |
| 6784 | } |
| 6785 | |
| 6786 | |
| 6787 | static void |
| 6788 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 6789 | { |
| 6790 | iface->interface_added = object_notify; |
| 6791 | iface->interface_removed = object_notify; |
| 6792 | } |
| 6793 | |
| 6794 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 6795 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) |
| 6796 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); |
| 6797 | |
| 6798 | static void |
| 6799 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) |
| 6800 | { |
| 6801 | } |
| 6802 | |
| 6803 | static void |
| 6804 | object_skeleton_set_property (GObject *gobject, |
| 6805 | guint prop_id, |
| 6806 | const GValue *value, |
| 6807 | GParamSpec *pspec) |
| 6808 | { |
| 6809 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 6810 | GDBusInterfaceSkeleton *interface; |
| 6811 | |
| 6812 | switch (prop_id) |
| 6813 | { |
| 6814 | case 1: |
| 6815 | interface = g_value_get_object (value); |
| 6816 | if (interface != NULL) |
| 6817 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6818 | g_warn_if_fail (IS_SENSOR_VALUE (interface)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6819 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6820 | } |
| 6821 | else |
| 6822 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6823 | 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] | 6824 | } |
| 6825 | break; |
| 6826 | |
| 6827 | case 2: |
| 6828 | interface = g_value_get_object (value); |
| 6829 | if (interface != NULL) |
| 6830 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6831 | g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6832 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6833 | } |
| 6834 | else |
| 6835 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6836 | 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] | 6837 | } |
| 6838 | break; |
| 6839 | |
| 6840 | case 3: |
| 6841 | interface = g_value_get_object (value); |
| 6842 | if (interface != NULL) |
| 6843 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6844 | g_warn_if_fail (IS_SENSOR_I2C (interface)); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 6845 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6846 | } |
| 6847 | else |
| 6848 | { |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6849 | 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] | 6850 | } |
| 6851 | break; |
| 6852 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6853 | case 4: |
| 6854 | interface = g_value_get_object (value); |
| 6855 | if (interface != NULL) |
| 6856 | { |
| 6857 | g_warn_if_fail (IS_SENSOR_MATCH (interface)); |
| 6858 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6859 | } |
| 6860 | else |
| 6861 | { |
| 6862 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); |
| 6863 | } |
| 6864 | break; |
| 6865 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6866 | default: |
| 6867 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6868 | break; |
| 6869 | } |
| 6870 | } |
| 6871 | |
| 6872 | static void |
| 6873 | object_skeleton_get_property (GObject *gobject, |
| 6874 | guint prop_id, |
| 6875 | GValue *value, |
| 6876 | GParamSpec *pspec) |
| 6877 | { |
| 6878 | ObjectSkeleton *object = OBJECT_SKELETON (gobject); |
| 6879 | GDBusInterface *interface; |
| 6880 | |
| 6881 | switch (prop_id) |
| 6882 | { |
| 6883 | case 1: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6884 | 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] | 6885 | g_value_take_object (value, interface); |
| 6886 | break; |
| 6887 | |
| 6888 | case 2: |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6889 | 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] | 6890 | g_value_take_object (value, interface); |
| 6891 | break; |
| 6892 | |
| 6893 | case 3: |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6894 | 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] | 6895 | g_value_take_object (value, interface); |
| 6896 | break; |
| 6897 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6898 | case 4: |
| 6899 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); |
| 6900 | g_value_take_object (value, interface); |
| 6901 | break; |
| 6902 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6903 | default: |
| 6904 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6905 | break; |
| 6906 | } |
| 6907 | } |
| 6908 | |
| 6909 | static void |
| 6910 | object_skeleton_class_init (ObjectSkeletonClass *klass) |
| 6911 | { |
| 6912 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 6913 | |
| 6914 | gobject_class->set_property = object_skeleton_set_property; |
| 6915 | gobject_class->get_property = object_skeleton_get_property; |
| 6916 | |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6917 | g_object_class_override_property (gobject_class, 1, "sensor-value"); |
| 6918 | g_object_class_override_property (gobject_class, 2, "sensor-threshold"); |
| 6919 | g_object_class_override_property (gobject_class, 3, "sensor-i2c"); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6920 | g_object_class_override_property (gobject_class, 4, "sensor-match"); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6921 | } |
| 6922 | |
| 6923 | /** |
| 6924 | * object_skeleton_new: |
| 6925 | * @object_path: An object path. |
| 6926 | * |
| 6927 | * Creates a new skeleton object. |
| 6928 | * |
| 6929 | * Returns: (transfer full): The skeleton object. |
| 6930 | */ |
| 6931 | ObjectSkeleton * |
| 6932 | object_skeleton_new (const gchar *object_path) |
| 6933 | { |
| 6934 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 6935 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 6936 | } |
| 6937 | |
| 6938 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6939 | * object_skeleton_set_sensor_value: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6940 | * @object: A #ObjectSkeleton. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6941 | * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6942 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6943 | * 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] | 6944 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6945 | void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6946 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6947 | g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6948 | } |
| 6949 | |
| 6950 | /** |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6951 | * object_skeleton_set_sensor_threshold: |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6952 | * @object: A #ObjectSkeleton. |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6953 | * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6954 | * |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6955 | * 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] | 6956 | */ |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6957 | void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6958 | { |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 6959 | g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); |
Norman James | cc7ae12 | 2015-08-24 14:26:09 -0500 | [diff] [blame] | 6960 | } |
| 6961 | |
Norman James | 90baede | 2015-09-02 20:32:49 -0500 | [diff] [blame] | 6962 | /** |
| 6963 | * object_skeleton_set_sensor_i2c: |
| 6964 | * @object: A #ObjectSkeleton. |
| 6965 | * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. |
| 6966 | * |
| 6967 | * 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. |
| 6968 | */ |
| 6969 | void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) |
| 6970 | { |
| 6971 | g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); |
| 6972 | } |
| 6973 | |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 6974 | /** |
| 6975 | * object_skeleton_set_sensor_match: |
| 6976 | * @object: A #ObjectSkeleton. |
| 6977 | * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. |
| 6978 | * |
| 6979 | * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object. |
| 6980 | */ |
| 6981 | void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) |
| 6982 | { |
| 6983 | g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); |
| 6984 | } |
| 6985 | |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 6986 | |
| 6987 | /* ------------------------------------------------------------------------ |
| 6988 | * Code for ObjectManager client |
| 6989 | * ------------------------------------------------------------------------ |
| 6990 | */ |
| 6991 | |
| 6992 | /** |
| 6993 | * SECTION:ObjectManagerClient |
| 6994 | * @title: ObjectManagerClient |
| 6995 | * @short_description: Generated GDBusObjectManagerClient type |
| 6996 | * |
| 6997 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. |
| 6998 | */ |
| 6999 | |
| 7000 | /** |
| 7001 | * ObjectManagerClient: |
| 7002 | * |
| 7003 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. |
| 7004 | */ |
| 7005 | |
| 7006 | /** |
| 7007 | * ObjectManagerClientClass: |
| 7008 | * @parent_class: The parent class. |
| 7009 | * |
| 7010 | * Class structure for #ObjectManagerClient. |
| 7011 | */ |
| 7012 | |
| 7013 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); |
| 7014 | |
| 7015 | static void |
| 7016 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) |
| 7017 | { |
| 7018 | } |
| 7019 | |
| 7020 | static void |
| 7021 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 7022 | { |
| 7023 | } |
| 7024 | |
| 7025 | /** |
| 7026 | * object_manager_client_get_proxy_type: |
| 7027 | * @manager: A #GDBusObjectManagerClient. |
| 7028 | * @object_path: The object path of the remote object (unused). |
| 7029 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. |
| 7030 | * @user_data: User data (unused). |
| 7031 | * |
| 7032 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. |
| 7033 | * |
| 7034 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. |
| 7035 | */ |
| 7036 | GType |
| 7037 | 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) |
| 7038 | { |
| 7039 | static gsize once_init_value = 0; |
| 7040 | static GHashTable *lookup_hash; |
| 7041 | GType ret; |
| 7042 | |
| 7043 | if (interface_name == NULL) |
| 7044 | return TYPE_OBJECT_PROXY; |
| 7045 | if (g_once_init_enter (&once_init_value)) |
| 7046 | { |
| 7047 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
Norman James | 5d78b4d | 2015-09-05 13:34:34 -0500 | [diff] [blame] | 7048 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); |
| 7049 | 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] | 7050 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); |
Norman James | 9e6acf9 | 2015-09-08 07:00:04 -0500 | [diff] [blame^] | 7051 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); |
Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 7052 | g_once_init_leave (&once_init_value, 1); |
| 7053 | } |
| 7054 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); |
| 7055 | if (ret == (GType) 0) |
| 7056 | ret = G_TYPE_DBUS_PROXY; |
| 7057 | return ret; |
| 7058 | } |
| 7059 | |
| 7060 | /** |
| 7061 | * object_manager_client_new: |
| 7062 | * @connection: A #GDBusConnection. |
| 7063 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 7064 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7065 | * @object_path: An object path. |
| 7066 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7067 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7068 | * @user_data: User data to pass to @callback. |
| 7069 | * |
| 7070 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. |
| 7071 | * |
| 7072 | * 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. |
| 7073 | * You can then call object_manager_client_new_finish() to get the result of the operation. |
| 7074 | * |
| 7075 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. |
| 7076 | */ |
| 7077 | void |
| 7078 | object_manager_client_new ( |
| 7079 | GDBusConnection *connection, |
| 7080 | GDBusObjectManagerClientFlags flags, |
| 7081 | const gchar *name, |
| 7082 | const gchar *object_path, |
| 7083 | GCancellable *cancellable, |
| 7084 | GAsyncReadyCallback callback, |
| 7085 | gpointer user_data) |
| 7086 | { |
| 7087 | 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); |
| 7088 | } |
| 7089 | |
| 7090 | /** |
| 7091 | * object_manager_client_new_finish: |
| 7092 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). |
| 7093 | * @error: Return location for error or %NULL |
| 7094 | * |
| 7095 | * Finishes an operation started with object_manager_client_new(). |
| 7096 | * |
| 7097 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 7098 | */ |
| 7099 | GDBusObjectManager * |
| 7100 | object_manager_client_new_finish ( |
| 7101 | GAsyncResult *res, |
| 7102 | GError **error) |
| 7103 | { |
| 7104 | GObject *ret; |
| 7105 | GObject *source_object; |
| 7106 | source_object = g_async_result_get_source_object (res); |
| 7107 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7108 | g_object_unref (source_object); |
| 7109 | if (ret != NULL) |
| 7110 | return G_DBUS_OBJECT_MANAGER (ret); |
| 7111 | else |
| 7112 | return NULL; |
| 7113 | } |
| 7114 | |
| 7115 | /** |
| 7116 | * object_manager_client_new_sync: |
| 7117 | * @connection: A #GDBusConnection. |
| 7118 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 7119 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
| 7120 | * @object_path: An object path. |
| 7121 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7122 | * @error: Return location for error or %NULL |
| 7123 | * |
| 7124 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. |
| 7125 | * |
| 7126 | * The calling thread is blocked until a reply is received. |
| 7127 | * |
| 7128 | * See object_manager_client_new() for the asynchronous version of this constructor. |
| 7129 | * |
| 7130 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 7131 | */ |
| 7132 | GDBusObjectManager * |
| 7133 | object_manager_client_new_sync ( |
| 7134 | GDBusConnection *connection, |
| 7135 | GDBusObjectManagerClientFlags flags, |
| 7136 | const gchar *name, |
| 7137 | const gchar *object_path, |
| 7138 | GCancellable *cancellable, |
| 7139 | GError **error) |
| 7140 | { |
| 7141 | GInitable *ret; |
| 7142 | 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); |
| 7143 | if (ret != NULL) |
| 7144 | return G_DBUS_OBJECT_MANAGER (ret); |
| 7145 | else |
| 7146 | return NULL; |
| 7147 | } |
| 7148 | |
| 7149 | |
| 7150 | /** |
| 7151 | * object_manager_client_new_for_bus: |
| 7152 | * @bus_type: A #GBusType. |
| 7153 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 7154 | * @name: A bus name (well-known or unique). |
| 7155 | * @object_path: An object path. |
| 7156 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7157 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
| 7158 | * @user_data: User data to pass to @callback. |
| 7159 | * |
| 7160 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. |
| 7161 | * |
| 7162 | * 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. |
| 7163 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. |
| 7164 | * |
| 7165 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
| 7166 | */ |
| 7167 | void |
| 7168 | object_manager_client_new_for_bus ( |
| 7169 | GBusType bus_type, |
| 7170 | GDBusObjectManagerClientFlags flags, |
| 7171 | const gchar *name, |
| 7172 | const gchar *object_path, |
| 7173 | GCancellable *cancellable, |
| 7174 | GAsyncReadyCallback callback, |
| 7175 | gpointer user_data) |
| 7176 | { |
| 7177 | 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); |
| 7178 | } |
| 7179 | |
| 7180 | /** |
| 7181 | * object_manager_client_new_for_bus_finish: |
| 7182 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). |
| 7183 | * @error: Return location for error or %NULL |
| 7184 | * |
| 7185 | * Finishes an operation started with object_manager_client_new_for_bus(). |
| 7186 | * |
| 7187 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 7188 | */ |
| 7189 | GDBusObjectManager * |
| 7190 | object_manager_client_new_for_bus_finish ( |
| 7191 | GAsyncResult *res, |
| 7192 | GError **error) |
| 7193 | { |
| 7194 | GObject *ret; |
| 7195 | GObject *source_object; |
| 7196 | source_object = g_async_result_get_source_object (res); |
| 7197 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7198 | g_object_unref (source_object); |
| 7199 | if (ret != NULL) |
| 7200 | return G_DBUS_OBJECT_MANAGER (ret); |
| 7201 | else |
| 7202 | return NULL; |
| 7203 | } |
| 7204 | |
| 7205 | /** |
| 7206 | * object_manager_client_new_for_bus_sync: |
| 7207 | * @bus_type: A #GBusType. |
| 7208 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. |
| 7209 | * @name: A bus name (well-known or unique). |
| 7210 | * @object_path: An object path. |
| 7211 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
| 7212 | * @error: Return location for error or %NULL |
| 7213 | * |
| 7214 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
| 7215 | * |
| 7216 | * The calling thread is blocked until a reply is received. |
| 7217 | * |
| 7218 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. |
| 7219 | * |
| 7220 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. |
| 7221 | */ |
| 7222 | GDBusObjectManager * |
| 7223 | object_manager_client_new_for_bus_sync ( |
| 7224 | GBusType bus_type, |
| 7225 | GDBusObjectManagerClientFlags flags, |
| 7226 | const gchar *name, |
| 7227 | const gchar *object_path, |
| 7228 | GCancellable *cancellable, |
| 7229 | GError **error) |
| 7230 | { |
| 7231 | GInitable *ret; |
| 7232 | 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); |
| 7233 | if (ret != NULL) |
| 7234 | return G_DBUS_OBJECT_MANAGER (ret); |
| 7235 | else |
| 7236 | return NULL; |
| 7237 | } |
| 7238 | |
| 7239 | |