blob: bb80fd03131a9d055f8622f9edcad6c0c049ba41 [file] [log] [blame]
Norman Jamese2765102015-08-19 22:00:55 -05001/*
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
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static 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;
82out:
83 return ret;
84}
85
86static 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);
98out:
99 return ret;
100}
101
102G_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 James5d78b4d2015-09-05 13:34:34 -0500152 * Code for interface org.openbmc.SensorValue
Norman Jamese2765102015-08-19 22:00:55 -0500153 * ------------------------------------------------------------------------
154 */
155
156/**
Norman James5d78b4d2015-09-05 13:34:34 -0500157 * SECTION:SensorValue
158 * @title: SensorValue
159 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
Norman Jamese2765102015-08-19 22:00:55 -0500160 *
Norman James5d78b4d2015-09-05 13:34:34 -0500161 * 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 Jamese2765102015-08-19 22:00:55 -0500162 */
163
Norman James5d78b4d2015-09-05 13:34:34 -0500164/* ---- Introspection data for org.openbmc.SensorValue ---- */
Norman Jamese2765102015-08-19 22:00:55 -0500165
Norman James5d78b4d2015-09-05 13:34:34 -0500166static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
Norman James90baede2015-09-02 20:32:49 -0500167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
Norman James5d78b4d2015-09-05 13:34:34 -0500179static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
Norman Jamese2765102015-08-19 22:00:55 -0500180{
181 {
182 -1,
183 (gchar *) "value",
Norman James5d78b4d2015-09-05 13:34:34 -0500184 (gchar *) "v",
Norman Jamese2765102015-08-19 22:00:55 -0500185 NULL
186 },
187 FALSE
188};
189
Norman James5d78b4d2015-09-05 13:34:34 -0500190static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
Norman Jamese2765102015-08-19 22:00:55 -0500191{
Norman James5d78b4d2015-09-05 13:34:34 -0500192 &_sensor_value_method_info_get_value_OUT_ARG_value,
Norman Jamese2765102015-08-19 22:00:55 -0500193 NULL
194};
195
Norman James5d78b4d2015-09-05 13:34:34 -0500196static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
Norman Jamese2765102015-08-19 22:00:55 -0500197{
198 {
199 -1,
200 (gchar *) "getValue",
201 NULL,
Norman James5d78b4d2015-09-05 13:34:34 -0500202 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
Norman Jamese2765102015-08-19 22:00:55 -0500203 NULL
204 },
205 "handle-get-value",
206 FALSE
207};
208
Norman James5d78b4d2015-09-05 13:34:34 -0500209static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
Norman James90baede2015-09-02 20:32:49 -0500210{
211 {
212 -1,
213 (gchar *) "value",
Norman James5d78b4d2015-09-05 13:34:34 -0500214 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -0500215 NULL
216 },
217 FALSE
218};
219
Norman James5d78b4d2015-09-05 13:34:34 -0500220static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
Norman James90baede2015-09-02 20:32:49 -0500221{
Norman James5d78b4d2015-09-05 13:34:34 -0500222 &_sensor_value_method_info_set_value_IN_ARG_value,
Norman James90baede2015-09-02 20:32:49 -0500223 NULL
224};
225
Norman James5d78b4d2015-09-05 13:34:34 -0500226static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
Norman James90baede2015-09-02 20:32:49 -0500227{
228 {
229 -1,
230 (gchar *) "setValue",
Norman James5d78b4d2015-09-05 13:34:34 -0500231 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
Norman James90baede2015-09-02 20:32:49 -0500232 NULL,
233 NULL
234 },
235 "handle-set-value",
236 FALSE
237};
238
Norman James5d78b4d2015-09-05 13:34:34 -0500239static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
Norman Jamese2765102015-08-19 22:00:55 -0500240{
Norman James5d78b4d2015-09-05 13:34:34 -0500241 &_sensor_value_method_info_init,
242 &_sensor_value_method_info_get_value,
243 &_sensor_value_method_info_set_value,
Norman Jamese2765102015-08-19 22:00:55 -0500244 NULL
245};
246
Norman James5d78b4d2015-09-05 13:34:34 -0500247static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
Norman Jamese2765102015-08-19 22:00:55 -0500248{
249 {
250 -1,
251 (gchar *) "value",
Norman James5d78b4d2015-09-05 13:34:34 -0500252 (gchar *) "v",
Norman Jamese2765102015-08-19 22:00:55 -0500253 NULL
254 },
255 FALSE
256};
257
Norman James5d78b4d2015-09-05 13:34:34 -0500258static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
Norman James90baede2015-09-02 20:32:49 -0500259{
260 {
261 -1,
262 (gchar *) "units",
263 (gchar *) "s",
264 NULL
265 },
266 FALSE
267};
268
Norman James5d78b4d2015-09-05 13:34:34 -0500269static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
Norman Jamese2765102015-08-19 22:00:55 -0500270{
Norman James5d78b4d2015-09-05 13:34:34 -0500271 &_sensor_value_signal_info_changed_ARG_value,
272 &_sensor_value_signal_info_changed_ARG_units,
Norman Jamese2765102015-08-19 22:00:55 -0500273 NULL
274};
275
Norman James5d78b4d2015-09-05 13:34:34 -0500276static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
Norman Jamese2765102015-08-19 22:00:55 -0500277{
278 {
279 -1,
280 (gchar *) "Changed",
Norman James5d78b4d2015-09-05 13:34:34 -0500281 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
Norman Jamese2765102015-08-19 22:00:55 -0500282 NULL
283 },
284 "changed"
285};
286
Norman James5d78b4d2015-09-05 13:34:34 -0500287static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
Norman James3f97c5d2015-08-26 17:44:14 -0500288{
289 {
290 -1,
Norman James90baede2015-09-02 20:32:49 -0500291 (gchar *) "bus_name",
292 (gchar *) "s",
Norman James3f97c5d2015-08-26 17:44:14 -0500293 NULL
294 },
Norman James90baede2015-09-02 20:32:49 -0500295 FALSE
Norman James3f97c5d2015-08-26 17:44:14 -0500296};
297
Norman James5d78b4d2015-09-05 13:34:34 -0500298static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
Norman James90baede2015-09-02 20:32:49 -0500299{
Norman James5d78b4d2015-09-05 13:34:34 -0500300 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
Norman James90baede2015-09-02 20:32:49 -0500301 NULL
302};
303
Norman James5d78b4d2015-09-05 13:34:34 -0500304static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
Norman James3f97c5d2015-08-26 17:44:14 -0500305{
306 {
307 -1,
Norman James90baede2015-09-02 20:32:49 -0500308 (gchar *) "Heartbeat",
Norman James5d78b4d2015-09-05 13:34:34 -0500309 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
Norman James3f97c5d2015-08-26 17:44:14 -0500310 NULL
311 },
Norman James90baede2015-09-02 20:32:49 -0500312 "heartbeat"
Norman James3f97c5d2015-08-26 17:44:14 -0500313};
314
Norman James5d78b4d2015-09-05 13:34:34 -0500315static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
Norman Jamese2765102015-08-19 22:00:55 -0500316{
Norman James5d78b4d2015-09-05 13:34:34 -0500317 &_sensor_value_signal_info_changed,
318 &_sensor_value_signal_info_heartbeat,
Norman Jamese2765102015-08-19 22:00:55 -0500319 NULL
320};
321
Norman James5d78b4d2015-09-05 13:34:34 -0500322static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
Norman Jamese2765102015-08-19 22:00:55 -0500323{
324 {
325 -1,
326 (gchar *) "value",
Norman James5d78b4d2015-09-05 13:34:34 -0500327 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -0500328 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamese2765102015-08-19 22:00:55 -0500329 NULL
330 },
331 "value",
332 FALSE
333};
334
Norman James5d78b4d2015-09-05 13:34:34 -0500335static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
Norman Jamese2765102015-08-19 22:00:55 -0500336{
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 James5d78b4d2015-09-05 13:34:34 -0500348static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
Norman Jamescc7ae122015-08-24 14:26:09 -0500349{
350 {
351 -1,
352 (gchar *) "poll_interval",
353 (gchar *) "i",
354 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
355 NULL
356 },
357 "poll-interval",
358 FALSE
359};
360
Norman James5d78b4d2015-09-05 13:34:34 -0500361static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
Norman Jamescc7ae122015-08-24 14:26:09 -0500362{
363 {
364 -1,
Norman James90baede2015-09-02 20:32:49 -0500365 (gchar *) "heatbeat",
Norman Jamescc7ae122015-08-24 14:26:09 -0500366 (gchar *) "i",
367 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
368 NULL
369 },
Norman James90baede2015-09-02 20:32:49 -0500370 "heatbeat",
Norman Jamescc7ae122015-08-24 14:26:09 -0500371 FALSE
372};
373
Norman James5d78b4d2015-09-05 13:34:34 -0500374static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
Norman Jamese2765102015-08-19 22:00:55 -0500375{
Norman James5d78b4d2015-09-05 13:34:34 -0500376 &_sensor_value_property_info_value,
377 &_sensor_value_property_info_units,
378 &_sensor_value_property_info_poll_interval,
379 &_sensor_value_property_info_heatbeat,
Norman Jamese2765102015-08-19 22:00:55 -0500380 NULL
381};
382
Norman James5d78b4d2015-09-05 13:34:34 -0500383static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
Norman Jamese2765102015-08-19 22:00:55 -0500384{
385 {
386 -1,
Norman James5d78b4d2015-09-05 13:34:34 -0500387 (gchar *) "org.openbmc.SensorValue",
388 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
389 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
390 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
Norman Jamese2765102015-08-19 22:00:55 -0500391 NULL
392 },
Norman James5d78b4d2015-09-05 13:34:34 -0500393 "sensor-value",
Norman Jamese2765102015-08-19 22:00:55 -0500394};
395
396
397/**
Norman James5d78b4d2015-09-05 13:34:34 -0500398 * sensor_value_interface_info:
Norman Jamese2765102015-08-19 22:00:55 -0500399 *
Norman James5d78b4d2015-09-05 13:34:34 -0500400 * 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 Jamese2765102015-08-19 22:00:55 -0500401 *
402 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
403 */
404GDBusInterfaceInfo *
Norman James5d78b4d2015-09-05 13:34:34 -0500405sensor_value_interface_info (void)
Norman Jamese2765102015-08-19 22:00:55 -0500406{
Norman James5d78b4d2015-09-05 13:34:34 -0500407 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
Norman Jamese2765102015-08-19 22:00:55 -0500408}
409
410/**
Norman James5d78b4d2015-09-05 13:34:34 -0500411 * sensor_value_override_properties:
Norman Jamese2765102015-08-19 22:00:55 -0500412 * @klass: The class structure for a #GObject<!-- -->-derived class.
413 * @property_id_begin: The property id to assign to the first overridden property.
414 *
Norman James5d78b4d2015-09-05 13:34:34 -0500415 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
Norman Jamese2765102015-08-19 22:00:55 -0500416 * The properties are overridden in the order they are defined.
417 *
418 * Returns: The last property id.
419 */
420guint
Norman James5d78b4d2015-09-05 13:34:34 -0500421sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
Norman Jamese2765102015-08-19 22:00:55 -0500422{
423 g_object_class_override_property (klass, property_id_begin++, "value");
424 g_object_class_override_property (klass, property_id_begin++, "units");
Norman Jamescc7ae122015-08-24 14:26:09 -0500425 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
Norman James90baede2015-09-02 20:32:49 -0500426 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
Norman Jamese2765102015-08-19 22:00:55 -0500427 return property_id_begin - 1;
428}
429
430
431
432/**
Norman James5d78b4d2015-09-05 13:34:34 -0500433 * SensorValue:
Norman Jamese2765102015-08-19 22:00:55 -0500434 *
Norman James5d78b4d2015-09-05 13:34:34 -0500435 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
Norman Jamese2765102015-08-19 22:00:55 -0500436 */
437
438/**
Norman James5d78b4d2015-09-05 13:34:34 -0500439 * SensorValueIface:
Norman Jamese2765102015-08-19 22:00:55 -0500440 * @parent_iface: The parent interface.
Norman James5d78b4d2015-09-05 13:34:34 -0500441 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
442 * @handle_init: Handler for the #SensorValue::handle-init signal.
443 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
444 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
445 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
446 * @get_units: Getter for the #SensorValue:units property.
447 * @get_value: Getter for the #SensorValue:value property.
448 * @changed: Handler for the #SensorValue::changed signal.
449 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
Norman Jamese2765102015-08-19 22:00:55 -0500450 *
Norman James5d78b4d2015-09-05 13:34:34 -0500451 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
Norman Jamese2765102015-08-19 22:00:55 -0500452 */
453
Norman James5d78b4d2015-09-05 13:34:34 -0500454typedef SensorValueIface SensorValueInterface;
455G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
Norman Jamese2765102015-08-19 22:00:55 -0500456
457static void
Norman James5d78b4d2015-09-05 13:34:34 -0500458sensor_value_default_init (SensorValueIface *iface)
Norman Jamese2765102015-08-19 22:00:55 -0500459{
460 /* GObject signals for incoming D-Bus method calls: */
461 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500462 * SensorValue::handle-init:
463 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -0500464 * @invocation: A #GDBusMethodInvocation.
465 *
Norman James5d78b4d2015-09-05 13:34:34 -0500466 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
Norman James90baede2015-09-02 20:32:49 -0500467 *
Norman James5d78b4d2015-09-05 13:34:34 -0500468 * 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 James90baede2015-09-02 20:32:49 -0500469 *
470 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
471 */
472 g_signal_new ("handle-init",
473 G_TYPE_FROM_INTERFACE (iface),
474 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -0500475 G_STRUCT_OFFSET (SensorValueIface, handle_init),
Norman James90baede2015-09-02 20:32:49 -0500476 g_signal_accumulator_true_handled,
477 NULL,
478 g_cclosure_marshal_generic,
479 G_TYPE_BOOLEAN,
480 1,
481 G_TYPE_DBUS_METHOD_INVOCATION);
482
483 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500484 * SensorValue::handle-get-value:
485 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500486 * @invocation: A #GDBusMethodInvocation.
487 *
Norman James5d78b4d2015-09-05 13:34:34 -0500488 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
Norman Jamese2765102015-08-19 22:00:55 -0500489 *
Norman James5d78b4d2015-09-05 13:34:34 -0500490 * 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 Jamese2765102015-08-19 22:00:55 -0500491 *
492 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
493 */
494 g_signal_new ("handle-get-value",
495 G_TYPE_FROM_INTERFACE (iface),
496 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -0500497 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
Norman Jamese2765102015-08-19 22:00:55 -0500498 g_signal_accumulator_true_handled,
499 NULL,
500 g_cclosure_marshal_generic,
501 G_TYPE_BOOLEAN,
502 1,
503 G_TYPE_DBUS_METHOD_INVOCATION);
504
505 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500506 * SensorValue::handle-set-value:
507 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -0500508 * @invocation: A #GDBusMethodInvocation.
509 * @arg_value: Argument passed by remote caller.
510 *
Norman James5d78b4d2015-09-05 13:34:34 -0500511 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
Norman James90baede2015-09-02 20:32:49 -0500512 *
Norman James5d78b4d2015-09-05 13:34:34 -0500513 * 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 James90baede2015-09-02 20:32:49 -0500514 *
515 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
516 */
517 g_signal_new ("handle-set-value",
518 G_TYPE_FROM_INTERFACE (iface),
519 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -0500520 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
Norman James90baede2015-09-02 20:32:49 -0500521 g_signal_accumulator_true_handled,
522 NULL,
523 g_cclosure_marshal_generic,
524 G_TYPE_BOOLEAN,
525 2,
Norman James5d78b4d2015-09-05 13:34:34 -0500526 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
Norman Jamescc7ae122015-08-24 14:26:09 -0500527
Norman Jamese2765102015-08-19 22:00:55 -0500528 /* GObject signals for received D-Bus signals: */
529 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500530 * SensorValue::changed:
531 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500532 * @arg_value: Argument.
Norman James90baede2015-09-02 20:32:49 -0500533 * @arg_units: Argument.
Norman Jamese2765102015-08-19 22:00:55 -0500534 *
Norman James5d78b4d2015-09-05 13:34:34 -0500535 * 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 Jamese2765102015-08-19 22:00:55 -0500536 *
537 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
538 */
539 g_signal_new ("changed",
540 G_TYPE_FROM_INTERFACE (iface),
541 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -0500542 G_STRUCT_OFFSET (SensorValueIface, changed),
Norman Jamese2765102015-08-19 22:00:55 -0500543 NULL,
544 NULL,
545 g_cclosure_marshal_generic,
546 G_TYPE_NONE,
Norman James5d78b4d2015-09-05 13:34:34 -0500547 2, G_TYPE_VARIANT, G_TYPE_STRING);
Norman Jamese2765102015-08-19 22:00:55 -0500548
Norman James3f97c5d2015-08-26 17:44:14 -0500549 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500550 * SensorValue::heartbeat:
551 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -0500552 * @arg_bus_name: Argument.
Norman James3f97c5d2015-08-26 17:44:14 -0500553 *
Norman James5d78b4d2015-09-05 13:34:34 -0500554 * 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 James3f97c5d2015-08-26 17:44:14 -0500555 *
556 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
557 */
Norman James90baede2015-09-02 20:32:49 -0500558 g_signal_new ("heartbeat",
Norman James3f97c5d2015-08-26 17:44:14 -0500559 G_TYPE_FROM_INTERFACE (iface),
560 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -0500561 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
Norman James3f97c5d2015-08-26 17:44:14 -0500562 NULL,
563 NULL,
564 g_cclosure_marshal_generic,
565 G_TYPE_NONE,
Norman James90baede2015-09-02 20:32:49 -0500566 1, G_TYPE_STRING);
Norman James3f97c5d2015-08-26 17:44:14 -0500567
Norman Jamese2765102015-08-19 22:00:55 -0500568 /* GObject properties for D-Bus properties: */
569 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500570 * SensorValue:value:
Norman Jamese2765102015-08-19 22:00:55 -0500571 *
Norman James5d78b4d2015-09-05 13:34:34 -0500572 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
Norman Jamese2765102015-08-19 22:00:55 -0500573 *
Norman James90baede2015-09-02 20:32:49 -0500574 * 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 Jamese2765102015-08-19 22:00:55 -0500575 */
576 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -0500577 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamese2765102015-08-19 22:00:55 -0500578 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500579 * SensorValue:units:
Norman Jamese2765102015-08-19 22:00:55 -0500580 *
Norman James5d78b4d2015-09-05 13:34:34 -0500581 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
Norman Jamese2765102015-08-19 22:00:55 -0500582 *
583 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
584 */
585 g_object_interface_install_property (iface,
586 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -0500587 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500588 * SensorValue:poll-interval:
Norman Jamescc7ae122015-08-24 14:26:09 -0500589 *
Norman James5d78b4d2015-09-05 13:34:34 -0500590 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -0500591 *
592 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
593 */
594 g_object_interface_install_property (iface,
595 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
596 /**
Norman James5d78b4d2015-09-05 13:34:34 -0500597 * SensorValue:heatbeat:
Norman Jamescc7ae122015-08-24 14:26:09 -0500598 *
Norman James5d78b4d2015-09-05 13:34:34 -0500599 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -0500600 *
601 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
602 */
603 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -0500604 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamese2765102015-08-19 22:00:55 -0500605}
606
607/**
Norman James5d78b4d2015-09-05 13:34:34 -0500608 * sensor_value_get_value: (skip)
609 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500610 *
Norman James5d78b4d2015-09-05 13:34:34 -0500611 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
Norman Jamese2765102015-08-19 22:00:55 -0500612 *
Norman James90baede2015-09-02 20:32:49 -0500613 * 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 Jamese2765102015-08-19 22:00:55 -0500614 *
Norman James5d78b4d2015-09-05 13:34:34 -0500615 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning>
616 *
617 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
Norman Jamese2765102015-08-19 22:00:55 -0500618 */
Norman James5d78b4d2015-09-05 13:34:34 -0500619GVariant *
620sensor_value_get_value (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -0500621{
Norman James5d78b4d2015-09-05 13:34:34 -0500622 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
Norman Jamese2765102015-08-19 22:00:55 -0500623}
624
625/**
Norman James5d78b4d2015-09-05 13:34:34 -0500626 * sensor_value_dup_value: (skip)
627 * @object: A #SensorValue.
628 *
629 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
630 *
631 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
632 *
633 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
634 */
635GVariant *
636sensor_value_dup_value (SensorValue *object)
637{
638 GVariant *value;
639 g_object_get (G_OBJECT (object), "value", &value, NULL);
640 return value;
641}
642
643/**
644 * sensor_value_set_value: (skip)
645 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500646 * @value: The value to set.
647 *
Norman James5d78b4d2015-09-05 13:34:34 -0500648 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
Norman Jamese2765102015-08-19 22:00:55 -0500649 *
Norman James90baede2015-09-02 20:32:49 -0500650 * 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 Jamese2765102015-08-19 22:00:55 -0500651 */
652void
Norman James5d78b4d2015-09-05 13:34:34 -0500653sensor_value_set_value (SensorValue *object, GVariant *value)
Norman Jamese2765102015-08-19 22:00:55 -0500654{
655 g_object_set (G_OBJECT (object), "value", value, NULL);
656}
657
658/**
Norman James5d78b4d2015-09-05 13:34:34 -0500659 * sensor_value_get_units: (skip)
660 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500661 *
Norman James5d78b4d2015-09-05 13:34:34 -0500662 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
Norman Jamese2765102015-08-19 22:00:55 -0500663 *
664 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
665 *
Norman James5d78b4d2015-09-05 13:34:34 -0500666 * <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 Jamese2765102015-08-19 22:00:55 -0500667 *
668 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
669 */
670const gchar *
Norman James5d78b4d2015-09-05 13:34:34 -0500671sensor_value_get_units (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -0500672{
Norman James5d78b4d2015-09-05 13:34:34 -0500673 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
Norman Jamese2765102015-08-19 22:00:55 -0500674}
675
676/**
Norman James5d78b4d2015-09-05 13:34:34 -0500677 * sensor_value_dup_units: (skip)
678 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500679 *
Norman James5d78b4d2015-09-05 13:34:34 -0500680 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
Norman Jamese2765102015-08-19 22:00:55 -0500681 *
682 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
683 *
684 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
685 */
686gchar *
Norman James5d78b4d2015-09-05 13:34:34 -0500687sensor_value_dup_units (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -0500688{
689 gchar *value;
690 g_object_get (G_OBJECT (object), "units", &value, NULL);
691 return value;
692}
693
694/**
Norman James5d78b4d2015-09-05 13:34:34 -0500695 * sensor_value_set_units: (skip)
696 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500697 * @value: The value to set.
698 *
Norman James5d78b4d2015-09-05 13:34:34 -0500699 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
Norman Jamese2765102015-08-19 22:00:55 -0500700 *
701 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
702 */
703void
Norman James5d78b4d2015-09-05 13:34:34 -0500704sensor_value_set_units (SensorValue *object, const gchar *value)
Norman Jamese2765102015-08-19 22:00:55 -0500705{
706 g_object_set (G_OBJECT (object), "units", value, NULL);
707}
708
709/**
Norman James5d78b4d2015-09-05 13:34:34 -0500710 * sensor_value_get_poll_interval: (skip)
711 * @object: A #SensorValue.
Norman Jamescc7ae122015-08-24 14:26:09 -0500712 *
Norman James5d78b4d2015-09-05 13:34:34 -0500713 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -0500714 *
715 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
716 *
717 * Returns: The property value.
718 */
719gint
Norman James5d78b4d2015-09-05 13:34:34 -0500720sensor_value_get_poll_interval (SensorValue *object)
Norman Jamescc7ae122015-08-24 14:26:09 -0500721{
Norman James5d78b4d2015-09-05 13:34:34 -0500722 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
Norman Jamescc7ae122015-08-24 14:26:09 -0500723}
724
725/**
Norman James5d78b4d2015-09-05 13:34:34 -0500726 * sensor_value_set_poll_interval: (skip)
727 * @object: A #SensorValue.
Norman Jamescc7ae122015-08-24 14:26:09 -0500728 * @value: The value to set.
729 *
Norman James5d78b4d2015-09-05 13:34:34 -0500730 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -0500731 *
732 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
733 */
734void
Norman James5d78b4d2015-09-05 13:34:34 -0500735sensor_value_set_poll_interval (SensorValue *object, gint value)
Norman Jamescc7ae122015-08-24 14:26:09 -0500736{
737 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
738}
739
740/**
Norman James5d78b4d2015-09-05 13:34:34 -0500741 * sensor_value_get_heatbeat: (skip)
742 * @object: A #SensorValue.
Norman Jamescc7ae122015-08-24 14:26:09 -0500743 *
Norman James5d78b4d2015-09-05 13:34:34 -0500744 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -0500745 *
746 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
747 *
748 * Returns: The property value.
749 */
750gint
Norman James5d78b4d2015-09-05 13:34:34 -0500751sensor_value_get_heatbeat (SensorValue *object)
Norman Jamescc7ae122015-08-24 14:26:09 -0500752{
Norman James5d78b4d2015-09-05 13:34:34 -0500753 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
Norman Jamescc7ae122015-08-24 14:26:09 -0500754}
755
756/**
Norman James5d78b4d2015-09-05 13:34:34 -0500757 * sensor_value_set_heatbeat: (skip)
758 * @object: A #SensorValue.
Norman Jamescc7ae122015-08-24 14:26:09 -0500759 * @value: The value to set.
760 *
Norman James5d78b4d2015-09-05 13:34:34 -0500761 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -0500762 *
763 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
764 */
765void
Norman James5d78b4d2015-09-05 13:34:34 -0500766sensor_value_set_heatbeat (SensorValue *object, gint value)
Norman Jamescc7ae122015-08-24 14:26:09 -0500767{
Norman James90baede2015-09-02 20:32:49 -0500768 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -0500769}
770
771/**
Norman James5d78b4d2015-09-05 13:34:34 -0500772 * sensor_value_emit_changed:
773 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -0500774 * @arg_value: Argument to pass with the signal.
Norman James90baede2015-09-02 20:32:49 -0500775 * @arg_units: Argument to pass with the signal.
Norman Jamese2765102015-08-19 22:00:55 -0500776 *
Norman James5d78b4d2015-09-05 13:34:34 -0500777 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
Norman Jamese2765102015-08-19 22:00:55 -0500778 */
779void
Norman James5d78b4d2015-09-05 13:34:34 -0500780sensor_value_emit_changed (
781 SensorValue *object,
782 GVariant *arg_value,
Norman James90baede2015-09-02 20:32:49 -0500783 const gchar *arg_units)
Norman Jamese2765102015-08-19 22:00:55 -0500784{
Norman James90baede2015-09-02 20:32:49 -0500785 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
Norman Jamese2765102015-08-19 22:00:55 -0500786}
787
788/**
Norman James5d78b4d2015-09-05 13:34:34 -0500789 * sensor_value_emit_heartbeat:
790 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -0500791 * @arg_bus_name: Argument to pass with the signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500792 *
Norman James5d78b4d2015-09-05 13:34:34 -0500793 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500794 */
795void
Norman James5d78b4d2015-09-05 13:34:34 -0500796sensor_value_emit_heartbeat (
797 SensorValue *object,
Norman James90baede2015-09-02 20:32:49 -0500798 const gchar *arg_bus_name)
Norman James3f97c5d2015-08-26 17:44:14 -0500799{
Norman James90baede2015-09-02 20:32:49 -0500800 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
Norman James3f97c5d2015-08-26 17:44:14 -0500801}
802
803/**
Norman James5d78b4d2015-09-05 13:34:34 -0500804 * sensor_value_call_init:
805 * @proxy: A #SensorValueProxy.
Norman James90baede2015-09-02 20:32:49 -0500806 * @cancellable: (allow-none): A #GCancellable or %NULL.
807 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
808 * @user_data: User data to pass to @callback.
Norman James3f97c5d2015-08-26 17:44:14 -0500809 *
Norman James5d78b4d2015-09-05 13:34:34 -0500810 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
Norman James90baede2015-09-02 20:32:49 -0500811 * 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 James5d78b4d2015-09-05 13:34:34 -0500812 * You can then call sensor_value_call_init_finish() to get the result of the operation.
Norman James90baede2015-09-02 20:32:49 -0500813 *
Norman James5d78b4d2015-09-05 13:34:34 -0500814 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
Norman James3f97c5d2015-08-26 17:44:14 -0500815 */
816void
Norman James5d78b4d2015-09-05 13:34:34 -0500817sensor_value_call_init (
818 SensorValue *proxy,
Norman James90baede2015-09-02 20:32:49 -0500819 GCancellable *cancellable,
820 GAsyncReadyCallback callback,
821 gpointer user_data)
Norman James3f97c5d2015-08-26 17:44:14 -0500822{
Norman James90baede2015-09-02 20:32:49 -0500823 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
824 "init",
825 g_variant_new ("()"),
826 G_DBUS_CALL_FLAGS_NONE,
827 -1,
828 cancellable,
829 callback,
830 user_data);
831}
832
833/**
Norman James5d78b4d2015-09-05 13:34:34 -0500834 * sensor_value_call_init_finish:
835 * @proxy: A #SensorValueProxy.
836 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
Norman James90baede2015-09-02 20:32:49 -0500837 * @error: Return location for error or %NULL.
838 *
Norman James5d78b4d2015-09-05 13:34:34 -0500839 * Finishes an operation started with sensor_value_call_init().
Norman James90baede2015-09-02 20:32:49 -0500840 *
841 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
842 */
843gboolean
Norman James5d78b4d2015-09-05 13:34:34 -0500844sensor_value_call_init_finish (
845 SensorValue *proxy,
Norman James90baede2015-09-02 20:32:49 -0500846 GAsyncResult *res,
847 GError **error)
848{
849 GVariant *_ret;
850 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
851 if (_ret == NULL)
852 goto _out;
853 g_variant_get (_ret,
854 "()");
855 g_variant_unref (_ret);
856_out:
857 return _ret != NULL;
858}
859
860/**
Norman James5d78b4d2015-09-05 13:34:34 -0500861 * sensor_value_call_init_sync:
862 * @proxy: A #SensorValueProxy.
Norman James90baede2015-09-02 20:32:49 -0500863 * @cancellable: (allow-none): A #GCancellable or %NULL.
864 * @error: Return location for error or %NULL.
865 *
Norman James5d78b4d2015-09-05 13:34:34 -0500866 * 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 James90baede2015-09-02 20:32:49 -0500867 *
Norman James5d78b4d2015-09-05 13:34:34 -0500868 * See sensor_value_call_init() for the asynchronous version of this method.
Norman James90baede2015-09-02 20:32:49 -0500869 *
870 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
871 */
872gboolean
Norman James5d78b4d2015-09-05 13:34:34 -0500873sensor_value_call_init_sync (
874 SensorValue *proxy,
Norman James90baede2015-09-02 20:32:49 -0500875 GCancellable *cancellable,
876 GError **error)
877{
878 GVariant *_ret;
879 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
880 "init",
881 g_variant_new ("()"),
882 G_DBUS_CALL_FLAGS_NONE,
883 -1,
884 cancellable,
885 error);
886 if (_ret == NULL)
887 goto _out;
888 g_variant_get (_ret,
889 "()");
890 g_variant_unref (_ret);
891_out:
892 return _ret != NULL;
Norman James3f97c5d2015-08-26 17:44:14 -0500893}
894
895/**
Norman James5d78b4d2015-09-05 13:34:34 -0500896 * sensor_value_call_get_value:
897 * @proxy: A #SensorValueProxy.
Norman Jamese2765102015-08-19 22:00:55 -0500898 * @cancellable: (allow-none): A #GCancellable or %NULL.
899 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
900 * @user_data: User data to pass to @callback.
901 *
Norman James5d78b4d2015-09-05 13:34:34 -0500902 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
Norman Jamese2765102015-08-19 22:00:55 -0500903 * 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 James5d78b4d2015-09-05 13:34:34 -0500904 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
Norman Jamese2765102015-08-19 22:00:55 -0500905 *
Norman James5d78b4d2015-09-05 13:34:34 -0500906 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
Norman Jamese2765102015-08-19 22:00:55 -0500907 */
908void
Norman James5d78b4d2015-09-05 13:34:34 -0500909sensor_value_call_get_value (
910 SensorValue *proxy,
Norman Jamese2765102015-08-19 22:00:55 -0500911 GCancellable *cancellable,
912 GAsyncReadyCallback callback,
913 gpointer user_data)
914{
915 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
916 "getValue",
917 g_variant_new ("()"),
918 G_DBUS_CALL_FLAGS_NONE,
919 -1,
920 cancellable,
921 callback,
922 user_data);
923}
924
925/**
Norman James5d78b4d2015-09-05 13:34:34 -0500926 * sensor_value_call_get_value_finish:
927 * @proxy: A #SensorValueProxy.
Norman Jamese2765102015-08-19 22:00:55 -0500928 * @out_value: (out): Return location for return parameter or %NULL to ignore.
Norman James5d78b4d2015-09-05 13:34:34 -0500929 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
Norman Jamese2765102015-08-19 22:00:55 -0500930 * @error: Return location for error or %NULL.
931 *
Norman James5d78b4d2015-09-05 13:34:34 -0500932 * Finishes an operation started with sensor_value_call_get_value().
Norman Jamese2765102015-08-19 22:00:55 -0500933 *
934 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
935 */
936gboolean
Norman James5d78b4d2015-09-05 13:34:34 -0500937sensor_value_call_get_value_finish (
938 SensorValue *proxy,
939 GVariant **out_value,
Norman Jamese2765102015-08-19 22:00:55 -0500940 GAsyncResult *res,
941 GError **error)
942{
943 GVariant *_ret;
944 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
945 if (_ret == NULL)
946 goto _out;
947 g_variant_get (_ret,
Norman James5d78b4d2015-09-05 13:34:34 -0500948 "(@v)",
Norman Jamese2765102015-08-19 22:00:55 -0500949 out_value);
950 g_variant_unref (_ret);
951_out:
952 return _ret != NULL;
953}
954
955/**
Norman James5d78b4d2015-09-05 13:34:34 -0500956 * sensor_value_call_get_value_sync:
957 * @proxy: A #SensorValueProxy.
Norman Jamese2765102015-08-19 22:00:55 -0500958 * @out_value: (out): Return location for return parameter or %NULL to ignore.
959 * @cancellable: (allow-none): A #GCancellable or %NULL.
960 * @error: Return location for error or %NULL.
961 *
Norman James5d78b4d2015-09-05 13:34:34 -0500962 * 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 Jamese2765102015-08-19 22:00:55 -0500963 *
Norman James5d78b4d2015-09-05 13:34:34 -0500964 * See sensor_value_call_get_value() for the asynchronous version of this method.
Norman Jamese2765102015-08-19 22:00:55 -0500965 *
966 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
967 */
968gboolean
Norman James5d78b4d2015-09-05 13:34:34 -0500969sensor_value_call_get_value_sync (
970 SensorValue *proxy,
971 GVariant **out_value,
Norman Jamese2765102015-08-19 22:00:55 -0500972 GCancellable *cancellable,
973 GError **error)
974{
975 GVariant *_ret;
976 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
977 "getValue",
978 g_variant_new ("()"),
979 G_DBUS_CALL_FLAGS_NONE,
980 -1,
981 cancellable,
982 error);
983 if (_ret == NULL)
984 goto _out;
985 g_variant_get (_ret,
Norman James5d78b4d2015-09-05 13:34:34 -0500986 "(@v)",
Norman Jamese2765102015-08-19 22:00:55 -0500987 out_value);
988 g_variant_unref (_ret);
989_out:
990 return _ret != NULL;
991}
992
993/**
Norman James5d78b4d2015-09-05 13:34:34 -0500994 * sensor_value_call_set_value:
995 * @proxy: A #SensorValueProxy.
Norman James90baede2015-09-02 20:32:49 -0500996 * @arg_value: Argument to pass with the method invocation.
997 * @cancellable: (allow-none): A #GCancellable or %NULL.
998 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
999 * @user_data: User data to pass to @callback.
1000 *
Norman James5d78b4d2015-09-05 13:34:34 -05001001 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
Norman James90baede2015-09-02 20:32:49 -05001002 * 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 James5d78b4d2015-09-05 13:34:34 -05001003 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
Norman James90baede2015-09-02 20:32:49 -05001004 *
Norman James5d78b4d2015-09-05 13:34:34 -05001005 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
Norman James90baede2015-09-02 20:32:49 -05001006 */
1007void
Norman James5d78b4d2015-09-05 13:34:34 -05001008sensor_value_call_set_value (
1009 SensorValue *proxy,
1010 GVariant *arg_value,
Norman James90baede2015-09-02 20:32:49 -05001011 GCancellable *cancellable,
1012 GAsyncReadyCallback callback,
1013 gpointer user_data)
1014{
1015 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1016 "setValue",
Norman James5d78b4d2015-09-05 13:34:34 -05001017 g_variant_new ("(@v)",
Norman James90baede2015-09-02 20:32:49 -05001018 arg_value),
1019 G_DBUS_CALL_FLAGS_NONE,
1020 -1,
1021 cancellable,
1022 callback,
1023 user_data);
1024}
1025
1026/**
Norman James5d78b4d2015-09-05 13:34:34 -05001027 * sensor_value_call_set_value_finish:
1028 * @proxy: A #SensorValueProxy.
1029 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
Norman James90baede2015-09-02 20:32:49 -05001030 * @error: Return location for error or %NULL.
1031 *
Norman James5d78b4d2015-09-05 13:34:34 -05001032 * Finishes an operation started with sensor_value_call_set_value().
Norman James90baede2015-09-02 20:32:49 -05001033 *
1034 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1035 */
1036gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05001037sensor_value_call_set_value_finish (
1038 SensorValue *proxy,
Norman James90baede2015-09-02 20:32:49 -05001039 GAsyncResult *res,
1040 GError **error)
1041{
1042 GVariant *_ret;
1043 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1044 if (_ret == NULL)
1045 goto _out;
1046 g_variant_get (_ret,
1047 "()");
1048 g_variant_unref (_ret);
1049_out:
1050 return _ret != NULL;
1051}
1052
1053/**
Norman James5d78b4d2015-09-05 13:34:34 -05001054 * sensor_value_call_set_value_sync:
1055 * @proxy: A #SensorValueProxy.
Norman James90baede2015-09-02 20:32:49 -05001056 * @arg_value: Argument to pass with the method invocation.
1057 * @cancellable: (allow-none): A #GCancellable or %NULL.
1058 * @error: Return location for error or %NULL.
1059 *
Norman James5d78b4d2015-09-05 13:34:34 -05001060 * 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 James90baede2015-09-02 20:32:49 -05001061 *
Norman James5d78b4d2015-09-05 13:34:34 -05001062 * See sensor_value_call_set_value() for the asynchronous version of this method.
Norman James90baede2015-09-02 20:32:49 -05001063 *
1064 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1065 */
1066gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05001067sensor_value_call_set_value_sync (
1068 SensorValue *proxy,
1069 GVariant *arg_value,
Norman James90baede2015-09-02 20:32:49 -05001070 GCancellable *cancellable,
1071 GError **error)
1072{
1073 GVariant *_ret;
1074 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1075 "setValue",
Norman James5d78b4d2015-09-05 13:34:34 -05001076 g_variant_new ("(@v)",
Norman James90baede2015-09-02 20:32:49 -05001077 arg_value),
1078 G_DBUS_CALL_FLAGS_NONE,
1079 -1,
1080 cancellable,
1081 error);
1082 if (_ret == NULL)
1083 goto _out;
1084 g_variant_get (_ret,
1085 "()");
1086 g_variant_unref (_ret);
1087_out:
1088 return _ret != NULL;
1089}
1090
1091/**
Norman James5d78b4d2015-09-05 13:34:34 -05001092 * sensor_value_complete_init:
1093 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -05001094 * @invocation: (transfer full): A #GDBusMethodInvocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05001095 *
Norman James5d78b4d2015-09-05 13:34:34 -05001096 * 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 Jamescc7ae122015-08-24 14:26:09 -05001097 *
Norman James90baede2015-09-02 20:32:49 -05001098 * This method will free @invocation, you cannot use it afterwards.
Norman Jamescc7ae122015-08-24 14:26:09 -05001099 */
1100void
Norman James5d78b4d2015-09-05 13:34:34 -05001101sensor_value_complete_init (
1102 SensorValue *object,
Norman James90baede2015-09-02 20:32:49 -05001103 GDBusMethodInvocation *invocation)
Norman Jamescc7ae122015-08-24 14:26:09 -05001104{
Norman James90baede2015-09-02 20:32:49 -05001105 g_dbus_method_invocation_return_value (invocation,
1106 g_variant_new ("()"));
Norman Jamese7594922015-08-27 14:25:24 -05001107}
1108
1109/**
Norman James5d78b4d2015-09-05 13:34:34 -05001110 * sensor_value_complete_get_value:
1111 * @object: A #SensorValue.
Norman Jamese2765102015-08-19 22:00:55 -05001112 * @invocation: (transfer full): A #GDBusMethodInvocation.
1113 * @value: Parameter to return.
1114 *
Norman James5d78b4d2015-09-05 13:34:34 -05001115 * 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 Jamese2765102015-08-19 22:00:55 -05001116 *
1117 * This method will free @invocation, you cannot use it afterwards.
1118 */
1119void
Norman James5d78b4d2015-09-05 13:34:34 -05001120sensor_value_complete_get_value (
1121 SensorValue *object,
Norman Jamese2765102015-08-19 22:00:55 -05001122 GDBusMethodInvocation *invocation,
Norman James5d78b4d2015-09-05 13:34:34 -05001123 GVariant *value)
Norman Jamese2765102015-08-19 22:00:55 -05001124{
1125 g_dbus_method_invocation_return_value (invocation,
Norman James5d78b4d2015-09-05 13:34:34 -05001126 g_variant_new ("(@v)",
Norman Jamese2765102015-08-19 22:00:55 -05001127 value));
1128}
1129
1130/**
Norman James5d78b4d2015-09-05 13:34:34 -05001131 * sensor_value_complete_set_value:
1132 * @object: A #SensorValue.
Norman James90baede2015-09-02 20:32:49 -05001133 * @invocation: (transfer full): A #GDBusMethodInvocation.
1134 *
Norman James5d78b4d2015-09-05 13:34:34 -05001135 * 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 James90baede2015-09-02 20:32:49 -05001136 *
1137 * This method will free @invocation, you cannot use it afterwards.
1138 */
1139void
Norman James5d78b4d2015-09-05 13:34:34 -05001140sensor_value_complete_set_value (
1141 SensorValue *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05001142 GDBusMethodInvocation *invocation)
1143{
1144 g_dbus_method_invocation_return_value (invocation,
1145 g_variant_new ("()"));
1146}
1147
Norman Jamese2765102015-08-19 22:00:55 -05001148/* ------------------------------------------------------------------------ */
1149
1150/**
Norman James5d78b4d2015-09-05 13:34:34 -05001151 * SensorValueProxy:
Norman Jamese2765102015-08-19 22:00:55 -05001152 *
Norman James5d78b4d2015-09-05 13:34:34 -05001153 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
Norman Jamese2765102015-08-19 22:00:55 -05001154 */
1155
1156/**
Norman James5d78b4d2015-09-05 13:34:34 -05001157 * SensorValueProxyClass:
Norman Jamese2765102015-08-19 22:00:55 -05001158 * @parent_class: The parent class.
1159 *
Norman James5d78b4d2015-09-05 13:34:34 -05001160 * Class structure for #SensorValueProxy.
Norman Jamese2765102015-08-19 22:00:55 -05001161 */
1162
Norman James5d78b4d2015-09-05 13:34:34 -05001163struct _SensorValueProxyPrivate
Norman Jamese2765102015-08-19 22:00:55 -05001164{
1165 GData *qdata;
1166};
1167
Norman James5d78b4d2015-09-05 13:34:34 -05001168static void sensor_value_proxy_iface_init (SensorValueIface *iface);
Norman Jamese2765102015-08-19 22:00:55 -05001169
1170#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05001171G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
1172 G_ADD_PRIVATE (SensorValueProxy)
1173 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
Norman Jamese2765102015-08-19 22:00:55 -05001174
1175#else
Norman James5d78b4d2015-09-05 13:34:34 -05001176G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
1177 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
Norman Jamese2765102015-08-19 22:00:55 -05001178
1179#endif
1180static void
Norman James5d78b4d2015-09-05 13:34:34 -05001181sensor_value_proxy_finalize (GObject *object)
Norman Jamese2765102015-08-19 22:00:55 -05001182{
Norman James5d78b4d2015-09-05 13:34:34 -05001183 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
Norman Jamese2765102015-08-19 22:00:55 -05001184 g_datalist_clear (&proxy->priv->qdata);
Norman James5d78b4d2015-09-05 13:34:34 -05001185 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
Norman Jamese2765102015-08-19 22:00:55 -05001186}
1187
1188static void
Norman James5d78b4d2015-09-05 13:34:34 -05001189sensor_value_proxy_get_property (GObject *object,
Norman Jamese2765102015-08-19 22:00:55 -05001190 guint prop_id,
1191 GValue *value,
1192 GParamSpec *pspec G_GNUC_UNUSED)
1193{
1194 const _ExtendedGDBusPropertyInfo *info;
1195 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05001196 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman James5d78b4d2015-09-05 13:34:34 -05001197 info = _sensor_value_property_info_pointers[prop_id - 1];
Norman Jamese2765102015-08-19 22:00:55 -05001198 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1199 if (info->use_gvariant)
1200 {
1201 g_value_set_variant (value, variant);
1202 }
1203 else
1204 {
1205 if (variant != NULL)
1206 g_dbus_gvariant_to_gvalue (variant, value);
1207 }
1208 if (variant != NULL)
1209 g_variant_unref (variant);
1210}
1211
1212static void
Norman James5d78b4d2015-09-05 13:34:34 -05001213sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
Norman Jamese2765102015-08-19 22:00:55 -05001214 GAsyncResult *res,
1215 gpointer user_data)
1216{
1217 const _ExtendedGDBusPropertyInfo *info = user_data;
1218 GError *error;
1219 GVariant *_ret;
1220 error = NULL;
1221 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1222 if (!_ret)
1223 {
Norman James5d78b4d2015-09-05 13:34:34 -05001224 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
Norman Jamese2765102015-08-19 22:00:55 -05001225 info->parent_struct.name,
1226 error->message, g_quark_to_string (error->domain), error->code);
1227 g_error_free (error);
1228 }
1229 else
1230 {
1231 g_variant_unref (_ret);
1232 }
1233}
1234
1235static void
Norman James5d78b4d2015-09-05 13:34:34 -05001236sensor_value_proxy_set_property (GObject *object,
Norman Jamese2765102015-08-19 22:00:55 -05001237 guint prop_id,
1238 const GValue *value,
1239 GParamSpec *pspec G_GNUC_UNUSED)
1240{
1241 const _ExtendedGDBusPropertyInfo *info;
1242 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05001243 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman James5d78b4d2015-09-05 13:34:34 -05001244 info = _sensor_value_property_info_pointers[prop_id - 1];
Norman Jamese2765102015-08-19 22:00:55 -05001245 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1246 g_dbus_proxy_call (G_DBUS_PROXY (object),
1247 "org.freedesktop.DBus.Properties.Set",
Norman James5d78b4d2015-09-05 13:34:34 -05001248 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
Norman Jamese2765102015-08-19 22:00:55 -05001249 G_DBUS_CALL_FLAGS_NONE,
1250 -1,
Norman James5d78b4d2015-09-05 13:34:34 -05001251 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
Norman Jamese2765102015-08-19 22:00:55 -05001252 g_variant_unref (variant);
1253}
1254
1255static void
Norman James5d78b4d2015-09-05 13:34:34 -05001256sensor_value_proxy_g_signal (GDBusProxy *proxy,
Norman Jamese2765102015-08-19 22:00:55 -05001257 const gchar *sender_name G_GNUC_UNUSED,
1258 const gchar *signal_name,
1259 GVariant *parameters)
1260{
1261 _ExtendedGDBusSignalInfo *info;
1262 GVariantIter iter;
1263 GVariant *child;
1264 GValue *paramv;
1265 guint num_params;
1266 guint n;
1267 guint signal_id;
Norman James5d78b4d2015-09-05 13:34:34 -05001268 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
Norman Jamese2765102015-08-19 22:00:55 -05001269 if (info == NULL)
1270 return;
1271 num_params = g_variant_n_children (parameters);
1272 paramv = g_new0 (GValue, num_params + 1);
Norman James5d78b4d2015-09-05 13:34:34 -05001273 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
Norman Jamese2765102015-08-19 22:00:55 -05001274 g_value_set_object (&paramv[0], proxy);
1275 g_variant_iter_init (&iter, parameters);
1276 n = 1;
1277 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1278 {
1279 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1280 if (arg_info->use_gvariant)
1281 {
1282 g_value_init (&paramv[n], G_TYPE_VARIANT);
1283 g_value_set_variant (&paramv[n], child);
1284 n++;
1285 }
1286 else
1287 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1288 g_variant_unref (child);
1289 }
Norman James5d78b4d2015-09-05 13:34:34 -05001290 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
Norman Jamese2765102015-08-19 22:00:55 -05001291 g_signal_emitv (paramv, signal_id, 0, NULL);
1292 for (n = 0; n < num_params + 1; n++)
1293 g_value_unset (&paramv[n]);
1294 g_free (paramv);
1295}
1296
1297static void
Norman James5d78b4d2015-09-05 13:34:34 -05001298sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
Norman Jamese2765102015-08-19 22:00:55 -05001299 GVariant *changed_properties,
1300 const gchar *const *invalidated_properties)
1301{
Norman James5d78b4d2015-09-05 13:34:34 -05001302 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
Norman Jamese2765102015-08-19 22:00:55 -05001303 guint n;
1304 const gchar *key;
1305 GVariantIter *iter;
1306 _ExtendedGDBusPropertyInfo *info;
1307 g_variant_get (changed_properties, "a{sv}", &iter);
1308 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1309 {
Norman James5d78b4d2015-09-05 13:34:34 -05001310 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
Norman Jamese2765102015-08-19 22:00:55 -05001311 g_datalist_remove_data (&proxy->priv->qdata, key);
1312 if (info != NULL)
1313 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1314 }
1315 g_variant_iter_free (iter);
1316 for (n = 0; invalidated_properties[n] != NULL; n++)
1317 {
Norman James5d78b4d2015-09-05 13:34:34 -05001318 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
Norman Jamese2765102015-08-19 22:00:55 -05001319 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1320 if (info != NULL)
1321 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1322 }
1323}
1324
Norman James5d78b4d2015-09-05 13:34:34 -05001325static GVariant *
1326sensor_value_proxy_get_value (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -05001327{
Norman James5d78b4d2015-09-05 13:34:34 -05001328 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
Norman Jamese2765102015-08-19 22:00:55 -05001329 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05001330 GVariant *value = NULL;
Norman Jamese2765102015-08-19 22:00:55 -05001331 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
Norman James5d78b4d2015-09-05 13:34:34 -05001332 value = variant;
Norman Jamese2765102015-08-19 22:00:55 -05001333 if (variant != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05001334 g_variant_unref (variant);
Norman Jamese2765102015-08-19 22:00:55 -05001335 return value;
1336}
1337
1338static const gchar *
Norman James5d78b4d2015-09-05 13:34:34 -05001339sensor_value_proxy_get_units (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -05001340{
Norman James5d78b4d2015-09-05 13:34:34 -05001341 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
Norman Jamese2765102015-08-19 22:00:55 -05001342 GVariant *variant;
1343 const gchar *value = NULL;
1344 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
1345 if (variant != NULL)
1346 {
1347 value = g_variant_get_string (variant, NULL);
1348 g_variant_unref (variant);
1349 }
1350 return value;
1351}
1352
Norman Jamescc7ae122015-08-24 14:26:09 -05001353static gint
Norman James5d78b4d2015-09-05 13:34:34 -05001354sensor_value_proxy_get_poll_interval (SensorValue *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05001355{
Norman James5d78b4d2015-09-05 13:34:34 -05001356 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05001357 GVariant *variant;
1358 gint value = 0;
1359 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1360 if (variant != NULL)
1361 {
1362 value = g_variant_get_int32 (variant);
1363 g_variant_unref (variant);
1364 }
1365 return value;
1366}
1367
Norman Jamescc7ae122015-08-24 14:26:09 -05001368static gint
Norman James5d78b4d2015-09-05 13:34:34 -05001369sensor_value_proxy_get_heatbeat (SensorValue *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05001370{
Norman James5d78b4d2015-09-05 13:34:34 -05001371 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05001372 GVariant *variant;
1373 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05001374 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
Norman Jamescc7ae122015-08-24 14:26:09 -05001375 if (variant != NULL)
1376 {
1377 value = g_variant_get_int32 (variant);
1378 g_variant_unref (variant);
1379 }
1380 return value;
1381}
1382
Norman Jamese2765102015-08-19 22:00:55 -05001383static void
Norman James5d78b4d2015-09-05 13:34:34 -05001384sensor_value_proxy_init (SensorValueProxy *proxy)
Norman Jamese2765102015-08-19 22:00:55 -05001385{
1386#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05001387 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
Norman Jamese2765102015-08-19 22:00:55 -05001388#else
Norman James5d78b4d2015-09-05 13:34:34 -05001389 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
Norman Jamese2765102015-08-19 22:00:55 -05001390#endif
1391
Norman James5d78b4d2015-09-05 13:34:34 -05001392 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
Norman Jamese2765102015-08-19 22:00:55 -05001393}
1394
1395static void
Norman James5d78b4d2015-09-05 13:34:34 -05001396sensor_value_proxy_class_init (SensorValueProxyClass *klass)
Norman Jamese2765102015-08-19 22:00:55 -05001397{
1398 GObjectClass *gobject_class;
1399 GDBusProxyClass *proxy_class;
1400
1401 gobject_class = G_OBJECT_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05001402 gobject_class->finalize = sensor_value_proxy_finalize;
1403 gobject_class->get_property = sensor_value_proxy_get_property;
1404 gobject_class->set_property = sensor_value_proxy_set_property;
Norman Jamese2765102015-08-19 22:00:55 -05001405
1406 proxy_class = G_DBUS_PROXY_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05001407 proxy_class->g_signal = sensor_value_proxy_g_signal;
1408 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
Norman Jamese2765102015-08-19 22:00:55 -05001409
Norman James5d78b4d2015-09-05 13:34:34 -05001410 sensor_value_override_properties (gobject_class, 1);
Norman Jamese2765102015-08-19 22:00:55 -05001411
1412#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05001413 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
Norman Jamese2765102015-08-19 22:00:55 -05001414#endif
1415}
1416
1417static void
Norman James5d78b4d2015-09-05 13:34:34 -05001418sensor_value_proxy_iface_init (SensorValueIface *iface)
Norman Jamese2765102015-08-19 22:00:55 -05001419{
Norman James5d78b4d2015-09-05 13:34:34 -05001420 iface->get_value = sensor_value_proxy_get_value;
1421 iface->get_units = sensor_value_proxy_get_units;
1422 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
1423 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
Norman Jamese2765102015-08-19 22:00:55 -05001424}
1425
1426/**
Norman James5d78b4d2015-09-05 13:34:34 -05001427 * sensor_value_proxy_new:
Norman Jamese2765102015-08-19 22:00:55 -05001428 * @connection: A #GDBusConnection.
1429 * @flags: Flags from the #GDBusProxyFlags enumeration.
1430 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1431 * @object_path: An object path.
1432 * @cancellable: (allow-none): A #GCancellable or %NULL.
1433 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1434 * @user_data: User data to pass to @callback.
1435 *
Norman James5d78b4d2015-09-05 13:34:34 -05001436 * 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 Jamese2765102015-08-19 22:00:55 -05001437 *
1438 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James5d78b4d2015-09-05 13:34:34 -05001439 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
Norman Jamese2765102015-08-19 22:00:55 -05001440 *
Norman James5d78b4d2015-09-05 13:34:34 -05001441 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
Norman Jamese2765102015-08-19 22:00:55 -05001442 */
1443void
Norman James5d78b4d2015-09-05 13:34:34 -05001444sensor_value_proxy_new (
Norman Jamese2765102015-08-19 22:00:55 -05001445 GDBusConnection *connection,
1446 GDBusProxyFlags flags,
1447 const gchar *name,
1448 const gchar *object_path,
1449 GCancellable *cancellable,
1450 GAsyncReadyCallback callback,
1451 gpointer user_data)
1452{
Norman James5d78b4d2015-09-05 13:34:34 -05001453 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 Jamese2765102015-08-19 22:00:55 -05001454}
1455
1456/**
Norman James5d78b4d2015-09-05 13:34:34 -05001457 * sensor_value_proxy_new_finish:
1458 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
Norman Jamese2765102015-08-19 22:00:55 -05001459 * @error: Return location for error or %NULL
1460 *
Norman James5d78b4d2015-09-05 13:34:34 -05001461 * Finishes an operation started with sensor_value_proxy_new().
Norman Jamese2765102015-08-19 22:00:55 -05001462 *
Norman James5d78b4d2015-09-05 13:34:34 -05001463 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamese2765102015-08-19 22:00:55 -05001464 */
Norman James5d78b4d2015-09-05 13:34:34 -05001465SensorValue *
1466sensor_value_proxy_new_finish (
Norman Jamese2765102015-08-19 22:00:55 -05001467 GAsyncResult *res,
1468 GError **error)
1469{
1470 GObject *ret;
1471 GObject *source_object;
1472 source_object = g_async_result_get_source_object (res);
1473 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1474 g_object_unref (source_object);
1475 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05001476 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05001477 else
1478 return NULL;
1479}
1480
1481/**
Norman James5d78b4d2015-09-05 13:34:34 -05001482 * sensor_value_proxy_new_sync:
Norman Jamese2765102015-08-19 22:00:55 -05001483 * @connection: A #GDBusConnection.
1484 * @flags: Flags from the #GDBusProxyFlags enumeration.
1485 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1486 * @object_path: An object path.
1487 * @cancellable: (allow-none): A #GCancellable or %NULL.
1488 * @error: Return location for error or %NULL
1489 *
Norman James5d78b4d2015-09-05 13:34:34 -05001490 * 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 Jamese2765102015-08-19 22:00:55 -05001491 *
1492 * The calling thread is blocked until a reply is received.
1493 *
Norman James5d78b4d2015-09-05 13:34:34 -05001494 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
Norman Jamese2765102015-08-19 22:00:55 -05001495 *
Norman James5d78b4d2015-09-05 13:34:34 -05001496 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamese2765102015-08-19 22:00:55 -05001497 */
Norman James5d78b4d2015-09-05 13:34:34 -05001498SensorValue *
1499sensor_value_proxy_new_sync (
Norman Jamese2765102015-08-19 22:00:55 -05001500 GDBusConnection *connection,
1501 GDBusProxyFlags flags,
1502 const gchar *name,
1503 const gchar *object_path,
1504 GCancellable *cancellable,
1505 GError **error)
1506{
1507 GInitable *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05001508 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 Jamese2765102015-08-19 22:00:55 -05001509 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05001510 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05001511 else
1512 return NULL;
1513}
1514
1515
1516/**
Norman James5d78b4d2015-09-05 13:34:34 -05001517 * sensor_value_proxy_new_for_bus:
Norman Jamese2765102015-08-19 22:00:55 -05001518 * @bus_type: A #GBusType.
1519 * @flags: Flags from the #GDBusProxyFlags enumeration.
1520 * @name: A bus name (well-known or unique).
1521 * @object_path: An object path.
1522 * @cancellable: (allow-none): A #GCancellable or %NULL.
1523 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1524 * @user_data: User data to pass to @callback.
1525 *
Norman James5d78b4d2015-09-05 13:34:34 -05001526 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
Norman Jamese2765102015-08-19 22:00:55 -05001527 *
1528 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James5d78b4d2015-09-05 13:34:34 -05001529 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
Norman Jamese2765102015-08-19 22:00:55 -05001530 *
Norman James5d78b4d2015-09-05 13:34:34 -05001531 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
Norman Jamese2765102015-08-19 22:00:55 -05001532 */
1533void
Norman James5d78b4d2015-09-05 13:34:34 -05001534sensor_value_proxy_new_for_bus (
Norman Jamese2765102015-08-19 22:00:55 -05001535 GBusType bus_type,
1536 GDBusProxyFlags flags,
1537 const gchar *name,
1538 const gchar *object_path,
1539 GCancellable *cancellable,
1540 GAsyncReadyCallback callback,
1541 gpointer user_data)
1542{
Norman James5d78b4d2015-09-05 13:34:34 -05001543 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 Jamese2765102015-08-19 22:00:55 -05001544}
1545
1546/**
Norman James5d78b4d2015-09-05 13:34:34 -05001547 * sensor_value_proxy_new_for_bus_finish:
1548 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
Norman Jamese2765102015-08-19 22:00:55 -05001549 * @error: Return location for error or %NULL
1550 *
Norman James5d78b4d2015-09-05 13:34:34 -05001551 * Finishes an operation started with sensor_value_proxy_new_for_bus().
Norman Jamese2765102015-08-19 22:00:55 -05001552 *
Norman James5d78b4d2015-09-05 13:34:34 -05001553 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamese2765102015-08-19 22:00:55 -05001554 */
Norman James5d78b4d2015-09-05 13:34:34 -05001555SensorValue *
1556sensor_value_proxy_new_for_bus_finish (
Norman Jamese2765102015-08-19 22:00:55 -05001557 GAsyncResult *res,
1558 GError **error)
1559{
1560 GObject *ret;
1561 GObject *source_object;
1562 source_object = g_async_result_get_source_object (res);
1563 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1564 g_object_unref (source_object);
1565 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05001566 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05001567 else
1568 return NULL;
1569}
1570
1571/**
Norman James5d78b4d2015-09-05 13:34:34 -05001572 * sensor_value_proxy_new_for_bus_sync:
Norman Jamese2765102015-08-19 22:00:55 -05001573 * @bus_type: A #GBusType.
1574 * @flags: Flags from the #GDBusProxyFlags enumeration.
1575 * @name: A bus name (well-known or unique).
1576 * @object_path: An object path.
1577 * @cancellable: (allow-none): A #GCancellable or %NULL.
1578 * @error: Return location for error or %NULL
1579 *
Norman James5d78b4d2015-09-05 13:34:34 -05001580 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
Norman Jamese2765102015-08-19 22:00:55 -05001581 *
1582 * The calling thread is blocked until a reply is received.
1583 *
Norman James5d78b4d2015-09-05 13:34:34 -05001584 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
Norman Jamese2765102015-08-19 22:00:55 -05001585 *
Norman James5d78b4d2015-09-05 13:34:34 -05001586 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamese2765102015-08-19 22:00:55 -05001587 */
Norman James5d78b4d2015-09-05 13:34:34 -05001588SensorValue *
1589sensor_value_proxy_new_for_bus_sync (
Norman Jamese2765102015-08-19 22:00:55 -05001590 GBusType bus_type,
1591 GDBusProxyFlags flags,
1592 const gchar *name,
1593 const gchar *object_path,
1594 GCancellable *cancellable,
1595 GError **error)
1596{
1597 GInitable *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05001598 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 Jamese2765102015-08-19 22:00:55 -05001599 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05001600 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05001601 else
1602 return NULL;
1603}
1604
1605
1606/* ------------------------------------------------------------------------ */
1607
1608/**
Norman James5d78b4d2015-09-05 13:34:34 -05001609 * SensorValueSkeleton:
Norman Jamese2765102015-08-19 22:00:55 -05001610 *
Norman James5d78b4d2015-09-05 13:34:34 -05001611 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
Norman Jamese2765102015-08-19 22:00:55 -05001612 */
1613
1614/**
Norman James5d78b4d2015-09-05 13:34:34 -05001615 * SensorValueSkeletonClass:
Norman Jamese2765102015-08-19 22:00:55 -05001616 * @parent_class: The parent class.
1617 *
Norman James5d78b4d2015-09-05 13:34:34 -05001618 * Class structure for #SensorValueSkeleton.
Norman Jamese2765102015-08-19 22:00:55 -05001619 */
1620
Norman James5d78b4d2015-09-05 13:34:34 -05001621struct _SensorValueSkeletonPrivate
Norman Jamese2765102015-08-19 22:00:55 -05001622{
1623 GValue *properties;
1624 GList *changed_properties;
1625 GSource *changed_properties_idle_source;
1626 GMainContext *context;
1627 GMutex lock;
1628};
1629
1630static void
Norman James5d78b4d2015-09-05 13:34:34 -05001631_sensor_value_skeleton_handle_method_call (
Norman Jamese2765102015-08-19 22:00:55 -05001632 GDBusConnection *connection G_GNUC_UNUSED,
1633 const gchar *sender G_GNUC_UNUSED,
1634 const gchar *object_path G_GNUC_UNUSED,
1635 const gchar *interface_name,
1636 const gchar *method_name,
1637 GVariant *parameters,
1638 GDBusMethodInvocation *invocation,
1639 gpointer user_data)
1640{
Norman James5d78b4d2015-09-05 13:34:34 -05001641 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
Norman Jamese2765102015-08-19 22:00:55 -05001642 _ExtendedGDBusMethodInfo *info;
1643 GVariantIter iter;
1644 GVariant *child;
1645 GValue *paramv;
1646 guint num_params;
1647 guint num_extra;
1648 guint n;
1649 guint signal_id;
1650 GValue return_value = G_VALUE_INIT;
1651 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1652 g_assert (info != NULL);
1653 num_params = g_variant_n_children (parameters);
1654 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1655 n = 0;
Norman James5d78b4d2015-09-05 13:34:34 -05001656 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
Norman Jamese2765102015-08-19 22:00:55 -05001657 g_value_set_object (&paramv[n++], skeleton);
1658 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1659 g_value_set_object (&paramv[n++], invocation);
1660 if (info->pass_fdlist)
1661 {
1662#ifdef G_OS_UNIX
1663 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1664 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1665#else
1666 g_assert_not_reached ();
1667#endif
1668 }
1669 g_variant_iter_init (&iter, parameters);
1670 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1671 {
1672 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1673 if (arg_info->use_gvariant)
1674 {
1675 g_value_init (&paramv[n], G_TYPE_VARIANT);
1676 g_value_set_variant (&paramv[n], child);
1677 n++;
1678 }
1679 else
1680 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1681 g_variant_unref (child);
1682 }
Norman James5d78b4d2015-09-05 13:34:34 -05001683 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
Norman Jamese2765102015-08-19 22:00:55 -05001684 g_value_init (&return_value, G_TYPE_BOOLEAN);
1685 g_signal_emitv (paramv, signal_id, 0, &return_value);
1686 if (!g_value_get_boolean (&return_value))
1687 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
1688 g_value_unset (&return_value);
1689 for (n = 0; n < num_params + num_extra; n++)
1690 g_value_unset (&paramv[n]);
1691 g_free (paramv);
1692}
1693
1694static GVariant *
Norman James5d78b4d2015-09-05 13:34:34 -05001695_sensor_value_skeleton_handle_get_property (
Norman Jamese2765102015-08-19 22:00:55 -05001696 GDBusConnection *connection G_GNUC_UNUSED,
1697 const gchar *sender G_GNUC_UNUSED,
1698 const gchar *object_path G_GNUC_UNUSED,
1699 const gchar *interface_name G_GNUC_UNUSED,
1700 const gchar *property_name,
1701 GError **error,
1702 gpointer user_data)
1703{
Norman James5d78b4d2015-09-05 13:34:34 -05001704 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
Norman Jamese2765102015-08-19 22:00:55 -05001705 GValue value = G_VALUE_INIT;
1706 GParamSpec *pspec;
1707 _ExtendedGDBusPropertyInfo *info;
1708 GVariant *ret;
1709 ret = NULL;
Norman James5d78b4d2015-09-05 13:34:34 -05001710 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
Norman Jamese2765102015-08-19 22:00:55 -05001711 g_assert (info != NULL);
1712 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1713 if (pspec == NULL)
1714 {
1715 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1716 }
1717 else
1718 {
1719 g_value_init (&value, pspec->value_type);
1720 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1721 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1722 g_value_unset (&value);
1723 }
1724 return ret;
1725}
1726
1727static gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05001728_sensor_value_skeleton_handle_set_property (
Norman Jamese2765102015-08-19 22:00:55 -05001729 GDBusConnection *connection G_GNUC_UNUSED,
1730 const gchar *sender G_GNUC_UNUSED,
1731 const gchar *object_path G_GNUC_UNUSED,
1732 const gchar *interface_name G_GNUC_UNUSED,
1733 const gchar *property_name,
1734 GVariant *variant,
1735 GError **error,
1736 gpointer user_data)
1737{
Norman James5d78b4d2015-09-05 13:34:34 -05001738 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
Norman Jamese2765102015-08-19 22:00:55 -05001739 GValue value = G_VALUE_INIT;
1740 GParamSpec *pspec;
1741 _ExtendedGDBusPropertyInfo *info;
1742 gboolean ret;
1743 ret = FALSE;
Norman James5d78b4d2015-09-05 13:34:34 -05001744 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
Norman Jamese2765102015-08-19 22:00:55 -05001745 g_assert (info != NULL);
1746 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1747 if (pspec == NULL)
1748 {
1749 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1750 }
1751 else
1752 {
1753 if (info->use_gvariant)
1754 g_value_set_variant (&value, variant);
1755 else
1756 g_dbus_gvariant_to_gvalue (variant, &value);
1757 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1758 g_value_unset (&value);
1759 ret = TRUE;
1760 }
1761 return ret;
1762}
1763
Norman James5d78b4d2015-09-05 13:34:34 -05001764static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
Norman Jamese2765102015-08-19 22:00:55 -05001765{
Norman James5d78b4d2015-09-05 13:34:34 -05001766 _sensor_value_skeleton_handle_method_call,
1767 _sensor_value_skeleton_handle_get_property,
1768 _sensor_value_skeleton_handle_set_property,
Norman Jamese2765102015-08-19 22:00:55 -05001769 {NULL}
1770};
1771
1772static GDBusInterfaceInfo *
Norman James5d78b4d2015-09-05 13:34:34 -05001773sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
Norman Jamese2765102015-08-19 22:00:55 -05001774{
Norman James5d78b4d2015-09-05 13:34:34 -05001775 return sensor_value_interface_info ();
Norman Jamese2765102015-08-19 22:00:55 -05001776}
1777
1778static GDBusInterfaceVTable *
Norman James5d78b4d2015-09-05 13:34:34 -05001779sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
Norman Jamese2765102015-08-19 22:00:55 -05001780{
Norman James5d78b4d2015-09-05 13:34:34 -05001781 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
Norman Jamese2765102015-08-19 22:00:55 -05001782}
1783
1784static GVariant *
Norman James5d78b4d2015-09-05 13:34:34 -05001785sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
Norman Jamese2765102015-08-19 22:00:55 -05001786{
Norman James5d78b4d2015-09-05 13:34:34 -05001787 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
Norman Jamese2765102015-08-19 22:00:55 -05001788
1789 GVariantBuilder builder;
1790 guint n;
1791 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
Norman James5d78b4d2015-09-05 13:34:34 -05001792 if (_sensor_value_interface_info.parent_struct.properties == NULL)
Norman Jamese2765102015-08-19 22:00:55 -05001793 goto out;
Norman James5d78b4d2015-09-05 13:34:34 -05001794 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
Norman Jamese2765102015-08-19 22:00:55 -05001795 {
Norman James5d78b4d2015-09-05 13:34:34 -05001796 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
Norman Jamese2765102015-08-19 22:00:55 -05001797 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1798 {
1799 GVariant *value;
Norman James5d78b4d2015-09-05 13:34:34 -05001800 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 Jamese2765102015-08-19 22:00:55 -05001801 if (value != NULL)
1802 {
1803 g_variant_take_ref (value);
1804 g_variant_builder_add (&builder, "{sv}", info->name, value);
1805 g_variant_unref (value);
1806 }
1807 }
1808 }
1809out:
1810 return g_variant_builder_end (&builder);
1811}
1812
Norman James5d78b4d2015-09-05 13:34:34 -05001813static gboolean _sensor_value_emit_changed (gpointer user_data);
Norman Jamese2765102015-08-19 22:00:55 -05001814
1815static void
Norman James5d78b4d2015-09-05 13:34:34 -05001816sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
Norman Jamese2765102015-08-19 22:00:55 -05001817{
Norman James5d78b4d2015-09-05 13:34:34 -05001818 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
Norman Jamese2765102015-08-19 22:00:55 -05001819 gboolean emit_changed = FALSE;
1820
1821 g_mutex_lock (&skeleton->priv->lock);
1822 if (skeleton->priv->changed_properties_idle_source != NULL)
1823 {
1824 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1825 skeleton->priv->changed_properties_idle_source = NULL;
1826 emit_changed = TRUE;
1827 }
1828 g_mutex_unlock (&skeleton->priv->lock);
1829
1830 if (emit_changed)
Norman James5d78b4d2015-09-05 13:34:34 -05001831 _sensor_value_emit_changed (skeleton);
Norman Jamese2765102015-08-19 22:00:55 -05001832}
1833
1834static void
Norman James5d78b4d2015-09-05 13:34:34 -05001835_sensor_value_on_signal_changed (
1836 SensorValue *object,
1837 GVariant *arg_value,
Norman James90baede2015-09-02 20:32:49 -05001838 const gchar *arg_units)
Norman Jamese2765102015-08-19 22:00:55 -05001839{
Norman James5d78b4d2015-09-05 13:34:34 -05001840 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamese2765102015-08-19 22:00:55 -05001841
1842 GList *connections, *l;
1843 GVariant *signal_variant;
1844 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1845
Norman James5d78b4d2015-09-05 13:34:34 -05001846 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
Norman James90baede2015-09-02 20:32:49 -05001847 arg_value,
1848 arg_units));
Norman Jamese2765102015-08-19 22:00:55 -05001849 for (l = connections; l != NULL; l = l->next)
1850 {
1851 GDBusConnection *connection = l->data;
1852 g_dbus_connection_emit_signal (connection,
Norman James5d78b4d2015-09-05 13:34:34 -05001853 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
Norman Jamese2765102015-08-19 22:00:55 -05001854 signal_variant, NULL);
1855 }
1856 g_variant_unref (signal_variant);
1857 g_list_free_full (connections, g_object_unref);
1858}
1859
Norman James3f97c5d2015-08-26 17:44:14 -05001860static void
Norman James5d78b4d2015-09-05 13:34:34 -05001861_sensor_value_on_signal_heartbeat (
1862 SensorValue *object,
Norman James90baede2015-09-02 20:32:49 -05001863 const gchar *arg_bus_name)
Norman James3f97c5d2015-08-26 17:44:14 -05001864{
Norman James5d78b4d2015-09-05 13:34:34 -05001865 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman James3f97c5d2015-08-26 17:44:14 -05001866
1867 GList *connections, *l;
1868 GVariant *signal_variant;
1869 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1870
Norman James90baede2015-09-02 20:32:49 -05001871 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
1872 arg_bus_name));
Norman James3f97c5d2015-08-26 17:44:14 -05001873 for (l = connections; l != NULL; l = l->next)
1874 {
1875 GDBusConnection *connection = l->data;
1876 g_dbus_connection_emit_signal (connection,
Norman James5d78b4d2015-09-05 13:34:34 -05001877 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
Norman James3f97c5d2015-08-26 17:44:14 -05001878 signal_variant, NULL);
1879 }
1880 g_variant_unref (signal_variant);
1881 g_list_free_full (connections, g_object_unref);
1882}
1883
Norman James5d78b4d2015-09-05 13:34:34 -05001884static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
Norman Jamese2765102015-08-19 22:00:55 -05001885#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05001886G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1887 G_ADD_PRIVATE (SensorValueSkeleton)
1888 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
Norman Jamese2765102015-08-19 22:00:55 -05001889
1890#else
Norman James5d78b4d2015-09-05 13:34:34 -05001891G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1892 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
Norman Jamese2765102015-08-19 22:00:55 -05001893
1894#endif
1895static void
Norman James5d78b4d2015-09-05 13:34:34 -05001896sensor_value_skeleton_finalize (GObject *object)
Norman Jamese2765102015-08-19 22:00:55 -05001897{
Norman James5d78b4d2015-09-05 13:34:34 -05001898 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamese2765102015-08-19 22:00:55 -05001899 guint n;
Norman James90baede2015-09-02 20:32:49 -05001900 for (n = 0; n < 4; n++)
Norman Jamese2765102015-08-19 22:00:55 -05001901 g_value_unset (&skeleton->priv->properties[n]);
1902 g_free (skeleton->priv->properties);
1903 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1904 if (skeleton->priv->changed_properties_idle_source != NULL)
1905 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1906 g_main_context_unref (skeleton->priv->context);
1907 g_mutex_clear (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05001908 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
Norman Jamese2765102015-08-19 22:00:55 -05001909}
1910
1911static void
Norman James5d78b4d2015-09-05 13:34:34 -05001912sensor_value_skeleton_get_property (GObject *object,
Norman Jamese2765102015-08-19 22:00:55 -05001913 guint prop_id,
1914 GValue *value,
1915 GParamSpec *pspec G_GNUC_UNUSED)
1916{
Norman James5d78b4d2015-09-05 13:34:34 -05001917 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05001918 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05001919 g_mutex_lock (&skeleton->priv->lock);
1920 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1921 g_mutex_unlock (&skeleton->priv->lock);
1922}
1923
1924static gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05001925_sensor_value_emit_changed (gpointer user_data)
Norman Jamese2765102015-08-19 22:00:55 -05001926{
Norman James5d78b4d2015-09-05 13:34:34 -05001927 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
Norman Jamese2765102015-08-19 22:00:55 -05001928 GList *l;
1929 GVariantBuilder builder;
1930 GVariantBuilder invalidated_builder;
1931 guint num_changes;
1932
1933 g_mutex_lock (&skeleton->priv->lock);
1934 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1935 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1936 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1937 {
1938 ChangedProperty *cp = l->data;
1939 GVariant *variant;
1940 const GValue *cur_value;
1941
1942 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1943 if (!_g_value_equal (cur_value, &cp->orig_value))
1944 {
1945 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1946 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1947 g_variant_unref (variant);
1948 num_changes++;
1949 }
1950 }
1951 if (num_changes > 0)
1952 {
1953 GList *connections, *ll;
1954 GVariant *signal_variant;
Norman James5d78b4d2015-09-05 13:34:34 -05001955 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
Norman Jamese2765102015-08-19 22:00:55 -05001956 &builder, &invalidated_builder));
1957 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1958 for (ll = connections; ll != NULL; ll = ll->next)
1959 {
1960 GDBusConnection *connection = ll->data;
1961
1962 g_dbus_connection_emit_signal (connection,
1963 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1964 "org.freedesktop.DBus.Properties",
1965 "PropertiesChanged",
1966 signal_variant,
1967 NULL);
1968 }
1969 g_variant_unref (signal_variant);
1970 g_list_free_full (connections, g_object_unref);
1971 }
1972 else
1973 {
1974 g_variant_builder_clear (&builder);
1975 g_variant_builder_clear (&invalidated_builder);
1976 }
1977 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1978 skeleton->priv->changed_properties = NULL;
1979 skeleton->priv->changed_properties_idle_source = NULL;
1980 g_mutex_unlock (&skeleton->priv->lock);
1981 return FALSE;
1982}
1983
1984static void
Norman James5d78b4d2015-09-05 13:34:34 -05001985_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
Norman Jamese2765102015-08-19 22:00:55 -05001986{
1987 ChangedProperty *cp;
1988 GList *l;
1989 cp = NULL;
1990 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1991 {
1992 ChangedProperty *i_cp = l->data;
1993 if (i_cp->info == info)
1994 {
1995 cp = i_cp;
1996 break;
1997 }
1998 }
1999 if (cp == NULL)
2000 {
2001 cp = g_new0 (ChangedProperty, 1);
2002 cp->prop_id = prop_id;
2003 cp->info = info;
2004 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2005 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2006 g_value_copy (orig_value, &cp->orig_value);
2007 }
2008}
2009
2010static void
Norman James5d78b4d2015-09-05 13:34:34 -05002011sensor_value_skeleton_notify (GObject *object,
Norman Jamese2765102015-08-19 22:00:55 -05002012 GParamSpec *pspec G_GNUC_UNUSED)
2013{
Norman James5d78b4d2015-09-05 13:34:34 -05002014 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamese2765102015-08-19 22:00:55 -05002015 g_mutex_lock (&skeleton->priv->lock);
2016 if (skeleton->priv->changed_properties != NULL &&
2017 skeleton->priv->changed_properties_idle_source == NULL)
2018 {
2019 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2020 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
Norman James5d78b4d2015-09-05 13:34:34 -05002021 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Norman Jamese2765102015-08-19 22:00:55 -05002022 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2023 g_source_unref (skeleton->priv->changed_properties_idle_source);
2024 }
2025 g_mutex_unlock (&skeleton->priv->lock);
2026}
2027
2028static void
Norman James5d78b4d2015-09-05 13:34:34 -05002029sensor_value_skeleton_set_property (GObject *object,
Norman Jamese2765102015-08-19 22:00:55 -05002030 guint prop_id,
2031 const GValue *value,
2032 GParamSpec *pspec)
2033{
Norman James5d78b4d2015-09-05 13:34:34 -05002034 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05002035 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05002036 g_mutex_lock (&skeleton->priv->lock);
2037 g_object_freeze_notify (object);
2038 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2039 {
2040 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05002041 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
Norman Jamese2765102015-08-19 22:00:55 -05002042 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2043 g_object_notify_by_pspec (object, pspec);
2044 }
2045 g_mutex_unlock (&skeleton->priv->lock);
2046 g_object_thaw_notify (object);
2047}
2048
2049static void
Norman James5d78b4d2015-09-05 13:34:34 -05002050sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
Norman Jamese2765102015-08-19 22:00:55 -05002051{
2052#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05002053 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
Norman Jamese2765102015-08-19 22:00:55 -05002054#else
Norman James5d78b4d2015-09-05 13:34:34 -05002055 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
Norman Jamese2765102015-08-19 22:00:55 -05002056#endif
2057
2058 g_mutex_init (&skeleton->priv->lock);
2059 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James90baede2015-09-02 20:32:49 -05002060 skeleton->priv->properties = g_new0 (GValue, 4);
Norman James5d78b4d2015-09-05 13:34:34 -05002061 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
Norman Jamese2765102015-08-19 22:00:55 -05002062 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman Jamescc7ae122015-08-24 14:26:09 -05002063 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James3f97c5d2015-08-26 17:44:14 -05002064 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
Norman Jamese2765102015-08-19 22:00:55 -05002065}
2066
Norman James5d78b4d2015-09-05 13:34:34 -05002067static GVariant *
2068sensor_value_skeleton_get_value (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -05002069{
Norman James5d78b4d2015-09-05 13:34:34 -05002070 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
2071 GVariant *value;
Norman Jamese2765102015-08-19 22:00:55 -05002072 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05002073 value = g_value_get_variant (&(skeleton->priv->properties[0]));
Norman Jamese2765102015-08-19 22:00:55 -05002074 g_mutex_unlock (&skeleton->priv->lock);
2075 return value;
2076}
2077
2078static const gchar *
Norman James5d78b4d2015-09-05 13:34:34 -05002079sensor_value_skeleton_get_units (SensorValue *object)
Norman Jamese2765102015-08-19 22:00:55 -05002080{
Norman James5d78b4d2015-09-05 13:34:34 -05002081 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamese2765102015-08-19 22:00:55 -05002082 const gchar *value;
2083 g_mutex_lock (&skeleton->priv->lock);
2084 value = g_value_get_string (&(skeleton->priv->properties[1]));
2085 g_mutex_unlock (&skeleton->priv->lock);
2086 return value;
2087}
2088
Norman Jamescc7ae122015-08-24 14:26:09 -05002089static gint
Norman James5d78b4d2015-09-05 13:34:34 -05002090sensor_value_skeleton_get_poll_interval (SensorValue *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002091{
Norman James5d78b4d2015-09-05 13:34:34 -05002092 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05002093 gint value;
2094 g_mutex_lock (&skeleton->priv->lock);
2095 value = g_value_get_int (&(skeleton->priv->properties[2]));
2096 g_mutex_unlock (&skeleton->priv->lock);
2097 return value;
2098}
2099
Norman James3f97c5d2015-08-26 17:44:14 -05002100static gint
Norman James5d78b4d2015-09-05 13:34:34 -05002101sensor_value_skeleton_get_heatbeat (SensorValue *object)
Norman James3f97c5d2015-08-26 17:44:14 -05002102{
Norman James5d78b4d2015-09-05 13:34:34 -05002103 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman James3f97c5d2015-08-26 17:44:14 -05002104 gint value;
2105 g_mutex_lock (&skeleton->priv->lock);
2106 value = g_value_get_int (&(skeleton->priv->properties[3]));
2107 g_mutex_unlock (&skeleton->priv->lock);
2108 return value;
2109}
2110
Norman Jamese2765102015-08-19 22:00:55 -05002111static void
Norman James5d78b4d2015-09-05 13:34:34 -05002112sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
Norman Jamese2765102015-08-19 22:00:55 -05002113{
2114 GObjectClass *gobject_class;
2115 GDBusInterfaceSkeletonClass *skeleton_class;
2116
2117 gobject_class = G_OBJECT_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05002118 gobject_class->finalize = sensor_value_skeleton_finalize;
2119 gobject_class->get_property = sensor_value_skeleton_get_property;
2120 gobject_class->set_property = sensor_value_skeleton_set_property;
2121 gobject_class->notify = sensor_value_skeleton_notify;
Norman Jamese2765102015-08-19 22:00:55 -05002122
2123
Norman James5d78b4d2015-09-05 13:34:34 -05002124 sensor_value_override_properties (gobject_class, 1);
Norman Jamese2765102015-08-19 22:00:55 -05002125
2126 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05002127 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
2128 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
2129 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
2130 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
Norman Jamese2765102015-08-19 22:00:55 -05002131
2132#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05002133 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
Norman Jamese2765102015-08-19 22:00:55 -05002134#endif
2135}
2136
2137static void
Norman James5d78b4d2015-09-05 13:34:34 -05002138sensor_value_skeleton_iface_init (SensorValueIface *iface)
Norman Jamese2765102015-08-19 22:00:55 -05002139{
Norman James5d78b4d2015-09-05 13:34:34 -05002140 iface->changed = _sensor_value_on_signal_changed;
2141 iface->heartbeat = _sensor_value_on_signal_heartbeat;
2142 iface->get_value = sensor_value_skeleton_get_value;
2143 iface->get_units = sensor_value_skeleton_get_units;
2144 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
2145 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
Norman Jamese2765102015-08-19 22:00:55 -05002146}
2147
2148/**
Norman James5d78b4d2015-09-05 13:34:34 -05002149 * sensor_value_skeleton_new:
Norman Jamese2765102015-08-19 22:00:55 -05002150 *
Norman James5d78b4d2015-09-05 13:34:34 -05002151 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
Norman Jamese2765102015-08-19 22:00:55 -05002152 *
Norman James5d78b4d2015-09-05 13:34:34 -05002153 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
Norman Jamese2765102015-08-19 22:00:55 -05002154 */
Norman James5d78b4d2015-09-05 13:34:34 -05002155SensorValue *
2156sensor_value_skeleton_new (void)
Norman Jamese2765102015-08-19 22:00:55 -05002157{
Norman James5d78b4d2015-09-05 13:34:34 -05002158 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
Norman Jamese2765102015-08-19 22:00:55 -05002159}
2160
2161/* ------------------------------------------------------------------------
Norman James5d78b4d2015-09-05 13:34:34 -05002162 * Code for interface org.openbmc.SensorThreshold
Norman Jamese2765102015-08-19 22:00:55 -05002163 * ------------------------------------------------------------------------
2164 */
2165
2166/**
Norman James5d78b4d2015-09-05 13:34:34 -05002167 * SECTION:SensorThreshold
2168 * @title: SensorThreshold
2169 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
Norman Jamese2765102015-08-19 22:00:55 -05002170 *
Norman James5d78b4d2015-09-05 13:34:34 -05002171 * 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 Jamese2765102015-08-19 22:00:55 -05002172 */
2173
Norman James5d78b4d2015-09-05 13:34:34 -05002174/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
Norman Jamese2765102015-08-19 22:00:55 -05002175
Norman James5d78b4d2015-09-05 13:34:34 -05002176static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
Norman Jamescc7ae122015-08-24 14:26:09 -05002177{
2178 {
2179 -1,
Norman James90baede2015-09-02 20:32:49 -05002180 (gchar *) "state",
Norman James5d78b4d2015-09-05 13:34:34 -05002181 (gchar *) "y",
Norman Jamescc7ae122015-08-24 14:26:09 -05002182 NULL
2183 },
2184 FALSE
2185};
2186
Norman James5d78b4d2015-09-05 13:34:34 -05002187static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
Norman Jamescc7ae122015-08-24 14:26:09 -05002188{
Norman James5d78b4d2015-09-05 13:34:34 -05002189 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002190 NULL
2191};
2192
Norman James5d78b4d2015-09-05 13:34:34 -05002193static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
Norman Jamescc7ae122015-08-24 14:26:09 -05002194{
2195 {
2196 -1,
Norman James90baede2015-09-02 20:32:49 -05002197 (gchar *) "getState",
Norman Jamescc7ae122015-08-24 14:26:09 -05002198 NULL,
Norman James5d78b4d2015-09-05 13:34:34 -05002199 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
Norman Jamescc7ae122015-08-24 14:26:09 -05002200 NULL
2201 },
Norman James90baede2015-09-02 20:32:49 -05002202 "handle-get-state",
Norman Jamescc7ae122015-08-24 14:26:09 -05002203 FALSE
2204};
2205
Norman James5d78b4d2015-09-05 13:34:34 -05002206static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
Norman Jamescc7ae122015-08-24 14:26:09 -05002207{
Norman James5d78b4d2015-09-05 13:34:34 -05002208 &_sensor_threshold_method_info_get_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002209 NULL
2210};
2211
Norman James5d78b4d2015-09-05 13:34:34 -05002212static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05002213{
2214 {
2215 -1,
Norman James90baede2015-09-02 20:32:49 -05002216 (gchar *) "Warning",
2217 NULL,
Norman Jamescc7ae122015-08-24 14:26:09 -05002218 NULL
2219 },
2220 "warning"
2221};
2222
Norman James5d78b4d2015-09-05 13:34:34 -05002223static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
Norman James90baede2015-09-02 20:32:49 -05002224{
2225 {
2226 -1,
2227 (gchar *) "Critical",
2228 NULL,
2229 NULL
2230 },
2231 "critical"
2232};
2233
Norman James5d78b4d2015-09-05 13:34:34 -05002234static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
Norman James90baede2015-09-02 20:32:49 -05002235{
2236 {
2237 -1,
2238 (gchar *) "Normal",
2239 NULL,
2240 NULL
2241 },
2242 "normal"
2243};
2244
Norman James5d78b4d2015-09-05 13:34:34 -05002245static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
Norman Jamescc7ae122015-08-24 14:26:09 -05002246{
Norman James5d78b4d2015-09-05 13:34:34 -05002247 &_sensor_threshold_signal_info_warning,
2248 &_sensor_threshold_signal_info_critical,
2249 &_sensor_threshold_signal_info_normal,
Norman Jamescc7ae122015-08-24 14:26:09 -05002250 NULL
2251};
2252
Norman James5d78b4d2015-09-05 13:34:34 -05002253static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
Norman Jamescc7ae122015-08-24 14:26:09 -05002254{
2255 {
2256 -1,
Norman James90baede2015-09-02 20:32:49 -05002257 (gchar *) "lower_critical",
Norman James5d78b4d2015-09-05 13:34:34 -05002258 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -05002259 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05002260 NULL
2261 },
Norman James90baede2015-09-02 20:32:49 -05002262 "lower-critical",
Norman Jamescc7ae122015-08-24 14:26:09 -05002263 FALSE
2264};
2265
Norman James5d78b4d2015-09-05 13:34:34 -05002266static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05002267{
2268 {
2269 -1,
Norman James90baede2015-09-02 20:32:49 -05002270 (gchar *) "lower_warning",
Norman James5d78b4d2015-09-05 13:34:34 -05002271 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -05002272 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05002273 NULL
2274 },
Norman James90baede2015-09-02 20:32:49 -05002275 "lower-warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05002276 FALSE
2277};
2278
Norman James5d78b4d2015-09-05 13:34:34 -05002279static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05002280{
2281 {
2282 -1,
Norman James90baede2015-09-02 20:32:49 -05002283 (gchar *) "upper_warning",
Norman James5d78b4d2015-09-05 13:34:34 -05002284 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -05002285 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05002286 NULL
2287 },
Norman James90baede2015-09-02 20:32:49 -05002288 "upper-warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05002289 FALSE
2290};
2291
Norman James5d78b4d2015-09-05 13:34:34 -05002292static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
Norman Jamescc7ae122015-08-24 14:26:09 -05002293{
2294 {
2295 -1,
Norman James90baede2015-09-02 20:32:49 -05002296 (gchar *) "upper_critical",
Norman James5d78b4d2015-09-05 13:34:34 -05002297 (gchar *) "v",
Norman James90baede2015-09-02 20:32:49 -05002298 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2299 NULL
2300 },
2301 "upper-critical",
2302 FALSE
2303};
2304
Norman James5d78b4d2015-09-05 13:34:34 -05002305static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
Norman James90baede2015-09-02 20:32:49 -05002306{
2307 {
2308 -1,
2309 (gchar *) "state",
Norman James5d78b4d2015-09-05 13:34:34 -05002310 (gchar *) "y",
Norman Jamescc7ae122015-08-24 14:26:09 -05002311 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2312 NULL
2313 },
Norman James90baede2015-09-02 20:32:49 -05002314 "state",
Norman Jamescc7ae122015-08-24 14:26:09 -05002315 FALSE
2316};
2317
Norman James5d78b4d2015-09-05 13:34:34 -05002318static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
Norman Jamescc7ae122015-08-24 14:26:09 -05002319{
Norman James5d78b4d2015-09-05 13:34:34 -05002320 &_sensor_threshold_property_info_lower_critical,
2321 &_sensor_threshold_property_info_lower_warning,
2322 &_sensor_threshold_property_info_upper_warning,
2323 &_sensor_threshold_property_info_upper_critical,
2324 &_sensor_threshold_property_info_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002325 NULL
2326};
2327
Norman James5d78b4d2015-09-05 13:34:34 -05002328static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
Norman Jamescc7ae122015-08-24 14:26:09 -05002329{
2330 {
2331 -1,
Norman James5d78b4d2015-09-05 13:34:34 -05002332 (gchar *) "org.openbmc.SensorThreshold",
2333 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
2334 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
2335 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
Norman Jamescc7ae122015-08-24 14:26:09 -05002336 NULL
2337 },
Norman James5d78b4d2015-09-05 13:34:34 -05002338 "sensor-threshold",
Norman Jamescc7ae122015-08-24 14:26:09 -05002339};
2340
2341
2342/**
Norman James5d78b4d2015-09-05 13:34:34 -05002343 * sensor_threshold_interface_info:
Norman Jamescc7ae122015-08-24 14:26:09 -05002344 *
Norman James5d78b4d2015-09-05 13:34:34 -05002345 * 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 Jamescc7ae122015-08-24 14:26:09 -05002346 *
2347 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2348 */
2349GDBusInterfaceInfo *
Norman James5d78b4d2015-09-05 13:34:34 -05002350sensor_threshold_interface_info (void)
Norman Jamescc7ae122015-08-24 14:26:09 -05002351{
Norman James5d78b4d2015-09-05 13:34:34 -05002352 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
Norman Jamescc7ae122015-08-24 14:26:09 -05002353}
2354
2355/**
Norman James5d78b4d2015-09-05 13:34:34 -05002356 * sensor_threshold_override_properties:
Norman Jamescc7ae122015-08-24 14:26:09 -05002357 * @klass: The class structure for a #GObject<!-- -->-derived class.
2358 * @property_id_begin: The property id to assign to the first overridden property.
2359 *
Norman James5d78b4d2015-09-05 13:34:34 -05002360 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
Norman Jamescc7ae122015-08-24 14:26:09 -05002361 * The properties are overridden in the order they are defined.
2362 *
2363 * Returns: The last property id.
2364 */
2365guint
Norman James5d78b4d2015-09-05 13:34:34 -05002366sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
Norman Jamescc7ae122015-08-24 14:26:09 -05002367{
Norman James90baede2015-09-02 20:32:49 -05002368 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
2369 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
2370 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
2371 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
2372 g_object_class_override_property (klass, property_id_begin++, "state");
Norman Jamescc7ae122015-08-24 14:26:09 -05002373 return property_id_begin - 1;
2374}
2375
2376
2377
2378/**
Norman James5d78b4d2015-09-05 13:34:34 -05002379 * SensorThreshold:
Norman Jamescc7ae122015-08-24 14:26:09 -05002380 *
Norman James5d78b4d2015-09-05 13:34:34 -05002381 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002382 */
2383
2384/**
Norman James5d78b4d2015-09-05 13:34:34 -05002385 * SensorThresholdIface:
Norman Jamescc7ae122015-08-24 14:26:09 -05002386 * @parent_iface: The parent interface.
Norman James5d78b4d2015-09-05 13:34:34 -05002387 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
2388 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
2389 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
2390 * @get_state: Getter for the #SensorThreshold:state property.
2391 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
2392 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
2393 * @critical: Handler for the #SensorThreshold::critical signal.
2394 * @normal: Handler for the #SensorThreshold::normal signal.
2395 * @warning: Handler for the #SensorThreshold::warning signal.
Norman Jamescc7ae122015-08-24 14:26:09 -05002396 *
Norman James5d78b4d2015-09-05 13:34:34 -05002397 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002398 */
2399
Norman James5d78b4d2015-09-05 13:34:34 -05002400typedef SensorThresholdIface SensorThresholdInterface;
2401G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
Norman Jamescc7ae122015-08-24 14:26:09 -05002402
2403static void
Norman James5d78b4d2015-09-05 13:34:34 -05002404sensor_threshold_default_init (SensorThresholdIface *iface)
Norman Jamescc7ae122015-08-24 14:26:09 -05002405{
2406 /* GObject signals for incoming D-Bus method calls: */
2407 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002408 * SensorThreshold::handle-get-state:
2409 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002410 * @invocation: A #GDBusMethodInvocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05002411 *
Norman James5d78b4d2015-09-05 13:34:34 -05002412 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
Norman Jamescc7ae122015-08-24 14:26:09 -05002413 *
Norman James5d78b4d2015-09-05 13:34:34 -05002414 * 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 James90baede2015-09-02 20:32:49 -05002415 *
2416 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
Norman Jamescc7ae122015-08-24 14:26:09 -05002417 */
Norman James90baede2015-09-02 20:32:49 -05002418 g_signal_new ("handle-get-state",
Norman Jamescc7ae122015-08-24 14:26:09 -05002419 G_TYPE_FROM_INTERFACE (iface),
2420 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -05002421 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
Norman James90baede2015-09-02 20:32:49 -05002422 g_signal_accumulator_true_handled,
Norman Jamescc7ae122015-08-24 14:26:09 -05002423 NULL,
2424 g_cclosure_marshal_generic,
Norman James90baede2015-09-02 20:32:49 -05002425 G_TYPE_BOOLEAN,
2426 1,
2427 G_TYPE_DBUS_METHOD_INVOCATION);
Norman Jamescc7ae122015-08-24 14:26:09 -05002428
Norman James90baede2015-09-02 20:32:49 -05002429 /* GObject signals for received D-Bus signals: */
Norman Jamescc7ae122015-08-24 14:26:09 -05002430 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002431 * SensorThreshold::warning:
2432 * @object: A #SensorThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05002433 *
Norman James5d78b4d2015-09-05 13:34:34 -05002434 * 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 Jamescc7ae122015-08-24 14:26:09 -05002435 *
2436 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
2437 */
2438 g_signal_new ("warning",
2439 G_TYPE_FROM_INTERFACE (iface),
2440 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -05002441 G_STRUCT_OFFSET (SensorThresholdIface, warning),
Norman Jamescc7ae122015-08-24 14:26:09 -05002442 NULL,
2443 NULL,
2444 g_cclosure_marshal_generic,
2445 G_TYPE_NONE,
Norman James90baede2015-09-02 20:32:49 -05002446 0);
2447
2448 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002449 * SensorThreshold::critical:
2450 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002451 *
Norman James5d78b4d2015-09-05 13:34:34 -05002452 * 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 James90baede2015-09-02 20:32:49 -05002453 *
2454 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
2455 */
2456 g_signal_new ("critical",
2457 G_TYPE_FROM_INTERFACE (iface),
2458 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -05002459 G_STRUCT_OFFSET (SensorThresholdIface, critical),
Norman James90baede2015-09-02 20:32:49 -05002460 NULL,
2461 NULL,
2462 g_cclosure_marshal_generic,
2463 G_TYPE_NONE,
2464 0);
2465
2466 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002467 * SensorThreshold::normal:
2468 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002469 *
Norman James5d78b4d2015-09-05 13:34:34 -05002470 * 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 James90baede2015-09-02 20:32:49 -05002471 *
2472 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
2473 */
2474 g_signal_new ("normal",
2475 G_TYPE_FROM_INTERFACE (iface),
2476 G_SIGNAL_RUN_LAST,
Norman James5d78b4d2015-09-05 13:34:34 -05002477 G_STRUCT_OFFSET (SensorThresholdIface, normal),
Norman James90baede2015-09-02 20:32:49 -05002478 NULL,
2479 NULL,
2480 g_cclosure_marshal_generic,
2481 G_TYPE_NONE,
2482 0);
Norman Jamescc7ae122015-08-24 14:26:09 -05002483
2484 /* GObject properties for D-Bus properties: */
2485 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002486 * SensorThreshold:lower-critical:
Norman Jamescc7ae122015-08-24 14:26:09 -05002487 *
Norman James5d78b4d2015-09-05 13:34:34 -05002488 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002489 *
Norman James90baede2015-09-02 20:32:49 -05002490 * 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 Jamescc7ae122015-08-24 14:26:09 -05002491 */
2492 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -05002493 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05002494 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002495 * SensorThreshold:lower-warning:
Norman Jamescc7ae122015-08-24 14:26:09 -05002496 *
Norman James5d78b4d2015-09-05 13:34:34 -05002497 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002498 *
Norman James90baede2015-09-02 20:32:49 -05002499 * 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 Jamescc7ae122015-08-24 14:26:09 -05002500 */
2501 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -05002502 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05002503 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002504 * SensorThreshold:upper-warning:
Norman Jamescc7ae122015-08-24 14:26:09 -05002505 *
Norman James5d78b4d2015-09-05 13:34:34 -05002506 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002507 *
Norman James90baede2015-09-02 20:32:49 -05002508 * 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 Jamescc7ae122015-08-24 14:26:09 -05002509 */
2510 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -05002511 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05002512 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002513 * SensorThreshold:upper-critical:
Norman Jamescc7ae122015-08-24 14:26:09 -05002514 *
Norman James5d78b4d2015-09-05 13:34:34 -05002515 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
Norman James90baede2015-09-02 20:32:49 -05002516 *
2517 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
2518 */
2519 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -05002520 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James90baede2015-09-02 20:32:49 -05002521 /**
Norman James5d78b4d2015-09-05 13:34:34 -05002522 * SensorThreshold:state:
Norman James90baede2015-09-02 20:32:49 -05002523 *
Norman James5d78b4d2015-09-05 13:34:34 -05002524 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05002525 *
2526 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
2527 */
2528 g_object_interface_install_property (iface,
Norman James5d78b4d2015-09-05 13:34:34 -05002529 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05002530}
2531
2532/**
Norman James5d78b4d2015-09-05 13:34:34 -05002533 * sensor_threshold_get_lower_critical: (skip)
2534 * @object: A #SensorThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05002535 *
Norman James5d78b4d2015-09-05 13:34:34 -05002536 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
Norman James90baede2015-09-02 20:32:49 -05002537 *
2538 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2539 *
Norman James5d78b4d2015-09-05 13:34:34 -05002540 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_critical() if on another thread.</warning>
2541 *
2542 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
Norman James90baede2015-09-02 20:32:49 -05002543 */
Norman James5d78b4d2015-09-05 13:34:34 -05002544GVariant *
2545sensor_threshold_get_lower_critical (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002546{
Norman James5d78b4d2015-09-05 13:34:34 -05002547 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
Norman James90baede2015-09-02 20:32:49 -05002548}
2549
2550/**
Norman James5d78b4d2015-09-05 13:34:34 -05002551 * sensor_threshold_dup_lower_critical: (skip)
2552 * @object: A #SensorThreshold.
2553 *
2554 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
2555 *
2556 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2557 *
2558 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
2559 */
2560GVariant *
2561sensor_threshold_dup_lower_critical (SensorThreshold *object)
2562{
2563 GVariant *value;
2564 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
2565 return value;
2566}
2567
2568/**
2569 * sensor_threshold_set_lower_critical: (skip)
2570 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002571 * @value: The value to set.
2572 *
Norman James5d78b4d2015-09-05 13:34:34 -05002573 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
Norman James90baede2015-09-02 20:32:49 -05002574 *
2575 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2576 */
2577void
Norman James5d78b4d2015-09-05 13:34:34 -05002578sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
Norman James90baede2015-09-02 20:32:49 -05002579{
2580 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
2581}
2582
2583/**
Norman James5d78b4d2015-09-05 13:34:34 -05002584 * sensor_threshold_get_lower_warning: (skip)
2585 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002586 *
Norman James5d78b4d2015-09-05 13:34:34 -05002587 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
Norman James90baede2015-09-02 20:32:49 -05002588 *
2589 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2590 *
Norman James5d78b4d2015-09-05 13:34:34 -05002591 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_warning() if on another thread.</warning>
2592 *
2593 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
Norman James90baede2015-09-02 20:32:49 -05002594 */
Norman James5d78b4d2015-09-05 13:34:34 -05002595GVariant *
2596sensor_threshold_get_lower_warning (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002597{
Norman James5d78b4d2015-09-05 13:34:34 -05002598 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
Norman James90baede2015-09-02 20:32:49 -05002599}
2600
2601/**
Norman James5d78b4d2015-09-05 13:34:34 -05002602 * sensor_threshold_dup_lower_warning: (skip)
2603 * @object: A #SensorThreshold.
2604 *
2605 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
2606 *
2607 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2608 *
2609 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
2610 */
2611GVariant *
2612sensor_threshold_dup_lower_warning (SensorThreshold *object)
2613{
2614 GVariant *value;
2615 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
2616 return value;
2617}
2618
2619/**
2620 * sensor_threshold_set_lower_warning: (skip)
2621 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002622 * @value: The value to set.
2623 *
Norman James5d78b4d2015-09-05 13:34:34 -05002624 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
Norman James90baede2015-09-02 20:32:49 -05002625 *
2626 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2627 */
2628void
Norman James5d78b4d2015-09-05 13:34:34 -05002629sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
Norman James90baede2015-09-02 20:32:49 -05002630{
2631 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
2632}
2633
2634/**
Norman James5d78b4d2015-09-05 13:34:34 -05002635 * sensor_threshold_get_upper_warning: (skip)
2636 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002637 *
Norman James5d78b4d2015-09-05 13:34:34 -05002638 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
Norman James90baede2015-09-02 20:32:49 -05002639 *
2640 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2641 *
Norman James5d78b4d2015-09-05 13:34:34 -05002642 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_warning() if on another thread.</warning>
2643 *
2644 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
Norman James90baede2015-09-02 20:32:49 -05002645 */
Norman James5d78b4d2015-09-05 13:34:34 -05002646GVariant *
2647sensor_threshold_get_upper_warning (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002648{
Norman James5d78b4d2015-09-05 13:34:34 -05002649 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
Norman James90baede2015-09-02 20:32:49 -05002650}
2651
2652/**
Norman James5d78b4d2015-09-05 13:34:34 -05002653 * sensor_threshold_dup_upper_warning: (skip)
2654 * @object: A #SensorThreshold.
2655 *
2656 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
2657 *
2658 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2659 *
2660 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
2661 */
2662GVariant *
2663sensor_threshold_dup_upper_warning (SensorThreshold *object)
2664{
2665 GVariant *value;
2666 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
2667 return value;
2668}
2669
2670/**
2671 * sensor_threshold_set_upper_warning: (skip)
2672 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002673 * @value: The value to set.
2674 *
Norman James5d78b4d2015-09-05 13:34:34 -05002675 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
Norman James90baede2015-09-02 20:32:49 -05002676 *
2677 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2678 */
2679void
Norman James5d78b4d2015-09-05 13:34:34 -05002680sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
Norman James90baede2015-09-02 20:32:49 -05002681{
2682 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
2683}
2684
2685/**
Norman James5d78b4d2015-09-05 13:34:34 -05002686 * sensor_threshold_get_upper_critical: (skip)
2687 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002688 *
Norman James5d78b4d2015-09-05 13:34:34 -05002689 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
Norman James90baede2015-09-02 20:32:49 -05002690 *
2691 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2692 *
Norman James5d78b4d2015-09-05 13:34:34 -05002693 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_critical() if on another thread.</warning>
2694 *
2695 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
Norman James90baede2015-09-02 20:32:49 -05002696 */
Norman James5d78b4d2015-09-05 13:34:34 -05002697GVariant *
2698sensor_threshold_get_upper_critical (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002699{
Norman James5d78b4d2015-09-05 13:34:34 -05002700 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
Norman James90baede2015-09-02 20:32:49 -05002701}
2702
2703/**
Norman James5d78b4d2015-09-05 13:34:34 -05002704 * sensor_threshold_dup_upper_critical: (skip)
2705 * @object: A #SensorThreshold.
2706 *
2707 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
2708 *
2709 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2710 *
2711 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
2712 */
2713GVariant *
2714sensor_threshold_dup_upper_critical (SensorThreshold *object)
2715{
2716 GVariant *value;
2717 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
2718 return value;
2719}
2720
2721/**
2722 * sensor_threshold_set_upper_critical: (skip)
2723 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002724 * @value: The value to set.
2725 *
Norman James5d78b4d2015-09-05 13:34:34 -05002726 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
Norman James90baede2015-09-02 20:32:49 -05002727 *
2728 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2729 */
2730void
Norman James5d78b4d2015-09-05 13:34:34 -05002731sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
Norman James90baede2015-09-02 20:32:49 -05002732{
2733 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
2734}
2735
2736/**
Norman James5d78b4d2015-09-05 13:34:34 -05002737 * sensor_threshold_get_state: (skip)
2738 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002739 *
Norman James5d78b4d2015-09-05 13:34:34 -05002740 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -05002741 *
2742 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2743 *
2744 * Returns: The property value.
2745 */
Norman James5d78b4d2015-09-05 13:34:34 -05002746guchar
2747sensor_threshold_get_state (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002748{
Norman James5d78b4d2015-09-05 13:34:34 -05002749 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05002750}
2751
2752/**
Norman James5d78b4d2015-09-05 13:34:34 -05002753 * sensor_threshold_set_state: (skip)
2754 * @object: A #SensorThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05002755 * @value: The value to set.
2756 *
Norman James5d78b4d2015-09-05 13:34:34 -05002757 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -05002758 *
2759 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2760 */
2761void
Norman James5d78b4d2015-09-05 13:34:34 -05002762sensor_threshold_set_state (SensorThreshold *object, guchar value)
Norman Jamescc7ae122015-08-24 14:26:09 -05002763{
Norman James90baede2015-09-02 20:32:49 -05002764 g_object_set (G_OBJECT (object), "state", value, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -05002765}
2766
2767/**
Norman James5d78b4d2015-09-05 13:34:34 -05002768 * sensor_threshold_emit_warning:
2769 * @object: A #SensorThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05002770 *
Norman James5d78b4d2015-09-05 13:34:34 -05002771 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
Norman Jamescc7ae122015-08-24 14:26:09 -05002772 */
2773void
Norman James5d78b4d2015-09-05 13:34:34 -05002774sensor_threshold_emit_warning (
2775 SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002776{
Norman James90baede2015-09-02 20:32:49 -05002777 g_signal_emit_by_name (object, "warning");
Norman Jamescc7ae122015-08-24 14:26:09 -05002778}
2779
2780/**
Norman James5d78b4d2015-09-05 13:34:34 -05002781 * sensor_threshold_emit_critical:
2782 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002783 *
Norman James5d78b4d2015-09-05 13:34:34 -05002784 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
Norman James90baede2015-09-02 20:32:49 -05002785 */
2786void
Norman James5d78b4d2015-09-05 13:34:34 -05002787sensor_threshold_emit_critical (
2788 SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002789{
2790 g_signal_emit_by_name (object, "critical");
2791}
2792
2793/**
Norman James5d78b4d2015-09-05 13:34:34 -05002794 * sensor_threshold_emit_normal:
2795 * @object: A #SensorThreshold.
Norman James90baede2015-09-02 20:32:49 -05002796 *
Norman James5d78b4d2015-09-05 13:34:34 -05002797 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
Norman James90baede2015-09-02 20:32:49 -05002798 */
2799void
Norman James5d78b4d2015-09-05 13:34:34 -05002800sensor_threshold_emit_normal (
2801 SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05002802{
2803 g_signal_emit_by_name (object, "normal");
2804}
2805
2806/**
Norman James5d78b4d2015-09-05 13:34:34 -05002807 * sensor_threshold_call_get_state:
2808 * @proxy: A #SensorThresholdProxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05002809 * @cancellable: (allow-none): A #GCancellable or %NULL.
2810 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2811 * @user_data: User data to pass to @callback.
2812 *
Norman James5d78b4d2015-09-05 13:34:34 -05002813 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05002814 * 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 James5d78b4d2015-09-05 13:34:34 -05002815 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05002816 *
Norman James5d78b4d2015-09-05 13:34:34 -05002817 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05002818 */
2819void
Norman James5d78b4d2015-09-05 13:34:34 -05002820sensor_threshold_call_get_state (
2821 SensorThreshold *proxy,
Norman Jamescc7ae122015-08-24 14:26:09 -05002822 GCancellable *cancellable,
2823 GAsyncReadyCallback callback,
2824 gpointer user_data)
2825{
2826 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05002827 "getState",
2828 g_variant_new ("()"),
Norman Jamescc7ae122015-08-24 14:26:09 -05002829 G_DBUS_CALL_FLAGS_NONE,
2830 -1,
2831 cancellable,
2832 callback,
2833 user_data);
2834}
2835
2836/**
Norman James5d78b4d2015-09-05 13:34:34 -05002837 * sensor_threshold_call_get_state_finish:
2838 * @proxy: A #SensorThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05002839 * @out_state: (out): Return location for return parameter or %NULL to ignore.
Norman James5d78b4d2015-09-05 13:34:34 -05002840 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05002841 * @error: Return location for error or %NULL.
2842 *
Norman James5d78b4d2015-09-05 13:34:34 -05002843 * Finishes an operation started with sensor_threshold_call_get_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05002844 *
2845 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2846 */
2847gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05002848sensor_threshold_call_get_state_finish (
2849 SensorThreshold *proxy,
2850 guchar *out_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002851 GAsyncResult *res,
2852 GError **error)
2853{
2854 GVariant *_ret;
2855 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2856 if (_ret == NULL)
2857 goto _out;
2858 g_variant_get (_ret,
Norman James5d78b4d2015-09-05 13:34:34 -05002859 "(y)",
Norman James90baede2015-09-02 20:32:49 -05002860 out_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05002861 g_variant_unref (_ret);
2862_out:
2863 return _ret != NULL;
2864}
2865
2866/**
Norman James5d78b4d2015-09-05 13:34:34 -05002867 * sensor_threshold_call_get_state_sync:
2868 * @proxy: A #SensorThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05002869 * @out_state: (out): Return location for return parameter or %NULL to ignore.
Norman Jamescc7ae122015-08-24 14:26:09 -05002870 * @cancellable: (allow-none): A #GCancellable or %NULL.
2871 * @error: Return location for error or %NULL.
2872 *
Norman James5d78b4d2015-09-05 13:34:34 -05002873 * 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 Jamescc7ae122015-08-24 14:26:09 -05002874 *
Norman James5d78b4d2015-09-05 13:34:34 -05002875 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05002876 *
2877 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2878 */
2879gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05002880sensor_threshold_call_get_state_sync (
2881 SensorThreshold *proxy,
2882 guchar *out_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002883 GCancellable *cancellable,
2884 GError **error)
2885{
2886 GVariant *_ret;
2887 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05002888 "getState",
2889 g_variant_new ("()"),
Norman Jamescc7ae122015-08-24 14:26:09 -05002890 G_DBUS_CALL_FLAGS_NONE,
2891 -1,
2892 cancellable,
2893 error);
2894 if (_ret == NULL)
2895 goto _out;
2896 g_variant_get (_ret,
Norman James5d78b4d2015-09-05 13:34:34 -05002897 "(y)",
Norman James90baede2015-09-02 20:32:49 -05002898 out_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05002899 g_variant_unref (_ret);
2900_out:
2901 return _ret != NULL;
2902}
2903
2904/**
Norman James5d78b4d2015-09-05 13:34:34 -05002905 * sensor_threshold_complete_get_state:
2906 * @object: A #SensorThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05002907 * @invocation: (transfer full): A #GDBusMethodInvocation.
Norman James90baede2015-09-02 20:32:49 -05002908 * @state: Parameter to return.
Norman Jamescc7ae122015-08-24 14:26:09 -05002909 *
Norman James5d78b4d2015-09-05 13:34:34 -05002910 * 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 Jamescc7ae122015-08-24 14:26:09 -05002911 *
2912 * This method will free @invocation, you cannot use it afterwards.
2913 */
2914void
Norman James5d78b4d2015-09-05 13:34:34 -05002915sensor_threshold_complete_get_state (
2916 SensorThreshold *object,
Norman James90baede2015-09-02 20:32:49 -05002917 GDBusMethodInvocation *invocation,
Norman James5d78b4d2015-09-05 13:34:34 -05002918 guchar state)
Norman Jamescc7ae122015-08-24 14:26:09 -05002919{
2920 g_dbus_method_invocation_return_value (invocation,
Norman James5d78b4d2015-09-05 13:34:34 -05002921 g_variant_new ("(y)",
Norman James90baede2015-09-02 20:32:49 -05002922 state));
Norman Jamescc7ae122015-08-24 14:26:09 -05002923}
2924
2925/* ------------------------------------------------------------------------ */
2926
2927/**
Norman James5d78b4d2015-09-05 13:34:34 -05002928 * SensorThresholdProxy:
Norman Jamescc7ae122015-08-24 14:26:09 -05002929 *
Norman James5d78b4d2015-09-05 13:34:34 -05002930 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
Norman Jamescc7ae122015-08-24 14:26:09 -05002931 */
2932
2933/**
Norman James5d78b4d2015-09-05 13:34:34 -05002934 * SensorThresholdProxyClass:
Norman Jamescc7ae122015-08-24 14:26:09 -05002935 * @parent_class: The parent class.
2936 *
Norman James5d78b4d2015-09-05 13:34:34 -05002937 * Class structure for #SensorThresholdProxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05002938 */
2939
Norman James5d78b4d2015-09-05 13:34:34 -05002940struct _SensorThresholdProxyPrivate
Norman Jamescc7ae122015-08-24 14:26:09 -05002941{
2942 GData *qdata;
2943};
2944
Norman James5d78b4d2015-09-05 13:34:34 -05002945static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
Norman Jamescc7ae122015-08-24 14:26:09 -05002946
2947#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05002948G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
2949 G_ADD_PRIVATE (SensorThresholdProxy)
2950 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
Norman Jamescc7ae122015-08-24 14:26:09 -05002951
2952#else
Norman James5d78b4d2015-09-05 13:34:34 -05002953G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
2954 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
Norman Jamescc7ae122015-08-24 14:26:09 -05002955
2956#endif
2957static void
Norman James5d78b4d2015-09-05 13:34:34 -05002958sensor_threshold_proxy_finalize (GObject *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002959{
Norman James5d78b4d2015-09-05 13:34:34 -05002960 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05002961 g_datalist_clear (&proxy->priv->qdata);
Norman James5d78b4d2015-09-05 13:34:34 -05002962 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05002963}
2964
2965static void
Norman James5d78b4d2015-09-05 13:34:34 -05002966sensor_threshold_proxy_get_property (GObject *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05002967 guint prop_id,
2968 GValue *value,
2969 GParamSpec *pspec G_GNUC_UNUSED)
2970{
2971 const _ExtendedGDBusPropertyInfo *info;
2972 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05002973 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James5d78b4d2015-09-05 13:34:34 -05002974 info = _sensor_threshold_property_info_pointers[prop_id - 1];
Norman Jamescc7ae122015-08-24 14:26:09 -05002975 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2976 if (info->use_gvariant)
2977 {
2978 g_value_set_variant (value, variant);
2979 }
2980 else
2981 {
2982 if (variant != NULL)
2983 g_dbus_gvariant_to_gvalue (variant, value);
2984 }
2985 if (variant != NULL)
2986 g_variant_unref (variant);
2987}
2988
2989static void
Norman James5d78b4d2015-09-05 13:34:34 -05002990sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
Norman Jamescc7ae122015-08-24 14:26:09 -05002991 GAsyncResult *res,
2992 gpointer user_data)
2993{
2994 const _ExtendedGDBusPropertyInfo *info = user_data;
2995 GError *error;
2996 GVariant *_ret;
2997 error = NULL;
2998 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2999 if (!_ret)
3000 {
Norman James5d78b4d2015-09-05 13:34:34 -05003001 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
Norman Jamescc7ae122015-08-24 14:26:09 -05003002 info->parent_struct.name,
3003 error->message, g_quark_to_string (error->domain), error->code);
3004 g_error_free (error);
3005 }
3006 else
3007 {
3008 g_variant_unref (_ret);
3009 }
3010}
3011
3012static void
Norman James5d78b4d2015-09-05 13:34:34 -05003013sensor_threshold_proxy_set_property (GObject *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05003014 guint prop_id,
3015 const GValue *value,
3016 GParamSpec *pspec G_GNUC_UNUSED)
3017{
3018 const _ExtendedGDBusPropertyInfo *info;
3019 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05003020 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James5d78b4d2015-09-05 13:34:34 -05003021 info = _sensor_threshold_property_info_pointers[prop_id - 1];
Norman Jamescc7ae122015-08-24 14:26:09 -05003022 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3023 g_dbus_proxy_call (G_DBUS_PROXY (object),
3024 "org.freedesktop.DBus.Properties.Set",
Norman James5d78b4d2015-09-05 13:34:34 -05003025 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
Norman Jamescc7ae122015-08-24 14:26:09 -05003026 G_DBUS_CALL_FLAGS_NONE,
3027 -1,
Norman James5d78b4d2015-09-05 13:34:34 -05003028 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
Norman Jamescc7ae122015-08-24 14:26:09 -05003029 g_variant_unref (variant);
3030}
3031
3032static void
Norman James5d78b4d2015-09-05 13:34:34 -05003033sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
Norman Jamescc7ae122015-08-24 14:26:09 -05003034 const gchar *sender_name G_GNUC_UNUSED,
3035 const gchar *signal_name,
3036 GVariant *parameters)
3037{
3038 _ExtendedGDBusSignalInfo *info;
3039 GVariantIter iter;
3040 GVariant *child;
3041 GValue *paramv;
3042 guint num_params;
3043 guint n;
3044 guint signal_id;
Norman James5d78b4d2015-09-05 13:34:34 -05003045 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
Norman Jamescc7ae122015-08-24 14:26:09 -05003046 if (info == NULL)
3047 return;
3048 num_params = g_variant_n_children (parameters);
3049 paramv = g_new0 (GValue, num_params + 1);
Norman James5d78b4d2015-09-05 13:34:34 -05003050 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
Norman Jamescc7ae122015-08-24 14:26:09 -05003051 g_value_set_object (&paramv[0], proxy);
3052 g_variant_iter_init (&iter, parameters);
3053 n = 1;
3054 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3055 {
3056 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3057 if (arg_info->use_gvariant)
3058 {
3059 g_value_init (&paramv[n], G_TYPE_VARIANT);
3060 g_value_set_variant (&paramv[n], child);
3061 n++;
3062 }
3063 else
3064 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3065 g_variant_unref (child);
3066 }
Norman James5d78b4d2015-09-05 13:34:34 -05003067 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
Norman Jamescc7ae122015-08-24 14:26:09 -05003068 g_signal_emitv (paramv, signal_id, 0, NULL);
3069 for (n = 0; n < num_params + 1; n++)
3070 g_value_unset (&paramv[n]);
3071 g_free (paramv);
3072}
3073
3074static void
Norman James5d78b4d2015-09-05 13:34:34 -05003075sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
Norman Jamescc7ae122015-08-24 14:26:09 -05003076 GVariant *changed_properties,
3077 const gchar *const *invalidated_properties)
3078{
Norman James5d78b4d2015-09-05 13:34:34 -05003079 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
Norman Jamescc7ae122015-08-24 14:26:09 -05003080 guint n;
3081 const gchar *key;
3082 GVariantIter *iter;
3083 _ExtendedGDBusPropertyInfo *info;
3084 g_variant_get (changed_properties, "a{sv}", &iter);
3085 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3086 {
Norman James5d78b4d2015-09-05 13:34:34 -05003087 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
Norman Jamescc7ae122015-08-24 14:26:09 -05003088 g_datalist_remove_data (&proxy->priv->qdata, key);
3089 if (info != NULL)
3090 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3091 }
3092 g_variant_iter_free (iter);
3093 for (n = 0; invalidated_properties[n] != NULL; n++)
3094 {
Norman James5d78b4d2015-09-05 13:34:34 -05003095 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
Norman Jamescc7ae122015-08-24 14:26:09 -05003096 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3097 if (info != NULL)
3098 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3099 }
3100}
3101
Norman James5d78b4d2015-09-05 13:34:34 -05003102static GVariant *
3103sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003104{
Norman James5d78b4d2015-09-05 13:34:34 -05003105 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003106 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003107 GVariant *value = NULL;
Norman James90baede2015-09-02 20:32:49 -05003108 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
Norman James5d78b4d2015-09-05 13:34:34 -05003109 value = variant;
Norman Jamescc7ae122015-08-24 14:26:09 -05003110 if (variant != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003111 g_variant_unref (variant);
Norman Jamescc7ae122015-08-24 14:26:09 -05003112 return value;
3113}
3114
Norman James5d78b4d2015-09-05 13:34:34 -05003115static GVariant *
3116sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003117{
Norman James5d78b4d2015-09-05 13:34:34 -05003118 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003119 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003120 GVariant *value = NULL;
Norman James90baede2015-09-02 20:32:49 -05003121 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
Norman James5d78b4d2015-09-05 13:34:34 -05003122 value = variant;
Norman Jamescc7ae122015-08-24 14:26:09 -05003123 if (variant != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003124 g_variant_unref (variant);
Norman Jamescc7ae122015-08-24 14:26:09 -05003125 return value;
3126}
3127
Norman James5d78b4d2015-09-05 13:34:34 -05003128static GVariant *
3129sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003130{
Norman James5d78b4d2015-09-05 13:34:34 -05003131 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003132 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003133 GVariant *value = NULL;
Norman James90baede2015-09-02 20:32:49 -05003134 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
Norman James5d78b4d2015-09-05 13:34:34 -05003135 value = variant;
Norman Jamescc7ae122015-08-24 14:26:09 -05003136 if (variant != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003137 g_variant_unref (variant);
Norman Jamescc7ae122015-08-24 14:26:09 -05003138 return value;
3139}
3140
Norman James5d78b4d2015-09-05 13:34:34 -05003141static GVariant *
3142sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003143{
Norman James5d78b4d2015-09-05 13:34:34 -05003144 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003145 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003146 GVariant *value = NULL;
Norman James90baede2015-09-02 20:32:49 -05003147 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
Norman James5d78b4d2015-09-05 13:34:34 -05003148 value = variant;
Norman James90baede2015-09-02 20:32:49 -05003149 if (variant != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003150 g_variant_unref (variant);
Norman James90baede2015-09-02 20:32:49 -05003151 return value;
3152}
3153
Norman James5d78b4d2015-09-05 13:34:34 -05003154static guchar
3155sensor_threshold_proxy_get_state (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05003156{
Norman James5d78b4d2015-09-05 13:34:34 -05003157 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
Norman James90baede2015-09-02 20:32:49 -05003158 GVariant *variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003159 guchar value = 0;
Norman James90baede2015-09-02 20:32:49 -05003160 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
Norman Jamescc7ae122015-08-24 14:26:09 -05003161 if (variant != NULL)
3162 {
Norman James5d78b4d2015-09-05 13:34:34 -05003163 value = g_variant_get_byte (variant);
Norman Jamescc7ae122015-08-24 14:26:09 -05003164 g_variant_unref (variant);
3165 }
3166 return value;
3167}
3168
3169static void
Norman James5d78b4d2015-09-05 13:34:34 -05003170sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
Norman Jamescc7ae122015-08-24 14:26:09 -05003171{
3172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05003173 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
Norman Jamescc7ae122015-08-24 14:26:09 -05003174#else
Norman James5d78b4d2015-09-05 13:34:34 -05003175 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
Norman Jamescc7ae122015-08-24 14:26:09 -05003176#endif
3177
Norman James5d78b4d2015-09-05 13:34:34 -05003178 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
Norman Jamescc7ae122015-08-24 14:26:09 -05003179}
3180
3181static void
Norman James5d78b4d2015-09-05 13:34:34 -05003182sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
Norman Jamescc7ae122015-08-24 14:26:09 -05003183{
3184 GObjectClass *gobject_class;
3185 GDBusProxyClass *proxy_class;
3186
3187 gobject_class = G_OBJECT_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05003188 gobject_class->finalize = sensor_threshold_proxy_finalize;
3189 gobject_class->get_property = sensor_threshold_proxy_get_property;
3190 gobject_class->set_property = sensor_threshold_proxy_set_property;
Norman Jamescc7ae122015-08-24 14:26:09 -05003191
3192 proxy_class = G_DBUS_PROXY_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05003193 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
3194 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
Norman Jamescc7ae122015-08-24 14:26:09 -05003195
Norman James5d78b4d2015-09-05 13:34:34 -05003196 sensor_threshold_override_properties (gobject_class, 1);
Norman Jamescc7ae122015-08-24 14:26:09 -05003197
3198#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05003199 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
Norman Jamescc7ae122015-08-24 14:26:09 -05003200#endif
3201}
3202
3203static void
Norman James5d78b4d2015-09-05 13:34:34 -05003204sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
Norman Jamescc7ae122015-08-24 14:26:09 -05003205{
Norman James5d78b4d2015-09-05 13:34:34 -05003206 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
3207 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
3208 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
3209 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
3210 iface->get_state = sensor_threshold_proxy_get_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05003211}
3212
3213/**
Norman James5d78b4d2015-09-05 13:34:34 -05003214 * sensor_threshold_proxy_new:
Norman Jamescc7ae122015-08-24 14:26:09 -05003215 * @connection: A #GDBusConnection.
3216 * @flags: Flags from the #GDBusProxyFlags enumeration.
3217 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3218 * @object_path: An object path.
3219 * @cancellable: (allow-none): A #GCancellable or %NULL.
3220 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3221 * @user_data: User data to pass to @callback.
3222 *
Norman James5d78b4d2015-09-05 13:34:34 -05003223 * 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 Jamescc7ae122015-08-24 14:26:09 -05003224 *
3225 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James5d78b4d2015-09-05 13:34:34 -05003226 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05003227 *
Norman James5d78b4d2015-09-05 13:34:34 -05003228 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
Norman Jamescc7ae122015-08-24 14:26:09 -05003229 */
3230void
Norman James5d78b4d2015-09-05 13:34:34 -05003231sensor_threshold_proxy_new (
Norman Jamescc7ae122015-08-24 14:26:09 -05003232 GDBusConnection *connection,
3233 GDBusProxyFlags flags,
3234 const gchar *name,
3235 const gchar *object_path,
3236 GCancellable *cancellable,
3237 GAsyncReadyCallback callback,
3238 gpointer user_data)
3239{
Norman James5d78b4d2015-09-05 13:34:34 -05003240 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 Jamescc7ae122015-08-24 14:26:09 -05003241}
3242
3243/**
Norman James5d78b4d2015-09-05 13:34:34 -05003244 * sensor_threshold_proxy_new_finish:
3245 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
Norman Jamescc7ae122015-08-24 14:26:09 -05003246 * @error: Return location for error or %NULL
3247 *
Norman James5d78b4d2015-09-05 13:34:34 -05003248 * Finishes an operation started with sensor_threshold_proxy_new().
Norman Jamescc7ae122015-08-24 14:26:09 -05003249 *
Norman James5d78b4d2015-09-05 13:34:34 -05003250 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamescc7ae122015-08-24 14:26:09 -05003251 */
Norman James5d78b4d2015-09-05 13:34:34 -05003252SensorThreshold *
3253sensor_threshold_proxy_new_finish (
Norman Jamescc7ae122015-08-24 14:26:09 -05003254 GAsyncResult *res,
3255 GError **error)
3256{
3257 GObject *ret;
3258 GObject *source_object;
3259 source_object = g_async_result_get_source_object (res);
3260 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3261 g_object_unref (source_object);
3262 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003263 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05003264 else
3265 return NULL;
3266}
3267
3268/**
Norman James5d78b4d2015-09-05 13:34:34 -05003269 * sensor_threshold_proxy_new_sync:
Norman Jamescc7ae122015-08-24 14:26:09 -05003270 * @connection: A #GDBusConnection.
3271 * @flags: Flags from the #GDBusProxyFlags enumeration.
3272 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3273 * @object_path: An object path.
3274 * @cancellable: (allow-none): A #GCancellable or %NULL.
3275 * @error: Return location for error or %NULL
3276 *
Norman James5d78b4d2015-09-05 13:34:34 -05003277 * 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 Jamescc7ae122015-08-24 14:26:09 -05003278 *
3279 * The calling thread is blocked until a reply is received.
3280 *
Norman James5d78b4d2015-09-05 13:34:34 -05003281 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
Norman Jamescc7ae122015-08-24 14:26:09 -05003282 *
Norman James5d78b4d2015-09-05 13:34:34 -05003283 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamescc7ae122015-08-24 14:26:09 -05003284 */
Norman James5d78b4d2015-09-05 13:34:34 -05003285SensorThreshold *
3286sensor_threshold_proxy_new_sync (
Norman Jamescc7ae122015-08-24 14:26:09 -05003287 GDBusConnection *connection,
3288 GDBusProxyFlags flags,
3289 const gchar *name,
3290 const gchar *object_path,
3291 GCancellable *cancellable,
3292 GError **error)
3293{
3294 GInitable *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05003295 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 Jamescc7ae122015-08-24 14:26:09 -05003296 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003297 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05003298 else
3299 return NULL;
3300}
3301
3302
3303/**
Norman James5d78b4d2015-09-05 13:34:34 -05003304 * sensor_threshold_proxy_new_for_bus:
Norman Jamescc7ae122015-08-24 14:26:09 -05003305 * @bus_type: A #GBusType.
3306 * @flags: Flags from the #GDBusProxyFlags enumeration.
3307 * @name: A bus name (well-known or unique).
3308 * @object_path: An object path.
3309 * @cancellable: (allow-none): A #GCancellable or %NULL.
3310 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3311 * @user_data: User data to pass to @callback.
3312 *
Norman James5d78b4d2015-09-05 13:34:34 -05003313 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
Norman Jamescc7ae122015-08-24 14:26:09 -05003314 *
3315 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James5d78b4d2015-09-05 13:34:34 -05003316 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05003317 *
Norman James5d78b4d2015-09-05 13:34:34 -05003318 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
Norman Jamescc7ae122015-08-24 14:26:09 -05003319 */
3320void
Norman James5d78b4d2015-09-05 13:34:34 -05003321sensor_threshold_proxy_new_for_bus (
Norman Jamescc7ae122015-08-24 14:26:09 -05003322 GBusType bus_type,
3323 GDBusProxyFlags flags,
3324 const gchar *name,
3325 const gchar *object_path,
3326 GCancellable *cancellable,
3327 GAsyncReadyCallback callback,
3328 gpointer user_data)
3329{
Norman James5d78b4d2015-09-05 13:34:34 -05003330 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 Jamescc7ae122015-08-24 14:26:09 -05003331}
3332
3333/**
Norman James5d78b4d2015-09-05 13:34:34 -05003334 * sensor_threshold_proxy_new_for_bus_finish:
3335 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
Norman Jamescc7ae122015-08-24 14:26:09 -05003336 * @error: Return location for error or %NULL
3337 *
Norman James5d78b4d2015-09-05 13:34:34 -05003338 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
Norman Jamescc7ae122015-08-24 14:26:09 -05003339 *
Norman James5d78b4d2015-09-05 13:34:34 -05003340 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamescc7ae122015-08-24 14:26:09 -05003341 */
Norman James5d78b4d2015-09-05 13:34:34 -05003342SensorThreshold *
3343sensor_threshold_proxy_new_for_bus_finish (
Norman Jamescc7ae122015-08-24 14:26:09 -05003344 GAsyncResult *res,
3345 GError **error)
3346{
3347 GObject *ret;
3348 GObject *source_object;
3349 source_object = g_async_result_get_source_object (res);
3350 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3351 g_object_unref (source_object);
3352 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003353 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05003354 else
3355 return NULL;
3356}
3357
3358/**
Norman James5d78b4d2015-09-05 13:34:34 -05003359 * sensor_threshold_proxy_new_for_bus_sync:
Norman Jamescc7ae122015-08-24 14:26:09 -05003360 * @bus_type: A #GBusType.
3361 * @flags: Flags from the #GDBusProxyFlags enumeration.
3362 * @name: A bus name (well-known or unique).
3363 * @object_path: An object path.
3364 * @cancellable: (allow-none): A #GCancellable or %NULL.
3365 * @error: Return location for error or %NULL
3366 *
Norman James5d78b4d2015-09-05 13:34:34 -05003367 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
Norman Jamescc7ae122015-08-24 14:26:09 -05003368 *
3369 * The calling thread is blocked until a reply is received.
3370 *
Norman James5d78b4d2015-09-05 13:34:34 -05003371 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
Norman Jamescc7ae122015-08-24 14:26:09 -05003372 *
Norman James5d78b4d2015-09-05 13:34:34 -05003373 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
Norman Jamescc7ae122015-08-24 14:26:09 -05003374 */
Norman James5d78b4d2015-09-05 13:34:34 -05003375SensorThreshold *
3376sensor_threshold_proxy_new_for_bus_sync (
Norman Jamescc7ae122015-08-24 14:26:09 -05003377 GBusType bus_type,
3378 GDBusProxyFlags flags,
3379 const gchar *name,
3380 const gchar *object_path,
3381 GCancellable *cancellable,
3382 GError **error)
3383{
3384 GInitable *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05003385 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 Jamescc7ae122015-08-24 14:26:09 -05003386 if (ret != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003387 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05003388 else
3389 return NULL;
3390}
3391
3392
3393/* ------------------------------------------------------------------------ */
3394
3395/**
Norman James5d78b4d2015-09-05 13:34:34 -05003396 * SensorThresholdSkeleton:
Norman Jamescc7ae122015-08-24 14:26:09 -05003397 *
Norman James5d78b4d2015-09-05 13:34:34 -05003398 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
Norman Jamescc7ae122015-08-24 14:26:09 -05003399 */
3400
3401/**
Norman James5d78b4d2015-09-05 13:34:34 -05003402 * SensorThresholdSkeletonClass:
Norman Jamescc7ae122015-08-24 14:26:09 -05003403 * @parent_class: The parent class.
3404 *
Norman James5d78b4d2015-09-05 13:34:34 -05003405 * Class structure for #SensorThresholdSkeleton.
Norman Jamescc7ae122015-08-24 14:26:09 -05003406 */
3407
Norman James5d78b4d2015-09-05 13:34:34 -05003408struct _SensorThresholdSkeletonPrivate
Norman Jamescc7ae122015-08-24 14:26:09 -05003409{
3410 GValue *properties;
3411 GList *changed_properties;
3412 GSource *changed_properties_idle_source;
3413 GMainContext *context;
3414 GMutex lock;
3415};
3416
3417static void
Norman James5d78b4d2015-09-05 13:34:34 -05003418_sensor_threshold_skeleton_handle_method_call (
Norman Jamescc7ae122015-08-24 14:26:09 -05003419 GDBusConnection *connection G_GNUC_UNUSED,
3420 const gchar *sender G_GNUC_UNUSED,
3421 const gchar *object_path G_GNUC_UNUSED,
3422 const gchar *interface_name,
3423 const gchar *method_name,
3424 GVariant *parameters,
3425 GDBusMethodInvocation *invocation,
3426 gpointer user_data)
3427{
Norman James5d78b4d2015-09-05 13:34:34 -05003428 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
Norman Jamescc7ae122015-08-24 14:26:09 -05003429 _ExtendedGDBusMethodInfo *info;
3430 GVariantIter iter;
3431 GVariant *child;
3432 GValue *paramv;
3433 guint num_params;
3434 guint num_extra;
3435 guint n;
3436 guint signal_id;
3437 GValue return_value = G_VALUE_INIT;
3438 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3439 g_assert (info != NULL);
3440 num_params = g_variant_n_children (parameters);
3441 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3442 n = 0;
Norman James5d78b4d2015-09-05 13:34:34 -05003443 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
Norman Jamescc7ae122015-08-24 14:26:09 -05003444 g_value_set_object (&paramv[n++], skeleton);
3445 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3446 g_value_set_object (&paramv[n++], invocation);
3447 if (info->pass_fdlist)
3448 {
3449#ifdef G_OS_UNIX
3450 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3451 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3452#else
3453 g_assert_not_reached ();
3454#endif
3455 }
3456 g_variant_iter_init (&iter, parameters);
3457 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3458 {
3459 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3460 if (arg_info->use_gvariant)
3461 {
3462 g_value_init (&paramv[n], G_TYPE_VARIANT);
3463 g_value_set_variant (&paramv[n], child);
3464 n++;
3465 }
3466 else
3467 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3468 g_variant_unref (child);
3469 }
Norman James5d78b4d2015-09-05 13:34:34 -05003470 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
Norman Jamescc7ae122015-08-24 14:26:09 -05003471 g_value_init (&return_value, G_TYPE_BOOLEAN);
3472 g_signal_emitv (paramv, signal_id, 0, &return_value);
3473 if (!g_value_get_boolean (&return_value))
3474 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
3475 g_value_unset (&return_value);
3476 for (n = 0; n < num_params + num_extra; n++)
3477 g_value_unset (&paramv[n]);
3478 g_free (paramv);
3479}
3480
3481static GVariant *
Norman James5d78b4d2015-09-05 13:34:34 -05003482_sensor_threshold_skeleton_handle_get_property (
Norman Jamescc7ae122015-08-24 14:26:09 -05003483 GDBusConnection *connection G_GNUC_UNUSED,
3484 const gchar *sender G_GNUC_UNUSED,
3485 const gchar *object_path G_GNUC_UNUSED,
3486 const gchar *interface_name G_GNUC_UNUSED,
3487 const gchar *property_name,
3488 GError **error,
3489 gpointer user_data)
3490{
Norman James5d78b4d2015-09-05 13:34:34 -05003491 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
Norman Jamescc7ae122015-08-24 14:26:09 -05003492 GValue value = G_VALUE_INIT;
3493 GParamSpec *pspec;
3494 _ExtendedGDBusPropertyInfo *info;
3495 GVariant *ret;
3496 ret = NULL;
Norman James5d78b4d2015-09-05 13:34:34 -05003497 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
Norman Jamescc7ae122015-08-24 14:26:09 -05003498 g_assert (info != NULL);
3499 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3500 if (pspec == NULL)
3501 {
3502 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3503 }
3504 else
3505 {
3506 g_value_init (&value, pspec->value_type);
3507 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3508 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3509 g_value_unset (&value);
3510 }
3511 return ret;
3512}
3513
3514static gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05003515_sensor_threshold_skeleton_handle_set_property (
Norman Jamescc7ae122015-08-24 14:26:09 -05003516 GDBusConnection *connection G_GNUC_UNUSED,
3517 const gchar *sender G_GNUC_UNUSED,
3518 const gchar *object_path G_GNUC_UNUSED,
3519 const gchar *interface_name G_GNUC_UNUSED,
3520 const gchar *property_name,
3521 GVariant *variant,
3522 GError **error,
3523 gpointer user_data)
3524{
Norman James5d78b4d2015-09-05 13:34:34 -05003525 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
Norman Jamescc7ae122015-08-24 14:26:09 -05003526 GValue value = G_VALUE_INIT;
3527 GParamSpec *pspec;
3528 _ExtendedGDBusPropertyInfo *info;
3529 gboolean ret;
3530 ret = FALSE;
Norman James5d78b4d2015-09-05 13:34:34 -05003531 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
Norman Jamescc7ae122015-08-24 14:26:09 -05003532 g_assert (info != NULL);
3533 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3534 if (pspec == NULL)
3535 {
3536 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3537 }
3538 else
3539 {
3540 if (info->use_gvariant)
3541 g_value_set_variant (&value, variant);
3542 else
3543 g_dbus_gvariant_to_gvalue (variant, &value);
3544 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3545 g_value_unset (&value);
3546 ret = TRUE;
3547 }
3548 return ret;
3549}
3550
Norman James5d78b4d2015-09-05 13:34:34 -05003551static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
Norman Jamescc7ae122015-08-24 14:26:09 -05003552{
Norman James5d78b4d2015-09-05 13:34:34 -05003553 _sensor_threshold_skeleton_handle_method_call,
3554 _sensor_threshold_skeleton_handle_get_property,
3555 _sensor_threshold_skeleton_handle_set_property,
Norman Jamescc7ae122015-08-24 14:26:09 -05003556 {NULL}
3557};
3558
3559static GDBusInterfaceInfo *
Norman James5d78b4d2015-09-05 13:34:34 -05003560sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
Norman Jamescc7ae122015-08-24 14:26:09 -05003561{
Norman James5d78b4d2015-09-05 13:34:34 -05003562 return sensor_threshold_interface_info ();
Norman Jamescc7ae122015-08-24 14:26:09 -05003563}
3564
3565static GDBusInterfaceVTable *
Norman James5d78b4d2015-09-05 13:34:34 -05003566sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
Norman Jamescc7ae122015-08-24 14:26:09 -05003567{
Norman James5d78b4d2015-09-05 13:34:34 -05003568 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
Norman Jamescc7ae122015-08-24 14:26:09 -05003569}
3570
3571static GVariant *
Norman James5d78b4d2015-09-05 13:34:34 -05003572sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
Norman Jamescc7ae122015-08-24 14:26:09 -05003573{
Norman James5d78b4d2015-09-05 13:34:34 -05003574 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
Norman Jamescc7ae122015-08-24 14:26:09 -05003575
3576 GVariantBuilder builder;
3577 guint n;
3578 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
Norman James5d78b4d2015-09-05 13:34:34 -05003579 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
Norman Jamescc7ae122015-08-24 14:26:09 -05003580 goto out;
Norman James5d78b4d2015-09-05 13:34:34 -05003581 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
Norman Jamescc7ae122015-08-24 14:26:09 -05003582 {
Norman James5d78b4d2015-09-05 13:34:34 -05003583 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
Norman Jamescc7ae122015-08-24 14:26:09 -05003584 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3585 {
3586 GVariant *value;
Norman James5d78b4d2015-09-05 13:34:34 -05003587 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 Jamescc7ae122015-08-24 14:26:09 -05003588 if (value != NULL)
3589 {
3590 g_variant_take_ref (value);
3591 g_variant_builder_add (&builder, "{sv}", info->name, value);
3592 g_variant_unref (value);
3593 }
3594 }
3595 }
3596out:
3597 return g_variant_builder_end (&builder);
3598}
3599
Norman James5d78b4d2015-09-05 13:34:34 -05003600static gboolean _sensor_threshold_emit_changed (gpointer user_data);
Norman Jamescc7ae122015-08-24 14:26:09 -05003601
3602static void
Norman James5d78b4d2015-09-05 13:34:34 -05003603sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
Norman Jamescc7ae122015-08-24 14:26:09 -05003604{
Norman James5d78b4d2015-09-05 13:34:34 -05003605 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
Norman Jamescc7ae122015-08-24 14:26:09 -05003606 gboolean emit_changed = FALSE;
3607
3608 g_mutex_lock (&skeleton->priv->lock);
3609 if (skeleton->priv->changed_properties_idle_source != NULL)
3610 {
3611 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3612 skeleton->priv->changed_properties_idle_source = NULL;
3613 emit_changed = TRUE;
3614 }
3615 g_mutex_unlock (&skeleton->priv->lock);
3616
3617 if (emit_changed)
Norman James5d78b4d2015-09-05 13:34:34 -05003618 _sensor_threshold_emit_changed (skeleton);
Norman Jamescc7ae122015-08-24 14:26:09 -05003619}
3620
3621static void
Norman James5d78b4d2015-09-05 13:34:34 -05003622_sensor_threshold_on_signal_warning (
3623 SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003624{
Norman James5d78b4d2015-09-05 13:34:34 -05003625 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003626
3627 GList *connections, *l;
3628 GVariant *signal_variant;
3629 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3630
Norman James90baede2015-09-02 20:32:49 -05003631 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
Norman Jamescc7ae122015-08-24 14:26:09 -05003632 for (l = connections; l != NULL; l = l->next)
3633 {
3634 GDBusConnection *connection = l->data;
3635 g_dbus_connection_emit_signal (connection,
Norman James5d78b4d2015-09-05 13:34:34 -05003636 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05003637 signal_variant, NULL);
3638 }
3639 g_variant_unref (signal_variant);
3640 g_list_free_full (connections, g_object_unref);
3641}
3642
3643static void
Norman James5d78b4d2015-09-05 13:34:34 -05003644_sensor_threshold_on_signal_critical (
3645 SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003646{
Norman James5d78b4d2015-09-05 13:34:34 -05003647 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003648
3649 GList *connections, *l;
3650 GVariant *signal_variant;
3651 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3652
Norman James90baede2015-09-02 20:32:49 -05003653 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
Norman Jamescc7ae122015-08-24 14:26:09 -05003654 for (l = connections; l != NULL; l = l->next)
3655 {
3656 GDBusConnection *connection = l->data;
3657 g_dbus_connection_emit_signal (connection,
Norman James5d78b4d2015-09-05 13:34:34 -05003658 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
Norman James90baede2015-09-02 20:32:49 -05003659 signal_variant, NULL);
3660 }
3661 g_variant_unref (signal_variant);
3662 g_list_free_full (connections, g_object_unref);
3663}
3664
3665static void
Norman James5d78b4d2015-09-05 13:34:34 -05003666_sensor_threshold_on_signal_normal (
3667 SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05003668{
Norman James5d78b4d2015-09-05 13:34:34 -05003669 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05003670
3671 GList *connections, *l;
3672 GVariant *signal_variant;
3673 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3674
3675 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3676 for (l = connections; l != NULL; l = l->next)
3677 {
3678 GDBusConnection *connection = l->data;
3679 g_dbus_connection_emit_signal (connection,
Norman James5d78b4d2015-09-05 13:34:34 -05003680 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
Norman Jamescc7ae122015-08-24 14:26:09 -05003681 signal_variant, NULL);
3682 }
3683 g_variant_unref (signal_variant);
3684 g_list_free_full (connections, g_object_unref);
3685}
3686
Norman James5d78b4d2015-09-05 13:34:34 -05003687static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
Norman Jamescc7ae122015-08-24 14:26:09 -05003688#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05003689G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3690 G_ADD_PRIVATE (SensorThresholdSkeleton)
3691 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
Norman Jamescc7ae122015-08-24 14:26:09 -05003692
3693#else
Norman James5d78b4d2015-09-05 13:34:34 -05003694G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3695 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
Norman Jamescc7ae122015-08-24 14:26:09 -05003696
3697#endif
3698static void
Norman James5d78b4d2015-09-05 13:34:34 -05003699sensor_threshold_skeleton_finalize (GObject *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003700{
Norman James5d78b4d2015-09-05 13:34:34 -05003701 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003702 guint n;
Norman James90baede2015-09-02 20:32:49 -05003703 for (n = 0; n < 5; n++)
Norman Jamescc7ae122015-08-24 14:26:09 -05003704 g_value_unset (&skeleton->priv->properties[n]);
3705 g_free (skeleton->priv->properties);
3706 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3707 if (skeleton->priv->changed_properties_idle_source != NULL)
3708 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3709 g_main_context_unref (skeleton->priv->context);
3710 g_mutex_clear (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003711 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003712}
3713
3714static void
Norman James5d78b4d2015-09-05 13:34:34 -05003715sensor_threshold_skeleton_get_property (GObject *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05003716 guint prop_id,
3717 GValue *value,
3718 GParamSpec *pspec G_GNUC_UNUSED)
3719{
Norman James5d78b4d2015-09-05 13:34:34 -05003720 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05003721 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05003722 g_mutex_lock (&skeleton->priv->lock);
3723 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3724 g_mutex_unlock (&skeleton->priv->lock);
3725}
3726
3727static gboolean
Norman James5d78b4d2015-09-05 13:34:34 -05003728_sensor_threshold_emit_changed (gpointer user_data)
Norman Jamescc7ae122015-08-24 14:26:09 -05003729{
Norman James5d78b4d2015-09-05 13:34:34 -05003730 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
Norman Jamescc7ae122015-08-24 14:26:09 -05003731 GList *l;
3732 GVariantBuilder builder;
3733 GVariantBuilder invalidated_builder;
3734 guint num_changes;
3735
3736 g_mutex_lock (&skeleton->priv->lock);
3737 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3738 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3739 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3740 {
3741 ChangedProperty *cp = l->data;
3742 GVariant *variant;
3743 const GValue *cur_value;
3744
3745 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3746 if (!_g_value_equal (cur_value, &cp->orig_value))
3747 {
3748 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3749 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3750 g_variant_unref (variant);
3751 num_changes++;
3752 }
3753 }
3754 if (num_changes > 0)
3755 {
3756 GList *connections, *ll;
3757 GVariant *signal_variant;
Norman James5d78b4d2015-09-05 13:34:34 -05003758 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
Norman Jamescc7ae122015-08-24 14:26:09 -05003759 &builder, &invalidated_builder));
3760 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3761 for (ll = connections; ll != NULL; ll = ll->next)
3762 {
3763 GDBusConnection *connection = ll->data;
3764
3765 g_dbus_connection_emit_signal (connection,
3766 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3767 "org.freedesktop.DBus.Properties",
3768 "PropertiesChanged",
3769 signal_variant,
3770 NULL);
3771 }
3772 g_variant_unref (signal_variant);
3773 g_list_free_full (connections, g_object_unref);
3774 }
3775 else
3776 {
3777 g_variant_builder_clear (&builder);
3778 g_variant_builder_clear (&invalidated_builder);
3779 }
3780 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3781 skeleton->priv->changed_properties = NULL;
3782 skeleton->priv->changed_properties_idle_source = NULL;
3783 g_mutex_unlock (&skeleton->priv->lock);
3784 return FALSE;
3785}
3786
3787static void
Norman James5d78b4d2015-09-05 13:34:34 -05003788_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
Norman Jamescc7ae122015-08-24 14:26:09 -05003789{
3790 ChangedProperty *cp;
3791 GList *l;
3792 cp = NULL;
3793 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3794 {
3795 ChangedProperty *i_cp = l->data;
3796 if (i_cp->info == info)
3797 {
3798 cp = i_cp;
3799 break;
3800 }
3801 }
3802 if (cp == NULL)
3803 {
3804 cp = g_new0 (ChangedProperty, 1);
3805 cp->prop_id = prop_id;
3806 cp->info = info;
3807 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3808 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3809 g_value_copy (orig_value, &cp->orig_value);
3810 }
3811}
3812
3813static void
Norman James5d78b4d2015-09-05 13:34:34 -05003814sensor_threshold_skeleton_notify (GObject *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05003815 GParamSpec *pspec G_GNUC_UNUSED)
3816{
Norman James5d78b4d2015-09-05 13:34:34 -05003817 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05003818 g_mutex_lock (&skeleton->priv->lock);
3819 if (skeleton->priv->changed_properties != NULL &&
3820 skeleton->priv->changed_properties_idle_source == NULL)
3821 {
3822 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3823 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
Norman James5d78b4d2015-09-05 13:34:34 -05003824 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Norman Jamescc7ae122015-08-24 14:26:09 -05003825 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3826 g_source_unref (skeleton->priv->changed_properties_idle_source);
3827 }
3828 g_mutex_unlock (&skeleton->priv->lock);
3829}
3830
3831static void
Norman James5d78b4d2015-09-05 13:34:34 -05003832sensor_threshold_skeleton_set_property (GObject *object,
Norman Jamescc7ae122015-08-24 14:26:09 -05003833 guint prop_id,
3834 const GValue *value,
3835 GParamSpec *pspec)
3836{
Norman James5d78b4d2015-09-05 13:34:34 -05003837 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05003838 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05003839 g_mutex_lock (&skeleton->priv->lock);
3840 g_object_freeze_notify (object);
3841 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3842 {
3843 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
Norman James5d78b4d2015-09-05 13:34:34 -05003844 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
Norman Jamescc7ae122015-08-24 14:26:09 -05003845 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3846 g_object_notify_by_pspec (object, pspec);
3847 }
3848 g_mutex_unlock (&skeleton->priv->lock);
3849 g_object_thaw_notify (object);
3850}
3851
3852static void
Norman James5d78b4d2015-09-05 13:34:34 -05003853sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
Norman Jamescc7ae122015-08-24 14:26:09 -05003854{
3855#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05003856 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
Norman Jamescc7ae122015-08-24 14:26:09 -05003857#else
Norman James5d78b4d2015-09-05 13:34:34 -05003858 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
Norman Jamescc7ae122015-08-24 14:26:09 -05003859#endif
3860
3861 g_mutex_init (&skeleton->priv->lock);
3862 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James90baede2015-09-02 20:32:49 -05003863 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James5d78b4d2015-09-05 13:34:34 -05003864 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
3865 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
3866 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
3867 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
3868 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
Norman Jamescc7ae122015-08-24 14:26:09 -05003869}
3870
Norman James5d78b4d2015-09-05 13:34:34 -05003871static GVariant *
3872sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003873{
Norman James5d78b4d2015-09-05 13:34:34 -05003874 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
3875 GVariant *value;
Norman Jamescc7ae122015-08-24 14:26:09 -05003876 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003877 value = g_value_get_variant (&(skeleton->priv->properties[0]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003878 g_mutex_unlock (&skeleton->priv->lock);
3879 return value;
3880}
3881
Norman James5d78b4d2015-09-05 13:34:34 -05003882static GVariant *
3883sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003884{
Norman James5d78b4d2015-09-05 13:34:34 -05003885 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
3886 GVariant *value;
Norman Jamescc7ae122015-08-24 14:26:09 -05003887 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003888 value = g_value_get_variant (&(skeleton->priv->properties[1]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003889 g_mutex_unlock (&skeleton->priv->lock);
3890 return value;
3891}
3892
Norman James5d78b4d2015-09-05 13:34:34 -05003893static GVariant *
3894sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003895{
Norman James5d78b4d2015-09-05 13:34:34 -05003896 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
3897 GVariant *value;
Norman Jamescc7ae122015-08-24 14:26:09 -05003898 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003899 value = g_value_get_variant (&(skeleton->priv->properties[2]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003900 g_mutex_unlock (&skeleton->priv->lock);
3901 return value;
3902}
3903
Norman James5d78b4d2015-09-05 13:34:34 -05003904static GVariant *
3905sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003906{
Norman James5d78b4d2015-09-05 13:34:34 -05003907 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
3908 GVariant *value;
Norman Jamescc7ae122015-08-24 14:26:09 -05003909 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003910 value = g_value_get_variant (&(skeleton->priv->properties[3]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003911 g_mutex_unlock (&skeleton->priv->lock);
3912 return value;
3913}
3914
Norman James5d78b4d2015-09-05 13:34:34 -05003915static guchar
3916sensor_threshold_skeleton_get_state (SensorThreshold *object)
Norman James90baede2015-09-02 20:32:49 -05003917{
Norman James5d78b4d2015-09-05 13:34:34 -05003918 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
3919 guchar value;
Norman James90baede2015-09-02 20:32:49 -05003920 g_mutex_lock (&skeleton->priv->lock);
Norman James5d78b4d2015-09-05 13:34:34 -05003921 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
Norman James90baede2015-09-02 20:32:49 -05003922 g_mutex_unlock (&skeleton->priv->lock);
3923 return value;
3924}
3925
Norman Jamescc7ae122015-08-24 14:26:09 -05003926static void
Norman James5d78b4d2015-09-05 13:34:34 -05003927sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
Norman Jamescc7ae122015-08-24 14:26:09 -05003928{
3929 GObjectClass *gobject_class;
3930 GDBusInterfaceSkeletonClass *skeleton_class;
3931
3932 gobject_class = G_OBJECT_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05003933 gobject_class->finalize = sensor_threshold_skeleton_finalize;
3934 gobject_class->get_property = sensor_threshold_skeleton_get_property;
3935 gobject_class->set_property = sensor_threshold_skeleton_set_property;
3936 gobject_class->notify = sensor_threshold_skeleton_notify;
Norman Jamescc7ae122015-08-24 14:26:09 -05003937
3938
Norman James5d78b4d2015-09-05 13:34:34 -05003939 sensor_threshold_override_properties (gobject_class, 1);
Norman Jamescc7ae122015-08-24 14:26:09 -05003940
3941 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
Norman James5d78b4d2015-09-05 13:34:34 -05003942 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
3943 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
3944 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
3945 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
Norman Jamescc7ae122015-08-24 14:26:09 -05003946
3947#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
Norman James5d78b4d2015-09-05 13:34:34 -05003948 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
Norman Jamescc7ae122015-08-24 14:26:09 -05003949#endif
3950}
3951
3952static void
Norman James5d78b4d2015-09-05 13:34:34 -05003953sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
Norman Jamescc7ae122015-08-24 14:26:09 -05003954{
Norman James5d78b4d2015-09-05 13:34:34 -05003955 iface->warning = _sensor_threshold_on_signal_warning;
3956 iface->critical = _sensor_threshold_on_signal_critical;
3957 iface->normal = _sensor_threshold_on_signal_normal;
3958 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
3959 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
3960 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
3961 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
3962 iface->get_state = sensor_threshold_skeleton_get_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05003963}
3964
3965/**
Norman James5d78b4d2015-09-05 13:34:34 -05003966 * sensor_threshold_skeleton_new:
Norman Jamescc7ae122015-08-24 14:26:09 -05003967 *
Norman James5d78b4d2015-09-05 13:34:34 -05003968 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05003969 *
Norman James5d78b4d2015-09-05 13:34:34 -05003970 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
Norman Jamescc7ae122015-08-24 14:26:09 -05003971 */
Norman James5d78b4d2015-09-05 13:34:34 -05003972SensorThreshold *
3973sensor_threshold_skeleton_new (void)
Norman Jamescc7ae122015-08-24 14:26:09 -05003974{
Norman James5d78b4d2015-09-05 13:34:34 -05003975 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
Norman Jamescc7ae122015-08-24 14:26:09 -05003976}
3977
3978/* ------------------------------------------------------------------------
Norman James90baede2015-09-02 20:32:49 -05003979 * Code for interface org.openbmc.SensorI2c
3980 * ------------------------------------------------------------------------
3981 */
3982
3983/**
3984 * SECTION:SensorI2c
3985 * @title: SensorI2c
3986 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
3987 *
3988 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C.
3989 */
3990
3991/* ---- Introspection data for org.openbmc.SensorI2c ---- */
3992
3993static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
3994{
3995 {
3996 -1,
3997 (gchar *) "dev_path",
3998 (gchar *) "s",
3999 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4000 NULL
4001 },
4002 "dev-path",
4003 FALSE
4004};
4005
4006static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
4007{
4008 {
4009 -1,
4010 (gchar *) "address",
4011 (gchar *) "s",
4012 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4013 NULL
4014 },
4015 "address",
4016 FALSE
4017};
4018
4019static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
4020{
4021 &_sensor_i2c_property_info_dev_path,
4022 &_sensor_i2c_property_info_address,
4023 NULL
4024};
4025
4026static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
4027{
4028 {
4029 -1,
4030 (gchar *) "org.openbmc.SensorI2c",
4031 NULL,
4032 NULL,
4033 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
4034 NULL
4035 },
4036 "sensor-i2c",
4037};
4038
4039
4040/**
4041 * sensor_i2c_interface_info:
4042 *
4043 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
4044 *
4045 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4046 */
4047GDBusInterfaceInfo *
4048sensor_i2c_interface_info (void)
4049{
4050 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
4051}
4052
4053/**
4054 * sensor_i2c_override_properties:
4055 * @klass: The class structure for a #GObject<!-- -->-derived class.
4056 * @property_id_begin: The property id to assign to the first overridden property.
4057 *
4058 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
4059 * The properties are overridden in the order they are defined.
4060 *
4061 * Returns: The last property id.
4062 */
4063guint
4064sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
4065{
4066 g_object_class_override_property (klass, property_id_begin++, "dev-path");
4067 g_object_class_override_property (klass, property_id_begin++, "address");
4068 return property_id_begin - 1;
4069}
4070
4071
4072
4073/**
4074 * SensorI2c:
4075 *
4076 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
4077 */
4078
4079/**
4080 * SensorI2cIface:
4081 * @parent_iface: The parent interface.
4082 * @get_address: Getter for the #SensorI2c:address property.
4083 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
4084 *
4085 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
4086 */
4087
4088typedef SensorI2cIface SensorI2cInterface;
4089G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
4090
4091static void
4092sensor_i2c_default_init (SensorI2cIface *iface)
4093{
4094 /* GObject properties for D-Bus properties: */
4095 /**
4096 * SensorI2c:dev-path:
4097 *
4098 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
4099 *
4100 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
4101 */
4102 g_object_interface_install_property (iface,
4103 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4104 /**
4105 * SensorI2c:address:
4106 *
4107 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
4108 *
4109 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
4110 */
4111 g_object_interface_install_property (iface,
4112 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4113}
4114
4115/**
4116 * sensor_i2c_get_dev_path: (skip)
4117 * @object: A #SensorI2c.
4118 *
4119 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
4120 *
4121 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4122 *
4123 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_dev_path() if on another thread.</warning>
4124 *
4125 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4126 */
4127const gchar *
4128sensor_i2c_get_dev_path (SensorI2c *object)
4129{
4130 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
4131}
4132
4133/**
4134 * sensor_i2c_dup_dev_path: (skip)
4135 * @object: A #SensorI2c.
4136 *
4137 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
4138 *
4139 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4140 *
4141 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4142 */
4143gchar *
4144sensor_i2c_dup_dev_path (SensorI2c *object)
4145{
4146 gchar *value;
4147 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
4148 return value;
4149}
4150
4151/**
4152 * sensor_i2c_set_dev_path: (skip)
4153 * @object: A #SensorI2c.
4154 * @value: The value to set.
4155 *
4156 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
4157 *
4158 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4159 */
4160void
4161sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
4162{
4163 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
4164}
4165
4166/**
4167 * sensor_i2c_get_address: (skip)
4168 * @object: A #SensorI2c.
4169 *
4170 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
4171 *
4172 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4173 *
4174 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_address() if on another thread.</warning>
4175 *
4176 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4177 */
4178const gchar *
4179sensor_i2c_get_address (SensorI2c *object)
4180{
4181 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
4182}
4183
4184/**
4185 * sensor_i2c_dup_address: (skip)
4186 * @object: A #SensorI2c.
4187 *
4188 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
4189 *
4190 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4191 *
4192 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4193 */
4194gchar *
4195sensor_i2c_dup_address (SensorI2c *object)
4196{
4197 gchar *value;
4198 g_object_get (G_OBJECT (object), "address", &value, NULL);
4199 return value;
4200}
4201
4202/**
4203 * sensor_i2c_set_address: (skip)
4204 * @object: A #SensorI2c.
4205 * @value: The value to set.
4206 *
4207 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
4208 *
4209 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4210 */
4211void
4212sensor_i2c_set_address (SensorI2c *object, const gchar *value)
4213{
4214 g_object_set (G_OBJECT (object), "address", value, NULL);
4215}
4216
4217/* ------------------------------------------------------------------------ */
4218
4219/**
4220 * SensorI2cProxy:
4221 *
4222 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
4223 */
4224
4225/**
4226 * SensorI2cProxyClass:
4227 * @parent_class: The parent class.
4228 *
4229 * Class structure for #SensorI2cProxy.
4230 */
4231
4232struct _SensorI2cProxyPrivate
4233{
4234 GData *qdata;
4235};
4236
4237static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
4238
4239#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4240G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
4241 G_ADD_PRIVATE (SensorI2cProxy)
4242 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
4243
4244#else
4245G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
4246 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
4247
4248#endif
4249static void
4250sensor_i2c_proxy_finalize (GObject *object)
4251{
4252 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
4253 g_datalist_clear (&proxy->priv->qdata);
4254 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
4255}
4256
4257static void
4258sensor_i2c_proxy_get_property (GObject *object,
4259 guint prop_id,
4260 GValue *value,
4261 GParamSpec *pspec G_GNUC_UNUSED)
4262{
4263 const _ExtendedGDBusPropertyInfo *info;
4264 GVariant *variant;
4265 g_assert (prop_id != 0 && prop_id - 1 < 2);
4266 info = _sensor_i2c_property_info_pointers[prop_id - 1];
4267 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4268 if (info->use_gvariant)
4269 {
4270 g_value_set_variant (value, variant);
4271 }
4272 else
4273 {
4274 if (variant != NULL)
4275 g_dbus_gvariant_to_gvalue (variant, value);
4276 }
4277 if (variant != NULL)
4278 g_variant_unref (variant);
4279}
4280
4281static void
4282sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
4283 GAsyncResult *res,
4284 gpointer user_data)
4285{
4286 const _ExtendedGDBusPropertyInfo *info = user_data;
4287 GError *error;
4288 GVariant *_ret;
4289 error = NULL;
4290 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4291 if (!_ret)
4292 {
4293 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
4294 info->parent_struct.name,
4295 error->message, g_quark_to_string (error->domain), error->code);
4296 g_error_free (error);
4297 }
4298 else
4299 {
4300 g_variant_unref (_ret);
4301 }
4302}
4303
4304static void
4305sensor_i2c_proxy_set_property (GObject *object,
4306 guint prop_id,
4307 const GValue *value,
4308 GParamSpec *pspec G_GNUC_UNUSED)
4309{
4310 const _ExtendedGDBusPropertyInfo *info;
4311 GVariant *variant;
4312 g_assert (prop_id != 0 && prop_id - 1 < 2);
4313 info = _sensor_i2c_property_info_pointers[prop_id - 1];
4314 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4315 g_dbus_proxy_call (G_DBUS_PROXY (object),
4316 "org.freedesktop.DBus.Properties.Set",
4317 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
4318 G_DBUS_CALL_FLAGS_NONE,
4319 -1,
4320 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4321 g_variant_unref (variant);
4322}
4323
4324static void
4325sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
4326 const gchar *sender_name G_GNUC_UNUSED,
4327 const gchar *signal_name,
4328 GVariant *parameters)
4329{
4330 _ExtendedGDBusSignalInfo *info;
4331 GVariantIter iter;
4332 GVariant *child;
4333 GValue *paramv;
4334 guint num_params;
4335 guint n;
4336 guint signal_id;
4337 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
4338 if (info == NULL)
4339 return;
4340 num_params = g_variant_n_children (parameters);
4341 paramv = g_new0 (GValue, num_params + 1);
4342 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
4343 g_value_set_object (&paramv[0], proxy);
4344 g_variant_iter_init (&iter, parameters);
4345 n = 1;
4346 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4347 {
4348 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4349 if (arg_info->use_gvariant)
4350 {
4351 g_value_init (&paramv[n], G_TYPE_VARIANT);
4352 g_value_set_variant (&paramv[n], child);
4353 n++;
4354 }
4355 else
4356 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4357 g_variant_unref (child);
4358 }
4359 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
4360 g_signal_emitv (paramv, signal_id, 0, NULL);
4361 for (n = 0; n < num_params + 1; n++)
4362 g_value_unset (&paramv[n]);
4363 g_free (paramv);
4364}
4365
4366static void
4367sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
4368 GVariant *changed_properties,
4369 const gchar *const *invalidated_properties)
4370{
4371 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
4372 guint n;
4373 const gchar *key;
4374 GVariantIter *iter;
4375 _ExtendedGDBusPropertyInfo *info;
4376 g_variant_get (changed_properties, "a{sv}", &iter);
4377 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4378 {
4379 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
4380 g_datalist_remove_data (&proxy->priv->qdata, key);
4381 if (info != NULL)
4382 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4383 }
4384 g_variant_iter_free (iter);
4385 for (n = 0; invalidated_properties[n] != NULL; n++)
4386 {
4387 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
4388 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4389 if (info != NULL)
4390 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4391 }
4392}
4393
4394static const gchar *
4395sensor_i2c_proxy_get_dev_path (SensorI2c *object)
4396{
4397 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
4398 GVariant *variant;
4399 const gchar *value = NULL;
4400 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
4401 if (variant != NULL)
4402 {
4403 value = g_variant_get_string (variant, NULL);
4404 g_variant_unref (variant);
4405 }
4406 return value;
4407}
4408
4409static const gchar *
4410sensor_i2c_proxy_get_address (SensorI2c *object)
4411{
4412 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
4413 GVariant *variant;
4414 const gchar *value = NULL;
4415 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
4416 if (variant != NULL)
4417 {
4418 value = g_variant_get_string (variant, NULL);
4419 g_variant_unref (variant);
4420 }
4421 return value;
4422}
4423
4424static void
4425sensor_i2c_proxy_init (SensorI2cProxy *proxy)
4426{
4427#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4428 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
4429#else
4430 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
4431#endif
4432
4433 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
4434}
4435
4436static void
4437sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
4438{
4439 GObjectClass *gobject_class;
4440 GDBusProxyClass *proxy_class;
4441
4442 gobject_class = G_OBJECT_CLASS (klass);
4443 gobject_class->finalize = sensor_i2c_proxy_finalize;
4444 gobject_class->get_property = sensor_i2c_proxy_get_property;
4445 gobject_class->set_property = sensor_i2c_proxy_set_property;
4446
4447 proxy_class = G_DBUS_PROXY_CLASS (klass);
4448 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
4449 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
4450
4451 sensor_i2c_override_properties (gobject_class, 1);
4452
4453#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4454 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
4455#endif
4456}
4457
4458static void
4459sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
4460{
4461 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
4462 iface->get_address = sensor_i2c_proxy_get_address;
4463}
4464
4465/**
4466 * sensor_i2c_proxy_new:
4467 * @connection: A #GDBusConnection.
4468 * @flags: Flags from the #GDBusProxyFlags enumeration.
4469 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4470 * @object_path: An object path.
4471 * @cancellable: (allow-none): A #GCancellable or %NULL.
4472 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4473 * @user_data: User data to pass to @callback.
4474 *
4475 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details.
4476 *
4477 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4478 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
4479 *
4480 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
4481 */
4482void
4483sensor_i2c_proxy_new (
4484 GDBusConnection *connection,
4485 GDBusProxyFlags flags,
4486 const gchar *name,
4487 const gchar *object_path,
4488 GCancellable *cancellable,
4489 GAsyncReadyCallback callback,
4490 gpointer user_data)
4491{
4492 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
4493}
4494
4495/**
4496 * sensor_i2c_proxy_new_finish:
4497 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
4498 * @error: Return location for error or %NULL
4499 *
4500 * Finishes an operation started with sensor_i2c_proxy_new().
4501 *
4502 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
4503 */
4504SensorI2c *
4505sensor_i2c_proxy_new_finish (
4506 GAsyncResult *res,
4507 GError **error)
4508{
4509 GObject *ret;
4510 GObject *source_object;
4511 source_object = g_async_result_get_source_object (res);
4512 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4513 g_object_unref (source_object);
4514 if (ret != NULL)
4515 return SENSOR_I2C (ret);
4516 else
4517 return NULL;
4518}
4519
4520/**
4521 * sensor_i2c_proxy_new_sync:
4522 * @connection: A #GDBusConnection.
4523 * @flags: Flags from the #GDBusProxyFlags enumeration.
4524 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4525 * @object_path: An object path.
4526 * @cancellable: (allow-none): A #GCancellable or %NULL.
4527 * @error: Return location for error or %NULL
4528 *
4529 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details.
4530 *
4531 * The calling thread is blocked until a reply is received.
4532 *
4533 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
4534 *
4535 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
4536 */
4537SensorI2c *
4538sensor_i2c_proxy_new_sync (
4539 GDBusConnection *connection,
4540 GDBusProxyFlags flags,
4541 const gchar *name,
4542 const gchar *object_path,
4543 GCancellable *cancellable,
4544 GError **error)
4545{
4546 GInitable *ret;
4547 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
4548 if (ret != NULL)
4549 return SENSOR_I2C (ret);
4550 else
4551 return NULL;
4552}
4553
4554
4555/**
4556 * sensor_i2c_proxy_new_for_bus:
4557 * @bus_type: A #GBusType.
4558 * @flags: Flags from the #GDBusProxyFlags enumeration.
4559 * @name: A bus name (well-known or unique).
4560 * @object_path: An object path.
4561 * @cancellable: (allow-none): A #GCancellable or %NULL.
4562 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4563 * @user_data: User data to pass to @callback.
4564 *
4565 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4566 *
4567 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4568 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
4569 *
4570 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4571 */
4572void
4573sensor_i2c_proxy_new_for_bus (
4574 GBusType bus_type,
4575 GDBusProxyFlags flags,
4576 const gchar *name,
4577 const gchar *object_path,
4578 GCancellable *cancellable,
4579 GAsyncReadyCallback callback,
4580 gpointer user_data)
4581{
4582 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
4583}
4584
4585/**
4586 * sensor_i2c_proxy_new_for_bus_finish:
4587 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
4588 * @error: Return location for error or %NULL
4589 *
4590 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
4591 *
4592 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
4593 */
4594SensorI2c *
4595sensor_i2c_proxy_new_for_bus_finish (
4596 GAsyncResult *res,
4597 GError **error)
4598{
4599 GObject *ret;
4600 GObject *source_object;
4601 source_object = g_async_result_get_source_object (res);
4602 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4603 g_object_unref (source_object);
4604 if (ret != NULL)
4605 return SENSOR_I2C (ret);
4606 else
4607 return NULL;
4608}
4609
4610/**
4611 * sensor_i2c_proxy_new_for_bus_sync:
4612 * @bus_type: A #GBusType.
4613 * @flags: Flags from the #GDBusProxyFlags enumeration.
4614 * @name: A bus name (well-known or unique).
4615 * @object_path: An object path.
4616 * @cancellable: (allow-none): A #GCancellable or %NULL.
4617 * @error: Return location for error or %NULL
4618 *
4619 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4620 *
4621 * The calling thread is blocked until a reply is received.
4622 *
4623 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
4624 *
4625 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
4626 */
4627SensorI2c *
4628sensor_i2c_proxy_new_for_bus_sync (
4629 GBusType bus_type,
4630 GDBusProxyFlags flags,
4631 const gchar *name,
4632 const gchar *object_path,
4633 GCancellable *cancellable,
4634 GError **error)
4635{
4636 GInitable *ret;
4637 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
4638 if (ret != NULL)
4639 return SENSOR_I2C (ret);
4640 else
4641 return NULL;
4642}
4643
4644
4645/* ------------------------------------------------------------------------ */
4646
4647/**
4648 * SensorI2cSkeleton:
4649 *
4650 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
4651 */
4652
4653/**
4654 * SensorI2cSkeletonClass:
4655 * @parent_class: The parent class.
4656 *
4657 * Class structure for #SensorI2cSkeleton.
4658 */
4659
4660struct _SensorI2cSkeletonPrivate
4661{
4662 GValue *properties;
4663 GList *changed_properties;
4664 GSource *changed_properties_idle_source;
4665 GMainContext *context;
4666 GMutex lock;
4667};
4668
4669static void
4670_sensor_i2c_skeleton_handle_method_call (
4671 GDBusConnection *connection G_GNUC_UNUSED,
4672 const gchar *sender G_GNUC_UNUSED,
4673 const gchar *object_path G_GNUC_UNUSED,
4674 const gchar *interface_name,
4675 const gchar *method_name,
4676 GVariant *parameters,
4677 GDBusMethodInvocation *invocation,
4678 gpointer user_data)
4679{
4680 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
4681 _ExtendedGDBusMethodInfo *info;
4682 GVariantIter iter;
4683 GVariant *child;
4684 GValue *paramv;
4685 guint num_params;
4686 guint num_extra;
4687 guint n;
4688 guint signal_id;
4689 GValue return_value = G_VALUE_INIT;
4690 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4691 g_assert (info != NULL);
4692 num_params = g_variant_n_children (parameters);
4693 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
4694 n = 0;
4695 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
4696 g_value_set_object (&paramv[n++], skeleton);
4697 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
4698 g_value_set_object (&paramv[n++], invocation);
4699 if (info->pass_fdlist)
4700 {
4701#ifdef G_OS_UNIX
4702 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
4703 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
4704#else
4705 g_assert_not_reached ();
4706#endif
4707 }
4708 g_variant_iter_init (&iter, parameters);
4709 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4710 {
4711 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
4712 if (arg_info->use_gvariant)
4713 {
4714 g_value_init (&paramv[n], G_TYPE_VARIANT);
4715 g_value_set_variant (&paramv[n], child);
4716 n++;
4717 }
4718 else
4719 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4720 g_variant_unref (child);
4721 }
4722 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
4723 g_value_init (&return_value, G_TYPE_BOOLEAN);
4724 g_signal_emitv (paramv, signal_id, 0, &return_value);
4725 if (!g_value_get_boolean (&return_value))
4726 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
4727 g_value_unset (&return_value);
4728 for (n = 0; n < num_params + num_extra; n++)
4729 g_value_unset (&paramv[n]);
4730 g_free (paramv);
4731}
4732
4733static GVariant *
4734_sensor_i2c_skeleton_handle_get_property (
4735 GDBusConnection *connection G_GNUC_UNUSED,
4736 const gchar *sender G_GNUC_UNUSED,
4737 const gchar *object_path G_GNUC_UNUSED,
4738 const gchar *interface_name G_GNUC_UNUSED,
4739 const gchar *property_name,
4740 GError **error,
4741 gpointer user_data)
4742{
4743 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
4744 GValue value = G_VALUE_INIT;
4745 GParamSpec *pspec;
4746 _ExtendedGDBusPropertyInfo *info;
4747 GVariant *ret;
4748 ret = NULL;
4749 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
4750 g_assert (info != NULL);
4751 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4752 if (pspec == NULL)
4753 {
4754 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4755 }
4756 else
4757 {
4758 g_value_init (&value, pspec->value_type);
4759 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4760 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4761 g_value_unset (&value);
4762 }
4763 return ret;
4764}
4765
4766static gboolean
4767_sensor_i2c_skeleton_handle_set_property (
4768 GDBusConnection *connection G_GNUC_UNUSED,
4769 const gchar *sender G_GNUC_UNUSED,
4770 const gchar *object_path G_GNUC_UNUSED,
4771 const gchar *interface_name G_GNUC_UNUSED,
4772 const gchar *property_name,
4773 GVariant *variant,
4774 GError **error,
4775 gpointer user_data)
4776{
4777 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
4778 GValue value = G_VALUE_INIT;
4779 GParamSpec *pspec;
4780 _ExtendedGDBusPropertyInfo *info;
4781 gboolean ret;
4782 ret = FALSE;
4783 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
4784 g_assert (info != NULL);
4785 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4786 if (pspec == NULL)
4787 {
4788 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4789 }
4790 else
4791 {
4792 if (info->use_gvariant)
4793 g_value_set_variant (&value, variant);
4794 else
4795 g_dbus_gvariant_to_gvalue (variant, &value);
4796 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4797 g_value_unset (&value);
4798 ret = TRUE;
4799 }
4800 return ret;
4801}
4802
4803static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
4804{
4805 _sensor_i2c_skeleton_handle_method_call,
4806 _sensor_i2c_skeleton_handle_get_property,
4807 _sensor_i2c_skeleton_handle_set_property,
4808 {NULL}
4809};
4810
4811static GDBusInterfaceInfo *
4812sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4813{
4814 return sensor_i2c_interface_info ();
4815}
4816
4817static GDBusInterfaceVTable *
4818sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4819{
4820 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
4821}
4822
4823static GVariant *
4824sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
4825{
4826 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
4827
4828 GVariantBuilder builder;
4829 guint n;
4830 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4831 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
4832 goto out;
4833 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
4834 {
4835 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
4836 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4837 {
4838 GVariant *value;
4839 value = _sensor_i2c_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorI2c", info->name, NULL, skeleton);
4840 if (value != NULL)
4841 {
4842 g_variant_take_ref (value);
4843 g_variant_builder_add (&builder, "{sv}", info->name, value);
4844 g_variant_unref (value);
4845 }
4846 }
4847 }
4848out:
4849 return g_variant_builder_end (&builder);
4850}
4851
4852static gboolean _sensor_i2c_emit_changed (gpointer user_data);
4853
4854static void
4855sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
4856{
4857 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
4858 gboolean emit_changed = FALSE;
4859
4860 g_mutex_lock (&skeleton->priv->lock);
4861 if (skeleton->priv->changed_properties_idle_source != NULL)
4862 {
4863 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4864 skeleton->priv->changed_properties_idle_source = NULL;
4865 emit_changed = TRUE;
4866 }
4867 g_mutex_unlock (&skeleton->priv->lock);
4868
4869 if (emit_changed)
4870 _sensor_i2c_emit_changed (skeleton);
4871}
4872
4873static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
4874#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4875G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4876 G_ADD_PRIVATE (SensorI2cSkeleton)
4877 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
4878
4879#else
4880G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4881 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
4882
4883#endif
4884static void
4885sensor_i2c_skeleton_finalize (GObject *object)
4886{
4887 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
4888 guint n;
4889 for (n = 0; n < 2; n++)
4890 g_value_unset (&skeleton->priv->properties[n]);
4891 g_free (skeleton->priv->properties);
4892 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4893 if (skeleton->priv->changed_properties_idle_source != NULL)
4894 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4895 g_main_context_unref (skeleton->priv->context);
4896 g_mutex_clear (&skeleton->priv->lock);
4897 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
4898}
4899
4900static void
4901sensor_i2c_skeleton_get_property (GObject *object,
4902 guint prop_id,
4903 GValue *value,
4904 GParamSpec *pspec G_GNUC_UNUSED)
4905{
4906 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
4907 g_assert (prop_id != 0 && prop_id - 1 < 2);
4908 g_mutex_lock (&skeleton->priv->lock);
4909 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4910 g_mutex_unlock (&skeleton->priv->lock);
4911}
4912
4913static gboolean
4914_sensor_i2c_emit_changed (gpointer user_data)
4915{
4916 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
4917 GList *l;
4918 GVariantBuilder builder;
4919 GVariantBuilder invalidated_builder;
4920 guint num_changes;
4921
4922 g_mutex_lock (&skeleton->priv->lock);
4923 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4924 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4925 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4926 {
4927 ChangedProperty *cp = l->data;
4928 GVariant *variant;
4929 const GValue *cur_value;
4930
4931 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4932 if (!_g_value_equal (cur_value, &cp->orig_value))
4933 {
4934 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4935 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4936 g_variant_unref (variant);
4937 num_changes++;
4938 }
4939 }
4940 if (num_changes > 0)
4941 {
4942 GList *connections, *ll;
4943 GVariant *signal_variant;
4944 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
4945 &builder, &invalidated_builder));
4946 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4947 for (ll = connections; ll != NULL; ll = ll->next)
4948 {
4949 GDBusConnection *connection = ll->data;
4950
4951 g_dbus_connection_emit_signal (connection,
4952 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4953 "org.freedesktop.DBus.Properties",
4954 "PropertiesChanged",
4955 signal_variant,
4956 NULL);
4957 }
4958 g_variant_unref (signal_variant);
4959 g_list_free_full (connections, g_object_unref);
4960 }
4961 else
4962 {
4963 g_variant_builder_clear (&builder);
4964 g_variant_builder_clear (&invalidated_builder);
4965 }
4966 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4967 skeleton->priv->changed_properties = NULL;
4968 skeleton->priv->changed_properties_idle_source = NULL;
4969 g_mutex_unlock (&skeleton->priv->lock);
4970 return FALSE;
4971}
4972
4973static void
4974_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4975{
4976 ChangedProperty *cp;
4977 GList *l;
4978 cp = NULL;
4979 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4980 {
4981 ChangedProperty *i_cp = l->data;
4982 if (i_cp->info == info)
4983 {
4984 cp = i_cp;
4985 break;
4986 }
4987 }
4988 if (cp == NULL)
4989 {
4990 cp = g_new0 (ChangedProperty, 1);
4991 cp->prop_id = prop_id;
4992 cp->info = info;
4993 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4994 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4995 g_value_copy (orig_value, &cp->orig_value);
4996 }
4997}
4998
4999static void
5000sensor_i2c_skeleton_notify (GObject *object,
5001 GParamSpec *pspec G_GNUC_UNUSED)
5002{
5003 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
5004 g_mutex_lock (&skeleton->priv->lock);
5005 if (skeleton->priv->changed_properties != NULL &&
5006 skeleton->priv->changed_properties_idle_source == NULL)
5007 {
5008 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5009 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5010 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5011 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5012 g_source_unref (skeleton->priv->changed_properties_idle_source);
5013 }
5014 g_mutex_unlock (&skeleton->priv->lock);
5015}
5016
5017static void
5018sensor_i2c_skeleton_set_property (GObject *object,
5019 guint prop_id,
5020 const GValue *value,
5021 GParamSpec *pspec)
5022{
5023 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
5024 g_assert (prop_id != 0 && prop_id - 1 < 2);
5025 g_mutex_lock (&skeleton->priv->lock);
5026 g_object_freeze_notify (object);
5027 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5028 {
5029 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5030 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5031 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5032 g_object_notify_by_pspec (object, pspec);
5033 }
5034 g_mutex_unlock (&skeleton->priv->lock);
5035 g_object_thaw_notify (object);
5036}
5037
5038static void
5039sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
5040{
5041#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5042 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
5043#else
5044 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
5045#endif
5046
5047 g_mutex_init (&skeleton->priv->lock);
5048 skeleton->priv->context = g_main_context_ref_thread_default ();
5049 skeleton->priv->properties = g_new0 (GValue, 2);
5050 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
5051 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5052}
5053
5054static const gchar *
5055sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
5056{
5057 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
5058 const gchar *value;
5059 g_mutex_lock (&skeleton->priv->lock);
5060 value = g_value_get_string (&(skeleton->priv->properties[0]));
5061 g_mutex_unlock (&skeleton->priv->lock);
5062 return value;
5063}
5064
5065static const gchar *
5066sensor_i2c_skeleton_get_address (SensorI2c *object)
5067{
5068 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
5069 const gchar *value;
5070 g_mutex_lock (&skeleton->priv->lock);
5071 value = g_value_get_string (&(skeleton->priv->properties[1]));
5072 g_mutex_unlock (&skeleton->priv->lock);
5073 return value;
5074}
5075
5076static void
5077sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
5078{
5079 GObjectClass *gobject_class;
5080 GDBusInterfaceSkeletonClass *skeleton_class;
5081
5082 gobject_class = G_OBJECT_CLASS (klass);
5083 gobject_class->finalize = sensor_i2c_skeleton_finalize;
5084 gobject_class->get_property = sensor_i2c_skeleton_get_property;
5085 gobject_class->set_property = sensor_i2c_skeleton_set_property;
5086 gobject_class->notify = sensor_i2c_skeleton_notify;
5087
5088
5089 sensor_i2c_override_properties (gobject_class, 1);
5090
5091 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5092 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
5093 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
5094 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
5095 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
5096
5097#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5098 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
5099#endif
5100}
5101
5102static void
5103sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
5104{
5105 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
5106 iface->get_address = sensor_i2c_skeleton_get_address;
5107}
5108
5109/**
5110 * sensor_i2c_skeleton_new:
5111 *
5112 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
5113 *
5114 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
5115 */
5116SensorI2c *
5117sensor_i2c_skeleton_new (void)
5118{
5119 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
5120}
5121
5122/* ------------------------------------------------------------------------
Norman Jamese2765102015-08-19 22:00:55 -05005123 * Code for Object, ObjectProxy and ObjectSkeleton
5124 * ------------------------------------------------------------------------
5125 */
5126
5127/**
5128 * SECTION:Object
5129 * @title: Object
5130 * @short_description: Specialized GDBusObject types
5131 *
5132 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
5133 */
5134
5135/**
5136 * Object:
5137 *
5138 * The #Object type is a specialized container of interfaces.
5139 */
5140
5141/**
5142 * ObjectIface:
5143 * @parent_iface: The parent interface.
5144 *
5145 * Virtual table for the #Object interface.
5146 */
5147
5148typedef ObjectIface ObjectInterface;
5149G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
5150
5151static void
5152object_default_init (ObjectIface *iface)
5153{
5154 /**
Norman James5d78b4d2015-09-05 13:34:34 -05005155 * Object:sensor-value:
Norman Jamese2765102015-08-19 22:00:55 -05005156 *
Norman James5d78b4d2015-09-05 13:34:34 -05005157 * 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 Jamese2765102015-08-19 22:00:55 -05005158 *
5159 * Connect to the #GObject::notify signal to get informed of property changes.
5160 */
Norman James5d78b4d2015-09-05 13:34:34 -05005161 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 Jamese2765102015-08-19 22:00:55 -05005162
5163 /**
Norman James5d78b4d2015-09-05 13:34:34 -05005164 * Object:sensor-threshold:
Norman Jamese2765102015-08-19 22:00:55 -05005165 *
Norman James5d78b4d2015-09-05 13:34:34 -05005166 * 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 Jamese2765102015-08-19 22:00:55 -05005167 *
5168 * Connect to the #GObject::notify signal to get informed of property changes.
5169 */
Norman James5d78b4d2015-09-05 13:34:34 -05005170 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 Jamescc7ae122015-08-24 14:26:09 -05005171
Norman James90baede2015-09-02 20:32:49 -05005172 /**
5173 * Object:sensor-i2c:
5174 *
5175 * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any.
5176 *
5177 * Connect to the #GObject::notify signal to get informed of property changes.
5178 */
5179 g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
5180
Norman Jamese2765102015-08-19 22:00:55 -05005181}
5182
5183/**
Norman James5d78b4d2015-09-05 13:34:34 -05005184 * object_get_sensor_value:
Norman Jamese2765102015-08-19 22:00:55 -05005185 * @object: A #Object.
5186 *
Norman James5d78b4d2015-09-05 13:34:34 -05005187 * 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 Jamese2765102015-08-19 22:00:55 -05005188 *
Norman James5d78b4d2015-09-05 13:34:34 -05005189 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
Norman Jamese2765102015-08-19 22:00:55 -05005190 */
Norman James5d78b4d2015-09-05 13:34:34 -05005191SensorValue *object_get_sensor_value (Object *object)
Norman Jamese2765102015-08-19 22:00:55 -05005192{
5193 GDBusInterface *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05005194 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman Jamese2765102015-08-19 22:00:55 -05005195 if (ret == NULL)
5196 return NULL;
Norman James5d78b4d2015-09-05 13:34:34 -05005197 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05005198}
5199
5200/**
Norman James5d78b4d2015-09-05 13:34:34 -05005201 * object_get_sensor_threshold:
Norman Jamese2765102015-08-19 22:00:55 -05005202 * @object: A #Object.
5203 *
Norman James5d78b4d2015-09-05 13:34:34 -05005204 * 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 Jamese2765102015-08-19 22:00:55 -05005205 *
Norman James5d78b4d2015-09-05 13:34:34 -05005206 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
Norman Jamese2765102015-08-19 22:00:55 -05005207 */
Norman James5d78b4d2015-09-05 13:34:34 -05005208SensorThreshold *object_get_sensor_threshold (Object *object)
Norman Jamese2765102015-08-19 22:00:55 -05005209{
5210 GDBusInterface *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05005211 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05005212 if (ret == NULL)
5213 return NULL;
Norman James5d78b4d2015-09-05 13:34:34 -05005214 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05005215}
5216
Norman James90baede2015-09-02 20:32:49 -05005217/**
5218 * object_get_sensor_i2c:
5219 * @object: A #Object.
5220 *
5221 * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any.
5222 *
5223 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5224 */
5225SensorI2c *object_get_sensor_i2c (Object *object)
5226{
5227 GDBusInterface *ret;
5228 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
5229 if (ret == NULL)
5230 return NULL;
5231 return SENSOR_I2C (ret);
5232}
5233
Norman Jamese2765102015-08-19 22:00:55 -05005234
5235/**
Norman James5d78b4d2015-09-05 13:34:34 -05005236 * object_peek_sensor_value: (skip)
Norman Jamese2765102015-08-19 22:00:55 -05005237 * @object: A #Object.
5238 *
Norman James5d78b4d2015-09-05 13:34:34 -05005239 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
Norman Jamese2765102015-08-19 22:00:55 -05005240 *
5241 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
5242 *
Norman James5d78b4d2015-09-05 13:34:34 -05005243 * 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 Jamese2765102015-08-19 22:00:55 -05005244 */
Norman James5d78b4d2015-09-05 13:34:34 -05005245SensorValue *object_peek_sensor_value (Object *object)
Norman Jamese2765102015-08-19 22:00:55 -05005246{
5247 GDBusInterface *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05005248 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman Jamese2765102015-08-19 22:00:55 -05005249 if (ret == NULL)
5250 return NULL;
5251 g_object_unref (ret);
Norman James5d78b4d2015-09-05 13:34:34 -05005252 return SENSOR_VALUE (ret);
Norman Jamese2765102015-08-19 22:00:55 -05005253}
5254
5255/**
Norman James5d78b4d2015-09-05 13:34:34 -05005256 * object_peek_sensor_threshold: (skip)
Norman Jamese2765102015-08-19 22:00:55 -05005257 * @object: A #Object.
5258 *
Norman James5d78b4d2015-09-05 13:34:34 -05005259 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
Norman Jamese2765102015-08-19 22:00:55 -05005260 *
5261 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
5262 *
Norman James5d78b4d2015-09-05 13:34:34 -05005263 * 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 Jamese2765102015-08-19 22:00:55 -05005264 */
Norman James5d78b4d2015-09-05 13:34:34 -05005265SensorThreshold *object_peek_sensor_threshold (Object *object)
Norman Jamese2765102015-08-19 22:00:55 -05005266{
5267 GDBusInterface *ret;
Norman James5d78b4d2015-09-05 13:34:34 -05005268 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05005269 if (ret == NULL)
5270 return NULL;
5271 g_object_unref (ret);
Norman James5d78b4d2015-09-05 13:34:34 -05005272 return SENSOR_THRESHOLD (ret);
Norman Jamescc7ae122015-08-24 14:26:09 -05005273}
5274
Norman James90baede2015-09-02 20:32:49 -05005275/**
5276 * object_peek_sensor_i2c: (skip)
5277 * @object: A #Object.
5278 *
5279 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
5280 *
5281 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
5282 *
5283 * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
5284 */
5285SensorI2c *object_peek_sensor_i2c (Object *object)
5286{
5287 GDBusInterface *ret;
5288 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
5289 if (ret == NULL)
5290 return NULL;
5291 g_object_unref (ret);
5292 return SENSOR_I2C (ret);
5293}
5294
Norman Jamese2765102015-08-19 22:00:55 -05005295
5296static void
5297object_notify (GDBusObject *object, GDBusInterface *interface)
5298{
5299 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
5300 /* info can be NULL if the other end is using a D-Bus interface we don't know
5301 * anything about, for example old generated code in this process talking to
5302 * newer generated code in the other process. */
5303 if (info != NULL)
5304 g_object_notify (G_OBJECT (object), info->hyphen_name);
5305}
5306
5307/**
5308 * ObjectProxy:
5309 *
5310 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
5311 */
5312
5313/**
5314 * ObjectProxyClass:
5315 * @parent_class: The parent class.
5316 *
5317 * Class structure for #ObjectProxy.
5318 */
5319
5320static void
5321object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5322{
5323}
5324
5325static void
5326object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
5327{
5328 iface->interface_added = object_notify;
5329 iface->interface_removed = object_notify;
5330}
5331
5332
5333G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
5334 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
5335 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
5336
5337static void
5338object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
5339{
5340}
5341
5342static void
5343object_proxy_set_property (GObject *gobject,
5344 guint prop_id,
5345 const GValue *value G_GNUC_UNUSED,
5346 GParamSpec *pspec)
5347{
5348 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5349}
5350
5351static void
5352object_proxy_get_property (GObject *gobject,
5353 guint prop_id,
5354 GValue *value,
5355 GParamSpec *pspec)
5356{
5357 ObjectProxy *object = OBJECT_PROXY (gobject);
5358 GDBusInterface *interface;
5359
5360 switch (prop_id)
5361 {
5362 case 1:
Norman James5d78b4d2015-09-05 13:34:34 -05005363 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman Jamese2765102015-08-19 22:00:55 -05005364 g_value_take_object (value, interface);
5365 break;
5366
5367 case 2:
Norman James5d78b4d2015-09-05 13:34:34 -05005368 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05005369 g_value_take_object (value, interface);
5370 break;
5371
5372 case 3:
Norman James90baede2015-09-02 20:32:49 -05005373 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05005374 g_value_take_object (value, interface);
5375 break;
5376
Norman Jamese2765102015-08-19 22:00:55 -05005377 default:
5378 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5379 break;
5380 }
5381}
5382
5383static void
5384object_proxy_class_init (ObjectProxyClass *klass)
5385{
5386 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
5387
5388 gobject_class->set_property = object_proxy_set_property;
5389 gobject_class->get_property = object_proxy_get_property;
5390
Norman James5d78b4d2015-09-05 13:34:34 -05005391 g_object_class_override_property (gobject_class, 1, "sensor-value");
5392 g_object_class_override_property (gobject_class, 2, "sensor-threshold");
5393 g_object_class_override_property (gobject_class, 3, "sensor-i2c");
Norman Jamese2765102015-08-19 22:00:55 -05005394}
5395
5396/**
5397 * object_proxy_new:
5398 * @connection: A #GDBusConnection.
5399 * @object_path: An object path.
5400 *
5401 * Creates a new proxy object.
5402 *
5403 * Returns: (transfer full): The proxy object.
5404 */
5405ObjectProxy *
5406object_proxy_new (GDBusConnection *connection,
5407 const gchar *object_path)
5408{
5409 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
5410 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
5411 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
5412}
5413
5414/**
5415 * ObjectSkeleton:
5416 *
5417 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
5418 */
5419
5420/**
5421 * ObjectSkeletonClass:
5422 * @parent_class: The parent class.
5423 *
5424 * Class structure for #ObjectSkeleton.
5425 */
5426
5427static void
5428object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5429{
5430}
5431
5432
5433static void
5434object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
5435{
5436 iface->interface_added = object_notify;
5437 iface->interface_removed = object_notify;
5438}
5439
5440G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
5441 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
5442 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
5443
5444static void
5445object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
5446{
5447}
5448
5449static void
5450object_skeleton_set_property (GObject *gobject,
5451 guint prop_id,
5452 const GValue *value,
5453 GParamSpec *pspec)
5454{
5455 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
5456 GDBusInterfaceSkeleton *interface;
5457
5458 switch (prop_id)
5459 {
5460 case 1:
5461 interface = g_value_get_object (value);
5462 if (interface != NULL)
5463 {
Norman James5d78b4d2015-09-05 13:34:34 -05005464 g_warn_if_fail (IS_SENSOR_VALUE (interface));
Norman Jamese2765102015-08-19 22:00:55 -05005465 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5466 }
5467 else
5468 {
Norman James5d78b4d2015-09-05 13:34:34 -05005469 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
Norman Jamese2765102015-08-19 22:00:55 -05005470 }
5471 break;
5472
5473 case 2:
5474 interface = g_value_get_object (value);
5475 if (interface != NULL)
5476 {
Norman James5d78b4d2015-09-05 13:34:34 -05005477 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
Norman Jamese2765102015-08-19 22:00:55 -05005478 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5479 }
5480 else
5481 {
Norman James5d78b4d2015-09-05 13:34:34 -05005482 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05005483 }
5484 break;
5485
5486 case 3:
5487 interface = g_value_get_object (value);
5488 if (interface != NULL)
5489 {
Norman James90baede2015-09-02 20:32:49 -05005490 g_warn_if_fail (IS_SENSOR_I2C (interface));
Norman Jamescc7ae122015-08-24 14:26:09 -05005491 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5492 }
5493 else
5494 {
Norman James90baede2015-09-02 20:32:49 -05005495 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05005496 }
5497 break;
5498
Norman Jamese2765102015-08-19 22:00:55 -05005499 default:
5500 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5501 break;
5502 }
5503}
5504
5505static void
5506object_skeleton_get_property (GObject *gobject,
5507 guint prop_id,
5508 GValue *value,
5509 GParamSpec *pspec)
5510{
5511 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
5512 GDBusInterface *interface;
5513
5514 switch (prop_id)
5515 {
5516 case 1:
Norman James5d78b4d2015-09-05 13:34:34 -05005517 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman Jamese2765102015-08-19 22:00:55 -05005518 g_value_take_object (value, interface);
5519 break;
5520
5521 case 2:
Norman James5d78b4d2015-09-05 13:34:34 -05005522 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05005523 g_value_take_object (value, interface);
5524 break;
5525
5526 case 3:
Norman James90baede2015-09-02 20:32:49 -05005527 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05005528 g_value_take_object (value, interface);
5529 break;
5530
Norman Jamese2765102015-08-19 22:00:55 -05005531 default:
5532 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5533 break;
5534 }
5535}
5536
5537static void
5538object_skeleton_class_init (ObjectSkeletonClass *klass)
5539{
5540 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
5541
5542 gobject_class->set_property = object_skeleton_set_property;
5543 gobject_class->get_property = object_skeleton_get_property;
5544
Norman James5d78b4d2015-09-05 13:34:34 -05005545 g_object_class_override_property (gobject_class, 1, "sensor-value");
5546 g_object_class_override_property (gobject_class, 2, "sensor-threshold");
5547 g_object_class_override_property (gobject_class, 3, "sensor-i2c");
Norman Jamese2765102015-08-19 22:00:55 -05005548}
5549
5550/**
5551 * object_skeleton_new:
5552 * @object_path: An object path.
5553 *
5554 * Creates a new skeleton object.
5555 *
5556 * Returns: (transfer full): The skeleton object.
5557 */
5558ObjectSkeleton *
5559object_skeleton_new (const gchar *object_path)
5560{
5561 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
5562 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
5563}
5564
5565/**
Norman James5d78b4d2015-09-05 13:34:34 -05005566 * object_skeleton_set_sensor_value:
Norman Jamese2765102015-08-19 22:00:55 -05005567 * @object: A #ObjectSkeleton.
Norman James5d78b4d2015-09-05 13:34:34 -05005568 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
Norman Jamese2765102015-08-19 22:00:55 -05005569 *
Norman James5d78b4d2015-09-05 13:34:34 -05005570 * 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 Jamese2765102015-08-19 22:00:55 -05005571 */
Norman James5d78b4d2015-09-05 13:34:34 -05005572void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
Norman Jamese2765102015-08-19 22:00:55 -05005573{
Norman James5d78b4d2015-09-05 13:34:34 -05005574 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
Norman Jamese2765102015-08-19 22:00:55 -05005575}
5576
5577/**
Norman James5d78b4d2015-09-05 13:34:34 -05005578 * object_skeleton_set_sensor_threshold:
Norman Jamese2765102015-08-19 22:00:55 -05005579 * @object: A #ObjectSkeleton.
Norman James5d78b4d2015-09-05 13:34:34 -05005580 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
Norman Jamese2765102015-08-19 22:00:55 -05005581 *
Norman James5d78b4d2015-09-05 13:34:34 -05005582 * 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 Jamese2765102015-08-19 22:00:55 -05005583 */
Norman James5d78b4d2015-09-05 13:34:34 -05005584void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
Norman Jamese2765102015-08-19 22:00:55 -05005585{
Norman James5d78b4d2015-09-05 13:34:34 -05005586 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -05005587}
5588
Norman James90baede2015-09-02 20:32:49 -05005589/**
5590 * object_skeleton_set_sensor_i2c:
5591 * @object: A #ObjectSkeleton.
5592 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
5593 *
5594 * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object.
5595 */
5596void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
5597{
5598 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
5599}
5600
Norman Jamese2765102015-08-19 22:00:55 -05005601
5602/* ------------------------------------------------------------------------
5603 * Code for ObjectManager client
5604 * ------------------------------------------------------------------------
5605 */
5606
5607/**
5608 * SECTION:ObjectManagerClient
5609 * @title: ObjectManagerClient
5610 * @short_description: Generated GDBusObjectManagerClient type
5611 *
5612 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
5613 */
5614
5615/**
5616 * ObjectManagerClient:
5617 *
5618 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
5619 */
5620
5621/**
5622 * ObjectManagerClientClass:
5623 * @parent_class: The parent class.
5624 *
5625 * Class structure for #ObjectManagerClient.
5626 */
5627
5628G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
5629
5630static void
5631object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
5632{
5633}
5634
5635static void
5636object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
5637{
5638}
5639
5640/**
5641 * object_manager_client_get_proxy_type:
5642 * @manager: A #GDBusObjectManagerClient.
5643 * @object_path: The object path of the remote object (unused).
5644 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
5645 * @user_data: User data (unused).
5646 *
5647 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
5648 *
5649 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
5650 */
5651GType
5652object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
5653{
5654 static gsize once_init_value = 0;
5655 static GHashTable *lookup_hash;
5656 GType ret;
5657
5658 if (interface_name == NULL)
5659 return TYPE_OBJECT_PROXY;
5660 if (g_once_init_enter (&once_init_value))
5661 {
5662 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James5d78b4d2015-09-05 13:34:34 -05005663 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
5664 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
Norman James90baede2015-09-02 20:32:49 -05005665 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
Norman Jamese2765102015-08-19 22:00:55 -05005666 g_once_init_leave (&once_init_value, 1);
5667 }
5668 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
5669 if (ret == (GType) 0)
5670 ret = G_TYPE_DBUS_PROXY;
5671 return ret;
5672}
5673
5674/**
5675 * object_manager_client_new:
5676 * @connection: A #GDBusConnection.
5677 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5678 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5679 * @object_path: An object path.
5680 * @cancellable: (allow-none): A #GCancellable or %NULL.
5681 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5682 * @user_data: User data to pass to @callback.
5683 *
5684 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
5685 *
5686 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5687 * You can then call object_manager_client_new_finish() to get the result of the operation.
5688 *
5689 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
5690 */
5691void
5692object_manager_client_new (
5693 GDBusConnection *connection,
5694 GDBusObjectManagerClientFlags flags,
5695 const gchar *name,
5696 const gchar *object_path,
5697 GCancellable *cancellable,
5698 GAsyncReadyCallback callback,
5699 gpointer user_data)
5700{
5701 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
5702}
5703
5704/**
5705 * object_manager_client_new_finish:
5706 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
5707 * @error: Return location for error or %NULL
5708 *
5709 * Finishes an operation started with object_manager_client_new().
5710 *
5711 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5712 */
5713GDBusObjectManager *
5714object_manager_client_new_finish (
5715 GAsyncResult *res,
5716 GError **error)
5717{
5718 GObject *ret;
5719 GObject *source_object;
5720 source_object = g_async_result_get_source_object (res);
5721 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5722 g_object_unref (source_object);
5723 if (ret != NULL)
5724 return G_DBUS_OBJECT_MANAGER (ret);
5725 else
5726 return NULL;
5727}
5728
5729/**
5730 * object_manager_client_new_sync:
5731 * @connection: A #GDBusConnection.
5732 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5733 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5734 * @object_path: An object path.
5735 * @cancellable: (allow-none): A #GCancellable or %NULL.
5736 * @error: Return location for error or %NULL
5737 *
5738 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
5739 *
5740 * The calling thread is blocked until a reply is received.
5741 *
5742 * See object_manager_client_new() for the asynchronous version of this constructor.
5743 *
5744 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5745 */
5746GDBusObjectManager *
5747object_manager_client_new_sync (
5748 GDBusConnection *connection,
5749 GDBusObjectManagerClientFlags flags,
5750 const gchar *name,
5751 const gchar *object_path,
5752 GCancellable *cancellable,
5753 GError **error)
5754{
5755 GInitable *ret;
5756 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
5757 if (ret != NULL)
5758 return G_DBUS_OBJECT_MANAGER (ret);
5759 else
5760 return NULL;
5761}
5762
5763
5764/**
5765 * object_manager_client_new_for_bus:
5766 * @bus_type: A #GBusType.
5767 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5768 * @name: A bus name (well-known or unique).
5769 * @object_path: An object path.
5770 * @cancellable: (allow-none): A #GCancellable or %NULL.
5771 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5772 * @user_data: User data to pass to @callback.
5773 *
5774 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
5775 *
5776 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5777 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
5778 *
5779 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5780 */
5781void
5782object_manager_client_new_for_bus (
5783 GBusType bus_type,
5784 GDBusObjectManagerClientFlags flags,
5785 const gchar *name,
5786 const gchar *object_path,
5787 GCancellable *cancellable,
5788 GAsyncReadyCallback callback,
5789 gpointer user_data)
5790{
5791 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
5792}
5793
5794/**
5795 * object_manager_client_new_for_bus_finish:
5796 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
5797 * @error: Return location for error or %NULL
5798 *
5799 * Finishes an operation started with object_manager_client_new_for_bus().
5800 *
5801 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5802 */
5803GDBusObjectManager *
5804object_manager_client_new_for_bus_finish (
5805 GAsyncResult *res,
5806 GError **error)
5807{
5808 GObject *ret;
5809 GObject *source_object;
5810 source_object = g_async_result_get_source_object (res);
5811 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5812 g_object_unref (source_object);
5813 if (ret != NULL)
5814 return G_DBUS_OBJECT_MANAGER (ret);
5815 else
5816 return NULL;
5817}
5818
5819/**
5820 * object_manager_client_new_for_bus_sync:
5821 * @bus_type: A #GBusType.
5822 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5823 * @name: A bus name (well-known or unique).
5824 * @object_path: An object path.
5825 * @cancellable: (allow-none): A #GCancellable or %NULL.
5826 * @error: Return location for error or %NULL
5827 *
5828 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5829 *
5830 * The calling thread is blocked until a reply is received.
5831 *
5832 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
5833 *
5834 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5835 */
5836GDBusObjectManager *
5837object_manager_client_new_for_bus_sync (
5838 GBusType bus_type,
5839 GDBusObjectManagerClientFlags flags,
5840 const gchar *name,
5841 const gchar *object_path,
5842 GCancellable *cancellable,
5843 GError **error)
5844{
5845 GInitable *ret;
5846 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
5847 if (ret != NULL)
5848 return G_DBUS_OBJECT_MANAGER (ret);
5849 else
5850 return NULL;
5851}
5852
5853