1 /*
2 * This file is generated by gdbus-codegen, do not modify it.
3 *
4 * The license of this code is the same as for the D-Bus interface description
5 * it was derived from. Note that it links to GLib, so must comply with the
6 * LGPL linking clauses.
7 */
8
9 #ifdef HAVE_CONFIG_H
10 # include "config.h"
11 #endif
12
13 #include "openbmc_intf.h"
14
15 #include <string.h>
16 #ifdef G_OS_UNIX
17 # include <gio/gunixfdlist.h>
18 #endif
19
20 #ifdef G_ENABLE_DEBUG
21 #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
22 #define g_marshal_value_peek_char(v) g_value_get_schar (v)
23 #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
24 #define g_marshal_value_peek_int(v) g_value_get_int (v)
25 #define g_marshal_value_peek_uint(v) g_value_get_uint (v)
26 #define g_marshal_value_peek_long(v) g_value_get_long (v)
27 #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
28 #define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
29 #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
30 #define g_marshal_value_peek_enum(v) g_value_get_enum (v)
31 #define g_marshal_value_peek_flags(v) g_value_get_flags (v)
32 #define g_marshal_value_peek_float(v) g_value_get_float (v)
33 #define g_marshal_value_peek_double(v) g_value_get_double (v)
34 #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
35 #define g_marshal_value_peek_param(v) g_value_get_param (v)
36 #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
37 #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
38 #define g_marshal_value_peek_object(v) g_value_get_object (v)
39 #define g_marshal_value_peek_variant(v) g_value_get_variant (v)
40 #else /* !G_ENABLE_DEBUG */
41 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
42 * Do not access GValues directly in your code. Instead, use the
43 * g_value_get_*() functions
44 */
45 #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
46 #define g_marshal_value_peek_char(v) (v)->data[0].v_int
47 #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
48 #define g_marshal_value_peek_int(v) (v)->data[0].v_int
49 #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
50 #define g_marshal_value_peek_long(v) (v)->data[0].v_long
51 #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
52 #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
53 #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
54 #define g_marshal_value_peek_enum(v) (v)->data[0].v_long
55 #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
56 #define g_marshal_value_peek_float(v) (v)->data[0].v_float
57 #define g_marshal_value_peek_double(v) (v)->data[0].v_double
58 #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
59 #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
60 #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
61 #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
62 #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
63 #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
64 #endif /* !G_ENABLE_DEBUG */
65
66 typedef struct
67 {
68 GDBusArgInfo parent_struct;
69 gboolean use_gvariant;
70 } _ExtendedGDBusArgInfo;
71
72 typedef struct
73 {
74 GDBusMethodInfo parent_struct;
75 const gchar *signal_name;
76 gboolean pass_fdlist;
77 } _ExtendedGDBusMethodInfo;
78
79 typedef struct
80 {
81 GDBusSignalInfo parent_struct;
82 const gchar *signal_name;
83 } _ExtendedGDBusSignalInfo;
84
85 typedef struct
86 {
87 GDBusPropertyInfo parent_struct;
88 const gchar *hyphen_name;
89 guint use_gvariant : 1;
90 guint emits_changed_signal : 1;
91 } _ExtendedGDBusPropertyInfo;
92
93 typedef struct
94 {
95 GDBusInterfaceInfo parent_struct;
96 const gchar *hyphen_name;
97 } _ExtendedGDBusInterfaceInfo;
98
99 typedef struct
100 {
101 const _ExtendedGDBusPropertyInfo *info;
102 guint prop_id;
103 GValue orig_value; /* the value before the change */
104 } ChangedProperty;
105
106 static void
_changed_property_free(ChangedProperty * data)107 _changed_property_free (ChangedProperty *data)
108 {
109 g_value_unset (&data->orig_value);
110 g_free (data);
111 }
112
113 static gboolean
_g_strv_equal0(gchar ** a,gchar ** b)114 _g_strv_equal0 (gchar **a, gchar **b)
115 {
116 gboolean ret = FALSE;
117 guint n;
118 if (a == NULL && b == NULL)
119 {
120 ret = TRUE;
121 goto out;
122 }
123 if (a == NULL || b == NULL)
124 goto out;
125 if (g_strv_length (a) != g_strv_length (b))
126 goto out;
127 for (n = 0; a[n] != NULL; n++)
128 if (g_strcmp0 (a[n], b[n]) != 0)
129 goto out;
130 ret = TRUE;
131 out:
132 return ret;
133 }
134
135 static gboolean
_g_variant_equal0(GVariant * a,GVariant * b)136 _g_variant_equal0 (GVariant *a, GVariant *b)
137 {
138 gboolean ret = FALSE;
139 if (a == NULL && b == NULL)
140 {
141 ret = TRUE;
142 goto out;
143 }
144 if (a == NULL || b == NULL)
145 goto out;
146 ret = g_variant_equal (a, b);
147 out:
148 return ret;
149 }
150
151 G_GNUC_UNUSED static gboolean
_g_value_equal(const GValue * a,const GValue * b)152 _g_value_equal (const GValue *a, const GValue *b)
153 {
154 gboolean ret = FALSE;
155 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
156 switch (G_VALUE_TYPE (a))
157 {
158 case G_TYPE_BOOLEAN:
159 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
160 break;
161 case G_TYPE_UCHAR:
162 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
163 break;
164 case G_TYPE_INT:
165 ret = (g_value_get_int (a) == g_value_get_int (b));
166 break;
167 case G_TYPE_UINT:
168 ret = (g_value_get_uint (a) == g_value_get_uint (b));
169 break;
170 case G_TYPE_INT64:
171 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
172 break;
173 case G_TYPE_UINT64:
174 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
175 break;
176 case G_TYPE_DOUBLE:
177 {
178 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
179 gdouble da = g_value_get_double (a);
180 gdouble db = g_value_get_double (b);
181 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
182 }
183 break;
184 case G_TYPE_STRING:
185 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
186 break;
187 case G_TYPE_VARIANT:
188 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
189 break;
190 default:
191 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
192 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
193 else
194 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
195 break;
196 }
197 return ret;
198 }
199
200 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)201 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT (
202 GClosure *closure,
203 GValue *return_value,
204 unsigned int n_param_values,
205 const GValue *param_values,
206 void *invocation_hint G_GNUC_UNUSED,
207 void *marshal_data)
208 {
209 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectIntFunc)
210 (void *data1,
211 GDBusMethodInvocation *arg_method_invocation,
212 gint arg_cooling_zone,
213 void *data2);
214 _GDbusCodegenMarshalBoolean_ObjectIntFunc callback;
215 GCClosure *cc = (GCClosure*) closure;
216 void *data1, *data2;
217 gboolean v_return;
218
219 g_return_if_fail (return_value != NULL);
220 g_return_if_fail (n_param_values == 3);
221
222 if (G_CCLOSURE_SWAP_DATA (closure))
223 {
224 data1 = closure->data;
225 data2 = g_value_peek_pointer (param_values + 0);
226 }
227 else
228 {
229 data1 = g_value_peek_pointer (param_values + 0);
230 data2 = closure->data;
231 }
232
233 callback = (_GDbusCodegenMarshalBoolean_ObjectIntFunc)
234 (marshal_data ? marshal_data : cc->callback);
235
236 v_return =
237 callback (data1,
238 g_marshal_value_peek_object (param_values + 1),
239 g_marshal_value_peek_int (param_values + 2),
240 data2);
241
242 g_value_set_boolean (return_value, v_return);
243 }
244
245 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)246 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (
247 GClosure *closure,
248 GValue *return_value,
249 unsigned int n_param_values,
250 const GValue *param_values,
251 void *invocation_hint G_GNUC_UNUSED,
252 void *marshal_data)
253 {
254 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectFunc)
255 (void *data1,
256 GDBusMethodInvocation *arg_method_invocation,
257 void *data2);
258 _GDbusCodegenMarshalBoolean_ObjectFunc callback;
259 GCClosure *cc = (GCClosure*) closure;
260 void *data1, *data2;
261 gboolean v_return;
262
263 g_return_if_fail (return_value != NULL);
264 g_return_if_fail (n_param_values == 2);
265
266 if (G_CCLOSURE_SWAP_DATA (closure))
267 {
268 data1 = closure->data;
269 data2 = g_value_peek_pointer (param_values + 0);
270 }
271 else
272 {
273 data1 = g_value_peek_pointer (param_values + 0);
274 data2 = closure->data;
275 }
276
277 callback = (_GDbusCodegenMarshalBoolean_ObjectFunc)
278 (marshal_data ? marshal_data : cc->callback);
279
280 v_return =
281 callback (data1,
282 g_marshal_value_peek_object (param_values + 1),
283 data2);
284
285 g_value_set_boolean (return_value, v_return);
286 }
287
288 static void
_g_dbus_codegen_marshal_VOID__VARIANT_STRING(GClosure * closure,GValue * return_value G_GNUC_UNUSED,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)289 _g_dbus_codegen_marshal_VOID__VARIANT_STRING (
290 GClosure *closure,
291 GValue *return_value G_GNUC_UNUSED,
292 unsigned int n_param_values,
293 const GValue *param_values,
294 void *invocation_hint G_GNUC_UNUSED,
295 void *marshal_data)
296 {
297 typedef void (*_GDbusCodegenMarshalVoid_VariantStringFunc)
298 (void *data1,
299 GVariant *arg_value,
300 const gchar *arg_units,
301 void *data2);
302 _GDbusCodegenMarshalVoid_VariantStringFunc callback;
303 GCClosure *cc = (GCClosure*) closure;
304 void *data1, *data2;
305
306 g_return_if_fail (n_param_values == 3);
307
308 if (G_CCLOSURE_SWAP_DATA (closure))
309 {
310 data1 = closure->data;
311 data2 = g_value_peek_pointer (param_values + 0);
312 }
313 else
314 {
315 data1 = g_value_peek_pointer (param_values + 0);
316 data2 = closure->data;
317 }
318
319 callback = (_GDbusCodegenMarshalVoid_VariantStringFunc)
320 (marshal_data ? marshal_data : cc->callback);
321
322 callback (data1,
323 g_marshal_value_peek_variant (param_values + 1),
324 g_marshal_value_peek_string (param_values + 2),
325 data2);
326 }
327
328 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)329 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (
330 GClosure *closure,
331 GValue *return_value,
332 unsigned int n_param_values,
333 const GValue *param_values,
334 void *invocation_hint G_GNUC_UNUSED,
335 void *marshal_data)
336 {
337 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectVariantFunc)
338 (void *data1,
339 GDBusMethodInvocation *arg_method_invocation,
340 GVariant *arg_value,
341 void *data2);
342 _GDbusCodegenMarshalBoolean_ObjectVariantFunc callback;
343 GCClosure *cc = (GCClosure*) closure;
344 void *data1, *data2;
345 gboolean v_return;
346
347 g_return_if_fail (return_value != NULL);
348 g_return_if_fail (n_param_values == 3);
349
350 if (G_CCLOSURE_SWAP_DATA (closure))
351 {
352 data1 = closure->data;
353 data2 = g_value_peek_pointer (param_values + 0);
354 }
355 else
356 {
357 data1 = g_value_peek_pointer (param_values + 0);
358 data2 = closure->data;
359 }
360
361 callback = (_GDbusCodegenMarshalBoolean_ObjectVariantFunc)
362 (marshal_data ? marshal_data : cc->callback);
363
364 v_return =
365 callback (data1,
366 g_marshal_value_peek_object (param_values + 1),
367 g_marshal_value_peek_variant (param_values + 2),
368 data2);
369
370 g_value_set_boolean (return_value, v_return);
371 }
372
373 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)374 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (
375 GClosure *closure,
376 GValue *return_value,
377 unsigned int n_param_values,
378 const GValue *param_values,
379 void *invocation_hint G_GNUC_UNUSED,
380 void *marshal_data)
381 {
382 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringFunc)
383 (void *data1,
384 GDBusMethodInvocation *arg_method_invocation,
385 const gchar *arg_name,
386 void *data2);
387 _GDbusCodegenMarshalBoolean_ObjectStringFunc callback;
388 GCClosure *cc = (GCClosure*) closure;
389 void *data1, *data2;
390 gboolean v_return;
391
392 g_return_if_fail (return_value != NULL);
393 g_return_if_fail (n_param_values == 3);
394
395 if (G_CCLOSURE_SWAP_DATA (closure))
396 {
397 data1 = closure->data;
398 data2 = g_value_peek_pointer (param_values + 0);
399 }
400 else
401 {
402 data1 = g_value_peek_pointer (param_values + 0);
403 data2 = closure->data;
404 }
405
406 callback = (_GDbusCodegenMarshalBoolean_ObjectStringFunc)
407 (marshal_data ? marshal_data : cc->callback);
408
409 v_return =
410 callback (data1,
411 g_marshal_value_peek_object (param_values + 1),
412 g_marshal_value_peek_string (param_values + 2),
413 data2);
414
415 g_value_set_boolean (return_value, v_return);
416 }
417
418 static void
_g_dbus_codegen_marshal_VOID__INT_STRING_INT(GClosure * closure,GValue * return_value G_GNUC_UNUSED,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)419 _g_dbus_codegen_marshal_VOID__INT_STRING_INT (
420 GClosure *closure,
421 GValue *return_value G_GNUC_UNUSED,
422 unsigned int n_param_values,
423 const GValue *param_values,
424 void *invocation_hint G_GNUC_UNUSED,
425 void *marshal_data)
426 {
427 typedef void (*_GDbusCodegenMarshalVoid_IntStringIntFunc)
428 (void *data1,
429 gint arg_priority,
430 const gchar *arg_message,
431 gint arg_rc,
432 void *data2);
433 _GDbusCodegenMarshalVoid_IntStringIntFunc callback;
434 GCClosure *cc = (GCClosure*) closure;
435 void *data1, *data2;
436
437 g_return_if_fail (n_param_values == 4);
438
439 if (G_CCLOSURE_SWAP_DATA (closure))
440 {
441 data1 = closure->data;
442 data2 = g_value_peek_pointer (param_values + 0);
443 }
444 else
445 {
446 data1 = g_value_peek_pointer (param_values + 0);
447 data2 = closure->data;
448 }
449
450 callback = (_GDbusCodegenMarshalVoid_IntStringIntFunc)
451 (marshal_data ? marshal_data : cc->callback);
452
453 callback (data1,
454 g_marshal_value_peek_int (param_values + 1),
455 g_marshal_value_peek_string (param_values + 2),
456 g_marshal_value_peek_int (param_values + 3),
457 data2);
458 }
459
460 static void
_g_dbus_codegen_marshal_VOID__STRING_STRING(GClosure * closure,GValue * return_value G_GNUC_UNUSED,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)461 _g_dbus_codegen_marshal_VOID__STRING_STRING (
462 GClosure *closure,
463 GValue *return_value G_GNUC_UNUSED,
464 unsigned int n_param_values,
465 const GValue *param_values,
466 void *invocation_hint G_GNUC_UNUSED,
467 void *marshal_data)
468 {
469 typedef void (*_GDbusCodegenMarshalVoid_StringStringFunc)
470 (void *data1,
471 const gchar *arg_url,
472 const gchar *arg_filename,
473 void *data2);
474 _GDbusCodegenMarshalVoid_StringStringFunc callback;
475 GCClosure *cc = (GCClosure*) closure;
476 void *data1, *data2;
477
478 g_return_if_fail (n_param_values == 3);
479
480 if (G_CCLOSURE_SWAP_DATA (closure))
481 {
482 data1 = closure->data;
483 data2 = g_value_peek_pointer (param_values + 0);
484 }
485 else
486 {
487 data1 = g_value_peek_pointer (param_values + 0);
488 data2 = closure->data;
489 }
490
491 callback = (_GDbusCodegenMarshalVoid_StringStringFunc)
492 (marshal_data ? marshal_data : cc->callback);
493
494 callback (data1,
495 g_marshal_value_peek_string (param_values + 1),
496 g_marshal_value_peek_string (param_values + 2),
497 data2);
498 }
499
500 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)501 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING (
502 GClosure *closure,
503 GValue *return_value,
504 unsigned int n_param_values,
505 const GValue *param_values,
506 void *invocation_hint G_GNUC_UNUSED,
507 void *marshal_data)
508 {
509 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringStringFunc)
510 (void *data1,
511 GDBusMethodInvocation *arg_method_invocation,
512 const gchar *arg_url,
513 const gchar *arg_filename,
514 void *data2);
515 _GDbusCodegenMarshalBoolean_ObjectStringStringFunc callback;
516 GCClosure *cc = (GCClosure*) closure;
517 void *data1, *data2;
518 gboolean v_return;
519
520 g_return_if_fail (return_value != NULL);
521 g_return_if_fail (n_param_values == 4);
522
523 if (G_CCLOSURE_SWAP_DATA (closure))
524 {
525 data1 = closure->data;
526 data2 = g_value_peek_pointer (param_values + 0);
527 }
528 else
529 {
530 data1 = g_value_peek_pointer (param_values + 0);
531 data2 = closure->data;
532 }
533
534 callback = (_GDbusCodegenMarshalBoolean_ObjectStringStringFunc)
535 (marshal_data ? marshal_data : cc->callback);
536
537 v_return =
538 callback (data1,
539 g_marshal_value_peek_object (param_values + 1),
540 g_marshal_value_peek_string (param_values + 2),
541 g_marshal_value_peek_string (param_values + 3),
542 data2);
543
544 g_value_set_boolean (return_value, v_return);
545 }
546
547 static void
_g_dbus_codegen_marshal_VOID__STRING_UCHAR(GClosure * closure,GValue * return_value G_GNUC_UNUSED,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)548 _g_dbus_codegen_marshal_VOID__STRING_UCHAR (
549 GClosure *closure,
550 GValue *return_value G_GNUC_UNUSED,
551 unsigned int n_param_values,
552 const GValue *param_values,
553 void *invocation_hint G_GNUC_UNUSED,
554 void *marshal_data)
555 {
556 typedef void (*_GDbusCodegenMarshalVoid_StringUcharFunc)
557 (void *data1,
558 const gchar *arg_filename,
559 guchar arg_progress,
560 void *data2);
561 _GDbusCodegenMarshalVoid_StringUcharFunc callback;
562 GCClosure *cc = (GCClosure*) closure;
563 void *data1, *data2;
564
565 g_return_if_fail (n_param_values == 3);
566
567 if (G_CCLOSURE_SWAP_DATA (closure))
568 {
569 data1 = closure->data;
570 data2 = g_value_peek_pointer (param_values + 0);
571 }
572 else
573 {
574 data1 = g_value_peek_pointer (param_values + 0);
575 data2 = closure->data;
576 }
577
578 callback = (_GDbusCodegenMarshalVoid_StringUcharFunc)
579 (marshal_data ? marshal_data : cc->callback);
580
581 callback (data1,
582 g_marshal_value_peek_string (param_values + 1),
583 g_marshal_value_peek_uchar (param_values + 2),
584 data2);
585 }
586
587 static void
_g_dbus_codegen_marshal_VOID__UCHAR_UCHAR_UCHAR_STRING(GClosure * closure,GValue * return_value G_GNUC_UNUSED,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)588 _g_dbus_codegen_marshal_VOID__UCHAR_UCHAR_UCHAR_STRING (
589 GClosure *closure,
590 GValue *return_value G_GNUC_UNUSED,
591 unsigned int n_param_values,
592 const GValue *param_values,
593 void *invocation_hint G_GNUC_UNUSED,
594 void *marshal_data)
595 {
596 typedef void (*_GDbusCodegenMarshalVoid_UcharUcharUcharStringFunc)
597 (void *data1,
598 guchar arg_seq,
599 guchar arg_netfn,
600 guchar arg_cmd,
601 const gchar *arg_data,
602 void *data2);
603 _GDbusCodegenMarshalVoid_UcharUcharUcharStringFunc callback;
604 GCClosure *cc = (GCClosure*) closure;
605 void *data1, *data2;
606
607 g_return_if_fail (n_param_values == 5);
608
609 if (G_CCLOSURE_SWAP_DATA (closure))
610 {
611 data1 = closure->data;
612 data2 = g_value_peek_pointer (param_values + 0);
613 }
614 else
615 {
616 data1 = g_value_peek_pointer (param_values + 0);
617 data2 = closure->data;
618 }
619
620 callback = (_GDbusCodegenMarshalVoid_UcharUcharUcharStringFunc)
621 (marshal_data ? marshal_data : cc->callback);
622
623 callback (data1,
624 g_marshal_value_peek_uchar (param_values + 1),
625 g_marshal_value_peek_uchar (param_values + 2),
626 g_marshal_value_peek_uchar (param_values + 3),
627 g_marshal_value_peek_string (param_values + 4),
628 data2);
629 }
630
631 static void
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_UCHAR_UCHAR_UCHAR_STRING(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint G_GNUC_UNUSED,void * marshal_data)632 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_UCHAR_UCHAR_UCHAR_STRING (
633 GClosure *closure,
634 GValue *return_value,
635 unsigned int n_param_values,
636 const GValue *param_values,
637 void *invocation_hint G_GNUC_UNUSED,
638 void *marshal_data)
639 {
640 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectUcharUcharUcharStringFunc)
641 (void *data1,
642 GDBusMethodInvocation *arg_method_invocation,
643 guchar arg_seq,
644 guchar arg_netfn,
645 guchar arg_cmd,
646 const gchar *arg_data,
647 void *data2);
648 _GDbusCodegenMarshalBoolean_ObjectUcharUcharUcharStringFunc callback;
649 GCClosure *cc = (GCClosure*) closure;
650 void *data1, *data2;
651 gboolean v_return;
652
653 g_return_if_fail (return_value != NULL);
654 g_return_if_fail (n_param_values == 6);
655
656 if (G_CCLOSURE_SWAP_DATA (closure))
657 {
658 data1 = closure->data;
659 data2 = g_value_peek_pointer (param_values + 0);
660 }
661 else
662 {
663 data1 = g_value_peek_pointer (param_values + 0);
664 data2 = closure->data;
665 }
666
667 callback = (_GDbusCodegenMarshalBoolean_ObjectUcharUcharUcharStringFunc)
668 (marshal_data ? marshal_data : cc->callback);
669
670 v_return =
671 callback (data1,
672 g_marshal_value_peek_object (param_values + 1),
673 g_marshal_value_peek_uchar (param_values + 2),
674 g_marshal_value_peek_uchar (param_values + 3),
675 g_marshal_value_peek_uchar (param_values + 4),
676 g_marshal_value_peek_string (param_values + 5),
677 data2);
678
679 g_value_set_boolean (return_value, v_return);
680 }
681
682 /* ------------------------------------------------------------------------
683 * Code for interface org.openbmc.Hwmon
684 * ------------------------------------------------------------------------
685 */
686
687 /**
688 * SECTION:Hwmon
689 * @title: Hwmon
690 * @short_description: Generated C code for the org.openbmc.Hwmon D-Bus interface
691 *
692 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface in C.
693 */
694
695 /* ---- Introspection data for org.openbmc.Hwmon ---- */
696
697 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_poll_interval =
698 {
699 {
700 -1,
701 (gchar *) "poll_interval",
702 (gchar *) "i",
703 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
704 NULL
705 },
706 "poll-interval",
707 FALSE,
708 TRUE
709 };
710
711 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_sysfs_path =
712 {
713 {
714 -1,
715 (gchar *) "sysfs_path",
716 (gchar *) "s",
717 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
718 NULL
719 },
720 "sysfs-path",
721 FALSE,
722 TRUE
723 };
724
725 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_scale =
726 {
727 {
728 -1,
729 (gchar *) "scale",
730 (gchar *) "i",
731 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
732 NULL
733 },
734 "scale",
735 FALSE,
736 TRUE
737 };
738
739 static const GDBusPropertyInfo * const _hwmon_property_info_pointers[] =
740 {
741 &_hwmon_property_info_poll_interval.parent_struct,
742 &_hwmon_property_info_sysfs_path.parent_struct,
743 &_hwmon_property_info_scale.parent_struct,
744 NULL
745 };
746
747 static const _ExtendedGDBusInterfaceInfo _hwmon_interface_info =
748 {
749 {
750 -1,
751 (gchar *) "org.openbmc.Hwmon",
752 NULL,
753 NULL,
754 (GDBusPropertyInfo **) &_hwmon_property_info_pointers,
755 NULL
756 },
757 "hwmon",
758 };
759
760
761 /**
762 * hwmon_interface_info:
763 *
764 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface.
765 *
766 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
767 */
768 GDBusInterfaceInfo *
hwmon_interface_info(void)769 hwmon_interface_info (void)
770 {
771 return (GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct;
772 }
773
774 /**
775 * hwmon_override_properties:
776 * @klass: The class structure for a #GObject derived class.
777 * @property_id_begin: The property id to assign to the first overridden property.
778 *
779 * Overrides all #GObject properties in the #Hwmon interface for a concrete class.
780 * The properties are overridden in the order they are defined.
781 *
782 * Returns: The last property id.
783 */
784 guint
hwmon_override_properties(GObjectClass * klass,guint property_id_begin)785 hwmon_override_properties (GObjectClass *klass, guint property_id_begin)
786 {
787 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
788 g_object_class_override_property (klass, property_id_begin++, "sysfs-path");
789 g_object_class_override_property (klass, property_id_begin++, "scale");
790 return property_id_begin - 1;
791 }
792
793
794
795 /**
796 * Hwmon:
797 *
798 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
799 */
800
801 /**
802 * HwmonIface:
803 * @parent_iface: The parent interface.
804 * @get_poll_interval: Getter for the #Hwmon:poll-interval property.
805 * @get_scale: Getter for the #Hwmon:scale property.
806 * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property.
807 *
808 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
809 */
810
811 typedef HwmonIface HwmonInterface;
G_DEFINE_INTERFACE(Hwmon,hwmon,G_TYPE_OBJECT)812 G_DEFINE_INTERFACE (Hwmon, hwmon, G_TYPE_OBJECT)
813
814 static void
815 hwmon_default_init (HwmonIface *iface)
816 {
817 /* GObject properties for D-Bus properties: */
818 /**
819 * Hwmon:poll-interval:
820 *
821 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link>.
822 *
823 * 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.
824 */
825 g_object_interface_install_property (iface,
826 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
827 /**
828 * Hwmon:sysfs-path:
829 *
830 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link>.
831 *
832 * 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.
833 */
834 g_object_interface_install_property (iface,
835 g_param_spec_string ("sysfs-path", "sysfs_path", "sysfs_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
836 /**
837 * Hwmon:scale:
838 *
839 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link>.
840 *
841 * 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.
842 */
843 g_object_interface_install_property (iface,
844 g_param_spec_int ("scale", "scale", "scale", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
845 }
846
847 /**
848 * hwmon_get_poll_interval: (skip)
849 * @object: A #Hwmon.
850 *
851 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property.
852 *
853 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
854 *
855 * Returns: The property value.
856 */
857 gint
hwmon_get_poll_interval(Hwmon * object)858 hwmon_get_poll_interval (Hwmon *object)
859 {
860 g_return_val_if_fail (IS_HWMON (object), 0);
861
862 return HWMON_GET_IFACE (object)->get_poll_interval (object);
863 }
864
865 /**
866 * hwmon_set_poll_interval: (skip)
867 * @object: A #Hwmon.
868 * @value: The value to set.
869 *
870 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property to @value.
871 *
872 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
873 */
874 void
hwmon_set_poll_interval(Hwmon * object,gint value)875 hwmon_set_poll_interval (Hwmon *object, gint value)
876 {
877 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
878 }
879
880 /**
881 * hwmon_get_sysfs_path: (skip)
882 * @object: A #Hwmon.
883 *
884 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
885 *
886 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
887 *
888 * 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 hwmon_dup_sysfs_path() if on another thread.
889 *
890 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
891 */
892 const gchar *
hwmon_get_sysfs_path(Hwmon * object)893 hwmon_get_sysfs_path (Hwmon *object)
894 {
895 g_return_val_if_fail (IS_HWMON (object), NULL);
896
897 return HWMON_GET_IFACE (object)->get_sysfs_path (object);
898 }
899
900 /**
901 * hwmon_dup_sysfs_path: (skip)
902 * @object: A #Hwmon.
903 *
904 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
905 *
906 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
907 *
908 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
909 */
910 gchar *
hwmon_dup_sysfs_path(Hwmon * object)911 hwmon_dup_sysfs_path (Hwmon *object)
912 {
913 gchar *value;
914 g_object_get (G_OBJECT (object), "sysfs-path", &value, NULL);
915 return value;
916 }
917
918 /**
919 * hwmon_set_sysfs_path: (skip)
920 * @object: A #Hwmon.
921 * @value: The value to set.
922 *
923 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property to @value.
924 *
925 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
926 */
927 void
hwmon_set_sysfs_path(Hwmon * object,const gchar * value)928 hwmon_set_sysfs_path (Hwmon *object, const gchar *value)
929 {
930 g_object_set (G_OBJECT (object), "sysfs-path", value, NULL);
931 }
932
933 /**
934 * hwmon_get_scale: (skip)
935 * @object: A #Hwmon.
936 *
937 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property.
938 *
939 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
940 *
941 * Returns: The property value.
942 */
943 gint
hwmon_get_scale(Hwmon * object)944 hwmon_get_scale (Hwmon *object)
945 {
946 g_return_val_if_fail (IS_HWMON (object), 0);
947
948 return HWMON_GET_IFACE (object)->get_scale (object);
949 }
950
951 /**
952 * hwmon_set_scale: (skip)
953 * @object: A #Hwmon.
954 * @value: The value to set.
955 *
956 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property to @value.
957 *
958 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
959 */
960 void
hwmon_set_scale(Hwmon * object,gint value)961 hwmon_set_scale (Hwmon *object, gint value)
962 {
963 g_object_set (G_OBJECT (object), "scale", value, NULL);
964 }
965
966 /* ------------------------------------------------------------------------ */
967
968 /**
969 * HwmonProxy:
970 *
971 * The #HwmonProxy structure contains only private data and should only be accessed using the provided API.
972 */
973
974 /**
975 * HwmonProxyClass:
976 * @parent_class: The parent class.
977 *
978 * Class structure for #HwmonProxy.
979 */
980
981 struct _HwmonProxyPrivate
982 {
983 GData *qdata;
984 };
985
986 static void hwmon_proxy_iface_init (HwmonIface *iface);
987
988 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(HwmonProxy,hwmon_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (HwmonProxy)G_IMPLEMENT_INTERFACE (TYPE_HWMON,hwmon_proxy_iface_init))989 G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
990 G_ADD_PRIVATE (HwmonProxy)
991 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init))
992
993 #else
994 G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
995 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init))
996
997 #endif
998 static void
999 hwmon_proxy_finalize (GObject *object)
1000 {
1001 HwmonProxy *proxy = HWMON_PROXY (object);
1002 g_datalist_clear (&proxy->priv->qdata);
1003 G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object);
1004 }
1005
1006 static void
hwmon_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)1007 hwmon_proxy_get_property (GObject *object,
1008 guint prop_id,
1009 GValue *value,
1010 GParamSpec *pspec G_GNUC_UNUSED)
1011 {
1012 const _ExtendedGDBusPropertyInfo *info;
1013 GVariant *variant;
1014 g_assert (prop_id != 0 && prop_id - 1 < 3);
1015 info = (const _ExtendedGDBusPropertyInfo *) _hwmon_property_info_pointers[prop_id - 1];
1016 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1017 if (info->use_gvariant)
1018 {
1019 g_value_set_variant (value, variant);
1020 }
1021 else
1022 {
1023 if (variant != NULL)
1024 g_dbus_gvariant_to_gvalue (variant, value);
1025 }
1026 if (variant != NULL)
1027 g_variant_unref (variant);
1028 }
1029
1030 static void
hwmon_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)1031 hwmon_proxy_set_property_cb (GDBusProxy *proxy,
1032 GAsyncResult *res,
1033 gpointer user_data)
1034 {
1035 const _ExtendedGDBusPropertyInfo *info = user_data;
1036 GError *error;
1037 GVariant *_ret;
1038 error = NULL;
1039 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1040 if (!_ret)
1041 {
1042 g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)",
1043 info->parent_struct.name,
1044 error->message, g_quark_to_string (error->domain), error->code);
1045 g_error_free (error);
1046 }
1047 else
1048 {
1049 g_variant_unref (_ret);
1050 }
1051 }
1052
1053 static void
hwmon_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)1054 hwmon_proxy_set_property (GObject *object,
1055 guint prop_id,
1056 const GValue *value,
1057 GParamSpec *pspec G_GNUC_UNUSED)
1058 {
1059 const _ExtendedGDBusPropertyInfo *info;
1060 GVariant *variant;
1061 g_assert (prop_id != 0 && prop_id - 1 < 3);
1062 info = (const _ExtendedGDBusPropertyInfo *) _hwmon_property_info_pointers[prop_id - 1];
1063 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1064 g_dbus_proxy_call (G_DBUS_PROXY (object),
1065 "org.freedesktop.DBus.Properties.Set",
1066 g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant),
1067 G_DBUS_CALL_FLAGS_NONE,
1068 -1,
1069 NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1070 g_variant_unref (variant);
1071 }
1072
1073 static void
hwmon_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)1074 hwmon_proxy_g_signal (GDBusProxy *proxy,
1075 const gchar *sender_name G_GNUC_UNUSED,
1076 const gchar *signal_name,
1077 GVariant *parameters)
1078 {
1079 _ExtendedGDBusSignalInfo *info;
1080 GVariantIter iter;
1081 GVariant *child;
1082 GValue *paramv;
1083 gsize num_params;
1084 gsize n;
1085 guint signal_id;
1086 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name);
1087 if (info == NULL)
1088 return;
1089 num_params = g_variant_n_children (parameters);
1090 paramv = g_new0 (GValue, num_params + 1);
1091 g_value_init (¶mv[0], TYPE_HWMON);
1092 g_value_set_object (¶mv[0], proxy);
1093 g_variant_iter_init (&iter, parameters);
1094 n = 1;
1095 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1096 {
1097 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1098 if (arg_info->use_gvariant)
1099 {
1100 g_value_init (¶mv[n], G_TYPE_VARIANT);
1101 g_value_set_variant (¶mv[n], child);
1102 n++;
1103 }
1104 else
1105 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1106 g_variant_unref (child);
1107 }
1108 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1109 g_signal_emitv (paramv, signal_id, 0, NULL);
1110 for (n = 0; n < num_params + 1; n++)
1111 g_value_unset (¶mv[n]);
1112 g_free (paramv);
1113 }
1114
1115 static void
hwmon_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)1116 hwmon_proxy_g_properties_changed (GDBusProxy *_proxy,
1117 GVariant *changed_properties,
1118 const gchar *const *invalidated_properties)
1119 {
1120 HwmonProxy *proxy = HWMON_PROXY (_proxy);
1121 guint n;
1122 const gchar *key;
1123 GVariantIter *iter;
1124 _ExtendedGDBusPropertyInfo *info;
1125 g_variant_get (changed_properties, "a{sv}", &iter);
1126 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1127 {
1128 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key);
1129 g_datalist_remove_data (&proxy->priv->qdata, key);
1130 if (info != NULL)
1131 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1132 }
1133 g_variant_iter_free (iter);
1134 for (n = 0; invalidated_properties[n] != NULL; n++)
1135 {
1136 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]);
1137 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1138 if (info != NULL)
1139 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1140 }
1141 }
1142
1143 static gint
hwmon_proxy_get_poll_interval(Hwmon * object)1144 hwmon_proxy_get_poll_interval (Hwmon *object)
1145 {
1146 HwmonProxy *proxy = HWMON_PROXY (object);
1147 GVariant *variant;
1148 gint value = 0;
1149 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1150 if (variant != NULL)
1151 {
1152 value = g_variant_get_int32 (variant);
1153 g_variant_unref (variant);
1154 }
1155 return value;
1156 }
1157
1158 static const gchar *
hwmon_proxy_get_sysfs_path(Hwmon * object)1159 hwmon_proxy_get_sysfs_path (Hwmon *object)
1160 {
1161 HwmonProxy *proxy = HWMON_PROXY (object);
1162 GVariant *variant;
1163 const gchar *value = NULL;
1164 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path");
1165 if (variant != NULL)
1166 {
1167 value = g_variant_get_string (variant, NULL);
1168 g_variant_unref (variant);
1169 }
1170 return value;
1171 }
1172
1173 static gint
hwmon_proxy_get_scale(Hwmon * object)1174 hwmon_proxy_get_scale (Hwmon *object)
1175 {
1176 HwmonProxy *proxy = HWMON_PROXY (object);
1177 GVariant *variant;
1178 gint value = 0;
1179 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "scale");
1180 if (variant != NULL)
1181 {
1182 value = g_variant_get_int32 (variant);
1183 g_variant_unref (variant);
1184 }
1185 return value;
1186 }
1187
1188 static void
hwmon_proxy_init(HwmonProxy * proxy)1189 hwmon_proxy_init (HwmonProxy *proxy)
1190 {
1191 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1192 proxy->priv = hwmon_proxy_get_instance_private (proxy);
1193 #else
1194 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate);
1195 #endif
1196
1197 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ());
1198 }
1199
1200 static void
hwmon_proxy_class_init(HwmonProxyClass * klass)1201 hwmon_proxy_class_init (HwmonProxyClass *klass)
1202 {
1203 GObjectClass *gobject_class;
1204 GDBusProxyClass *proxy_class;
1205
1206 gobject_class = G_OBJECT_CLASS (klass);
1207 gobject_class->finalize = hwmon_proxy_finalize;
1208 gobject_class->get_property = hwmon_proxy_get_property;
1209 gobject_class->set_property = hwmon_proxy_set_property;
1210
1211 proxy_class = G_DBUS_PROXY_CLASS (klass);
1212 proxy_class->g_signal = hwmon_proxy_g_signal;
1213 proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed;
1214
1215 hwmon_override_properties (gobject_class, 1);
1216
1217 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1218 g_type_class_add_private (klass, sizeof (HwmonProxyPrivate));
1219 #endif
1220 }
1221
1222 static void
hwmon_proxy_iface_init(HwmonIface * iface)1223 hwmon_proxy_iface_init (HwmonIface *iface)
1224 {
1225 iface->get_poll_interval = hwmon_proxy_get_poll_interval;
1226 iface->get_sysfs_path = hwmon_proxy_get_sysfs_path;
1227 iface->get_scale = hwmon_proxy_get_scale;
1228 }
1229
1230 /**
1231 * hwmon_proxy_new:
1232 * @connection: A #GDBusConnection.
1233 * @flags: Flags from the #GDBusProxyFlags enumeration.
1234 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1235 * @object_path: An object path.
1236 * @cancellable: (nullable): A #GCancellable or %NULL.
1237 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1238 * @user_data: User data to pass to @callback.
1239 *
1240 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new() for more details.
1241 *
1242 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1243 * You can then call hwmon_proxy_new_finish() to get the result of the operation.
1244 *
1245 * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor.
1246 */
1247 void
hwmon_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1248 hwmon_proxy_new (
1249 GDBusConnection *connection,
1250 GDBusProxyFlags flags,
1251 const gchar *name,
1252 const gchar *object_path,
1253 GCancellable *cancellable,
1254 GAsyncReadyCallback callback,
1255 gpointer user_data)
1256 {
1257 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL);
1258 }
1259
1260 /**
1261 * hwmon_proxy_new_finish:
1262 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new().
1263 * @error: Return location for error or %NULL
1264 *
1265 * Finishes an operation started with hwmon_proxy_new().
1266 *
1267 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1268 */
1269 Hwmon *
hwmon_proxy_new_finish(GAsyncResult * res,GError ** error)1270 hwmon_proxy_new_finish (
1271 GAsyncResult *res,
1272 GError **error)
1273 {
1274 GObject *ret;
1275 GObject *source_object;
1276 source_object = g_async_result_get_source_object (res);
1277 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1278 g_object_unref (source_object);
1279 if (ret != NULL)
1280 return HWMON (ret);
1281 else
1282 return NULL;
1283 }
1284
1285 /**
1286 * hwmon_proxy_new_sync:
1287 * @connection: A #GDBusConnection.
1288 * @flags: Flags from the #GDBusProxyFlags enumeration.
1289 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1290 * @object_path: An object path.
1291 * @cancellable: (nullable): A #GCancellable or %NULL.
1292 * @error: Return location for error or %NULL
1293 *
1294 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new_sync() for more details.
1295 *
1296 * The calling thread is blocked until a reply is received.
1297 *
1298 * See hwmon_proxy_new() for the asynchronous version of this constructor.
1299 *
1300 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1301 */
1302 Hwmon *
hwmon_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)1303 hwmon_proxy_new_sync (
1304 GDBusConnection *connection,
1305 GDBusProxyFlags flags,
1306 const gchar *name,
1307 const gchar *object_path,
1308 GCancellable *cancellable,
1309 GError **error)
1310 {
1311 GInitable *ret;
1312 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL);
1313 if (ret != NULL)
1314 return HWMON (ret);
1315 else
1316 return NULL;
1317 }
1318
1319
1320 /**
1321 * hwmon_proxy_new_for_bus:
1322 * @bus_type: A #GBusType.
1323 * @flags: Flags from the #GDBusProxyFlags enumeration.
1324 * @name: A bus name (well-known or unique).
1325 * @object_path: An object path.
1326 * @cancellable: (nullable): A #GCancellable or %NULL.
1327 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1328 * @user_data: User data to pass to @callback.
1329 *
1330 * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1331 *
1332 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1333 * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation.
1334 *
1335 * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1336 */
1337 void
hwmon_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1338 hwmon_proxy_new_for_bus (
1339 GBusType bus_type,
1340 GDBusProxyFlags flags,
1341 const gchar *name,
1342 const gchar *object_path,
1343 GCancellable *cancellable,
1344 GAsyncReadyCallback callback,
1345 gpointer user_data)
1346 {
1347 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL);
1348 }
1349
1350 /**
1351 * hwmon_proxy_new_for_bus_finish:
1352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus().
1353 * @error: Return location for error or %NULL
1354 *
1355 * Finishes an operation started with hwmon_proxy_new_for_bus().
1356 *
1357 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1358 */
1359 Hwmon *
hwmon_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)1360 hwmon_proxy_new_for_bus_finish (
1361 GAsyncResult *res,
1362 GError **error)
1363 {
1364 GObject *ret;
1365 GObject *source_object;
1366 source_object = g_async_result_get_source_object (res);
1367 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1368 g_object_unref (source_object);
1369 if (ret != NULL)
1370 return HWMON (ret);
1371 else
1372 return NULL;
1373 }
1374
1375 /**
1376 * hwmon_proxy_new_for_bus_sync:
1377 * @bus_type: A #GBusType.
1378 * @flags: Flags from the #GDBusProxyFlags enumeration.
1379 * @name: A bus name (well-known or unique).
1380 * @object_path: An object path.
1381 * @cancellable: (nullable): A #GCancellable or %NULL.
1382 * @error: Return location for error or %NULL
1383 *
1384 * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1385 *
1386 * The calling thread is blocked until a reply is received.
1387 *
1388 * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor.
1389 *
1390 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1391 */
1392 Hwmon *
hwmon_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)1393 hwmon_proxy_new_for_bus_sync (
1394 GBusType bus_type,
1395 GDBusProxyFlags flags,
1396 const gchar *name,
1397 const gchar *object_path,
1398 GCancellable *cancellable,
1399 GError **error)
1400 {
1401 GInitable *ret;
1402 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL);
1403 if (ret != NULL)
1404 return HWMON (ret);
1405 else
1406 return NULL;
1407 }
1408
1409
1410 /* ------------------------------------------------------------------------ */
1411
1412 /**
1413 * HwmonSkeleton:
1414 *
1415 * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API.
1416 */
1417
1418 /**
1419 * HwmonSkeletonClass:
1420 * @parent_class: The parent class.
1421 *
1422 * Class structure for #HwmonSkeleton.
1423 */
1424
1425 struct _HwmonSkeletonPrivate
1426 {
1427 GValue *properties;
1428 GList *changed_properties;
1429 GSource *changed_properties_idle_source;
1430 GMainContext *context;
1431 GMutex lock;
1432 };
1433
1434 static void
_hwmon_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)1435 _hwmon_skeleton_handle_method_call (
1436 GDBusConnection *connection G_GNUC_UNUSED,
1437 const gchar *sender G_GNUC_UNUSED,
1438 const gchar *object_path G_GNUC_UNUSED,
1439 const gchar *interface_name,
1440 const gchar *method_name,
1441 GVariant *parameters,
1442 GDBusMethodInvocation *invocation,
1443 gpointer user_data)
1444 {
1445 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1446 _ExtendedGDBusMethodInfo *info;
1447 GVariantIter iter;
1448 GVariant *child;
1449 GValue *paramv;
1450 gsize num_params;
1451 guint num_extra;
1452 gsize n;
1453 guint signal_id;
1454 GValue return_value = G_VALUE_INIT;
1455 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1456 g_assert (info != NULL);
1457 num_params = g_variant_n_children (parameters);
1458 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1459 n = 0;
1460 g_value_init (¶mv[n], TYPE_HWMON);
1461 g_value_set_object (¶mv[n++], skeleton);
1462 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1463 g_value_set_object (¶mv[n++], invocation);
1464 if (info->pass_fdlist)
1465 {
1466 #ifdef G_OS_UNIX
1467 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1468 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1469 #else
1470 g_assert_not_reached ();
1471 #endif
1472 }
1473 g_variant_iter_init (&iter, parameters);
1474 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1475 {
1476 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1477 if (arg_info->use_gvariant)
1478 {
1479 g_value_init (¶mv[n], G_TYPE_VARIANT);
1480 g_value_set_variant (¶mv[n], child);
1481 n++;
1482 }
1483 else
1484 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1485 g_variant_unref (child);
1486 }
1487 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1488 g_value_init (&return_value, G_TYPE_BOOLEAN);
1489 g_signal_emitv (paramv, signal_id, 0, &return_value);
1490 if (!g_value_get_boolean (&return_value))
1491 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);
1492 g_value_unset (&return_value);
1493 for (n = 0; n < num_params + num_extra; n++)
1494 g_value_unset (¶mv[n]);
1495 g_free (paramv);
1496 }
1497
1498 static GVariant *
_hwmon_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)1499 _hwmon_skeleton_handle_get_property (
1500 GDBusConnection *connection G_GNUC_UNUSED,
1501 const gchar *sender G_GNUC_UNUSED,
1502 const gchar *object_path G_GNUC_UNUSED,
1503 const gchar *interface_name G_GNUC_UNUSED,
1504 const gchar *property_name,
1505 GError **error,
1506 gpointer user_data)
1507 {
1508 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1509 GValue value = G_VALUE_INIT;
1510 GParamSpec *pspec;
1511 _ExtendedGDBusPropertyInfo *info;
1512 GVariant *ret;
1513 ret = NULL;
1514 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1515 g_assert (info != NULL);
1516 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1517 if (pspec == NULL)
1518 {
1519 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1520 }
1521 else
1522 {
1523 g_value_init (&value, pspec->value_type);
1524 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1525 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1526 g_value_unset (&value);
1527 }
1528 return ret;
1529 }
1530
1531 static gboolean
_hwmon_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)1532 _hwmon_skeleton_handle_set_property (
1533 GDBusConnection *connection G_GNUC_UNUSED,
1534 const gchar *sender G_GNUC_UNUSED,
1535 const gchar *object_path G_GNUC_UNUSED,
1536 const gchar *interface_name G_GNUC_UNUSED,
1537 const gchar *property_name,
1538 GVariant *variant,
1539 GError **error,
1540 gpointer user_data)
1541 {
1542 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1543 GValue value = G_VALUE_INIT;
1544 GParamSpec *pspec;
1545 _ExtendedGDBusPropertyInfo *info;
1546 gboolean ret;
1547 ret = FALSE;
1548 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1549 g_assert (info != NULL);
1550 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1551 if (pspec == NULL)
1552 {
1553 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1554 }
1555 else
1556 {
1557 if (info->use_gvariant)
1558 g_value_set_variant (&value, variant);
1559 else
1560 g_dbus_gvariant_to_gvalue (variant, &value);
1561 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1562 g_value_unset (&value);
1563 ret = TRUE;
1564 }
1565 return ret;
1566 }
1567
1568 static const GDBusInterfaceVTable _hwmon_skeleton_vtable =
1569 {
1570 _hwmon_skeleton_handle_method_call,
1571 _hwmon_skeleton_handle_get_property,
1572 _hwmon_skeleton_handle_set_property,
1573 {NULL}
1574 };
1575
1576 static GDBusInterfaceInfo *
hwmon_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1577 hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1578 {
1579 return hwmon_interface_info ();
1580 }
1581
1582 static GDBusInterfaceVTable *
hwmon_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1583 hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1584 {
1585 return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable;
1586 }
1587
1588 static GVariant *
hwmon_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)1589 hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1590 {
1591 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1592
1593 GVariantBuilder builder;
1594 guint n;
1595 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1596 if (_hwmon_interface_info.parent_struct.properties == NULL)
1597 goto out;
1598 for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++)
1599 {
1600 GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n];
1601 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1602 {
1603 GVariant *value;
1604 value = _hwmon_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.Hwmon", info->name, NULL, skeleton);
1605 if (value != NULL)
1606 {
1607 g_variant_take_ref (value);
1608 g_variant_builder_add (&builder, "{sv}", info->name, value);
1609 g_variant_unref (value);
1610 }
1611 }
1612 }
1613 out:
1614 return g_variant_builder_end (&builder);
1615 }
1616
1617 static gboolean _hwmon_emit_changed (gpointer user_data);
1618
1619 static void
hwmon_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)1620 hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1621 {
1622 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1623 gboolean emit_changed = FALSE;
1624
1625 g_mutex_lock (&skeleton->priv->lock);
1626 if (skeleton->priv->changed_properties_idle_source != NULL)
1627 {
1628 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1629 skeleton->priv->changed_properties_idle_source = NULL;
1630 emit_changed = TRUE;
1631 }
1632 g_mutex_unlock (&skeleton->priv->lock);
1633
1634 if (emit_changed)
1635 _hwmon_emit_changed (skeleton);
1636 }
1637
1638 static void hwmon_skeleton_iface_init (HwmonIface *iface);
1639 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(HwmonSkeleton,hwmon_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (HwmonSkeleton)G_IMPLEMENT_INTERFACE (TYPE_HWMON,hwmon_skeleton_iface_init))1640 G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1641 G_ADD_PRIVATE (HwmonSkeleton)
1642 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init))
1643
1644 #else
1645 G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1646 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init))
1647
1648 #endif
1649 static void
1650 hwmon_skeleton_finalize (GObject *object)
1651 {
1652 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1653 guint n;
1654 for (n = 0; n < 3; n++)
1655 g_value_unset (&skeleton->priv->properties[n]);
1656 g_free (skeleton->priv->properties);
1657 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1658 if (skeleton->priv->changed_properties_idle_source != NULL)
1659 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1660 g_main_context_unref (skeleton->priv->context);
1661 g_mutex_clear (&skeleton->priv->lock);
1662 G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object);
1663 }
1664
1665 static void
hwmon_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)1666 hwmon_skeleton_get_property (GObject *object,
1667 guint prop_id,
1668 GValue *value,
1669 GParamSpec *pspec G_GNUC_UNUSED)
1670 {
1671 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1672 g_assert (prop_id != 0 && prop_id - 1 < 3);
1673 g_mutex_lock (&skeleton->priv->lock);
1674 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1675 g_mutex_unlock (&skeleton->priv->lock);
1676 }
1677
1678 static gboolean
_hwmon_emit_changed(gpointer user_data)1679 _hwmon_emit_changed (gpointer user_data)
1680 {
1681 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1682 GList *l;
1683 GVariantBuilder builder;
1684 GVariantBuilder invalidated_builder;
1685 guint num_changes;
1686
1687 g_mutex_lock (&skeleton->priv->lock);
1688 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1689 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1690 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1691 {
1692 ChangedProperty *cp = l->data;
1693 GVariant *variant;
1694 const GValue *cur_value;
1695
1696 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1697 if (!_g_value_equal (cur_value, &cp->orig_value))
1698 {
1699 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1700 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1701 g_variant_unref (variant);
1702 num_changes++;
1703 }
1704 }
1705 if (num_changes > 0)
1706 {
1707 GList *connections, *ll;
1708 GVariant *signal_variant;
1709 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon",
1710 &builder, &invalidated_builder));
1711 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1712 for (ll = connections; ll != NULL; ll = ll->next)
1713 {
1714 GDBusConnection *connection = ll->data;
1715
1716 g_dbus_connection_emit_signal (connection,
1717 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1718 "org.freedesktop.DBus.Properties",
1719 "PropertiesChanged",
1720 signal_variant,
1721 NULL);
1722 }
1723 g_variant_unref (signal_variant);
1724 g_list_free_full (connections, g_object_unref);
1725 }
1726 else
1727 {
1728 g_variant_builder_clear (&builder);
1729 g_variant_builder_clear (&invalidated_builder);
1730 }
1731 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1732 skeleton->priv->changed_properties = NULL;
1733 skeleton->priv->changed_properties_idle_source = NULL;
1734 g_mutex_unlock (&skeleton->priv->lock);
1735 return FALSE;
1736 }
1737
1738 static void
_hwmon_schedule_emit_changed(HwmonSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)1739 _hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1740 {
1741 ChangedProperty *cp;
1742 GList *l;
1743 cp = NULL;
1744 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1745 {
1746 ChangedProperty *i_cp = l->data;
1747 if (i_cp->info == info)
1748 {
1749 cp = i_cp;
1750 break;
1751 }
1752 }
1753 if (cp == NULL)
1754 {
1755 cp = g_new0 (ChangedProperty, 1);
1756 cp->prop_id = prop_id;
1757 cp->info = info;
1758 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1759 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1760 g_value_copy (orig_value, &cp->orig_value);
1761 }
1762 }
1763
1764 static void
hwmon_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)1765 hwmon_skeleton_notify (GObject *object,
1766 GParamSpec *pspec G_GNUC_UNUSED)
1767 {
1768 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1769 g_mutex_lock (&skeleton->priv->lock);
1770 if (skeleton->priv->changed_properties != NULL &&
1771 skeleton->priv->changed_properties_idle_source == NULL)
1772 {
1773 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1774 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1775 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1776 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _hwmon_emit_changed");
1777 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1778 g_source_unref (skeleton->priv->changed_properties_idle_source);
1779 }
1780 g_mutex_unlock (&skeleton->priv->lock);
1781 }
1782
1783 static void
hwmon_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)1784 hwmon_skeleton_set_property (GObject *object,
1785 guint prop_id,
1786 const GValue *value,
1787 GParamSpec *pspec)
1788 {
1789 const _ExtendedGDBusPropertyInfo *info;
1790 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1791 g_assert (prop_id != 0 && prop_id - 1 < 3);
1792 info = (const _ExtendedGDBusPropertyInfo *) _hwmon_property_info_pointers[prop_id - 1];
1793 g_mutex_lock (&skeleton->priv->lock);
1794 g_object_freeze_notify (object);
1795 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1796 {
1797 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
1798 info->emits_changed_signal)
1799 _hwmon_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
1800 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1801 g_object_notify_by_pspec (object, pspec);
1802 }
1803 g_mutex_unlock (&skeleton->priv->lock);
1804 g_object_thaw_notify (object);
1805 }
1806
1807 static void
hwmon_skeleton_init(HwmonSkeleton * skeleton)1808 hwmon_skeleton_init (HwmonSkeleton *skeleton)
1809 {
1810 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1811 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
1812 #else
1813 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
1814 #endif
1815
1816 g_mutex_init (&skeleton->priv->lock);
1817 skeleton->priv->context = g_main_context_ref_thread_default ();
1818 skeleton->priv->properties = g_new0 (GValue, 3);
1819 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
1820 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1821 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
1822 }
1823
1824 static gint
hwmon_skeleton_get_poll_interval(Hwmon * object)1825 hwmon_skeleton_get_poll_interval (Hwmon *object)
1826 {
1827 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1828 gint value;
1829 g_mutex_lock (&skeleton->priv->lock);
1830 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
1831 g_mutex_unlock (&skeleton->priv->lock);
1832 return value;
1833 }
1834
1835 static const gchar *
hwmon_skeleton_get_sysfs_path(Hwmon * object)1836 hwmon_skeleton_get_sysfs_path (Hwmon *object)
1837 {
1838 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1839 const gchar *value;
1840 g_mutex_lock (&skeleton->priv->lock);
1841 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
1842 g_mutex_unlock (&skeleton->priv->lock);
1843 return value;
1844 }
1845
1846 static gint
hwmon_skeleton_get_scale(Hwmon * object)1847 hwmon_skeleton_get_scale (Hwmon *object)
1848 {
1849 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1850 gint value;
1851 g_mutex_lock (&skeleton->priv->lock);
1852 value = g_marshal_value_peek_int (&(skeleton->priv->properties[2]));
1853 g_mutex_unlock (&skeleton->priv->lock);
1854 return value;
1855 }
1856
1857 static void
hwmon_skeleton_class_init(HwmonSkeletonClass * klass)1858 hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
1859 {
1860 GObjectClass *gobject_class;
1861 GDBusInterfaceSkeletonClass *skeleton_class;
1862
1863 gobject_class = G_OBJECT_CLASS (klass);
1864 gobject_class->finalize = hwmon_skeleton_finalize;
1865 gobject_class->get_property = hwmon_skeleton_get_property;
1866 gobject_class->set_property = hwmon_skeleton_set_property;
1867 gobject_class->notify = hwmon_skeleton_notify;
1868
1869
1870 hwmon_override_properties (gobject_class, 1);
1871
1872 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1873 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
1874 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
1875 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
1876 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
1877
1878 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1879 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
1880 #endif
1881 }
1882
1883 static void
hwmon_skeleton_iface_init(HwmonIface * iface)1884 hwmon_skeleton_iface_init (HwmonIface *iface)
1885 {
1886 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
1887 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
1888 iface->get_scale = hwmon_skeleton_get_scale;
1889 }
1890
1891 /**
1892 * hwmon_skeleton_new:
1893 *
1894 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
1895 *
1896 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
1897 */
1898 Hwmon *
hwmon_skeleton_new(void)1899 hwmon_skeleton_new (void)
1900 {
1901 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
1902 }
1903
1904 /* ------------------------------------------------------------------------
1905 * Code for interface org.openbmc.Fan
1906 * ------------------------------------------------------------------------
1907 */
1908
1909 /**
1910 * SECTION:Fan
1911 * @title: Fan
1912 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1913 *
1914 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface in C.
1915 */
1916
1917 enum
1918 {
1919 _FAN_SPEED_CHANGED,
1920 _FAN_TACH_ERROR,
1921 };
1922
1923 static unsigned _FAN_SIGNALS[2] = { 0 };
1924
1925 /* ---- Introspection data for org.openbmc.Fan ---- */
1926
1927 static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1928 {
1929 {
1930 -1,
1931 (gchar *) "cooling_zone",
1932 (gchar *) "i",
1933 NULL
1934 },
1935 FALSE
1936 };
1937
1938 static const GDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1939 {
1940 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone.parent_struct,
1941 NULL
1942 };
1943
1944 static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1945 {
1946 {
1947 -1,
1948 (gchar *) "setCoolingZone",
1949 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1950 NULL,
1951 NULL
1952 },
1953 "handle-set-cooling-zone",
1954 FALSE
1955 };
1956
1957 static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1958 {
1959 {
1960 -1,
1961 (gchar *) "speed",
1962 (gchar *) "i",
1963 NULL
1964 },
1965 FALSE
1966 };
1967
1968 static const GDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1969 {
1970 &_fan_method_info_get_speed_OUT_ARG_speed.parent_struct,
1971 NULL
1972 };
1973
1974 static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1975 {
1976 {
1977 -1,
1978 (gchar *) "getSpeed",
1979 NULL,
1980 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1981 NULL
1982 },
1983 "handle-get-speed",
1984 FALSE
1985 };
1986
1987 static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1988 {
1989 {
1990 -1,
1991 (gchar *) "speed",
1992 (gchar *) "i",
1993 NULL
1994 },
1995 FALSE
1996 };
1997
1998 static const GDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1999 {
2000 &_fan_method_info_set_speed_IN_ARG_speed.parent_struct,
2001 NULL
2002 };
2003
2004 static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
2005 {
2006 {
2007 -1,
2008 (gchar *) "setSpeed",
2009 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
2010 NULL,
2011 NULL
2012 },
2013 "handle-set-speed",
2014 FALSE
2015 };
2016
2017 static const GDBusMethodInfo * const _fan_method_info_pointers[] =
2018 {
2019 &_fan_method_info_set_cooling_zone.parent_struct,
2020 &_fan_method_info_get_speed.parent_struct,
2021 &_fan_method_info_set_speed.parent_struct,
2022 NULL
2023 };
2024
2025 static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
2026 {
2027 {
2028 -1,
2029 (gchar *) "speed",
2030 (gchar *) "i",
2031 NULL
2032 },
2033 FALSE
2034 };
2035
2036 static const GDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
2037 {
2038 &_fan_signal_info_speed_changed_ARG_speed.parent_struct,
2039 NULL
2040 };
2041
2042 static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
2043 {
2044 {
2045 -1,
2046 (gchar *) "SpeedChanged",
2047 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
2048 NULL
2049 },
2050 "speed-changed"
2051 };
2052
2053 static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
2054 {
2055 {
2056 -1,
2057 (gchar *) "TachError",
2058 NULL,
2059 NULL
2060 },
2061 "tach-error"
2062 };
2063
2064 static const GDBusSignalInfo * const _fan_signal_info_pointers[] =
2065 {
2066 &_fan_signal_info_speed_changed.parent_struct,
2067 &_fan_signal_info_tach_error.parent_struct,
2068 NULL
2069 };
2070
2071 static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
2072 {
2073 {
2074 -1,
2075 (gchar *) "speed",
2076 (gchar *) "i",
2077 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2078 NULL
2079 },
2080 "speed",
2081 FALSE,
2082 TRUE
2083 };
2084
2085 static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
2086 {
2087 {
2088 -1,
2089 (gchar *) "cooling_zone",
2090 (gchar *) "i",
2091 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2092 NULL
2093 },
2094 "cooling-zone",
2095 FALSE,
2096 TRUE
2097 };
2098
2099 static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
2100 {
2101 {
2102 -1,
2103 (gchar *) "pwm_num",
2104 (gchar *) "i",
2105 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2106 NULL
2107 },
2108 "pwm-num",
2109 FALSE,
2110 TRUE
2111 };
2112
2113 static const GDBusPropertyInfo * const _fan_property_info_pointers[] =
2114 {
2115 &_fan_property_info_speed.parent_struct,
2116 &_fan_property_info_cooling_zone.parent_struct,
2117 &_fan_property_info_pwm_num.parent_struct,
2118 NULL
2119 };
2120
2121 static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
2122 {
2123 {
2124 -1,
2125 (gchar *) "org.openbmc.Fan",
2126 (GDBusMethodInfo **) &_fan_method_info_pointers,
2127 (GDBusSignalInfo **) &_fan_signal_info_pointers,
2128 (GDBusPropertyInfo **) &_fan_property_info_pointers,
2129 NULL
2130 },
2131 "fan",
2132 };
2133
2134
2135 /**
2136 * fan_interface_info:
2137 *
2138 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
2139 *
2140 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2141 */
2142 GDBusInterfaceInfo *
fan_interface_info(void)2143 fan_interface_info (void)
2144 {
2145 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
2146 }
2147
2148 /**
2149 * fan_override_properties:
2150 * @klass: The class structure for a #GObject derived class.
2151 * @property_id_begin: The property id to assign to the first overridden property.
2152 *
2153 * Overrides all #GObject properties in the #Fan interface for a concrete class.
2154 * The properties are overridden in the order they are defined.
2155 *
2156 * Returns: The last property id.
2157 */
2158 guint
fan_override_properties(GObjectClass * klass,guint property_id_begin)2159 fan_override_properties (GObjectClass *klass, guint property_id_begin)
2160 {
2161 g_object_class_override_property (klass, property_id_begin++, "speed");
2162 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
2163 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
2164 return property_id_begin - 1;
2165 }
2166
2167
2168 inline static void
fan_signal_marshal_speed_changed(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)2169 fan_signal_marshal_speed_changed (
2170 GClosure *closure,
2171 GValue *return_value,
2172 unsigned int n_param_values,
2173 const GValue *param_values,
2174 void *invocation_hint,
2175 void *marshal_data)
2176 {
2177 g_cclosure_marshal_VOID__INT (closure,
2178 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2179 }
2180
2181 inline static void
fan_signal_marshal_tach_error(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)2182 fan_signal_marshal_tach_error (
2183 GClosure *closure,
2184 GValue *return_value,
2185 unsigned int n_param_values,
2186 const GValue *param_values,
2187 void *invocation_hint,
2188 void *marshal_data)
2189 {
2190 g_cclosure_marshal_VOID__VOID (closure,
2191 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2192 }
2193
2194 inline static void
fan_method_marshal_set_cooling_zone(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)2195 fan_method_marshal_set_cooling_zone (
2196 GClosure *closure,
2197 GValue *return_value,
2198 unsigned int n_param_values,
2199 const GValue *param_values,
2200 void *invocation_hint,
2201 void *marshal_data)
2202 {
2203 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT (closure,
2204 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2205 }
2206
2207 inline static void
fan_method_marshal_get_speed(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)2208 fan_method_marshal_get_speed (
2209 GClosure *closure,
2210 GValue *return_value,
2211 unsigned int n_param_values,
2212 const GValue *param_values,
2213 void *invocation_hint,
2214 void *marshal_data)
2215 {
2216 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
2217 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2218 }
2219
2220 inline static void
fan_method_marshal_set_speed(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)2221 fan_method_marshal_set_speed (
2222 GClosure *closure,
2223 GValue *return_value,
2224 unsigned int n_param_values,
2225 const GValue *param_values,
2226 void *invocation_hint,
2227 void *marshal_data)
2228 {
2229 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT (closure,
2230 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2231 }
2232
2233
2234 /**
2235 * Fan:
2236 *
2237 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2238 */
2239
2240 /**
2241 * FanIface:
2242 * @parent_iface: The parent interface.
2243 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
2244 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
2245 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
2246 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
2247 * @get_pwm_num: Getter for the #Fan:pwm-num property.
2248 * @get_speed: Getter for the #Fan:speed property.
2249 * @speed_changed: Handler for the #Fan::speed-changed signal.
2250 * @tach_error: Handler for the #Fan::tach-error signal.
2251 *
2252 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2253 */
2254
2255 typedef FanIface FanInterface;
G_DEFINE_INTERFACE(Fan,fan,G_TYPE_OBJECT)2256 G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT)
2257
2258 static void
2259 fan_default_init (FanIface *iface)
2260 {
2261 /* GObject signals for incoming D-Bus method calls: */
2262 /**
2263 * Fan::handle-set-cooling-zone:
2264 * @object: A #Fan.
2265 * @invocation: A #GDBusMethodInvocation.
2266 * @arg_cooling_zone: Argument passed by remote caller.
2267 *
2268 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2269 *
2270 * 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 fan_complete_set_cooling_zone() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
2271 *
2272 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
2273 */
2274 g_signal_new ("handle-set-cooling-zone",
2275 G_TYPE_FROM_INTERFACE (iface),
2276 G_SIGNAL_RUN_LAST,
2277 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
2278 g_signal_accumulator_true_handled,
2279 NULL,
2280 fan_method_marshal_set_cooling_zone,
2281 G_TYPE_BOOLEAN,
2282 2,
2283 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2284
2285 /**
2286 * Fan::handle-get-speed:
2287 * @object: A #Fan.
2288 * @invocation: A #GDBusMethodInvocation.
2289 *
2290 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
2291 *
2292 * 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 fan_complete_get_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
2293 *
2294 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
2295 */
2296 g_signal_new ("handle-get-speed",
2297 G_TYPE_FROM_INTERFACE (iface),
2298 G_SIGNAL_RUN_LAST,
2299 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2300 g_signal_accumulator_true_handled,
2301 NULL,
2302 fan_method_marshal_get_speed,
2303 G_TYPE_BOOLEAN,
2304 1,
2305 G_TYPE_DBUS_METHOD_INVOCATION);
2306
2307 /**
2308 * Fan::handle-set-speed:
2309 * @object: A #Fan.
2310 * @invocation: A #GDBusMethodInvocation.
2311 * @arg_speed: Argument passed by remote caller.
2312 *
2313 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2314 *
2315 * 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 fan_complete_set_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
2316 *
2317 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
2318 */
2319 g_signal_new ("handle-set-speed",
2320 G_TYPE_FROM_INTERFACE (iface),
2321 G_SIGNAL_RUN_LAST,
2322 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2323 g_signal_accumulator_true_handled,
2324 NULL,
2325 fan_method_marshal_set_speed,
2326 G_TYPE_BOOLEAN,
2327 2,
2328 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2329
2330 /* GObject signals for received D-Bus signals: */
2331 /**
2332 * Fan::speed-changed:
2333 * @object: A #Fan.
2334 * @arg_speed: Argument.
2335 *
2336 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> is received.
2337 *
2338 * 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.
2339 */
2340 _FAN_SIGNALS[_FAN_SPEED_CHANGED] =
2341 g_signal_new ("speed-changed",
2342 G_TYPE_FROM_INTERFACE (iface),
2343 G_SIGNAL_RUN_LAST,
2344 G_STRUCT_OFFSET (FanIface, speed_changed),
2345 NULL,
2346 NULL,
2347 fan_signal_marshal_speed_changed,
2348 G_TYPE_NONE,
2349 1, G_TYPE_INT);
2350
2351 /**
2352 * Fan::tach-error:
2353 * @object: A #Fan.
2354 *
2355 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> is received.
2356 *
2357 * 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.
2358 */
2359 _FAN_SIGNALS[_FAN_TACH_ERROR] =
2360 g_signal_new ("tach-error",
2361 G_TYPE_FROM_INTERFACE (iface),
2362 G_SIGNAL_RUN_LAST,
2363 G_STRUCT_OFFSET (FanIface, tach_error),
2364 NULL,
2365 NULL,
2366 fan_signal_marshal_tach_error,
2367 G_TYPE_NONE,
2368 0);
2369
2370 /* GObject properties for D-Bus properties: */
2371 /**
2372 * Fan:speed:
2373 *
2374 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2375 *
2376 * 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.
2377 */
2378 g_object_interface_install_property (iface,
2379 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2380 /**
2381 * Fan:cooling-zone:
2382 *
2383 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2384 *
2385 * 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.
2386 */
2387 g_object_interface_install_property (iface,
2388 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2389 /**
2390 * Fan:pwm-num:
2391 *
2392 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2393 *
2394 * 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.
2395 */
2396 g_object_interface_install_property (iface,
2397 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2398 }
2399
2400 /**
2401 * fan_get_speed: (skip)
2402 * @object: A #Fan.
2403 *
2404 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2405 *
2406 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2407 *
2408 * Returns: The property value.
2409 */
2410 gint
fan_get_speed(Fan * object)2411 fan_get_speed (Fan *object)
2412 {
2413 g_return_val_if_fail (IS_FAN (object), 0);
2414
2415 return FAN_GET_IFACE (object)->get_speed (object);
2416 }
2417
2418 /**
2419 * fan_set_speed: (skip)
2420 * @object: A #Fan.
2421 * @value: The value to set.
2422 *
2423 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2424 *
2425 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2426 */
2427 void
fan_set_speed(Fan * object,gint value)2428 fan_set_speed (Fan *object, gint value)
2429 {
2430 g_object_set (G_OBJECT (object), "speed", value, NULL);
2431 }
2432
2433 /**
2434 * fan_get_cooling_zone: (skip)
2435 * @object: A #Fan.
2436 *
2437 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2438 *
2439 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2440 *
2441 * Returns: The property value.
2442 */
2443 gint
fan_get_cooling_zone(Fan * object)2444 fan_get_cooling_zone (Fan *object)
2445 {
2446 g_return_val_if_fail (IS_FAN (object), 0);
2447
2448 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2449 }
2450
2451 /**
2452 * fan_set_cooling_zone: (skip)
2453 * @object: A #Fan.
2454 * @value: The value to set.
2455 *
2456 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2457 *
2458 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2459 */
2460 void
fan_set_cooling_zone(Fan * object,gint value)2461 fan_set_cooling_zone (Fan *object, gint value)
2462 {
2463 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2464 }
2465
2466 /**
2467 * fan_get_pwm_num: (skip)
2468 * @object: A #Fan.
2469 *
2470 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2471 *
2472 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2473 *
2474 * Returns: The property value.
2475 */
2476 gint
fan_get_pwm_num(Fan * object)2477 fan_get_pwm_num (Fan *object)
2478 {
2479 g_return_val_if_fail (IS_FAN (object), 0);
2480
2481 return FAN_GET_IFACE (object)->get_pwm_num (object);
2482 }
2483
2484 /**
2485 * fan_set_pwm_num: (skip)
2486 * @object: A #Fan.
2487 * @value: The value to set.
2488 *
2489 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2490 *
2491 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2492 */
2493 void
fan_set_pwm_num(Fan * object,gint value)2494 fan_set_pwm_num (Fan *object, gint value)
2495 {
2496 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2497 }
2498
2499 /**
2500 * fan_emit_speed_changed:
2501 * @object: A #Fan.
2502 * @arg_speed: Argument to pass with the signal.
2503 *
2504 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2505 */
2506 void
fan_emit_speed_changed(Fan * object,gint arg_speed)2507 fan_emit_speed_changed (
2508 Fan *object,
2509 gint arg_speed)
2510 {
2511 g_signal_emit (object, _FAN_SIGNALS[_FAN_SPEED_CHANGED], 0, arg_speed);
2512 }
2513
2514 /**
2515 * fan_emit_tach_error:
2516 * @object: A #Fan.
2517 *
2518 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2519 */
2520 void
fan_emit_tach_error(Fan * object)2521 fan_emit_tach_error (
2522 Fan *object)
2523 {
2524 g_signal_emit (object, _FAN_SIGNALS[_FAN_TACH_ERROR], 0);
2525 }
2526
2527 /**
2528 * fan_call_set_cooling_zone:
2529 * @proxy: A #FanProxy.
2530 * @arg_cooling_zone: Argument to pass with the method invocation.
2531 * @cancellable: (nullable): A #GCancellable or %NULL.
2532 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2533 * @user_data: User data to pass to @callback.
2534 *
2535 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2536 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
2537 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2538 *
2539 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2540 */
2541 void
fan_call_set_cooling_zone(Fan * proxy,gint arg_cooling_zone,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2542 fan_call_set_cooling_zone (
2543 Fan *proxy,
2544 gint arg_cooling_zone,
2545 GCancellable *cancellable,
2546 GAsyncReadyCallback callback,
2547 gpointer user_data)
2548 {
2549 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2550 "setCoolingZone",
2551 g_variant_new ("(i)",
2552 arg_cooling_zone),
2553 G_DBUS_CALL_FLAGS_NONE,
2554 -1,
2555 cancellable,
2556 callback,
2557 user_data);
2558 }
2559
2560 /**
2561 * fan_call_set_cooling_zone_finish:
2562 * @proxy: A #FanProxy.
2563 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2564 * @error: Return location for error or %NULL.
2565 *
2566 * Finishes an operation started with fan_call_set_cooling_zone().
2567 *
2568 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2569 */
2570 gboolean
fan_call_set_cooling_zone_finish(Fan * proxy,GAsyncResult * res,GError ** error)2571 fan_call_set_cooling_zone_finish (
2572 Fan *proxy,
2573 GAsyncResult *res,
2574 GError **error)
2575 {
2576 GVariant *_ret;
2577 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2578 if (_ret == NULL)
2579 goto _out;
2580 g_variant_get (_ret,
2581 "()");
2582 g_variant_unref (_ret);
2583 _out:
2584 return _ret != NULL;
2585 }
2586
2587 /**
2588 * fan_call_set_cooling_zone_sync:
2589 * @proxy: A #FanProxy.
2590 * @arg_cooling_zone: Argument to pass with the method invocation.
2591 * @cancellable: (nullable): A #GCancellable or %NULL.
2592 * @error: Return location for error or %NULL.
2593 *
2594 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2595 *
2596 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2597 *
2598 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2599 */
2600 gboolean
fan_call_set_cooling_zone_sync(Fan * proxy,gint arg_cooling_zone,GCancellable * cancellable,GError ** error)2601 fan_call_set_cooling_zone_sync (
2602 Fan *proxy,
2603 gint arg_cooling_zone,
2604 GCancellable *cancellable,
2605 GError **error)
2606 {
2607 GVariant *_ret;
2608 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2609 "setCoolingZone",
2610 g_variant_new ("(i)",
2611 arg_cooling_zone),
2612 G_DBUS_CALL_FLAGS_NONE,
2613 -1,
2614 cancellable,
2615 error);
2616 if (_ret == NULL)
2617 goto _out;
2618 g_variant_get (_ret,
2619 "()");
2620 g_variant_unref (_ret);
2621 _out:
2622 return _ret != NULL;
2623 }
2624
2625 /**
2626 * fan_call_get_speed:
2627 * @proxy: A #FanProxy.
2628 * @cancellable: (nullable): A #GCancellable or %NULL.
2629 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2630 * @user_data: User data to pass to @callback.
2631 *
2632 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2633 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
2634 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2635 *
2636 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2637 */
2638 void
fan_call_get_speed(Fan * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2639 fan_call_get_speed (
2640 Fan *proxy,
2641 GCancellable *cancellable,
2642 GAsyncReadyCallback callback,
2643 gpointer user_data)
2644 {
2645 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2646 "getSpeed",
2647 g_variant_new ("()"),
2648 G_DBUS_CALL_FLAGS_NONE,
2649 -1,
2650 cancellable,
2651 callback,
2652 user_data);
2653 }
2654
2655 /**
2656 * fan_call_get_speed_finish:
2657 * @proxy: A #FanProxy.
2658 * @out_speed: (out) (optional): Return location for return parameter or %NULL to ignore.
2659 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2660 * @error: Return location for error or %NULL.
2661 *
2662 * Finishes an operation started with fan_call_get_speed().
2663 *
2664 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2665 */
2666 gboolean
fan_call_get_speed_finish(Fan * proxy,gint * out_speed,GAsyncResult * res,GError ** error)2667 fan_call_get_speed_finish (
2668 Fan *proxy,
2669 gint *out_speed,
2670 GAsyncResult *res,
2671 GError **error)
2672 {
2673 GVariant *_ret;
2674 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2675 if (_ret == NULL)
2676 goto _out;
2677 g_variant_get (_ret,
2678 "(i)",
2679 out_speed);
2680 g_variant_unref (_ret);
2681 _out:
2682 return _ret != NULL;
2683 }
2684
2685 /**
2686 * fan_call_get_speed_sync:
2687 * @proxy: A #FanProxy.
2688 * @out_speed: (out) (optional): Return location for return parameter or %NULL to ignore.
2689 * @cancellable: (nullable): A #GCancellable or %NULL.
2690 * @error: Return location for error or %NULL.
2691 *
2692 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2693 *
2694 * See fan_call_get_speed() for the asynchronous version of this method.
2695 *
2696 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2697 */
2698 gboolean
fan_call_get_speed_sync(Fan * proxy,gint * out_speed,GCancellable * cancellable,GError ** error)2699 fan_call_get_speed_sync (
2700 Fan *proxy,
2701 gint *out_speed,
2702 GCancellable *cancellable,
2703 GError **error)
2704 {
2705 GVariant *_ret;
2706 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2707 "getSpeed",
2708 g_variant_new ("()"),
2709 G_DBUS_CALL_FLAGS_NONE,
2710 -1,
2711 cancellable,
2712 error);
2713 if (_ret == NULL)
2714 goto _out;
2715 g_variant_get (_ret,
2716 "(i)",
2717 out_speed);
2718 g_variant_unref (_ret);
2719 _out:
2720 return _ret != NULL;
2721 }
2722
2723 /**
2724 * fan_call_set_speed:
2725 * @proxy: A #FanProxy.
2726 * @arg_speed: Argument to pass with the method invocation.
2727 * @cancellable: (nullable): A #GCancellable or %NULL.
2728 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2729 * @user_data: User data to pass to @callback.
2730 *
2731 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2732 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
2733 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2734 *
2735 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2736 */
2737 void
fan_call_set_speed(Fan * proxy,gint arg_speed,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2738 fan_call_set_speed (
2739 Fan *proxy,
2740 gint arg_speed,
2741 GCancellable *cancellable,
2742 GAsyncReadyCallback callback,
2743 gpointer user_data)
2744 {
2745 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2746 "setSpeed",
2747 g_variant_new ("(i)",
2748 arg_speed),
2749 G_DBUS_CALL_FLAGS_NONE,
2750 -1,
2751 cancellable,
2752 callback,
2753 user_data);
2754 }
2755
2756 /**
2757 * fan_call_set_speed_finish:
2758 * @proxy: A #FanProxy.
2759 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2760 * @error: Return location for error or %NULL.
2761 *
2762 * Finishes an operation started with fan_call_set_speed().
2763 *
2764 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2765 */
2766 gboolean
fan_call_set_speed_finish(Fan * proxy,GAsyncResult * res,GError ** error)2767 fan_call_set_speed_finish (
2768 Fan *proxy,
2769 GAsyncResult *res,
2770 GError **error)
2771 {
2772 GVariant *_ret;
2773 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2774 if (_ret == NULL)
2775 goto _out;
2776 g_variant_get (_ret,
2777 "()");
2778 g_variant_unref (_ret);
2779 _out:
2780 return _ret != NULL;
2781 }
2782
2783 /**
2784 * fan_call_set_speed_sync:
2785 * @proxy: A #FanProxy.
2786 * @arg_speed: Argument to pass with the method invocation.
2787 * @cancellable: (nullable): A #GCancellable or %NULL.
2788 * @error: Return location for error or %NULL.
2789 *
2790 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2791 *
2792 * See fan_call_set_speed() for the asynchronous version of this method.
2793 *
2794 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2795 */
2796 gboolean
fan_call_set_speed_sync(Fan * proxy,gint arg_speed,GCancellable * cancellable,GError ** error)2797 fan_call_set_speed_sync (
2798 Fan *proxy,
2799 gint arg_speed,
2800 GCancellable *cancellable,
2801 GError **error)
2802 {
2803 GVariant *_ret;
2804 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2805 "setSpeed",
2806 g_variant_new ("(i)",
2807 arg_speed),
2808 G_DBUS_CALL_FLAGS_NONE,
2809 -1,
2810 cancellable,
2811 error);
2812 if (_ret == NULL)
2813 goto _out;
2814 g_variant_get (_ret,
2815 "()");
2816 g_variant_unref (_ret);
2817 _out:
2818 return _ret != NULL;
2819 }
2820
2821 /**
2822 * fan_complete_set_cooling_zone:
2823 * @object: A #Fan.
2824 * @invocation: (transfer full): A #GDBusMethodInvocation.
2825 *
2826 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</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.
2827 *
2828 * This method will free @invocation, you cannot use it afterwards.
2829 */
2830 void
fan_complete_set_cooling_zone(Fan * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2831 fan_complete_set_cooling_zone (
2832 Fan *object G_GNUC_UNUSED,
2833 GDBusMethodInvocation *invocation)
2834 {
2835 g_dbus_method_invocation_return_value (invocation,
2836 g_variant_new ("()"));
2837 }
2838
2839 /**
2840 * fan_complete_get_speed:
2841 * @object: A #Fan.
2842 * @invocation: (transfer full): A #GDBusMethodInvocation.
2843 * @speed: Parameter to return.
2844 *
2845 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</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.
2846 *
2847 * This method will free @invocation, you cannot use it afterwards.
2848 */
2849 void
fan_complete_get_speed(Fan * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gint speed)2850 fan_complete_get_speed (
2851 Fan *object G_GNUC_UNUSED,
2852 GDBusMethodInvocation *invocation,
2853 gint speed)
2854 {
2855 g_dbus_method_invocation_return_value (invocation,
2856 g_variant_new ("(i)",
2857 speed));
2858 }
2859
2860 /**
2861 * fan_complete_set_speed:
2862 * @object: A #Fan.
2863 * @invocation: (transfer full): A #GDBusMethodInvocation.
2864 *
2865 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</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.
2866 *
2867 * This method will free @invocation, you cannot use it afterwards.
2868 */
2869 void
fan_complete_set_speed(Fan * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2870 fan_complete_set_speed (
2871 Fan *object G_GNUC_UNUSED,
2872 GDBusMethodInvocation *invocation)
2873 {
2874 g_dbus_method_invocation_return_value (invocation,
2875 g_variant_new ("()"));
2876 }
2877
2878 /* ------------------------------------------------------------------------ */
2879
2880 /**
2881 * FanProxy:
2882 *
2883 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2884 */
2885
2886 /**
2887 * FanProxyClass:
2888 * @parent_class: The parent class.
2889 *
2890 * Class structure for #FanProxy.
2891 */
2892
2893 struct _FanProxyPrivate
2894 {
2895 GData *qdata;
2896 };
2897
2898 static void fan_proxy_iface_init (FanIface *iface);
2899
2900 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FanProxy,fan_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (FanProxy)G_IMPLEMENT_INTERFACE (TYPE_FAN,fan_proxy_iface_init))2901 G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2902 G_ADD_PRIVATE (FanProxy)
2903 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init))
2904
2905 #else
2906 G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2907 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init))
2908
2909 #endif
2910 static void
2911 fan_proxy_finalize (GObject *object)
2912 {
2913 FanProxy *proxy = FAN_PROXY (object);
2914 g_datalist_clear (&proxy->priv->qdata);
2915 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2916 }
2917
2918 static void
fan_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2919 fan_proxy_get_property (GObject *object,
2920 guint prop_id,
2921 GValue *value,
2922 GParamSpec *pspec G_GNUC_UNUSED)
2923 {
2924 const _ExtendedGDBusPropertyInfo *info;
2925 GVariant *variant;
2926 g_assert (prop_id != 0 && prop_id - 1 < 3);
2927 info = (const _ExtendedGDBusPropertyInfo *) _fan_property_info_pointers[prop_id - 1];
2928 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2929 if (info->use_gvariant)
2930 {
2931 g_value_set_variant (value, variant);
2932 }
2933 else
2934 {
2935 if (variant != NULL)
2936 g_dbus_gvariant_to_gvalue (variant, value);
2937 }
2938 if (variant != NULL)
2939 g_variant_unref (variant);
2940 }
2941
2942 static void
fan_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)2943 fan_proxy_set_property_cb (GDBusProxy *proxy,
2944 GAsyncResult *res,
2945 gpointer user_data)
2946 {
2947 const _ExtendedGDBusPropertyInfo *info = user_data;
2948 GError *error;
2949 GVariant *_ret;
2950 error = NULL;
2951 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2952 if (!_ret)
2953 {
2954 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2955 info->parent_struct.name,
2956 error->message, g_quark_to_string (error->domain), error->code);
2957 g_error_free (error);
2958 }
2959 else
2960 {
2961 g_variant_unref (_ret);
2962 }
2963 }
2964
2965 static void
fan_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2966 fan_proxy_set_property (GObject *object,
2967 guint prop_id,
2968 const GValue *value,
2969 GParamSpec *pspec G_GNUC_UNUSED)
2970 {
2971 const _ExtendedGDBusPropertyInfo *info;
2972 GVariant *variant;
2973 g_assert (prop_id != 0 && prop_id - 1 < 3);
2974 info = (const _ExtendedGDBusPropertyInfo *) _fan_property_info_pointers[prop_id - 1];
2975 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2976 g_dbus_proxy_call (G_DBUS_PROXY (object),
2977 "org.freedesktop.DBus.Properties.Set",
2978 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2979 G_DBUS_CALL_FLAGS_NONE,
2980 -1,
2981 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2982 g_variant_unref (variant);
2983 }
2984
2985 static void
fan_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)2986 fan_proxy_g_signal (GDBusProxy *proxy,
2987 const gchar *sender_name G_GNUC_UNUSED,
2988 const gchar *signal_name,
2989 GVariant *parameters)
2990 {
2991 _ExtendedGDBusSignalInfo *info;
2992 GVariantIter iter;
2993 GVariant *child;
2994 GValue *paramv;
2995 gsize num_params;
2996 gsize n;
2997 guint signal_id;
2998 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2999 if (info == NULL)
3000 return;
3001 num_params = g_variant_n_children (parameters);
3002 paramv = g_new0 (GValue, num_params + 1);
3003 g_value_init (¶mv[0], TYPE_FAN);
3004 g_value_set_object (¶mv[0], proxy);
3005 g_variant_iter_init (&iter, parameters);
3006 n = 1;
3007 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3008 {
3009 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3010 if (arg_info->use_gvariant)
3011 {
3012 g_value_init (¶mv[n], G_TYPE_VARIANT);
3013 g_value_set_variant (¶mv[n], child);
3014 n++;
3015 }
3016 else
3017 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
3018 g_variant_unref (child);
3019 }
3020 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3021 g_signal_emitv (paramv, signal_id, 0, NULL);
3022 for (n = 0; n < num_params + 1; n++)
3023 g_value_unset (¶mv[n]);
3024 g_free (paramv);
3025 }
3026
3027 static void
fan_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)3028 fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3029 GVariant *changed_properties,
3030 const gchar *const *invalidated_properties)
3031 {
3032 FanProxy *proxy = FAN_PROXY (_proxy);
3033 guint n;
3034 const gchar *key;
3035 GVariantIter *iter;
3036 _ExtendedGDBusPropertyInfo *info;
3037 g_variant_get (changed_properties, "a{sv}", &iter);
3038 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3039 {
3040 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
3041 g_datalist_remove_data (&proxy->priv->qdata, key);
3042 if (info != NULL)
3043 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3044 }
3045 g_variant_iter_free (iter);
3046 for (n = 0; invalidated_properties[n] != NULL; n++)
3047 {
3048 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
3049 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3050 if (info != NULL)
3051 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3052 }
3053 }
3054
3055 static gint
fan_proxy_get_speed(Fan * object)3056 fan_proxy_get_speed (Fan *object)
3057 {
3058 FanProxy *proxy = FAN_PROXY (object);
3059 GVariant *variant;
3060 gint value = 0;
3061 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3062 if (variant != NULL)
3063 {
3064 value = g_variant_get_int32 (variant);
3065 g_variant_unref (variant);
3066 }
3067 return value;
3068 }
3069
3070 static gint
fan_proxy_get_cooling_zone(Fan * object)3071 fan_proxy_get_cooling_zone (Fan *object)
3072 {
3073 FanProxy *proxy = FAN_PROXY (object);
3074 GVariant *variant;
3075 gint value = 0;
3076 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3077 if (variant != NULL)
3078 {
3079 value = g_variant_get_int32 (variant);
3080 g_variant_unref (variant);
3081 }
3082 return value;
3083 }
3084
3085 static gint
fan_proxy_get_pwm_num(Fan * object)3086 fan_proxy_get_pwm_num (Fan *object)
3087 {
3088 FanProxy *proxy = FAN_PROXY (object);
3089 GVariant *variant;
3090 gint value = 0;
3091 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
3092 if (variant != NULL)
3093 {
3094 value = g_variant_get_int32 (variant);
3095 g_variant_unref (variant);
3096 }
3097 return value;
3098 }
3099
3100 static void
fan_proxy_init(FanProxy * proxy)3101 fan_proxy_init (FanProxy *proxy)
3102 {
3103 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3104 proxy->priv = fan_proxy_get_instance_private (proxy);
3105 #else
3106 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
3107 #endif
3108
3109 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
3110 }
3111
3112 static void
fan_proxy_class_init(FanProxyClass * klass)3113 fan_proxy_class_init (FanProxyClass *klass)
3114 {
3115 GObjectClass *gobject_class;
3116 GDBusProxyClass *proxy_class;
3117
3118 gobject_class = G_OBJECT_CLASS (klass);
3119 gobject_class->finalize = fan_proxy_finalize;
3120 gobject_class->get_property = fan_proxy_get_property;
3121 gobject_class->set_property = fan_proxy_set_property;
3122
3123 proxy_class = G_DBUS_PROXY_CLASS (klass);
3124 proxy_class->g_signal = fan_proxy_g_signal;
3125 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
3126
3127 fan_override_properties (gobject_class, 1);
3128
3129 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3130 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
3131 #endif
3132 }
3133
3134 static void
fan_proxy_iface_init(FanIface * iface)3135 fan_proxy_iface_init (FanIface *iface)
3136 {
3137 iface->get_speed = fan_proxy_get_speed;
3138 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
3139 iface->get_pwm_num = fan_proxy_get_pwm_num;
3140 }
3141
3142 /**
3143 * fan_proxy_new:
3144 * @connection: A #GDBusConnection.
3145 * @flags: Flags from the #GDBusProxyFlags enumeration.
3146 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3147 * @object_path: An object path.
3148 * @cancellable: (nullable): A #GCancellable or %NULL.
3149 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3150 * @user_data: User data to pass to @callback.
3151 *
3152 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new() for more details.
3153 *
3154 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
3155 * You can then call fan_proxy_new_finish() to get the result of the operation.
3156 *
3157 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3158 */
3159 void
fan_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3160 fan_proxy_new (
3161 GDBusConnection *connection,
3162 GDBusProxyFlags flags,
3163 const gchar *name,
3164 const gchar *object_path,
3165 GCancellable *cancellable,
3166 GAsyncReadyCallback callback,
3167 gpointer user_data)
3168 {
3169 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
3170 }
3171
3172 /**
3173 * fan_proxy_new_finish:
3174 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
3175 * @error: Return location for error or %NULL
3176 *
3177 * Finishes an operation started with fan_proxy_new().
3178 *
3179 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3180 */
3181 Fan *
fan_proxy_new_finish(GAsyncResult * res,GError ** error)3182 fan_proxy_new_finish (
3183 GAsyncResult *res,
3184 GError **error)
3185 {
3186 GObject *ret;
3187 GObject *source_object;
3188 source_object = g_async_result_get_source_object (res);
3189 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3190 g_object_unref (source_object);
3191 if (ret != NULL)
3192 return FAN (ret);
3193 else
3194 return NULL;
3195 }
3196
3197 /**
3198 * fan_proxy_new_sync:
3199 * @connection: A #GDBusConnection.
3200 * @flags: Flags from the #GDBusProxyFlags enumeration.
3201 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3202 * @object_path: An object path.
3203 * @cancellable: (nullable): A #GCancellable or %NULL.
3204 * @error: Return location for error or %NULL
3205 *
3206 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new_sync() for more details.
3207 *
3208 * The calling thread is blocked until a reply is received.
3209 *
3210 * See fan_proxy_new() for the asynchronous version of this constructor.
3211 *
3212 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3213 */
3214 Fan *
fan_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3215 fan_proxy_new_sync (
3216 GDBusConnection *connection,
3217 GDBusProxyFlags flags,
3218 const gchar *name,
3219 const gchar *object_path,
3220 GCancellable *cancellable,
3221 GError **error)
3222 {
3223 GInitable *ret;
3224 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
3225 if (ret != NULL)
3226 return FAN (ret);
3227 else
3228 return NULL;
3229 }
3230
3231
3232 /**
3233 * fan_proxy_new_for_bus:
3234 * @bus_type: A #GBusType.
3235 * @flags: Flags from the #GDBusProxyFlags enumeration.
3236 * @name: A bus name (well-known or unique).
3237 * @object_path: An object path.
3238 * @cancellable: (nullable): A #GCancellable or %NULL.
3239 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3240 * @user_data: User data to pass to @callback.
3241 *
3242 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3243 *
3244 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
3245 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
3246 *
3247 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3248 */
3249 void
fan_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3250 fan_proxy_new_for_bus (
3251 GBusType bus_type,
3252 GDBusProxyFlags flags,
3253 const gchar *name,
3254 const gchar *object_path,
3255 GCancellable *cancellable,
3256 GAsyncReadyCallback callback,
3257 gpointer user_data)
3258 {
3259 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
3260 }
3261
3262 /**
3263 * fan_proxy_new_for_bus_finish:
3264 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
3265 * @error: Return location for error or %NULL
3266 *
3267 * Finishes an operation started with fan_proxy_new_for_bus().
3268 *
3269 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3270 */
3271 Fan *
fan_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)3272 fan_proxy_new_for_bus_finish (
3273 GAsyncResult *res,
3274 GError **error)
3275 {
3276 GObject *ret;
3277 GObject *source_object;
3278 source_object = g_async_result_get_source_object (res);
3279 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3280 g_object_unref (source_object);
3281 if (ret != NULL)
3282 return FAN (ret);
3283 else
3284 return NULL;
3285 }
3286
3287 /**
3288 * fan_proxy_new_for_bus_sync:
3289 * @bus_type: A #GBusType.
3290 * @flags: Flags from the #GDBusProxyFlags enumeration.
3291 * @name: A bus name (well-known or unique).
3292 * @object_path: An object path.
3293 * @cancellable: (nullable): A #GCancellable or %NULL.
3294 * @error: Return location for error or %NULL
3295 *
3296 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3297 *
3298 * The calling thread is blocked until a reply is received.
3299 *
3300 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3301 *
3302 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3303 */
3304 Fan *
fan_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3305 fan_proxy_new_for_bus_sync (
3306 GBusType bus_type,
3307 GDBusProxyFlags flags,
3308 const gchar *name,
3309 const gchar *object_path,
3310 GCancellable *cancellable,
3311 GError **error)
3312 {
3313 GInitable *ret;
3314 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
3315 if (ret != NULL)
3316 return FAN (ret);
3317 else
3318 return NULL;
3319 }
3320
3321
3322 /* ------------------------------------------------------------------------ */
3323
3324 /**
3325 * FanSkeleton:
3326 *
3327 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3328 */
3329
3330 /**
3331 * FanSkeletonClass:
3332 * @parent_class: The parent class.
3333 *
3334 * Class structure for #FanSkeleton.
3335 */
3336
3337 struct _FanSkeletonPrivate
3338 {
3339 GValue *properties;
3340 GList *changed_properties;
3341 GSource *changed_properties_idle_source;
3342 GMainContext *context;
3343 GMutex lock;
3344 };
3345
3346 static void
_fan_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)3347 _fan_skeleton_handle_method_call (
3348 GDBusConnection *connection G_GNUC_UNUSED,
3349 const gchar *sender G_GNUC_UNUSED,
3350 const gchar *object_path G_GNUC_UNUSED,
3351 const gchar *interface_name,
3352 const gchar *method_name,
3353 GVariant *parameters,
3354 GDBusMethodInvocation *invocation,
3355 gpointer user_data)
3356 {
3357 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3358 _ExtendedGDBusMethodInfo *info;
3359 GVariantIter iter;
3360 GVariant *child;
3361 GValue *paramv;
3362 gsize num_params;
3363 guint num_extra;
3364 gsize n;
3365 guint signal_id;
3366 GValue return_value = G_VALUE_INIT;
3367 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3368 g_assert (info != NULL);
3369 num_params = g_variant_n_children (parameters);
3370 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3371 n = 0;
3372 g_value_init (¶mv[n], TYPE_FAN);
3373 g_value_set_object (¶mv[n++], skeleton);
3374 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3375 g_value_set_object (¶mv[n++], invocation);
3376 if (info->pass_fdlist)
3377 {
3378 #ifdef G_OS_UNIX
3379 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
3380 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3381 #else
3382 g_assert_not_reached ();
3383 #endif
3384 }
3385 g_variant_iter_init (&iter, parameters);
3386 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3387 {
3388 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3389 if (arg_info->use_gvariant)
3390 {
3391 g_value_init (¶mv[n], G_TYPE_VARIANT);
3392 g_value_set_variant (¶mv[n], child);
3393 n++;
3394 }
3395 else
3396 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
3397 g_variant_unref (child);
3398 }
3399 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3400 g_value_init (&return_value, G_TYPE_BOOLEAN);
3401 g_signal_emitv (paramv, signal_id, 0, &return_value);
3402 if (!g_value_get_boolean (&return_value))
3403 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);
3404 g_value_unset (&return_value);
3405 for (n = 0; n < num_params + num_extra; n++)
3406 g_value_unset (¶mv[n]);
3407 g_free (paramv);
3408 }
3409
3410 static GVariant *
_fan_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)3411 _fan_skeleton_handle_get_property (
3412 GDBusConnection *connection G_GNUC_UNUSED,
3413 const gchar *sender G_GNUC_UNUSED,
3414 const gchar *object_path G_GNUC_UNUSED,
3415 const gchar *interface_name G_GNUC_UNUSED,
3416 const gchar *property_name,
3417 GError **error,
3418 gpointer user_data)
3419 {
3420 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3421 GValue value = G_VALUE_INIT;
3422 GParamSpec *pspec;
3423 _ExtendedGDBusPropertyInfo *info;
3424 GVariant *ret;
3425 ret = NULL;
3426 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3427 g_assert (info != NULL);
3428 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3429 if (pspec == NULL)
3430 {
3431 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3432 }
3433 else
3434 {
3435 g_value_init (&value, pspec->value_type);
3436 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3437 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3438 g_value_unset (&value);
3439 }
3440 return ret;
3441 }
3442
3443 static gboolean
_fan_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)3444 _fan_skeleton_handle_set_property (
3445 GDBusConnection *connection G_GNUC_UNUSED,
3446 const gchar *sender G_GNUC_UNUSED,
3447 const gchar *object_path G_GNUC_UNUSED,
3448 const gchar *interface_name G_GNUC_UNUSED,
3449 const gchar *property_name,
3450 GVariant *variant,
3451 GError **error,
3452 gpointer user_data)
3453 {
3454 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3455 GValue value = G_VALUE_INIT;
3456 GParamSpec *pspec;
3457 _ExtendedGDBusPropertyInfo *info;
3458 gboolean ret;
3459 ret = FALSE;
3460 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3461 g_assert (info != NULL);
3462 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3463 if (pspec == NULL)
3464 {
3465 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3466 }
3467 else
3468 {
3469 if (info->use_gvariant)
3470 g_value_set_variant (&value, variant);
3471 else
3472 g_dbus_gvariant_to_gvalue (variant, &value);
3473 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3474 g_value_unset (&value);
3475 ret = TRUE;
3476 }
3477 return ret;
3478 }
3479
3480 static const GDBusInterfaceVTable _fan_skeleton_vtable =
3481 {
3482 _fan_skeleton_handle_method_call,
3483 _fan_skeleton_handle_get_property,
3484 _fan_skeleton_handle_set_property,
3485 {NULL}
3486 };
3487
3488 static GDBusInterfaceInfo *
fan_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3489 fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3490 {
3491 return fan_interface_info ();
3492 }
3493
3494 static GDBusInterfaceVTable *
fan_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3495 fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3496 {
3497 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3498 }
3499
3500 static GVariant *
fan_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)3501 fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3502 {
3503 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3504
3505 GVariantBuilder builder;
3506 guint n;
3507 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3508 if (_fan_interface_info.parent_struct.properties == NULL)
3509 goto out;
3510 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3511 {
3512 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3513 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3514 {
3515 GVariant *value;
3516 value = _fan_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.Fan", info->name, NULL, skeleton);
3517 if (value != NULL)
3518 {
3519 g_variant_take_ref (value);
3520 g_variant_builder_add (&builder, "{sv}", info->name, value);
3521 g_variant_unref (value);
3522 }
3523 }
3524 }
3525 out:
3526 return g_variant_builder_end (&builder);
3527 }
3528
3529 static gboolean _fan_emit_changed (gpointer user_data);
3530
3531 static void
fan_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)3532 fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3533 {
3534 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3535 gboolean emit_changed = FALSE;
3536
3537 g_mutex_lock (&skeleton->priv->lock);
3538 if (skeleton->priv->changed_properties_idle_source != NULL)
3539 {
3540 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3541 skeleton->priv->changed_properties_idle_source = NULL;
3542 emit_changed = TRUE;
3543 }
3544 g_mutex_unlock (&skeleton->priv->lock);
3545
3546 if (emit_changed)
3547 _fan_emit_changed (skeleton);
3548 }
3549
3550 static void
_fan_on_signal_speed_changed(Fan * object,gint arg_speed)3551 _fan_on_signal_speed_changed (
3552 Fan *object,
3553 gint arg_speed)
3554 {
3555 FanSkeleton *skeleton = FAN_SKELETON (object);
3556
3557 GList *connections, *l;
3558 GVariant *signal_variant;
3559 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3560
3561 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3562 arg_speed));
3563 for (l = connections; l != NULL; l = l->next)
3564 {
3565 GDBusConnection *connection = l->data;
3566 g_dbus_connection_emit_signal (connection,
3567 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3568 signal_variant, NULL);
3569 }
3570 g_variant_unref (signal_variant);
3571 g_list_free_full (connections, g_object_unref);
3572 }
3573
3574 static void
_fan_on_signal_tach_error(Fan * object)3575 _fan_on_signal_tach_error (
3576 Fan *object)
3577 {
3578 FanSkeleton *skeleton = FAN_SKELETON (object);
3579
3580 GList *connections, *l;
3581 GVariant *signal_variant;
3582 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3583
3584 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3585 for (l = connections; l != NULL; l = l->next)
3586 {
3587 GDBusConnection *connection = l->data;
3588 g_dbus_connection_emit_signal (connection,
3589 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3590 signal_variant, NULL);
3591 }
3592 g_variant_unref (signal_variant);
3593 g_list_free_full (connections, g_object_unref);
3594 }
3595
3596 static void fan_skeleton_iface_init (FanIface *iface);
3597 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FanSkeleton,fan_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (FanSkeleton)G_IMPLEMENT_INTERFACE (TYPE_FAN,fan_skeleton_iface_init))3598 G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3599 G_ADD_PRIVATE (FanSkeleton)
3600 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init))
3601
3602 #else
3603 G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3604 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init))
3605
3606 #endif
3607 static void
3608 fan_skeleton_finalize (GObject *object)
3609 {
3610 FanSkeleton *skeleton = FAN_SKELETON (object);
3611 guint n;
3612 for (n = 0; n < 3; n++)
3613 g_value_unset (&skeleton->priv->properties[n]);
3614 g_free (skeleton->priv->properties);
3615 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3616 if (skeleton->priv->changed_properties_idle_source != NULL)
3617 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3618 g_main_context_unref (skeleton->priv->context);
3619 g_mutex_clear (&skeleton->priv->lock);
3620 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3621 }
3622
3623 static void
fan_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)3624 fan_skeleton_get_property (GObject *object,
3625 guint prop_id,
3626 GValue *value,
3627 GParamSpec *pspec G_GNUC_UNUSED)
3628 {
3629 FanSkeleton *skeleton = FAN_SKELETON (object);
3630 g_assert (prop_id != 0 && prop_id - 1 < 3);
3631 g_mutex_lock (&skeleton->priv->lock);
3632 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3633 g_mutex_unlock (&skeleton->priv->lock);
3634 }
3635
3636 static gboolean
_fan_emit_changed(gpointer user_data)3637 _fan_emit_changed (gpointer user_data)
3638 {
3639 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3640 GList *l;
3641 GVariantBuilder builder;
3642 GVariantBuilder invalidated_builder;
3643 guint num_changes;
3644
3645 g_mutex_lock (&skeleton->priv->lock);
3646 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3647 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3648 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3649 {
3650 ChangedProperty *cp = l->data;
3651 GVariant *variant;
3652 const GValue *cur_value;
3653
3654 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3655 if (!_g_value_equal (cur_value, &cp->orig_value))
3656 {
3657 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3658 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3659 g_variant_unref (variant);
3660 num_changes++;
3661 }
3662 }
3663 if (num_changes > 0)
3664 {
3665 GList *connections, *ll;
3666 GVariant *signal_variant;
3667 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3668 &builder, &invalidated_builder));
3669 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3670 for (ll = connections; ll != NULL; ll = ll->next)
3671 {
3672 GDBusConnection *connection = ll->data;
3673
3674 g_dbus_connection_emit_signal (connection,
3675 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3676 "org.freedesktop.DBus.Properties",
3677 "PropertiesChanged",
3678 signal_variant,
3679 NULL);
3680 }
3681 g_variant_unref (signal_variant);
3682 g_list_free_full (connections, g_object_unref);
3683 }
3684 else
3685 {
3686 g_variant_builder_clear (&builder);
3687 g_variant_builder_clear (&invalidated_builder);
3688 }
3689 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3690 skeleton->priv->changed_properties = NULL;
3691 skeleton->priv->changed_properties_idle_source = NULL;
3692 g_mutex_unlock (&skeleton->priv->lock);
3693 return FALSE;
3694 }
3695
3696 static void
_fan_schedule_emit_changed(FanSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)3697 _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3698 {
3699 ChangedProperty *cp;
3700 GList *l;
3701 cp = NULL;
3702 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3703 {
3704 ChangedProperty *i_cp = l->data;
3705 if (i_cp->info == info)
3706 {
3707 cp = i_cp;
3708 break;
3709 }
3710 }
3711 if (cp == NULL)
3712 {
3713 cp = g_new0 (ChangedProperty, 1);
3714 cp->prop_id = prop_id;
3715 cp->info = info;
3716 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3717 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3718 g_value_copy (orig_value, &cp->orig_value);
3719 }
3720 }
3721
3722 static void
fan_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)3723 fan_skeleton_notify (GObject *object,
3724 GParamSpec *pspec G_GNUC_UNUSED)
3725 {
3726 FanSkeleton *skeleton = FAN_SKELETON (object);
3727 g_mutex_lock (&skeleton->priv->lock);
3728 if (skeleton->priv->changed_properties != NULL &&
3729 skeleton->priv->changed_properties_idle_source == NULL)
3730 {
3731 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3732 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3733 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3734 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed");
3735 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3736 g_source_unref (skeleton->priv->changed_properties_idle_source);
3737 }
3738 g_mutex_unlock (&skeleton->priv->lock);
3739 }
3740
3741 static void
fan_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)3742 fan_skeleton_set_property (GObject *object,
3743 guint prop_id,
3744 const GValue *value,
3745 GParamSpec *pspec)
3746 {
3747 const _ExtendedGDBusPropertyInfo *info;
3748 FanSkeleton *skeleton = FAN_SKELETON (object);
3749 g_assert (prop_id != 0 && prop_id - 1 < 3);
3750 info = (const _ExtendedGDBusPropertyInfo *) _fan_property_info_pointers[prop_id - 1];
3751 g_mutex_lock (&skeleton->priv->lock);
3752 g_object_freeze_notify (object);
3753 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3754 {
3755 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
3756 info->emits_changed_signal)
3757 _fan_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
3758 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3759 g_object_notify_by_pspec (object, pspec);
3760 }
3761 g_mutex_unlock (&skeleton->priv->lock);
3762 g_object_thaw_notify (object);
3763 }
3764
3765 static void
fan_skeleton_init(FanSkeleton * skeleton)3766 fan_skeleton_init (FanSkeleton *skeleton)
3767 {
3768 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3769 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3770 #else
3771 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3772 #endif
3773
3774 g_mutex_init (&skeleton->priv->lock);
3775 skeleton->priv->context = g_main_context_ref_thread_default ();
3776 skeleton->priv->properties = g_new0 (GValue, 3);
3777 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3778 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3779 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3780 }
3781
3782 static gint
fan_skeleton_get_speed(Fan * object)3783 fan_skeleton_get_speed (Fan *object)
3784 {
3785 FanSkeleton *skeleton = FAN_SKELETON (object);
3786 gint value;
3787 g_mutex_lock (&skeleton->priv->lock);
3788 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
3789 g_mutex_unlock (&skeleton->priv->lock);
3790 return value;
3791 }
3792
3793 static gint
fan_skeleton_get_cooling_zone(Fan * object)3794 fan_skeleton_get_cooling_zone (Fan *object)
3795 {
3796 FanSkeleton *skeleton = FAN_SKELETON (object);
3797 gint value;
3798 g_mutex_lock (&skeleton->priv->lock);
3799 value = g_marshal_value_peek_int (&(skeleton->priv->properties[1]));
3800 g_mutex_unlock (&skeleton->priv->lock);
3801 return value;
3802 }
3803
3804 static gint
fan_skeleton_get_pwm_num(Fan * object)3805 fan_skeleton_get_pwm_num (Fan *object)
3806 {
3807 FanSkeleton *skeleton = FAN_SKELETON (object);
3808 gint value;
3809 g_mutex_lock (&skeleton->priv->lock);
3810 value = g_marshal_value_peek_int (&(skeleton->priv->properties[2]));
3811 g_mutex_unlock (&skeleton->priv->lock);
3812 return value;
3813 }
3814
3815 static void
fan_skeleton_class_init(FanSkeletonClass * klass)3816 fan_skeleton_class_init (FanSkeletonClass *klass)
3817 {
3818 GObjectClass *gobject_class;
3819 GDBusInterfaceSkeletonClass *skeleton_class;
3820
3821 gobject_class = G_OBJECT_CLASS (klass);
3822 gobject_class->finalize = fan_skeleton_finalize;
3823 gobject_class->get_property = fan_skeleton_get_property;
3824 gobject_class->set_property = fan_skeleton_set_property;
3825 gobject_class->notify = fan_skeleton_notify;
3826
3827
3828 fan_override_properties (gobject_class, 1);
3829
3830 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3831 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3832 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3833 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3834 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3835
3836 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3837 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3838 #endif
3839 }
3840
3841 static void
fan_skeleton_iface_init(FanIface * iface)3842 fan_skeleton_iface_init (FanIface *iface)
3843 {
3844 iface->speed_changed = _fan_on_signal_speed_changed;
3845 iface->tach_error = _fan_on_signal_tach_error;
3846 iface->get_speed = fan_skeleton_get_speed;
3847 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3848 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3849 }
3850
3851 /**
3852 * fan_skeleton_new:
3853 *
3854 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3855 *
3856 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3857 */
3858 Fan *
fan_skeleton_new(void)3859 fan_skeleton_new (void)
3860 {
3861 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3862 }
3863
3864 /* ------------------------------------------------------------------------
3865 * Code for interface org.openbmc.SensorValue
3866 * ------------------------------------------------------------------------
3867 */
3868
3869 /**
3870 * SECTION:SensorValue
3871 * @title: SensorValue
3872 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3873 *
3874 * 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.
3875 */
3876
3877 enum
3878 {
3879 _SENSOR_VALUE_CHANGED,
3880 _SENSOR_VALUE_ERROR,
3881 _SENSOR_VALUE_HEARTBEAT,
3882 };
3883
3884 static unsigned _SENSOR_VALUE_SIGNALS[3] = { 0 };
3885
3886 /* ---- Introspection data for org.openbmc.SensorValue ---- */
3887
3888 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3889 {
3890 {
3891 -1,
3892 (gchar *) "init",
3893 NULL,
3894 NULL,
3895 NULL
3896 },
3897 "handle-init",
3898 FALSE
3899 };
3900
3901 static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3902 {
3903 {
3904 -1,
3905 (gchar *) "value",
3906 (gchar *) "v",
3907 NULL
3908 },
3909 FALSE
3910 };
3911
3912 static const GDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3913 {
3914 &_sensor_value_method_info_get_value_OUT_ARG_value.parent_struct,
3915 NULL
3916 };
3917
3918 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3919 {
3920 {
3921 -1,
3922 (gchar *) "getValue",
3923 NULL,
3924 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3925 NULL
3926 },
3927 "handle-get-value",
3928 FALSE
3929 };
3930
3931 static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3932 {
3933 {
3934 -1,
3935 (gchar *) "value",
3936 (gchar *) "v",
3937 NULL
3938 },
3939 FALSE
3940 };
3941
3942 static const GDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3943 {
3944 &_sensor_value_method_info_set_value_IN_ARG_value.parent_struct,
3945 NULL
3946 };
3947
3948 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3949 {
3950 {
3951 -1,
3952 (gchar *) "setValue",
3953 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3954 NULL,
3955 NULL
3956 },
3957 "handle-set-value",
3958 FALSE
3959 };
3960
3961 static const GDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3962 {
3963 &_sensor_value_method_info_init.parent_struct,
3964 &_sensor_value_method_info_get_value.parent_struct,
3965 &_sensor_value_method_info_set_value.parent_struct,
3966 NULL
3967 };
3968
3969 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3970 {
3971 {
3972 -1,
3973 (gchar *) "value",
3974 (gchar *) "v",
3975 NULL
3976 },
3977 FALSE
3978 };
3979
3980 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3981 {
3982 {
3983 -1,
3984 (gchar *) "units",
3985 (gchar *) "s",
3986 NULL
3987 },
3988 FALSE
3989 };
3990
3991 static const GDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3992 {
3993 &_sensor_value_signal_info_changed_ARG_value.parent_struct,
3994 &_sensor_value_signal_info_changed_ARG_units.parent_struct,
3995 NULL
3996 };
3997
3998 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3999 {
4000 {
4001 -1,
4002 (gchar *) "Changed",
4003 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
4004 NULL
4005 },
4006 "changed"
4007 };
4008
4009 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
4010 {
4011 {
4012 -1,
4013 (gchar *) "Error",
4014 NULL,
4015 NULL
4016 },
4017 "error"
4018 };
4019
4020 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
4021 {
4022 {
4023 -1,
4024 (gchar *) "bus_name",
4025 (gchar *) "s",
4026 NULL
4027 },
4028 FALSE
4029 };
4030
4031 static const GDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
4032 {
4033 &_sensor_value_signal_info_heartbeat_ARG_bus_name.parent_struct,
4034 NULL
4035 };
4036
4037 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
4038 {
4039 {
4040 -1,
4041 (gchar *) "Heartbeat",
4042 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
4043 NULL
4044 },
4045 "heartbeat"
4046 };
4047
4048 static const GDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
4049 {
4050 &_sensor_value_signal_info_changed.parent_struct,
4051 &_sensor_value_signal_info_error.parent_struct,
4052 &_sensor_value_signal_info_heartbeat.parent_struct,
4053 NULL
4054 };
4055
4056 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
4057 {
4058 {
4059 -1,
4060 (gchar *) "value",
4061 (gchar *) "v",
4062 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4063 NULL
4064 },
4065 "value",
4066 FALSE,
4067 TRUE
4068 };
4069
4070 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
4071 {
4072 {
4073 -1,
4074 (gchar *) "units",
4075 (gchar *) "s",
4076 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4077 NULL
4078 },
4079 "units",
4080 FALSE,
4081 TRUE
4082 };
4083
4084 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
4085 {
4086 {
4087 -1,
4088 (gchar *) "poll_interval",
4089 (gchar *) "i",
4090 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4091 NULL
4092 },
4093 "poll-interval",
4094 FALSE,
4095 TRUE
4096 };
4097
4098 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
4099 {
4100 {
4101 -1,
4102 (gchar *) "heatbeat",
4103 (gchar *) "i",
4104 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4105 NULL
4106 },
4107 "heatbeat",
4108 FALSE,
4109 TRUE
4110 };
4111
4112 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
4113 {
4114 {
4115 -1,
4116 (gchar *) "settable",
4117 (gchar *) "b",
4118 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4119 NULL
4120 },
4121 "settable",
4122 FALSE,
4123 TRUE
4124 };
4125
4126 static const GDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
4127 {
4128 &_sensor_value_property_info_value.parent_struct,
4129 &_sensor_value_property_info_units.parent_struct,
4130 &_sensor_value_property_info_poll_interval.parent_struct,
4131 &_sensor_value_property_info_heatbeat.parent_struct,
4132 &_sensor_value_property_info_settable.parent_struct,
4133 NULL
4134 };
4135
4136 static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
4137 {
4138 {
4139 -1,
4140 (gchar *) "org.openbmc.SensorValue",
4141 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
4142 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
4143 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
4144 NULL
4145 },
4146 "sensor-value",
4147 };
4148
4149
4150 /**
4151 * sensor_value_interface_info:
4152 *
4153 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
4154 *
4155 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4156 */
4157 GDBusInterfaceInfo *
sensor_value_interface_info(void)4158 sensor_value_interface_info (void)
4159 {
4160 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
4161 }
4162
4163 /**
4164 * sensor_value_override_properties:
4165 * @klass: The class structure for a #GObject derived class.
4166 * @property_id_begin: The property id to assign to the first overridden property.
4167 *
4168 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
4169 * The properties are overridden in the order they are defined.
4170 *
4171 * Returns: The last property id.
4172 */
4173 guint
sensor_value_override_properties(GObjectClass * klass,guint property_id_begin)4174 sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
4175 {
4176 g_object_class_override_property (klass, property_id_begin++, "value");
4177 g_object_class_override_property (klass, property_id_begin++, "units");
4178 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
4179 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
4180 g_object_class_override_property (klass, property_id_begin++, "settable");
4181 return property_id_begin - 1;
4182 }
4183
4184
4185 inline static void
sensor_value_signal_marshal_changed(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4186 sensor_value_signal_marshal_changed (
4187 GClosure *closure,
4188 GValue *return_value,
4189 unsigned int n_param_values,
4190 const GValue *param_values,
4191 void *invocation_hint,
4192 void *marshal_data)
4193 {
4194 _g_dbus_codegen_marshal_VOID__VARIANT_STRING (closure,
4195 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4196 }
4197
4198 inline static void
sensor_value_signal_marshal_error(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4199 sensor_value_signal_marshal_error (
4200 GClosure *closure,
4201 GValue *return_value,
4202 unsigned int n_param_values,
4203 const GValue *param_values,
4204 void *invocation_hint,
4205 void *marshal_data)
4206 {
4207 g_cclosure_marshal_VOID__VOID (closure,
4208 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4209 }
4210
4211 inline static void
sensor_value_signal_marshal_heartbeat(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4212 sensor_value_signal_marshal_heartbeat (
4213 GClosure *closure,
4214 GValue *return_value,
4215 unsigned int n_param_values,
4216 const GValue *param_values,
4217 void *invocation_hint,
4218 void *marshal_data)
4219 {
4220 g_cclosure_marshal_VOID__STRING (closure,
4221 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4222 }
4223
4224 inline static void
sensor_value_method_marshal_init(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4225 sensor_value_method_marshal_init (
4226 GClosure *closure,
4227 GValue *return_value,
4228 unsigned int n_param_values,
4229 const GValue *param_values,
4230 void *invocation_hint,
4231 void *marshal_data)
4232 {
4233 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
4234 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4235 }
4236
4237 inline static void
sensor_value_method_marshal_get_value(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4238 sensor_value_method_marshal_get_value (
4239 GClosure *closure,
4240 GValue *return_value,
4241 unsigned int n_param_values,
4242 const GValue *param_values,
4243 void *invocation_hint,
4244 void *marshal_data)
4245 {
4246 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
4247 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4248 }
4249
4250 inline static void
sensor_value_method_marshal_set_value(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)4251 sensor_value_method_marshal_set_value (
4252 GClosure *closure,
4253 GValue *return_value,
4254 unsigned int n_param_values,
4255 const GValue *param_values,
4256 void *invocation_hint,
4257 void *marshal_data)
4258 {
4259 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (closure,
4260 return_value, n_param_values, param_values, invocation_hint, marshal_data);
4261 }
4262
4263
4264 /**
4265 * SensorValue:
4266 *
4267 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4268 */
4269
4270 /**
4271 * SensorValueIface:
4272 * @parent_iface: The parent interface.
4273 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
4274 * @handle_init: Handler for the #SensorValue::handle-init signal.
4275 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
4276 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
4277 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
4278 * @get_settable: Getter for the #SensorValue:settable property.
4279 * @get_units: Getter for the #SensorValue:units property.
4280 * @get_value: Getter for the #SensorValue:value property.
4281 * @changed: Handler for the #SensorValue::changed signal.
4282 * @error: Handler for the #SensorValue::error signal.
4283 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
4284 *
4285 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4286 */
4287
4288 typedef SensorValueIface SensorValueInterface;
G_DEFINE_INTERFACE(SensorValue,sensor_value,G_TYPE_OBJECT)4289 G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT)
4290
4291 static void
4292 sensor_value_default_init (SensorValueIface *iface)
4293 {
4294 /* GObject signals for incoming D-Bus method calls: */
4295 /**
4296 * SensorValue::handle-init:
4297 * @object: A #SensorValue.
4298 * @invocation: A #GDBusMethodInvocation.
4299 *
4300 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
4301 *
4302 * 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 other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4303 *
4304 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
4305 */
4306 g_signal_new ("handle-init",
4307 G_TYPE_FROM_INTERFACE (iface),
4308 G_SIGNAL_RUN_LAST,
4309 G_STRUCT_OFFSET (SensorValueIface, handle_init),
4310 g_signal_accumulator_true_handled,
4311 NULL,
4312 sensor_value_method_marshal_init,
4313 G_TYPE_BOOLEAN,
4314 1,
4315 G_TYPE_DBUS_METHOD_INVOCATION);
4316
4317 /**
4318 * SensorValue::handle-get-value:
4319 * @object: A #SensorValue.
4320 * @invocation: A #GDBusMethodInvocation.
4321 *
4322 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
4323 *
4324 * 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 other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4325 *
4326 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
4327 */
4328 g_signal_new ("handle-get-value",
4329 G_TYPE_FROM_INTERFACE (iface),
4330 G_SIGNAL_RUN_LAST,
4331 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
4332 g_signal_accumulator_true_handled,
4333 NULL,
4334 sensor_value_method_marshal_get_value,
4335 G_TYPE_BOOLEAN,
4336 1,
4337 G_TYPE_DBUS_METHOD_INVOCATION);
4338
4339 /**
4340 * SensorValue::handle-set-value:
4341 * @object: A #SensorValue.
4342 * @invocation: A #GDBusMethodInvocation.
4343 * @arg_value: Argument passed by remote caller.
4344 *
4345 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
4346 *
4347 * 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 other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4348 *
4349 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
4350 */
4351 g_signal_new ("handle-set-value",
4352 G_TYPE_FROM_INTERFACE (iface),
4353 G_SIGNAL_RUN_LAST,
4354 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
4355 g_signal_accumulator_true_handled,
4356 NULL,
4357 sensor_value_method_marshal_set_value,
4358 G_TYPE_BOOLEAN,
4359 2,
4360 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
4361
4362 /* GObject signals for received D-Bus signals: */
4363 /**
4364 * SensorValue::changed:
4365 * @object: A #SensorValue.
4366 * @arg_value: Argument.
4367 * @arg_units: Argument.
4368 *
4369 * 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.
4370 *
4371 * 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.
4372 */
4373 _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_CHANGED] =
4374 g_signal_new ("changed",
4375 G_TYPE_FROM_INTERFACE (iface),
4376 G_SIGNAL_RUN_LAST,
4377 G_STRUCT_OFFSET (SensorValueIface, changed),
4378 NULL,
4379 NULL,
4380 sensor_value_signal_marshal_changed,
4381 G_TYPE_NONE,
4382 2, G_TYPE_VARIANT, G_TYPE_STRING);
4383
4384 /**
4385 * SensorValue::error:
4386 * @object: A #SensorValue.
4387 *
4388 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> is received.
4389 *
4390 * 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.
4391 */
4392 _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_ERROR] =
4393 g_signal_new ("error",
4394 G_TYPE_FROM_INTERFACE (iface),
4395 G_SIGNAL_RUN_LAST,
4396 G_STRUCT_OFFSET (SensorValueIface, error),
4397 NULL,
4398 NULL,
4399 sensor_value_signal_marshal_error,
4400 G_TYPE_NONE,
4401 0);
4402
4403 /**
4404 * SensorValue::heartbeat:
4405 * @object: A #SensorValue.
4406 * @arg_bus_name: Argument.
4407 *
4408 * 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.
4409 *
4410 * 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.
4411 */
4412 _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_HEARTBEAT] =
4413 g_signal_new ("heartbeat",
4414 G_TYPE_FROM_INTERFACE (iface),
4415 G_SIGNAL_RUN_LAST,
4416 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4417 NULL,
4418 NULL,
4419 sensor_value_signal_marshal_heartbeat,
4420 G_TYPE_NONE,
4421 1, G_TYPE_STRING);
4422
4423 /* GObject properties for D-Bus properties: */
4424 /**
4425 * SensorValue:value:
4426 *
4427 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4428 *
4429 * 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.
4430 */
4431 g_object_interface_install_property (iface,
4432 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4433 /**
4434 * SensorValue:units:
4435 *
4436 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4437 *
4438 * 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.
4439 */
4440 g_object_interface_install_property (iface,
4441 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4442 /**
4443 * SensorValue:poll-interval:
4444 *
4445 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4446 *
4447 * 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.
4448 */
4449 g_object_interface_install_property (iface,
4450 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4451 /**
4452 * SensorValue:heatbeat:
4453 *
4454 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4455 *
4456 * 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.
4457 */
4458 g_object_interface_install_property (iface,
4459 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4460 /**
4461 * SensorValue:settable:
4462 *
4463 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4464 *
4465 * 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.
4466 */
4467 g_object_interface_install_property (iface,
4468 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4469 }
4470
4471 /**
4472 * sensor_value_get_value: (skip)
4473 * @object: A #SensorValue.
4474 *
4475 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4476 *
4477 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4478 *
4479 * 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.
4480 *
4481 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4482 */
4483 GVariant *
sensor_value_get_value(SensorValue * object)4484 sensor_value_get_value (SensorValue *object)
4485 {
4486 g_return_val_if_fail (IS_SENSOR_VALUE (object), NULL);
4487
4488 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4489 }
4490
4491 /**
4492 * sensor_value_dup_value: (skip)
4493 * @object: A #SensorValue.
4494 *
4495 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4496 *
4497 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4498 *
4499 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4500 */
4501 GVariant *
sensor_value_dup_value(SensorValue * object)4502 sensor_value_dup_value (SensorValue *object)
4503 {
4504 GVariant *value;
4505 g_object_get (G_OBJECT (object), "value", &value, NULL);
4506 return value;
4507 }
4508
4509 /**
4510 * sensor_value_set_value: (skip)
4511 * @object: A #SensorValue.
4512 * @value: The value to set.
4513 *
4514 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4515 *
4516 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4517 */
4518 void
sensor_value_set_value(SensorValue * object,GVariant * value)4519 sensor_value_set_value (SensorValue *object, GVariant *value)
4520 {
4521 g_object_set (G_OBJECT (object), "value", value, NULL);
4522 }
4523
4524 /**
4525 * sensor_value_get_units: (skip)
4526 * @object: A #SensorValue.
4527 *
4528 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4529 *
4530 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4531 *
4532 * 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.
4533 *
4534 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4535 */
4536 const gchar *
sensor_value_get_units(SensorValue * object)4537 sensor_value_get_units (SensorValue *object)
4538 {
4539 g_return_val_if_fail (IS_SENSOR_VALUE (object), NULL);
4540
4541 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4542 }
4543
4544 /**
4545 * sensor_value_dup_units: (skip)
4546 * @object: A #SensorValue.
4547 *
4548 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4549 *
4550 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4551 *
4552 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4553 */
4554 gchar *
sensor_value_dup_units(SensorValue * object)4555 sensor_value_dup_units (SensorValue *object)
4556 {
4557 gchar *value;
4558 g_object_get (G_OBJECT (object), "units", &value, NULL);
4559 return value;
4560 }
4561
4562 /**
4563 * sensor_value_set_units: (skip)
4564 * @object: A #SensorValue.
4565 * @value: The value to set.
4566 *
4567 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4568 *
4569 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4570 */
4571 void
sensor_value_set_units(SensorValue * object,const gchar * value)4572 sensor_value_set_units (SensorValue *object, const gchar *value)
4573 {
4574 g_object_set (G_OBJECT (object), "units", value, NULL);
4575 }
4576
4577 /**
4578 * sensor_value_get_poll_interval: (skip)
4579 * @object: A #SensorValue.
4580 *
4581 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4582 *
4583 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4584 *
4585 * Returns: The property value.
4586 */
4587 gint
sensor_value_get_poll_interval(SensorValue * object)4588 sensor_value_get_poll_interval (SensorValue *object)
4589 {
4590 g_return_val_if_fail (IS_SENSOR_VALUE (object), 0);
4591
4592 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4593 }
4594
4595 /**
4596 * sensor_value_set_poll_interval: (skip)
4597 * @object: A #SensorValue.
4598 * @value: The value to set.
4599 *
4600 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4601 *
4602 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4603 */
4604 void
sensor_value_set_poll_interval(SensorValue * object,gint value)4605 sensor_value_set_poll_interval (SensorValue *object, gint value)
4606 {
4607 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4608 }
4609
4610 /**
4611 * sensor_value_get_heatbeat: (skip)
4612 * @object: A #SensorValue.
4613 *
4614 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4615 *
4616 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4617 *
4618 * Returns: The property value.
4619 */
4620 gint
sensor_value_get_heatbeat(SensorValue * object)4621 sensor_value_get_heatbeat (SensorValue *object)
4622 {
4623 g_return_val_if_fail (IS_SENSOR_VALUE (object), 0);
4624
4625 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4626 }
4627
4628 /**
4629 * sensor_value_set_heatbeat: (skip)
4630 * @object: A #SensorValue.
4631 * @value: The value to set.
4632 *
4633 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4634 *
4635 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4636 */
4637 void
sensor_value_set_heatbeat(SensorValue * object,gint value)4638 sensor_value_set_heatbeat (SensorValue *object, gint value)
4639 {
4640 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4641 }
4642
4643 /**
4644 * sensor_value_get_settable: (skip)
4645 * @object: A #SensorValue.
4646 *
4647 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4648 *
4649 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4650 *
4651 * Returns: The property value.
4652 */
4653 gboolean
sensor_value_get_settable(SensorValue * object)4654 sensor_value_get_settable (SensorValue *object)
4655 {
4656 g_return_val_if_fail (IS_SENSOR_VALUE (object), FALSE);
4657
4658 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4659 }
4660
4661 /**
4662 * sensor_value_set_settable: (skip)
4663 * @object: A #SensorValue.
4664 * @value: The value to set.
4665 *
4666 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4667 *
4668 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4669 */
4670 void
sensor_value_set_settable(SensorValue * object,gboolean value)4671 sensor_value_set_settable (SensorValue *object, gboolean value)
4672 {
4673 g_object_set (G_OBJECT (object), "settable", value, NULL);
4674 }
4675
4676 /**
4677 * sensor_value_emit_changed:
4678 * @object: A #SensorValue.
4679 * @arg_value: Argument to pass with the signal.
4680 * @arg_units: Argument to pass with the signal.
4681 *
4682 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4683 */
4684 void
sensor_value_emit_changed(SensorValue * object,GVariant * arg_value,const gchar * arg_units)4685 sensor_value_emit_changed (
4686 SensorValue *object,
4687 GVariant *arg_value,
4688 const gchar *arg_units)
4689 {
4690 g_signal_emit (object, _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_CHANGED], 0, arg_value, arg_units);
4691 }
4692
4693 /**
4694 * sensor_value_emit_error:
4695 * @object: A #SensorValue.
4696 *
4697 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4698 */
4699 void
sensor_value_emit_error(SensorValue * object)4700 sensor_value_emit_error (
4701 SensorValue *object)
4702 {
4703 g_signal_emit (object, _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_ERROR], 0);
4704 }
4705
4706 /**
4707 * sensor_value_emit_heartbeat:
4708 * @object: A #SensorValue.
4709 * @arg_bus_name: Argument to pass with the signal.
4710 *
4711 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4712 */
4713 void
sensor_value_emit_heartbeat(SensorValue * object,const gchar * arg_bus_name)4714 sensor_value_emit_heartbeat (
4715 SensorValue *object,
4716 const gchar *arg_bus_name)
4717 {
4718 g_signal_emit (object, _SENSOR_VALUE_SIGNALS[_SENSOR_VALUE_HEARTBEAT], 0, arg_bus_name);
4719 }
4720
4721 /**
4722 * sensor_value_call_init:
4723 * @proxy: A #SensorValueProxy.
4724 * @cancellable: (nullable): A #GCancellable or %NULL.
4725 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4726 * @user_data: User data to pass to @callback.
4727 *
4728 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4729 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
4730 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4731 *
4732 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4733 */
4734 void
sensor_value_call_init(SensorValue * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4735 sensor_value_call_init (
4736 SensorValue *proxy,
4737 GCancellable *cancellable,
4738 GAsyncReadyCallback callback,
4739 gpointer user_data)
4740 {
4741 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4742 "init",
4743 g_variant_new ("()"),
4744 G_DBUS_CALL_FLAGS_NONE,
4745 -1,
4746 cancellable,
4747 callback,
4748 user_data);
4749 }
4750
4751 /**
4752 * sensor_value_call_init_finish:
4753 * @proxy: A #SensorValueProxy.
4754 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4755 * @error: Return location for error or %NULL.
4756 *
4757 * Finishes an operation started with sensor_value_call_init().
4758 *
4759 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4760 */
4761 gboolean
sensor_value_call_init_finish(SensorValue * proxy,GAsyncResult * res,GError ** error)4762 sensor_value_call_init_finish (
4763 SensorValue *proxy,
4764 GAsyncResult *res,
4765 GError **error)
4766 {
4767 GVariant *_ret;
4768 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4769 if (_ret == NULL)
4770 goto _out;
4771 g_variant_get (_ret,
4772 "()");
4773 g_variant_unref (_ret);
4774 _out:
4775 return _ret != NULL;
4776 }
4777
4778 /**
4779 * sensor_value_call_init_sync:
4780 * @proxy: A #SensorValueProxy.
4781 * @cancellable: (nullable): A #GCancellable or %NULL.
4782 * @error: Return location for error or %NULL.
4783 *
4784 * 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.
4785 *
4786 * See sensor_value_call_init() for the asynchronous version of this method.
4787 *
4788 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4789 */
4790 gboolean
sensor_value_call_init_sync(SensorValue * proxy,GCancellable * cancellable,GError ** error)4791 sensor_value_call_init_sync (
4792 SensorValue *proxy,
4793 GCancellable *cancellable,
4794 GError **error)
4795 {
4796 GVariant *_ret;
4797 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4798 "init",
4799 g_variant_new ("()"),
4800 G_DBUS_CALL_FLAGS_NONE,
4801 -1,
4802 cancellable,
4803 error);
4804 if (_ret == NULL)
4805 goto _out;
4806 g_variant_get (_ret,
4807 "()");
4808 g_variant_unref (_ret);
4809 _out:
4810 return _ret != NULL;
4811 }
4812
4813 /**
4814 * sensor_value_call_get_value:
4815 * @proxy: A #SensorValueProxy.
4816 * @cancellable: (nullable): A #GCancellable or %NULL.
4817 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4818 * @user_data: User data to pass to @callback.
4819 *
4820 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4821 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
4822 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4823 *
4824 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4825 */
4826 void
sensor_value_call_get_value(SensorValue * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4827 sensor_value_call_get_value (
4828 SensorValue *proxy,
4829 GCancellable *cancellable,
4830 GAsyncReadyCallback callback,
4831 gpointer user_data)
4832 {
4833 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4834 "getValue",
4835 g_variant_new ("()"),
4836 G_DBUS_CALL_FLAGS_NONE,
4837 -1,
4838 cancellable,
4839 callback,
4840 user_data);
4841 }
4842
4843 /**
4844 * sensor_value_call_get_value_finish:
4845 * @proxy: A #SensorValueProxy.
4846 * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore.
4847 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4848 * @error: Return location for error or %NULL.
4849 *
4850 * Finishes an operation started with sensor_value_call_get_value().
4851 *
4852 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4853 */
4854 gboolean
sensor_value_call_get_value_finish(SensorValue * proxy,GVariant ** out_value,GAsyncResult * res,GError ** error)4855 sensor_value_call_get_value_finish (
4856 SensorValue *proxy,
4857 GVariant **out_value,
4858 GAsyncResult *res,
4859 GError **error)
4860 {
4861 GVariant *_ret;
4862 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4863 if (_ret == NULL)
4864 goto _out;
4865 g_variant_get (_ret,
4866 "(@v)",
4867 out_value);
4868 g_variant_unref (_ret);
4869 _out:
4870 return _ret != NULL;
4871 }
4872
4873 /**
4874 * sensor_value_call_get_value_sync:
4875 * @proxy: A #SensorValueProxy.
4876 * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore.
4877 * @cancellable: (nullable): A #GCancellable or %NULL.
4878 * @error: Return location for error or %NULL.
4879 *
4880 * 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.
4881 *
4882 * See sensor_value_call_get_value() for the asynchronous version of this method.
4883 *
4884 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4885 */
4886 gboolean
sensor_value_call_get_value_sync(SensorValue * proxy,GVariant ** out_value,GCancellable * cancellable,GError ** error)4887 sensor_value_call_get_value_sync (
4888 SensorValue *proxy,
4889 GVariant **out_value,
4890 GCancellable *cancellable,
4891 GError **error)
4892 {
4893 GVariant *_ret;
4894 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4895 "getValue",
4896 g_variant_new ("()"),
4897 G_DBUS_CALL_FLAGS_NONE,
4898 -1,
4899 cancellable,
4900 error);
4901 if (_ret == NULL)
4902 goto _out;
4903 g_variant_get (_ret,
4904 "(@v)",
4905 out_value);
4906 g_variant_unref (_ret);
4907 _out:
4908 return _ret != NULL;
4909 }
4910
4911 /**
4912 * sensor_value_call_set_value:
4913 * @proxy: A #SensorValueProxy.
4914 * @arg_value: Argument to pass with the method invocation.
4915 * @cancellable: (nullable): A #GCancellable or %NULL.
4916 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4917 * @user_data: User data to pass to @callback.
4918 *
4919 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4920 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
4921 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4922 *
4923 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4924 */
4925 void
sensor_value_call_set_value(SensorValue * proxy,GVariant * arg_value,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4926 sensor_value_call_set_value (
4927 SensorValue *proxy,
4928 GVariant *arg_value,
4929 GCancellable *cancellable,
4930 GAsyncReadyCallback callback,
4931 gpointer user_data)
4932 {
4933 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4934 "setValue",
4935 g_variant_new ("(@v)",
4936 arg_value),
4937 G_DBUS_CALL_FLAGS_NONE,
4938 -1,
4939 cancellable,
4940 callback,
4941 user_data);
4942 }
4943
4944 /**
4945 * sensor_value_call_set_value_finish:
4946 * @proxy: A #SensorValueProxy.
4947 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4948 * @error: Return location for error or %NULL.
4949 *
4950 * Finishes an operation started with sensor_value_call_set_value().
4951 *
4952 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4953 */
4954 gboolean
sensor_value_call_set_value_finish(SensorValue * proxy,GAsyncResult * res,GError ** error)4955 sensor_value_call_set_value_finish (
4956 SensorValue *proxy,
4957 GAsyncResult *res,
4958 GError **error)
4959 {
4960 GVariant *_ret;
4961 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4962 if (_ret == NULL)
4963 goto _out;
4964 g_variant_get (_ret,
4965 "()");
4966 g_variant_unref (_ret);
4967 _out:
4968 return _ret != NULL;
4969 }
4970
4971 /**
4972 * sensor_value_call_set_value_sync:
4973 * @proxy: A #SensorValueProxy.
4974 * @arg_value: Argument to pass with the method invocation.
4975 * @cancellable: (nullable): A #GCancellable or %NULL.
4976 * @error: Return location for error or %NULL.
4977 *
4978 * 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.
4979 *
4980 * See sensor_value_call_set_value() for the asynchronous version of this method.
4981 *
4982 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4983 */
4984 gboolean
sensor_value_call_set_value_sync(SensorValue * proxy,GVariant * arg_value,GCancellable * cancellable,GError ** error)4985 sensor_value_call_set_value_sync (
4986 SensorValue *proxy,
4987 GVariant *arg_value,
4988 GCancellable *cancellable,
4989 GError **error)
4990 {
4991 GVariant *_ret;
4992 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4993 "setValue",
4994 g_variant_new ("(@v)",
4995 arg_value),
4996 G_DBUS_CALL_FLAGS_NONE,
4997 -1,
4998 cancellable,
4999 error);
5000 if (_ret == NULL)
5001 goto _out;
5002 g_variant_get (_ret,
5003 "()");
5004 g_variant_unref (_ret);
5005 _out:
5006 return _ret != NULL;
5007 }
5008
5009 /**
5010 * sensor_value_complete_init:
5011 * @object: A #SensorValue.
5012 * @invocation: (transfer full): A #GDBusMethodInvocation.
5013 *
5014 * 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.
5015 *
5016 * This method will free @invocation, you cannot use it afterwards.
5017 */
5018 void
sensor_value_complete_init(SensorValue * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)5019 sensor_value_complete_init (
5020 SensorValue *object G_GNUC_UNUSED,
5021 GDBusMethodInvocation *invocation)
5022 {
5023 g_dbus_method_invocation_return_value (invocation,
5024 g_variant_new ("()"));
5025 }
5026
5027 /**
5028 * sensor_value_complete_get_value:
5029 * @object: A #SensorValue.
5030 * @invocation: (transfer full): A #GDBusMethodInvocation.
5031 * @value: Parameter to return.
5032 *
5033 * 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.
5034 *
5035 * This method will free @invocation, you cannot use it afterwards.
5036 */
5037 void
sensor_value_complete_get_value(SensorValue * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * value)5038 sensor_value_complete_get_value (
5039 SensorValue *object G_GNUC_UNUSED,
5040 GDBusMethodInvocation *invocation,
5041 GVariant *value)
5042 {
5043 g_dbus_method_invocation_return_value (invocation,
5044 g_variant_new ("(@v)",
5045 value));
5046 }
5047
5048 /**
5049 * sensor_value_complete_set_value:
5050 * @object: A #SensorValue.
5051 * @invocation: (transfer full): A #GDBusMethodInvocation.
5052 *
5053 * 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.
5054 *
5055 * This method will free @invocation, you cannot use it afterwards.
5056 */
5057 void
sensor_value_complete_set_value(SensorValue * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)5058 sensor_value_complete_set_value (
5059 SensorValue *object G_GNUC_UNUSED,
5060 GDBusMethodInvocation *invocation)
5061 {
5062 g_dbus_method_invocation_return_value (invocation,
5063 g_variant_new ("()"));
5064 }
5065
5066 /* ------------------------------------------------------------------------ */
5067
5068 /**
5069 * SensorValueProxy:
5070 *
5071 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
5072 */
5073
5074 /**
5075 * SensorValueProxyClass:
5076 * @parent_class: The parent class.
5077 *
5078 * Class structure for #SensorValueProxy.
5079 */
5080
5081 struct _SensorValueProxyPrivate
5082 {
5083 GData *qdata;
5084 };
5085
5086 static void sensor_value_proxy_iface_init (SensorValueIface *iface);
5087
5088 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorValueProxy,sensor_value_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SensorValueProxy)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE,sensor_value_proxy_iface_init))5089 G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5090 G_ADD_PRIVATE (SensorValueProxy)
5091 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init))
5092
5093 #else
5094 G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5095 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init))
5096
5097 #endif
5098 static void
5099 sensor_value_proxy_finalize (GObject *object)
5100 {
5101 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5102 g_datalist_clear (&proxy->priv->qdata);
5103 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
5104 }
5105
5106 static void
sensor_value_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5107 sensor_value_proxy_get_property (GObject *object,
5108 guint prop_id,
5109 GValue *value,
5110 GParamSpec *pspec G_GNUC_UNUSED)
5111 {
5112 const _ExtendedGDBusPropertyInfo *info;
5113 GVariant *variant;
5114 g_assert (prop_id != 0 && prop_id - 1 < 5);
5115 info = (const _ExtendedGDBusPropertyInfo *) _sensor_value_property_info_pointers[prop_id - 1];
5116 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5117 if (info->use_gvariant)
5118 {
5119 g_value_set_variant (value, variant);
5120 }
5121 else
5122 {
5123 if (variant != NULL)
5124 g_dbus_gvariant_to_gvalue (variant, value);
5125 }
5126 if (variant != NULL)
5127 g_variant_unref (variant);
5128 }
5129
5130 static void
sensor_value_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)5131 sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
5132 GAsyncResult *res,
5133 gpointer user_data)
5134 {
5135 const _ExtendedGDBusPropertyInfo *info = user_data;
5136 GError *error;
5137 GVariant *_ret;
5138 error = NULL;
5139 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5140 if (!_ret)
5141 {
5142 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
5143 info->parent_struct.name,
5144 error->message, g_quark_to_string (error->domain), error->code);
5145 g_error_free (error);
5146 }
5147 else
5148 {
5149 g_variant_unref (_ret);
5150 }
5151 }
5152
5153 static void
sensor_value_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5154 sensor_value_proxy_set_property (GObject *object,
5155 guint prop_id,
5156 const GValue *value,
5157 GParamSpec *pspec G_GNUC_UNUSED)
5158 {
5159 const _ExtendedGDBusPropertyInfo *info;
5160 GVariant *variant;
5161 g_assert (prop_id != 0 && prop_id - 1 < 5);
5162 info = (const _ExtendedGDBusPropertyInfo *) _sensor_value_property_info_pointers[prop_id - 1];
5163 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5164 g_dbus_proxy_call (G_DBUS_PROXY (object),
5165 "org.freedesktop.DBus.Properties.Set",
5166 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
5167 G_DBUS_CALL_FLAGS_NONE,
5168 -1,
5169 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5170 g_variant_unref (variant);
5171 }
5172
5173 static void
sensor_value_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)5174 sensor_value_proxy_g_signal (GDBusProxy *proxy,
5175 const gchar *sender_name G_GNUC_UNUSED,
5176 const gchar *signal_name,
5177 GVariant *parameters)
5178 {
5179 _ExtendedGDBusSignalInfo *info;
5180 GVariantIter iter;
5181 GVariant *child;
5182 GValue *paramv;
5183 gsize num_params;
5184 gsize n;
5185 guint signal_id;
5186 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
5187 if (info == NULL)
5188 return;
5189 num_params = g_variant_n_children (parameters);
5190 paramv = g_new0 (GValue, num_params + 1);
5191 g_value_init (¶mv[0], TYPE_SENSOR_VALUE);
5192 g_value_set_object (¶mv[0], proxy);
5193 g_variant_iter_init (&iter, parameters);
5194 n = 1;
5195 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5196 {
5197 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5198 if (arg_info->use_gvariant)
5199 {
5200 g_value_init (¶mv[n], G_TYPE_VARIANT);
5201 g_value_set_variant (¶mv[n], child);
5202 n++;
5203 }
5204 else
5205 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
5206 g_variant_unref (child);
5207 }
5208 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5209 g_signal_emitv (paramv, signal_id, 0, NULL);
5210 for (n = 0; n < num_params + 1; n++)
5211 g_value_unset (¶mv[n]);
5212 g_free (paramv);
5213 }
5214
5215 static void
sensor_value_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)5216 sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
5217 GVariant *changed_properties,
5218 const gchar *const *invalidated_properties)
5219 {
5220 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
5221 guint n;
5222 const gchar *key;
5223 GVariantIter *iter;
5224 _ExtendedGDBusPropertyInfo *info;
5225 g_variant_get (changed_properties, "a{sv}", &iter);
5226 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5227 {
5228 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
5229 g_datalist_remove_data (&proxy->priv->qdata, key);
5230 if (info != NULL)
5231 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5232 }
5233 g_variant_iter_free (iter);
5234 for (n = 0; invalidated_properties[n] != NULL; n++)
5235 {
5236 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
5237 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5238 if (info != NULL)
5239 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5240 }
5241 }
5242
5243 static GVariant *
sensor_value_proxy_get_value(SensorValue * object)5244 sensor_value_proxy_get_value (SensorValue *object)
5245 {
5246 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5247 GVariant *variant;
5248 GVariant *value = NULL;
5249 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
5250 value = variant;
5251 if (variant != NULL)
5252 g_variant_unref (variant);
5253 return value;
5254 }
5255
5256 static const gchar *
sensor_value_proxy_get_units(SensorValue * object)5257 sensor_value_proxy_get_units (SensorValue *object)
5258 {
5259 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5260 GVariant *variant;
5261 const gchar *value = NULL;
5262 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
5263 if (variant != NULL)
5264 {
5265 value = g_variant_get_string (variant, NULL);
5266 g_variant_unref (variant);
5267 }
5268 return value;
5269 }
5270
5271 static gint
sensor_value_proxy_get_poll_interval(SensorValue * object)5272 sensor_value_proxy_get_poll_interval (SensorValue *object)
5273 {
5274 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5275 GVariant *variant;
5276 gint value = 0;
5277 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
5278 if (variant != NULL)
5279 {
5280 value = g_variant_get_int32 (variant);
5281 g_variant_unref (variant);
5282 }
5283 return value;
5284 }
5285
5286 static gint
sensor_value_proxy_get_heatbeat(SensorValue * object)5287 sensor_value_proxy_get_heatbeat (SensorValue *object)
5288 {
5289 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5290 GVariant *variant;
5291 gint value = 0;
5292 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
5293 if (variant != NULL)
5294 {
5295 value = g_variant_get_int32 (variant);
5296 g_variant_unref (variant);
5297 }
5298 return value;
5299 }
5300
5301 static gboolean
sensor_value_proxy_get_settable(SensorValue * object)5302 sensor_value_proxy_get_settable (SensorValue *object)
5303 {
5304 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5305 GVariant *variant;
5306 gboolean value = FALSE;
5307 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
5308 if (variant != NULL)
5309 {
5310 value = g_variant_get_boolean (variant);
5311 g_variant_unref (variant);
5312 }
5313 return value;
5314 }
5315
5316 static void
sensor_value_proxy_init(SensorValueProxy * proxy)5317 sensor_value_proxy_init (SensorValueProxy *proxy)
5318 {
5319 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5320 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
5321 #else
5322 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
5323 #endif
5324
5325 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
5326 }
5327
5328 static void
sensor_value_proxy_class_init(SensorValueProxyClass * klass)5329 sensor_value_proxy_class_init (SensorValueProxyClass *klass)
5330 {
5331 GObjectClass *gobject_class;
5332 GDBusProxyClass *proxy_class;
5333
5334 gobject_class = G_OBJECT_CLASS (klass);
5335 gobject_class->finalize = sensor_value_proxy_finalize;
5336 gobject_class->get_property = sensor_value_proxy_get_property;
5337 gobject_class->set_property = sensor_value_proxy_set_property;
5338
5339 proxy_class = G_DBUS_PROXY_CLASS (klass);
5340 proxy_class->g_signal = sensor_value_proxy_g_signal;
5341 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
5342
5343 sensor_value_override_properties (gobject_class, 1);
5344
5345 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5346 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
5347 #endif
5348 }
5349
5350 static void
sensor_value_proxy_iface_init(SensorValueIface * iface)5351 sensor_value_proxy_iface_init (SensorValueIface *iface)
5352 {
5353 iface->get_value = sensor_value_proxy_get_value;
5354 iface->get_units = sensor_value_proxy_get_units;
5355 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
5356 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
5357 iface->get_settable = sensor_value_proxy_get_settable;
5358 }
5359
5360 /**
5361 * sensor_value_proxy_new:
5362 * @connection: A #GDBusConnection.
5363 * @flags: Flags from the #GDBusProxyFlags enumeration.
5364 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5365 * @object_path: An object path.
5366 * @cancellable: (nullable): A #GCancellable or %NULL.
5367 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5368 * @user_data: User data to pass to @callback.
5369 *
5370 * 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.
5371 *
5372 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
5373 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
5374 *
5375 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
5376 */
5377 void
sensor_value_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)5378 sensor_value_proxy_new (
5379 GDBusConnection *connection,
5380 GDBusProxyFlags flags,
5381 const gchar *name,
5382 const gchar *object_path,
5383 GCancellable *cancellable,
5384 GAsyncReadyCallback callback,
5385 gpointer user_data)
5386 {
5387 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);
5388 }
5389
5390 /**
5391 * sensor_value_proxy_new_finish:
5392 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
5393 * @error: Return location for error or %NULL
5394 *
5395 * Finishes an operation started with sensor_value_proxy_new().
5396 *
5397 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5398 */
5399 SensorValue *
sensor_value_proxy_new_finish(GAsyncResult * res,GError ** error)5400 sensor_value_proxy_new_finish (
5401 GAsyncResult *res,
5402 GError **error)
5403 {
5404 GObject *ret;
5405 GObject *source_object;
5406 source_object = g_async_result_get_source_object (res);
5407 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5408 g_object_unref (source_object);
5409 if (ret != NULL)
5410 return SENSOR_VALUE (ret);
5411 else
5412 return NULL;
5413 }
5414
5415 /**
5416 * sensor_value_proxy_new_sync:
5417 * @connection: A #GDBusConnection.
5418 * @flags: Flags from the #GDBusProxyFlags enumeration.
5419 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5420 * @object_path: An object path.
5421 * @cancellable: (nullable): A #GCancellable or %NULL.
5422 * @error: Return location for error or %NULL
5423 *
5424 * 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.
5425 *
5426 * The calling thread is blocked until a reply is received.
5427 *
5428 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5429 *
5430 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5431 */
5432 SensorValue *
sensor_value_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)5433 sensor_value_proxy_new_sync (
5434 GDBusConnection *connection,
5435 GDBusProxyFlags flags,
5436 const gchar *name,
5437 const gchar *object_path,
5438 GCancellable *cancellable,
5439 GError **error)
5440 {
5441 GInitable *ret;
5442 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);
5443 if (ret != NULL)
5444 return SENSOR_VALUE (ret);
5445 else
5446 return NULL;
5447 }
5448
5449
5450 /**
5451 * sensor_value_proxy_new_for_bus:
5452 * @bus_type: A #GBusType.
5453 * @flags: Flags from the #GDBusProxyFlags enumeration.
5454 * @name: A bus name (well-known or unique).
5455 * @object_path: An object path.
5456 * @cancellable: (nullable): A #GCancellable or %NULL.
5457 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5458 * @user_data: User data to pass to @callback.
5459 *
5460 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5461 *
5462 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
5463 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5464 *
5465 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5466 */
5467 void
sensor_value_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)5468 sensor_value_proxy_new_for_bus (
5469 GBusType bus_type,
5470 GDBusProxyFlags flags,
5471 const gchar *name,
5472 const gchar *object_path,
5473 GCancellable *cancellable,
5474 GAsyncReadyCallback callback,
5475 gpointer user_data)
5476 {
5477 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);
5478 }
5479
5480 /**
5481 * sensor_value_proxy_new_for_bus_finish:
5482 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5483 * @error: Return location for error or %NULL
5484 *
5485 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5486 *
5487 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5488 */
5489 SensorValue *
sensor_value_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)5490 sensor_value_proxy_new_for_bus_finish (
5491 GAsyncResult *res,
5492 GError **error)
5493 {
5494 GObject *ret;
5495 GObject *source_object;
5496 source_object = g_async_result_get_source_object (res);
5497 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5498 g_object_unref (source_object);
5499 if (ret != NULL)
5500 return SENSOR_VALUE (ret);
5501 else
5502 return NULL;
5503 }
5504
5505 /**
5506 * sensor_value_proxy_new_for_bus_sync:
5507 * @bus_type: A #GBusType.
5508 * @flags: Flags from the #GDBusProxyFlags enumeration.
5509 * @name: A bus name (well-known or unique).
5510 * @object_path: An object path.
5511 * @cancellable: (nullable): A #GCancellable or %NULL.
5512 * @error: Return location for error or %NULL
5513 *
5514 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5515 *
5516 * The calling thread is blocked until a reply is received.
5517 *
5518 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5519 *
5520 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5521 */
5522 SensorValue *
sensor_value_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)5523 sensor_value_proxy_new_for_bus_sync (
5524 GBusType bus_type,
5525 GDBusProxyFlags flags,
5526 const gchar *name,
5527 const gchar *object_path,
5528 GCancellable *cancellable,
5529 GError **error)
5530 {
5531 GInitable *ret;
5532 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);
5533 if (ret != NULL)
5534 return SENSOR_VALUE (ret);
5535 else
5536 return NULL;
5537 }
5538
5539
5540 /* ------------------------------------------------------------------------ */
5541
5542 /**
5543 * SensorValueSkeleton:
5544 *
5545 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5546 */
5547
5548 /**
5549 * SensorValueSkeletonClass:
5550 * @parent_class: The parent class.
5551 *
5552 * Class structure for #SensorValueSkeleton.
5553 */
5554
5555 struct _SensorValueSkeletonPrivate
5556 {
5557 GValue *properties;
5558 GList *changed_properties;
5559 GSource *changed_properties_idle_source;
5560 GMainContext *context;
5561 GMutex lock;
5562 };
5563
5564 static void
_sensor_value_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)5565 _sensor_value_skeleton_handle_method_call (
5566 GDBusConnection *connection G_GNUC_UNUSED,
5567 const gchar *sender G_GNUC_UNUSED,
5568 const gchar *object_path G_GNUC_UNUSED,
5569 const gchar *interface_name,
5570 const gchar *method_name,
5571 GVariant *parameters,
5572 GDBusMethodInvocation *invocation,
5573 gpointer user_data)
5574 {
5575 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5576 _ExtendedGDBusMethodInfo *info;
5577 GVariantIter iter;
5578 GVariant *child;
5579 GValue *paramv;
5580 gsize num_params;
5581 guint num_extra;
5582 gsize n;
5583 guint signal_id;
5584 GValue return_value = G_VALUE_INIT;
5585 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5586 g_assert (info != NULL);
5587 num_params = g_variant_n_children (parameters);
5588 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5589 n = 0;
5590 g_value_init (¶mv[n], TYPE_SENSOR_VALUE);
5591 g_value_set_object (¶mv[n++], skeleton);
5592 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5593 g_value_set_object (¶mv[n++], invocation);
5594 if (info->pass_fdlist)
5595 {
5596 #ifdef G_OS_UNIX
5597 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
5598 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5599 #else
5600 g_assert_not_reached ();
5601 #endif
5602 }
5603 g_variant_iter_init (&iter, parameters);
5604 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5605 {
5606 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5607 if (arg_info->use_gvariant)
5608 {
5609 g_value_init (¶mv[n], G_TYPE_VARIANT);
5610 g_value_set_variant (¶mv[n], child);
5611 n++;
5612 }
5613 else
5614 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
5615 g_variant_unref (child);
5616 }
5617 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5618 g_value_init (&return_value, G_TYPE_BOOLEAN);
5619 g_signal_emitv (paramv, signal_id, 0, &return_value);
5620 if (!g_value_get_boolean (&return_value))
5621 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);
5622 g_value_unset (&return_value);
5623 for (n = 0; n < num_params + num_extra; n++)
5624 g_value_unset (¶mv[n]);
5625 g_free (paramv);
5626 }
5627
5628 static GVariant *
_sensor_value_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)5629 _sensor_value_skeleton_handle_get_property (
5630 GDBusConnection *connection G_GNUC_UNUSED,
5631 const gchar *sender G_GNUC_UNUSED,
5632 const gchar *object_path G_GNUC_UNUSED,
5633 const gchar *interface_name G_GNUC_UNUSED,
5634 const gchar *property_name,
5635 GError **error,
5636 gpointer user_data)
5637 {
5638 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5639 GValue value = G_VALUE_INIT;
5640 GParamSpec *pspec;
5641 _ExtendedGDBusPropertyInfo *info;
5642 GVariant *ret;
5643 ret = NULL;
5644 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5645 g_assert (info != NULL);
5646 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5647 if (pspec == NULL)
5648 {
5649 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5650 }
5651 else
5652 {
5653 g_value_init (&value, pspec->value_type);
5654 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5655 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5656 g_value_unset (&value);
5657 }
5658 return ret;
5659 }
5660
5661 static gboolean
_sensor_value_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)5662 _sensor_value_skeleton_handle_set_property (
5663 GDBusConnection *connection G_GNUC_UNUSED,
5664 const gchar *sender G_GNUC_UNUSED,
5665 const gchar *object_path G_GNUC_UNUSED,
5666 const gchar *interface_name G_GNUC_UNUSED,
5667 const gchar *property_name,
5668 GVariant *variant,
5669 GError **error,
5670 gpointer user_data)
5671 {
5672 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5673 GValue value = G_VALUE_INIT;
5674 GParamSpec *pspec;
5675 _ExtendedGDBusPropertyInfo *info;
5676 gboolean ret;
5677 ret = FALSE;
5678 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5679 g_assert (info != NULL);
5680 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5681 if (pspec == NULL)
5682 {
5683 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5684 }
5685 else
5686 {
5687 if (info->use_gvariant)
5688 g_value_set_variant (&value, variant);
5689 else
5690 g_dbus_gvariant_to_gvalue (variant, &value);
5691 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5692 g_value_unset (&value);
5693 ret = TRUE;
5694 }
5695 return ret;
5696 }
5697
5698 static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5699 {
5700 _sensor_value_skeleton_handle_method_call,
5701 _sensor_value_skeleton_handle_get_property,
5702 _sensor_value_skeleton_handle_set_property,
5703 {NULL}
5704 };
5705
5706 static GDBusInterfaceInfo *
sensor_value_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)5707 sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5708 {
5709 return sensor_value_interface_info ();
5710 }
5711
5712 static GDBusInterfaceVTable *
sensor_value_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)5713 sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5714 {
5715 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5716 }
5717
5718 static GVariant *
sensor_value_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)5719 sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5720 {
5721 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5722
5723 GVariantBuilder builder;
5724 guint n;
5725 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5726 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5727 goto out;
5728 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5729 {
5730 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5731 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5732 {
5733 GVariant *value;
5734 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);
5735 if (value != NULL)
5736 {
5737 g_variant_take_ref (value);
5738 g_variant_builder_add (&builder, "{sv}", info->name, value);
5739 g_variant_unref (value);
5740 }
5741 }
5742 }
5743 out:
5744 return g_variant_builder_end (&builder);
5745 }
5746
5747 static gboolean _sensor_value_emit_changed (gpointer user_data);
5748
5749 static void
sensor_value_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)5750 sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5751 {
5752 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5753 gboolean emit_changed = FALSE;
5754
5755 g_mutex_lock (&skeleton->priv->lock);
5756 if (skeleton->priv->changed_properties_idle_source != NULL)
5757 {
5758 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5759 skeleton->priv->changed_properties_idle_source = NULL;
5760 emit_changed = TRUE;
5761 }
5762 g_mutex_unlock (&skeleton->priv->lock);
5763
5764 if (emit_changed)
5765 _sensor_value_emit_changed (skeleton);
5766 }
5767
5768 static void
_sensor_value_on_signal_changed(SensorValue * object,GVariant * arg_value,const gchar * arg_units)5769 _sensor_value_on_signal_changed (
5770 SensorValue *object,
5771 GVariant *arg_value,
5772 const gchar *arg_units)
5773 {
5774 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5775
5776 GList *connections, *l;
5777 GVariant *signal_variant;
5778 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5779
5780 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5781 arg_value,
5782 arg_units));
5783 for (l = connections; l != NULL; l = l->next)
5784 {
5785 GDBusConnection *connection = l->data;
5786 g_dbus_connection_emit_signal (connection,
5787 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5788 signal_variant, NULL);
5789 }
5790 g_variant_unref (signal_variant);
5791 g_list_free_full (connections, g_object_unref);
5792 }
5793
5794 static void
_sensor_value_on_signal_error(SensorValue * object)5795 _sensor_value_on_signal_error (
5796 SensorValue *object)
5797 {
5798 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5799
5800 GList *connections, *l;
5801 GVariant *signal_variant;
5802 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5803
5804 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5805 for (l = connections; l != NULL; l = l->next)
5806 {
5807 GDBusConnection *connection = l->data;
5808 g_dbus_connection_emit_signal (connection,
5809 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5810 signal_variant, NULL);
5811 }
5812 g_variant_unref (signal_variant);
5813 g_list_free_full (connections, g_object_unref);
5814 }
5815
5816 static void
_sensor_value_on_signal_heartbeat(SensorValue * object,const gchar * arg_bus_name)5817 _sensor_value_on_signal_heartbeat (
5818 SensorValue *object,
5819 const gchar *arg_bus_name)
5820 {
5821 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5822
5823 GList *connections, *l;
5824 GVariant *signal_variant;
5825 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5826
5827 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5828 arg_bus_name));
5829 for (l = connections; l != NULL; l = l->next)
5830 {
5831 GDBusConnection *connection = l->data;
5832 g_dbus_connection_emit_signal (connection,
5833 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5834 signal_variant, NULL);
5835 }
5836 g_variant_unref (signal_variant);
5837 g_list_free_full (connections, g_object_unref);
5838 }
5839
5840 static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5841 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorValueSkeleton,sensor_value_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SensorValueSkeleton)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE,sensor_value_skeleton_iface_init))5842 G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5843 G_ADD_PRIVATE (SensorValueSkeleton)
5844 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init))
5845
5846 #else
5847 G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5848 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init))
5849
5850 #endif
5851 static void
5852 sensor_value_skeleton_finalize (GObject *object)
5853 {
5854 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5855 guint n;
5856 for (n = 0; n < 5; n++)
5857 g_value_unset (&skeleton->priv->properties[n]);
5858 g_free (skeleton->priv->properties);
5859 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5860 if (skeleton->priv->changed_properties_idle_source != NULL)
5861 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5862 g_main_context_unref (skeleton->priv->context);
5863 g_mutex_clear (&skeleton->priv->lock);
5864 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5865 }
5866
5867 static void
sensor_value_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5868 sensor_value_skeleton_get_property (GObject *object,
5869 guint prop_id,
5870 GValue *value,
5871 GParamSpec *pspec G_GNUC_UNUSED)
5872 {
5873 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5874 g_assert (prop_id != 0 && prop_id - 1 < 5);
5875 g_mutex_lock (&skeleton->priv->lock);
5876 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5877 g_mutex_unlock (&skeleton->priv->lock);
5878 }
5879
5880 static gboolean
_sensor_value_emit_changed(gpointer user_data)5881 _sensor_value_emit_changed (gpointer user_data)
5882 {
5883 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5884 GList *l;
5885 GVariantBuilder builder;
5886 GVariantBuilder invalidated_builder;
5887 guint num_changes;
5888
5889 g_mutex_lock (&skeleton->priv->lock);
5890 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5891 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5892 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5893 {
5894 ChangedProperty *cp = l->data;
5895 GVariant *variant;
5896 const GValue *cur_value;
5897
5898 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5899 if (!_g_value_equal (cur_value, &cp->orig_value))
5900 {
5901 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5902 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5903 g_variant_unref (variant);
5904 num_changes++;
5905 }
5906 }
5907 if (num_changes > 0)
5908 {
5909 GList *connections, *ll;
5910 GVariant *signal_variant;
5911 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5912 &builder, &invalidated_builder));
5913 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5914 for (ll = connections; ll != NULL; ll = ll->next)
5915 {
5916 GDBusConnection *connection = ll->data;
5917
5918 g_dbus_connection_emit_signal (connection,
5919 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5920 "org.freedesktop.DBus.Properties",
5921 "PropertiesChanged",
5922 signal_variant,
5923 NULL);
5924 }
5925 g_variant_unref (signal_variant);
5926 g_list_free_full (connections, g_object_unref);
5927 }
5928 else
5929 {
5930 g_variant_builder_clear (&builder);
5931 g_variant_builder_clear (&invalidated_builder);
5932 }
5933 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5934 skeleton->priv->changed_properties = NULL;
5935 skeleton->priv->changed_properties_idle_source = NULL;
5936 g_mutex_unlock (&skeleton->priv->lock);
5937 return FALSE;
5938 }
5939
5940 static void
_sensor_value_schedule_emit_changed(SensorValueSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)5941 _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5942 {
5943 ChangedProperty *cp;
5944 GList *l;
5945 cp = NULL;
5946 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5947 {
5948 ChangedProperty *i_cp = l->data;
5949 if (i_cp->info == info)
5950 {
5951 cp = i_cp;
5952 break;
5953 }
5954 }
5955 if (cp == NULL)
5956 {
5957 cp = g_new0 (ChangedProperty, 1);
5958 cp->prop_id = prop_id;
5959 cp->info = info;
5960 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5961 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5962 g_value_copy (orig_value, &cp->orig_value);
5963 }
5964 }
5965
5966 static void
sensor_value_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)5967 sensor_value_skeleton_notify (GObject *object,
5968 GParamSpec *pspec G_GNUC_UNUSED)
5969 {
5970 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5971 g_mutex_lock (&skeleton->priv->lock);
5972 if (skeleton->priv->changed_properties != NULL &&
5973 skeleton->priv->changed_properties_idle_source == NULL)
5974 {
5975 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5976 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5977 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5978 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed");
5979 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5980 g_source_unref (skeleton->priv->changed_properties_idle_source);
5981 }
5982 g_mutex_unlock (&skeleton->priv->lock);
5983 }
5984
5985 static void
sensor_value_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)5986 sensor_value_skeleton_set_property (GObject *object,
5987 guint prop_id,
5988 const GValue *value,
5989 GParamSpec *pspec)
5990 {
5991 const _ExtendedGDBusPropertyInfo *info;
5992 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5993 g_assert (prop_id != 0 && prop_id - 1 < 5);
5994 info = (const _ExtendedGDBusPropertyInfo *) _sensor_value_property_info_pointers[prop_id - 1];
5995 g_mutex_lock (&skeleton->priv->lock);
5996 g_object_freeze_notify (object);
5997 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5998 {
5999 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
6000 info->emits_changed_signal)
6001 _sensor_value_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
6002 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6003 g_object_notify_by_pspec (object, pspec);
6004 }
6005 g_mutex_unlock (&skeleton->priv->lock);
6006 g_object_thaw_notify (object);
6007 }
6008
6009 static void
sensor_value_skeleton_init(SensorValueSkeleton * skeleton)6010 sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
6011 {
6012 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6013 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
6014 #else
6015 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
6016 #endif
6017
6018 g_mutex_init (&skeleton->priv->lock);
6019 skeleton->priv->context = g_main_context_ref_thread_default ();
6020 skeleton->priv->properties = g_new0 (GValue, 5);
6021 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
6022 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6023 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
6024 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
6025 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
6026 }
6027
6028 static GVariant *
sensor_value_skeleton_get_value(SensorValue * object)6029 sensor_value_skeleton_get_value (SensorValue *object)
6030 {
6031 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6032 GVariant *value;
6033 g_mutex_lock (&skeleton->priv->lock);
6034 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[0]));
6035 g_mutex_unlock (&skeleton->priv->lock);
6036 return value;
6037 }
6038
6039 static const gchar *
sensor_value_skeleton_get_units(SensorValue * object)6040 sensor_value_skeleton_get_units (SensorValue *object)
6041 {
6042 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6043 const gchar *value;
6044 g_mutex_lock (&skeleton->priv->lock);
6045 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
6046 g_mutex_unlock (&skeleton->priv->lock);
6047 return value;
6048 }
6049
6050 static gint
sensor_value_skeleton_get_poll_interval(SensorValue * object)6051 sensor_value_skeleton_get_poll_interval (SensorValue *object)
6052 {
6053 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6054 gint value;
6055 g_mutex_lock (&skeleton->priv->lock);
6056 value = g_marshal_value_peek_int (&(skeleton->priv->properties[2]));
6057 g_mutex_unlock (&skeleton->priv->lock);
6058 return value;
6059 }
6060
6061 static gint
sensor_value_skeleton_get_heatbeat(SensorValue * object)6062 sensor_value_skeleton_get_heatbeat (SensorValue *object)
6063 {
6064 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6065 gint value;
6066 g_mutex_lock (&skeleton->priv->lock);
6067 value = g_marshal_value_peek_int (&(skeleton->priv->properties[3]));
6068 g_mutex_unlock (&skeleton->priv->lock);
6069 return value;
6070 }
6071
6072 static gboolean
sensor_value_skeleton_get_settable(SensorValue * object)6073 sensor_value_skeleton_get_settable (SensorValue *object)
6074 {
6075 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6076 gboolean value;
6077 g_mutex_lock (&skeleton->priv->lock);
6078 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[4]));
6079 g_mutex_unlock (&skeleton->priv->lock);
6080 return value;
6081 }
6082
6083 static void
sensor_value_skeleton_class_init(SensorValueSkeletonClass * klass)6084 sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
6085 {
6086 GObjectClass *gobject_class;
6087 GDBusInterfaceSkeletonClass *skeleton_class;
6088
6089 gobject_class = G_OBJECT_CLASS (klass);
6090 gobject_class->finalize = sensor_value_skeleton_finalize;
6091 gobject_class->get_property = sensor_value_skeleton_get_property;
6092 gobject_class->set_property = sensor_value_skeleton_set_property;
6093 gobject_class->notify = sensor_value_skeleton_notify;
6094
6095
6096 sensor_value_override_properties (gobject_class, 1);
6097
6098 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6099 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
6100 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
6101 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
6102 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
6103
6104 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6105 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
6106 #endif
6107 }
6108
6109 static void
sensor_value_skeleton_iface_init(SensorValueIface * iface)6110 sensor_value_skeleton_iface_init (SensorValueIface *iface)
6111 {
6112 iface->changed = _sensor_value_on_signal_changed;
6113 iface->error = _sensor_value_on_signal_error;
6114 iface->heartbeat = _sensor_value_on_signal_heartbeat;
6115 iface->get_value = sensor_value_skeleton_get_value;
6116 iface->get_units = sensor_value_skeleton_get_units;
6117 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
6118 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
6119 iface->get_settable = sensor_value_skeleton_get_settable;
6120 }
6121
6122 /**
6123 * sensor_value_skeleton_new:
6124 *
6125 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
6126 *
6127 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
6128 */
6129 SensorValue *
sensor_value_skeleton_new(void)6130 sensor_value_skeleton_new (void)
6131 {
6132 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
6133 }
6134
6135 /* ------------------------------------------------------------------------
6136 * Code for interface org.openbmc.SensorThreshold
6137 * ------------------------------------------------------------------------
6138 */
6139
6140 /**
6141 * SECTION:SensorThreshold
6142 * @title: SensorThreshold
6143 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
6144 *
6145 * 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.
6146 */
6147
6148 enum
6149 {
6150 _SENSOR_THRESHOLD_WARNING,
6151 _SENSOR_THRESHOLD_CRITICAL,
6152 _SENSOR_THRESHOLD_NORMAL,
6153 };
6154
6155 static unsigned _SENSOR_THRESHOLD_SIGNALS[3] = { 0 };
6156
6157 /* ---- Introspection data for org.openbmc.SensorThreshold ---- */
6158
6159 static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
6160 {
6161 {
6162 -1,
6163 (gchar *) "state",
6164 (gchar *) "y",
6165 NULL
6166 },
6167 FALSE
6168 };
6169
6170 static const GDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
6171 {
6172 &_sensor_threshold_method_info_get_state_OUT_ARG_state.parent_struct,
6173 NULL
6174 };
6175
6176 static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
6177 {
6178 {
6179 -1,
6180 (gchar *) "getState",
6181 NULL,
6182 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
6183 NULL
6184 },
6185 "handle-get-state",
6186 FALSE
6187 };
6188
6189 static const GDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
6190 {
6191 &_sensor_threshold_method_info_get_state.parent_struct,
6192 NULL
6193 };
6194
6195 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
6196 {
6197 {
6198 -1,
6199 (gchar *) "Warning",
6200 NULL,
6201 NULL
6202 },
6203 "warning"
6204 };
6205
6206 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
6207 {
6208 {
6209 -1,
6210 (gchar *) "Critical",
6211 NULL,
6212 NULL
6213 },
6214 "critical"
6215 };
6216
6217 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
6218 {
6219 {
6220 -1,
6221 (gchar *) "Normal",
6222 NULL,
6223 NULL
6224 },
6225 "normal"
6226 };
6227
6228 static const GDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
6229 {
6230 &_sensor_threshold_signal_info_warning.parent_struct,
6231 &_sensor_threshold_signal_info_critical.parent_struct,
6232 &_sensor_threshold_signal_info_normal.parent_struct,
6233 NULL
6234 };
6235
6236 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
6237 {
6238 {
6239 -1,
6240 (gchar *) "lower_critical",
6241 (gchar *) "v",
6242 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6243 NULL
6244 },
6245 "lower-critical",
6246 FALSE,
6247 TRUE
6248 };
6249
6250 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
6251 {
6252 {
6253 -1,
6254 (gchar *) "lower_warning",
6255 (gchar *) "v",
6256 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6257 NULL
6258 },
6259 "lower-warning",
6260 FALSE,
6261 TRUE
6262 };
6263
6264 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6265 {
6266 {
6267 -1,
6268 (gchar *) "upper_warning",
6269 (gchar *) "v",
6270 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6271 NULL
6272 },
6273 "upper-warning",
6274 FALSE,
6275 TRUE
6276 };
6277
6278 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6279 {
6280 {
6281 -1,
6282 (gchar *) "upper_critical",
6283 (gchar *) "v",
6284 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6285 NULL
6286 },
6287 "upper-critical",
6288 FALSE,
6289 TRUE
6290 };
6291
6292 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6293 {
6294 {
6295 -1,
6296 (gchar *) "state",
6297 (gchar *) "y",
6298 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6299 NULL
6300 },
6301 "state",
6302 FALSE,
6303 TRUE
6304 };
6305
6306 static const GDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6307 {
6308 &_sensor_threshold_property_info_lower_critical.parent_struct,
6309 &_sensor_threshold_property_info_lower_warning.parent_struct,
6310 &_sensor_threshold_property_info_upper_warning.parent_struct,
6311 &_sensor_threshold_property_info_upper_critical.parent_struct,
6312 &_sensor_threshold_property_info_state.parent_struct,
6313 NULL
6314 };
6315
6316 static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6317 {
6318 {
6319 -1,
6320 (gchar *) "org.openbmc.SensorThreshold",
6321 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6322 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6323 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6324 NULL
6325 },
6326 "sensor-threshold",
6327 };
6328
6329
6330 /**
6331 * sensor_threshold_interface_info:
6332 *
6333 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6334 *
6335 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6336 */
6337 GDBusInterfaceInfo *
sensor_threshold_interface_info(void)6338 sensor_threshold_interface_info (void)
6339 {
6340 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6341 }
6342
6343 /**
6344 * sensor_threshold_override_properties:
6345 * @klass: The class structure for a #GObject derived class.
6346 * @property_id_begin: The property id to assign to the first overridden property.
6347 *
6348 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6349 * The properties are overridden in the order they are defined.
6350 *
6351 * Returns: The last property id.
6352 */
6353 guint
sensor_threshold_override_properties(GObjectClass * klass,guint property_id_begin)6354 sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6355 {
6356 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6357 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6358 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6359 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6360 g_object_class_override_property (klass, property_id_begin++, "state");
6361 return property_id_begin - 1;
6362 }
6363
6364
6365 inline static void
sensor_threshold_signal_marshal_warning(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)6366 sensor_threshold_signal_marshal_warning (
6367 GClosure *closure,
6368 GValue *return_value,
6369 unsigned int n_param_values,
6370 const GValue *param_values,
6371 void *invocation_hint,
6372 void *marshal_data)
6373 {
6374 g_cclosure_marshal_VOID__VOID (closure,
6375 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6376 }
6377
6378 inline static void
sensor_threshold_signal_marshal_critical(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)6379 sensor_threshold_signal_marshal_critical (
6380 GClosure *closure,
6381 GValue *return_value,
6382 unsigned int n_param_values,
6383 const GValue *param_values,
6384 void *invocation_hint,
6385 void *marshal_data)
6386 {
6387 g_cclosure_marshal_VOID__VOID (closure,
6388 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6389 }
6390
6391 inline static void
sensor_threshold_signal_marshal_normal(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)6392 sensor_threshold_signal_marshal_normal (
6393 GClosure *closure,
6394 GValue *return_value,
6395 unsigned int n_param_values,
6396 const GValue *param_values,
6397 void *invocation_hint,
6398 void *marshal_data)
6399 {
6400 g_cclosure_marshal_VOID__VOID (closure,
6401 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6402 }
6403
6404 inline static void
sensor_threshold_method_marshal_get_state(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)6405 sensor_threshold_method_marshal_get_state (
6406 GClosure *closure,
6407 GValue *return_value,
6408 unsigned int n_param_values,
6409 const GValue *param_values,
6410 void *invocation_hint,
6411 void *marshal_data)
6412 {
6413 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
6414 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6415 }
6416
6417
6418 /**
6419 * SensorThreshold:
6420 *
6421 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6422 */
6423
6424 /**
6425 * SensorThresholdIface:
6426 * @parent_iface: The parent interface.
6427 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6428 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6429 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6430 * @get_state: Getter for the #SensorThreshold:state property.
6431 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6432 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6433 * @critical: Handler for the #SensorThreshold::critical signal.
6434 * @normal: Handler for the #SensorThreshold::normal signal.
6435 * @warning: Handler for the #SensorThreshold::warning signal.
6436 *
6437 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6438 */
6439
6440 typedef SensorThresholdIface SensorThresholdInterface;
G_DEFINE_INTERFACE(SensorThreshold,sensor_threshold,G_TYPE_OBJECT)6441 G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT)
6442
6443 static void
6444 sensor_threshold_default_init (SensorThresholdIface *iface)
6445 {
6446 /* GObject signals for incoming D-Bus method calls: */
6447 /**
6448 * SensorThreshold::handle-get-state:
6449 * @object: A #SensorThreshold.
6450 * @invocation: A #GDBusMethodInvocation.
6451 *
6452 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6453 *
6454 * 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 other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
6455 *
6456 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
6457 */
6458 g_signal_new ("handle-get-state",
6459 G_TYPE_FROM_INTERFACE (iface),
6460 G_SIGNAL_RUN_LAST,
6461 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6462 g_signal_accumulator_true_handled,
6463 NULL,
6464 sensor_threshold_method_marshal_get_state,
6465 G_TYPE_BOOLEAN,
6466 1,
6467 G_TYPE_DBUS_METHOD_INVOCATION);
6468
6469 /* GObject signals for received D-Bus signals: */
6470 /**
6471 * SensorThreshold::warning:
6472 * @object: A #SensorThreshold.
6473 *
6474 * 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.
6475 *
6476 * 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.
6477 */
6478 _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_WARNING] =
6479 g_signal_new ("warning",
6480 G_TYPE_FROM_INTERFACE (iface),
6481 G_SIGNAL_RUN_LAST,
6482 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6483 NULL,
6484 NULL,
6485 sensor_threshold_signal_marshal_warning,
6486 G_TYPE_NONE,
6487 0);
6488
6489 /**
6490 * SensorThreshold::critical:
6491 * @object: A #SensorThreshold.
6492 *
6493 * 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.
6494 *
6495 * 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.
6496 */
6497 _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_CRITICAL] =
6498 g_signal_new ("critical",
6499 G_TYPE_FROM_INTERFACE (iface),
6500 G_SIGNAL_RUN_LAST,
6501 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6502 NULL,
6503 NULL,
6504 sensor_threshold_signal_marshal_critical,
6505 G_TYPE_NONE,
6506 0);
6507
6508 /**
6509 * SensorThreshold::normal:
6510 * @object: A #SensorThreshold.
6511 *
6512 * 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.
6513 *
6514 * 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.
6515 */
6516 _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_NORMAL] =
6517 g_signal_new ("normal",
6518 G_TYPE_FROM_INTERFACE (iface),
6519 G_SIGNAL_RUN_LAST,
6520 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6521 NULL,
6522 NULL,
6523 sensor_threshold_signal_marshal_normal,
6524 G_TYPE_NONE,
6525 0);
6526
6527 /* GObject properties for D-Bus properties: */
6528 /**
6529 * SensorThreshold:lower-critical:
6530 *
6531 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6532 *
6533 * 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.
6534 */
6535 g_object_interface_install_property (iface,
6536 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6537 /**
6538 * SensorThreshold:lower-warning:
6539 *
6540 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6541 *
6542 * 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.
6543 */
6544 g_object_interface_install_property (iface,
6545 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6546 /**
6547 * SensorThreshold:upper-warning:
6548 *
6549 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6550 *
6551 * 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.
6552 */
6553 g_object_interface_install_property (iface,
6554 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6555 /**
6556 * SensorThreshold:upper-critical:
6557 *
6558 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6559 *
6560 * 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.
6561 */
6562 g_object_interface_install_property (iface,
6563 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6564 /**
6565 * SensorThreshold:state:
6566 *
6567 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6568 *
6569 * 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.
6570 */
6571 g_object_interface_install_property (iface,
6572 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6573 }
6574
6575 /**
6576 * sensor_threshold_get_lower_critical: (skip)
6577 * @object: A #SensorThreshold.
6578 *
6579 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6580 *
6581 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6582 *
6583 * 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.
6584 *
6585 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6586 */
6587 GVariant *
sensor_threshold_get_lower_critical(SensorThreshold * object)6588 sensor_threshold_get_lower_critical (SensorThreshold *object)
6589 {
6590 g_return_val_if_fail (IS_SENSOR_THRESHOLD (object), NULL);
6591
6592 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6593 }
6594
6595 /**
6596 * sensor_threshold_dup_lower_critical: (skip)
6597 * @object: A #SensorThreshold.
6598 *
6599 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6600 *
6601 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6602 *
6603 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6604 */
6605 GVariant *
sensor_threshold_dup_lower_critical(SensorThreshold * object)6606 sensor_threshold_dup_lower_critical (SensorThreshold *object)
6607 {
6608 GVariant *value;
6609 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6610 return value;
6611 }
6612
6613 /**
6614 * sensor_threshold_set_lower_critical: (skip)
6615 * @object: A #SensorThreshold.
6616 * @value: The value to set.
6617 *
6618 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6619 *
6620 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6621 */
6622 void
sensor_threshold_set_lower_critical(SensorThreshold * object,GVariant * value)6623 sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6624 {
6625 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6626 }
6627
6628 /**
6629 * sensor_threshold_get_lower_warning: (skip)
6630 * @object: A #SensorThreshold.
6631 *
6632 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6633 *
6634 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6635 *
6636 * 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.
6637 *
6638 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6639 */
6640 GVariant *
sensor_threshold_get_lower_warning(SensorThreshold * object)6641 sensor_threshold_get_lower_warning (SensorThreshold *object)
6642 {
6643 g_return_val_if_fail (IS_SENSOR_THRESHOLD (object), NULL);
6644
6645 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6646 }
6647
6648 /**
6649 * sensor_threshold_dup_lower_warning: (skip)
6650 * @object: A #SensorThreshold.
6651 *
6652 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6653 *
6654 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6655 *
6656 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6657 */
6658 GVariant *
sensor_threshold_dup_lower_warning(SensorThreshold * object)6659 sensor_threshold_dup_lower_warning (SensorThreshold *object)
6660 {
6661 GVariant *value;
6662 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6663 return value;
6664 }
6665
6666 /**
6667 * sensor_threshold_set_lower_warning: (skip)
6668 * @object: A #SensorThreshold.
6669 * @value: The value to set.
6670 *
6671 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6672 *
6673 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6674 */
6675 void
sensor_threshold_set_lower_warning(SensorThreshold * object,GVariant * value)6676 sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6677 {
6678 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6679 }
6680
6681 /**
6682 * sensor_threshold_get_upper_warning: (skip)
6683 * @object: A #SensorThreshold.
6684 *
6685 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6686 *
6687 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6688 *
6689 * 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.
6690 *
6691 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6692 */
6693 GVariant *
sensor_threshold_get_upper_warning(SensorThreshold * object)6694 sensor_threshold_get_upper_warning (SensorThreshold *object)
6695 {
6696 g_return_val_if_fail (IS_SENSOR_THRESHOLD (object), NULL);
6697
6698 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6699 }
6700
6701 /**
6702 * sensor_threshold_dup_upper_warning: (skip)
6703 * @object: A #SensorThreshold.
6704 *
6705 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6706 *
6707 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6708 *
6709 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6710 */
6711 GVariant *
sensor_threshold_dup_upper_warning(SensorThreshold * object)6712 sensor_threshold_dup_upper_warning (SensorThreshold *object)
6713 {
6714 GVariant *value;
6715 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6716 return value;
6717 }
6718
6719 /**
6720 * sensor_threshold_set_upper_warning: (skip)
6721 * @object: A #SensorThreshold.
6722 * @value: The value to set.
6723 *
6724 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6725 *
6726 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6727 */
6728 void
sensor_threshold_set_upper_warning(SensorThreshold * object,GVariant * value)6729 sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6730 {
6731 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6732 }
6733
6734 /**
6735 * sensor_threshold_get_upper_critical: (skip)
6736 * @object: A #SensorThreshold.
6737 *
6738 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6739 *
6740 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6741 *
6742 * 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.
6743 *
6744 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6745 */
6746 GVariant *
sensor_threshold_get_upper_critical(SensorThreshold * object)6747 sensor_threshold_get_upper_critical (SensorThreshold *object)
6748 {
6749 g_return_val_if_fail (IS_SENSOR_THRESHOLD (object), NULL);
6750
6751 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6752 }
6753
6754 /**
6755 * sensor_threshold_dup_upper_critical: (skip)
6756 * @object: A #SensorThreshold.
6757 *
6758 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6759 *
6760 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6761 *
6762 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6763 */
6764 GVariant *
sensor_threshold_dup_upper_critical(SensorThreshold * object)6765 sensor_threshold_dup_upper_critical (SensorThreshold *object)
6766 {
6767 GVariant *value;
6768 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6769 return value;
6770 }
6771
6772 /**
6773 * sensor_threshold_set_upper_critical: (skip)
6774 * @object: A #SensorThreshold.
6775 * @value: The value to set.
6776 *
6777 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6778 *
6779 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6780 */
6781 void
sensor_threshold_set_upper_critical(SensorThreshold * object,GVariant * value)6782 sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6783 {
6784 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6785 }
6786
6787 /**
6788 * sensor_threshold_get_state: (skip)
6789 * @object: A #SensorThreshold.
6790 *
6791 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6792 *
6793 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6794 *
6795 * Returns: The property value.
6796 */
6797 guchar
sensor_threshold_get_state(SensorThreshold * object)6798 sensor_threshold_get_state (SensorThreshold *object)
6799 {
6800 g_return_val_if_fail (IS_SENSOR_THRESHOLD (object), '\0');
6801
6802 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6803 }
6804
6805 /**
6806 * sensor_threshold_set_state: (skip)
6807 * @object: A #SensorThreshold.
6808 * @value: The value to set.
6809 *
6810 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6811 *
6812 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6813 */
6814 void
sensor_threshold_set_state(SensorThreshold * object,guchar value)6815 sensor_threshold_set_state (SensorThreshold *object, guchar value)
6816 {
6817 g_object_set (G_OBJECT (object), "state", value, NULL);
6818 }
6819
6820 /**
6821 * sensor_threshold_emit_warning:
6822 * @object: A #SensorThreshold.
6823 *
6824 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6825 */
6826 void
sensor_threshold_emit_warning(SensorThreshold * object)6827 sensor_threshold_emit_warning (
6828 SensorThreshold *object)
6829 {
6830 g_signal_emit (object, _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_WARNING], 0);
6831 }
6832
6833 /**
6834 * sensor_threshold_emit_critical:
6835 * @object: A #SensorThreshold.
6836 *
6837 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6838 */
6839 void
sensor_threshold_emit_critical(SensorThreshold * object)6840 sensor_threshold_emit_critical (
6841 SensorThreshold *object)
6842 {
6843 g_signal_emit (object, _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_CRITICAL], 0);
6844 }
6845
6846 /**
6847 * sensor_threshold_emit_normal:
6848 * @object: A #SensorThreshold.
6849 *
6850 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6851 */
6852 void
sensor_threshold_emit_normal(SensorThreshold * object)6853 sensor_threshold_emit_normal (
6854 SensorThreshold *object)
6855 {
6856 g_signal_emit (object, _SENSOR_THRESHOLD_SIGNALS[_SENSOR_THRESHOLD_NORMAL], 0);
6857 }
6858
6859 /**
6860 * sensor_threshold_call_get_state:
6861 * @proxy: A #SensorThresholdProxy.
6862 * @cancellable: (nullable): A #GCancellable or %NULL.
6863 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6864 * @user_data: User data to pass to @callback.
6865 *
6866 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6867 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
6868 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6869 *
6870 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6871 */
6872 void
sensor_threshold_call_get_state(SensorThreshold * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)6873 sensor_threshold_call_get_state (
6874 SensorThreshold *proxy,
6875 GCancellable *cancellable,
6876 GAsyncReadyCallback callback,
6877 gpointer user_data)
6878 {
6879 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6880 "getState",
6881 g_variant_new ("()"),
6882 G_DBUS_CALL_FLAGS_NONE,
6883 -1,
6884 cancellable,
6885 callback,
6886 user_data);
6887 }
6888
6889 /**
6890 * sensor_threshold_call_get_state_finish:
6891 * @proxy: A #SensorThresholdProxy.
6892 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
6893 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6894 * @error: Return location for error or %NULL.
6895 *
6896 * Finishes an operation started with sensor_threshold_call_get_state().
6897 *
6898 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
6899 */
6900 gboolean
sensor_threshold_call_get_state_finish(SensorThreshold * proxy,guchar * out_state,GAsyncResult * res,GError ** error)6901 sensor_threshold_call_get_state_finish (
6902 SensorThreshold *proxy,
6903 guchar *out_state,
6904 GAsyncResult *res,
6905 GError **error)
6906 {
6907 GVariant *_ret;
6908 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6909 if (_ret == NULL)
6910 goto _out;
6911 g_variant_get (_ret,
6912 "(y)",
6913 out_state);
6914 g_variant_unref (_ret);
6915 _out:
6916 return _ret != NULL;
6917 }
6918
6919 /**
6920 * sensor_threshold_call_get_state_sync:
6921 * @proxy: A #SensorThresholdProxy.
6922 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
6923 * @cancellable: (nullable): A #GCancellable or %NULL.
6924 * @error: Return location for error or %NULL.
6925 *
6926 * 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.
6927 *
6928 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6929 *
6930 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
6931 */
6932 gboolean
sensor_threshold_call_get_state_sync(SensorThreshold * proxy,guchar * out_state,GCancellable * cancellable,GError ** error)6933 sensor_threshold_call_get_state_sync (
6934 SensorThreshold *proxy,
6935 guchar *out_state,
6936 GCancellable *cancellable,
6937 GError **error)
6938 {
6939 GVariant *_ret;
6940 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6941 "getState",
6942 g_variant_new ("()"),
6943 G_DBUS_CALL_FLAGS_NONE,
6944 -1,
6945 cancellable,
6946 error);
6947 if (_ret == NULL)
6948 goto _out;
6949 g_variant_get (_ret,
6950 "(y)",
6951 out_state);
6952 g_variant_unref (_ret);
6953 _out:
6954 return _ret != NULL;
6955 }
6956
6957 /**
6958 * sensor_threshold_complete_get_state:
6959 * @object: A #SensorThreshold.
6960 * @invocation: (transfer full): A #GDBusMethodInvocation.
6961 * @state: Parameter to return.
6962 *
6963 * 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.
6964 *
6965 * This method will free @invocation, you cannot use it afterwards.
6966 */
6967 void
sensor_threshold_complete_get_state(SensorThreshold * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,guchar state)6968 sensor_threshold_complete_get_state (
6969 SensorThreshold *object G_GNUC_UNUSED,
6970 GDBusMethodInvocation *invocation,
6971 guchar state)
6972 {
6973 g_dbus_method_invocation_return_value (invocation,
6974 g_variant_new ("(y)",
6975 state));
6976 }
6977
6978 /* ------------------------------------------------------------------------ */
6979
6980 /**
6981 * SensorThresholdProxy:
6982 *
6983 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6984 */
6985
6986 /**
6987 * SensorThresholdProxyClass:
6988 * @parent_class: The parent class.
6989 *
6990 * Class structure for #SensorThresholdProxy.
6991 */
6992
6993 struct _SensorThresholdProxyPrivate
6994 {
6995 GData *qdata;
6996 };
6997
6998 static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6999
7000 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorThresholdProxy,sensor_threshold_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SensorThresholdProxy)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD,sensor_threshold_proxy_iface_init))7001 G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7002 G_ADD_PRIVATE (SensorThresholdProxy)
7003 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init))
7004
7005 #else
7006 G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7007 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init))
7008
7009 #endif
7010 static void
7011 sensor_threshold_proxy_finalize (GObject *object)
7012 {
7013 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7014 g_datalist_clear (&proxy->priv->qdata);
7015 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
7016 }
7017
7018 static void
sensor_threshold_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7019 sensor_threshold_proxy_get_property (GObject *object,
7020 guint prop_id,
7021 GValue *value,
7022 GParamSpec *pspec G_GNUC_UNUSED)
7023 {
7024 const _ExtendedGDBusPropertyInfo *info;
7025 GVariant *variant;
7026 g_assert (prop_id != 0 && prop_id - 1 < 5);
7027 info = (const _ExtendedGDBusPropertyInfo *) _sensor_threshold_property_info_pointers[prop_id - 1];
7028 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7029 if (info->use_gvariant)
7030 {
7031 g_value_set_variant (value, variant);
7032 }
7033 else
7034 {
7035 if (variant != NULL)
7036 g_dbus_gvariant_to_gvalue (variant, value);
7037 }
7038 if (variant != NULL)
7039 g_variant_unref (variant);
7040 }
7041
7042 static void
sensor_threshold_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)7043 sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7044 GAsyncResult *res,
7045 gpointer user_data)
7046 {
7047 const _ExtendedGDBusPropertyInfo *info = user_data;
7048 GError *error;
7049 GVariant *_ret;
7050 error = NULL;
7051 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7052 if (!_ret)
7053 {
7054 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
7055 info->parent_struct.name,
7056 error->message, g_quark_to_string (error->domain), error->code);
7057 g_error_free (error);
7058 }
7059 else
7060 {
7061 g_variant_unref (_ret);
7062 }
7063 }
7064
7065 static void
sensor_threshold_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7066 sensor_threshold_proxy_set_property (GObject *object,
7067 guint prop_id,
7068 const GValue *value,
7069 GParamSpec *pspec G_GNUC_UNUSED)
7070 {
7071 const _ExtendedGDBusPropertyInfo *info;
7072 GVariant *variant;
7073 g_assert (prop_id != 0 && prop_id - 1 < 5);
7074 info = (const _ExtendedGDBusPropertyInfo *) _sensor_threshold_property_info_pointers[prop_id - 1];
7075 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7076 g_dbus_proxy_call (G_DBUS_PROXY (object),
7077 "org.freedesktop.DBus.Properties.Set",
7078 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
7079 G_DBUS_CALL_FLAGS_NONE,
7080 -1,
7081 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7082 g_variant_unref (variant);
7083 }
7084
7085 static void
sensor_threshold_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)7086 sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
7087 const gchar *sender_name G_GNUC_UNUSED,
7088 const gchar *signal_name,
7089 GVariant *parameters)
7090 {
7091 _ExtendedGDBusSignalInfo *info;
7092 GVariantIter iter;
7093 GVariant *child;
7094 GValue *paramv;
7095 gsize num_params;
7096 gsize n;
7097 guint signal_id;
7098 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
7099 if (info == NULL)
7100 return;
7101 num_params = g_variant_n_children (parameters);
7102 paramv = g_new0 (GValue, num_params + 1);
7103 g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD);
7104 g_value_set_object (¶mv[0], proxy);
7105 g_variant_iter_init (&iter, parameters);
7106 n = 1;
7107 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7108 {
7109 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7110 if (arg_info->use_gvariant)
7111 {
7112 g_value_init (¶mv[n], G_TYPE_VARIANT);
7113 g_value_set_variant (¶mv[n], child);
7114 n++;
7115 }
7116 else
7117 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
7118 g_variant_unref (child);
7119 }
7120 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7121 g_signal_emitv (paramv, signal_id, 0, NULL);
7122 for (n = 0; n < num_params + 1; n++)
7123 g_value_unset (¶mv[n]);
7124 g_free (paramv);
7125 }
7126
7127 static void
sensor_threshold_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)7128 sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7129 GVariant *changed_properties,
7130 const gchar *const *invalidated_properties)
7131 {
7132 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
7133 guint n;
7134 const gchar *key;
7135 GVariantIter *iter;
7136 _ExtendedGDBusPropertyInfo *info;
7137 g_variant_get (changed_properties, "a{sv}", &iter);
7138 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7139 {
7140 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
7141 g_datalist_remove_data (&proxy->priv->qdata, key);
7142 if (info != NULL)
7143 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7144 }
7145 g_variant_iter_free (iter);
7146 for (n = 0; invalidated_properties[n] != NULL; n++)
7147 {
7148 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
7149 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7150 if (info != NULL)
7151 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7152 }
7153 }
7154
7155 static GVariant *
sensor_threshold_proxy_get_lower_critical(SensorThreshold * object)7156 sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
7157 {
7158 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7159 GVariant *variant;
7160 GVariant *value = NULL;
7161 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
7162 value = variant;
7163 if (variant != NULL)
7164 g_variant_unref (variant);
7165 return value;
7166 }
7167
7168 static GVariant *
sensor_threshold_proxy_get_lower_warning(SensorThreshold * object)7169 sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
7170 {
7171 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7172 GVariant *variant;
7173 GVariant *value = NULL;
7174 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
7175 value = variant;
7176 if (variant != NULL)
7177 g_variant_unref (variant);
7178 return value;
7179 }
7180
7181 static GVariant *
sensor_threshold_proxy_get_upper_warning(SensorThreshold * object)7182 sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
7183 {
7184 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7185 GVariant *variant;
7186 GVariant *value = NULL;
7187 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
7188 value = variant;
7189 if (variant != NULL)
7190 g_variant_unref (variant);
7191 return value;
7192 }
7193
7194 static GVariant *
sensor_threshold_proxy_get_upper_critical(SensorThreshold * object)7195 sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
7196 {
7197 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7198 GVariant *variant;
7199 GVariant *value = NULL;
7200 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
7201 value = variant;
7202 if (variant != NULL)
7203 g_variant_unref (variant);
7204 return value;
7205 }
7206
7207 static guchar
sensor_threshold_proxy_get_state(SensorThreshold * object)7208 sensor_threshold_proxy_get_state (SensorThreshold *object)
7209 {
7210 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7211 GVariant *variant;
7212 guchar value = '\0';
7213 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7214 if (variant != NULL)
7215 {
7216 value = g_variant_get_byte (variant);
7217 g_variant_unref (variant);
7218 }
7219 return value;
7220 }
7221
7222 static void
sensor_threshold_proxy_init(SensorThresholdProxy * proxy)7223 sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
7224 {
7225 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7226 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
7227 #else
7228 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
7229 #endif
7230
7231 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
7232 }
7233
7234 static void
sensor_threshold_proxy_class_init(SensorThresholdProxyClass * klass)7235 sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
7236 {
7237 GObjectClass *gobject_class;
7238 GDBusProxyClass *proxy_class;
7239
7240 gobject_class = G_OBJECT_CLASS (klass);
7241 gobject_class->finalize = sensor_threshold_proxy_finalize;
7242 gobject_class->get_property = sensor_threshold_proxy_get_property;
7243 gobject_class->set_property = sensor_threshold_proxy_set_property;
7244
7245 proxy_class = G_DBUS_PROXY_CLASS (klass);
7246 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
7247 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
7248
7249 sensor_threshold_override_properties (gobject_class, 1);
7250
7251 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7252 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
7253 #endif
7254 }
7255
7256 static void
sensor_threshold_proxy_iface_init(SensorThresholdIface * iface)7257 sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
7258 {
7259 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
7260 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
7261 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
7262 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
7263 iface->get_state = sensor_threshold_proxy_get_state;
7264 }
7265
7266 /**
7267 * sensor_threshold_proxy_new:
7268 * @connection: A #GDBusConnection.
7269 * @flags: Flags from the #GDBusProxyFlags enumeration.
7270 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7271 * @object_path: An object path.
7272 * @cancellable: (nullable): A #GCancellable or %NULL.
7273 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7274 * @user_data: User data to pass to @callback.
7275 *
7276 * 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.
7277 *
7278 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
7279 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
7280 *
7281 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7282 */
7283 void
sensor_threshold_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)7284 sensor_threshold_proxy_new (
7285 GDBusConnection *connection,
7286 GDBusProxyFlags flags,
7287 const gchar *name,
7288 const gchar *object_path,
7289 GCancellable *cancellable,
7290 GAsyncReadyCallback callback,
7291 gpointer user_data)
7292 {
7293 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);
7294 }
7295
7296 /**
7297 * sensor_threshold_proxy_new_finish:
7298 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
7299 * @error: Return location for error or %NULL
7300 *
7301 * Finishes an operation started with sensor_threshold_proxy_new().
7302 *
7303 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7304 */
7305 SensorThreshold *
sensor_threshold_proxy_new_finish(GAsyncResult * res,GError ** error)7306 sensor_threshold_proxy_new_finish (
7307 GAsyncResult *res,
7308 GError **error)
7309 {
7310 GObject *ret;
7311 GObject *source_object;
7312 source_object = g_async_result_get_source_object (res);
7313 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7314 g_object_unref (source_object);
7315 if (ret != NULL)
7316 return SENSOR_THRESHOLD (ret);
7317 else
7318 return NULL;
7319 }
7320
7321 /**
7322 * sensor_threshold_proxy_new_sync:
7323 * @connection: A #GDBusConnection.
7324 * @flags: Flags from the #GDBusProxyFlags enumeration.
7325 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7326 * @object_path: An object path.
7327 * @cancellable: (nullable): A #GCancellable or %NULL.
7328 * @error: Return location for error or %NULL
7329 *
7330 * 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.
7331 *
7332 * The calling thread is blocked until a reply is received.
7333 *
7334 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7335 *
7336 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7337 */
7338 SensorThreshold *
sensor_threshold_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)7339 sensor_threshold_proxy_new_sync (
7340 GDBusConnection *connection,
7341 GDBusProxyFlags flags,
7342 const gchar *name,
7343 const gchar *object_path,
7344 GCancellable *cancellable,
7345 GError **error)
7346 {
7347 GInitable *ret;
7348 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);
7349 if (ret != NULL)
7350 return SENSOR_THRESHOLD (ret);
7351 else
7352 return NULL;
7353 }
7354
7355
7356 /**
7357 * sensor_threshold_proxy_new_for_bus:
7358 * @bus_type: A #GBusType.
7359 * @flags: Flags from the #GDBusProxyFlags enumeration.
7360 * @name: A bus name (well-known or unique).
7361 * @object_path: An object path.
7362 * @cancellable: (nullable): A #GCancellable or %NULL.
7363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7364 * @user_data: User data to pass to @callback.
7365 *
7366 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7367 *
7368 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
7369 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7370 *
7371 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7372 */
7373 void
sensor_threshold_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)7374 sensor_threshold_proxy_new_for_bus (
7375 GBusType bus_type,
7376 GDBusProxyFlags flags,
7377 const gchar *name,
7378 const gchar *object_path,
7379 GCancellable *cancellable,
7380 GAsyncReadyCallback callback,
7381 gpointer user_data)
7382 {
7383 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);
7384 }
7385
7386 /**
7387 * sensor_threshold_proxy_new_for_bus_finish:
7388 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7389 * @error: Return location for error or %NULL
7390 *
7391 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7392 *
7393 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7394 */
7395 SensorThreshold *
sensor_threshold_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)7396 sensor_threshold_proxy_new_for_bus_finish (
7397 GAsyncResult *res,
7398 GError **error)
7399 {
7400 GObject *ret;
7401 GObject *source_object;
7402 source_object = g_async_result_get_source_object (res);
7403 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7404 g_object_unref (source_object);
7405 if (ret != NULL)
7406 return SENSOR_THRESHOLD (ret);
7407 else
7408 return NULL;
7409 }
7410
7411 /**
7412 * sensor_threshold_proxy_new_for_bus_sync:
7413 * @bus_type: A #GBusType.
7414 * @flags: Flags from the #GDBusProxyFlags enumeration.
7415 * @name: A bus name (well-known or unique).
7416 * @object_path: An object path.
7417 * @cancellable: (nullable): A #GCancellable or %NULL.
7418 * @error: Return location for error or %NULL
7419 *
7420 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7421 *
7422 * The calling thread is blocked until a reply is received.
7423 *
7424 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7425 *
7426 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7427 */
7428 SensorThreshold *
sensor_threshold_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)7429 sensor_threshold_proxy_new_for_bus_sync (
7430 GBusType bus_type,
7431 GDBusProxyFlags flags,
7432 const gchar *name,
7433 const gchar *object_path,
7434 GCancellable *cancellable,
7435 GError **error)
7436 {
7437 GInitable *ret;
7438 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);
7439 if (ret != NULL)
7440 return SENSOR_THRESHOLD (ret);
7441 else
7442 return NULL;
7443 }
7444
7445
7446 /* ------------------------------------------------------------------------ */
7447
7448 /**
7449 * SensorThresholdSkeleton:
7450 *
7451 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7452 */
7453
7454 /**
7455 * SensorThresholdSkeletonClass:
7456 * @parent_class: The parent class.
7457 *
7458 * Class structure for #SensorThresholdSkeleton.
7459 */
7460
7461 struct _SensorThresholdSkeletonPrivate
7462 {
7463 GValue *properties;
7464 GList *changed_properties;
7465 GSource *changed_properties_idle_source;
7466 GMainContext *context;
7467 GMutex lock;
7468 };
7469
7470 static void
_sensor_threshold_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)7471 _sensor_threshold_skeleton_handle_method_call (
7472 GDBusConnection *connection G_GNUC_UNUSED,
7473 const gchar *sender G_GNUC_UNUSED,
7474 const gchar *object_path G_GNUC_UNUSED,
7475 const gchar *interface_name,
7476 const gchar *method_name,
7477 GVariant *parameters,
7478 GDBusMethodInvocation *invocation,
7479 gpointer user_data)
7480 {
7481 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7482 _ExtendedGDBusMethodInfo *info;
7483 GVariantIter iter;
7484 GVariant *child;
7485 GValue *paramv;
7486 gsize num_params;
7487 guint num_extra;
7488 gsize n;
7489 guint signal_id;
7490 GValue return_value = G_VALUE_INIT;
7491 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7492 g_assert (info != NULL);
7493 num_params = g_variant_n_children (parameters);
7494 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7495 n = 0;
7496 g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD);
7497 g_value_set_object (¶mv[n++], skeleton);
7498 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7499 g_value_set_object (¶mv[n++], invocation);
7500 if (info->pass_fdlist)
7501 {
7502 #ifdef G_OS_UNIX
7503 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
7504 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7505 #else
7506 g_assert_not_reached ();
7507 #endif
7508 }
7509 g_variant_iter_init (&iter, parameters);
7510 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7511 {
7512 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7513 if (arg_info->use_gvariant)
7514 {
7515 g_value_init (¶mv[n], G_TYPE_VARIANT);
7516 g_value_set_variant (¶mv[n], child);
7517 n++;
7518 }
7519 else
7520 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
7521 g_variant_unref (child);
7522 }
7523 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7524 g_value_init (&return_value, G_TYPE_BOOLEAN);
7525 g_signal_emitv (paramv, signal_id, 0, &return_value);
7526 if (!g_value_get_boolean (&return_value))
7527 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);
7528 g_value_unset (&return_value);
7529 for (n = 0; n < num_params + num_extra; n++)
7530 g_value_unset (¶mv[n]);
7531 g_free (paramv);
7532 }
7533
7534 static GVariant *
_sensor_threshold_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)7535 _sensor_threshold_skeleton_handle_get_property (
7536 GDBusConnection *connection G_GNUC_UNUSED,
7537 const gchar *sender G_GNUC_UNUSED,
7538 const gchar *object_path G_GNUC_UNUSED,
7539 const gchar *interface_name G_GNUC_UNUSED,
7540 const gchar *property_name,
7541 GError **error,
7542 gpointer user_data)
7543 {
7544 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7545 GValue value = G_VALUE_INIT;
7546 GParamSpec *pspec;
7547 _ExtendedGDBusPropertyInfo *info;
7548 GVariant *ret;
7549 ret = NULL;
7550 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7551 g_assert (info != NULL);
7552 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7553 if (pspec == NULL)
7554 {
7555 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7556 }
7557 else
7558 {
7559 g_value_init (&value, pspec->value_type);
7560 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7561 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7562 g_value_unset (&value);
7563 }
7564 return ret;
7565 }
7566
7567 static gboolean
_sensor_threshold_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)7568 _sensor_threshold_skeleton_handle_set_property (
7569 GDBusConnection *connection G_GNUC_UNUSED,
7570 const gchar *sender G_GNUC_UNUSED,
7571 const gchar *object_path G_GNUC_UNUSED,
7572 const gchar *interface_name G_GNUC_UNUSED,
7573 const gchar *property_name,
7574 GVariant *variant,
7575 GError **error,
7576 gpointer user_data)
7577 {
7578 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7579 GValue value = G_VALUE_INIT;
7580 GParamSpec *pspec;
7581 _ExtendedGDBusPropertyInfo *info;
7582 gboolean ret;
7583 ret = FALSE;
7584 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7585 g_assert (info != NULL);
7586 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7587 if (pspec == NULL)
7588 {
7589 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7590 }
7591 else
7592 {
7593 if (info->use_gvariant)
7594 g_value_set_variant (&value, variant);
7595 else
7596 g_dbus_gvariant_to_gvalue (variant, &value);
7597 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7598 g_value_unset (&value);
7599 ret = TRUE;
7600 }
7601 return ret;
7602 }
7603
7604 static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7605 {
7606 _sensor_threshold_skeleton_handle_method_call,
7607 _sensor_threshold_skeleton_handle_get_property,
7608 _sensor_threshold_skeleton_handle_set_property,
7609 {NULL}
7610 };
7611
7612 static GDBusInterfaceInfo *
sensor_threshold_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)7613 sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7614 {
7615 return sensor_threshold_interface_info ();
7616 }
7617
7618 static GDBusInterfaceVTable *
sensor_threshold_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)7619 sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7620 {
7621 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7622 }
7623
7624 static GVariant *
sensor_threshold_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)7625 sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7626 {
7627 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7628
7629 GVariantBuilder builder;
7630 guint n;
7631 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7632 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7633 goto out;
7634 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7635 {
7636 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7637 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7638 {
7639 GVariant *value;
7640 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);
7641 if (value != NULL)
7642 {
7643 g_variant_take_ref (value);
7644 g_variant_builder_add (&builder, "{sv}", info->name, value);
7645 g_variant_unref (value);
7646 }
7647 }
7648 }
7649 out:
7650 return g_variant_builder_end (&builder);
7651 }
7652
7653 static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7654
7655 static void
sensor_threshold_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)7656 sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7657 {
7658 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7659 gboolean emit_changed = FALSE;
7660
7661 g_mutex_lock (&skeleton->priv->lock);
7662 if (skeleton->priv->changed_properties_idle_source != NULL)
7663 {
7664 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7665 skeleton->priv->changed_properties_idle_source = NULL;
7666 emit_changed = TRUE;
7667 }
7668 g_mutex_unlock (&skeleton->priv->lock);
7669
7670 if (emit_changed)
7671 _sensor_threshold_emit_changed (skeleton);
7672 }
7673
7674 static void
_sensor_threshold_on_signal_warning(SensorThreshold * object)7675 _sensor_threshold_on_signal_warning (
7676 SensorThreshold *object)
7677 {
7678 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7679
7680 GList *connections, *l;
7681 GVariant *signal_variant;
7682 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7683
7684 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7685 for (l = connections; l != NULL; l = l->next)
7686 {
7687 GDBusConnection *connection = l->data;
7688 g_dbus_connection_emit_signal (connection,
7689 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7690 signal_variant, NULL);
7691 }
7692 g_variant_unref (signal_variant);
7693 g_list_free_full (connections, g_object_unref);
7694 }
7695
7696 static void
_sensor_threshold_on_signal_critical(SensorThreshold * object)7697 _sensor_threshold_on_signal_critical (
7698 SensorThreshold *object)
7699 {
7700 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7701
7702 GList *connections, *l;
7703 GVariant *signal_variant;
7704 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7705
7706 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7707 for (l = connections; l != NULL; l = l->next)
7708 {
7709 GDBusConnection *connection = l->data;
7710 g_dbus_connection_emit_signal (connection,
7711 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7712 signal_variant, NULL);
7713 }
7714 g_variant_unref (signal_variant);
7715 g_list_free_full (connections, g_object_unref);
7716 }
7717
7718 static void
_sensor_threshold_on_signal_normal(SensorThreshold * object)7719 _sensor_threshold_on_signal_normal (
7720 SensorThreshold *object)
7721 {
7722 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7723
7724 GList *connections, *l;
7725 GVariant *signal_variant;
7726 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7727
7728 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7729 for (l = connections; l != NULL; l = l->next)
7730 {
7731 GDBusConnection *connection = l->data;
7732 g_dbus_connection_emit_signal (connection,
7733 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7734 signal_variant, NULL);
7735 }
7736 g_variant_unref (signal_variant);
7737 g_list_free_full (connections, g_object_unref);
7738 }
7739
7740 static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7741 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorThresholdSkeleton,sensor_threshold_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SensorThresholdSkeleton)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD,sensor_threshold_skeleton_iface_init))7742 G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7743 G_ADD_PRIVATE (SensorThresholdSkeleton)
7744 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init))
7745
7746 #else
7747 G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7748 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init))
7749
7750 #endif
7751 static void
7752 sensor_threshold_skeleton_finalize (GObject *object)
7753 {
7754 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7755 guint n;
7756 for (n = 0; n < 5; n++)
7757 g_value_unset (&skeleton->priv->properties[n]);
7758 g_free (skeleton->priv->properties);
7759 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7760 if (skeleton->priv->changed_properties_idle_source != NULL)
7761 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7762 g_main_context_unref (skeleton->priv->context);
7763 g_mutex_clear (&skeleton->priv->lock);
7764 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7765 }
7766
7767 static void
sensor_threshold_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7768 sensor_threshold_skeleton_get_property (GObject *object,
7769 guint prop_id,
7770 GValue *value,
7771 GParamSpec *pspec G_GNUC_UNUSED)
7772 {
7773 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7774 g_assert (prop_id != 0 && prop_id - 1 < 5);
7775 g_mutex_lock (&skeleton->priv->lock);
7776 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7777 g_mutex_unlock (&skeleton->priv->lock);
7778 }
7779
7780 static gboolean
_sensor_threshold_emit_changed(gpointer user_data)7781 _sensor_threshold_emit_changed (gpointer user_data)
7782 {
7783 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7784 GList *l;
7785 GVariantBuilder builder;
7786 GVariantBuilder invalidated_builder;
7787 guint num_changes;
7788
7789 g_mutex_lock (&skeleton->priv->lock);
7790 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7791 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7792 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7793 {
7794 ChangedProperty *cp = l->data;
7795 GVariant *variant;
7796 const GValue *cur_value;
7797
7798 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7799 if (!_g_value_equal (cur_value, &cp->orig_value))
7800 {
7801 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7802 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7803 g_variant_unref (variant);
7804 num_changes++;
7805 }
7806 }
7807 if (num_changes > 0)
7808 {
7809 GList *connections, *ll;
7810 GVariant *signal_variant;
7811 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7812 &builder, &invalidated_builder));
7813 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7814 for (ll = connections; ll != NULL; ll = ll->next)
7815 {
7816 GDBusConnection *connection = ll->data;
7817
7818 g_dbus_connection_emit_signal (connection,
7819 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7820 "org.freedesktop.DBus.Properties",
7821 "PropertiesChanged",
7822 signal_variant,
7823 NULL);
7824 }
7825 g_variant_unref (signal_variant);
7826 g_list_free_full (connections, g_object_unref);
7827 }
7828 else
7829 {
7830 g_variant_builder_clear (&builder);
7831 g_variant_builder_clear (&invalidated_builder);
7832 }
7833 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7834 skeleton->priv->changed_properties = NULL;
7835 skeleton->priv->changed_properties_idle_source = NULL;
7836 g_mutex_unlock (&skeleton->priv->lock);
7837 return FALSE;
7838 }
7839
7840 static void
_sensor_threshold_schedule_emit_changed(SensorThresholdSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)7841 _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7842 {
7843 ChangedProperty *cp;
7844 GList *l;
7845 cp = NULL;
7846 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7847 {
7848 ChangedProperty *i_cp = l->data;
7849 if (i_cp->info == info)
7850 {
7851 cp = i_cp;
7852 break;
7853 }
7854 }
7855 if (cp == NULL)
7856 {
7857 cp = g_new0 (ChangedProperty, 1);
7858 cp->prop_id = prop_id;
7859 cp->info = info;
7860 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7861 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7862 g_value_copy (orig_value, &cp->orig_value);
7863 }
7864 }
7865
7866 static void
sensor_threshold_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)7867 sensor_threshold_skeleton_notify (GObject *object,
7868 GParamSpec *pspec G_GNUC_UNUSED)
7869 {
7870 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7871 g_mutex_lock (&skeleton->priv->lock);
7872 if (skeleton->priv->changed_properties != NULL &&
7873 skeleton->priv->changed_properties_idle_source == NULL)
7874 {
7875 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7876 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7877 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7878 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed");
7879 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7880 g_source_unref (skeleton->priv->changed_properties_idle_source);
7881 }
7882 g_mutex_unlock (&skeleton->priv->lock);
7883 }
7884
7885 static void
sensor_threshold_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)7886 sensor_threshold_skeleton_set_property (GObject *object,
7887 guint prop_id,
7888 const GValue *value,
7889 GParamSpec *pspec)
7890 {
7891 const _ExtendedGDBusPropertyInfo *info;
7892 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7893 g_assert (prop_id != 0 && prop_id - 1 < 5);
7894 info = (const _ExtendedGDBusPropertyInfo *) _sensor_threshold_property_info_pointers[prop_id - 1];
7895 g_mutex_lock (&skeleton->priv->lock);
7896 g_object_freeze_notify (object);
7897 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7898 {
7899 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
7900 info->emits_changed_signal)
7901 _sensor_threshold_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
7902 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7903 g_object_notify_by_pspec (object, pspec);
7904 }
7905 g_mutex_unlock (&skeleton->priv->lock);
7906 g_object_thaw_notify (object);
7907 }
7908
7909 static void
sensor_threshold_skeleton_init(SensorThresholdSkeleton * skeleton)7910 sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7911 {
7912 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7913 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7914 #else
7915 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7916 #endif
7917
7918 g_mutex_init (&skeleton->priv->lock);
7919 skeleton->priv->context = g_main_context_ref_thread_default ();
7920 skeleton->priv->properties = g_new0 (GValue, 5);
7921 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7922 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7923 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7924 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7925 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7926 }
7927
7928 static GVariant *
sensor_threshold_skeleton_get_lower_critical(SensorThreshold * object)7929 sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7930 {
7931 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7932 GVariant *value;
7933 g_mutex_lock (&skeleton->priv->lock);
7934 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[0]));
7935 g_mutex_unlock (&skeleton->priv->lock);
7936 return value;
7937 }
7938
7939 static GVariant *
sensor_threshold_skeleton_get_lower_warning(SensorThreshold * object)7940 sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7941 {
7942 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7943 GVariant *value;
7944 g_mutex_lock (&skeleton->priv->lock);
7945 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[1]));
7946 g_mutex_unlock (&skeleton->priv->lock);
7947 return value;
7948 }
7949
7950 static GVariant *
sensor_threshold_skeleton_get_upper_warning(SensorThreshold * object)7951 sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7952 {
7953 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7954 GVariant *value;
7955 g_mutex_lock (&skeleton->priv->lock);
7956 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[2]));
7957 g_mutex_unlock (&skeleton->priv->lock);
7958 return value;
7959 }
7960
7961 static GVariant *
sensor_threshold_skeleton_get_upper_critical(SensorThreshold * object)7962 sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7963 {
7964 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7965 GVariant *value;
7966 g_mutex_lock (&skeleton->priv->lock);
7967 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[3]));
7968 g_mutex_unlock (&skeleton->priv->lock);
7969 return value;
7970 }
7971
7972 static guchar
sensor_threshold_skeleton_get_state(SensorThreshold * object)7973 sensor_threshold_skeleton_get_state (SensorThreshold *object)
7974 {
7975 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7976 guchar value;
7977 g_mutex_lock (&skeleton->priv->lock);
7978 value = g_marshal_value_peek_uchar (&(skeleton->priv->properties[4]));
7979 g_mutex_unlock (&skeleton->priv->lock);
7980 return value;
7981 }
7982
7983 static void
sensor_threshold_skeleton_class_init(SensorThresholdSkeletonClass * klass)7984 sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7985 {
7986 GObjectClass *gobject_class;
7987 GDBusInterfaceSkeletonClass *skeleton_class;
7988
7989 gobject_class = G_OBJECT_CLASS (klass);
7990 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7991 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7992 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7993 gobject_class->notify = sensor_threshold_skeleton_notify;
7994
7995
7996 sensor_threshold_override_properties (gobject_class, 1);
7997
7998 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7999 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
8000 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
8001 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
8002 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
8003
8004 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8005 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
8006 #endif
8007 }
8008
8009 static void
sensor_threshold_skeleton_iface_init(SensorThresholdIface * iface)8010 sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
8011 {
8012 iface->warning = _sensor_threshold_on_signal_warning;
8013 iface->critical = _sensor_threshold_on_signal_critical;
8014 iface->normal = _sensor_threshold_on_signal_normal;
8015 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
8016 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
8017 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
8018 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
8019 iface->get_state = sensor_threshold_skeleton_get_state;
8020 }
8021
8022 /**
8023 * sensor_threshold_skeleton_new:
8024 *
8025 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
8026 *
8027 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
8028 */
8029 SensorThreshold *
sensor_threshold_skeleton_new(void)8030 sensor_threshold_skeleton_new (void)
8031 {
8032 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
8033 }
8034
8035 /* ------------------------------------------------------------------------
8036 * Code for interface org.openbmc.SensorI2c
8037 * ------------------------------------------------------------------------
8038 */
8039
8040 /**
8041 * SECTION:SensorI2c
8042 * @title: SensorI2c
8043 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
8044 *
8045 * 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.
8046 */
8047
8048 /* ---- Introspection data for org.openbmc.SensorI2c ---- */
8049
8050 static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
8051 {
8052 {
8053 -1,
8054 (gchar *) "dev_path",
8055 (gchar *) "s",
8056 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8057 NULL
8058 },
8059 "dev-path",
8060 FALSE,
8061 TRUE
8062 };
8063
8064 static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
8065 {
8066 {
8067 -1,
8068 (gchar *) "address",
8069 (gchar *) "s",
8070 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8071 NULL
8072 },
8073 "address",
8074 FALSE,
8075 TRUE
8076 };
8077
8078 static const GDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
8079 {
8080 &_sensor_i2c_property_info_dev_path.parent_struct,
8081 &_sensor_i2c_property_info_address.parent_struct,
8082 NULL
8083 };
8084
8085 static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
8086 {
8087 {
8088 -1,
8089 (gchar *) "org.openbmc.SensorI2c",
8090 NULL,
8091 NULL,
8092 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
8093 NULL
8094 },
8095 "sensor-i2c",
8096 };
8097
8098
8099 /**
8100 * sensor_i2c_interface_info:
8101 *
8102 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
8103 *
8104 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8105 */
8106 GDBusInterfaceInfo *
sensor_i2c_interface_info(void)8107 sensor_i2c_interface_info (void)
8108 {
8109 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
8110 }
8111
8112 /**
8113 * sensor_i2c_override_properties:
8114 * @klass: The class structure for a #GObject derived class.
8115 * @property_id_begin: The property id to assign to the first overridden property.
8116 *
8117 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
8118 * The properties are overridden in the order they are defined.
8119 *
8120 * Returns: The last property id.
8121 */
8122 guint
sensor_i2c_override_properties(GObjectClass * klass,guint property_id_begin)8123 sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
8124 {
8125 g_object_class_override_property (klass, property_id_begin++, "dev-path");
8126 g_object_class_override_property (klass, property_id_begin++, "address");
8127 return property_id_begin - 1;
8128 }
8129
8130
8131
8132 /**
8133 * SensorI2c:
8134 *
8135 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8136 */
8137
8138 /**
8139 * SensorI2cIface:
8140 * @parent_iface: The parent interface.
8141 * @get_address: Getter for the #SensorI2c:address property.
8142 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
8143 *
8144 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8145 */
8146
8147 typedef SensorI2cIface SensorI2cInterface;
G_DEFINE_INTERFACE(SensorI2c,sensor_i2c,G_TYPE_OBJECT)8148 G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT)
8149
8150 static void
8151 sensor_i2c_default_init (SensorI2cIface *iface)
8152 {
8153 /* GObject properties for D-Bus properties: */
8154 /**
8155 * SensorI2c:dev-path:
8156 *
8157 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
8158 *
8159 * 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.
8160 */
8161 g_object_interface_install_property (iface,
8162 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8163 /**
8164 * SensorI2c:address:
8165 *
8166 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
8167 *
8168 * 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.
8169 */
8170 g_object_interface_install_property (iface,
8171 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8172 }
8173
8174 /**
8175 * sensor_i2c_get_dev_path: (skip)
8176 * @object: A #SensorI2c.
8177 *
8178 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8179 *
8180 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8181 *
8182 * 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.
8183 *
8184 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8185 */
8186 const gchar *
sensor_i2c_get_dev_path(SensorI2c * object)8187 sensor_i2c_get_dev_path (SensorI2c *object)
8188 {
8189 g_return_val_if_fail (IS_SENSOR_I2C (object), NULL);
8190
8191 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
8192 }
8193
8194 /**
8195 * sensor_i2c_dup_dev_path: (skip)
8196 * @object: A #SensorI2c.
8197 *
8198 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8199 *
8200 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8201 *
8202 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8203 */
8204 gchar *
sensor_i2c_dup_dev_path(SensorI2c * object)8205 sensor_i2c_dup_dev_path (SensorI2c *object)
8206 {
8207 gchar *value;
8208 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
8209 return value;
8210 }
8211
8212 /**
8213 * sensor_i2c_set_dev_path: (skip)
8214 * @object: A #SensorI2c.
8215 * @value: The value to set.
8216 *
8217 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
8218 *
8219 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8220 */
8221 void
sensor_i2c_set_dev_path(SensorI2c * object,const gchar * value)8222 sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
8223 {
8224 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
8225 }
8226
8227 /**
8228 * sensor_i2c_get_address: (skip)
8229 * @object: A #SensorI2c.
8230 *
8231 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8232 *
8233 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8234 *
8235 * 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.
8236 *
8237 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8238 */
8239 const gchar *
sensor_i2c_get_address(SensorI2c * object)8240 sensor_i2c_get_address (SensorI2c *object)
8241 {
8242 g_return_val_if_fail (IS_SENSOR_I2C (object), NULL);
8243
8244 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
8245 }
8246
8247 /**
8248 * sensor_i2c_dup_address: (skip)
8249 * @object: A #SensorI2c.
8250 *
8251 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8252 *
8253 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8254 *
8255 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8256 */
8257 gchar *
sensor_i2c_dup_address(SensorI2c * object)8258 sensor_i2c_dup_address (SensorI2c *object)
8259 {
8260 gchar *value;
8261 g_object_get (G_OBJECT (object), "address", &value, NULL);
8262 return value;
8263 }
8264
8265 /**
8266 * sensor_i2c_set_address: (skip)
8267 * @object: A #SensorI2c.
8268 * @value: The value to set.
8269 *
8270 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
8271 *
8272 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8273 */
8274 void
sensor_i2c_set_address(SensorI2c * object,const gchar * value)8275 sensor_i2c_set_address (SensorI2c *object, const gchar *value)
8276 {
8277 g_object_set (G_OBJECT (object), "address", value, NULL);
8278 }
8279
8280 /* ------------------------------------------------------------------------ */
8281
8282 /**
8283 * SensorI2cProxy:
8284 *
8285 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
8286 */
8287
8288 /**
8289 * SensorI2cProxyClass:
8290 * @parent_class: The parent class.
8291 *
8292 * Class structure for #SensorI2cProxy.
8293 */
8294
8295 struct _SensorI2cProxyPrivate
8296 {
8297 GData *qdata;
8298 };
8299
8300 static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
8301
8302 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorI2cProxy,sensor_i2c_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SensorI2cProxy)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C,sensor_i2c_proxy_iface_init))8303 G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8304 G_ADD_PRIVATE (SensorI2cProxy)
8305 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init))
8306
8307 #else
8308 G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8309 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init))
8310
8311 #endif
8312 static void
8313 sensor_i2c_proxy_finalize (GObject *object)
8314 {
8315 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8316 g_datalist_clear (&proxy->priv->qdata);
8317 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
8318 }
8319
8320 static void
sensor_i2c_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)8321 sensor_i2c_proxy_get_property (GObject *object,
8322 guint prop_id,
8323 GValue *value,
8324 GParamSpec *pspec G_GNUC_UNUSED)
8325 {
8326 const _ExtendedGDBusPropertyInfo *info;
8327 GVariant *variant;
8328 g_assert (prop_id != 0 && prop_id - 1 < 2);
8329 info = (const _ExtendedGDBusPropertyInfo *) _sensor_i2c_property_info_pointers[prop_id - 1];
8330 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8331 if (info->use_gvariant)
8332 {
8333 g_value_set_variant (value, variant);
8334 }
8335 else
8336 {
8337 if (variant != NULL)
8338 g_dbus_gvariant_to_gvalue (variant, value);
8339 }
8340 if (variant != NULL)
8341 g_variant_unref (variant);
8342 }
8343
8344 static void
sensor_i2c_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)8345 sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8346 GAsyncResult *res,
8347 gpointer user_data)
8348 {
8349 const _ExtendedGDBusPropertyInfo *info = user_data;
8350 GError *error;
8351 GVariant *_ret;
8352 error = NULL;
8353 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8354 if (!_ret)
8355 {
8356 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8357 info->parent_struct.name,
8358 error->message, g_quark_to_string (error->domain), error->code);
8359 g_error_free (error);
8360 }
8361 else
8362 {
8363 g_variant_unref (_ret);
8364 }
8365 }
8366
8367 static void
sensor_i2c_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)8368 sensor_i2c_proxy_set_property (GObject *object,
8369 guint prop_id,
8370 const GValue *value,
8371 GParamSpec *pspec G_GNUC_UNUSED)
8372 {
8373 const _ExtendedGDBusPropertyInfo *info;
8374 GVariant *variant;
8375 g_assert (prop_id != 0 && prop_id - 1 < 2);
8376 info = (const _ExtendedGDBusPropertyInfo *) _sensor_i2c_property_info_pointers[prop_id - 1];
8377 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8378 g_dbus_proxy_call (G_DBUS_PROXY (object),
8379 "org.freedesktop.DBus.Properties.Set",
8380 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8381 G_DBUS_CALL_FLAGS_NONE,
8382 -1,
8383 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8384 g_variant_unref (variant);
8385 }
8386
8387 static void
sensor_i2c_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)8388 sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8389 const gchar *sender_name G_GNUC_UNUSED,
8390 const gchar *signal_name,
8391 GVariant *parameters)
8392 {
8393 _ExtendedGDBusSignalInfo *info;
8394 GVariantIter iter;
8395 GVariant *child;
8396 GValue *paramv;
8397 gsize num_params;
8398 gsize n;
8399 guint signal_id;
8400 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8401 if (info == NULL)
8402 return;
8403 num_params = g_variant_n_children (parameters);
8404 paramv = g_new0 (GValue, num_params + 1);
8405 g_value_init (¶mv[0], TYPE_SENSOR_I2C);
8406 g_value_set_object (¶mv[0], proxy);
8407 g_variant_iter_init (&iter, parameters);
8408 n = 1;
8409 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8410 {
8411 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8412 if (arg_info->use_gvariant)
8413 {
8414 g_value_init (¶mv[n], G_TYPE_VARIANT);
8415 g_value_set_variant (¶mv[n], child);
8416 n++;
8417 }
8418 else
8419 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
8420 g_variant_unref (child);
8421 }
8422 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8423 g_signal_emitv (paramv, signal_id, 0, NULL);
8424 for (n = 0; n < num_params + 1; n++)
8425 g_value_unset (¶mv[n]);
8426 g_free (paramv);
8427 }
8428
8429 static void
sensor_i2c_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)8430 sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8431 GVariant *changed_properties,
8432 const gchar *const *invalidated_properties)
8433 {
8434 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8435 guint n;
8436 const gchar *key;
8437 GVariantIter *iter;
8438 _ExtendedGDBusPropertyInfo *info;
8439 g_variant_get (changed_properties, "a{sv}", &iter);
8440 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8441 {
8442 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8443 g_datalist_remove_data (&proxy->priv->qdata, key);
8444 if (info != NULL)
8445 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8446 }
8447 g_variant_iter_free (iter);
8448 for (n = 0; invalidated_properties[n] != NULL; n++)
8449 {
8450 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8451 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8452 if (info != NULL)
8453 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8454 }
8455 }
8456
8457 static const gchar *
sensor_i2c_proxy_get_dev_path(SensorI2c * object)8458 sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8459 {
8460 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8461 GVariant *variant;
8462 const gchar *value = NULL;
8463 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8464 if (variant != NULL)
8465 {
8466 value = g_variant_get_string (variant, NULL);
8467 g_variant_unref (variant);
8468 }
8469 return value;
8470 }
8471
8472 static const gchar *
sensor_i2c_proxy_get_address(SensorI2c * object)8473 sensor_i2c_proxy_get_address (SensorI2c *object)
8474 {
8475 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8476 GVariant *variant;
8477 const gchar *value = NULL;
8478 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8479 if (variant != NULL)
8480 {
8481 value = g_variant_get_string (variant, NULL);
8482 g_variant_unref (variant);
8483 }
8484 return value;
8485 }
8486
8487 static void
sensor_i2c_proxy_init(SensorI2cProxy * proxy)8488 sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8489 {
8490 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8491 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8492 #else
8493 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8494 #endif
8495
8496 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8497 }
8498
8499 static void
sensor_i2c_proxy_class_init(SensorI2cProxyClass * klass)8500 sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8501 {
8502 GObjectClass *gobject_class;
8503 GDBusProxyClass *proxy_class;
8504
8505 gobject_class = G_OBJECT_CLASS (klass);
8506 gobject_class->finalize = sensor_i2c_proxy_finalize;
8507 gobject_class->get_property = sensor_i2c_proxy_get_property;
8508 gobject_class->set_property = sensor_i2c_proxy_set_property;
8509
8510 proxy_class = G_DBUS_PROXY_CLASS (klass);
8511 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8512 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8513
8514 sensor_i2c_override_properties (gobject_class, 1);
8515
8516 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8517 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8518 #endif
8519 }
8520
8521 static void
sensor_i2c_proxy_iface_init(SensorI2cIface * iface)8522 sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8523 {
8524 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8525 iface->get_address = sensor_i2c_proxy_get_address;
8526 }
8527
8528 /**
8529 * sensor_i2c_proxy_new:
8530 * @connection: A #GDBusConnection.
8531 * @flags: Flags from the #GDBusProxyFlags enumeration.
8532 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8533 * @object_path: An object path.
8534 * @cancellable: (nullable): A #GCancellable or %NULL.
8535 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8536 * @user_data: User data to pass to @callback.
8537 *
8538 * 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.
8539 *
8540 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
8541 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8542 *
8543 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8544 */
8545 void
sensor_i2c_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)8546 sensor_i2c_proxy_new (
8547 GDBusConnection *connection,
8548 GDBusProxyFlags flags,
8549 const gchar *name,
8550 const gchar *object_path,
8551 GCancellable *cancellable,
8552 GAsyncReadyCallback callback,
8553 gpointer user_data)
8554 {
8555 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);
8556 }
8557
8558 /**
8559 * sensor_i2c_proxy_new_finish:
8560 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8561 * @error: Return location for error or %NULL
8562 *
8563 * Finishes an operation started with sensor_i2c_proxy_new().
8564 *
8565 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8566 */
8567 SensorI2c *
sensor_i2c_proxy_new_finish(GAsyncResult * res,GError ** error)8568 sensor_i2c_proxy_new_finish (
8569 GAsyncResult *res,
8570 GError **error)
8571 {
8572 GObject *ret;
8573 GObject *source_object;
8574 source_object = g_async_result_get_source_object (res);
8575 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8576 g_object_unref (source_object);
8577 if (ret != NULL)
8578 return SENSOR_I2C (ret);
8579 else
8580 return NULL;
8581 }
8582
8583 /**
8584 * sensor_i2c_proxy_new_sync:
8585 * @connection: A #GDBusConnection.
8586 * @flags: Flags from the #GDBusProxyFlags enumeration.
8587 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8588 * @object_path: An object path.
8589 * @cancellable: (nullable): A #GCancellable or %NULL.
8590 * @error: Return location for error or %NULL
8591 *
8592 * 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.
8593 *
8594 * The calling thread is blocked until a reply is received.
8595 *
8596 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8597 *
8598 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8599 */
8600 SensorI2c *
sensor_i2c_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)8601 sensor_i2c_proxy_new_sync (
8602 GDBusConnection *connection,
8603 GDBusProxyFlags flags,
8604 const gchar *name,
8605 const gchar *object_path,
8606 GCancellable *cancellable,
8607 GError **error)
8608 {
8609 GInitable *ret;
8610 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);
8611 if (ret != NULL)
8612 return SENSOR_I2C (ret);
8613 else
8614 return NULL;
8615 }
8616
8617
8618 /**
8619 * sensor_i2c_proxy_new_for_bus:
8620 * @bus_type: A #GBusType.
8621 * @flags: Flags from the #GDBusProxyFlags enumeration.
8622 * @name: A bus name (well-known or unique).
8623 * @object_path: An object path.
8624 * @cancellable: (nullable): A #GCancellable or %NULL.
8625 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8626 * @user_data: User data to pass to @callback.
8627 *
8628 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8629 *
8630 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
8631 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8632 *
8633 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8634 */
8635 void
sensor_i2c_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)8636 sensor_i2c_proxy_new_for_bus (
8637 GBusType bus_type,
8638 GDBusProxyFlags flags,
8639 const gchar *name,
8640 const gchar *object_path,
8641 GCancellable *cancellable,
8642 GAsyncReadyCallback callback,
8643 gpointer user_data)
8644 {
8645 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);
8646 }
8647
8648 /**
8649 * sensor_i2c_proxy_new_for_bus_finish:
8650 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8651 * @error: Return location for error or %NULL
8652 *
8653 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8654 *
8655 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8656 */
8657 SensorI2c *
sensor_i2c_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)8658 sensor_i2c_proxy_new_for_bus_finish (
8659 GAsyncResult *res,
8660 GError **error)
8661 {
8662 GObject *ret;
8663 GObject *source_object;
8664 source_object = g_async_result_get_source_object (res);
8665 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8666 g_object_unref (source_object);
8667 if (ret != NULL)
8668 return SENSOR_I2C (ret);
8669 else
8670 return NULL;
8671 }
8672
8673 /**
8674 * sensor_i2c_proxy_new_for_bus_sync:
8675 * @bus_type: A #GBusType.
8676 * @flags: Flags from the #GDBusProxyFlags enumeration.
8677 * @name: A bus name (well-known or unique).
8678 * @object_path: An object path.
8679 * @cancellable: (nullable): A #GCancellable or %NULL.
8680 * @error: Return location for error or %NULL
8681 *
8682 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8683 *
8684 * The calling thread is blocked until a reply is received.
8685 *
8686 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8687 *
8688 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8689 */
8690 SensorI2c *
sensor_i2c_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)8691 sensor_i2c_proxy_new_for_bus_sync (
8692 GBusType bus_type,
8693 GDBusProxyFlags flags,
8694 const gchar *name,
8695 const gchar *object_path,
8696 GCancellable *cancellable,
8697 GError **error)
8698 {
8699 GInitable *ret;
8700 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);
8701 if (ret != NULL)
8702 return SENSOR_I2C (ret);
8703 else
8704 return NULL;
8705 }
8706
8707
8708 /* ------------------------------------------------------------------------ */
8709
8710 /**
8711 * SensorI2cSkeleton:
8712 *
8713 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8714 */
8715
8716 /**
8717 * SensorI2cSkeletonClass:
8718 * @parent_class: The parent class.
8719 *
8720 * Class structure for #SensorI2cSkeleton.
8721 */
8722
8723 struct _SensorI2cSkeletonPrivate
8724 {
8725 GValue *properties;
8726 GList *changed_properties;
8727 GSource *changed_properties_idle_source;
8728 GMainContext *context;
8729 GMutex lock;
8730 };
8731
8732 static void
_sensor_i2c_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)8733 _sensor_i2c_skeleton_handle_method_call (
8734 GDBusConnection *connection G_GNUC_UNUSED,
8735 const gchar *sender G_GNUC_UNUSED,
8736 const gchar *object_path G_GNUC_UNUSED,
8737 const gchar *interface_name,
8738 const gchar *method_name,
8739 GVariant *parameters,
8740 GDBusMethodInvocation *invocation,
8741 gpointer user_data)
8742 {
8743 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8744 _ExtendedGDBusMethodInfo *info;
8745 GVariantIter iter;
8746 GVariant *child;
8747 GValue *paramv;
8748 gsize num_params;
8749 guint num_extra;
8750 gsize n;
8751 guint signal_id;
8752 GValue return_value = G_VALUE_INIT;
8753 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8754 g_assert (info != NULL);
8755 num_params = g_variant_n_children (parameters);
8756 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8757 n = 0;
8758 g_value_init (¶mv[n], TYPE_SENSOR_I2C);
8759 g_value_set_object (¶mv[n++], skeleton);
8760 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8761 g_value_set_object (¶mv[n++], invocation);
8762 if (info->pass_fdlist)
8763 {
8764 #ifdef G_OS_UNIX
8765 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
8766 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8767 #else
8768 g_assert_not_reached ();
8769 #endif
8770 }
8771 g_variant_iter_init (&iter, parameters);
8772 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8773 {
8774 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8775 if (arg_info->use_gvariant)
8776 {
8777 g_value_init (¶mv[n], G_TYPE_VARIANT);
8778 g_value_set_variant (¶mv[n], child);
8779 n++;
8780 }
8781 else
8782 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
8783 g_variant_unref (child);
8784 }
8785 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8786 g_value_init (&return_value, G_TYPE_BOOLEAN);
8787 g_signal_emitv (paramv, signal_id, 0, &return_value);
8788 if (!g_value_get_boolean (&return_value))
8789 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);
8790 g_value_unset (&return_value);
8791 for (n = 0; n < num_params + num_extra; n++)
8792 g_value_unset (¶mv[n]);
8793 g_free (paramv);
8794 }
8795
8796 static GVariant *
_sensor_i2c_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)8797 _sensor_i2c_skeleton_handle_get_property (
8798 GDBusConnection *connection G_GNUC_UNUSED,
8799 const gchar *sender G_GNUC_UNUSED,
8800 const gchar *object_path G_GNUC_UNUSED,
8801 const gchar *interface_name G_GNUC_UNUSED,
8802 const gchar *property_name,
8803 GError **error,
8804 gpointer user_data)
8805 {
8806 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8807 GValue value = G_VALUE_INIT;
8808 GParamSpec *pspec;
8809 _ExtendedGDBusPropertyInfo *info;
8810 GVariant *ret;
8811 ret = NULL;
8812 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8813 g_assert (info != NULL);
8814 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8815 if (pspec == NULL)
8816 {
8817 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8818 }
8819 else
8820 {
8821 g_value_init (&value, pspec->value_type);
8822 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8823 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8824 g_value_unset (&value);
8825 }
8826 return ret;
8827 }
8828
8829 static gboolean
_sensor_i2c_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)8830 _sensor_i2c_skeleton_handle_set_property (
8831 GDBusConnection *connection G_GNUC_UNUSED,
8832 const gchar *sender G_GNUC_UNUSED,
8833 const gchar *object_path G_GNUC_UNUSED,
8834 const gchar *interface_name G_GNUC_UNUSED,
8835 const gchar *property_name,
8836 GVariant *variant,
8837 GError **error,
8838 gpointer user_data)
8839 {
8840 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8841 GValue value = G_VALUE_INIT;
8842 GParamSpec *pspec;
8843 _ExtendedGDBusPropertyInfo *info;
8844 gboolean ret;
8845 ret = FALSE;
8846 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8847 g_assert (info != NULL);
8848 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8849 if (pspec == NULL)
8850 {
8851 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8852 }
8853 else
8854 {
8855 if (info->use_gvariant)
8856 g_value_set_variant (&value, variant);
8857 else
8858 g_dbus_gvariant_to_gvalue (variant, &value);
8859 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8860 g_value_unset (&value);
8861 ret = TRUE;
8862 }
8863 return ret;
8864 }
8865
8866 static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8867 {
8868 _sensor_i2c_skeleton_handle_method_call,
8869 _sensor_i2c_skeleton_handle_get_property,
8870 _sensor_i2c_skeleton_handle_set_property,
8871 {NULL}
8872 };
8873
8874 static GDBusInterfaceInfo *
sensor_i2c_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)8875 sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8876 {
8877 return sensor_i2c_interface_info ();
8878 }
8879
8880 static GDBusInterfaceVTable *
sensor_i2c_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)8881 sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8882 {
8883 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8884 }
8885
8886 static GVariant *
sensor_i2c_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)8887 sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8888 {
8889 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8890
8891 GVariantBuilder builder;
8892 guint n;
8893 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8894 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8895 goto out;
8896 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8897 {
8898 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8899 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8900 {
8901 GVariant *value;
8902 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);
8903 if (value != NULL)
8904 {
8905 g_variant_take_ref (value);
8906 g_variant_builder_add (&builder, "{sv}", info->name, value);
8907 g_variant_unref (value);
8908 }
8909 }
8910 }
8911 out:
8912 return g_variant_builder_end (&builder);
8913 }
8914
8915 static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8916
8917 static void
sensor_i2c_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)8918 sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8919 {
8920 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8921 gboolean emit_changed = FALSE;
8922
8923 g_mutex_lock (&skeleton->priv->lock);
8924 if (skeleton->priv->changed_properties_idle_source != NULL)
8925 {
8926 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8927 skeleton->priv->changed_properties_idle_source = NULL;
8928 emit_changed = TRUE;
8929 }
8930 g_mutex_unlock (&skeleton->priv->lock);
8931
8932 if (emit_changed)
8933 _sensor_i2c_emit_changed (skeleton);
8934 }
8935
8936 static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8937 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorI2cSkeleton,sensor_i2c_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SensorI2cSkeleton)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C,sensor_i2c_skeleton_iface_init))8938 G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8939 G_ADD_PRIVATE (SensorI2cSkeleton)
8940 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init))
8941
8942 #else
8943 G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8944 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init))
8945
8946 #endif
8947 static void
8948 sensor_i2c_skeleton_finalize (GObject *object)
8949 {
8950 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8951 guint n;
8952 for (n = 0; n < 2; n++)
8953 g_value_unset (&skeleton->priv->properties[n]);
8954 g_free (skeleton->priv->properties);
8955 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8956 if (skeleton->priv->changed_properties_idle_source != NULL)
8957 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8958 g_main_context_unref (skeleton->priv->context);
8959 g_mutex_clear (&skeleton->priv->lock);
8960 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8961 }
8962
8963 static void
sensor_i2c_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)8964 sensor_i2c_skeleton_get_property (GObject *object,
8965 guint prop_id,
8966 GValue *value,
8967 GParamSpec *pspec G_GNUC_UNUSED)
8968 {
8969 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8970 g_assert (prop_id != 0 && prop_id - 1 < 2);
8971 g_mutex_lock (&skeleton->priv->lock);
8972 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8973 g_mutex_unlock (&skeleton->priv->lock);
8974 }
8975
8976 static gboolean
_sensor_i2c_emit_changed(gpointer user_data)8977 _sensor_i2c_emit_changed (gpointer user_data)
8978 {
8979 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8980 GList *l;
8981 GVariantBuilder builder;
8982 GVariantBuilder invalidated_builder;
8983 guint num_changes;
8984
8985 g_mutex_lock (&skeleton->priv->lock);
8986 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8987 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8988 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8989 {
8990 ChangedProperty *cp = l->data;
8991 GVariant *variant;
8992 const GValue *cur_value;
8993
8994 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8995 if (!_g_value_equal (cur_value, &cp->orig_value))
8996 {
8997 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8998 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8999 g_variant_unref (variant);
9000 num_changes++;
9001 }
9002 }
9003 if (num_changes > 0)
9004 {
9005 GList *connections, *ll;
9006 GVariant *signal_variant;
9007 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
9008 &builder, &invalidated_builder));
9009 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9010 for (ll = connections; ll != NULL; ll = ll->next)
9011 {
9012 GDBusConnection *connection = ll->data;
9013
9014 g_dbus_connection_emit_signal (connection,
9015 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9016 "org.freedesktop.DBus.Properties",
9017 "PropertiesChanged",
9018 signal_variant,
9019 NULL);
9020 }
9021 g_variant_unref (signal_variant);
9022 g_list_free_full (connections, g_object_unref);
9023 }
9024 else
9025 {
9026 g_variant_builder_clear (&builder);
9027 g_variant_builder_clear (&invalidated_builder);
9028 }
9029 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9030 skeleton->priv->changed_properties = NULL;
9031 skeleton->priv->changed_properties_idle_source = NULL;
9032 g_mutex_unlock (&skeleton->priv->lock);
9033 return FALSE;
9034 }
9035
9036 static void
_sensor_i2c_schedule_emit_changed(SensorI2cSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)9037 _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9038 {
9039 ChangedProperty *cp;
9040 GList *l;
9041 cp = NULL;
9042 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9043 {
9044 ChangedProperty *i_cp = l->data;
9045 if (i_cp->info == info)
9046 {
9047 cp = i_cp;
9048 break;
9049 }
9050 }
9051 if (cp == NULL)
9052 {
9053 cp = g_new0 (ChangedProperty, 1);
9054 cp->prop_id = prop_id;
9055 cp->info = info;
9056 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9057 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9058 g_value_copy (orig_value, &cp->orig_value);
9059 }
9060 }
9061
9062 static void
sensor_i2c_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)9063 sensor_i2c_skeleton_notify (GObject *object,
9064 GParamSpec *pspec G_GNUC_UNUSED)
9065 {
9066 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9067 g_mutex_lock (&skeleton->priv->lock);
9068 if (skeleton->priv->changed_properties != NULL &&
9069 skeleton->priv->changed_properties_idle_source == NULL)
9070 {
9071 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9072 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9073 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9074 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed");
9075 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9076 g_source_unref (skeleton->priv->changed_properties_idle_source);
9077 }
9078 g_mutex_unlock (&skeleton->priv->lock);
9079 }
9080
9081 static void
sensor_i2c_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)9082 sensor_i2c_skeleton_set_property (GObject *object,
9083 guint prop_id,
9084 const GValue *value,
9085 GParamSpec *pspec)
9086 {
9087 const _ExtendedGDBusPropertyInfo *info;
9088 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9089 g_assert (prop_id != 0 && prop_id - 1 < 2);
9090 info = (const _ExtendedGDBusPropertyInfo *) _sensor_i2c_property_info_pointers[prop_id - 1];
9091 g_mutex_lock (&skeleton->priv->lock);
9092 g_object_freeze_notify (object);
9093 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9094 {
9095 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
9096 info->emits_changed_signal)
9097 _sensor_i2c_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
9098 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9099 g_object_notify_by_pspec (object, pspec);
9100 }
9101 g_mutex_unlock (&skeleton->priv->lock);
9102 g_object_thaw_notify (object);
9103 }
9104
9105 static void
sensor_i2c_skeleton_init(SensorI2cSkeleton * skeleton)9106 sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
9107 {
9108 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9109 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
9110 #else
9111 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
9112 #endif
9113
9114 g_mutex_init (&skeleton->priv->lock);
9115 skeleton->priv->context = g_main_context_ref_thread_default ();
9116 skeleton->priv->properties = g_new0 (GValue, 2);
9117 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
9118 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
9119 }
9120
9121 static const gchar *
sensor_i2c_skeleton_get_dev_path(SensorI2c * object)9122 sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
9123 {
9124 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9125 const gchar *value;
9126 g_mutex_lock (&skeleton->priv->lock);
9127 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
9128 g_mutex_unlock (&skeleton->priv->lock);
9129 return value;
9130 }
9131
9132 static const gchar *
sensor_i2c_skeleton_get_address(SensorI2c * object)9133 sensor_i2c_skeleton_get_address (SensorI2c *object)
9134 {
9135 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9136 const gchar *value;
9137 g_mutex_lock (&skeleton->priv->lock);
9138 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
9139 g_mutex_unlock (&skeleton->priv->lock);
9140 return value;
9141 }
9142
9143 static void
sensor_i2c_skeleton_class_init(SensorI2cSkeletonClass * klass)9144 sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
9145 {
9146 GObjectClass *gobject_class;
9147 GDBusInterfaceSkeletonClass *skeleton_class;
9148
9149 gobject_class = G_OBJECT_CLASS (klass);
9150 gobject_class->finalize = sensor_i2c_skeleton_finalize;
9151 gobject_class->get_property = sensor_i2c_skeleton_get_property;
9152 gobject_class->set_property = sensor_i2c_skeleton_set_property;
9153 gobject_class->notify = sensor_i2c_skeleton_notify;
9154
9155
9156 sensor_i2c_override_properties (gobject_class, 1);
9157
9158 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9159 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
9160 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
9161 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
9162 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
9163
9164 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9165 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
9166 #endif
9167 }
9168
9169 static void
sensor_i2c_skeleton_iface_init(SensorI2cIface * iface)9170 sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
9171 {
9172 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
9173 iface->get_address = sensor_i2c_skeleton_get_address;
9174 }
9175
9176 /**
9177 * sensor_i2c_skeleton_new:
9178 *
9179 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
9180 *
9181 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
9182 */
9183 SensorI2c *
sensor_i2c_skeleton_new(void)9184 sensor_i2c_skeleton_new (void)
9185 {
9186 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
9187 }
9188
9189 /* ------------------------------------------------------------------------
9190 * Code for interface org.openbmc.SensorMatch
9191 * ------------------------------------------------------------------------
9192 */
9193
9194 /**
9195 * SECTION:SensorMatch
9196 * @title: SensorMatch
9197 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
9198 *
9199 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C.
9200 */
9201
9202 enum
9203 {
9204 _SENSOR_MATCH_SENSOR_MATCH,
9205 };
9206
9207 static unsigned _SENSOR_MATCH_SIGNALS[1] = { 0 };
9208
9209 /* ---- Introspection data for org.openbmc.SensorMatch ---- */
9210
9211 static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
9212 {
9213 {
9214 -1,
9215 (gchar *) "state",
9216 (gchar *) "y",
9217 NULL
9218 },
9219 FALSE
9220 };
9221
9222 static const GDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
9223 {
9224 &_sensor_match_signal_info_sensor_match_ARG_state.parent_struct,
9225 NULL
9226 };
9227
9228 static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
9229 {
9230 {
9231 -1,
9232 (gchar *) "SensorMatch",
9233 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
9234 NULL
9235 },
9236 "sensor-match"
9237 };
9238
9239 static const GDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
9240 {
9241 &_sensor_match_signal_info_sensor_match.parent_struct,
9242 NULL
9243 };
9244
9245 static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
9246 {
9247 {
9248 -1,
9249 (gchar *) "match_value",
9250 (gchar *) "v",
9251 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9252 NULL
9253 },
9254 "match-value",
9255 FALSE,
9256 TRUE
9257 };
9258
9259 static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
9260 {
9261 {
9262 -1,
9263 (gchar *) "state",
9264 (gchar *) "y",
9265 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9266 NULL
9267 },
9268 "state",
9269 FALSE,
9270 TRUE
9271 };
9272
9273 static const GDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
9274 {
9275 &_sensor_match_property_info_match_value.parent_struct,
9276 &_sensor_match_property_info_state.parent_struct,
9277 NULL
9278 };
9279
9280 static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
9281 {
9282 {
9283 -1,
9284 (gchar *) "org.openbmc.SensorMatch",
9285 NULL,
9286 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
9287 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
9288 NULL
9289 },
9290 "sensor-match",
9291 };
9292
9293
9294 /**
9295 * sensor_match_interface_info:
9296 *
9297 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
9298 *
9299 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9300 */
9301 GDBusInterfaceInfo *
sensor_match_interface_info(void)9302 sensor_match_interface_info (void)
9303 {
9304 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
9305 }
9306
9307 /**
9308 * sensor_match_override_properties:
9309 * @klass: The class structure for a #GObject derived class.
9310 * @property_id_begin: The property id to assign to the first overridden property.
9311 *
9312 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
9313 * The properties are overridden in the order they are defined.
9314 *
9315 * Returns: The last property id.
9316 */
9317 guint
sensor_match_override_properties(GObjectClass * klass,guint property_id_begin)9318 sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
9319 {
9320 g_object_class_override_property (klass, property_id_begin++, "match-value");
9321 g_object_class_override_property (klass, property_id_begin++, "state");
9322 return property_id_begin - 1;
9323 }
9324
9325
9326 inline static void
sensor_match_signal_marshal_sensor_match(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)9327 sensor_match_signal_marshal_sensor_match (
9328 GClosure *closure,
9329 GValue *return_value,
9330 unsigned int n_param_values,
9331 const GValue *param_values,
9332 void *invocation_hint,
9333 void *marshal_data)
9334 {
9335 g_cclosure_marshal_VOID__UCHAR (closure,
9336 return_value, n_param_values, param_values, invocation_hint, marshal_data);
9337 }
9338
9339
9340 /**
9341 * SensorMatch:
9342 *
9343 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9344 */
9345
9346 /**
9347 * SensorMatchIface:
9348 * @parent_iface: The parent interface.
9349 * @get_match_value: Getter for the #SensorMatch:match-value property.
9350 * @get_state: Getter for the #SensorMatch:state property.
9351 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
9352 *
9353 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9354 */
9355
9356 typedef SensorMatchIface SensorMatchInterface;
G_DEFINE_INTERFACE(SensorMatch,sensor_match,G_TYPE_OBJECT)9357 G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT)
9358
9359 static void
9360 sensor_match_default_init (SensorMatchIface *iface)
9361 {
9362 /* GObject signals for received D-Bus signals: */
9363 /**
9364 * SensorMatch::sensor-match:
9365 * @object: A #SensorMatch.
9366 * @arg_state: Argument.
9367 *
9368 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received.
9369 *
9370 * 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.
9371 */
9372 _SENSOR_MATCH_SIGNALS[_SENSOR_MATCH_SENSOR_MATCH] =
9373 g_signal_new ("sensor-match",
9374 G_TYPE_FROM_INTERFACE (iface),
9375 G_SIGNAL_RUN_LAST,
9376 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9377 NULL,
9378 NULL,
9379 sensor_match_signal_marshal_sensor_match,
9380 G_TYPE_NONE,
9381 1, G_TYPE_UCHAR);
9382
9383 /* GObject properties for D-Bus properties: */
9384 /**
9385 * SensorMatch:match-value:
9386 *
9387 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9388 *
9389 * 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.
9390 */
9391 g_object_interface_install_property (iface,
9392 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9393 /**
9394 * SensorMatch:state:
9395 *
9396 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9397 *
9398 * 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.
9399 */
9400 g_object_interface_install_property (iface,
9401 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9402 }
9403
9404 /**
9405 * sensor_match_get_match_value: (skip)
9406 * @object: A #SensorMatch.
9407 *
9408 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9409 *
9410 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9411 *
9412 * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.
9413 *
9414 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9415 */
9416 GVariant *
sensor_match_get_match_value(SensorMatch * object)9417 sensor_match_get_match_value (SensorMatch *object)
9418 {
9419 g_return_val_if_fail (IS_SENSOR_MATCH (object), NULL);
9420
9421 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9422 }
9423
9424 /**
9425 * sensor_match_dup_match_value: (skip)
9426 * @object: A #SensorMatch.
9427 *
9428 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9429 *
9430 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9431 *
9432 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9433 */
9434 GVariant *
sensor_match_dup_match_value(SensorMatch * object)9435 sensor_match_dup_match_value (SensorMatch *object)
9436 {
9437 GVariant *value;
9438 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9439 return value;
9440 }
9441
9442 /**
9443 * sensor_match_set_match_value: (skip)
9444 * @object: A #SensorMatch.
9445 * @value: The value to set.
9446 *
9447 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9448 *
9449 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9450 */
9451 void
sensor_match_set_match_value(SensorMatch * object,GVariant * value)9452 sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9453 {
9454 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9455 }
9456
9457 /**
9458 * sensor_match_get_state: (skip)
9459 * @object: A #SensorMatch.
9460 *
9461 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9462 *
9463 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9464 *
9465 * Returns: The property value.
9466 */
9467 guchar
sensor_match_get_state(SensorMatch * object)9468 sensor_match_get_state (SensorMatch *object)
9469 {
9470 g_return_val_if_fail (IS_SENSOR_MATCH (object), '\0');
9471
9472 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9473 }
9474
9475 /**
9476 * sensor_match_set_state: (skip)
9477 * @object: A #SensorMatch.
9478 * @value: The value to set.
9479 *
9480 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9481 *
9482 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9483 */
9484 void
sensor_match_set_state(SensorMatch * object,guchar value)9485 sensor_match_set_state (SensorMatch *object, guchar value)
9486 {
9487 g_object_set (G_OBJECT (object), "state", value, NULL);
9488 }
9489
9490 /**
9491 * sensor_match_emit_sensor_match:
9492 * @object: A #SensorMatch.
9493 * @arg_state: Argument to pass with the signal.
9494 *
9495 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9496 */
9497 void
sensor_match_emit_sensor_match(SensorMatch * object,guchar arg_state)9498 sensor_match_emit_sensor_match (
9499 SensorMatch *object,
9500 guchar arg_state)
9501 {
9502 g_signal_emit (object, _SENSOR_MATCH_SIGNALS[_SENSOR_MATCH_SENSOR_MATCH], 0, arg_state);
9503 }
9504
9505 /* ------------------------------------------------------------------------ */
9506
9507 /**
9508 * SensorMatchProxy:
9509 *
9510 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9511 */
9512
9513 /**
9514 * SensorMatchProxyClass:
9515 * @parent_class: The parent class.
9516 *
9517 * Class structure for #SensorMatchProxy.
9518 */
9519
9520 struct _SensorMatchProxyPrivate
9521 {
9522 GData *qdata;
9523 };
9524
9525 static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9526
9527 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorMatchProxy,sensor_match_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SensorMatchProxy)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH,sensor_match_proxy_iface_init))9528 G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9529 G_ADD_PRIVATE (SensorMatchProxy)
9530 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init))
9531
9532 #else
9533 G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9534 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init))
9535
9536 #endif
9537 static void
9538 sensor_match_proxy_finalize (GObject *object)
9539 {
9540 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9541 g_datalist_clear (&proxy->priv->qdata);
9542 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9543 }
9544
9545 static void
sensor_match_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)9546 sensor_match_proxy_get_property (GObject *object,
9547 guint prop_id,
9548 GValue *value,
9549 GParamSpec *pspec G_GNUC_UNUSED)
9550 {
9551 const _ExtendedGDBusPropertyInfo *info;
9552 GVariant *variant;
9553 g_assert (prop_id != 0 && prop_id - 1 < 2);
9554 info = (const _ExtendedGDBusPropertyInfo *) _sensor_match_property_info_pointers[prop_id - 1];
9555 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9556 if (info->use_gvariant)
9557 {
9558 g_value_set_variant (value, variant);
9559 }
9560 else
9561 {
9562 if (variant != NULL)
9563 g_dbus_gvariant_to_gvalue (variant, value);
9564 }
9565 if (variant != NULL)
9566 g_variant_unref (variant);
9567 }
9568
9569 static void
sensor_match_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)9570 sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9571 GAsyncResult *res,
9572 gpointer user_data)
9573 {
9574 const _ExtendedGDBusPropertyInfo *info = user_data;
9575 GError *error;
9576 GVariant *_ret;
9577 error = NULL;
9578 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9579 if (!_ret)
9580 {
9581 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9582 info->parent_struct.name,
9583 error->message, g_quark_to_string (error->domain), error->code);
9584 g_error_free (error);
9585 }
9586 else
9587 {
9588 g_variant_unref (_ret);
9589 }
9590 }
9591
9592 static void
sensor_match_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)9593 sensor_match_proxy_set_property (GObject *object,
9594 guint prop_id,
9595 const GValue *value,
9596 GParamSpec *pspec G_GNUC_UNUSED)
9597 {
9598 const _ExtendedGDBusPropertyInfo *info;
9599 GVariant *variant;
9600 g_assert (prop_id != 0 && prop_id - 1 < 2);
9601 info = (const _ExtendedGDBusPropertyInfo *) _sensor_match_property_info_pointers[prop_id - 1];
9602 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9603 g_dbus_proxy_call (G_DBUS_PROXY (object),
9604 "org.freedesktop.DBus.Properties.Set",
9605 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9606 G_DBUS_CALL_FLAGS_NONE,
9607 -1,
9608 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9609 g_variant_unref (variant);
9610 }
9611
9612 static void
sensor_match_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)9613 sensor_match_proxy_g_signal (GDBusProxy *proxy,
9614 const gchar *sender_name G_GNUC_UNUSED,
9615 const gchar *signal_name,
9616 GVariant *parameters)
9617 {
9618 _ExtendedGDBusSignalInfo *info;
9619 GVariantIter iter;
9620 GVariant *child;
9621 GValue *paramv;
9622 gsize num_params;
9623 gsize n;
9624 guint signal_id;
9625 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9626 if (info == NULL)
9627 return;
9628 num_params = g_variant_n_children (parameters);
9629 paramv = g_new0 (GValue, num_params + 1);
9630 g_value_init (¶mv[0], TYPE_SENSOR_MATCH);
9631 g_value_set_object (¶mv[0], proxy);
9632 g_variant_iter_init (&iter, parameters);
9633 n = 1;
9634 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9635 {
9636 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9637 if (arg_info->use_gvariant)
9638 {
9639 g_value_init (¶mv[n], G_TYPE_VARIANT);
9640 g_value_set_variant (¶mv[n], child);
9641 n++;
9642 }
9643 else
9644 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
9645 g_variant_unref (child);
9646 }
9647 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9648 g_signal_emitv (paramv, signal_id, 0, NULL);
9649 for (n = 0; n < num_params + 1; n++)
9650 g_value_unset (¶mv[n]);
9651 g_free (paramv);
9652 }
9653
9654 static void
sensor_match_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)9655 sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9656 GVariant *changed_properties,
9657 const gchar *const *invalidated_properties)
9658 {
9659 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9660 guint n;
9661 const gchar *key;
9662 GVariantIter *iter;
9663 _ExtendedGDBusPropertyInfo *info;
9664 g_variant_get (changed_properties, "a{sv}", &iter);
9665 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9666 {
9667 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9668 g_datalist_remove_data (&proxy->priv->qdata, key);
9669 if (info != NULL)
9670 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9671 }
9672 g_variant_iter_free (iter);
9673 for (n = 0; invalidated_properties[n] != NULL; n++)
9674 {
9675 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9676 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9677 if (info != NULL)
9678 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9679 }
9680 }
9681
9682 static GVariant *
sensor_match_proxy_get_match_value(SensorMatch * object)9683 sensor_match_proxy_get_match_value (SensorMatch *object)
9684 {
9685 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9686 GVariant *variant;
9687 GVariant *value = NULL;
9688 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9689 value = variant;
9690 if (variant != NULL)
9691 g_variant_unref (variant);
9692 return value;
9693 }
9694
9695 static guchar
sensor_match_proxy_get_state(SensorMatch * object)9696 sensor_match_proxy_get_state (SensorMatch *object)
9697 {
9698 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9699 GVariant *variant;
9700 guchar value = '\0';
9701 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9702 if (variant != NULL)
9703 {
9704 value = g_variant_get_byte (variant);
9705 g_variant_unref (variant);
9706 }
9707 return value;
9708 }
9709
9710 static void
sensor_match_proxy_init(SensorMatchProxy * proxy)9711 sensor_match_proxy_init (SensorMatchProxy *proxy)
9712 {
9713 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9714 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9715 #else
9716 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9717 #endif
9718
9719 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9720 }
9721
9722 static void
sensor_match_proxy_class_init(SensorMatchProxyClass * klass)9723 sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9724 {
9725 GObjectClass *gobject_class;
9726 GDBusProxyClass *proxy_class;
9727
9728 gobject_class = G_OBJECT_CLASS (klass);
9729 gobject_class->finalize = sensor_match_proxy_finalize;
9730 gobject_class->get_property = sensor_match_proxy_get_property;
9731 gobject_class->set_property = sensor_match_proxy_set_property;
9732
9733 proxy_class = G_DBUS_PROXY_CLASS (klass);
9734 proxy_class->g_signal = sensor_match_proxy_g_signal;
9735 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9736
9737 sensor_match_override_properties (gobject_class, 1);
9738
9739 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9740 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9741 #endif
9742 }
9743
9744 static void
sensor_match_proxy_iface_init(SensorMatchIface * iface)9745 sensor_match_proxy_iface_init (SensorMatchIface *iface)
9746 {
9747 iface->get_match_value = sensor_match_proxy_get_match_value;
9748 iface->get_state = sensor_match_proxy_get_state;
9749 }
9750
9751 /**
9752 * sensor_match_proxy_new:
9753 * @connection: A #GDBusConnection.
9754 * @flags: Flags from the #GDBusProxyFlags enumeration.
9755 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9756 * @object_path: An object path.
9757 * @cancellable: (nullable): A #GCancellable or %NULL.
9758 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9759 * @user_data: User data to pass to @callback.
9760 *
9761 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details.
9762 *
9763 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
9764 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9765 *
9766 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9767 */
9768 void
sensor_match_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)9769 sensor_match_proxy_new (
9770 GDBusConnection *connection,
9771 GDBusProxyFlags flags,
9772 const gchar *name,
9773 const gchar *object_path,
9774 GCancellable *cancellable,
9775 GAsyncReadyCallback callback,
9776 gpointer user_data)
9777 {
9778 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9779 }
9780
9781 /**
9782 * sensor_match_proxy_new_finish:
9783 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9784 * @error: Return location for error or %NULL
9785 *
9786 * Finishes an operation started with sensor_match_proxy_new().
9787 *
9788 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9789 */
9790 SensorMatch *
sensor_match_proxy_new_finish(GAsyncResult * res,GError ** error)9791 sensor_match_proxy_new_finish (
9792 GAsyncResult *res,
9793 GError **error)
9794 {
9795 GObject *ret;
9796 GObject *source_object;
9797 source_object = g_async_result_get_source_object (res);
9798 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9799 g_object_unref (source_object);
9800 if (ret != NULL)
9801 return SENSOR_MATCH (ret);
9802 else
9803 return NULL;
9804 }
9805
9806 /**
9807 * sensor_match_proxy_new_sync:
9808 * @connection: A #GDBusConnection.
9809 * @flags: Flags from the #GDBusProxyFlags enumeration.
9810 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9811 * @object_path: An object path.
9812 * @cancellable: (nullable): A #GCancellable or %NULL.
9813 * @error: Return location for error or %NULL
9814 *
9815 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details.
9816 *
9817 * The calling thread is blocked until a reply is received.
9818 *
9819 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9820 *
9821 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9822 */
9823 SensorMatch *
sensor_match_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)9824 sensor_match_proxy_new_sync (
9825 GDBusConnection *connection,
9826 GDBusProxyFlags flags,
9827 const gchar *name,
9828 const gchar *object_path,
9829 GCancellable *cancellable,
9830 GError **error)
9831 {
9832 GInitable *ret;
9833 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9834 if (ret != NULL)
9835 return SENSOR_MATCH (ret);
9836 else
9837 return NULL;
9838 }
9839
9840
9841 /**
9842 * sensor_match_proxy_new_for_bus:
9843 * @bus_type: A #GBusType.
9844 * @flags: Flags from the #GDBusProxyFlags enumeration.
9845 * @name: A bus name (well-known or unique).
9846 * @object_path: An object path.
9847 * @cancellable: (nullable): A #GCancellable or %NULL.
9848 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9849 * @user_data: User data to pass to @callback.
9850 *
9851 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9852 *
9853 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
9854 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9855 *
9856 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9857 */
9858 void
sensor_match_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)9859 sensor_match_proxy_new_for_bus (
9860 GBusType bus_type,
9861 GDBusProxyFlags flags,
9862 const gchar *name,
9863 const gchar *object_path,
9864 GCancellable *cancellable,
9865 GAsyncReadyCallback callback,
9866 gpointer user_data)
9867 {
9868 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9869 }
9870
9871 /**
9872 * sensor_match_proxy_new_for_bus_finish:
9873 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9874 * @error: Return location for error or %NULL
9875 *
9876 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9877 *
9878 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9879 */
9880 SensorMatch *
sensor_match_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)9881 sensor_match_proxy_new_for_bus_finish (
9882 GAsyncResult *res,
9883 GError **error)
9884 {
9885 GObject *ret;
9886 GObject *source_object;
9887 source_object = g_async_result_get_source_object (res);
9888 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9889 g_object_unref (source_object);
9890 if (ret != NULL)
9891 return SENSOR_MATCH (ret);
9892 else
9893 return NULL;
9894 }
9895
9896 /**
9897 * sensor_match_proxy_new_for_bus_sync:
9898 * @bus_type: A #GBusType.
9899 * @flags: Flags from the #GDBusProxyFlags enumeration.
9900 * @name: A bus name (well-known or unique).
9901 * @object_path: An object path.
9902 * @cancellable: (nullable): A #GCancellable or %NULL.
9903 * @error: Return location for error or %NULL
9904 *
9905 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9906 *
9907 * The calling thread is blocked until a reply is received.
9908 *
9909 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9910 *
9911 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9912 */
9913 SensorMatch *
sensor_match_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)9914 sensor_match_proxy_new_for_bus_sync (
9915 GBusType bus_type,
9916 GDBusProxyFlags flags,
9917 const gchar *name,
9918 const gchar *object_path,
9919 GCancellable *cancellable,
9920 GError **error)
9921 {
9922 GInitable *ret;
9923 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9924 if (ret != NULL)
9925 return SENSOR_MATCH (ret);
9926 else
9927 return NULL;
9928 }
9929
9930
9931 /* ------------------------------------------------------------------------ */
9932
9933 /**
9934 * SensorMatchSkeleton:
9935 *
9936 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9937 */
9938
9939 /**
9940 * SensorMatchSkeletonClass:
9941 * @parent_class: The parent class.
9942 *
9943 * Class structure for #SensorMatchSkeleton.
9944 */
9945
9946 struct _SensorMatchSkeletonPrivate
9947 {
9948 GValue *properties;
9949 GList *changed_properties;
9950 GSource *changed_properties_idle_source;
9951 GMainContext *context;
9952 GMutex lock;
9953 };
9954
9955 static void
_sensor_match_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)9956 _sensor_match_skeleton_handle_method_call (
9957 GDBusConnection *connection G_GNUC_UNUSED,
9958 const gchar *sender G_GNUC_UNUSED,
9959 const gchar *object_path G_GNUC_UNUSED,
9960 const gchar *interface_name,
9961 const gchar *method_name,
9962 GVariant *parameters,
9963 GDBusMethodInvocation *invocation,
9964 gpointer user_data)
9965 {
9966 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9967 _ExtendedGDBusMethodInfo *info;
9968 GVariantIter iter;
9969 GVariant *child;
9970 GValue *paramv;
9971 gsize num_params;
9972 guint num_extra;
9973 gsize n;
9974 guint signal_id;
9975 GValue return_value = G_VALUE_INIT;
9976 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9977 g_assert (info != NULL);
9978 num_params = g_variant_n_children (parameters);
9979 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9980 n = 0;
9981 g_value_init (¶mv[n], TYPE_SENSOR_MATCH);
9982 g_value_set_object (¶mv[n++], skeleton);
9983 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9984 g_value_set_object (¶mv[n++], invocation);
9985 if (info->pass_fdlist)
9986 {
9987 #ifdef G_OS_UNIX
9988 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
9989 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9990 #else
9991 g_assert_not_reached ();
9992 #endif
9993 }
9994 g_variant_iter_init (&iter, parameters);
9995 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9996 {
9997 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9998 if (arg_info->use_gvariant)
9999 {
10000 g_value_init (¶mv[n], G_TYPE_VARIANT);
10001 g_value_set_variant (¶mv[n], child);
10002 n++;
10003 }
10004 else
10005 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
10006 g_variant_unref (child);
10007 }
10008 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
10009 g_value_init (&return_value, G_TYPE_BOOLEAN);
10010 g_signal_emitv (paramv, signal_id, 0, &return_value);
10011 if (!g_value_get_boolean (&return_value))
10012 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);
10013 g_value_unset (&return_value);
10014 for (n = 0; n < num_params + num_extra; n++)
10015 g_value_unset (¶mv[n]);
10016 g_free (paramv);
10017 }
10018
10019 static GVariant *
_sensor_match_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)10020 _sensor_match_skeleton_handle_get_property (
10021 GDBusConnection *connection G_GNUC_UNUSED,
10022 const gchar *sender G_GNUC_UNUSED,
10023 const gchar *object_path G_GNUC_UNUSED,
10024 const gchar *interface_name G_GNUC_UNUSED,
10025 const gchar *property_name,
10026 GError **error,
10027 gpointer user_data)
10028 {
10029 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10030 GValue value = G_VALUE_INIT;
10031 GParamSpec *pspec;
10032 _ExtendedGDBusPropertyInfo *info;
10033 GVariant *ret;
10034 ret = NULL;
10035 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10036 g_assert (info != NULL);
10037 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10038 if (pspec == NULL)
10039 {
10040 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10041 }
10042 else
10043 {
10044 g_value_init (&value, pspec->value_type);
10045 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10046 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10047 g_value_unset (&value);
10048 }
10049 return ret;
10050 }
10051
10052 static gboolean
_sensor_match_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)10053 _sensor_match_skeleton_handle_set_property (
10054 GDBusConnection *connection G_GNUC_UNUSED,
10055 const gchar *sender G_GNUC_UNUSED,
10056 const gchar *object_path G_GNUC_UNUSED,
10057 const gchar *interface_name G_GNUC_UNUSED,
10058 const gchar *property_name,
10059 GVariant *variant,
10060 GError **error,
10061 gpointer user_data)
10062 {
10063 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10064 GValue value = G_VALUE_INIT;
10065 GParamSpec *pspec;
10066 _ExtendedGDBusPropertyInfo *info;
10067 gboolean ret;
10068 ret = FALSE;
10069 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10070 g_assert (info != NULL);
10071 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10072 if (pspec == NULL)
10073 {
10074 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10075 }
10076 else
10077 {
10078 if (info->use_gvariant)
10079 g_value_set_variant (&value, variant);
10080 else
10081 g_dbus_gvariant_to_gvalue (variant, &value);
10082 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10083 g_value_unset (&value);
10084 ret = TRUE;
10085 }
10086 return ret;
10087 }
10088
10089 static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
10090 {
10091 _sensor_match_skeleton_handle_method_call,
10092 _sensor_match_skeleton_handle_get_property,
10093 _sensor_match_skeleton_handle_set_property,
10094 {NULL}
10095 };
10096
10097 static GDBusInterfaceInfo *
sensor_match_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)10098 sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10099 {
10100 return sensor_match_interface_info ();
10101 }
10102
10103 static GDBusInterfaceVTable *
sensor_match_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)10104 sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10105 {
10106 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
10107 }
10108
10109 static GVariant *
sensor_match_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)10110 sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10111 {
10112 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10113
10114 GVariantBuilder builder;
10115 guint n;
10116 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10117 if (_sensor_match_interface_info.parent_struct.properties == NULL)
10118 goto out;
10119 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
10120 {
10121 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
10122 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10123 {
10124 GVariant *value;
10125 value = _sensor_match_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", info->name, NULL, skeleton);
10126 if (value != NULL)
10127 {
10128 g_variant_take_ref (value);
10129 g_variant_builder_add (&builder, "{sv}", info->name, value);
10130 g_variant_unref (value);
10131 }
10132 }
10133 }
10134 out:
10135 return g_variant_builder_end (&builder);
10136 }
10137
10138 static gboolean _sensor_match_emit_changed (gpointer user_data);
10139
10140 static void
sensor_match_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)10141 sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10142 {
10143 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10144 gboolean emit_changed = FALSE;
10145
10146 g_mutex_lock (&skeleton->priv->lock);
10147 if (skeleton->priv->changed_properties_idle_source != NULL)
10148 {
10149 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10150 skeleton->priv->changed_properties_idle_source = NULL;
10151 emit_changed = TRUE;
10152 }
10153 g_mutex_unlock (&skeleton->priv->lock);
10154
10155 if (emit_changed)
10156 _sensor_match_emit_changed (skeleton);
10157 }
10158
10159 static void
_sensor_match_on_signal_sensor_match(SensorMatch * object,guchar arg_state)10160 _sensor_match_on_signal_sensor_match (
10161 SensorMatch *object,
10162 guchar arg_state)
10163 {
10164 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10165
10166 GList *connections, *l;
10167 GVariant *signal_variant;
10168 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10169
10170 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
10171 arg_state));
10172 for (l = connections; l != NULL; l = l->next)
10173 {
10174 GDBusConnection *connection = l->data;
10175 g_dbus_connection_emit_signal (connection,
10176 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
10177 signal_variant, NULL);
10178 }
10179 g_variant_unref (signal_variant);
10180 g_list_free_full (connections, g_object_unref);
10181 }
10182
10183 static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
10184 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SensorMatchSkeleton,sensor_match_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SensorMatchSkeleton)G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH,sensor_match_skeleton_iface_init))10185 G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10186 G_ADD_PRIVATE (SensorMatchSkeleton)
10187 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init))
10188
10189 #else
10190 G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10191 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init))
10192
10193 #endif
10194 static void
10195 sensor_match_skeleton_finalize (GObject *object)
10196 {
10197 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10198 guint n;
10199 for (n = 0; n < 2; n++)
10200 g_value_unset (&skeleton->priv->properties[n]);
10201 g_free (skeleton->priv->properties);
10202 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10203 if (skeleton->priv->changed_properties_idle_source != NULL)
10204 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10205 g_main_context_unref (skeleton->priv->context);
10206 g_mutex_clear (&skeleton->priv->lock);
10207 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
10208 }
10209
10210 static void
sensor_match_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)10211 sensor_match_skeleton_get_property (GObject *object,
10212 guint prop_id,
10213 GValue *value,
10214 GParamSpec *pspec G_GNUC_UNUSED)
10215 {
10216 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10217 g_assert (prop_id != 0 && prop_id - 1 < 2);
10218 g_mutex_lock (&skeleton->priv->lock);
10219 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10220 g_mutex_unlock (&skeleton->priv->lock);
10221 }
10222
10223 static gboolean
_sensor_match_emit_changed(gpointer user_data)10224 _sensor_match_emit_changed (gpointer user_data)
10225 {
10226 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10227 GList *l;
10228 GVariantBuilder builder;
10229 GVariantBuilder invalidated_builder;
10230 guint num_changes;
10231
10232 g_mutex_lock (&skeleton->priv->lock);
10233 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10234 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10235 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10236 {
10237 ChangedProperty *cp = l->data;
10238 GVariant *variant;
10239 const GValue *cur_value;
10240
10241 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10242 if (!_g_value_equal (cur_value, &cp->orig_value))
10243 {
10244 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10245 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10246 g_variant_unref (variant);
10247 num_changes++;
10248 }
10249 }
10250 if (num_changes > 0)
10251 {
10252 GList *connections, *ll;
10253 GVariant *signal_variant;
10254 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
10255 &builder, &invalidated_builder));
10256 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10257 for (ll = connections; ll != NULL; ll = ll->next)
10258 {
10259 GDBusConnection *connection = ll->data;
10260
10261 g_dbus_connection_emit_signal (connection,
10262 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10263 "org.freedesktop.DBus.Properties",
10264 "PropertiesChanged",
10265 signal_variant,
10266 NULL);
10267 }
10268 g_variant_unref (signal_variant);
10269 g_list_free_full (connections, g_object_unref);
10270 }
10271 else
10272 {
10273 g_variant_builder_clear (&builder);
10274 g_variant_builder_clear (&invalidated_builder);
10275 }
10276 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10277 skeleton->priv->changed_properties = NULL;
10278 skeleton->priv->changed_properties_idle_source = NULL;
10279 g_mutex_unlock (&skeleton->priv->lock);
10280 return FALSE;
10281 }
10282
10283 static void
_sensor_match_schedule_emit_changed(SensorMatchSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)10284 _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10285 {
10286 ChangedProperty *cp;
10287 GList *l;
10288 cp = NULL;
10289 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10290 {
10291 ChangedProperty *i_cp = l->data;
10292 if (i_cp->info == info)
10293 {
10294 cp = i_cp;
10295 break;
10296 }
10297 }
10298 if (cp == NULL)
10299 {
10300 cp = g_new0 (ChangedProperty, 1);
10301 cp->prop_id = prop_id;
10302 cp->info = info;
10303 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10304 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10305 g_value_copy (orig_value, &cp->orig_value);
10306 }
10307 }
10308
10309 static void
sensor_match_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)10310 sensor_match_skeleton_notify (GObject *object,
10311 GParamSpec *pspec G_GNUC_UNUSED)
10312 {
10313 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10314 g_mutex_lock (&skeleton->priv->lock);
10315 if (skeleton->priv->changed_properties != NULL &&
10316 skeleton->priv->changed_properties_idle_source == NULL)
10317 {
10318 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10319 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10320 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
10321 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed");
10322 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10323 g_source_unref (skeleton->priv->changed_properties_idle_source);
10324 }
10325 g_mutex_unlock (&skeleton->priv->lock);
10326 }
10327
10328 static void
sensor_match_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)10329 sensor_match_skeleton_set_property (GObject *object,
10330 guint prop_id,
10331 const GValue *value,
10332 GParamSpec *pspec)
10333 {
10334 const _ExtendedGDBusPropertyInfo *info;
10335 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10336 g_assert (prop_id != 0 && prop_id - 1 < 2);
10337 info = (const _ExtendedGDBusPropertyInfo *) _sensor_match_property_info_pointers[prop_id - 1];
10338 g_mutex_lock (&skeleton->priv->lock);
10339 g_object_freeze_notify (object);
10340 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10341 {
10342 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
10343 info->emits_changed_signal)
10344 _sensor_match_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
10345 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10346 g_object_notify_by_pspec (object, pspec);
10347 }
10348 g_mutex_unlock (&skeleton->priv->lock);
10349 g_object_thaw_notify (object);
10350 }
10351
10352 static void
sensor_match_skeleton_init(SensorMatchSkeleton * skeleton)10353 sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
10354 {
10355 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10356 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
10357 #else
10358 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
10359 #endif
10360
10361 g_mutex_init (&skeleton->priv->lock);
10362 skeleton->priv->context = g_main_context_ref_thread_default ();
10363 skeleton->priv->properties = g_new0 (GValue, 2);
10364 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
10365 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
10366 }
10367
10368 static GVariant *
sensor_match_skeleton_get_match_value(SensorMatch * object)10369 sensor_match_skeleton_get_match_value (SensorMatch *object)
10370 {
10371 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10372 GVariant *value;
10373 g_mutex_lock (&skeleton->priv->lock);
10374 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[0]));
10375 g_mutex_unlock (&skeleton->priv->lock);
10376 return value;
10377 }
10378
10379 static guchar
sensor_match_skeleton_get_state(SensorMatch * object)10380 sensor_match_skeleton_get_state (SensorMatch *object)
10381 {
10382 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10383 guchar value;
10384 g_mutex_lock (&skeleton->priv->lock);
10385 value = g_marshal_value_peek_uchar (&(skeleton->priv->properties[1]));
10386 g_mutex_unlock (&skeleton->priv->lock);
10387 return value;
10388 }
10389
10390 static void
sensor_match_skeleton_class_init(SensorMatchSkeletonClass * klass)10391 sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10392 {
10393 GObjectClass *gobject_class;
10394 GDBusInterfaceSkeletonClass *skeleton_class;
10395
10396 gobject_class = G_OBJECT_CLASS (klass);
10397 gobject_class->finalize = sensor_match_skeleton_finalize;
10398 gobject_class->get_property = sensor_match_skeleton_get_property;
10399 gobject_class->set_property = sensor_match_skeleton_set_property;
10400 gobject_class->notify = sensor_match_skeleton_notify;
10401
10402
10403 sensor_match_override_properties (gobject_class, 1);
10404
10405 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10406 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10407 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10408 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10409 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10410
10411 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10412 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10413 #endif
10414 }
10415
10416 static void
sensor_match_skeleton_iface_init(SensorMatchIface * iface)10417 sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10418 {
10419 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10420 iface->get_match_value = sensor_match_skeleton_get_match_value;
10421 iface->get_state = sensor_match_skeleton_get_state;
10422 }
10423
10424 /**
10425 * sensor_match_skeleton_new:
10426 *
10427 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10428 *
10429 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10430 */
10431 SensorMatch *
sensor_match_skeleton_new(void)10432 sensor_match_skeleton_new (void)
10433 {
10434 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10435 }
10436
10437 /* ------------------------------------------------------------------------
10438 * Code for interface org.openbmc.Process
10439 * ------------------------------------------------------------------------
10440 */
10441
10442 /**
10443 * SECTION:Process
10444 * @title: Process
10445 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10446 *
10447 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface in C.
10448 */
10449
10450 /* ---- Introspection data for org.openbmc.Process ---- */
10451
10452 static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10453 {
10454 {
10455 -1,
10456 (gchar *) "stop",
10457 NULL,
10458 NULL,
10459 NULL
10460 },
10461 "handle-stop",
10462 FALSE
10463 };
10464
10465 static const GDBusMethodInfo * const _process_method_info_pointers[] =
10466 {
10467 &_process_method_info_stop.parent_struct,
10468 NULL
10469 };
10470
10471 static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10472 {
10473 {
10474 -1,
10475 (gchar *) "org.openbmc.Process",
10476 (GDBusMethodInfo **) &_process_method_info_pointers,
10477 NULL,
10478 NULL,
10479 NULL
10480 },
10481 "process",
10482 };
10483
10484
10485 /**
10486 * process_interface_info:
10487 *
10488 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10489 *
10490 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10491 */
10492 GDBusInterfaceInfo *
process_interface_info(void)10493 process_interface_info (void)
10494 {
10495 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10496 }
10497
10498 /**
10499 * process_override_properties:
10500 * @klass: The class structure for a #GObject derived class.
10501 * @property_id_begin: The property id to assign to the first overridden property.
10502 *
10503 * Overrides all #GObject properties in the #Process interface for a concrete class.
10504 * The properties are overridden in the order they are defined.
10505 *
10506 * Returns: The last property id.
10507 */
10508 guint
process_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)10509 process_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
10510 {
10511 return property_id_begin - 1;
10512 }
10513
10514
10515 inline static void
process_method_marshal_stop(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)10516 process_method_marshal_stop (
10517 GClosure *closure,
10518 GValue *return_value,
10519 unsigned int n_param_values,
10520 const GValue *param_values,
10521 void *invocation_hint,
10522 void *marshal_data)
10523 {
10524 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
10525 return_value, n_param_values, param_values, invocation_hint, marshal_data);
10526 }
10527
10528
10529 /**
10530 * Process:
10531 *
10532 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10533 */
10534
10535 /**
10536 * ProcessIface:
10537 * @parent_iface: The parent interface.
10538 * @handle_stop: Handler for the #Process::handle-stop signal.
10539 *
10540 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10541 */
10542
10543 typedef ProcessIface ProcessInterface;
G_DEFINE_INTERFACE(Process,process,G_TYPE_OBJECT)10544 G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT)
10545
10546 static void
10547 process_default_init (ProcessIface *iface)
10548 {
10549 /* GObject signals for incoming D-Bus method calls: */
10550 /**
10551 * Process::handle-stop:
10552 * @object: A #Process.
10553 * @invocation: A #GDBusMethodInvocation.
10554 *
10555 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10556 *
10557 * 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 process_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
10558 *
10559 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
10560 */
10561 g_signal_new ("handle-stop",
10562 G_TYPE_FROM_INTERFACE (iface),
10563 G_SIGNAL_RUN_LAST,
10564 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10565 g_signal_accumulator_true_handled,
10566 NULL,
10567 process_method_marshal_stop,
10568 G_TYPE_BOOLEAN,
10569 1,
10570 G_TYPE_DBUS_METHOD_INVOCATION);
10571
10572 }
10573
10574 /**
10575 * process_call_stop:
10576 * @proxy: A #ProcessProxy.
10577 * @cancellable: (nullable): A #GCancellable or %NULL.
10578 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10579 * @user_data: User data to pass to @callback.
10580 *
10581 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10582 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
10583 * You can then call process_call_stop_finish() to get the result of the operation.
10584 *
10585 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10586 */
10587 void
process_call_stop(Process * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)10588 process_call_stop (
10589 Process *proxy,
10590 GCancellable *cancellable,
10591 GAsyncReadyCallback callback,
10592 gpointer user_data)
10593 {
10594 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10595 "stop",
10596 g_variant_new ("()"),
10597 G_DBUS_CALL_FLAGS_NONE,
10598 -1,
10599 cancellable,
10600 callback,
10601 user_data);
10602 }
10603
10604 /**
10605 * process_call_stop_finish:
10606 * @proxy: A #ProcessProxy.
10607 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10608 * @error: Return location for error or %NULL.
10609 *
10610 * Finishes an operation started with process_call_stop().
10611 *
10612 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
10613 */
10614 gboolean
process_call_stop_finish(Process * proxy,GAsyncResult * res,GError ** error)10615 process_call_stop_finish (
10616 Process *proxy,
10617 GAsyncResult *res,
10618 GError **error)
10619 {
10620 GVariant *_ret;
10621 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10622 if (_ret == NULL)
10623 goto _out;
10624 g_variant_get (_ret,
10625 "()");
10626 g_variant_unref (_ret);
10627 _out:
10628 return _ret != NULL;
10629 }
10630
10631 /**
10632 * process_call_stop_sync:
10633 * @proxy: A #ProcessProxy.
10634 * @cancellable: (nullable): A #GCancellable or %NULL.
10635 * @error: Return location for error or %NULL.
10636 *
10637 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
10638 *
10639 * See process_call_stop() for the asynchronous version of this method.
10640 *
10641 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
10642 */
10643 gboolean
process_call_stop_sync(Process * proxy,GCancellable * cancellable,GError ** error)10644 process_call_stop_sync (
10645 Process *proxy,
10646 GCancellable *cancellable,
10647 GError **error)
10648 {
10649 GVariant *_ret;
10650 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10651 "stop",
10652 g_variant_new ("()"),
10653 G_DBUS_CALL_FLAGS_NONE,
10654 -1,
10655 cancellable,
10656 error);
10657 if (_ret == NULL)
10658 goto _out;
10659 g_variant_get (_ret,
10660 "()");
10661 g_variant_unref (_ret);
10662 _out:
10663 return _ret != NULL;
10664 }
10665
10666 /**
10667 * process_complete_stop:
10668 * @object: A #Process.
10669 * @invocation: (transfer full): A #GDBusMethodInvocation.
10670 *
10671 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</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.
10672 *
10673 * This method will free @invocation, you cannot use it afterwards.
10674 */
10675 void
process_complete_stop(Process * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)10676 process_complete_stop (
10677 Process *object G_GNUC_UNUSED,
10678 GDBusMethodInvocation *invocation)
10679 {
10680 g_dbus_method_invocation_return_value (invocation,
10681 g_variant_new ("()"));
10682 }
10683
10684 /* ------------------------------------------------------------------------ */
10685
10686 /**
10687 * ProcessProxy:
10688 *
10689 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10690 */
10691
10692 /**
10693 * ProcessProxyClass:
10694 * @parent_class: The parent class.
10695 *
10696 * Class structure for #ProcessProxy.
10697 */
10698
10699 struct _ProcessProxyPrivate
10700 {
10701 GData *qdata;
10702 };
10703
10704 static void process_proxy_iface_init (ProcessIface *iface);
10705
10706 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ProcessProxy,process_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ProcessProxy)G_IMPLEMENT_INTERFACE (TYPE_PROCESS,process_proxy_iface_init))10707 G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10708 G_ADD_PRIVATE (ProcessProxy)
10709 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init))
10710
10711 #else
10712 G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10713 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init))
10714
10715 #endif
10716 static void
10717 process_proxy_finalize (GObject *object)
10718 {
10719 ProcessProxy *proxy = PROCESS_PROXY (object);
10720 g_datalist_clear (&proxy->priv->qdata);
10721 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10722 }
10723
10724 static void
process_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)10725 process_proxy_get_property (GObject *object G_GNUC_UNUSED,
10726 guint prop_id G_GNUC_UNUSED,
10727 GValue *value G_GNUC_UNUSED,
10728 GParamSpec *pspec G_GNUC_UNUSED)
10729 {
10730 }
10731
10732 static void
process_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)10733 process_proxy_set_property (GObject *object G_GNUC_UNUSED,
10734 guint prop_id G_GNUC_UNUSED,
10735 const GValue *value G_GNUC_UNUSED,
10736 GParamSpec *pspec G_GNUC_UNUSED)
10737 {
10738 }
10739
10740 static void
process_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)10741 process_proxy_g_signal (GDBusProxy *proxy,
10742 const gchar *sender_name G_GNUC_UNUSED,
10743 const gchar *signal_name,
10744 GVariant *parameters)
10745 {
10746 _ExtendedGDBusSignalInfo *info;
10747 GVariantIter iter;
10748 GVariant *child;
10749 GValue *paramv;
10750 gsize num_params;
10751 gsize n;
10752 guint signal_id;
10753 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10754 if (info == NULL)
10755 return;
10756 num_params = g_variant_n_children (parameters);
10757 paramv = g_new0 (GValue, num_params + 1);
10758 g_value_init (¶mv[0], TYPE_PROCESS);
10759 g_value_set_object (¶mv[0], proxy);
10760 g_variant_iter_init (&iter, parameters);
10761 n = 1;
10762 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10763 {
10764 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10765 if (arg_info->use_gvariant)
10766 {
10767 g_value_init (¶mv[n], G_TYPE_VARIANT);
10768 g_value_set_variant (¶mv[n], child);
10769 n++;
10770 }
10771 else
10772 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
10773 g_variant_unref (child);
10774 }
10775 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10776 g_signal_emitv (paramv, signal_id, 0, NULL);
10777 for (n = 0; n < num_params + 1; n++)
10778 g_value_unset (¶mv[n]);
10779 g_free (paramv);
10780 }
10781
10782 static void
process_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)10783 process_proxy_g_properties_changed (GDBusProxy *_proxy,
10784 GVariant *changed_properties,
10785 const gchar *const *invalidated_properties)
10786 {
10787 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10788 guint n;
10789 const gchar *key;
10790 GVariantIter *iter;
10791 _ExtendedGDBusPropertyInfo *info;
10792 g_variant_get (changed_properties, "a{sv}", &iter);
10793 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10794 {
10795 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10796 g_datalist_remove_data (&proxy->priv->qdata, key);
10797 if (info != NULL)
10798 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10799 }
10800 g_variant_iter_free (iter);
10801 for (n = 0; invalidated_properties[n] != NULL; n++)
10802 {
10803 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10804 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10805 if (info != NULL)
10806 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10807 }
10808 }
10809
10810 static void
process_proxy_init(ProcessProxy * proxy)10811 process_proxy_init (ProcessProxy *proxy)
10812 {
10813 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10814 proxy->priv = process_proxy_get_instance_private (proxy);
10815 #else
10816 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10817 #endif
10818
10819 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10820 }
10821
10822 static void
process_proxy_class_init(ProcessProxyClass * klass)10823 process_proxy_class_init (ProcessProxyClass *klass)
10824 {
10825 GObjectClass *gobject_class;
10826 GDBusProxyClass *proxy_class;
10827
10828 gobject_class = G_OBJECT_CLASS (klass);
10829 gobject_class->finalize = process_proxy_finalize;
10830 gobject_class->get_property = process_proxy_get_property;
10831 gobject_class->set_property = process_proxy_set_property;
10832
10833 proxy_class = G_DBUS_PROXY_CLASS (klass);
10834 proxy_class->g_signal = process_proxy_g_signal;
10835 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10836
10837 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10838 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10839 #endif
10840 }
10841
10842 static void
process_proxy_iface_init(ProcessIface * iface G_GNUC_UNUSED)10843 process_proxy_iface_init (ProcessIface *iface G_GNUC_UNUSED)
10844 {
10845 }
10846
10847 /**
10848 * process_proxy_new:
10849 * @connection: A #GDBusConnection.
10850 * @flags: Flags from the #GDBusProxyFlags enumeration.
10851 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10852 * @object_path: An object path.
10853 * @cancellable: (nullable): A #GCancellable or %NULL.
10854 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10855 * @user_data: User data to pass to @callback.
10856 *
10857 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new() for more details.
10858 *
10859 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
10860 * You can then call process_proxy_new_finish() to get the result of the operation.
10861 *
10862 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10863 */
10864 void
process_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)10865 process_proxy_new (
10866 GDBusConnection *connection,
10867 GDBusProxyFlags flags,
10868 const gchar *name,
10869 const gchar *object_path,
10870 GCancellable *cancellable,
10871 GAsyncReadyCallback callback,
10872 gpointer user_data)
10873 {
10874 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
10875 }
10876
10877 /**
10878 * process_proxy_new_finish:
10879 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10880 * @error: Return location for error or %NULL
10881 *
10882 * Finishes an operation started with process_proxy_new().
10883 *
10884 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10885 */
10886 Process *
process_proxy_new_finish(GAsyncResult * res,GError ** error)10887 process_proxy_new_finish (
10888 GAsyncResult *res,
10889 GError **error)
10890 {
10891 GObject *ret;
10892 GObject *source_object;
10893 source_object = g_async_result_get_source_object (res);
10894 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10895 g_object_unref (source_object);
10896 if (ret != NULL)
10897 return PROCESS (ret);
10898 else
10899 return NULL;
10900 }
10901
10902 /**
10903 * process_proxy_new_sync:
10904 * @connection: A #GDBusConnection.
10905 * @flags: Flags from the #GDBusProxyFlags enumeration.
10906 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10907 * @object_path: An object path.
10908 * @cancellable: (nullable): A #GCancellable or %NULL.
10909 * @error: Return location for error or %NULL
10910 *
10911 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new_sync() for more details.
10912 *
10913 * The calling thread is blocked until a reply is received.
10914 *
10915 * See process_proxy_new() for the asynchronous version of this constructor.
10916 *
10917 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10918 */
10919 Process *
process_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)10920 process_proxy_new_sync (
10921 GDBusConnection *connection,
10922 GDBusProxyFlags flags,
10923 const gchar *name,
10924 const gchar *object_path,
10925 GCancellable *cancellable,
10926 GError **error)
10927 {
10928 GInitable *ret;
10929 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10930 if (ret != NULL)
10931 return PROCESS (ret);
10932 else
10933 return NULL;
10934 }
10935
10936
10937 /**
10938 * process_proxy_new_for_bus:
10939 * @bus_type: A #GBusType.
10940 * @flags: Flags from the #GDBusProxyFlags enumeration.
10941 * @name: A bus name (well-known or unique).
10942 * @object_path: An object path.
10943 * @cancellable: (nullable): A #GCancellable or %NULL.
10944 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10945 * @user_data: User data to pass to @callback.
10946 *
10947 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10948 *
10949 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
10950 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10951 *
10952 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10953 */
10954 void
process_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)10955 process_proxy_new_for_bus (
10956 GBusType bus_type,
10957 GDBusProxyFlags flags,
10958 const gchar *name,
10959 const gchar *object_path,
10960 GCancellable *cancellable,
10961 GAsyncReadyCallback callback,
10962 gpointer user_data)
10963 {
10964 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
10965 }
10966
10967 /**
10968 * process_proxy_new_for_bus_finish:
10969 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10970 * @error: Return location for error or %NULL
10971 *
10972 * Finishes an operation started with process_proxy_new_for_bus().
10973 *
10974 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10975 */
10976 Process *
process_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)10977 process_proxy_new_for_bus_finish (
10978 GAsyncResult *res,
10979 GError **error)
10980 {
10981 GObject *ret;
10982 GObject *source_object;
10983 source_object = g_async_result_get_source_object (res);
10984 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10985 g_object_unref (source_object);
10986 if (ret != NULL)
10987 return PROCESS (ret);
10988 else
10989 return NULL;
10990 }
10991
10992 /**
10993 * process_proxy_new_for_bus_sync:
10994 * @bus_type: A #GBusType.
10995 * @flags: Flags from the #GDBusProxyFlags enumeration.
10996 * @name: A bus name (well-known or unique).
10997 * @object_path: An object path.
10998 * @cancellable: (nullable): A #GCancellable or %NULL.
10999 * @error: Return location for error or %NULL
11000 *
11001 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11002 *
11003 * The calling thread is blocked until a reply is received.
11004 *
11005 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
11006 *
11007 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
11008 */
11009 Process *
process_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)11010 process_proxy_new_for_bus_sync (
11011 GBusType bus_type,
11012 GDBusProxyFlags flags,
11013 const gchar *name,
11014 const gchar *object_path,
11015 GCancellable *cancellable,
11016 GError **error)
11017 {
11018 GInitable *ret;
11019 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
11020 if (ret != NULL)
11021 return PROCESS (ret);
11022 else
11023 return NULL;
11024 }
11025
11026
11027 /* ------------------------------------------------------------------------ */
11028
11029 /**
11030 * ProcessSkeleton:
11031 *
11032 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
11033 */
11034
11035 /**
11036 * ProcessSkeletonClass:
11037 * @parent_class: The parent class.
11038 *
11039 * Class structure for #ProcessSkeleton.
11040 */
11041
11042 struct _ProcessSkeletonPrivate
11043 {
11044 GValue *properties;
11045 GList *changed_properties;
11046 GSource *changed_properties_idle_source;
11047 GMainContext *context;
11048 GMutex lock;
11049 };
11050
11051 static void
_process_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)11052 _process_skeleton_handle_method_call (
11053 GDBusConnection *connection G_GNUC_UNUSED,
11054 const gchar *sender G_GNUC_UNUSED,
11055 const gchar *object_path G_GNUC_UNUSED,
11056 const gchar *interface_name,
11057 const gchar *method_name,
11058 GVariant *parameters,
11059 GDBusMethodInvocation *invocation,
11060 gpointer user_data)
11061 {
11062 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11063 _ExtendedGDBusMethodInfo *info;
11064 GVariantIter iter;
11065 GVariant *child;
11066 GValue *paramv;
11067 gsize num_params;
11068 guint num_extra;
11069 gsize n;
11070 guint signal_id;
11071 GValue return_value = G_VALUE_INIT;
11072 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11073 g_assert (info != NULL);
11074 num_params = g_variant_n_children (parameters);
11075 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11076 n = 0;
11077 g_value_init (¶mv[n], TYPE_PROCESS);
11078 g_value_set_object (¶mv[n++], skeleton);
11079 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11080 g_value_set_object (¶mv[n++], invocation);
11081 if (info->pass_fdlist)
11082 {
11083 #ifdef G_OS_UNIX
11084 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
11085 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11086 #else
11087 g_assert_not_reached ();
11088 #endif
11089 }
11090 g_variant_iter_init (&iter, parameters);
11091 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11092 {
11093 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11094 if (arg_info->use_gvariant)
11095 {
11096 g_value_init (¶mv[n], G_TYPE_VARIANT);
11097 g_value_set_variant (¶mv[n], child);
11098 n++;
11099 }
11100 else
11101 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
11102 g_variant_unref (child);
11103 }
11104 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11105 g_value_init (&return_value, G_TYPE_BOOLEAN);
11106 g_signal_emitv (paramv, signal_id, 0, &return_value);
11107 if (!g_value_get_boolean (&return_value))
11108 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);
11109 g_value_unset (&return_value);
11110 for (n = 0; n < num_params + num_extra; n++)
11111 g_value_unset (¶mv[n]);
11112 g_free (paramv);
11113 }
11114
11115 static GVariant *
_process_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)11116 _process_skeleton_handle_get_property (
11117 GDBusConnection *connection G_GNUC_UNUSED,
11118 const gchar *sender G_GNUC_UNUSED,
11119 const gchar *object_path G_GNUC_UNUSED,
11120 const gchar *interface_name G_GNUC_UNUSED,
11121 const gchar *property_name,
11122 GError **error,
11123 gpointer user_data)
11124 {
11125 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11126 GValue value = G_VALUE_INIT;
11127 GParamSpec *pspec;
11128 _ExtendedGDBusPropertyInfo *info;
11129 GVariant *ret;
11130 ret = NULL;
11131 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11132 g_assert (info != NULL);
11133 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11134 if (pspec == NULL)
11135 {
11136 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11137 }
11138 else
11139 {
11140 g_value_init (&value, pspec->value_type);
11141 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11142 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11143 g_value_unset (&value);
11144 }
11145 return ret;
11146 }
11147
11148 static gboolean
_process_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)11149 _process_skeleton_handle_set_property (
11150 GDBusConnection *connection G_GNUC_UNUSED,
11151 const gchar *sender G_GNUC_UNUSED,
11152 const gchar *object_path G_GNUC_UNUSED,
11153 const gchar *interface_name G_GNUC_UNUSED,
11154 const gchar *property_name,
11155 GVariant *variant,
11156 GError **error,
11157 gpointer user_data)
11158 {
11159 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11160 GValue value = G_VALUE_INIT;
11161 GParamSpec *pspec;
11162 _ExtendedGDBusPropertyInfo *info;
11163 gboolean ret;
11164 ret = FALSE;
11165 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11166 g_assert (info != NULL);
11167 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11168 if (pspec == NULL)
11169 {
11170 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11171 }
11172 else
11173 {
11174 if (info->use_gvariant)
11175 g_value_set_variant (&value, variant);
11176 else
11177 g_dbus_gvariant_to_gvalue (variant, &value);
11178 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11179 g_value_unset (&value);
11180 ret = TRUE;
11181 }
11182 return ret;
11183 }
11184
11185 static const GDBusInterfaceVTable _process_skeleton_vtable =
11186 {
11187 _process_skeleton_handle_method_call,
11188 _process_skeleton_handle_get_property,
11189 _process_skeleton_handle_set_property,
11190 {NULL}
11191 };
11192
11193 static GDBusInterfaceInfo *
process_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)11194 process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11195 {
11196 return process_interface_info ();
11197 }
11198
11199 static GDBusInterfaceVTable *
process_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)11200 process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11201 {
11202 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
11203 }
11204
11205 static GVariant *
process_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)11206 process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11207 {
11208 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
11209
11210 GVariantBuilder builder;
11211 guint n;
11212 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11213 if (_process_interface_info.parent_struct.properties == NULL)
11214 goto out;
11215 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
11216 {
11217 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
11218 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11219 {
11220 GVariant *value;
11221 value = _process_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.Process", info->name, NULL, skeleton);
11222 if (value != NULL)
11223 {
11224 g_variant_take_ref (value);
11225 g_variant_builder_add (&builder, "{sv}", info->name, value);
11226 g_variant_unref (value);
11227 }
11228 }
11229 }
11230 out:
11231 return g_variant_builder_end (&builder);
11232 }
11233
11234 static void
process_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)11235 process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
11236 {
11237 }
11238
11239 static void process_skeleton_iface_init (ProcessIface *iface);
11240 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ProcessSkeleton,process_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ProcessSkeleton)G_IMPLEMENT_INTERFACE (TYPE_PROCESS,process_skeleton_iface_init))11241 G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11242 G_ADD_PRIVATE (ProcessSkeleton)
11243 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init))
11244
11245 #else
11246 G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11247 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init))
11248
11249 #endif
11250 static void
11251 process_skeleton_finalize (GObject *object)
11252 {
11253 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
11254 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11255 if (skeleton->priv->changed_properties_idle_source != NULL)
11256 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11257 g_main_context_unref (skeleton->priv->context);
11258 g_mutex_clear (&skeleton->priv->lock);
11259 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
11260 }
11261
11262 static void
process_skeleton_init(ProcessSkeleton * skeleton)11263 process_skeleton_init (ProcessSkeleton *skeleton)
11264 {
11265 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11266 skeleton->priv = process_skeleton_get_instance_private (skeleton);
11267 #else
11268 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
11269 #endif
11270
11271 g_mutex_init (&skeleton->priv->lock);
11272 skeleton->priv->context = g_main_context_ref_thread_default ();
11273 }
11274
11275 static void
process_skeleton_class_init(ProcessSkeletonClass * klass)11276 process_skeleton_class_init (ProcessSkeletonClass *klass)
11277 {
11278 GObjectClass *gobject_class;
11279 GDBusInterfaceSkeletonClass *skeleton_class;
11280
11281 gobject_class = G_OBJECT_CLASS (klass);
11282 gobject_class->finalize = process_skeleton_finalize;
11283
11284 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
11285 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
11286 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
11287 skeleton_class->flush = process_skeleton_dbus_interface_flush;
11288 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
11289
11290 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11291 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
11292 #endif
11293 }
11294
11295 static void
process_skeleton_iface_init(ProcessIface * iface G_GNUC_UNUSED)11296 process_skeleton_iface_init (ProcessIface *iface G_GNUC_UNUSED)
11297 {
11298 }
11299
11300 /**
11301 * process_skeleton_new:
11302 *
11303 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
11304 *
11305 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
11306 */
11307 Process *
process_skeleton_new(void)11308 process_skeleton_new (void)
11309 {
11310 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
11311 }
11312
11313 /* ------------------------------------------------------------------------
11314 * Code for interface org.openbmc.SharedResource
11315 * ------------------------------------------------------------------------
11316 */
11317
11318 /**
11319 * SECTION:SharedResource
11320 * @title: SharedResource
11321 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
11322 *
11323 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C.
11324 */
11325
11326 /* ---- Introspection data for org.openbmc.SharedResource ---- */
11327
11328 static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
11329 {
11330 {
11331 -1,
11332 (gchar *) "name",
11333 (gchar *) "s",
11334 NULL
11335 },
11336 FALSE
11337 };
11338
11339 static const GDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
11340 {
11341 &_shared_resource_method_info_lock_IN_ARG_name.parent_struct,
11342 NULL
11343 };
11344
11345 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
11346 {
11347 {
11348 -1,
11349 (gchar *) "lock",
11350 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
11351 NULL,
11352 NULL
11353 },
11354 "handle-lock",
11355 FALSE
11356 };
11357
11358 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
11359 {
11360 {
11361 -1,
11362 (gchar *) "unlock",
11363 NULL,
11364 NULL,
11365 NULL
11366 },
11367 "handle-unlock",
11368 FALSE
11369 };
11370
11371 static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
11372 {
11373 {
11374 -1,
11375 (gchar *) "lock",
11376 (gchar *) "b",
11377 NULL
11378 },
11379 FALSE
11380 };
11381
11382 static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
11383 {
11384 {
11385 -1,
11386 (gchar *) "name",
11387 (gchar *) "s",
11388 NULL
11389 },
11390 FALSE
11391 };
11392
11393 static const GDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
11394 {
11395 &_shared_resource_method_info_is_locked_OUT_ARG_lock.parent_struct,
11396 &_shared_resource_method_info_is_locked_OUT_ARG_name.parent_struct,
11397 NULL
11398 };
11399
11400 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
11401 {
11402 {
11403 -1,
11404 (gchar *) "isLocked",
11405 NULL,
11406 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
11407 NULL
11408 },
11409 "handle-is-locked",
11410 FALSE
11411 };
11412
11413 static const GDBusMethodInfo * const _shared_resource_method_info_pointers[] =
11414 {
11415 &_shared_resource_method_info_lock.parent_struct,
11416 &_shared_resource_method_info_unlock.parent_struct,
11417 &_shared_resource_method_info_is_locked.parent_struct,
11418 NULL
11419 };
11420
11421 static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
11422 {
11423 {
11424 -1,
11425 (gchar *) "lock",
11426 (gchar *) "b",
11427 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11428 NULL
11429 },
11430 "lock",
11431 FALSE,
11432 TRUE
11433 };
11434
11435 static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
11436 {
11437 {
11438 -1,
11439 (gchar *) "name",
11440 (gchar *) "s",
11441 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11442 NULL
11443 },
11444 "name",
11445 FALSE,
11446 TRUE
11447 };
11448
11449 static const GDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
11450 {
11451 &_shared_resource_property_info_lock.parent_struct,
11452 &_shared_resource_property_info_name.parent_struct,
11453 NULL
11454 };
11455
11456 static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
11457 {
11458 {
11459 -1,
11460 (gchar *) "org.openbmc.SharedResource",
11461 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
11462 NULL,
11463 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
11464 NULL
11465 },
11466 "shared-resource",
11467 };
11468
11469
11470 /**
11471 * shared_resource_interface_info:
11472 *
11473 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
11474 *
11475 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11476 */
11477 GDBusInterfaceInfo *
shared_resource_interface_info(void)11478 shared_resource_interface_info (void)
11479 {
11480 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
11481 }
11482
11483 /**
11484 * shared_resource_override_properties:
11485 * @klass: The class structure for a #GObject derived class.
11486 * @property_id_begin: The property id to assign to the first overridden property.
11487 *
11488 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
11489 * The properties are overridden in the order they are defined.
11490 *
11491 * Returns: The last property id.
11492 */
11493 guint
shared_resource_override_properties(GObjectClass * klass,guint property_id_begin)11494 shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
11495 {
11496 g_object_class_override_property (klass, property_id_begin++, "lock");
11497 g_object_class_override_property (klass, property_id_begin++, "name");
11498 return property_id_begin - 1;
11499 }
11500
11501
11502 inline static void
shared_resource_method_marshal_lock(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)11503 shared_resource_method_marshal_lock (
11504 GClosure *closure,
11505 GValue *return_value,
11506 unsigned int n_param_values,
11507 const GValue *param_values,
11508 void *invocation_hint,
11509 void *marshal_data)
11510 {
11511 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure,
11512 return_value, n_param_values, param_values, invocation_hint, marshal_data);
11513 }
11514
11515 inline static void
shared_resource_method_marshal_unlock(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)11516 shared_resource_method_marshal_unlock (
11517 GClosure *closure,
11518 GValue *return_value,
11519 unsigned int n_param_values,
11520 const GValue *param_values,
11521 void *invocation_hint,
11522 void *marshal_data)
11523 {
11524 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
11525 return_value, n_param_values, param_values, invocation_hint, marshal_data);
11526 }
11527
11528 inline static void
shared_resource_method_marshal_is_locked(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)11529 shared_resource_method_marshal_is_locked (
11530 GClosure *closure,
11531 GValue *return_value,
11532 unsigned int n_param_values,
11533 const GValue *param_values,
11534 void *invocation_hint,
11535 void *marshal_data)
11536 {
11537 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
11538 return_value, n_param_values, param_values, invocation_hint, marshal_data);
11539 }
11540
11541
11542 /**
11543 * SharedResource:
11544 *
11545 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11546 */
11547
11548 /**
11549 * SharedResourceIface:
11550 * @parent_iface: The parent interface.
11551 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
11552 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
11553 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
11554 * @get_lock: Getter for the #SharedResource:lock property.
11555 * @get_name: Getter for the #SharedResource:name property.
11556 *
11557 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11558 */
11559
11560 typedef SharedResourceIface SharedResourceInterface;
G_DEFINE_INTERFACE(SharedResource,shared_resource,G_TYPE_OBJECT)11561 G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT)
11562
11563 static void
11564 shared_resource_default_init (SharedResourceIface *iface)
11565 {
11566 /* GObject signals for incoming D-Bus method calls: */
11567 /**
11568 * SharedResource::handle-lock:
11569 * @object: A #SharedResource.
11570 * @invocation: A #GDBusMethodInvocation.
11571 * @arg_name: Argument passed by remote caller.
11572 *
11573 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
11574 *
11575 * 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 shared_resource_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
11576 *
11577 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
11578 */
11579 g_signal_new ("handle-lock",
11580 G_TYPE_FROM_INTERFACE (iface),
11581 G_SIGNAL_RUN_LAST,
11582 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
11583 g_signal_accumulator_true_handled,
11584 NULL,
11585 shared_resource_method_marshal_lock,
11586 G_TYPE_BOOLEAN,
11587 2,
11588 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
11589
11590 /**
11591 * SharedResource::handle-unlock:
11592 * @object: A #SharedResource.
11593 * @invocation: A #GDBusMethodInvocation.
11594 *
11595 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11596 *
11597 * 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 shared_resource_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
11598 *
11599 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
11600 */
11601 g_signal_new ("handle-unlock",
11602 G_TYPE_FROM_INTERFACE (iface),
11603 G_SIGNAL_RUN_LAST,
11604 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11605 g_signal_accumulator_true_handled,
11606 NULL,
11607 shared_resource_method_marshal_unlock,
11608 G_TYPE_BOOLEAN,
11609 1,
11610 G_TYPE_DBUS_METHOD_INVOCATION);
11611
11612 /**
11613 * SharedResource::handle-is-locked:
11614 * @object: A #SharedResource.
11615 * @invocation: A #GDBusMethodInvocation.
11616 *
11617 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11618 *
11619 * 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 shared_resource_complete_is_locked() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
11620 *
11621 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
11622 */
11623 g_signal_new ("handle-is-locked",
11624 G_TYPE_FROM_INTERFACE (iface),
11625 G_SIGNAL_RUN_LAST,
11626 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11627 g_signal_accumulator_true_handled,
11628 NULL,
11629 shared_resource_method_marshal_is_locked,
11630 G_TYPE_BOOLEAN,
11631 1,
11632 G_TYPE_DBUS_METHOD_INVOCATION);
11633
11634 /* GObject properties for D-Bus properties: */
11635 /**
11636 * SharedResource:lock:
11637 *
11638 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11639 *
11640 * 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.
11641 */
11642 g_object_interface_install_property (iface,
11643 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11644 /**
11645 * SharedResource:name:
11646 *
11647 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11648 *
11649 * 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.
11650 */
11651 g_object_interface_install_property (iface,
11652 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11653 }
11654
11655 /**
11656 * shared_resource_get_lock: (skip)
11657 * @object: A #SharedResource.
11658 *
11659 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11660 *
11661 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11662 *
11663 * Returns: The property value.
11664 */
11665 gboolean
shared_resource_get_lock(SharedResource * object)11666 shared_resource_get_lock (SharedResource *object)
11667 {
11668 g_return_val_if_fail (IS_SHARED_RESOURCE (object), FALSE);
11669
11670 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11671 }
11672
11673 /**
11674 * shared_resource_set_lock: (skip)
11675 * @object: A #SharedResource.
11676 * @value: The value to set.
11677 *
11678 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11679 *
11680 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11681 */
11682 void
shared_resource_set_lock(SharedResource * object,gboolean value)11683 shared_resource_set_lock (SharedResource *object, gboolean value)
11684 {
11685 g_object_set (G_OBJECT (object), "lock", value, NULL);
11686 }
11687
11688 /**
11689 * shared_resource_get_name: (skip)
11690 * @object: A #SharedResource.
11691 *
11692 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11693 *
11694 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11695 *
11696 * 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 shared_resource_dup_name() if on another thread.
11697 *
11698 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11699 */
11700 const gchar *
shared_resource_get_name(SharedResource * object)11701 shared_resource_get_name (SharedResource *object)
11702 {
11703 g_return_val_if_fail (IS_SHARED_RESOURCE (object), NULL);
11704
11705 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11706 }
11707
11708 /**
11709 * shared_resource_dup_name: (skip)
11710 * @object: A #SharedResource.
11711 *
11712 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11713 *
11714 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11715 *
11716 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11717 */
11718 gchar *
shared_resource_dup_name(SharedResource * object)11719 shared_resource_dup_name (SharedResource *object)
11720 {
11721 gchar *value;
11722 g_object_get (G_OBJECT (object), "name", &value, NULL);
11723 return value;
11724 }
11725
11726 /**
11727 * shared_resource_set_name: (skip)
11728 * @object: A #SharedResource.
11729 * @value: The value to set.
11730 *
11731 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11732 *
11733 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11734 */
11735 void
shared_resource_set_name(SharedResource * object,const gchar * value)11736 shared_resource_set_name (SharedResource *object, const gchar *value)
11737 {
11738 g_object_set (G_OBJECT (object), "name", value, NULL);
11739 }
11740
11741 /**
11742 * shared_resource_call_lock:
11743 * @proxy: A #SharedResourceProxy.
11744 * @arg_name: Argument to pass with the method invocation.
11745 * @cancellable: (nullable): A #GCancellable or %NULL.
11746 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11747 * @user_data: User data to pass to @callback.
11748 *
11749 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11750 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
11751 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11752 *
11753 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11754 */
11755 void
shared_resource_call_lock(SharedResource * proxy,const gchar * arg_name,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)11756 shared_resource_call_lock (
11757 SharedResource *proxy,
11758 const gchar *arg_name,
11759 GCancellable *cancellable,
11760 GAsyncReadyCallback callback,
11761 gpointer user_data)
11762 {
11763 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11764 "lock",
11765 g_variant_new ("(s)",
11766 arg_name),
11767 G_DBUS_CALL_FLAGS_NONE,
11768 -1,
11769 cancellable,
11770 callback,
11771 user_data);
11772 }
11773
11774 /**
11775 * shared_resource_call_lock_finish:
11776 * @proxy: A #SharedResourceProxy.
11777 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11778 * @error: Return location for error or %NULL.
11779 *
11780 * Finishes an operation started with shared_resource_call_lock().
11781 *
11782 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
11783 */
11784 gboolean
shared_resource_call_lock_finish(SharedResource * proxy,GAsyncResult * res,GError ** error)11785 shared_resource_call_lock_finish (
11786 SharedResource *proxy,
11787 GAsyncResult *res,
11788 GError **error)
11789 {
11790 GVariant *_ret;
11791 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11792 if (_ret == NULL)
11793 goto _out;
11794 g_variant_get (_ret,
11795 "()");
11796 g_variant_unref (_ret);
11797 _out:
11798 return _ret != NULL;
11799 }
11800
11801 /**
11802 * shared_resource_call_lock_sync:
11803 * @proxy: A #SharedResourceProxy.
11804 * @arg_name: Argument to pass with the method invocation.
11805 * @cancellable: (nullable): A #GCancellable or %NULL.
11806 * @error: Return location for error or %NULL.
11807 *
11808 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11809 *
11810 * See shared_resource_call_lock() for the asynchronous version of this method.
11811 *
11812 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
11813 */
11814 gboolean
shared_resource_call_lock_sync(SharedResource * proxy,const gchar * arg_name,GCancellable * cancellable,GError ** error)11815 shared_resource_call_lock_sync (
11816 SharedResource *proxy,
11817 const gchar *arg_name,
11818 GCancellable *cancellable,
11819 GError **error)
11820 {
11821 GVariant *_ret;
11822 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11823 "lock",
11824 g_variant_new ("(s)",
11825 arg_name),
11826 G_DBUS_CALL_FLAGS_NONE,
11827 -1,
11828 cancellable,
11829 error);
11830 if (_ret == NULL)
11831 goto _out;
11832 g_variant_get (_ret,
11833 "()");
11834 g_variant_unref (_ret);
11835 _out:
11836 return _ret != NULL;
11837 }
11838
11839 /**
11840 * shared_resource_call_unlock:
11841 * @proxy: A #SharedResourceProxy.
11842 * @cancellable: (nullable): A #GCancellable or %NULL.
11843 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11844 * @user_data: User data to pass to @callback.
11845 *
11846 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11847 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
11848 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11849 *
11850 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11851 */
11852 void
shared_resource_call_unlock(SharedResource * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)11853 shared_resource_call_unlock (
11854 SharedResource *proxy,
11855 GCancellable *cancellable,
11856 GAsyncReadyCallback callback,
11857 gpointer user_data)
11858 {
11859 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11860 "unlock",
11861 g_variant_new ("()"),
11862 G_DBUS_CALL_FLAGS_NONE,
11863 -1,
11864 cancellable,
11865 callback,
11866 user_data);
11867 }
11868
11869 /**
11870 * shared_resource_call_unlock_finish:
11871 * @proxy: A #SharedResourceProxy.
11872 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11873 * @error: Return location for error or %NULL.
11874 *
11875 * Finishes an operation started with shared_resource_call_unlock().
11876 *
11877 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
11878 */
11879 gboolean
shared_resource_call_unlock_finish(SharedResource * proxy,GAsyncResult * res,GError ** error)11880 shared_resource_call_unlock_finish (
11881 SharedResource *proxy,
11882 GAsyncResult *res,
11883 GError **error)
11884 {
11885 GVariant *_ret;
11886 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11887 if (_ret == NULL)
11888 goto _out;
11889 g_variant_get (_ret,
11890 "()");
11891 g_variant_unref (_ret);
11892 _out:
11893 return _ret != NULL;
11894 }
11895
11896 /**
11897 * shared_resource_call_unlock_sync:
11898 * @proxy: A #SharedResourceProxy.
11899 * @cancellable: (nullable): A #GCancellable or %NULL.
11900 * @error: Return location for error or %NULL.
11901 *
11902 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11903 *
11904 * See shared_resource_call_unlock() for the asynchronous version of this method.
11905 *
11906 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
11907 */
11908 gboolean
shared_resource_call_unlock_sync(SharedResource * proxy,GCancellable * cancellable,GError ** error)11909 shared_resource_call_unlock_sync (
11910 SharedResource *proxy,
11911 GCancellable *cancellable,
11912 GError **error)
11913 {
11914 GVariant *_ret;
11915 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11916 "unlock",
11917 g_variant_new ("()"),
11918 G_DBUS_CALL_FLAGS_NONE,
11919 -1,
11920 cancellable,
11921 error);
11922 if (_ret == NULL)
11923 goto _out;
11924 g_variant_get (_ret,
11925 "()");
11926 g_variant_unref (_ret);
11927 _out:
11928 return _ret != NULL;
11929 }
11930
11931 /**
11932 * shared_resource_call_is_locked:
11933 * @proxy: A #SharedResourceProxy.
11934 * @cancellable: (nullable): A #GCancellable or %NULL.
11935 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11936 * @user_data: User data to pass to @callback.
11937 *
11938 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11939 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
11940 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11941 *
11942 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11943 */
11944 void
shared_resource_call_is_locked(SharedResource * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)11945 shared_resource_call_is_locked (
11946 SharedResource *proxy,
11947 GCancellable *cancellable,
11948 GAsyncReadyCallback callback,
11949 gpointer user_data)
11950 {
11951 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11952 "isLocked",
11953 g_variant_new ("()"),
11954 G_DBUS_CALL_FLAGS_NONE,
11955 -1,
11956 cancellable,
11957 callback,
11958 user_data);
11959 }
11960
11961 /**
11962 * shared_resource_call_is_locked_finish:
11963 * @proxy: A #SharedResourceProxy.
11964 * @out_lock: (out) (optional): Return location for return parameter or %NULL to ignore.
11965 * @out_name: (out) (optional): Return location for return parameter or %NULL to ignore.
11966 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11967 * @error: Return location for error or %NULL.
11968 *
11969 * Finishes an operation started with shared_resource_call_is_locked().
11970 *
11971 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
11972 */
11973 gboolean
shared_resource_call_is_locked_finish(SharedResource * proxy,gboolean * out_lock,gchar ** out_name,GAsyncResult * res,GError ** error)11974 shared_resource_call_is_locked_finish (
11975 SharedResource *proxy,
11976 gboolean *out_lock,
11977 gchar **out_name,
11978 GAsyncResult *res,
11979 GError **error)
11980 {
11981 GVariant *_ret;
11982 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11983 if (_ret == NULL)
11984 goto _out;
11985 g_variant_get (_ret,
11986 "(bs)",
11987 out_lock,
11988 out_name);
11989 g_variant_unref (_ret);
11990 _out:
11991 return _ret != NULL;
11992 }
11993
11994 /**
11995 * shared_resource_call_is_locked_sync:
11996 * @proxy: A #SharedResourceProxy.
11997 * @out_lock: (out) (optional): Return location for return parameter or %NULL to ignore.
11998 * @out_name: (out) (optional): Return location for return parameter or %NULL to ignore.
11999 * @cancellable: (nullable): A #GCancellable or %NULL.
12000 * @error: Return location for error or %NULL.
12001 *
12002 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
12003 *
12004 * See shared_resource_call_is_locked() for the asynchronous version of this method.
12005 *
12006 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
12007 */
12008 gboolean
shared_resource_call_is_locked_sync(SharedResource * proxy,gboolean * out_lock,gchar ** out_name,GCancellable * cancellable,GError ** error)12009 shared_resource_call_is_locked_sync (
12010 SharedResource *proxy,
12011 gboolean *out_lock,
12012 gchar **out_name,
12013 GCancellable *cancellable,
12014 GError **error)
12015 {
12016 GVariant *_ret;
12017 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12018 "isLocked",
12019 g_variant_new ("()"),
12020 G_DBUS_CALL_FLAGS_NONE,
12021 -1,
12022 cancellable,
12023 error);
12024 if (_ret == NULL)
12025 goto _out;
12026 g_variant_get (_ret,
12027 "(bs)",
12028 out_lock,
12029 out_name);
12030 g_variant_unref (_ret);
12031 _out:
12032 return _ret != NULL;
12033 }
12034
12035 /**
12036 * shared_resource_complete_lock:
12037 * @object: A #SharedResource.
12038 * @invocation: (transfer full): A #GDBusMethodInvocation.
12039 *
12040 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</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.
12041 *
12042 * This method will free @invocation, you cannot use it afterwards.
12043 */
12044 void
shared_resource_complete_lock(SharedResource * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)12045 shared_resource_complete_lock (
12046 SharedResource *object G_GNUC_UNUSED,
12047 GDBusMethodInvocation *invocation)
12048 {
12049 g_dbus_method_invocation_return_value (invocation,
12050 g_variant_new ("()"));
12051 }
12052
12053 /**
12054 * shared_resource_complete_unlock:
12055 * @object: A #SharedResource.
12056 * @invocation: (transfer full): A #GDBusMethodInvocation.
12057 *
12058 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</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.
12059 *
12060 * This method will free @invocation, you cannot use it afterwards.
12061 */
12062 void
shared_resource_complete_unlock(SharedResource * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)12063 shared_resource_complete_unlock (
12064 SharedResource *object G_GNUC_UNUSED,
12065 GDBusMethodInvocation *invocation)
12066 {
12067 g_dbus_method_invocation_return_value (invocation,
12068 g_variant_new ("()"));
12069 }
12070
12071 /**
12072 * shared_resource_complete_is_locked:
12073 * @object: A #SharedResource.
12074 * @invocation: (transfer full): A #GDBusMethodInvocation.
12075 * @lock: Parameter to return.
12076 * @name: Parameter to return.
12077 *
12078 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</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.
12079 *
12080 * This method will free @invocation, you cannot use it afterwards.
12081 */
12082 void
shared_resource_complete_is_locked(SharedResource * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gboolean lock,const gchar * name)12083 shared_resource_complete_is_locked (
12084 SharedResource *object G_GNUC_UNUSED,
12085 GDBusMethodInvocation *invocation,
12086 gboolean lock,
12087 const gchar *name)
12088 {
12089 g_dbus_method_invocation_return_value (invocation,
12090 g_variant_new ("(bs)",
12091 lock,
12092 name));
12093 }
12094
12095 /* ------------------------------------------------------------------------ */
12096
12097 /**
12098 * SharedResourceProxy:
12099 *
12100 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
12101 */
12102
12103 /**
12104 * SharedResourceProxyClass:
12105 * @parent_class: The parent class.
12106 *
12107 * Class structure for #SharedResourceProxy.
12108 */
12109
12110 struct _SharedResourceProxyPrivate
12111 {
12112 GData *qdata;
12113 };
12114
12115 static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
12116
12117 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SharedResourceProxy,shared_resource_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SharedResourceProxy)G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE,shared_resource_proxy_iface_init))12118 G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12119 G_ADD_PRIVATE (SharedResourceProxy)
12120 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init))
12121
12122 #else
12123 G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12124 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init))
12125
12126 #endif
12127 static void
12128 shared_resource_proxy_finalize (GObject *object)
12129 {
12130 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12131 g_datalist_clear (&proxy->priv->qdata);
12132 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
12133 }
12134
12135 static void
shared_resource_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)12136 shared_resource_proxy_get_property (GObject *object,
12137 guint prop_id,
12138 GValue *value,
12139 GParamSpec *pspec G_GNUC_UNUSED)
12140 {
12141 const _ExtendedGDBusPropertyInfo *info;
12142 GVariant *variant;
12143 g_assert (prop_id != 0 && prop_id - 1 < 2);
12144 info = (const _ExtendedGDBusPropertyInfo *) _shared_resource_property_info_pointers[prop_id - 1];
12145 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12146 if (info->use_gvariant)
12147 {
12148 g_value_set_variant (value, variant);
12149 }
12150 else
12151 {
12152 if (variant != NULL)
12153 g_dbus_gvariant_to_gvalue (variant, value);
12154 }
12155 if (variant != NULL)
12156 g_variant_unref (variant);
12157 }
12158
12159 static void
shared_resource_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)12160 shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
12161 GAsyncResult *res,
12162 gpointer user_data)
12163 {
12164 const _ExtendedGDBusPropertyInfo *info = user_data;
12165 GError *error;
12166 GVariant *_ret;
12167 error = NULL;
12168 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12169 if (!_ret)
12170 {
12171 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
12172 info->parent_struct.name,
12173 error->message, g_quark_to_string (error->domain), error->code);
12174 g_error_free (error);
12175 }
12176 else
12177 {
12178 g_variant_unref (_ret);
12179 }
12180 }
12181
12182 static void
shared_resource_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)12183 shared_resource_proxy_set_property (GObject *object,
12184 guint prop_id,
12185 const GValue *value,
12186 GParamSpec *pspec G_GNUC_UNUSED)
12187 {
12188 const _ExtendedGDBusPropertyInfo *info;
12189 GVariant *variant;
12190 g_assert (prop_id != 0 && prop_id - 1 < 2);
12191 info = (const _ExtendedGDBusPropertyInfo *) _shared_resource_property_info_pointers[prop_id - 1];
12192 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12193 g_dbus_proxy_call (G_DBUS_PROXY (object),
12194 "org.freedesktop.DBus.Properties.Set",
12195 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
12196 G_DBUS_CALL_FLAGS_NONE,
12197 -1,
12198 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12199 g_variant_unref (variant);
12200 }
12201
12202 static void
shared_resource_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)12203 shared_resource_proxy_g_signal (GDBusProxy *proxy,
12204 const gchar *sender_name G_GNUC_UNUSED,
12205 const gchar *signal_name,
12206 GVariant *parameters)
12207 {
12208 _ExtendedGDBusSignalInfo *info;
12209 GVariantIter iter;
12210 GVariant *child;
12211 GValue *paramv;
12212 gsize num_params;
12213 gsize n;
12214 guint signal_id;
12215 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
12216 if (info == NULL)
12217 return;
12218 num_params = g_variant_n_children (parameters);
12219 paramv = g_new0 (GValue, num_params + 1);
12220 g_value_init (¶mv[0], TYPE_SHARED_RESOURCE);
12221 g_value_set_object (¶mv[0], proxy);
12222 g_variant_iter_init (&iter, parameters);
12223 n = 1;
12224 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12225 {
12226 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12227 if (arg_info->use_gvariant)
12228 {
12229 g_value_init (¶mv[n], G_TYPE_VARIANT);
12230 g_value_set_variant (¶mv[n], child);
12231 n++;
12232 }
12233 else
12234 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
12235 g_variant_unref (child);
12236 }
12237 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12238 g_signal_emitv (paramv, signal_id, 0, NULL);
12239 for (n = 0; n < num_params + 1; n++)
12240 g_value_unset (¶mv[n]);
12241 g_free (paramv);
12242 }
12243
12244 static void
shared_resource_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)12245 shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
12246 GVariant *changed_properties,
12247 const gchar *const *invalidated_properties)
12248 {
12249 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
12250 guint n;
12251 const gchar *key;
12252 GVariantIter *iter;
12253 _ExtendedGDBusPropertyInfo *info;
12254 g_variant_get (changed_properties, "a{sv}", &iter);
12255 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12256 {
12257 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
12258 g_datalist_remove_data (&proxy->priv->qdata, key);
12259 if (info != NULL)
12260 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12261 }
12262 g_variant_iter_free (iter);
12263 for (n = 0; invalidated_properties[n] != NULL; n++)
12264 {
12265 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
12266 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12267 if (info != NULL)
12268 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12269 }
12270 }
12271
12272 static gboolean
shared_resource_proxy_get_lock(SharedResource * object)12273 shared_resource_proxy_get_lock (SharedResource *object)
12274 {
12275 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12276 GVariant *variant;
12277 gboolean value = FALSE;
12278 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
12279 if (variant != NULL)
12280 {
12281 value = g_variant_get_boolean (variant);
12282 g_variant_unref (variant);
12283 }
12284 return value;
12285 }
12286
12287 static const gchar *
shared_resource_proxy_get_name(SharedResource * object)12288 shared_resource_proxy_get_name (SharedResource *object)
12289 {
12290 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12291 GVariant *variant;
12292 const gchar *value = NULL;
12293 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
12294 if (variant != NULL)
12295 {
12296 value = g_variant_get_string (variant, NULL);
12297 g_variant_unref (variant);
12298 }
12299 return value;
12300 }
12301
12302 static void
shared_resource_proxy_init(SharedResourceProxy * proxy)12303 shared_resource_proxy_init (SharedResourceProxy *proxy)
12304 {
12305 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12306 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
12307 #else
12308 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
12309 #endif
12310
12311 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
12312 }
12313
12314 static void
shared_resource_proxy_class_init(SharedResourceProxyClass * klass)12315 shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
12316 {
12317 GObjectClass *gobject_class;
12318 GDBusProxyClass *proxy_class;
12319
12320 gobject_class = G_OBJECT_CLASS (klass);
12321 gobject_class->finalize = shared_resource_proxy_finalize;
12322 gobject_class->get_property = shared_resource_proxy_get_property;
12323 gobject_class->set_property = shared_resource_proxy_set_property;
12324
12325 proxy_class = G_DBUS_PROXY_CLASS (klass);
12326 proxy_class->g_signal = shared_resource_proxy_g_signal;
12327 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
12328
12329 shared_resource_override_properties (gobject_class, 1);
12330
12331 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12332 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
12333 #endif
12334 }
12335
12336 static void
shared_resource_proxy_iface_init(SharedResourceIface * iface)12337 shared_resource_proxy_iface_init (SharedResourceIface *iface)
12338 {
12339 iface->get_lock = shared_resource_proxy_get_lock;
12340 iface->get_name = shared_resource_proxy_get_name;
12341 }
12342
12343 /**
12344 * shared_resource_proxy_new:
12345 * @connection: A #GDBusConnection.
12346 * @flags: Flags from the #GDBusProxyFlags enumeration.
12347 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12348 * @object_path: An object path.
12349 * @cancellable: (nullable): A #GCancellable or %NULL.
12350 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12351 * @user_data: User data to pass to @callback.
12352 *
12353 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details.
12354 *
12355 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
12356 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
12357 *
12358 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
12359 */
12360 void
shared_resource_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)12361 shared_resource_proxy_new (
12362 GDBusConnection *connection,
12363 GDBusProxyFlags flags,
12364 const gchar *name,
12365 const gchar *object_path,
12366 GCancellable *cancellable,
12367 GAsyncReadyCallback callback,
12368 gpointer user_data)
12369 {
12370 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
12371 }
12372
12373 /**
12374 * shared_resource_proxy_new_finish:
12375 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
12376 * @error: Return location for error or %NULL
12377 *
12378 * Finishes an operation started with shared_resource_proxy_new().
12379 *
12380 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12381 */
12382 SharedResource *
shared_resource_proxy_new_finish(GAsyncResult * res,GError ** error)12383 shared_resource_proxy_new_finish (
12384 GAsyncResult *res,
12385 GError **error)
12386 {
12387 GObject *ret;
12388 GObject *source_object;
12389 source_object = g_async_result_get_source_object (res);
12390 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12391 g_object_unref (source_object);
12392 if (ret != NULL)
12393 return SHARED_RESOURCE (ret);
12394 else
12395 return NULL;
12396 }
12397
12398 /**
12399 * shared_resource_proxy_new_sync:
12400 * @connection: A #GDBusConnection.
12401 * @flags: Flags from the #GDBusProxyFlags enumeration.
12402 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12403 * @object_path: An object path.
12404 * @cancellable: (nullable): A #GCancellable or %NULL.
12405 * @error: Return location for error or %NULL
12406 *
12407 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details.
12408 *
12409 * The calling thread is blocked until a reply is received.
12410 *
12411 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
12412 *
12413 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12414 */
12415 SharedResource *
shared_resource_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)12416 shared_resource_proxy_new_sync (
12417 GDBusConnection *connection,
12418 GDBusProxyFlags flags,
12419 const gchar *name,
12420 const gchar *object_path,
12421 GCancellable *cancellable,
12422 GError **error)
12423 {
12424 GInitable *ret;
12425 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
12426 if (ret != NULL)
12427 return SHARED_RESOURCE (ret);
12428 else
12429 return NULL;
12430 }
12431
12432
12433 /**
12434 * shared_resource_proxy_new_for_bus:
12435 * @bus_type: A #GBusType.
12436 * @flags: Flags from the #GDBusProxyFlags enumeration.
12437 * @name: A bus name (well-known or unique).
12438 * @object_path: An object path.
12439 * @cancellable: (nullable): A #GCancellable or %NULL.
12440 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12441 * @user_data: User data to pass to @callback.
12442 *
12443 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12444 *
12445 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
12446 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
12447 *
12448 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12449 */
12450 void
shared_resource_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)12451 shared_resource_proxy_new_for_bus (
12452 GBusType bus_type,
12453 GDBusProxyFlags flags,
12454 const gchar *name,
12455 const gchar *object_path,
12456 GCancellable *cancellable,
12457 GAsyncReadyCallback callback,
12458 gpointer user_data)
12459 {
12460 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
12461 }
12462
12463 /**
12464 * shared_resource_proxy_new_for_bus_finish:
12465 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
12466 * @error: Return location for error or %NULL
12467 *
12468 * Finishes an operation started with shared_resource_proxy_new_for_bus().
12469 *
12470 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12471 */
12472 SharedResource *
shared_resource_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)12473 shared_resource_proxy_new_for_bus_finish (
12474 GAsyncResult *res,
12475 GError **error)
12476 {
12477 GObject *ret;
12478 GObject *source_object;
12479 source_object = g_async_result_get_source_object (res);
12480 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12481 g_object_unref (source_object);
12482 if (ret != NULL)
12483 return SHARED_RESOURCE (ret);
12484 else
12485 return NULL;
12486 }
12487
12488 /**
12489 * shared_resource_proxy_new_for_bus_sync:
12490 * @bus_type: A #GBusType.
12491 * @flags: Flags from the #GDBusProxyFlags enumeration.
12492 * @name: A bus name (well-known or unique).
12493 * @object_path: An object path.
12494 * @cancellable: (nullable): A #GCancellable or %NULL.
12495 * @error: Return location for error or %NULL
12496 *
12497 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12498 *
12499 * The calling thread is blocked until a reply is received.
12500 *
12501 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
12502 *
12503 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12504 */
12505 SharedResource *
shared_resource_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)12506 shared_resource_proxy_new_for_bus_sync (
12507 GBusType bus_type,
12508 GDBusProxyFlags flags,
12509 const gchar *name,
12510 const gchar *object_path,
12511 GCancellable *cancellable,
12512 GError **error)
12513 {
12514 GInitable *ret;
12515 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
12516 if (ret != NULL)
12517 return SHARED_RESOURCE (ret);
12518 else
12519 return NULL;
12520 }
12521
12522
12523 /* ------------------------------------------------------------------------ */
12524
12525 /**
12526 * SharedResourceSkeleton:
12527 *
12528 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
12529 */
12530
12531 /**
12532 * SharedResourceSkeletonClass:
12533 * @parent_class: The parent class.
12534 *
12535 * Class structure for #SharedResourceSkeleton.
12536 */
12537
12538 struct _SharedResourceSkeletonPrivate
12539 {
12540 GValue *properties;
12541 GList *changed_properties;
12542 GSource *changed_properties_idle_source;
12543 GMainContext *context;
12544 GMutex lock;
12545 };
12546
12547 static void
_shared_resource_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)12548 _shared_resource_skeleton_handle_method_call (
12549 GDBusConnection *connection G_GNUC_UNUSED,
12550 const gchar *sender G_GNUC_UNUSED,
12551 const gchar *object_path G_GNUC_UNUSED,
12552 const gchar *interface_name,
12553 const gchar *method_name,
12554 GVariant *parameters,
12555 GDBusMethodInvocation *invocation,
12556 gpointer user_data)
12557 {
12558 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12559 _ExtendedGDBusMethodInfo *info;
12560 GVariantIter iter;
12561 GVariant *child;
12562 GValue *paramv;
12563 gsize num_params;
12564 guint num_extra;
12565 gsize n;
12566 guint signal_id;
12567 GValue return_value = G_VALUE_INIT;
12568 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12569 g_assert (info != NULL);
12570 num_params = g_variant_n_children (parameters);
12571 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12572 n = 0;
12573 g_value_init (¶mv[n], TYPE_SHARED_RESOURCE);
12574 g_value_set_object (¶mv[n++], skeleton);
12575 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12576 g_value_set_object (¶mv[n++], invocation);
12577 if (info->pass_fdlist)
12578 {
12579 #ifdef G_OS_UNIX
12580 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
12581 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12582 #else
12583 g_assert_not_reached ();
12584 #endif
12585 }
12586 g_variant_iter_init (&iter, parameters);
12587 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12588 {
12589 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12590 if (arg_info->use_gvariant)
12591 {
12592 g_value_init (¶mv[n], G_TYPE_VARIANT);
12593 g_value_set_variant (¶mv[n], child);
12594 n++;
12595 }
12596 else
12597 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
12598 g_variant_unref (child);
12599 }
12600 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12601 g_value_init (&return_value, G_TYPE_BOOLEAN);
12602 g_signal_emitv (paramv, signal_id, 0, &return_value);
12603 if (!g_value_get_boolean (&return_value))
12604 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);
12605 g_value_unset (&return_value);
12606 for (n = 0; n < num_params + num_extra; n++)
12607 g_value_unset (¶mv[n]);
12608 g_free (paramv);
12609 }
12610
12611 static GVariant *
_shared_resource_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)12612 _shared_resource_skeleton_handle_get_property (
12613 GDBusConnection *connection G_GNUC_UNUSED,
12614 const gchar *sender G_GNUC_UNUSED,
12615 const gchar *object_path G_GNUC_UNUSED,
12616 const gchar *interface_name G_GNUC_UNUSED,
12617 const gchar *property_name,
12618 GError **error,
12619 gpointer user_data)
12620 {
12621 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12622 GValue value = G_VALUE_INIT;
12623 GParamSpec *pspec;
12624 _ExtendedGDBusPropertyInfo *info;
12625 GVariant *ret;
12626 ret = NULL;
12627 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12628 g_assert (info != NULL);
12629 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12630 if (pspec == NULL)
12631 {
12632 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12633 }
12634 else
12635 {
12636 g_value_init (&value, pspec->value_type);
12637 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12638 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12639 g_value_unset (&value);
12640 }
12641 return ret;
12642 }
12643
12644 static gboolean
_shared_resource_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)12645 _shared_resource_skeleton_handle_set_property (
12646 GDBusConnection *connection G_GNUC_UNUSED,
12647 const gchar *sender G_GNUC_UNUSED,
12648 const gchar *object_path G_GNUC_UNUSED,
12649 const gchar *interface_name G_GNUC_UNUSED,
12650 const gchar *property_name,
12651 GVariant *variant,
12652 GError **error,
12653 gpointer user_data)
12654 {
12655 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12656 GValue value = G_VALUE_INIT;
12657 GParamSpec *pspec;
12658 _ExtendedGDBusPropertyInfo *info;
12659 gboolean ret;
12660 ret = FALSE;
12661 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12662 g_assert (info != NULL);
12663 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12664 if (pspec == NULL)
12665 {
12666 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12667 }
12668 else
12669 {
12670 if (info->use_gvariant)
12671 g_value_set_variant (&value, variant);
12672 else
12673 g_dbus_gvariant_to_gvalue (variant, &value);
12674 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12675 g_value_unset (&value);
12676 ret = TRUE;
12677 }
12678 return ret;
12679 }
12680
12681 static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12682 {
12683 _shared_resource_skeleton_handle_method_call,
12684 _shared_resource_skeleton_handle_get_property,
12685 _shared_resource_skeleton_handle_set_property,
12686 {NULL}
12687 };
12688
12689 static GDBusInterfaceInfo *
shared_resource_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)12690 shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12691 {
12692 return shared_resource_interface_info ();
12693 }
12694
12695 static GDBusInterfaceVTable *
shared_resource_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)12696 shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12697 {
12698 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12699 }
12700
12701 static GVariant *
shared_resource_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)12702 shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12703 {
12704 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12705
12706 GVariantBuilder builder;
12707 guint n;
12708 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12709 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12710 goto out;
12711 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12712 {
12713 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12714 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12715 {
12716 GVariant *value;
12717 value = _shared_resource_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.SharedResource", info->name, NULL, skeleton);
12718 if (value != NULL)
12719 {
12720 g_variant_take_ref (value);
12721 g_variant_builder_add (&builder, "{sv}", info->name, value);
12722 g_variant_unref (value);
12723 }
12724 }
12725 }
12726 out:
12727 return g_variant_builder_end (&builder);
12728 }
12729
12730 static gboolean _shared_resource_emit_changed (gpointer user_data);
12731
12732 static void
shared_resource_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)12733 shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12734 {
12735 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12736 gboolean emit_changed = FALSE;
12737
12738 g_mutex_lock (&skeleton->priv->lock);
12739 if (skeleton->priv->changed_properties_idle_source != NULL)
12740 {
12741 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12742 skeleton->priv->changed_properties_idle_source = NULL;
12743 emit_changed = TRUE;
12744 }
12745 g_mutex_unlock (&skeleton->priv->lock);
12746
12747 if (emit_changed)
12748 _shared_resource_emit_changed (skeleton);
12749 }
12750
12751 static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12752 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SharedResourceSkeleton,shared_resource_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SharedResourceSkeleton)G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE,shared_resource_skeleton_iface_init))12753 G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12754 G_ADD_PRIVATE (SharedResourceSkeleton)
12755 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init))
12756
12757 #else
12758 G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12759 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init))
12760
12761 #endif
12762 static void
12763 shared_resource_skeleton_finalize (GObject *object)
12764 {
12765 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12766 guint n;
12767 for (n = 0; n < 2; n++)
12768 g_value_unset (&skeleton->priv->properties[n]);
12769 g_free (skeleton->priv->properties);
12770 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12771 if (skeleton->priv->changed_properties_idle_source != NULL)
12772 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12773 g_main_context_unref (skeleton->priv->context);
12774 g_mutex_clear (&skeleton->priv->lock);
12775 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12776 }
12777
12778 static void
shared_resource_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)12779 shared_resource_skeleton_get_property (GObject *object,
12780 guint prop_id,
12781 GValue *value,
12782 GParamSpec *pspec G_GNUC_UNUSED)
12783 {
12784 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12785 g_assert (prop_id != 0 && prop_id - 1 < 2);
12786 g_mutex_lock (&skeleton->priv->lock);
12787 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12788 g_mutex_unlock (&skeleton->priv->lock);
12789 }
12790
12791 static gboolean
_shared_resource_emit_changed(gpointer user_data)12792 _shared_resource_emit_changed (gpointer user_data)
12793 {
12794 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12795 GList *l;
12796 GVariantBuilder builder;
12797 GVariantBuilder invalidated_builder;
12798 guint num_changes;
12799
12800 g_mutex_lock (&skeleton->priv->lock);
12801 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12802 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12803 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12804 {
12805 ChangedProperty *cp = l->data;
12806 GVariant *variant;
12807 const GValue *cur_value;
12808
12809 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12810 if (!_g_value_equal (cur_value, &cp->orig_value))
12811 {
12812 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12813 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12814 g_variant_unref (variant);
12815 num_changes++;
12816 }
12817 }
12818 if (num_changes > 0)
12819 {
12820 GList *connections, *ll;
12821 GVariant *signal_variant;
12822 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12823 &builder, &invalidated_builder));
12824 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12825 for (ll = connections; ll != NULL; ll = ll->next)
12826 {
12827 GDBusConnection *connection = ll->data;
12828
12829 g_dbus_connection_emit_signal (connection,
12830 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12831 "org.freedesktop.DBus.Properties",
12832 "PropertiesChanged",
12833 signal_variant,
12834 NULL);
12835 }
12836 g_variant_unref (signal_variant);
12837 g_list_free_full (connections, g_object_unref);
12838 }
12839 else
12840 {
12841 g_variant_builder_clear (&builder);
12842 g_variant_builder_clear (&invalidated_builder);
12843 }
12844 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12845 skeleton->priv->changed_properties = NULL;
12846 skeleton->priv->changed_properties_idle_source = NULL;
12847 g_mutex_unlock (&skeleton->priv->lock);
12848 return FALSE;
12849 }
12850
12851 static void
_shared_resource_schedule_emit_changed(SharedResourceSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)12852 _shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12853 {
12854 ChangedProperty *cp;
12855 GList *l;
12856 cp = NULL;
12857 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12858 {
12859 ChangedProperty *i_cp = l->data;
12860 if (i_cp->info == info)
12861 {
12862 cp = i_cp;
12863 break;
12864 }
12865 }
12866 if (cp == NULL)
12867 {
12868 cp = g_new0 (ChangedProperty, 1);
12869 cp->prop_id = prop_id;
12870 cp->info = info;
12871 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12872 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12873 g_value_copy (orig_value, &cp->orig_value);
12874 }
12875 }
12876
12877 static void
shared_resource_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)12878 shared_resource_skeleton_notify (GObject *object,
12879 GParamSpec *pspec G_GNUC_UNUSED)
12880 {
12881 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12882 g_mutex_lock (&skeleton->priv->lock);
12883 if (skeleton->priv->changed_properties != NULL &&
12884 skeleton->priv->changed_properties_idle_source == NULL)
12885 {
12886 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12887 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12888 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12889 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed");
12890 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12891 g_source_unref (skeleton->priv->changed_properties_idle_source);
12892 }
12893 g_mutex_unlock (&skeleton->priv->lock);
12894 }
12895
12896 static void
shared_resource_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)12897 shared_resource_skeleton_set_property (GObject *object,
12898 guint prop_id,
12899 const GValue *value,
12900 GParamSpec *pspec)
12901 {
12902 const _ExtendedGDBusPropertyInfo *info;
12903 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12904 g_assert (prop_id != 0 && prop_id - 1 < 2);
12905 info = (const _ExtendedGDBusPropertyInfo *) _shared_resource_property_info_pointers[prop_id - 1];
12906 g_mutex_lock (&skeleton->priv->lock);
12907 g_object_freeze_notify (object);
12908 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12909 {
12910 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
12911 info->emits_changed_signal)
12912 _shared_resource_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
12913 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12914 g_object_notify_by_pspec (object, pspec);
12915 }
12916 g_mutex_unlock (&skeleton->priv->lock);
12917 g_object_thaw_notify (object);
12918 }
12919
12920 static void
shared_resource_skeleton_init(SharedResourceSkeleton * skeleton)12921 shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12922 {
12923 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12924 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12925 #else
12926 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12927 #endif
12928
12929 g_mutex_init (&skeleton->priv->lock);
12930 skeleton->priv->context = g_main_context_ref_thread_default ();
12931 skeleton->priv->properties = g_new0 (GValue, 2);
12932 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12933 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12934 }
12935
12936 static gboolean
shared_resource_skeleton_get_lock(SharedResource * object)12937 shared_resource_skeleton_get_lock (SharedResource *object)
12938 {
12939 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12940 gboolean value;
12941 g_mutex_lock (&skeleton->priv->lock);
12942 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[0]));
12943 g_mutex_unlock (&skeleton->priv->lock);
12944 return value;
12945 }
12946
12947 static const gchar *
shared_resource_skeleton_get_name(SharedResource * object)12948 shared_resource_skeleton_get_name (SharedResource *object)
12949 {
12950 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12951 const gchar *value;
12952 g_mutex_lock (&skeleton->priv->lock);
12953 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
12954 g_mutex_unlock (&skeleton->priv->lock);
12955 return value;
12956 }
12957
12958 static void
shared_resource_skeleton_class_init(SharedResourceSkeletonClass * klass)12959 shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12960 {
12961 GObjectClass *gobject_class;
12962 GDBusInterfaceSkeletonClass *skeleton_class;
12963
12964 gobject_class = G_OBJECT_CLASS (klass);
12965 gobject_class->finalize = shared_resource_skeleton_finalize;
12966 gobject_class->get_property = shared_resource_skeleton_get_property;
12967 gobject_class->set_property = shared_resource_skeleton_set_property;
12968 gobject_class->notify = shared_resource_skeleton_notify;
12969
12970
12971 shared_resource_override_properties (gobject_class, 1);
12972
12973 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12974 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12975 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12976 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12977 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12978
12979 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12980 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12981 #endif
12982 }
12983
12984 static void
shared_resource_skeleton_iface_init(SharedResourceIface * iface)12985 shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12986 {
12987 iface->get_lock = shared_resource_skeleton_get_lock;
12988 iface->get_name = shared_resource_skeleton_get_name;
12989 }
12990
12991 /**
12992 * shared_resource_skeleton_new:
12993 *
12994 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12995 *
12996 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12997 */
12998 SharedResource *
shared_resource_skeleton_new(void)12999 shared_resource_skeleton_new (void)
13000 {
13001 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
13002 }
13003
13004 /* ------------------------------------------------------------------------
13005 * Code for interface org.openbmc.Control
13006 * ------------------------------------------------------------------------
13007 */
13008
13009 /**
13010 * SECTION:Control
13011 * @title: Control
13012 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
13013 *
13014 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface in C.
13015 */
13016
13017 enum
13018 {
13019 _CONTROL_HEARTBEAT,
13020 _CONTROL_STARTED,
13021 };
13022
13023 static unsigned _CONTROL_SIGNALS[2] = { 0 };
13024
13025 /* ---- Introspection data for org.openbmc.Control ---- */
13026
13027 static const _ExtendedGDBusMethodInfo _control_method_info_init =
13028 {
13029 {
13030 -1,
13031 (gchar *) "init",
13032 NULL,
13033 NULL,
13034 NULL
13035 },
13036 "handle-init",
13037 FALSE
13038 };
13039
13040 static const GDBusMethodInfo * const _control_method_info_pointers[] =
13041 {
13042 &_control_method_info_init.parent_struct,
13043 NULL
13044 };
13045
13046 static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
13047 {
13048 {
13049 -1,
13050 (gchar *) "bus_name",
13051 (gchar *) "s",
13052 NULL
13053 },
13054 FALSE
13055 };
13056
13057 static const GDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
13058 {
13059 &_control_signal_info_heartbeat_ARG_bus_name.parent_struct,
13060 NULL
13061 };
13062
13063 static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
13064 {
13065 {
13066 -1,
13067 (gchar *) "Heartbeat",
13068 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
13069 NULL
13070 },
13071 "heartbeat"
13072 };
13073
13074 static const _ExtendedGDBusSignalInfo _control_signal_info_started =
13075 {
13076 {
13077 -1,
13078 (gchar *) "Started",
13079 NULL,
13080 NULL
13081 },
13082 "started"
13083 };
13084
13085 static const GDBusSignalInfo * const _control_signal_info_pointers[] =
13086 {
13087 &_control_signal_info_heartbeat.parent_struct,
13088 &_control_signal_info_started.parent_struct,
13089 NULL
13090 };
13091
13092 static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
13093 {
13094 {
13095 -1,
13096 (gchar *) "poll_interval",
13097 (gchar *) "i",
13098 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
13099 NULL
13100 },
13101 "poll-interval",
13102 FALSE,
13103 TRUE
13104 };
13105
13106 static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
13107 {
13108 {
13109 -1,
13110 (gchar *) "heatbeat",
13111 (gchar *) "i",
13112 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
13113 NULL
13114 },
13115 "heatbeat",
13116 FALSE,
13117 TRUE
13118 };
13119
13120 static const GDBusPropertyInfo * const _control_property_info_pointers[] =
13121 {
13122 &_control_property_info_poll_interval.parent_struct,
13123 &_control_property_info_heatbeat.parent_struct,
13124 NULL
13125 };
13126
13127 static const _ExtendedGDBusInterfaceInfo _control_interface_info =
13128 {
13129 {
13130 -1,
13131 (gchar *) "org.openbmc.Control",
13132 (GDBusMethodInfo **) &_control_method_info_pointers,
13133 (GDBusSignalInfo **) &_control_signal_info_pointers,
13134 (GDBusPropertyInfo **) &_control_property_info_pointers,
13135 NULL
13136 },
13137 "control",
13138 };
13139
13140
13141 /**
13142 * control_interface_info:
13143 *
13144 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
13145 *
13146 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13147 */
13148 GDBusInterfaceInfo *
control_interface_info(void)13149 control_interface_info (void)
13150 {
13151 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
13152 }
13153
13154 /**
13155 * control_override_properties:
13156 * @klass: The class structure for a #GObject derived class.
13157 * @property_id_begin: The property id to assign to the first overridden property.
13158 *
13159 * Overrides all #GObject properties in the #Control interface for a concrete class.
13160 * The properties are overridden in the order they are defined.
13161 *
13162 * Returns: The last property id.
13163 */
13164 guint
control_override_properties(GObjectClass * klass,guint property_id_begin)13165 control_override_properties (GObjectClass *klass, guint property_id_begin)
13166 {
13167 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
13168 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
13169 return property_id_begin - 1;
13170 }
13171
13172
13173 inline static void
control_signal_marshal_heartbeat(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)13174 control_signal_marshal_heartbeat (
13175 GClosure *closure,
13176 GValue *return_value,
13177 unsigned int n_param_values,
13178 const GValue *param_values,
13179 void *invocation_hint,
13180 void *marshal_data)
13181 {
13182 g_cclosure_marshal_VOID__STRING (closure,
13183 return_value, n_param_values, param_values, invocation_hint, marshal_data);
13184 }
13185
13186 inline static void
control_signal_marshal_started(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)13187 control_signal_marshal_started (
13188 GClosure *closure,
13189 GValue *return_value,
13190 unsigned int n_param_values,
13191 const GValue *param_values,
13192 void *invocation_hint,
13193 void *marshal_data)
13194 {
13195 g_cclosure_marshal_VOID__VOID (closure,
13196 return_value, n_param_values, param_values, invocation_hint, marshal_data);
13197 }
13198
13199 inline static void
control_method_marshal_init(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)13200 control_method_marshal_init (
13201 GClosure *closure,
13202 GValue *return_value,
13203 unsigned int n_param_values,
13204 const GValue *param_values,
13205 void *invocation_hint,
13206 void *marshal_data)
13207 {
13208 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
13209 return_value, n_param_values, param_values, invocation_hint, marshal_data);
13210 }
13211
13212
13213 /**
13214 * Control:
13215 *
13216 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13217 */
13218
13219 /**
13220 * ControlIface:
13221 * @parent_iface: The parent interface.
13222 * @handle_init: Handler for the #Control::handle-init signal.
13223 * @get_heatbeat: Getter for the #Control:heatbeat property.
13224 * @get_poll_interval: Getter for the #Control:poll-interval property.
13225 * @heartbeat: Handler for the #Control::heartbeat signal.
13226 * @started: Handler for the #Control::started signal.
13227 *
13228 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13229 */
13230
13231 typedef ControlIface ControlInterface;
G_DEFINE_INTERFACE(Control,control,G_TYPE_OBJECT)13232 G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT)
13233
13234 static void
13235 control_default_init (ControlIface *iface)
13236 {
13237 /* GObject signals for incoming D-Bus method calls: */
13238 /**
13239 * Control::handle-init:
13240 * @object: A #Control.
13241 * @invocation: A #GDBusMethodInvocation.
13242 *
13243 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
13244 *
13245 * 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 control_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
13246 *
13247 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
13248 */
13249 g_signal_new ("handle-init",
13250 G_TYPE_FROM_INTERFACE (iface),
13251 G_SIGNAL_RUN_LAST,
13252 G_STRUCT_OFFSET (ControlIface, handle_init),
13253 g_signal_accumulator_true_handled,
13254 NULL,
13255 control_method_marshal_init,
13256 G_TYPE_BOOLEAN,
13257 1,
13258 G_TYPE_DBUS_METHOD_INVOCATION);
13259
13260 /* GObject signals for received D-Bus signals: */
13261 /**
13262 * Control::heartbeat:
13263 * @object: A #Control.
13264 * @arg_bus_name: Argument.
13265 *
13266 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> is received.
13267 *
13268 * 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.
13269 */
13270 _CONTROL_SIGNALS[_CONTROL_HEARTBEAT] =
13271 g_signal_new ("heartbeat",
13272 G_TYPE_FROM_INTERFACE (iface),
13273 G_SIGNAL_RUN_LAST,
13274 G_STRUCT_OFFSET (ControlIface, heartbeat),
13275 NULL,
13276 NULL,
13277 control_signal_marshal_heartbeat,
13278 G_TYPE_NONE,
13279 1, G_TYPE_STRING);
13280
13281 /**
13282 * Control::started:
13283 * @object: A #Control.
13284 *
13285 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received.
13286 *
13287 * 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.
13288 */
13289 _CONTROL_SIGNALS[_CONTROL_STARTED] =
13290 g_signal_new ("started",
13291 G_TYPE_FROM_INTERFACE (iface),
13292 G_SIGNAL_RUN_LAST,
13293 G_STRUCT_OFFSET (ControlIface, started),
13294 NULL,
13295 NULL,
13296 control_signal_marshal_started,
13297 G_TYPE_NONE,
13298 0);
13299
13300 /* GObject properties for D-Bus properties: */
13301 /**
13302 * Control:poll-interval:
13303 *
13304 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
13305 *
13306 * 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.
13307 */
13308 g_object_interface_install_property (iface,
13309 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13310 /**
13311 * Control:heatbeat:
13312 *
13313 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
13314 *
13315 * 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.
13316 */
13317 g_object_interface_install_property (iface,
13318 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13319 }
13320
13321 /**
13322 * control_get_poll_interval: (skip)
13323 * @object: A #Control.
13324 *
13325 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
13326 *
13327 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13328 *
13329 * Returns: The property value.
13330 */
13331 gint
control_get_poll_interval(Control * object)13332 control_get_poll_interval (Control *object)
13333 {
13334 g_return_val_if_fail (IS_CONTROL (object), 0);
13335
13336 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
13337 }
13338
13339 /**
13340 * control_set_poll_interval: (skip)
13341 * @object: A #Control.
13342 * @value: The value to set.
13343 *
13344 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
13345 *
13346 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13347 */
13348 void
control_set_poll_interval(Control * object,gint value)13349 control_set_poll_interval (Control *object, gint value)
13350 {
13351 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
13352 }
13353
13354 /**
13355 * control_get_heatbeat: (skip)
13356 * @object: A #Control.
13357 *
13358 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
13359 *
13360 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
13361 *
13362 * Returns: The property value.
13363 */
13364 gint
control_get_heatbeat(Control * object)13365 control_get_heatbeat (Control *object)
13366 {
13367 g_return_val_if_fail (IS_CONTROL (object), 0);
13368
13369 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
13370 }
13371
13372 /**
13373 * control_set_heatbeat: (skip)
13374 * @object: A #Control.
13375 * @value: The value to set.
13376 *
13377 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
13378 *
13379 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
13380 */
13381 void
control_set_heatbeat(Control * object,gint value)13382 control_set_heatbeat (Control *object, gint value)
13383 {
13384 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
13385 }
13386
13387 /**
13388 * control_emit_heartbeat:
13389 * @object: A #Control.
13390 * @arg_bus_name: Argument to pass with the signal.
13391 *
13392 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
13393 */
13394 void
control_emit_heartbeat(Control * object,const gchar * arg_bus_name)13395 control_emit_heartbeat (
13396 Control *object,
13397 const gchar *arg_bus_name)
13398 {
13399 g_signal_emit (object, _CONTROL_SIGNALS[_CONTROL_HEARTBEAT], 0, arg_bus_name);
13400 }
13401
13402 /**
13403 * control_emit_started:
13404 * @object: A #Control.
13405 *
13406 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
13407 */
13408 void
control_emit_started(Control * object)13409 control_emit_started (
13410 Control *object)
13411 {
13412 g_signal_emit (object, _CONTROL_SIGNALS[_CONTROL_STARTED], 0);
13413 }
13414
13415 /**
13416 * control_call_init:
13417 * @proxy: A #ControlProxy.
13418 * @cancellable: (nullable): A #GCancellable or %NULL.
13419 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13420 * @user_data: User data to pass to @callback.
13421 *
13422 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
13423 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
13424 * You can then call control_call_init_finish() to get the result of the operation.
13425 *
13426 * See control_call_init_sync() for the synchronous, blocking version of this method.
13427 */
13428 void
control_call_init(Control * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)13429 control_call_init (
13430 Control *proxy,
13431 GCancellable *cancellable,
13432 GAsyncReadyCallback callback,
13433 gpointer user_data)
13434 {
13435 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13436 "init",
13437 g_variant_new ("()"),
13438 G_DBUS_CALL_FLAGS_NONE,
13439 -1,
13440 cancellable,
13441 callback,
13442 user_data);
13443 }
13444
13445 /**
13446 * control_call_init_finish:
13447 * @proxy: A #ControlProxy.
13448 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
13449 * @error: Return location for error or %NULL.
13450 *
13451 * Finishes an operation started with control_call_init().
13452 *
13453 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
13454 */
13455 gboolean
control_call_init_finish(Control * proxy,GAsyncResult * res,GError ** error)13456 control_call_init_finish (
13457 Control *proxy,
13458 GAsyncResult *res,
13459 GError **error)
13460 {
13461 GVariant *_ret;
13462 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13463 if (_ret == NULL)
13464 goto _out;
13465 g_variant_get (_ret,
13466 "()");
13467 g_variant_unref (_ret);
13468 _out:
13469 return _ret != NULL;
13470 }
13471
13472 /**
13473 * control_call_init_sync:
13474 * @proxy: A #ControlProxy.
13475 * @cancellable: (nullable): A #GCancellable or %NULL.
13476 * @error: Return location for error or %NULL.
13477 *
13478 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
13479 *
13480 * See control_call_init() for the asynchronous version of this method.
13481 *
13482 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
13483 */
13484 gboolean
control_call_init_sync(Control * proxy,GCancellable * cancellable,GError ** error)13485 control_call_init_sync (
13486 Control *proxy,
13487 GCancellable *cancellable,
13488 GError **error)
13489 {
13490 GVariant *_ret;
13491 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13492 "init",
13493 g_variant_new ("()"),
13494 G_DBUS_CALL_FLAGS_NONE,
13495 -1,
13496 cancellable,
13497 error);
13498 if (_ret == NULL)
13499 goto _out;
13500 g_variant_get (_ret,
13501 "()");
13502 g_variant_unref (_ret);
13503 _out:
13504 return _ret != NULL;
13505 }
13506
13507 /**
13508 * control_complete_init:
13509 * @object: A #Control.
13510 * @invocation: (transfer full): A #GDBusMethodInvocation.
13511 *
13512 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.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.
13513 *
13514 * This method will free @invocation, you cannot use it afterwards.
13515 */
13516 void
control_complete_init(Control * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)13517 control_complete_init (
13518 Control *object G_GNUC_UNUSED,
13519 GDBusMethodInvocation *invocation)
13520 {
13521 g_dbus_method_invocation_return_value (invocation,
13522 g_variant_new ("()"));
13523 }
13524
13525 /* ------------------------------------------------------------------------ */
13526
13527 /**
13528 * ControlProxy:
13529 *
13530 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
13531 */
13532
13533 /**
13534 * ControlProxyClass:
13535 * @parent_class: The parent class.
13536 *
13537 * Class structure for #ControlProxy.
13538 */
13539
13540 struct _ControlProxyPrivate
13541 {
13542 GData *qdata;
13543 };
13544
13545 static void control_proxy_iface_init (ControlIface *iface);
13546
13547 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlProxy,control_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ControlProxy)G_IMPLEMENT_INTERFACE (TYPE_CONTROL,control_proxy_iface_init))13548 G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13549 G_ADD_PRIVATE (ControlProxy)
13550 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init))
13551
13552 #else
13553 G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13554 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init))
13555
13556 #endif
13557 static void
13558 control_proxy_finalize (GObject *object)
13559 {
13560 ControlProxy *proxy = CONTROL_PROXY (object);
13561 g_datalist_clear (&proxy->priv->qdata);
13562 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
13563 }
13564
13565 static void
control_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)13566 control_proxy_get_property (GObject *object,
13567 guint prop_id,
13568 GValue *value,
13569 GParamSpec *pspec G_GNUC_UNUSED)
13570 {
13571 const _ExtendedGDBusPropertyInfo *info;
13572 GVariant *variant;
13573 g_assert (prop_id != 0 && prop_id - 1 < 2);
13574 info = (const _ExtendedGDBusPropertyInfo *) _control_property_info_pointers[prop_id - 1];
13575 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
13576 if (info->use_gvariant)
13577 {
13578 g_value_set_variant (value, variant);
13579 }
13580 else
13581 {
13582 if (variant != NULL)
13583 g_dbus_gvariant_to_gvalue (variant, value);
13584 }
13585 if (variant != NULL)
13586 g_variant_unref (variant);
13587 }
13588
13589 static void
control_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)13590 control_proxy_set_property_cb (GDBusProxy *proxy,
13591 GAsyncResult *res,
13592 gpointer user_data)
13593 {
13594 const _ExtendedGDBusPropertyInfo *info = user_data;
13595 GError *error;
13596 GVariant *_ret;
13597 error = NULL;
13598 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
13599 if (!_ret)
13600 {
13601 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
13602 info->parent_struct.name,
13603 error->message, g_quark_to_string (error->domain), error->code);
13604 g_error_free (error);
13605 }
13606 else
13607 {
13608 g_variant_unref (_ret);
13609 }
13610 }
13611
13612 static void
control_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)13613 control_proxy_set_property (GObject *object,
13614 guint prop_id,
13615 const GValue *value,
13616 GParamSpec *pspec G_GNUC_UNUSED)
13617 {
13618 const _ExtendedGDBusPropertyInfo *info;
13619 GVariant *variant;
13620 g_assert (prop_id != 0 && prop_id - 1 < 2);
13621 info = (const _ExtendedGDBusPropertyInfo *) _control_property_info_pointers[prop_id - 1];
13622 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
13623 g_dbus_proxy_call (G_DBUS_PROXY (object),
13624 "org.freedesktop.DBus.Properties.Set",
13625 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
13626 G_DBUS_CALL_FLAGS_NONE,
13627 -1,
13628 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
13629 g_variant_unref (variant);
13630 }
13631
13632 static void
control_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)13633 control_proxy_g_signal (GDBusProxy *proxy,
13634 const gchar *sender_name G_GNUC_UNUSED,
13635 const gchar *signal_name,
13636 GVariant *parameters)
13637 {
13638 _ExtendedGDBusSignalInfo *info;
13639 GVariantIter iter;
13640 GVariant *child;
13641 GValue *paramv;
13642 gsize num_params;
13643 gsize n;
13644 guint signal_id;
13645 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13646 if (info == NULL)
13647 return;
13648 num_params = g_variant_n_children (parameters);
13649 paramv = g_new0 (GValue, num_params + 1);
13650 g_value_init (¶mv[0], TYPE_CONTROL);
13651 g_value_set_object (¶mv[0], proxy);
13652 g_variant_iter_init (&iter, parameters);
13653 n = 1;
13654 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13655 {
13656 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13657 if (arg_info->use_gvariant)
13658 {
13659 g_value_init (¶mv[n], G_TYPE_VARIANT);
13660 g_value_set_variant (¶mv[n], child);
13661 n++;
13662 }
13663 else
13664 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
13665 g_variant_unref (child);
13666 }
13667 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13668 g_signal_emitv (paramv, signal_id, 0, NULL);
13669 for (n = 0; n < num_params + 1; n++)
13670 g_value_unset (¶mv[n]);
13671 g_free (paramv);
13672 }
13673
13674 static void
control_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)13675 control_proxy_g_properties_changed (GDBusProxy *_proxy,
13676 GVariant *changed_properties,
13677 const gchar *const *invalidated_properties)
13678 {
13679 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13680 guint n;
13681 const gchar *key;
13682 GVariantIter *iter;
13683 _ExtendedGDBusPropertyInfo *info;
13684 g_variant_get (changed_properties, "a{sv}", &iter);
13685 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13686 {
13687 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13688 g_datalist_remove_data (&proxy->priv->qdata, key);
13689 if (info != NULL)
13690 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13691 }
13692 g_variant_iter_free (iter);
13693 for (n = 0; invalidated_properties[n] != NULL; n++)
13694 {
13695 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13696 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13697 if (info != NULL)
13698 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13699 }
13700 }
13701
13702 static gint
control_proxy_get_poll_interval(Control * object)13703 control_proxy_get_poll_interval (Control *object)
13704 {
13705 ControlProxy *proxy = CONTROL_PROXY (object);
13706 GVariant *variant;
13707 gint value = 0;
13708 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13709 if (variant != NULL)
13710 {
13711 value = g_variant_get_int32 (variant);
13712 g_variant_unref (variant);
13713 }
13714 return value;
13715 }
13716
13717 static gint
control_proxy_get_heatbeat(Control * object)13718 control_proxy_get_heatbeat (Control *object)
13719 {
13720 ControlProxy *proxy = CONTROL_PROXY (object);
13721 GVariant *variant;
13722 gint value = 0;
13723 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13724 if (variant != NULL)
13725 {
13726 value = g_variant_get_int32 (variant);
13727 g_variant_unref (variant);
13728 }
13729 return value;
13730 }
13731
13732 static void
control_proxy_init(ControlProxy * proxy)13733 control_proxy_init (ControlProxy *proxy)
13734 {
13735 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13736 proxy->priv = control_proxy_get_instance_private (proxy);
13737 #else
13738 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13739 #endif
13740
13741 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13742 }
13743
13744 static void
control_proxy_class_init(ControlProxyClass * klass)13745 control_proxy_class_init (ControlProxyClass *klass)
13746 {
13747 GObjectClass *gobject_class;
13748 GDBusProxyClass *proxy_class;
13749
13750 gobject_class = G_OBJECT_CLASS (klass);
13751 gobject_class->finalize = control_proxy_finalize;
13752 gobject_class->get_property = control_proxy_get_property;
13753 gobject_class->set_property = control_proxy_set_property;
13754
13755 proxy_class = G_DBUS_PROXY_CLASS (klass);
13756 proxy_class->g_signal = control_proxy_g_signal;
13757 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13758
13759 control_override_properties (gobject_class, 1);
13760
13761 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13762 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13763 #endif
13764 }
13765
13766 static void
control_proxy_iface_init(ControlIface * iface)13767 control_proxy_iface_init (ControlIface *iface)
13768 {
13769 iface->get_poll_interval = control_proxy_get_poll_interval;
13770 iface->get_heatbeat = control_proxy_get_heatbeat;
13771 }
13772
13773 /**
13774 * control_proxy_new:
13775 * @connection: A #GDBusConnection.
13776 * @flags: Flags from the #GDBusProxyFlags enumeration.
13777 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13778 * @object_path: An object path.
13779 * @cancellable: (nullable): A #GCancellable or %NULL.
13780 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13781 * @user_data: User data to pass to @callback.
13782 *
13783 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new() for more details.
13784 *
13785 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
13786 * You can then call control_proxy_new_finish() to get the result of the operation.
13787 *
13788 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13789 */
13790 void
control_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)13791 control_proxy_new (
13792 GDBusConnection *connection,
13793 GDBusProxyFlags flags,
13794 const gchar *name,
13795 const gchar *object_path,
13796 GCancellable *cancellable,
13797 GAsyncReadyCallback callback,
13798 gpointer user_data)
13799 {
13800 g_async_initable_new_async (TYPE_CONTROL_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.Control", NULL);
13801 }
13802
13803 /**
13804 * control_proxy_new_finish:
13805 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13806 * @error: Return location for error or %NULL
13807 *
13808 * Finishes an operation started with control_proxy_new().
13809 *
13810 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13811 */
13812 Control *
control_proxy_new_finish(GAsyncResult * res,GError ** error)13813 control_proxy_new_finish (
13814 GAsyncResult *res,
13815 GError **error)
13816 {
13817 GObject *ret;
13818 GObject *source_object;
13819 source_object = g_async_result_get_source_object (res);
13820 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13821 g_object_unref (source_object);
13822 if (ret != NULL)
13823 return CONTROL (ret);
13824 else
13825 return NULL;
13826 }
13827
13828 /**
13829 * control_proxy_new_sync:
13830 * @connection: A #GDBusConnection.
13831 * @flags: Flags from the #GDBusProxyFlags enumeration.
13832 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13833 * @object_path: An object path.
13834 * @cancellable: (nullable): A #GCancellable or %NULL.
13835 * @error: Return location for error or %NULL
13836 *
13837 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new_sync() for more details.
13838 *
13839 * The calling thread is blocked until a reply is received.
13840 *
13841 * See control_proxy_new() for the asynchronous version of this constructor.
13842 *
13843 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13844 */
13845 Control *
control_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)13846 control_proxy_new_sync (
13847 GDBusConnection *connection,
13848 GDBusProxyFlags flags,
13849 const gchar *name,
13850 const gchar *object_path,
13851 GCancellable *cancellable,
13852 GError **error)
13853 {
13854 GInitable *ret;
13855 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
13856 if (ret != NULL)
13857 return CONTROL (ret);
13858 else
13859 return NULL;
13860 }
13861
13862
13863 /**
13864 * control_proxy_new_for_bus:
13865 * @bus_type: A #GBusType.
13866 * @flags: Flags from the #GDBusProxyFlags enumeration.
13867 * @name: A bus name (well-known or unique).
13868 * @object_path: An object path.
13869 * @cancellable: (nullable): A #GCancellable or %NULL.
13870 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13871 * @user_data: User data to pass to @callback.
13872 *
13873 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13874 *
13875 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
13876 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13877 *
13878 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13879 */
13880 void
control_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)13881 control_proxy_new_for_bus (
13882 GBusType bus_type,
13883 GDBusProxyFlags flags,
13884 const gchar *name,
13885 const gchar *object_path,
13886 GCancellable *cancellable,
13887 GAsyncReadyCallback callback,
13888 gpointer user_data)
13889 {
13890 g_async_initable_new_async (TYPE_CONTROL_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.Control", NULL);
13891 }
13892
13893 /**
13894 * control_proxy_new_for_bus_finish:
13895 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13896 * @error: Return location for error or %NULL
13897 *
13898 * Finishes an operation started with control_proxy_new_for_bus().
13899 *
13900 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13901 */
13902 Control *
control_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)13903 control_proxy_new_for_bus_finish (
13904 GAsyncResult *res,
13905 GError **error)
13906 {
13907 GObject *ret;
13908 GObject *source_object;
13909 source_object = g_async_result_get_source_object (res);
13910 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13911 g_object_unref (source_object);
13912 if (ret != NULL)
13913 return CONTROL (ret);
13914 else
13915 return NULL;
13916 }
13917
13918 /**
13919 * control_proxy_new_for_bus_sync:
13920 * @bus_type: A #GBusType.
13921 * @flags: Flags from the #GDBusProxyFlags enumeration.
13922 * @name: A bus name (well-known or unique).
13923 * @object_path: An object path.
13924 * @cancellable: (nullable): A #GCancellable or %NULL.
13925 * @error: Return location for error or %NULL
13926 *
13927 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13928 *
13929 * The calling thread is blocked until a reply is received.
13930 *
13931 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13932 *
13933 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13934 */
13935 Control *
control_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)13936 control_proxy_new_for_bus_sync (
13937 GBusType bus_type,
13938 GDBusProxyFlags flags,
13939 const gchar *name,
13940 const gchar *object_path,
13941 GCancellable *cancellable,
13942 GError **error)
13943 {
13944 GInitable *ret;
13945 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
13946 if (ret != NULL)
13947 return CONTROL (ret);
13948 else
13949 return NULL;
13950 }
13951
13952
13953 /* ------------------------------------------------------------------------ */
13954
13955 /**
13956 * ControlSkeleton:
13957 *
13958 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13959 */
13960
13961 /**
13962 * ControlSkeletonClass:
13963 * @parent_class: The parent class.
13964 *
13965 * Class structure for #ControlSkeleton.
13966 */
13967
13968 struct _ControlSkeletonPrivate
13969 {
13970 GValue *properties;
13971 GList *changed_properties;
13972 GSource *changed_properties_idle_source;
13973 GMainContext *context;
13974 GMutex lock;
13975 };
13976
13977 static void
_control_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)13978 _control_skeleton_handle_method_call (
13979 GDBusConnection *connection G_GNUC_UNUSED,
13980 const gchar *sender G_GNUC_UNUSED,
13981 const gchar *object_path G_GNUC_UNUSED,
13982 const gchar *interface_name,
13983 const gchar *method_name,
13984 GVariant *parameters,
13985 GDBusMethodInvocation *invocation,
13986 gpointer user_data)
13987 {
13988 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13989 _ExtendedGDBusMethodInfo *info;
13990 GVariantIter iter;
13991 GVariant *child;
13992 GValue *paramv;
13993 gsize num_params;
13994 guint num_extra;
13995 gsize n;
13996 guint signal_id;
13997 GValue return_value = G_VALUE_INIT;
13998 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13999 g_assert (info != NULL);
14000 num_params = g_variant_n_children (parameters);
14001 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14002 n = 0;
14003 g_value_init (¶mv[n], TYPE_CONTROL);
14004 g_value_set_object (¶mv[n++], skeleton);
14005 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14006 g_value_set_object (¶mv[n++], invocation);
14007 if (info->pass_fdlist)
14008 {
14009 #ifdef G_OS_UNIX
14010 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
14011 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14012 #else
14013 g_assert_not_reached ();
14014 #endif
14015 }
14016 g_variant_iter_init (&iter, parameters);
14017 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14018 {
14019 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14020 if (arg_info->use_gvariant)
14021 {
14022 g_value_init (¶mv[n], G_TYPE_VARIANT);
14023 g_value_set_variant (¶mv[n], child);
14024 n++;
14025 }
14026 else
14027 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
14028 g_variant_unref (child);
14029 }
14030 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
14031 g_value_init (&return_value, G_TYPE_BOOLEAN);
14032 g_signal_emitv (paramv, signal_id, 0, &return_value);
14033 if (!g_value_get_boolean (&return_value))
14034 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);
14035 g_value_unset (&return_value);
14036 for (n = 0; n < num_params + num_extra; n++)
14037 g_value_unset (¶mv[n]);
14038 g_free (paramv);
14039 }
14040
14041 static GVariant *
_control_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)14042 _control_skeleton_handle_get_property (
14043 GDBusConnection *connection G_GNUC_UNUSED,
14044 const gchar *sender G_GNUC_UNUSED,
14045 const gchar *object_path G_GNUC_UNUSED,
14046 const gchar *interface_name G_GNUC_UNUSED,
14047 const gchar *property_name,
14048 GError **error,
14049 gpointer user_data)
14050 {
14051 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14052 GValue value = G_VALUE_INIT;
14053 GParamSpec *pspec;
14054 _ExtendedGDBusPropertyInfo *info;
14055 GVariant *ret;
14056 ret = NULL;
14057 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
14058 g_assert (info != NULL);
14059 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14060 if (pspec == NULL)
14061 {
14062 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14063 }
14064 else
14065 {
14066 g_value_init (&value, pspec->value_type);
14067 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14068 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14069 g_value_unset (&value);
14070 }
14071 return ret;
14072 }
14073
14074 static gboolean
_control_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)14075 _control_skeleton_handle_set_property (
14076 GDBusConnection *connection G_GNUC_UNUSED,
14077 const gchar *sender G_GNUC_UNUSED,
14078 const gchar *object_path G_GNUC_UNUSED,
14079 const gchar *interface_name G_GNUC_UNUSED,
14080 const gchar *property_name,
14081 GVariant *variant,
14082 GError **error,
14083 gpointer user_data)
14084 {
14085 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14086 GValue value = G_VALUE_INIT;
14087 GParamSpec *pspec;
14088 _ExtendedGDBusPropertyInfo *info;
14089 gboolean ret;
14090 ret = FALSE;
14091 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
14092 g_assert (info != NULL);
14093 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14094 if (pspec == NULL)
14095 {
14096 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14097 }
14098 else
14099 {
14100 if (info->use_gvariant)
14101 g_value_set_variant (&value, variant);
14102 else
14103 g_dbus_gvariant_to_gvalue (variant, &value);
14104 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14105 g_value_unset (&value);
14106 ret = TRUE;
14107 }
14108 return ret;
14109 }
14110
14111 static const GDBusInterfaceVTable _control_skeleton_vtable =
14112 {
14113 _control_skeleton_handle_method_call,
14114 _control_skeleton_handle_get_property,
14115 _control_skeleton_handle_set_property,
14116 {NULL}
14117 };
14118
14119 static GDBusInterfaceInfo *
control_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)14120 control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14121 {
14122 return control_interface_info ();
14123 }
14124
14125 static GDBusInterfaceVTable *
control_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)14126 control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14127 {
14128 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
14129 }
14130
14131 static GVariant *
control_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)14132 control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14133 {
14134 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14135
14136 GVariantBuilder builder;
14137 guint n;
14138 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14139 if (_control_interface_info.parent_struct.properties == NULL)
14140 goto out;
14141 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
14142 {
14143 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
14144 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14145 {
14146 GVariant *value;
14147 value = _control_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.Control", info->name, NULL, skeleton);
14148 if (value != NULL)
14149 {
14150 g_variant_take_ref (value);
14151 g_variant_builder_add (&builder, "{sv}", info->name, value);
14152 g_variant_unref (value);
14153 }
14154 }
14155 }
14156 out:
14157 return g_variant_builder_end (&builder);
14158 }
14159
14160 static gboolean _control_emit_changed (gpointer user_data);
14161
14162 static void
control_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)14163 control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14164 {
14165 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14166 gboolean emit_changed = FALSE;
14167
14168 g_mutex_lock (&skeleton->priv->lock);
14169 if (skeleton->priv->changed_properties_idle_source != NULL)
14170 {
14171 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14172 skeleton->priv->changed_properties_idle_source = NULL;
14173 emit_changed = TRUE;
14174 }
14175 g_mutex_unlock (&skeleton->priv->lock);
14176
14177 if (emit_changed)
14178 _control_emit_changed (skeleton);
14179 }
14180
14181 static void
_control_on_signal_heartbeat(Control * object,const gchar * arg_bus_name)14182 _control_on_signal_heartbeat (
14183 Control *object,
14184 const gchar *arg_bus_name)
14185 {
14186 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14187
14188 GList *connections, *l;
14189 GVariant *signal_variant;
14190 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14191
14192 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14193 arg_bus_name));
14194 for (l = connections; l != NULL; l = l->next)
14195 {
14196 GDBusConnection *connection = l->data;
14197 g_dbus_connection_emit_signal (connection,
14198 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
14199 signal_variant, NULL);
14200 }
14201 g_variant_unref (signal_variant);
14202 g_list_free_full (connections, g_object_unref);
14203 }
14204
14205 static void
_control_on_signal_started(Control * object)14206 _control_on_signal_started (
14207 Control *object)
14208 {
14209 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14210
14211 GList *connections, *l;
14212 GVariant *signal_variant;
14213 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14214
14215 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14216 for (l = connections; l != NULL; l = l->next)
14217 {
14218 GDBusConnection *connection = l->data;
14219 g_dbus_connection_emit_signal (connection,
14220 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
14221 signal_variant, NULL);
14222 }
14223 g_variant_unref (signal_variant);
14224 g_list_free_full (connections, g_object_unref);
14225 }
14226
14227 static void control_skeleton_iface_init (ControlIface *iface);
14228 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlSkeleton,control_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ControlSkeleton)G_IMPLEMENT_INTERFACE (TYPE_CONTROL,control_skeleton_iface_init))14229 G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14230 G_ADD_PRIVATE (ControlSkeleton)
14231 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init))
14232
14233 #else
14234 G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14235 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init))
14236
14237 #endif
14238 static void
14239 control_skeleton_finalize (GObject *object)
14240 {
14241 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14242 guint n;
14243 for (n = 0; n < 2; n++)
14244 g_value_unset (&skeleton->priv->properties[n]);
14245 g_free (skeleton->priv->properties);
14246 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14247 if (skeleton->priv->changed_properties_idle_source != NULL)
14248 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14249 g_main_context_unref (skeleton->priv->context);
14250 g_mutex_clear (&skeleton->priv->lock);
14251 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
14252 }
14253
14254 static void
control_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)14255 control_skeleton_get_property (GObject *object,
14256 guint prop_id,
14257 GValue *value,
14258 GParamSpec *pspec G_GNUC_UNUSED)
14259 {
14260 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14261 g_assert (prop_id != 0 && prop_id - 1 < 2);
14262 g_mutex_lock (&skeleton->priv->lock);
14263 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
14264 g_mutex_unlock (&skeleton->priv->lock);
14265 }
14266
14267 static gboolean
_control_emit_changed(gpointer user_data)14268 _control_emit_changed (gpointer user_data)
14269 {
14270 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14271 GList *l;
14272 GVariantBuilder builder;
14273 GVariantBuilder invalidated_builder;
14274 guint num_changes;
14275
14276 g_mutex_lock (&skeleton->priv->lock);
14277 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14278 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
14279 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
14280 {
14281 ChangedProperty *cp = l->data;
14282 GVariant *variant;
14283 const GValue *cur_value;
14284
14285 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
14286 if (!_g_value_equal (cur_value, &cp->orig_value))
14287 {
14288 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
14289 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
14290 g_variant_unref (variant);
14291 num_changes++;
14292 }
14293 }
14294 if (num_changes > 0)
14295 {
14296 GList *connections, *ll;
14297 GVariant *signal_variant;
14298 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
14299 &builder, &invalidated_builder));
14300 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14301 for (ll = connections; ll != NULL; ll = ll->next)
14302 {
14303 GDBusConnection *connection = ll->data;
14304
14305 g_dbus_connection_emit_signal (connection,
14306 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
14307 "org.freedesktop.DBus.Properties",
14308 "PropertiesChanged",
14309 signal_variant,
14310 NULL);
14311 }
14312 g_variant_unref (signal_variant);
14313 g_list_free_full (connections, g_object_unref);
14314 }
14315 else
14316 {
14317 g_variant_builder_clear (&builder);
14318 g_variant_builder_clear (&invalidated_builder);
14319 }
14320 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14321 skeleton->priv->changed_properties = NULL;
14322 skeleton->priv->changed_properties_idle_source = NULL;
14323 g_mutex_unlock (&skeleton->priv->lock);
14324 return FALSE;
14325 }
14326
14327 static void
_control_schedule_emit_changed(ControlSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)14328 _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
14329 {
14330 ChangedProperty *cp;
14331 GList *l;
14332 cp = NULL;
14333 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
14334 {
14335 ChangedProperty *i_cp = l->data;
14336 if (i_cp->info == info)
14337 {
14338 cp = i_cp;
14339 break;
14340 }
14341 }
14342 if (cp == NULL)
14343 {
14344 cp = g_new0 (ChangedProperty, 1);
14345 cp->prop_id = prop_id;
14346 cp->info = info;
14347 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
14348 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
14349 g_value_copy (orig_value, &cp->orig_value);
14350 }
14351 }
14352
14353 static void
control_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)14354 control_skeleton_notify (GObject *object,
14355 GParamSpec *pspec G_GNUC_UNUSED)
14356 {
14357 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14358 g_mutex_lock (&skeleton->priv->lock);
14359 if (skeleton->priv->changed_properties != NULL &&
14360 skeleton->priv->changed_properties_idle_source == NULL)
14361 {
14362 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
14363 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
14364 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
14365 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed");
14366 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
14367 g_source_unref (skeleton->priv->changed_properties_idle_source);
14368 }
14369 g_mutex_unlock (&skeleton->priv->lock);
14370 }
14371
14372 static void
control_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)14373 control_skeleton_set_property (GObject *object,
14374 guint prop_id,
14375 const GValue *value,
14376 GParamSpec *pspec)
14377 {
14378 const _ExtendedGDBusPropertyInfo *info;
14379 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14380 g_assert (prop_id != 0 && prop_id - 1 < 2);
14381 info = (const _ExtendedGDBusPropertyInfo *) _control_property_info_pointers[prop_id - 1];
14382 g_mutex_lock (&skeleton->priv->lock);
14383 g_object_freeze_notify (object);
14384 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
14385 {
14386 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
14387 info->emits_changed_signal)
14388 _control_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
14389 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
14390 g_object_notify_by_pspec (object, pspec);
14391 }
14392 g_mutex_unlock (&skeleton->priv->lock);
14393 g_object_thaw_notify (object);
14394 }
14395
14396 static void
control_skeleton_init(ControlSkeleton * skeleton)14397 control_skeleton_init (ControlSkeleton *skeleton)
14398 {
14399 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14400 skeleton->priv = control_skeleton_get_instance_private (skeleton);
14401 #else
14402 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
14403 #endif
14404
14405 g_mutex_init (&skeleton->priv->lock);
14406 skeleton->priv->context = g_main_context_ref_thread_default ();
14407 skeleton->priv->properties = g_new0 (GValue, 2);
14408 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
14409 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
14410 }
14411
14412 static gint
control_skeleton_get_poll_interval(Control * object)14413 control_skeleton_get_poll_interval (Control *object)
14414 {
14415 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14416 gint value;
14417 g_mutex_lock (&skeleton->priv->lock);
14418 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
14419 g_mutex_unlock (&skeleton->priv->lock);
14420 return value;
14421 }
14422
14423 static gint
control_skeleton_get_heatbeat(Control * object)14424 control_skeleton_get_heatbeat (Control *object)
14425 {
14426 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14427 gint value;
14428 g_mutex_lock (&skeleton->priv->lock);
14429 value = g_marshal_value_peek_int (&(skeleton->priv->properties[1]));
14430 g_mutex_unlock (&skeleton->priv->lock);
14431 return value;
14432 }
14433
14434 static void
control_skeleton_class_init(ControlSkeletonClass * klass)14435 control_skeleton_class_init (ControlSkeletonClass *klass)
14436 {
14437 GObjectClass *gobject_class;
14438 GDBusInterfaceSkeletonClass *skeleton_class;
14439
14440 gobject_class = G_OBJECT_CLASS (klass);
14441 gobject_class->finalize = control_skeleton_finalize;
14442 gobject_class->get_property = control_skeleton_get_property;
14443 gobject_class->set_property = control_skeleton_set_property;
14444 gobject_class->notify = control_skeleton_notify;
14445
14446
14447 control_override_properties (gobject_class, 1);
14448
14449 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14450 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
14451 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
14452 skeleton_class->flush = control_skeleton_dbus_interface_flush;
14453 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
14454
14455 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14456 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
14457 #endif
14458 }
14459
14460 static void
control_skeleton_iface_init(ControlIface * iface)14461 control_skeleton_iface_init (ControlIface *iface)
14462 {
14463 iface->heartbeat = _control_on_signal_heartbeat;
14464 iface->started = _control_on_signal_started;
14465 iface->get_poll_interval = control_skeleton_get_poll_interval;
14466 iface->get_heatbeat = control_skeleton_get_heatbeat;
14467 }
14468
14469 /**
14470 * control_skeleton_new:
14471 *
14472 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
14473 *
14474 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
14475 */
14476 Control *
control_skeleton_new(void)14477 control_skeleton_new (void)
14478 {
14479 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
14480 }
14481
14482 /* ------------------------------------------------------------------------
14483 * Code for interface org.openbmc.control.Bmc
14484 * ------------------------------------------------------------------------
14485 */
14486
14487 /**
14488 * SECTION:ControlBmc
14489 * @title: ControlBmc
14490 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
14491 *
14492 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface in C.
14493 */
14494
14495 /* ---- Introspection data for org.openbmc.control.Bmc ---- */
14496
14497 static const _ExtendedGDBusMethodInfo _control_bmc_method_info_cold_reset =
14498 {
14499 {
14500 -1,
14501 (gchar *) "coldReset",
14502 NULL,
14503 NULL,
14504 NULL
14505 },
14506 "handle-cold-reset",
14507 FALSE
14508 };
14509
14510 static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset =
14511 {
14512 {
14513 -1,
14514 (gchar *) "warmReset",
14515 NULL,
14516 NULL,
14517 NULL
14518 },
14519 "handle-warm-reset",
14520 FALSE
14521 };
14522
14523 static const GDBusMethodInfo * const _control_bmc_method_info_pointers[] =
14524 {
14525 &_control_bmc_method_info_cold_reset.parent_struct,
14526 &_control_bmc_method_info_warm_reset.parent_struct,
14527 NULL
14528 };
14529
14530 static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
14531 {
14532 {
14533 -1,
14534 (gchar *) "org.openbmc.control.Bmc",
14535 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
14536 NULL,
14537 NULL,
14538 NULL
14539 },
14540 "control-bmc",
14541 };
14542
14543
14544 /**
14545 * control_bmc_interface_info:
14546 *
14547 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface.
14548 *
14549 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14550 */
14551 GDBusInterfaceInfo *
control_bmc_interface_info(void)14552 control_bmc_interface_info (void)
14553 {
14554 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
14555 }
14556
14557 /**
14558 * control_bmc_override_properties:
14559 * @klass: The class structure for a #GObject derived class.
14560 * @property_id_begin: The property id to assign to the first overridden property.
14561 *
14562 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
14563 * The properties are overridden in the order they are defined.
14564 *
14565 * Returns: The last property id.
14566 */
14567 guint
control_bmc_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)14568 control_bmc_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
14569 {
14570 return property_id_begin - 1;
14571 }
14572
14573
14574 inline static void
control_bmc_method_marshal_cold_reset(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)14575 control_bmc_method_marshal_cold_reset (
14576 GClosure *closure,
14577 GValue *return_value,
14578 unsigned int n_param_values,
14579 const GValue *param_values,
14580 void *invocation_hint,
14581 void *marshal_data)
14582 {
14583 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
14584 return_value, n_param_values, param_values, invocation_hint, marshal_data);
14585 }
14586
14587 inline static void
control_bmc_method_marshal_warm_reset(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)14588 control_bmc_method_marshal_warm_reset (
14589 GClosure *closure,
14590 GValue *return_value,
14591 unsigned int n_param_values,
14592 const GValue *param_values,
14593 void *invocation_hint,
14594 void *marshal_data)
14595 {
14596 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
14597 return_value, n_param_values, param_values, invocation_hint, marshal_data);
14598 }
14599
14600
14601 /**
14602 * ControlBmc:
14603 *
14604 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14605 */
14606
14607 /**
14608 * ControlBmcIface:
14609 * @parent_iface: The parent interface.
14610 * @handle_cold_reset: Handler for the #ControlBmc::handle-cold-reset signal.
14611 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal.
14612 *
14613 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14614 */
14615
14616 typedef ControlBmcIface ControlBmcInterface;
G_DEFINE_INTERFACE(ControlBmc,control_bmc,G_TYPE_OBJECT)14617 G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT)
14618
14619 static void
14620 control_bmc_default_init (ControlBmcIface *iface)
14621 {
14622 /* GObject signals for incoming D-Bus method calls: */
14623 /**
14624 * ControlBmc::handle-cold-reset:
14625 * @object: A #ControlBmc.
14626 * @invocation: A #GDBusMethodInvocation.
14627 *
14628 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method.
14629 *
14630 * 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 control_bmc_complete_cold_reset() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14631 *
14632 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
14633 */
14634 g_signal_new ("handle-cold-reset",
14635 G_TYPE_FROM_INTERFACE (iface),
14636 G_SIGNAL_RUN_LAST,
14637 G_STRUCT_OFFSET (ControlBmcIface, handle_cold_reset),
14638 g_signal_accumulator_true_handled,
14639 NULL,
14640 control_bmc_method_marshal_cold_reset,
14641 G_TYPE_BOOLEAN,
14642 1,
14643 G_TYPE_DBUS_METHOD_INVOCATION);
14644
14645 /**
14646 * ControlBmc::handle-warm-reset:
14647 * @object: A #ControlBmc.
14648 * @invocation: A #GDBusMethodInvocation.
14649 *
14650 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method.
14651 *
14652 * 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 control_bmc_complete_warm_reset() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14653 *
14654 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
14655 */
14656 g_signal_new ("handle-warm-reset",
14657 G_TYPE_FROM_INTERFACE (iface),
14658 G_SIGNAL_RUN_LAST,
14659 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset),
14660 g_signal_accumulator_true_handled,
14661 NULL,
14662 control_bmc_method_marshal_warm_reset,
14663 G_TYPE_BOOLEAN,
14664 1,
14665 G_TYPE_DBUS_METHOD_INVOCATION);
14666
14667 }
14668
14669 /**
14670 * control_bmc_call_cold_reset:
14671 * @proxy: A #ControlBmcProxy.
14672 * @cancellable: (nullable): A #GCancellable or %NULL.
14673 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14674 * @user_data: User data to pass to @callback.
14675 *
14676 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy.
14677 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
14678 * You can then call control_bmc_call_cold_reset_finish() to get the result of the operation.
14679 *
14680 * See control_bmc_call_cold_reset_sync() for the synchronous, blocking version of this method.
14681 */
14682 void
control_bmc_call_cold_reset(ControlBmc * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)14683 control_bmc_call_cold_reset (
14684 ControlBmc *proxy,
14685 GCancellable *cancellable,
14686 GAsyncReadyCallback callback,
14687 gpointer user_data)
14688 {
14689 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14690 "coldReset",
14691 g_variant_new ("()"),
14692 G_DBUS_CALL_FLAGS_NONE,
14693 -1,
14694 cancellable,
14695 callback,
14696 user_data);
14697 }
14698
14699 /**
14700 * control_bmc_call_cold_reset_finish:
14701 * @proxy: A #ControlBmcProxy.
14702 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_cold_reset().
14703 * @error: Return location for error or %NULL.
14704 *
14705 * Finishes an operation started with control_bmc_call_cold_reset().
14706 *
14707 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
14708 */
14709 gboolean
control_bmc_call_cold_reset_finish(ControlBmc * proxy,GAsyncResult * res,GError ** error)14710 control_bmc_call_cold_reset_finish (
14711 ControlBmc *proxy,
14712 GAsyncResult *res,
14713 GError **error)
14714 {
14715 GVariant *_ret;
14716 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14717 if (_ret == NULL)
14718 goto _out;
14719 g_variant_get (_ret,
14720 "()");
14721 g_variant_unref (_ret);
14722 _out:
14723 return _ret != NULL;
14724 }
14725
14726 /**
14727 * control_bmc_call_cold_reset_sync:
14728 * @proxy: A #ControlBmcProxy.
14729 * @cancellable: (nullable): A #GCancellable or %NULL.
14730 * @error: Return location for error or %NULL.
14731 *
14732 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14733 *
14734 * See control_bmc_call_cold_reset() for the asynchronous version of this method.
14735 *
14736 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
14737 */
14738 gboolean
control_bmc_call_cold_reset_sync(ControlBmc * proxy,GCancellable * cancellable,GError ** error)14739 control_bmc_call_cold_reset_sync (
14740 ControlBmc *proxy,
14741 GCancellable *cancellable,
14742 GError **error)
14743 {
14744 GVariant *_ret;
14745 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14746 "coldReset",
14747 g_variant_new ("()"),
14748 G_DBUS_CALL_FLAGS_NONE,
14749 -1,
14750 cancellable,
14751 error);
14752 if (_ret == NULL)
14753 goto _out;
14754 g_variant_get (_ret,
14755 "()");
14756 g_variant_unref (_ret);
14757 _out:
14758 return _ret != NULL;
14759 }
14760
14761 /**
14762 * control_bmc_call_warm_reset:
14763 * @proxy: A #ControlBmcProxy.
14764 * @cancellable: (nullable): A #GCancellable or %NULL.
14765 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14766 * @user_data: User data to pass to @callback.
14767 *
14768 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy.
14769 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
14770 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation.
14771 *
14772 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method.
14773 */
14774 void
control_bmc_call_warm_reset(ControlBmc * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)14775 control_bmc_call_warm_reset (
14776 ControlBmc *proxy,
14777 GCancellable *cancellable,
14778 GAsyncReadyCallback callback,
14779 gpointer user_data)
14780 {
14781 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14782 "warmReset",
14783 g_variant_new ("()"),
14784 G_DBUS_CALL_FLAGS_NONE,
14785 -1,
14786 cancellable,
14787 callback,
14788 user_data);
14789 }
14790
14791 /**
14792 * control_bmc_call_warm_reset_finish:
14793 * @proxy: A #ControlBmcProxy.
14794 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset().
14795 * @error: Return location for error or %NULL.
14796 *
14797 * Finishes an operation started with control_bmc_call_warm_reset().
14798 *
14799 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
14800 */
14801 gboolean
control_bmc_call_warm_reset_finish(ControlBmc * proxy,GAsyncResult * res,GError ** error)14802 control_bmc_call_warm_reset_finish (
14803 ControlBmc *proxy,
14804 GAsyncResult *res,
14805 GError **error)
14806 {
14807 GVariant *_ret;
14808 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14809 if (_ret == NULL)
14810 goto _out;
14811 g_variant_get (_ret,
14812 "()");
14813 g_variant_unref (_ret);
14814 _out:
14815 return _ret != NULL;
14816 }
14817
14818 /**
14819 * control_bmc_call_warm_reset_sync:
14820 * @proxy: A #ControlBmcProxy.
14821 * @cancellable: (nullable): A #GCancellable or %NULL.
14822 * @error: Return location for error or %NULL.
14823 *
14824 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14825 *
14826 * See control_bmc_call_warm_reset() for the asynchronous version of this method.
14827 *
14828 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
14829 */
14830 gboolean
control_bmc_call_warm_reset_sync(ControlBmc * proxy,GCancellable * cancellable,GError ** error)14831 control_bmc_call_warm_reset_sync (
14832 ControlBmc *proxy,
14833 GCancellable *cancellable,
14834 GError **error)
14835 {
14836 GVariant *_ret;
14837 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14838 "warmReset",
14839 g_variant_new ("()"),
14840 G_DBUS_CALL_FLAGS_NONE,
14841 -1,
14842 cancellable,
14843 error);
14844 if (_ret == NULL)
14845 goto _out;
14846 g_variant_get (_ret,
14847 "()");
14848 g_variant_unref (_ret);
14849 _out:
14850 return _ret != NULL;
14851 }
14852
14853 /**
14854 * control_bmc_complete_cold_reset:
14855 * @object: A #ControlBmc.
14856 * @invocation: (transfer full): A #GDBusMethodInvocation.
14857 *
14858 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</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.
14859 *
14860 * This method will free @invocation, you cannot use it afterwards.
14861 */
14862 void
control_bmc_complete_cold_reset(ControlBmc * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)14863 control_bmc_complete_cold_reset (
14864 ControlBmc *object G_GNUC_UNUSED,
14865 GDBusMethodInvocation *invocation)
14866 {
14867 g_dbus_method_invocation_return_value (invocation,
14868 g_variant_new ("()"));
14869 }
14870
14871 /**
14872 * control_bmc_complete_warm_reset:
14873 * @object: A #ControlBmc.
14874 * @invocation: (transfer full): A #GDBusMethodInvocation.
14875 *
14876 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</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.
14877 *
14878 * This method will free @invocation, you cannot use it afterwards.
14879 */
14880 void
control_bmc_complete_warm_reset(ControlBmc * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)14881 control_bmc_complete_warm_reset (
14882 ControlBmc *object G_GNUC_UNUSED,
14883 GDBusMethodInvocation *invocation)
14884 {
14885 g_dbus_method_invocation_return_value (invocation,
14886 g_variant_new ("()"));
14887 }
14888
14889 /* ------------------------------------------------------------------------ */
14890
14891 /**
14892 * ControlBmcProxy:
14893 *
14894 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14895 */
14896
14897 /**
14898 * ControlBmcProxyClass:
14899 * @parent_class: The parent class.
14900 *
14901 * Class structure for #ControlBmcProxy.
14902 */
14903
14904 struct _ControlBmcProxyPrivate
14905 {
14906 GData *qdata;
14907 };
14908
14909 static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14910
14911 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlBmcProxy,control_bmc_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ControlBmcProxy)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC,control_bmc_proxy_iface_init))14912 G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14913 G_ADD_PRIVATE (ControlBmcProxy)
14914 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init))
14915
14916 #else
14917 G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14918 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init))
14919
14920 #endif
14921 static void
14922 control_bmc_proxy_finalize (GObject *object)
14923 {
14924 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14925 g_datalist_clear (&proxy->priv->qdata);
14926 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14927 }
14928
14929 static void
control_bmc_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)14930 control_bmc_proxy_get_property (GObject *object G_GNUC_UNUSED,
14931 guint prop_id G_GNUC_UNUSED,
14932 GValue *value G_GNUC_UNUSED,
14933 GParamSpec *pspec G_GNUC_UNUSED)
14934 {
14935 }
14936
14937 static void
control_bmc_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)14938 control_bmc_proxy_set_property (GObject *object G_GNUC_UNUSED,
14939 guint prop_id G_GNUC_UNUSED,
14940 const GValue *value G_GNUC_UNUSED,
14941 GParamSpec *pspec G_GNUC_UNUSED)
14942 {
14943 }
14944
14945 static void
control_bmc_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)14946 control_bmc_proxy_g_signal (GDBusProxy *proxy,
14947 const gchar *sender_name G_GNUC_UNUSED,
14948 const gchar *signal_name,
14949 GVariant *parameters)
14950 {
14951 _ExtendedGDBusSignalInfo *info;
14952 GVariantIter iter;
14953 GVariant *child;
14954 GValue *paramv;
14955 gsize num_params;
14956 gsize n;
14957 guint signal_id;
14958 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14959 if (info == NULL)
14960 return;
14961 num_params = g_variant_n_children (parameters);
14962 paramv = g_new0 (GValue, num_params + 1);
14963 g_value_init (¶mv[0], TYPE_CONTROL_BMC);
14964 g_value_set_object (¶mv[0], proxy);
14965 g_variant_iter_init (&iter, parameters);
14966 n = 1;
14967 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14968 {
14969 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14970 if (arg_info->use_gvariant)
14971 {
14972 g_value_init (¶mv[n], G_TYPE_VARIANT);
14973 g_value_set_variant (¶mv[n], child);
14974 n++;
14975 }
14976 else
14977 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
14978 g_variant_unref (child);
14979 }
14980 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14981 g_signal_emitv (paramv, signal_id, 0, NULL);
14982 for (n = 0; n < num_params + 1; n++)
14983 g_value_unset (¶mv[n]);
14984 g_free (paramv);
14985 }
14986
14987 static void
control_bmc_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)14988 control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14989 GVariant *changed_properties,
14990 const gchar *const *invalidated_properties)
14991 {
14992 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14993 guint n;
14994 const gchar *key;
14995 GVariantIter *iter;
14996 _ExtendedGDBusPropertyInfo *info;
14997 g_variant_get (changed_properties, "a{sv}", &iter);
14998 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14999 {
15000 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
15001 g_datalist_remove_data (&proxy->priv->qdata, key);
15002 if (info != NULL)
15003 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15004 }
15005 g_variant_iter_free (iter);
15006 for (n = 0; invalidated_properties[n] != NULL; n++)
15007 {
15008 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
15009 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15010 if (info != NULL)
15011 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15012 }
15013 }
15014
15015 static void
control_bmc_proxy_init(ControlBmcProxy * proxy)15016 control_bmc_proxy_init (ControlBmcProxy *proxy)
15017 {
15018 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15019 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
15020 #else
15021 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
15022 #endif
15023
15024 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
15025 }
15026
15027 static void
control_bmc_proxy_class_init(ControlBmcProxyClass * klass)15028 control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
15029 {
15030 GObjectClass *gobject_class;
15031 GDBusProxyClass *proxy_class;
15032
15033 gobject_class = G_OBJECT_CLASS (klass);
15034 gobject_class->finalize = control_bmc_proxy_finalize;
15035 gobject_class->get_property = control_bmc_proxy_get_property;
15036 gobject_class->set_property = control_bmc_proxy_set_property;
15037
15038 proxy_class = G_DBUS_PROXY_CLASS (klass);
15039 proxy_class->g_signal = control_bmc_proxy_g_signal;
15040 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
15041
15042 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15043 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
15044 #endif
15045 }
15046
15047 static void
control_bmc_proxy_iface_init(ControlBmcIface * iface G_GNUC_UNUSED)15048 control_bmc_proxy_iface_init (ControlBmcIface *iface G_GNUC_UNUSED)
15049 {
15050 }
15051
15052 /**
15053 * control_bmc_proxy_new:
15054 * @connection: A #GDBusConnection.
15055 * @flags: Flags from the #GDBusProxyFlags enumeration.
15056 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15057 * @object_path: An object path.
15058 * @cancellable: (nullable): A #GCancellable or %NULL.
15059 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15060 * @user_data: User data to pass to @callback.
15061 *
15062 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new() for more details.
15063 *
15064 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
15065 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
15066 *
15067 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
15068 */
15069 void
control_bmc_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)15070 control_bmc_proxy_new (
15071 GDBusConnection *connection,
15072 GDBusProxyFlags flags,
15073 const gchar *name,
15074 const gchar *object_path,
15075 GCancellable *cancellable,
15076 GAsyncReadyCallback callback,
15077 gpointer user_data)
15078 {
15079 g_async_initable_new_async (TYPE_CONTROL_BMC_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.control.Bmc", NULL);
15080 }
15081
15082 /**
15083 * control_bmc_proxy_new_finish:
15084 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
15085 * @error: Return location for error or %NULL
15086 *
15087 * Finishes an operation started with control_bmc_proxy_new().
15088 *
15089 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
15090 */
15091 ControlBmc *
control_bmc_proxy_new_finish(GAsyncResult * res,GError ** error)15092 control_bmc_proxy_new_finish (
15093 GAsyncResult *res,
15094 GError **error)
15095 {
15096 GObject *ret;
15097 GObject *source_object;
15098 source_object = g_async_result_get_source_object (res);
15099 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15100 g_object_unref (source_object);
15101 if (ret != NULL)
15102 return CONTROL_BMC (ret);
15103 else
15104 return NULL;
15105 }
15106
15107 /**
15108 * control_bmc_proxy_new_sync:
15109 * @connection: A #GDBusConnection.
15110 * @flags: Flags from the #GDBusProxyFlags enumeration.
15111 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15112 * @object_path: An object path.
15113 * @cancellable: (nullable): A #GCancellable or %NULL.
15114 * @error: Return location for error or %NULL
15115 *
15116 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new_sync() for more details.
15117 *
15118 * The calling thread is blocked until a reply is received.
15119 *
15120 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
15121 *
15122 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
15123 */
15124 ControlBmc *
control_bmc_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)15125 control_bmc_proxy_new_sync (
15126 GDBusConnection *connection,
15127 GDBusProxyFlags flags,
15128 const gchar *name,
15129 const gchar *object_path,
15130 GCancellable *cancellable,
15131 GError **error)
15132 {
15133 GInitable *ret;
15134 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
15135 if (ret != NULL)
15136 return CONTROL_BMC (ret);
15137 else
15138 return NULL;
15139 }
15140
15141
15142 /**
15143 * control_bmc_proxy_new_for_bus:
15144 * @bus_type: A #GBusType.
15145 * @flags: Flags from the #GDBusProxyFlags enumeration.
15146 * @name: A bus name (well-known or unique).
15147 * @object_path: An object path.
15148 * @cancellable: (nullable): A #GCancellable or %NULL.
15149 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15150 * @user_data: User data to pass to @callback.
15151 *
15152 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15153 *
15154 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
15155 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
15156 *
15157 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15158 */
15159 void
control_bmc_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)15160 control_bmc_proxy_new_for_bus (
15161 GBusType bus_type,
15162 GDBusProxyFlags flags,
15163 const gchar *name,
15164 const gchar *object_path,
15165 GCancellable *cancellable,
15166 GAsyncReadyCallback callback,
15167 gpointer user_data)
15168 {
15169 g_async_initable_new_async (TYPE_CONTROL_BMC_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.control.Bmc", NULL);
15170 }
15171
15172 /**
15173 * control_bmc_proxy_new_for_bus_finish:
15174 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
15175 * @error: Return location for error or %NULL
15176 *
15177 * Finishes an operation started with control_bmc_proxy_new_for_bus().
15178 *
15179 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
15180 */
15181 ControlBmc *
control_bmc_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)15182 control_bmc_proxy_new_for_bus_finish (
15183 GAsyncResult *res,
15184 GError **error)
15185 {
15186 GObject *ret;
15187 GObject *source_object;
15188 source_object = g_async_result_get_source_object (res);
15189 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15190 g_object_unref (source_object);
15191 if (ret != NULL)
15192 return CONTROL_BMC (ret);
15193 else
15194 return NULL;
15195 }
15196
15197 /**
15198 * control_bmc_proxy_new_for_bus_sync:
15199 * @bus_type: A #GBusType.
15200 * @flags: Flags from the #GDBusProxyFlags enumeration.
15201 * @name: A bus name (well-known or unique).
15202 * @object_path: An object path.
15203 * @cancellable: (nullable): A #GCancellable or %NULL.
15204 * @error: Return location for error or %NULL
15205 *
15206 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15207 *
15208 * The calling thread is blocked until a reply is received.
15209 *
15210 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
15211 *
15212 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
15213 */
15214 ControlBmc *
control_bmc_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)15215 control_bmc_proxy_new_for_bus_sync (
15216 GBusType bus_type,
15217 GDBusProxyFlags flags,
15218 const gchar *name,
15219 const gchar *object_path,
15220 GCancellable *cancellable,
15221 GError **error)
15222 {
15223 GInitable *ret;
15224 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
15225 if (ret != NULL)
15226 return CONTROL_BMC (ret);
15227 else
15228 return NULL;
15229 }
15230
15231
15232 /* ------------------------------------------------------------------------ */
15233
15234 /**
15235 * ControlBmcSkeleton:
15236 *
15237 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
15238 */
15239
15240 /**
15241 * ControlBmcSkeletonClass:
15242 * @parent_class: The parent class.
15243 *
15244 * Class structure for #ControlBmcSkeleton.
15245 */
15246
15247 struct _ControlBmcSkeletonPrivate
15248 {
15249 GValue *properties;
15250 GList *changed_properties;
15251 GSource *changed_properties_idle_source;
15252 GMainContext *context;
15253 GMutex lock;
15254 };
15255
15256 static void
_control_bmc_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)15257 _control_bmc_skeleton_handle_method_call (
15258 GDBusConnection *connection G_GNUC_UNUSED,
15259 const gchar *sender G_GNUC_UNUSED,
15260 const gchar *object_path G_GNUC_UNUSED,
15261 const gchar *interface_name,
15262 const gchar *method_name,
15263 GVariant *parameters,
15264 GDBusMethodInvocation *invocation,
15265 gpointer user_data)
15266 {
15267 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15268 _ExtendedGDBusMethodInfo *info;
15269 GVariantIter iter;
15270 GVariant *child;
15271 GValue *paramv;
15272 gsize num_params;
15273 guint num_extra;
15274 gsize n;
15275 guint signal_id;
15276 GValue return_value = G_VALUE_INIT;
15277 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15278 g_assert (info != NULL);
15279 num_params = g_variant_n_children (parameters);
15280 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15281 n = 0;
15282 g_value_init (¶mv[n], TYPE_CONTROL_BMC);
15283 g_value_set_object (¶mv[n++], skeleton);
15284 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15285 g_value_set_object (¶mv[n++], invocation);
15286 if (info->pass_fdlist)
15287 {
15288 #ifdef G_OS_UNIX
15289 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
15290 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15291 #else
15292 g_assert_not_reached ();
15293 #endif
15294 }
15295 g_variant_iter_init (&iter, parameters);
15296 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15297 {
15298 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15299 if (arg_info->use_gvariant)
15300 {
15301 g_value_init (¶mv[n], G_TYPE_VARIANT);
15302 g_value_set_variant (¶mv[n], child);
15303 n++;
15304 }
15305 else
15306 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
15307 g_variant_unref (child);
15308 }
15309 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
15310 g_value_init (&return_value, G_TYPE_BOOLEAN);
15311 g_signal_emitv (paramv, signal_id, 0, &return_value);
15312 if (!g_value_get_boolean (&return_value))
15313 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);
15314 g_value_unset (&return_value);
15315 for (n = 0; n < num_params + num_extra; n++)
15316 g_value_unset (¶mv[n]);
15317 g_free (paramv);
15318 }
15319
15320 static GVariant *
_control_bmc_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)15321 _control_bmc_skeleton_handle_get_property (
15322 GDBusConnection *connection G_GNUC_UNUSED,
15323 const gchar *sender G_GNUC_UNUSED,
15324 const gchar *object_path G_GNUC_UNUSED,
15325 const gchar *interface_name G_GNUC_UNUSED,
15326 const gchar *property_name,
15327 GError **error,
15328 gpointer user_data)
15329 {
15330 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15331 GValue value = G_VALUE_INIT;
15332 GParamSpec *pspec;
15333 _ExtendedGDBusPropertyInfo *info;
15334 GVariant *ret;
15335 ret = NULL;
15336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15337 g_assert (info != NULL);
15338 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15339 if (pspec == NULL)
15340 {
15341 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15342 }
15343 else
15344 {
15345 g_value_init (&value, pspec->value_type);
15346 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15347 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15348 g_value_unset (&value);
15349 }
15350 return ret;
15351 }
15352
15353 static gboolean
_control_bmc_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)15354 _control_bmc_skeleton_handle_set_property (
15355 GDBusConnection *connection G_GNUC_UNUSED,
15356 const gchar *sender G_GNUC_UNUSED,
15357 const gchar *object_path G_GNUC_UNUSED,
15358 const gchar *interface_name G_GNUC_UNUSED,
15359 const gchar *property_name,
15360 GVariant *variant,
15361 GError **error,
15362 gpointer user_data)
15363 {
15364 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15365 GValue value = G_VALUE_INIT;
15366 GParamSpec *pspec;
15367 _ExtendedGDBusPropertyInfo *info;
15368 gboolean ret;
15369 ret = FALSE;
15370 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15371 g_assert (info != NULL);
15372 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15373 if (pspec == NULL)
15374 {
15375 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15376 }
15377 else
15378 {
15379 if (info->use_gvariant)
15380 g_value_set_variant (&value, variant);
15381 else
15382 g_dbus_gvariant_to_gvalue (variant, &value);
15383 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15384 g_value_unset (&value);
15385 ret = TRUE;
15386 }
15387 return ret;
15388 }
15389
15390 static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
15391 {
15392 _control_bmc_skeleton_handle_method_call,
15393 _control_bmc_skeleton_handle_get_property,
15394 _control_bmc_skeleton_handle_set_property,
15395 {NULL}
15396 };
15397
15398 static GDBusInterfaceInfo *
control_bmc_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)15399 control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15400 {
15401 return control_bmc_interface_info ();
15402 }
15403
15404 static GDBusInterfaceVTable *
control_bmc_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)15405 control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15406 {
15407 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
15408 }
15409
15410 static GVariant *
control_bmc_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)15411 control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15412 {
15413 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
15414
15415 GVariantBuilder builder;
15416 guint n;
15417 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15418 if (_control_bmc_interface_info.parent_struct.properties == NULL)
15419 goto out;
15420 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
15421 {
15422 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
15423 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15424 {
15425 GVariant *value;
15426 value = _control_bmc_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.control.Bmc", info->name, NULL, skeleton);
15427 if (value != NULL)
15428 {
15429 g_variant_take_ref (value);
15430 g_variant_builder_add (&builder, "{sv}", info->name, value);
15431 g_variant_unref (value);
15432 }
15433 }
15434 }
15435 out:
15436 return g_variant_builder_end (&builder);
15437 }
15438
15439 static void
control_bmc_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)15440 control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
15441 {
15442 }
15443
15444 static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
15445 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlBmcSkeleton,control_bmc_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ControlBmcSkeleton)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC,control_bmc_skeleton_iface_init))15446 G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15447 G_ADD_PRIVATE (ControlBmcSkeleton)
15448 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init))
15449
15450 #else
15451 G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15452 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init))
15453
15454 #endif
15455 static void
15456 control_bmc_skeleton_finalize (GObject *object)
15457 {
15458 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
15459 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15460 if (skeleton->priv->changed_properties_idle_source != NULL)
15461 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15462 g_main_context_unref (skeleton->priv->context);
15463 g_mutex_clear (&skeleton->priv->lock);
15464 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
15465 }
15466
15467 static void
control_bmc_skeleton_init(ControlBmcSkeleton * skeleton)15468 control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
15469 {
15470 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15471 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
15472 #else
15473 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
15474 #endif
15475
15476 g_mutex_init (&skeleton->priv->lock);
15477 skeleton->priv->context = g_main_context_ref_thread_default ();
15478 }
15479
15480 static void
control_bmc_skeleton_class_init(ControlBmcSkeletonClass * klass)15481 control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
15482 {
15483 GObjectClass *gobject_class;
15484 GDBusInterfaceSkeletonClass *skeleton_class;
15485
15486 gobject_class = G_OBJECT_CLASS (klass);
15487 gobject_class->finalize = control_bmc_skeleton_finalize;
15488
15489 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15490 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
15491 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
15492 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
15493 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
15494
15495 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15496 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
15497 #endif
15498 }
15499
15500 static void
control_bmc_skeleton_iface_init(ControlBmcIface * iface G_GNUC_UNUSED)15501 control_bmc_skeleton_iface_init (ControlBmcIface *iface G_GNUC_UNUSED)
15502 {
15503 }
15504
15505 /**
15506 * control_bmc_skeleton_new:
15507 *
15508 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
15509 *
15510 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
15511 */
15512 ControlBmc *
control_bmc_skeleton_new(void)15513 control_bmc_skeleton_new (void)
15514 {
15515 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
15516 }
15517
15518 /* ------------------------------------------------------------------------
15519 * Code for interface org.openbmc.control.Host
15520 * ------------------------------------------------------------------------
15521 */
15522
15523 /**
15524 * SECTION:ControlHost
15525 * @title: ControlHost
15526 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
15527 *
15528 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface in C.
15529 */
15530
15531 enum
15532 {
15533 _CONTROL_HOST_BOOTED,
15534 };
15535
15536 static unsigned _CONTROL_HOST_SIGNALS[1] = { 0 };
15537
15538 /* ---- Introspection data for org.openbmc.control.Host ---- */
15539
15540 static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
15541 {
15542 {
15543 -1,
15544 (gchar *) "boot",
15545 NULL,
15546 NULL,
15547 NULL
15548 },
15549 "handle-boot",
15550 FALSE
15551 };
15552
15553 static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
15554 {
15555 {
15556 -1,
15557 (gchar *) "shutdown",
15558 NULL,
15559 NULL,
15560 NULL
15561 },
15562 "handle-shutdown",
15563 FALSE
15564 };
15565
15566 static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
15567 {
15568 {
15569 -1,
15570 (gchar *) "reboot",
15571 NULL,
15572 NULL,
15573 NULL
15574 },
15575 "handle-reboot",
15576 FALSE
15577 };
15578
15579 static const GDBusMethodInfo * const _control_host_method_info_pointers[] =
15580 {
15581 &_control_host_method_info_boot.parent_struct,
15582 &_control_host_method_info_shutdown.parent_struct,
15583 &_control_host_method_info_reboot.parent_struct,
15584 NULL
15585 };
15586
15587 static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
15588 {
15589 {
15590 -1,
15591 (gchar *) "Booted",
15592 NULL,
15593 NULL
15594 },
15595 "booted"
15596 };
15597
15598 static const GDBusSignalInfo * const _control_host_signal_info_pointers[] =
15599 {
15600 &_control_host_signal_info_booted.parent_struct,
15601 NULL
15602 };
15603
15604 static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
15605 {
15606 {
15607 -1,
15608 (gchar *) "debug_mode",
15609 (gchar *) "i",
15610 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15611 NULL
15612 },
15613 "debug-mode",
15614 FALSE,
15615 TRUE
15616 };
15617
15618 static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
15619 {
15620 {
15621 -1,
15622 (gchar *) "flash_side",
15623 (gchar *) "s",
15624 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15625 NULL
15626 },
15627 "flash-side",
15628 FALSE,
15629 TRUE
15630 };
15631
15632 static const GDBusPropertyInfo * const _control_host_property_info_pointers[] =
15633 {
15634 &_control_host_property_info_debug_mode.parent_struct,
15635 &_control_host_property_info_flash_side.parent_struct,
15636 NULL
15637 };
15638
15639 static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
15640 {
15641 {
15642 -1,
15643 (gchar *) "org.openbmc.control.Host",
15644 (GDBusMethodInfo **) &_control_host_method_info_pointers,
15645 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
15646 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
15647 NULL
15648 },
15649 "control-host",
15650 };
15651
15652
15653 /**
15654 * control_host_interface_info:
15655 *
15656 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface.
15657 *
15658 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
15659 */
15660 GDBusInterfaceInfo *
control_host_interface_info(void)15661 control_host_interface_info (void)
15662 {
15663 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
15664 }
15665
15666 /**
15667 * control_host_override_properties:
15668 * @klass: The class structure for a #GObject derived class.
15669 * @property_id_begin: The property id to assign to the first overridden property.
15670 *
15671 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
15672 * The properties are overridden in the order they are defined.
15673 *
15674 * Returns: The last property id.
15675 */
15676 guint
control_host_override_properties(GObjectClass * klass,guint property_id_begin)15677 control_host_override_properties (GObjectClass *klass, guint property_id_begin)
15678 {
15679 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
15680 g_object_class_override_property (klass, property_id_begin++, "flash-side");
15681 return property_id_begin - 1;
15682 }
15683
15684
15685 inline static void
control_host_signal_marshal_booted(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)15686 control_host_signal_marshal_booted (
15687 GClosure *closure,
15688 GValue *return_value,
15689 unsigned int n_param_values,
15690 const GValue *param_values,
15691 void *invocation_hint,
15692 void *marshal_data)
15693 {
15694 g_cclosure_marshal_VOID__VOID (closure,
15695 return_value, n_param_values, param_values, invocation_hint, marshal_data);
15696 }
15697
15698 inline static void
control_host_method_marshal_boot(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)15699 control_host_method_marshal_boot (
15700 GClosure *closure,
15701 GValue *return_value,
15702 unsigned int n_param_values,
15703 const GValue *param_values,
15704 void *invocation_hint,
15705 void *marshal_data)
15706 {
15707 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
15708 return_value, n_param_values, param_values, invocation_hint, marshal_data);
15709 }
15710
15711 inline static void
control_host_method_marshal_shutdown(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)15712 control_host_method_marshal_shutdown (
15713 GClosure *closure,
15714 GValue *return_value,
15715 unsigned int n_param_values,
15716 const GValue *param_values,
15717 void *invocation_hint,
15718 void *marshal_data)
15719 {
15720 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
15721 return_value, n_param_values, param_values, invocation_hint, marshal_data);
15722 }
15723
15724 inline static void
control_host_method_marshal_reboot(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)15725 control_host_method_marshal_reboot (
15726 GClosure *closure,
15727 GValue *return_value,
15728 unsigned int n_param_values,
15729 const GValue *param_values,
15730 void *invocation_hint,
15731 void *marshal_data)
15732 {
15733 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
15734 return_value, n_param_values, param_values, invocation_hint, marshal_data);
15735 }
15736
15737
15738 /**
15739 * ControlHost:
15740 *
15741 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15742 */
15743
15744 /**
15745 * ControlHostIface:
15746 * @parent_iface: The parent interface.
15747 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
15748 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
15749 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
15750 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
15751 * @get_flash_side: Getter for the #ControlHost:flash-side property.
15752 * @booted: Handler for the #ControlHost::booted signal.
15753 *
15754 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15755 */
15756
15757 typedef ControlHostIface ControlHostInterface;
G_DEFINE_INTERFACE(ControlHost,control_host,G_TYPE_OBJECT)15758 G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT)
15759
15760 static void
15761 control_host_default_init (ControlHostIface *iface)
15762 {
15763 /* GObject signals for incoming D-Bus method calls: */
15764 /**
15765 * ControlHost::handle-boot:
15766 * @object: A #ControlHost.
15767 * @invocation: A #GDBusMethodInvocation.
15768 *
15769 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
15770 *
15771 * 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 control_host_complete_boot() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
15772 *
15773 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
15774 */
15775 g_signal_new ("handle-boot",
15776 G_TYPE_FROM_INTERFACE (iface),
15777 G_SIGNAL_RUN_LAST,
15778 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
15779 g_signal_accumulator_true_handled,
15780 NULL,
15781 control_host_method_marshal_boot,
15782 G_TYPE_BOOLEAN,
15783 1,
15784 G_TYPE_DBUS_METHOD_INVOCATION);
15785
15786 /**
15787 * ControlHost::handle-shutdown:
15788 * @object: A #ControlHost.
15789 * @invocation: A #GDBusMethodInvocation.
15790 *
15791 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
15792 *
15793 * 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 control_host_complete_shutdown() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
15794 *
15795 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
15796 */
15797 g_signal_new ("handle-shutdown",
15798 G_TYPE_FROM_INTERFACE (iface),
15799 G_SIGNAL_RUN_LAST,
15800 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
15801 g_signal_accumulator_true_handled,
15802 NULL,
15803 control_host_method_marshal_shutdown,
15804 G_TYPE_BOOLEAN,
15805 1,
15806 G_TYPE_DBUS_METHOD_INVOCATION);
15807
15808 /**
15809 * ControlHost::handle-reboot:
15810 * @object: A #ControlHost.
15811 * @invocation: A #GDBusMethodInvocation.
15812 *
15813 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
15814 *
15815 * 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 control_host_complete_reboot() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
15816 *
15817 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
15818 */
15819 g_signal_new ("handle-reboot",
15820 G_TYPE_FROM_INTERFACE (iface),
15821 G_SIGNAL_RUN_LAST,
15822 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
15823 g_signal_accumulator_true_handled,
15824 NULL,
15825 control_host_method_marshal_reboot,
15826 G_TYPE_BOOLEAN,
15827 1,
15828 G_TYPE_DBUS_METHOD_INVOCATION);
15829
15830 /* GObject signals for received D-Bus signals: */
15831 /**
15832 * ControlHost::booted:
15833 * @object: A #ControlHost.
15834 *
15835 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> is received.
15836 *
15837 * 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.
15838 */
15839 _CONTROL_HOST_SIGNALS[_CONTROL_HOST_BOOTED] =
15840 g_signal_new ("booted",
15841 G_TYPE_FROM_INTERFACE (iface),
15842 G_SIGNAL_RUN_LAST,
15843 G_STRUCT_OFFSET (ControlHostIface, booted),
15844 NULL,
15845 NULL,
15846 control_host_signal_marshal_booted,
15847 G_TYPE_NONE,
15848 0);
15849
15850 /* GObject properties for D-Bus properties: */
15851 /**
15852 * ControlHost:debug-mode:
15853 *
15854 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
15855 *
15856 * 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.
15857 */
15858 g_object_interface_install_property (iface,
15859 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15860 /**
15861 * ControlHost:flash-side:
15862 *
15863 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
15864 *
15865 * 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.
15866 */
15867 g_object_interface_install_property (iface,
15868 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15869 }
15870
15871 /**
15872 * control_host_get_debug_mode: (skip)
15873 * @object: A #ControlHost.
15874 *
15875 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
15876 *
15877 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15878 *
15879 * Returns: The property value.
15880 */
15881 gint
control_host_get_debug_mode(ControlHost * object)15882 control_host_get_debug_mode (ControlHost *object)
15883 {
15884 g_return_val_if_fail (IS_CONTROL_HOST (object), 0);
15885
15886 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
15887 }
15888
15889 /**
15890 * control_host_set_debug_mode: (skip)
15891 * @object: A #ControlHost.
15892 * @value: The value to set.
15893 *
15894 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
15895 *
15896 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15897 */
15898 void
control_host_set_debug_mode(ControlHost * object,gint value)15899 control_host_set_debug_mode (ControlHost *object, gint value)
15900 {
15901 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
15902 }
15903
15904 /**
15905 * control_host_get_flash_side: (skip)
15906 * @object: A #ControlHost.
15907 *
15908 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15909 *
15910 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15911 *
15912 * 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 control_host_dup_flash_side() if on another thread.
15913 *
15914 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
15915 */
15916 const gchar *
control_host_get_flash_side(ControlHost * object)15917 control_host_get_flash_side (ControlHost *object)
15918 {
15919 g_return_val_if_fail (IS_CONTROL_HOST (object), NULL);
15920
15921 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
15922 }
15923
15924 /**
15925 * control_host_dup_flash_side: (skip)
15926 * @object: A #ControlHost.
15927 *
15928 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15929 *
15930 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15931 *
15932 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
15933 */
15934 gchar *
control_host_dup_flash_side(ControlHost * object)15935 control_host_dup_flash_side (ControlHost *object)
15936 {
15937 gchar *value;
15938 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
15939 return value;
15940 }
15941
15942 /**
15943 * control_host_set_flash_side: (skip)
15944 * @object: A #ControlHost.
15945 * @value: The value to set.
15946 *
15947 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
15948 *
15949 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15950 */
15951 void
control_host_set_flash_side(ControlHost * object,const gchar * value)15952 control_host_set_flash_side (ControlHost *object, const gchar *value)
15953 {
15954 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
15955 }
15956
15957 /**
15958 * control_host_emit_booted:
15959 * @object: A #ControlHost.
15960 *
15961 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
15962 */
15963 void
control_host_emit_booted(ControlHost * object)15964 control_host_emit_booted (
15965 ControlHost *object)
15966 {
15967 g_signal_emit (object, _CONTROL_HOST_SIGNALS[_CONTROL_HOST_BOOTED], 0);
15968 }
15969
15970 /**
15971 * control_host_call_boot:
15972 * @proxy: A #ControlHostProxy.
15973 * @cancellable: (nullable): A #GCancellable or %NULL.
15974 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15975 * @user_data: User data to pass to @callback.
15976 *
15977 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
15978 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
15979 * You can then call control_host_call_boot_finish() to get the result of the operation.
15980 *
15981 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
15982 */
15983 void
control_host_call_boot(ControlHost * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)15984 control_host_call_boot (
15985 ControlHost *proxy,
15986 GCancellable *cancellable,
15987 GAsyncReadyCallback callback,
15988 gpointer user_data)
15989 {
15990 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15991 "boot",
15992 g_variant_new ("()"),
15993 G_DBUS_CALL_FLAGS_NONE,
15994 -1,
15995 cancellable,
15996 callback,
15997 user_data);
15998 }
15999
16000 /**
16001 * control_host_call_boot_finish:
16002 * @proxy: A #ControlHostProxy.
16003 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
16004 * @error: Return location for error or %NULL.
16005 *
16006 * Finishes an operation started with control_host_call_boot().
16007 *
16008 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16009 */
16010 gboolean
control_host_call_boot_finish(ControlHost * proxy,GAsyncResult * res,GError ** error)16011 control_host_call_boot_finish (
16012 ControlHost *proxy,
16013 GAsyncResult *res,
16014 GError **error)
16015 {
16016 GVariant *_ret;
16017 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16018 if (_ret == NULL)
16019 goto _out;
16020 g_variant_get (_ret,
16021 "()");
16022 g_variant_unref (_ret);
16023 _out:
16024 return _ret != NULL;
16025 }
16026
16027 /**
16028 * control_host_call_boot_sync:
16029 * @proxy: A #ControlHostProxy.
16030 * @cancellable: (nullable): A #GCancellable or %NULL.
16031 * @error: Return location for error or %NULL.
16032 *
16033 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16034 *
16035 * See control_host_call_boot() for the asynchronous version of this method.
16036 *
16037 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16038 */
16039 gboolean
control_host_call_boot_sync(ControlHost * proxy,GCancellable * cancellable,GError ** error)16040 control_host_call_boot_sync (
16041 ControlHost *proxy,
16042 GCancellable *cancellable,
16043 GError **error)
16044 {
16045 GVariant *_ret;
16046 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16047 "boot",
16048 g_variant_new ("()"),
16049 G_DBUS_CALL_FLAGS_NONE,
16050 -1,
16051 cancellable,
16052 error);
16053 if (_ret == NULL)
16054 goto _out;
16055 g_variant_get (_ret,
16056 "()");
16057 g_variant_unref (_ret);
16058 _out:
16059 return _ret != NULL;
16060 }
16061
16062 /**
16063 * control_host_call_shutdown:
16064 * @proxy: A #ControlHostProxy.
16065 * @cancellable: (nullable): A #GCancellable or %NULL.
16066 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16067 * @user_data: User data to pass to @callback.
16068 *
16069 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
16070 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
16071 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
16072 *
16073 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
16074 */
16075 void
control_host_call_shutdown(ControlHost * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)16076 control_host_call_shutdown (
16077 ControlHost *proxy,
16078 GCancellable *cancellable,
16079 GAsyncReadyCallback callback,
16080 gpointer user_data)
16081 {
16082 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16083 "shutdown",
16084 g_variant_new ("()"),
16085 G_DBUS_CALL_FLAGS_NONE,
16086 -1,
16087 cancellable,
16088 callback,
16089 user_data);
16090 }
16091
16092 /**
16093 * control_host_call_shutdown_finish:
16094 * @proxy: A #ControlHostProxy.
16095 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
16096 * @error: Return location for error or %NULL.
16097 *
16098 * Finishes an operation started with control_host_call_shutdown().
16099 *
16100 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16101 */
16102 gboolean
control_host_call_shutdown_finish(ControlHost * proxy,GAsyncResult * res,GError ** error)16103 control_host_call_shutdown_finish (
16104 ControlHost *proxy,
16105 GAsyncResult *res,
16106 GError **error)
16107 {
16108 GVariant *_ret;
16109 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16110 if (_ret == NULL)
16111 goto _out;
16112 g_variant_get (_ret,
16113 "()");
16114 g_variant_unref (_ret);
16115 _out:
16116 return _ret != NULL;
16117 }
16118
16119 /**
16120 * control_host_call_shutdown_sync:
16121 * @proxy: A #ControlHostProxy.
16122 * @cancellable: (nullable): A #GCancellable or %NULL.
16123 * @error: Return location for error or %NULL.
16124 *
16125 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16126 *
16127 * See control_host_call_shutdown() for the asynchronous version of this method.
16128 *
16129 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16130 */
16131 gboolean
control_host_call_shutdown_sync(ControlHost * proxy,GCancellable * cancellable,GError ** error)16132 control_host_call_shutdown_sync (
16133 ControlHost *proxy,
16134 GCancellable *cancellable,
16135 GError **error)
16136 {
16137 GVariant *_ret;
16138 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16139 "shutdown",
16140 g_variant_new ("()"),
16141 G_DBUS_CALL_FLAGS_NONE,
16142 -1,
16143 cancellable,
16144 error);
16145 if (_ret == NULL)
16146 goto _out;
16147 g_variant_get (_ret,
16148 "()");
16149 g_variant_unref (_ret);
16150 _out:
16151 return _ret != NULL;
16152 }
16153
16154 /**
16155 * control_host_call_reboot:
16156 * @proxy: A #ControlHostProxy.
16157 * @cancellable: (nullable): A #GCancellable or %NULL.
16158 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16159 * @user_data: User data to pass to @callback.
16160 *
16161 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
16162 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
16163 * You can then call control_host_call_reboot_finish() to get the result of the operation.
16164 *
16165 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
16166 */
16167 void
control_host_call_reboot(ControlHost * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)16168 control_host_call_reboot (
16169 ControlHost *proxy,
16170 GCancellable *cancellable,
16171 GAsyncReadyCallback callback,
16172 gpointer user_data)
16173 {
16174 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16175 "reboot",
16176 g_variant_new ("()"),
16177 G_DBUS_CALL_FLAGS_NONE,
16178 -1,
16179 cancellable,
16180 callback,
16181 user_data);
16182 }
16183
16184 /**
16185 * control_host_call_reboot_finish:
16186 * @proxy: A #ControlHostProxy.
16187 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
16188 * @error: Return location for error or %NULL.
16189 *
16190 * Finishes an operation started with control_host_call_reboot().
16191 *
16192 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16193 */
16194 gboolean
control_host_call_reboot_finish(ControlHost * proxy,GAsyncResult * res,GError ** error)16195 control_host_call_reboot_finish (
16196 ControlHost *proxy,
16197 GAsyncResult *res,
16198 GError **error)
16199 {
16200 GVariant *_ret;
16201 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16202 if (_ret == NULL)
16203 goto _out;
16204 g_variant_get (_ret,
16205 "()");
16206 g_variant_unref (_ret);
16207 _out:
16208 return _ret != NULL;
16209 }
16210
16211 /**
16212 * control_host_call_reboot_sync:
16213 * @proxy: A #ControlHostProxy.
16214 * @cancellable: (nullable): A #GCancellable or %NULL.
16215 * @error: Return location for error or %NULL.
16216 *
16217 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16218 *
16219 * See control_host_call_reboot() for the asynchronous version of this method.
16220 *
16221 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
16222 */
16223 gboolean
control_host_call_reboot_sync(ControlHost * proxy,GCancellable * cancellable,GError ** error)16224 control_host_call_reboot_sync (
16225 ControlHost *proxy,
16226 GCancellable *cancellable,
16227 GError **error)
16228 {
16229 GVariant *_ret;
16230 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16231 "reboot",
16232 g_variant_new ("()"),
16233 G_DBUS_CALL_FLAGS_NONE,
16234 -1,
16235 cancellable,
16236 error);
16237 if (_ret == NULL)
16238 goto _out;
16239 g_variant_get (_ret,
16240 "()");
16241 g_variant_unref (_ret);
16242 _out:
16243 return _ret != NULL;
16244 }
16245
16246 /**
16247 * control_host_complete_boot:
16248 * @object: A #ControlHost.
16249 * @invocation: (transfer full): A #GDBusMethodInvocation.
16250 *
16251 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</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.
16252 *
16253 * This method will free @invocation, you cannot use it afterwards.
16254 */
16255 void
control_host_complete_boot(ControlHost * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)16256 control_host_complete_boot (
16257 ControlHost *object G_GNUC_UNUSED,
16258 GDBusMethodInvocation *invocation)
16259 {
16260 g_dbus_method_invocation_return_value (invocation,
16261 g_variant_new ("()"));
16262 }
16263
16264 /**
16265 * control_host_complete_shutdown:
16266 * @object: A #ControlHost.
16267 * @invocation: (transfer full): A #GDBusMethodInvocation.
16268 *
16269 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</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.
16270 *
16271 * This method will free @invocation, you cannot use it afterwards.
16272 */
16273 void
control_host_complete_shutdown(ControlHost * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)16274 control_host_complete_shutdown (
16275 ControlHost *object G_GNUC_UNUSED,
16276 GDBusMethodInvocation *invocation)
16277 {
16278 g_dbus_method_invocation_return_value (invocation,
16279 g_variant_new ("()"));
16280 }
16281
16282 /**
16283 * control_host_complete_reboot:
16284 * @object: A #ControlHost.
16285 * @invocation: (transfer full): A #GDBusMethodInvocation.
16286 *
16287 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</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.
16288 *
16289 * This method will free @invocation, you cannot use it afterwards.
16290 */
16291 void
control_host_complete_reboot(ControlHost * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)16292 control_host_complete_reboot (
16293 ControlHost *object G_GNUC_UNUSED,
16294 GDBusMethodInvocation *invocation)
16295 {
16296 g_dbus_method_invocation_return_value (invocation,
16297 g_variant_new ("()"));
16298 }
16299
16300 /* ------------------------------------------------------------------------ */
16301
16302 /**
16303 * ControlHostProxy:
16304 *
16305 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
16306 */
16307
16308 /**
16309 * ControlHostProxyClass:
16310 * @parent_class: The parent class.
16311 *
16312 * Class structure for #ControlHostProxy.
16313 */
16314
16315 struct _ControlHostProxyPrivate
16316 {
16317 GData *qdata;
16318 };
16319
16320 static void control_host_proxy_iface_init (ControlHostIface *iface);
16321
16322 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlHostProxy,control_host_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ControlHostProxy)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST,control_host_proxy_iface_init))16323 G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16324 G_ADD_PRIVATE (ControlHostProxy)
16325 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init))
16326
16327 #else
16328 G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16329 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init))
16330
16331 #endif
16332 static void
16333 control_host_proxy_finalize (GObject *object)
16334 {
16335 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16336 g_datalist_clear (&proxy->priv->qdata);
16337 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
16338 }
16339
16340 static void
control_host_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)16341 control_host_proxy_get_property (GObject *object,
16342 guint prop_id,
16343 GValue *value,
16344 GParamSpec *pspec G_GNUC_UNUSED)
16345 {
16346 const _ExtendedGDBusPropertyInfo *info;
16347 GVariant *variant;
16348 g_assert (prop_id != 0 && prop_id - 1 < 2);
16349 info = (const _ExtendedGDBusPropertyInfo *) _control_host_property_info_pointers[prop_id - 1];
16350 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16351 if (info->use_gvariant)
16352 {
16353 g_value_set_variant (value, variant);
16354 }
16355 else
16356 {
16357 if (variant != NULL)
16358 g_dbus_gvariant_to_gvalue (variant, value);
16359 }
16360 if (variant != NULL)
16361 g_variant_unref (variant);
16362 }
16363
16364 static void
control_host_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)16365 control_host_proxy_set_property_cb (GDBusProxy *proxy,
16366 GAsyncResult *res,
16367 gpointer user_data)
16368 {
16369 const _ExtendedGDBusPropertyInfo *info = user_data;
16370 GError *error;
16371 GVariant *_ret;
16372 error = NULL;
16373 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16374 if (!_ret)
16375 {
16376 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
16377 info->parent_struct.name,
16378 error->message, g_quark_to_string (error->domain), error->code);
16379 g_error_free (error);
16380 }
16381 else
16382 {
16383 g_variant_unref (_ret);
16384 }
16385 }
16386
16387 static void
control_host_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)16388 control_host_proxy_set_property (GObject *object,
16389 guint prop_id,
16390 const GValue *value,
16391 GParamSpec *pspec G_GNUC_UNUSED)
16392 {
16393 const _ExtendedGDBusPropertyInfo *info;
16394 GVariant *variant;
16395 g_assert (prop_id != 0 && prop_id - 1 < 2);
16396 info = (const _ExtendedGDBusPropertyInfo *) _control_host_property_info_pointers[prop_id - 1];
16397 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16398 g_dbus_proxy_call (G_DBUS_PROXY (object),
16399 "org.freedesktop.DBus.Properties.Set",
16400 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
16401 G_DBUS_CALL_FLAGS_NONE,
16402 -1,
16403 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16404 g_variant_unref (variant);
16405 }
16406
16407 static void
control_host_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)16408 control_host_proxy_g_signal (GDBusProxy *proxy,
16409 const gchar *sender_name G_GNUC_UNUSED,
16410 const gchar *signal_name,
16411 GVariant *parameters)
16412 {
16413 _ExtendedGDBusSignalInfo *info;
16414 GVariantIter iter;
16415 GVariant *child;
16416 GValue *paramv;
16417 gsize num_params;
16418 gsize n;
16419 guint signal_id;
16420 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
16421 if (info == NULL)
16422 return;
16423 num_params = g_variant_n_children (parameters);
16424 paramv = g_new0 (GValue, num_params + 1);
16425 g_value_init (¶mv[0], TYPE_CONTROL_HOST);
16426 g_value_set_object (¶mv[0], proxy);
16427 g_variant_iter_init (&iter, parameters);
16428 n = 1;
16429 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16430 {
16431 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16432 if (arg_info->use_gvariant)
16433 {
16434 g_value_init (¶mv[n], G_TYPE_VARIANT);
16435 g_value_set_variant (¶mv[n], child);
16436 n++;
16437 }
16438 else
16439 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
16440 g_variant_unref (child);
16441 }
16442 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16443 g_signal_emitv (paramv, signal_id, 0, NULL);
16444 for (n = 0; n < num_params + 1; n++)
16445 g_value_unset (¶mv[n]);
16446 g_free (paramv);
16447 }
16448
16449 static void
control_host_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)16450 control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
16451 GVariant *changed_properties,
16452 const gchar *const *invalidated_properties)
16453 {
16454 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
16455 guint n;
16456 const gchar *key;
16457 GVariantIter *iter;
16458 _ExtendedGDBusPropertyInfo *info;
16459 g_variant_get (changed_properties, "a{sv}", &iter);
16460 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16461 {
16462 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
16463 g_datalist_remove_data (&proxy->priv->qdata, key);
16464 if (info != NULL)
16465 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16466 }
16467 g_variant_iter_free (iter);
16468 for (n = 0; invalidated_properties[n] != NULL; n++)
16469 {
16470 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
16471 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16472 if (info != NULL)
16473 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16474 }
16475 }
16476
16477 static gint
control_host_proxy_get_debug_mode(ControlHost * object)16478 control_host_proxy_get_debug_mode (ControlHost *object)
16479 {
16480 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16481 GVariant *variant;
16482 gint value = 0;
16483 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
16484 if (variant != NULL)
16485 {
16486 value = g_variant_get_int32 (variant);
16487 g_variant_unref (variant);
16488 }
16489 return value;
16490 }
16491
16492 static const gchar *
control_host_proxy_get_flash_side(ControlHost * object)16493 control_host_proxy_get_flash_side (ControlHost *object)
16494 {
16495 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16496 GVariant *variant;
16497 const gchar *value = NULL;
16498 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
16499 if (variant != NULL)
16500 {
16501 value = g_variant_get_string (variant, NULL);
16502 g_variant_unref (variant);
16503 }
16504 return value;
16505 }
16506
16507 static void
control_host_proxy_init(ControlHostProxy * proxy)16508 control_host_proxy_init (ControlHostProxy *proxy)
16509 {
16510 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16511 proxy->priv = control_host_proxy_get_instance_private (proxy);
16512 #else
16513 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
16514 #endif
16515
16516 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
16517 }
16518
16519 static void
control_host_proxy_class_init(ControlHostProxyClass * klass)16520 control_host_proxy_class_init (ControlHostProxyClass *klass)
16521 {
16522 GObjectClass *gobject_class;
16523 GDBusProxyClass *proxy_class;
16524
16525 gobject_class = G_OBJECT_CLASS (klass);
16526 gobject_class->finalize = control_host_proxy_finalize;
16527 gobject_class->get_property = control_host_proxy_get_property;
16528 gobject_class->set_property = control_host_proxy_set_property;
16529
16530 proxy_class = G_DBUS_PROXY_CLASS (klass);
16531 proxy_class->g_signal = control_host_proxy_g_signal;
16532 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
16533
16534 control_host_override_properties (gobject_class, 1);
16535
16536 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16537 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
16538 #endif
16539 }
16540
16541 static void
control_host_proxy_iface_init(ControlHostIface * iface)16542 control_host_proxy_iface_init (ControlHostIface *iface)
16543 {
16544 iface->get_debug_mode = control_host_proxy_get_debug_mode;
16545 iface->get_flash_side = control_host_proxy_get_flash_side;
16546 }
16547
16548 /**
16549 * control_host_proxy_new:
16550 * @connection: A #GDBusConnection.
16551 * @flags: Flags from the #GDBusProxyFlags enumeration.
16552 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16553 * @object_path: An object path.
16554 * @cancellable: (nullable): A #GCancellable or %NULL.
16555 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16556 * @user_data: User data to pass to @callback.
16557 *
16558 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new() for more details.
16559 *
16560 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
16561 * You can then call control_host_proxy_new_finish() to get the result of the operation.
16562 *
16563 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
16564 */
16565 void
control_host_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)16566 control_host_proxy_new (
16567 GDBusConnection *connection,
16568 GDBusProxyFlags flags,
16569 const gchar *name,
16570 const gchar *object_path,
16571 GCancellable *cancellable,
16572 GAsyncReadyCallback callback,
16573 gpointer user_data)
16574 {
16575 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
16576 }
16577
16578 /**
16579 * control_host_proxy_new_finish:
16580 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
16581 * @error: Return location for error or %NULL
16582 *
16583 * Finishes an operation started with control_host_proxy_new().
16584 *
16585 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16586 */
16587 ControlHost *
control_host_proxy_new_finish(GAsyncResult * res,GError ** error)16588 control_host_proxy_new_finish (
16589 GAsyncResult *res,
16590 GError **error)
16591 {
16592 GObject *ret;
16593 GObject *source_object;
16594 source_object = g_async_result_get_source_object (res);
16595 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16596 g_object_unref (source_object);
16597 if (ret != NULL)
16598 return CONTROL_HOST (ret);
16599 else
16600 return NULL;
16601 }
16602
16603 /**
16604 * control_host_proxy_new_sync:
16605 * @connection: A #GDBusConnection.
16606 * @flags: Flags from the #GDBusProxyFlags enumeration.
16607 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16608 * @object_path: An object path.
16609 * @cancellable: (nullable): A #GCancellable or %NULL.
16610 * @error: Return location for error or %NULL
16611 *
16612 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new_sync() for more details.
16613 *
16614 * The calling thread is blocked until a reply is received.
16615 *
16616 * See control_host_proxy_new() for the asynchronous version of this constructor.
16617 *
16618 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16619 */
16620 ControlHost *
control_host_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)16621 control_host_proxy_new_sync (
16622 GDBusConnection *connection,
16623 GDBusProxyFlags flags,
16624 const gchar *name,
16625 const gchar *object_path,
16626 GCancellable *cancellable,
16627 GError **error)
16628 {
16629 GInitable *ret;
16630 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
16631 if (ret != NULL)
16632 return CONTROL_HOST (ret);
16633 else
16634 return NULL;
16635 }
16636
16637
16638 /**
16639 * control_host_proxy_new_for_bus:
16640 * @bus_type: A #GBusType.
16641 * @flags: Flags from the #GDBusProxyFlags enumeration.
16642 * @name: A bus name (well-known or unique).
16643 * @object_path: An object path.
16644 * @cancellable: (nullable): A #GCancellable or %NULL.
16645 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16646 * @user_data: User data to pass to @callback.
16647 *
16648 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16649 *
16650 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
16651 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
16652 *
16653 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16654 */
16655 void
control_host_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)16656 control_host_proxy_new_for_bus (
16657 GBusType bus_type,
16658 GDBusProxyFlags flags,
16659 const gchar *name,
16660 const gchar *object_path,
16661 GCancellable *cancellable,
16662 GAsyncReadyCallback callback,
16663 gpointer user_data)
16664 {
16665 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
16666 }
16667
16668 /**
16669 * control_host_proxy_new_for_bus_finish:
16670 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
16671 * @error: Return location for error or %NULL
16672 *
16673 * Finishes an operation started with control_host_proxy_new_for_bus().
16674 *
16675 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16676 */
16677 ControlHost *
control_host_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)16678 control_host_proxy_new_for_bus_finish (
16679 GAsyncResult *res,
16680 GError **error)
16681 {
16682 GObject *ret;
16683 GObject *source_object;
16684 source_object = g_async_result_get_source_object (res);
16685 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16686 g_object_unref (source_object);
16687 if (ret != NULL)
16688 return CONTROL_HOST (ret);
16689 else
16690 return NULL;
16691 }
16692
16693 /**
16694 * control_host_proxy_new_for_bus_sync:
16695 * @bus_type: A #GBusType.
16696 * @flags: Flags from the #GDBusProxyFlags enumeration.
16697 * @name: A bus name (well-known or unique).
16698 * @object_path: An object path.
16699 * @cancellable: (nullable): A #GCancellable or %NULL.
16700 * @error: Return location for error or %NULL
16701 *
16702 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16703 *
16704 * The calling thread is blocked until a reply is received.
16705 *
16706 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
16707 *
16708 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16709 */
16710 ControlHost *
control_host_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)16711 control_host_proxy_new_for_bus_sync (
16712 GBusType bus_type,
16713 GDBusProxyFlags flags,
16714 const gchar *name,
16715 const gchar *object_path,
16716 GCancellable *cancellable,
16717 GError **error)
16718 {
16719 GInitable *ret;
16720 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
16721 if (ret != NULL)
16722 return CONTROL_HOST (ret);
16723 else
16724 return NULL;
16725 }
16726
16727
16728 /* ------------------------------------------------------------------------ */
16729
16730 /**
16731 * ControlHostSkeleton:
16732 *
16733 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
16734 */
16735
16736 /**
16737 * ControlHostSkeletonClass:
16738 * @parent_class: The parent class.
16739 *
16740 * Class structure for #ControlHostSkeleton.
16741 */
16742
16743 struct _ControlHostSkeletonPrivate
16744 {
16745 GValue *properties;
16746 GList *changed_properties;
16747 GSource *changed_properties_idle_source;
16748 GMainContext *context;
16749 GMutex lock;
16750 };
16751
16752 static void
_control_host_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)16753 _control_host_skeleton_handle_method_call (
16754 GDBusConnection *connection G_GNUC_UNUSED,
16755 const gchar *sender G_GNUC_UNUSED,
16756 const gchar *object_path G_GNUC_UNUSED,
16757 const gchar *interface_name,
16758 const gchar *method_name,
16759 GVariant *parameters,
16760 GDBusMethodInvocation *invocation,
16761 gpointer user_data)
16762 {
16763 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16764 _ExtendedGDBusMethodInfo *info;
16765 GVariantIter iter;
16766 GVariant *child;
16767 GValue *paramv;
16768 gsize num_params;
16769 guint num_extra;
16770 gsize n;
16771 guint signal_id;
16772 GValue return_value = G_VALUE_INIT;
16773 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
16774 g_assert (info != NULL);
16775 num_params = g_variant_n_children (parameters);
16776 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
16777 n = 0;
16778 g_value_init (¶mv[n], TYPE_CONTROL_HOST);
16779 g_value_set_object (¶mv[n++], skeleton);
16780 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
16781 g_value_set_object (¶mv[n++], invocation);
16782 if (info->pass_fdlist)
16783 {
16784 #ifdef G_OS_UNIX
16785 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
16786 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
16787 #else
16788 g_assert_not_reached ();
16789 #endif
16790 }
16791 g_variant_iter_init (&iter, parameters);
16792 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16793 {
16794 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
16795 if (arg_info->use_gvariant)
16796 {
16797 g_value_init (¶mv[n], G_TYPE_VARIANT);
16798 g_value_set_variant (¶mv[n], child);
16799 n++;
16800 }
16801 else
16802 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
16803 g_variant_unref (child);
16804 }
16805 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16806 g_value_init (&return_value, G_TYPE_BOOLEAN);
16807 g_signal_emitv (paramv, signal_id, 0, &return_value);
16808 if (!g_value_get_boolean (&return_value))
16809 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);
16810 g_value_unset (&return_value);
16811 for (n = 0; n < num_params + num_extra; n++)
16812 g_value_unset (¶mv[n]);
16813 g_free (paramv);
16814 }
16815
16816 static GVariant *
_control_host_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)16817 _control_host_skeleton_handle_get_property (
16818 GDBusConnection *connection G_GNUC_UNUSED,
16819 const gchar *sender G_GNUC_UNUSED,
16820 const gchar *object_path G_GNUC_UNUSED,
16821 const gchar *interface_name G_GNUC_UNUSED,
16822 const gchar *property_name,
16823 GError **error,
16824 gpointer user_data)
16825 {
16826 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16827 GValue value = G_VALUE_INIT;
16828 GParamSpec *pspec;
16829 _ExtendedGDBusPropertyInfo *info;
16830 GVariant *ret;
16831 ret = NULL;
16832 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16833 g_assert (info != NULL);
16834 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16835 if (pspec == NULL)
16836 {
16837 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16838 }
16839 else
16840 {
16841 g_value_init (&value, pspec->value_type);
16842 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16843 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
16844 g_value_unset (&value);
16845 }
16846 return ret;
16847 }
16848
16849 static gboolean
_control_host_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)16850 _control_host_skeleton_handle_set_property (
16851 GDBusConnection *connection G_GNUC_UNUSED,
16852 const gchar *sender G_GNUC_UNUSED,
16853 const gchar *object_path G_GNUC_UNUSED,
16854 const gchar *interface_name G_GNUC_UNUSED,
16855 const gchar *property_name,
16856 GVariant *variant,
16857 GError **error,
16858 gpointer user_data)
16859 {
16860 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16861 GValue value = G_VALUE_INIT;
16862 GParamSpec *pspec;
16863 _ExtendedGDBusPropertyInfo *info;
16864 gboolean ret;
16865 ret = FALSE;
16866 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16867 g_assert (info != NULL);
16868 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16869 if (pspec == NULL)
16870 {
16871 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16872 }
16873 else
16874 {
16875 if (info->use_gvariant)
16876 g_value_set_variant (&value, variant);
16877 else
16878 g_dbus_gvariant_to_gvalue (variant, &value);
16879 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16880 g_value_unset (&value);
16881 ret = TRUE;
16882 }
16883 return ret;
16884 }
16885
16886 static const GDBusInterfaceVTable _control_host_skeleton_vtable =
16887 {
16888 _control_host_skeleton_handle_method_call,
16889 _control_host_skeleton_handle_get_property,
16890 _control_host_skeleton_handle_set_property,
16891 {NULL}
16892 };
16893
16894 static GDBusInterfaceInfo *
control_host_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)16895 control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16896 {
16897 return control_host_interface_info ();
16898 }
16899
16900 static GDBusInterfaceVTable *
control_host_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)16901 control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16902 {
16903 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
16904 }
16905
16906 static GVariant *
control_host_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)16907 control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
16908 {
16909 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16910
16911 GVariantBuilder builder;
16912 guint n;
16913 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16914 if (_control_host_interface_info.parent_struct.properties == NULL)
16915 goto out;
16916 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
16917 {
16918 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
16919 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
16920 {
16921 GVariant *value;
16922 value = _control_host_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.control.Host", info->name, NULL, skeleton);
16923 if (value != NULL)
16924 {
16925 g_variant_take_ref (value);
16926 g_variant_builder_add (&builder, "{sv}", info->name, value);
16927 g_variant_unref (value);
16928 }
16929 }
16930 }
16931 out:
16932 return g_variant_builder_end (&builder);
16933 }
16934
16935 static gboolean _control_host_emit_changed (gpointer user_data);
16936
16937 static void
control_host_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)16938 control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
16939 {
16940 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16941 gboolean emit_changed = FALSE;
16942
16943 g_mutex_lock (&skeleton->priv->lock);
16944 if (skeleton->priv->changed_properties_idle_source != NULL)
16945 {
16946 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16947 skeleton->priv->changed_properties_idle_source = NULL;
16948 emit_changed = TRUE;
16949 }
16950 g_mutex_unlock (&skeleton->priv->lock);
16951
16952 if (emit_changed)
16953 _control_host_emit_changed (skeleton);
16954 }
16955
16956 static void
_control_host_on_signal_booted(ControlHost * object)16957 _control_host_on_signal_booted (
16958 ControlHost *object)
16959 {
16960 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16961
16962 GList *connections, *l;
16963 GVariant *signal_variant;
16964 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16965
16966 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16967 for (l = connections; l != NULL; l = l->next)
16968 {
16969 GDBusConnection *connection = l->data;
16970 g_dbus_connection_emit_signal (connection,
16971 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
16972 signal_variant, NULL);
16973 }
16974 g_variant_unref (signal_variant);
16975 g_list_free_full (connections, g_object_unref);
16976 }
16977
16978 static void control_host_skeleton_iface_init (ControlHostIface *iface);
16979 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlHostSkeleton,control_host_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ControlHostSkeleton)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST,control_host_skeleton_iface_init))16980 G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16981 G_ADD_PRIVATE (ControlHostSkeleton)
16982 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init))
16983
16984 #else
16985 G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16986 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init))
16987
16988 #endif
16989 static void
16990 control_host_skeleton_finalize (GObject *object)
16991 {
16992 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16993 guint n;
16994 for (n = 0; n < 2; n++)
16995 g_value_unset (&skeleton->priv->properties[n]);
16996 g_free (skeleton->priv->properties);
16997 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16998 if (skeleton->priv->changed_properties_idle_source != NULL)
16999 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17000 g_main_context_unref (skeleton->priv->context);
17001 g_mutex_clear (&skeleton->priv->lock);
17002 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
17003 }
17004
17005 static void
control_host_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)17006 control_host_skeleton_get_property (GObject *object,
17007 guint prop_id,
17008 GValue *value,
17009 GParamSpec *pspec G_GNUC_UNUSED)
17010 {
17011 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
17012 g_assert (prop_id != 0 && prop_id - 1 < 2);
17013 g_mutex_lock (&skeleton->priv->lock);
17014 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17015 g_mutex_unlock (&skeleton->priv->lock);
17016 }
17017
17018 static gboolean
_control_host_emit_changed(gpointer user_data)17019 _control_host_emit_changed (gpointer user_data)
17020 {
17021 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
17022 GList *l;
17023 GVariantBuilder builder;
17024 GVariantBuilder invalidated_builder;
17025 guint num_changes;
17026
17027 g_mutex_lock (&skeleton->priv->lock);
17028 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17029 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17030 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17031 {
17032 ChangedProperty *cp = l->data;
17033 GVariant *variant;
17034 const GValue *cur_value;
17035
17036 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17037 if (!_g_value_equal (cur_value, &cp->orig_value))
17038 {
17039 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17040 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17041 g_variant_unref (variant);
17042 num_changes++;
17043 }
17044 }
17045 if (num_changes > 0)
17046 {
17047 GList *connections, *ll;
17048 GVariant *signal_variant;
17049 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
17050 &builder, &invalidated_builder));
17051 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17052 for (ll = connections; ll != NULL; ll = ll->next)
17053 {
17054 GDBusConnection *connection = ll->data;
17055
17056 g_dbus_connection_emit_signal (connection,
17057 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17058 "org.freedesktop.DBus.Properties",
17059 "PropertiesChanged",
17060 signal_variant,
17061 NULL);
17062 }
17063 g_variant_unref (signal_variant);
17064 g_list_free_full (connections, g_object_unref);
17065 }
17066 else
17067 {
17068 g_variant_builder_clear (&builder);
17069 g_variant_builder_clear (&invalidated_builder);
17070 }
17071 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17072 skeleton->priv->changed_properties = NULL;
17073 skeleton->priv->changed_properties_idle_source = NULL;
17074 g_mutex_unlock (&skeleton->priv->lock);
17075 return FALSE;
17076 }
17077
17078 static void
_control_host_schedule_emit_changed(ControlHostSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)17079 _control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17080 {
17081 ChangedProperty *cp;
17082 GList *l;
17083 cp = NULL;
17084 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17085 {
17086 ChangedProperty *i_cp = l->data;
17087 if (i_cp->info == info)
17088 {
17089 cp = i_cp;
17090 break;
17091 }
17092 }
17093 if (cp == NULL)
17094 {
17095 cp = g_new0 (ChangedProperty, 1);
17096 cp->prop_id = prop_id;
17097 cp->info = info;
17098 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17099 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17100 g_value_copy (orig_value, &cp->orig_value);
17101 }
17102 }
17103
17104 static void
control_host_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)17105 control_host_skeleton_notify (GObject *object,
17106 GParamSpec *pspec G_GNUC_UNUSED)
17107 {
17108 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
17109 g_mutex_lock (&skeleton->priv->lock);
17110 if (skeleton->priv->changed_properties != NULL &&
17111 skeleton->priv->changed_properties_idle_source == NULL)
17112 {
17113 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17114 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17115 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17116 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_host_emit_changed");
17117 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17118 g_source_unref (skeleton->priv->changed_properties_idle_source);
17119 }
17120 g_mutex_unlock (&skeleton->priv->lock);
17121 }
17122
17123 static void
control_host_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)17124 control_host_skeleton_set_property (GObject *object,
17125 guint prop_id,
17126 const GValue *value,
17127 GParamSpec *pspec)
17128 {
17129 const _ExtendedGDBusPropertyInfo *info;
17130 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
17131 g_assert (prop_id != 0 && prop_id - 1 < 2);
17132 info = (const _ExtendedGDBusPropertyInfo *) _control_host_property_info_pointers[prop_id - 1];
17133 g_mutex_lock (&skeleton->priv->lock);
17134 g_object_freeze_notify (object);
17135 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17136 {
17137 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
17138 info->emits_changed_signal)
17139 _control_host_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
17140 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17141 g_object_notify_by_pspec (object, pspec);
17142 }
17143 g_mutex_unlock (&skeleton->priv->lock);
17144 g_object_thaw_notify (object);
17145 }
17146
17147 static void
control_host_skeleton_init(ControlHostSkeleton * skeleton)17148 control_host_skeleton_init (ControlHostSkeleton *skeleton)
17149 {
17150 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17151 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
17152 #else
17153 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
17154 #endif
17155
17156 g_mutex_init (&skeleton->priv->lock);
17157 skeleton->priv->context = g_main_context_ref_thread_default ();
17158 skeleton->priv->properties = g_new0 (GValue, 2);
17159 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17160 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
17161 }
17162
17163 static gint
control_host_skeleton_get_debug_mode(ControlHost * object)17164 control_host_skeleton_get_debug_mode (ControlHost *object)
17165 {
17166 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
17167 gint value;
17168 g_mutex_lock (&skeleton->priv->lock);
17169 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
17170 g_mutex_unlock (&skeleton->priv->lock);
17171 return value;
17172 }
17173
17174 static const gchar *
control_host_skeleton_get_flash_side(ControlHost * object)17175 control_host_skeleton_get_flash_side (ControlHost *object)
17176 {
17177 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
17178 const gchar *value;
17179 g_mutex_lock (&skeleton->priv->lock);
17180 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
17181 g_mutex_unlock (&skeleton->priv->lock);
17182 return value;
17183 }
17184
17185 static void
control_host_skeleton_class_init(ControlHostSkeletonClass * klass)17186 control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
17187 {
17188 GObjectClass *gobject_class;
17189 GDBusInterfaceSkeletonClass *skeleton_class;
17190
17191 gobject_class = G_OBJECT_CLASS (klass);
17192 gobject_class->finalize = control_host_skeleton_finalize;
17193 gobject_class->get_property = control_host_skeleton_get_property;
17194 gobject_class->set_property = control_host_skeleton_set_property;
17195 gobject_class->notify = control_host_skeleton_notify;
17196
17197
17198 control_host_override_properties (gobject_class, 1);
17199
17200 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17201 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
17202 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
17203 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
17204 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
17205
17206 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17207 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
17208 #endif
17209 }
17210
17211 static void
control_host_skeleton_iface_init(ControlHostIface * iface)17212 control_host_skeleton_iface_init (ControlHostIface *iface)
17213 {
17214 iface->booted = _control_host_on_signal_booted;
17215 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
17216 iface->get_flash_side = control_host_skeleton_get_flash_side;
17217 }
17218
17219 /**
17220 * control_host_skeleton_new:
17221 *
17222 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
17223 *
17224 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
17225 */
17226 ControlHost *
control_host_skeleton_new(void)17227 control_host_skeleton_new (void)
17228 {
17229 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
17230 }
17231
17232 /* ------------------------------------------------------------------------
17233 * Code for interface org.openbmc.control.Power
17234 * ------------------------------------------------------------------------
17235 */
17236
17237 /**
17238 * SECTION:ControlPower
17239 * @title: ControlPower
17240 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
17241 *
17242 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface in C.
17243 */
17244
17245 enum
17246 {
17247 _CONTROL_POWER_POWER_GOOD,
17248 _CONTROL_POWER_POWER_LOST,
17249 };
17250
17251 static unsigned _CONTROL_POWER_SIGNALS[2] = { 0 };
17252
17253 /* ---- Introspection data for org.openbmc.control.Power ---- */
17254
17255 static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
17256 {
17257 {
17258 -1,
17259 (gchar *) "state",
17260 (gchar *) "i",
17261 NULL
17262 },
17263 FALSE
17264 };
17265
17266 static const GDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
17267 {
17268 &_control_power_method_info_set_power_state_IN_ARG_state.parent_struct,
17269 NULL
17270 };
17271
17272 static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
17273 {
17274 {
17275 -1,
17276 (gchar *) "setPowerState",
17277 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
17278 NULL,
17279 NULL
17280 },
17281 "handle-set-power-state",
17282 FALSE
17283 };
17284
17285 static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
17286 {
17287 {
17288 -1,
17289 (gchar *) "state",
17290 (gchar *) "i",
17291 NULL
17292 },
17293 FALSE
17294 };
17295
17296 static const GDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
17297 {
17298 &_control_power_method_info_get_power_state_OUT_ARG_state.parent_struct,
17299 NULL
17300 };
17301
17302 static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
17303 {
17304 {
17305 -1,
17306 (gchar *) "getPowerState",
17307 NULL,
17308 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
17309 NULL
17310 },
17311 "handle-get-power-state",
17312 FALSE
17313 };
17314
17315 static const GDBusMethodInfo * const _control_power_method_info_pointers[] =
17316 {
17317 &_control_power_method_info_set_power_state.parent_struct,
17318 &_control_power_method_info_get_power_state.parent_struct,
17319 NULL
17320 };
17321
17322 static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
17323 {
17324 {
17325 -1,
17326 (gchar *) "PowerGood",
17327 NULL,
17328 NULL
17329 },
17330 "power-good"
17331 };
17332
17333 static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
17334 {
17335 {
17336 -1,
17337 (gchar *) "PowerLost",
17338 NULL,
17339 NULL
17340 },
17341 "power-lost"
17342 };
17343
17344 static const GDBusSignalInfo * const _control_power_signal_info_pointers[] =
17345 {
17346 &_control_power_signal_info_power_good.parent_struct,
17347 &_control_power_signal_info_power_lost.parent_struct,
17348 NULL
17349 };
17350
17351 static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
17352 {
17353 {
17354 -1,
17355 (gchar *) "pgood",
17356 (gchar *) "i",
17357 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17358 NULL
17359 },
17360 "pgood",
17361 FALSE,
17362 TRUE
17363 };
17364
17365 static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
17366 {
17367 {
17368 -1,
17369 (gchar *) "state",
17370 (gchar *) "i",
17371 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17372 NULL
17373 },
17374 "state",
17375 FALSE,
17376 TRUE
17377 };
17378
17379 static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
17380 {
17381 {
17382 -1,
17383 (gchar *) "pgood_timeout",
17384 (gchar *) "i",
17385 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17386 NULL
17387 },
17388 "pgood-timeout",
17389 FALSE,
17390 TRUE
17391 };
17392
17393 static const GDBusPropertyInfo * const _control_power_property_info_pointers[] =
17394 {
17395 &_control_power_property_info_pgood.parent_struct,
17396 &_control_power_property_info_state.parent_struct,
17397 &_control_power_property_info_pgood_timeout.parent_struct,
17398 NULL
17399 };
17400
17401 static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
17402 {
17403 {
17404 -1,
17405 (gchar *) "org.openbmc.control.Power",
17406 (GDBusMethodInfo **) &_control_power_method_info_pointers,
17407 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
17408 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
17409 NULL
17410 },
17411 "control-power",
17412 };
17413
17414
17415 /**
17416 * control_power_interface_info:
17417 *
17418 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface.
17419 *
17420 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17421 */
17422 GDBusInterfaceInfo *
control_power_interface_info(void)17423 control_power_interface_info (void)
17424 {
17425 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
17426 }
17427
17428 /**
17429 * control_power_override_properties:
17430 * @klass: The class structure for a #GObject derived class.
17431 * @property_id_begin: The property id to assign to the first overridden property.
17432 *
17433 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
17434 * The properties are overridden in the order they are defined.
17435 *
17436 * Returns: The last property id.
17437 */
17438 guint
control_power_override_properties(GObjectClass * klass,guint property_id_begin)17439 control_power_override_properties (GObjectClass *klass, guint property_id_begin)
17440 {
17441 g_object_class_override_property (klass, property_id_begin++, "pgood");
17442 g_object_class_override_property (klass, property_id_begin++, "state");
17443 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
17444 return property_id_begin - 1;
17445 }
17446
17447
17448 inline static void
control_power_signal_marshal_power_good(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)17449 control_power_signal_marshal_power_good (
17450 GClosure *closure,
17451 GValue *return_value,
17452 unsigned int n_param_values,
17453 const GValue *param_values,
17454 void *invocation_hint,
17455 void *marshal_data)
17456 {
17457 g_cclosure_marshal_VOID__VOID (closure,
17458 return_value, n_param_values, param_values, invocation_hint, marshal_data);
17459 }
17460
17461 inline static void
control_power_signal_marshal_power_lost(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)17462 control_power_signal_marshal_power_lost (
17463 GClosure *closure,
17464 GValue *return_value,
17465 unsigned int n_param_values,
17466 const GValue *param_values,
17467 void *invocation_hint,
17468 void *marshal_data)
17469 {
17470 g_cclosure_marshal_VOID__VOID (closure,
17471 return_value, n_param_values, param_values, invocation_hint, marshal_data);
17472 }
17473
17474 inline static void
control_power_method_marshal_set_power_state(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)17475 control_power_method_marshal_set_power_state (
17476 GClosure *closure,
17477 GValue *return_value,
17478 unsigned int n_param_values,
17479 const GValue *param_values,
17480 void *invocation_hint,
17481 void *marshal_data)
17482 {
17483 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT (closure,
17484 return_value, n_param_values, param_values, invocation_hint, marshal_data);
17485 }
17486
17487 inline static void
control_power_method_marshal_get_power_state(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)17488 control_power_method_marshal_get_power_state (
17489 GClosure *closure,
17490 GValue *return_value,
17491 unsigned int n_param_values,
17492 const GValue *param_values,
17493 void *invocation_hint,
17494 void *marshal_data)
17495 {
17496 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
17497 return_value, n_param_values, param_values, invocation_hint, marshal_data);
17498 }
17499
17500
17501 /**
17502 * ControlPower:
17503 *
17504 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17505 */
17506
17507 /**
17508 * ControlPowerIface:
17509 * @parent_iface: The parent interface.
17510 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
17511 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
17512 * @get_pgood: Getter for the #ControlPower:pgood property.
17513 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
17514 * @get_state: Getter for the #ControlPower:state property.
17515 * @power_good: Handler for the #ControlPower::power-good signal.
17516 * @power_lost: Handler for the #ControlPower::power-lost signal.
17517 *
17518 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17519 */
17520
17521 typedef ControlPowerIface ControlPowerInterface;
G_DEFINE_INTERFACE(ControlPower,control_power,G_TYPE_OBJECT)17522 G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT)
17523
17524 static void
17525 control_power_default_init (ControlPowerIface *iface)
17526 {
17527 /* GObject signals for incoming D-Bus method calls: */
17528 /**
17529 * ControlPower::handle-set-power-state:
17530 * @object: A #ControlPower.
17531 * @invocation: A #GDBusMethodInvocation.
17532 * @arg_state: Argument passed by remote caller.
17533 *
17534 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
17535 *
17536 * 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 control_power_complete_set_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
17537 *
17538 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
17539 */
17540 g_signal_new ("handle-set-power-state",
17541 G_TYPE_FROM_INTERFACE (iface),
17542 G_SIGNAL_RUN_LAST,
17543 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
17544 g_signal_accumulator_true_handled,
17545 NULL,
17546 control_power_method_marshal_set_power_state,
17547 G_TYPE_BOOLEAN,
17548 2,
17549 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17550
17551 /**
17552 * ControlPower::handle-get-power-state:
17553 * @object: A #ControlPower.
17554 * @invocation: A #GDBusMethodInvocation.
17555 *
17556 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
17557 *
17558 * 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 control_power_complete_get_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
17559 *
17560 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
17561 */
17562 g_signal_new ("handle-get-power-state",
17563 G_TYPE_FROM_INTERFACE (iface),
17564 G_SIGNAL_RUN_LAST,
17565 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
17566 g_signal_accumulator_true_handled,
17567 NULL,
17568 control_power_method_marshal_get_power_state,
17569 G_TYPE_BOOLEAN,
17570 1,
17571 G_TYPE_DBUS_METHOD_INVOCATION);
17572
17573 /* GObject signals for received D-Bus signals: */
17574 /**
17575 * ControlPower::power-good:
17576 * @object: A #ControlPower.
17577 *
17578 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received.
17579 *
17580 * 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.
17581 */
17582 _CONTROL_POWER_SIGNALS[_CONTROL_POWER_POWER_GOOD] =
17583 g_signal_new ("power-good",
17584 G_TYPE_FROM_INTERFACE (iface),
17585 G_SIGNAL_RUN_LAST,
17586 G_STRUCT_OFFSET (ControlPowerIface, power_good),
17587 NULL,
17588 NULL,
17589 control_power_signal_marshal_power_good,
17590 G_TYPE_NONE,
17591 0);
17592
17593 /**
17594 * ControlPower::power-lost:
17595 * @object: A #ControlPower.
17596 *
17597 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> is received.
17598 *
17599 * 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.
17600 */
17601 _CONTROL_POWER_SIGNALS[_CONTROL_POWER_POWER_LOST] =
17602 g_signal_new ("power-lost",
17603 G_TYPE_FROM_INTERFACE (iface),
17604 G_SIGNAL_RUN_LAST,
17605 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
17606 NULL,
17607 NULL,
17608 control_power_signal_marshal_power_lost,
17609 G_TYPE_NONE,
17610 0);
17611
17612 /* GObject properties for D-Bus properties: */
17613 /**
17614 * ControlPower:pgood:
17615 *
17616 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
17617 *
17618 * 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.
17619 */
17620 g_object_interface_install_property (iface,
17621 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17622 /**
17623 * ControlPower:state:
17624 *
17625 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
17626 *
17627 * 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.
17628 */
17629 g_object_interface_install_property (iface,
17630 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17631 /**
17632 * ControlPower:pgood-timeout:
17633 *
17634 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
17635 *
17636 * 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.
17637 */
17638 g_object_interface_install_property (iface,
17639 g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17640 }
17641
17642 /**
17643 * control_power_get_pgood: (skip)
17644 * @object: A #ControlPower.
17645 *
17646 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
17647 *
17648 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17649 *
17650 * Returns: The property value.
17651 */
17652 gint
control_power_get_pgood(ControlPower * object)17653 control_power_get_pgood (ControlPower *object)
17654 {
17655 g_return_val_if_fail (IS_CONTROL_POWER (object), 0);
17656
17657 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
17658 }
17659
17660 /**
17661 * control_power_set_pgood: (skip)
17662 * @object: A #ControlPower.
17663 * @value: The value to set.
17664 *
17665 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
17666 *
17667 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17668 */
17669 void
control_power_set_pgood(ControlPower * object,gint value)17670 control_power_set_pgood (ControlPower *object, gint value)
17671 {
17672 g_object_set (G_OBJECT (object), "pgood", value, NULL);
17673 }
17674
17675 /**
17676 * control_power_get_state: (skip)
17677 * @object: A #ControlPower.
17678 *
17679 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
17680 *
17681 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17682 *
17683 * Returns: The property value.
17684 */
17685 gint
control_power_get_state(ControlPower * object)17686 control_power_get_state (ControlPower *object)
17687 {
17688 g_return_val_if_fail (IS_CONTROL_POWER (object), 0);
17689
17690 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
17691 }
17692
17693 /**
17694 * control_power_set_state: (skip)
17695 * @object: A #ControlPower.
17696 * @value: The value to set.
17697 *
17698 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
17699 *
17700 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17701 */
17702 void
control_power_set_state(ControlPower * object,gint value)17703 control_power_set_state (ControlPower *object, gint value)
17704 {
17705 g_object_set (G_OBJECT (object), "state", value, NULL);
17706 }
17707
17708 /**
17709 * control_power_get_pgood_timeout: (skip)
17710 * @object: A #ControlPower.
17711 *
17712 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
17713 *
17714 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17715 *
17716 * Returns: The property value.
17717 */
17718 gint
control_power_get_pgood_timeout(ControlPower * object)17719 control_power_get_pgood_timeout (ControlPower *object)
17720 {
17721 g_return_val_if_fail (IS_CONTROL_POWER (object), 0);
17722
17723 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
17724 }
17725
17726 /**
17727 * control_power_set_pgood_timeout: (skip)
17728 * @object: A #ControlPower.
17729 * @value: The value to set.
17730 *
17731 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
17732 *
17733 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17734 */
17735 void
control_power_set_pgood_timeout(ControlPower * object,gint value)17736 control_power_set_pgood_timeout (ControlPower *object, gint value)
17737 {
17738 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
17739 }
17740
17741 /**
17742 * control_power_emit_power_good:
17743 * @object: A #ControlPower.
17744 *
17745 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
17746 */
17747 void
control_power_emit_power_good(ControlPower * object)17748 control_power_emit_power_good (
17749 ControlPower *object)
17750 {
17751 g_signal_emit (object, _CONTROL_POWER_SIGNALS[_CONTROL_POWER_POWER_GOOD], 0);
17752 }
17753
17754 /**
17755 * control_power_emit_power_lost:
17756 * @object: A #ControlPower.
17757 *
17758 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
17759 */
17760 void
control_power_emit_power_lost(ControlPower * object)17761 control_power_emit_power_lost (
17762 ControlPower *object)
17763 {
17764 g_signal_emit (object, _CONTROL_POWER_SIGNALS[_CONTROL_POWER_POWER_LOST], 0);
17765 }
17766
17767 /**
17768 * control_power_call_set_power_state:
17769 * @proxy: A #ControlPowerProxy.
17770 * @arg_state: Argument to pass with the method invocation.
17771 * @cancellable: (nullable): A #GCancellable or %NULL.
17772 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17773 * @user_data: User data to pass to @callback.
17774 *
17775 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
17776 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
17777 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
17778 *
17779 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
17780 */
17781 void
control_power_call_set_power_state(ControlPower * proxy,gint arg_state,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)17782 control_power_call_set_power_state (
17783 ControlPower *proxy,
17784 gint arg_state,
17785 GCancellable *cancellable,
17786 GAsyncReadyCallback callback,
17787 gpointer user_data)
17788 {
17789 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17790 "setPowerState",
17791 g_variant_new ("(i)",
17792 arg_state),
17793 G_DBUS_CALL_FLAGS_NONE,
17794 -1,
17795 cancellable,
17796 callback,
17797 user_data);
17798 }
17799
17800 /**
17801 * control_power_call_set_power_state_finish:
17802 * @proxy: A #ControlPowerProxy.
17803 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
17804 * @error: Return location for error or %NULL.
17805 *
17806 * Finishes an operation started with control_power_call_set_power_state().
17807 *
17808 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
17809 */
17810 gboolean
control_power_call_set_power_state_finish(ControlPower * proxy,GAsyncResult * res,GError ** error)17811 control_power_call_set_power_state_finish (
17812 ControlPower *proxy,
17813 GAsyncResult *res,
17814 GError **error)
17815 {
17816 GVariant *_ret;
17817 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17818 if (_ret == NULL)
17819 goto _out;
17820 g_variant_get (_ret,
17821 "()");
17822 g_variant_unref (_ret);
17823 _out:
17824 return _ret != NULL;
17825 }
17826
17827 /**
17828 * control_power_call_set_power_state_sync:
17829 * @proxy: A #ControlPowerProxy.
17830 * @arg_state: Argument to pass with the method invocation.
17831 * @cancellable: (nullable): A #GCancellable or %NULL.
17832 * @error: Return location for error or %NULL.
17833 *
17834 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17835 *
17836 * See control_power_call_set_power_state() for the asynchronous version of this method.
17837 *
17838 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
17839 */
17840 gboolean
control_power_call_set_power_state_sync(ControlPower * proxy,gint arg_state,GCancellable * cancellable,GError ** error)17841 control_power_call_set_power_state_sync (
17842 ControlPower *proxy,
17843 gint arg_state,
17844 GCancellable *cancellable,
17845 GError **error)
17846 {
17847 GVariant *_ret;
17848 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17849 "setPowerState",
17850 g_variant_new ("(i)",
17851 arg_state),
17852 G_DBUS_CALL_FLAGS_NONE,
17853 -1,
17854 cancellable,
17855 error);
17856 if (_ret == NULL)
17857 goto _out;
17858 g_variant_get (_ret,
17859 "()");
17860 g_variant_unref (_ret);
17861 _out:
17862 return _ret != NULL;
17863 }
17864
17865 /**
17866 * control_power_call_get_power_state:
17867 * @proxy: A #ControlPowerProxy.
17868 * @cancellable: (nullable): A #GCancellable or %NULL.
17869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17870 * @user_data: User data to pass to @callback.
17871 *
17872 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
17873 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
17874 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
17875 *
17876 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
17877 */
17878 void
control_power_call_get_power_state(ControlPower * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)17879 control_power_call_get_power_state (
17880 ControlPower *proxy,
17881 GCancellable *cancellable,
17882 GAsyncReadyCallback callback,
17883 gpointer user_data)
17884 {
17885 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17886 "getPowerState",
17887 g_variant_new ("()"),
17888 G_DBUS_CALL_FLAGS_NONE,
17889 -1,
17890 cancellable,
17891 callback,
17892 user_data);
17893 }
17894
17895 /**
17896 * control_power_call_get_power_state_finish:
17897 * @proxy: A #ControlPowerProxy.
17898 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
17899 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
17900 * @error: Return location for error or %NULL.
17901 *
17902 * Finishes an operation started with control_power_call_get_power_state().
17903 *
17904 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
17905 */
17906 gboolean
control_power_call_get_power_state_finish(ControlPower * proxy,gint * out_state,GAsyncResult * res,GError ** error)17907 control_power_call_get_power_state_finish (
17908 ControlPower *proxy,
17909 gint *out_state,
17910 GAsyncResult *res,
17911 GError **error)
17912 {
17913 GVariant *_ret;
17914 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17915 if (_ret == NULL)
17916 goto _out;
17917 g_variant_get (_ret,
17918 "(i)",
17919 out_state);
17920 g_variant_unref (_ret);
17921 _out:
17922 return _ret != NULL;
17923 }
17924
17925 /**
17926 * control_power_call_get_power_state_sync:
17927 * @proxy: A #ControlPowerProxy.
17928 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
17929 * @cancellable: (nullable): A #GCancellable or %NULL.
17930 * @error: Return location for error or %NULL.
17931 *
17932 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17933 *
17934 * See control_power_call_get_power_state() for the asynchronous version of this method.
17935 *
17936 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
17937 */
17938 gboolean
control_power_call_get_power_state_sync(ControlPower * proxy,gint * out_state,GCancellable * cancellable,GError ** error)17939 control_power_call_get_power_state_sync (
17940 ControlPower *proxy,
17941 gint *out_state,
17942 GCancellable *cancellable,
17943 GError **error)
17944 {
17945 GVariant *_ret;
17946 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17947 "getPowerState",
17948 g_variant_new ("()"),
17949 G_DBUS_CALL_FLAGS_NONE,
17950 -1,
17951 cancellable,
17952 error);
17953 if (_ret == NULL)
17954 goto _out;
17955 g_variant_get (_ret,
17956 "(i)",
17957 out_state);
17958 g_variant_unref (_ret);
17959 _out:
17960 return _ret != NULL;
17961 }
17962
17963 /**
17964 * control_power_complete_set_power_state:
17965 * @object: A #ControlPower.
17966 * @invocation: (transfer full): A #GDBusMethodInvocation.
17967 *
17968 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</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.
17969 *
17970 * This method will free @invocation, you cannot use it afterwards.
17971 */
17972 void
control_power_complete_set_power_state(ControlPower * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)17973 control_power_complete_set_power_state (
17974 ControlPower *object G_GNUC_UNUSED,
17975 GDBusMethodInvocation *invocation)
17976 {
17977 g_dbus_method_invocation_return_value (invocation,
17978 g_variant_new ("()"));
17979 }
17980
17981 /**
17982 * control_power_complete_get_power_state:
17983 * @object: A #ControlPower.
17984 * @invocation: (transfer full): A #GDBusMethodInvocation.
17985 * @state: Parameter to return.
17986 *
17987 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</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.
17988 *
17989 * This method will free @invocation, you cannot use it afterwards.
17990 */
17991 void
control_power_complete_get_power_state(ControlPower * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gint state)17992 control_power_complete_get_power_state (
17993 ControlPower *object G_GNUC_UNUSED,
17994 GDBusMethodInvocation *invocation,
17995 gint state)
17996 {
17997 g_dbus_method_invocation_return_value (invocation,
17998 g_variant_new ("(i)",
17999 state));
18000 }
18001
18002 /* ------------------------------------------------------------------------ */
18003
18004 /**
18005 * ControlPowerProxy:
18006 *
18007 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
18008 */
18009
18010 /**
18011 * ControlPowerProxyClass:
18012 * @parent_class: The parent class.
18013 *
18014 * Class structure for #ControlPowerProxy.
18015 */
18016
18017 struct _ControlPowerProxyPrivate
18018 {
18019 GData *qdata;
18020 };
18021
18022 static void control_power_proxy_iface_init (ControlPowerIface *iface);
18023
18024 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlPowerProxy,control_power_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ControlPowerProxy)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER,control_power_proxy_iface_init))18025 G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
18026 G_ADD_PRIVATE (ControlPowerProxy)
18027 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init))
18028
18029 #else
18030 G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
18031 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init))
18032
18033 #endif
18034 static void
18035 control_power_proxy_finalize (GObject *object)
18036 {
18037 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
18038 g_datalist_clear (&proxy->priv->qdata);
18039 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
18040 }
18041
18042 static void
control_power_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)18043 control_power_proxy_get_property (GObject *object,
18044 guint prop_id,
18045 GValue *value,
18046 GParamSpec *pspec G_GNUC_UNUSED)
18047 {
18048 const _ExtendedGDBusPropertyInfo *info;
18049 GVariant *variant;
18050 g_assert (prop_id != 0 && prop_id - 1 < 3);
18051 info = (const _ExtendedGDBusPropertyInfo *) _control_power_property_info_pointers[prop_id - 1];
18052 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
18053 if (info->use_gvariant)
18054 {
18055 g_value_set_variant (value, variant);
18056 }
18057 else
18058 {
18059 if (variant != NULL)
18060 g_dbus_gvariant_to_gvalue (variant, value);
18061 }
18062 if (variant != NULL)
18063 g_variant_unref (variant);
18064 }
18065
18066 static void
control_power_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)18067 control_power_proxy_set_property_cb (GDBusProxy *proxy,
18068 GAsyncResult *res,
18069 gpointer user_data)
18070 {
18071 const _ExtendedGDBusPropertyInfo *info = user_data;
18072 GError *error;
18073 GVariant *_ret;
18074 error = NULL;
18075 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
18076 if (!_ret)
18077 {
18078 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
18079 info->parent_struct.name,
18080 error->message, g_quark_to_string (error->domain), error->code);
18081 g_error_free (error);
18082 }
18083 else
18084 {
18085 g_variant_unref (_ret);
18086 }
18087 }
18088
18089 static void
control_power_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)18090 control_power_proxy_set_property (GObject *object,
18091 guint prop_id,
18092 const GValue *value,
18093 GParamSpec *pspec G_GNUC_UNUSED)
18094 {
18095 const _ExtendedGDBusPropertyInfo *info;
18096 GVariant *variant;
18097 g_assert (prop_id != 0 && prop_id - 1 < 3);
18098 info = (const _ExtendedGDBusPropertyInfo *) _control_power_property_info_pointers[prop_id - 1];
18099 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
18100 g_dbus_proxy_call (G_DBUS_PROXY (object),
18101 "org.freedesktop.DBus.Properties.Set",
18102 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
18103 G_DBUS_CALL_FLAGS_NONE,
18104 -1,
18105 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
18106 g_variant_unref (variant);
18107 }
18108
18109 static void
control_power_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)18110 control_power_proxy_g_signal (GDBusProxy *proxy,
18111 const gchar *sender_name G_GNUC_UNUSED,
18112 const gchar *signal_name,
18113 GVariant *parameters)
18114 {
18115 _ExtendedGDBusSignalInfo *info;
18116 GVariantIter iter;
18117 GVariant *child;
18118 GValue *paramv;
18119 gsize num_params;
18120 gsize n;
18121 guint signal_id;
18122 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
18123 if (info == NULL)
18124 return;
18125 num_params = g_variant_n_children (parameters);
18126 paramv = g_new0 (GValue, num_params + 1);
18127 g_value_init (¶mv[0], TYPE_CONTROL_POWER);
18128 g_value_set_object (¶mv[0], proxy);
18129 g_variant_iter_init (&iter, parameters);
18130 n = 1;
18131 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18132 {
18133 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18134 if (arg_info->use_gvariant)
18135 {
18136 g_value_init (¶mv[n], G_TYPE_VARIANT);
18137 g_value_set_variant (¶mv[n], child);
18138 n++;
18139 }
18140 else
18141 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
18142 g_variant_unref (child);
18143 }
18144 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
18145 g_signal_emitv (paramv, signal_id, 0, NULL);
18146 for (n = 0; n < num_params + 1; n++)
18147 g_value_unset (¶mv[n]);
18148 g_free (paramv);
18149 }
18150
18151 static void
control_power_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)18152 control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
18153 GVariant *changed_properties,
18154 const gchar *const *invalidated_properties)
18155 {
18156 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
18157 guint n;
18158 const gchar *key;
18159 GVariantIter *iter;
18160 _ExtendedGDBusPropertyInfo *info;
18161 g_variant_get (changed_properties, "a{sv}", &iter);
18162 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18163 {
18164 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
18165 g_datalist_remove_data (&proxy->priv->qdata, key);
18166 if (info != NULL)
18167 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18168 }
18169 g_variant_iter_free (iter);
18170 for (n = 0; invalidated_properties[n] != NULL; n++)
18171 {
18172 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
18173 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18174 if (info != NULL)
18175 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18176 }
18177 }
18178
18179 static gint
control_power_proxy_get_pgood(ControlPower * object)18180 control_power_proxy_get_pgood (ControlPower *object)
18181 {
18182 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
18183 GVariant *variant;
18184 gint value = 0;
18185 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
18186 if (variant != NULL)
18187 {
18188 value = g_variant_get_int32 (variant);
18189 g_variant_unref (variant);
18190 }
18191 return value;
18192 }
18193
18194 static gint
control_power_proxy_get_state(ControlPower * object)18195 control_power_proxy_get_state (ControlPower *object)
18196 {
18197 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
18198 GVariant *variant;
18199 gint value = 0;
18200 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
18201 if (variant != NULL)
18202 {
18203 value = g_variant_get_int32 (variant);
18204 g_variant_unref (variant);
18205 }
18206 return value;
18207 }
18208
18209 static gint
control_power_proxy_get_pgood_timeout(ControlPower * object)18210 control_power_proxy_get_pgood_timeout (ControlPower *object)
18211 {
18212 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
18213 GVariant *variant;
18214 gint value = 0;
18215 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
18216 if (variant != NULL)
18217 {
18218 value = g_variant_get_int32 (variant);
18219 g_variant_unref (variant);
18220 }
18221 return value;
18222 }
18223
18224 static void
control_power_proxy_init(ControlPowerProxy * proxy)18225 control_power_proxy_init (ControlPowerProxy *proxy)
18226 {
18227 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18228 proxy->priv = control_power_proxy_get_instance_private (proxy);
18229 #else
18230 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
18231 #endif
18232
18233 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
18234 }
18235
18236 static void
control_power_proxy_class_init(ControlPowerProxyClass * klass)18237 control_power_proxy_class_init (ControlPowerProxyClass *klass)
18238 {
18239 GObjectClass *gobject_class;
18240 GDBusProxyClass *proxy_class;
18241
18242 gobject_class = G_OBJECT_CLASS (klass);
18243 gobject_class->finalize = control_power_proxy_finalize;
18244 gobject_class->get_property = control_power_proxy_get_property;
18245 gobject_class->set_property = control_power_proxy_set_property;
18246
18247 proxy_class = G_DBUS_PROXY_CLASS (klass);
18248 proxy_class->g_signal = control_power_proxy_g_signal;
18249 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
18250
18251 control_power_override_properties (gobject_class, 1);
18252
18253 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18254 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
18255 #endif
18256 }
18257
18258 static void
control_power_proxy_iface_init(ControlPowerIface * iface)18259 control_power_proxy_iface_init (ControlPowerIface *iface)
18260 {
18261 iface->get_pgood = control_power_proxy_get_pgood;
18262 iface->get_state = control_power_proxy_get_state;
18263 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
18264 }
18265
18266 /**
18267 * control_power_proxy_new:
18268 * @connection: A #GDBusConnection.
18269 * @flags: Flags from the #GDBusProxyFlags enumeration.
18270 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18271 * @object_path: An object path.
18272 * @cancellable: (nullable): A #GCancellable or %NULL.
18273 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18274 * @user_data: User data to pass to @callback.
18275 *
18276 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new() for more details.
18277 *
18278 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
18279 * You can then call control_power_proxy_new_finish() to get the result of the operation.
18280 *
18281 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
18282 */
18283 void
control_power_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)18284 control_power_proxy_new (
18285 GDBusConnection *connection,
18286 GDBusProxyFlags flags,
18287 const gchar *name,
18288 const gchar *object_path,
18289 GCancellable *cancellable,
18290 GAsyncReadyCallback callback,
18291 gpointer user_data)
18292 {
18293 g_async_initable_new_async (TYPE_CONTROL_POWER_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.control.Power", NULL);
18294 }
18295
18296 /**
18297 * control_power_proxy_new_finish:
18298 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
18299 * @error: Return location for error or %NULL
18300 *
18301 * Finishes an operation started with control_power_proxy_new().
18302 *
18303 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18304 */
18305 ControlPower *
control_power_proxy_new_finish(GAsyncResult * res,GError ** error)18306 control_power_proxy_new_finish (
18307 GAsyncResult *res,
18308 GError **error)
18309 {
18310 GObject *ret;
18311 GObject *source_object;
18312 source_object = g_async_result_get_source_object (res);
18313 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18314 g_object_unref (source_object);
18315 if (ret != NULL)
18316 return CONTROL_POWER (ret);
18317 else
18318 return NULL;
18319 }
18320
18321 /**
18322 * control_power_proxy_new_sync:
18323 * @connection: A #GDBusConnection.
18324 * @flags: Flags from the #GDBusProxyFlags enumeration.
18325 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18326 * @object_path: An object path.
18327 * @cancellable: (nullable): A #GCancellable or %NULL.
18328 * @error: Return location for error or %NULL
18329 *
18330 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new_sync() for more details.
18331 *
18332 * The calling thread is blocked until a reply is received.
18333 *
18334 * See control_power_proxy_new() for the asynchronous version of this constructor.
18335 *
18336 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18337 */
18338 ControlPower *
control_power_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)18339 control_power_proxy_new_sync (
18340 GDBusConnection *connection,
18341 GDBusProxyFlags flags,
18342 const gchar *name,
18343 const gchar *object_path,
18344 GCancellable *cancellable,
18345 GError **error)
18346 {
18347 GInitable *ret;
18348 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
18349 if (ret != NULL)
18350 return CONTROL_POWER (ret);
18351 else
18352 return NULL;
18353 }
18354
18355
18356 /**
18357 * control_power_proxy_new_for_bus:
18358 * @bus_type: A #GBusType.
18359 * @flags: Flags from the #GDBusProxyFlags enumeration.
18360 * @name: A bus name (well-known or unique).
18361 * @object_path: An object path.
18362 * @cancellable: (nullable): A #GCancellable or %NULL.
18363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18364 * @user_data: User data to pass to @callback.
18365 *
18366 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18367 *
18368 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
18369 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
18370 *
18371 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18372 */
18373 void
control_power_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)18374 control_power_proxy_new_for_bus (
18375 GBusType bus_type,
18376 GDBusProxyFlags flags,
18377 const gchar *name,
18378 const gchar *object_path,
18379 GCancellable *cancellable,
18380 GAsyncReadyCallback callback,
18381 gpointer user_data)
18382 {
18383 g_async_initable_new_async (TYPE_CONTROL_POWER_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.control.Power", NULL);
18384 }
18385
18386 /**
18387 * control_power_proxy_new_for_bus_finish:
18388 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
18389 * @error: Return location for error or %NULL
18390 *
18391 * Finishes an operation started with control_power_proxy_new_for_bus().
18392 *
18393 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18394 */
18395 ControlPower *
control_power_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)18396 control_power_proxy_new_for_bus_finish (
18397 GAsyncResult *res,
18398 GError **error)
18399 {
18400 GObject *ret;
18401 GObject *source_object;
18402 source_object = g_async_result_get_source_object (res);
18403 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18404 g_object_unref (source_object);
18405 if (ret != NULL)
18406 return CONTROL_POWER (ret);
18407 else
18408 return NULL;
18409 }
18410
18411 /**
18412 * control_power_proxy_new_for_bus_sync:
18413 * @bus_type: A #GBusType.
18414 * @flags: Flags from the #GDBusProxyFlags enumeration.
18415 * @name: A bus name (well-known or unique).
18416 * @object_path: An object path.
18417 * @cancellable: (nullable): A #GCancellable or %NULL.
18418 * @error: Return location for error or %NULL
18419 *
18420 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18421 *
18422 * The calling thread is blocked until a reply is received.
18423 *
18424 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
18425 *
18426 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18427 */
18428 ControlPower *
control_power_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)18429 control_power_proxy_new_for_bus_sync (
18430 GBusType bus_type,
18431 GDBusProxyFlags flags,
18432 const gchar *name,
18433 const gchar *object_path,
18434 GCancellable *cancellable,
18435 GError **error)
18436 {
18437 GInitable *ret;
18438 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
18439 if (ret != NULL)
18440 return CONTROL_POWER (ret);
18441 else
18442 return NULL;
18443 }
18444
18445
18446 /* ------------------------------------------------------------------------ */
18447
18448 /**
18449 * ControlPowerSkeleton:
18450 *
18451 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
18452 */
18453
18454 /**
18455 * ControlPowerSkeletonClass:
18456 * @parent_class: The parent class.
18457 *
18458 * Class structure for #ControlPowerSkeleton.
18459 */
18460
18461 struct _ControlPowerSkeletonPrivate
18462 {
18463 GValue *properties;
18464 GList *changed_properties;
18465 GSource *changed_properties_idle_source;
18466 GMainContext *context;
18467 GMutex lock;
18468 };
18469
18470 static void
_control_power_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)18471 _control_power_skeleton_handle_method_call (
18472 GDBusConnection *connection G_GNUC_UNUSED,
18473 const gchar *sender G_GNUC_UNUSED,
18474 const gchar *object_path G_GNUC_UNUSED,
18475 const gchar *interface_name,
18476 const gchar *method_name,
18477 GVariant *parameters,
18478 GDBusMethodInvocation *invocation,
18479 gpointer user_data)
18480 {
18481 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18482 _ExtendedGDBusMethodInfo *info;
18483 GVariantIter iter;
18484 GVariant *child;
18485 GValue *paramv;
18486 gsize num_params;
18487 guint num_extra;
18488 gsize n;
18489 guint signal_id;
18490 GValue return_value = G_VALUE_INIT;
18491 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18492 g_assert (info != NULL);
18493 num_params = g_variant_n_children (parameters);
18494 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18495 n = 0;
18496 g_value_init (¶mv[n], TYPE_CONTROL_POWER);
18497 g_value_set_object (¶mv[n++], skeleton);
18498 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18499 g_value_set_object (¶mv[n++], invocation);
18500 if (info->pass_fdlist)
18501 {
18502 #ifdef G_OS_UNIX
18503 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
18504 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18505 #else
18506 g_assert_not_reached ();
18507 #endif
18508 }
18509 g_variant_iter_init (&iter, parameters);
18510 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18511 {
18512 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18513 if (arg_info->use_gvariant)
18514 {
18515 g_value_init (¶mv[n], G_TYPE_VARIANT);
18516 g_value_set_variant (¶mv[n], child);
18517 n++;
18518 }
18519 else
18520 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
18521 g_variant_unref (child);
18522 }
18523 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
18524 g_value_init (&return_value, G_TYPE_BOOLEAN);
18525 g_signal_emitv (paramv, signal_id, 0, &return_value);
18526 if (!g_value_get_boolean (&return_value))
18527 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);
18528 g_value_unset (&return_value);
18529 for (n = 0; n < num_params + num_extra; n++)
18530 g_value_unset (¶mv[n]);
18531 g_free (paramv);
18532 }
18533
18534 static GVariant *
_control_power_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)18535 _control_power_skeleton_handle_get_property (
18536 GDBusConnection *connection G_GNUC_UNUSED,
18537 const gchar *sender G_GNUC_UNUSED,
18538 const gchar *object_path G_GNUC_UNUSED,
18539 const gchar *interface_name G_GNUC_UNUSED,
18540 const gchar *property_name,
18541 GError **error,
18542 gpointer user_data)
18543 {
18544 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18545 GValue value = G_VALUE_INIT;
18546 GParamSpec *pspec;
18547 _ExtendedGDBusPropertyInfo *info;
18548 GVariant *ret;
18549 ret = NULL;
18550 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18551 g_assert (info != NULL);
18552 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18553 if (pspec == NULL)
18554 {
18555 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18556 }
18557 else
18558 {
18559 g_value_init (&value, pspec->value_type);
18560 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18561 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18562 g_value_unset (&value);
18563 }
18564 return ret;
18565 }
18566
18567 static gboolean
_control_power_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)18568 _control_power_skeleton_handle_set_property (
18569 GDBusConnection *connection G_GNUC_UNUSED,
18570 const gchar *sender G_GNUC_UNUSED,
18571 const gchar *object_path G_GNUC_UNUSED,
18572 const gchar *interface_name G_GNUC_UNUSED,
18573 const gchar *property_name,
18574 GVariant *variant,
18575 GError **error,
18576 gpointer user_data)
18577 {
18578 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18579 GValue value = G_VALUE_INIT;
18580 GParamSpec *pspec;
18581 _ExtendedGDBusPropertyInfo *info;
18582 gboolean ret;
18583 ret = FALSE;
18584 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18585 g_assert (info != NULL);
18586 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18587 if (pspec == NULL)
18588 {
18589 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18590 }
18591 else
18592 {
18593 if (info->use_gvariant)
18594 g_value_set_variant (&value, variant);
18595 else
18596 g_dbus_gvariant_to_gvalue (variant, &value);
18597 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18598 g_value_unset (&value);
18599 ret = TRUE;
18600 }
18601 return ret;
18602 }
18603
18604 static const GDBusInterfaceVTable _control_power_skeleton_vtable =
18605 {
18606 _control_power_skeleton_handle_method_call,
18607 _control_power_skeleton_handle_get_property,
18608 _control_power_skeleton_handle_set_property,
18609 {NULL}
18610 };
18611
18612 static GDBusInterfaceInfo *
control_power_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)18613 control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18614 {
18615 return control_power_interface_info ();
18616 }
18617
18618 static GDBusInterfaceVTable *
control_power_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)18619 control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18620 {
18621 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
18622 }
18623
18624 static GVariant *
control_power_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)18625 control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18626 {
18627 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18628
18629 GVariantBuilder builder;
18630 guint n;
18631 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18632 if (_control_power_interface_info.parent_struct.properties == NULL)
18633 goto out;
18634 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
18635 {
18636 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
18637 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18638 {
18639 GVariant *value;
18640 value = _control_power_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.control.Power", info->name, NULL, skeleton);
18641 if (value != NULL)
18642 {
18643 g_variant_take_ref (value);
18644 g_variant_builder_add (&builder, "{sv}", info->name, value);
18645 g_variant_unref (value);
18646 }
18647 }
18648 }
18649 out:
18650 return g_variant_builder_end (&builder);
18651 }
18652
18653 static gboolean _control_power_emit_changed (gpointer user_data);
18654
18655 static void
control_power_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)18656 control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18657 {
18658 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18659 gboolean emit_changed = FALSE;
18660
18661 g_mutex_lock (&skeleton->priv->lock);
18662 if (skeleton->priv->changed_properties_idle_source != NULL)
18663 {
18664 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18665 skeleton->priv->changed_properties_idle_source = NULL;
18666 emit_changed = TRUE;
18667 }
18668 g_mutex_unlock (&skeleton->priv->lock);
18669
18670 if (emit_changed)
18671 _control_power_emit_changed (skeleton);
18672 }
18673
18674 static void
_control_power_on_signal_power_good(ControlPower * object)18675 _control_power_on_signal_power_good (
18676 ControlPower *object)
18677 {
18678 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18679
18680 GList *connections, *l;
18681 GVariant *signal_variant;
18682 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18683
18684 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18685 for (l = connections; l != NULL; l = l->next)
18686 {
18687 GDBusConnection *connection = l->data;
18688 g_dbus_connection_emit_signal (connection,
18689 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
18690 signal_variant, NULL);
18691 }
18692 g_variant_unref (signal_variant);
18693 g_list_free_full (connections, g_object_unref);
18694 }
18695
18696 static void
_control_power_on_signal_power_lost(ControlPower * object)18697 _control_power_on_signal_power_lost (
18698 ControlPower *object)
18699 {
18700 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18701
18702 GList *connections, *l;
18703 GVariant *signal_variant;
18704 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18705
18706 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18707 for (l = connections; l != NULL; l = l->next)
18708 {
18709 GDBusConnection *connection = l->data;
18710 g_dbus_connection_emit_signal (connection,
18711 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
18712 signal_variant, NULL);
18713 }
18714 g_variant_unref (signal_variant);
18715 g_list_free_full (connections, g_object_unref);
18716 }
18717
18718 static void control_power_skeleton_iface_init (ControlPowerIface *iface);
18719 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlPowerSkeleton,control_power_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ControlPowerSkeleton)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER,control_power_skeleton_iface_init))18720 G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18721 G_ADD_PRIVATE (ControlPowerSkeleton)
18722 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init))
18723
18724 #else
18725 G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18726 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init))
18727
18728 #endif
18729 static void
18730 control_power_skeleton_finalize (GObject *object)
18731 {
18732 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18733 guint n;
18734 for (n = 0; n < 3; n++)
18735 g_value_unset (&skeleton->priv->properties[n]);
18736 g_free (skeleton->priv->properties);
18737 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18738 if (skeleton->priv->changed_properties_idle_source != NULL)
18739 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18740 g_main_context_unref (skeleton->priv->context);
18741 g_mutex_clear (&skeleton->priv->lock);
18742 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
18743 }
18744
18745 static void
control_power_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)18746 control_power_skeleton_get_property (GObject *object,
18747 guint prop_id,
18748 GValue *value,
18749 GParamSpec *pspec G_GNUC_UNUSED)
18750 {
18751 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18752 g_assert (prop_id != 0 && prop_id - 1 < 3);
18753 g_mutex_lock (&skeleton->priv->lock);
18754 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18755 g_mutex_unlock (&skeleton->priv->lock);
18756 }
18757
18758 static gboolean
_control_power_emit_changed(gpointer user_data)18759 _control_power_emit_changed (gpointer user_data)
18760 {
18761 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18762 GList *l;
18763 GVariantBuilder builder;
18764 GVariantBuilder invalidated_builder;
18765 guint num_changes;
18766
18767 g_mutex_lock (&skeleton->priv->lock);
18768 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18769 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18770 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18771 {
18772 ChangedProperty *cp = l->data;
18773 GVariant *variant;
18774 const GValue *cur_value;
18775
18776 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18777 if (!_g_value_equal (cur_value, &cp->orig_value))
18778 {
18779 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18780 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18781 g_variant_unref (variant);
18782 num_changes++;
18783 }
18784 }
18785 if (num_changes > 0)
18786 {
18787 GList *connections, *ll;
18788 GVariant *signal_variant;
18789 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
18790 &builder, &invalidated_builder));
18791 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18792 for (ll = connections; ll != NULL; ll = ll->next)
18793 {
18794 GDBusConnection *connection = ll->data;
18795
18796 g_dbus_connection_emit_signal (connection,
18797 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18798 "org.freedesktop.DBus.Properties",
18799 "PropertiesChanged",
18800 signal_variant,
18801 NULL);
18802 }
18803 g_variant_unref (signal_variant);
18804 g_list_free_full (connections, g_object_unref);
18805 }
18806 else
18807 {
18808 g_variant_builder_clear (&builder);
18809 g_variant_builder_clear (&invalidated_builder);
18810 }
18811 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18812 skeleton->priv->changed_properties = NULL;
18813 skeleton->priv->changed_properties_idle_source = NULL;
18814 g_mutex_unlock (&skeleton->priv->lock);
18815 return FALSE;
18816 }
18817
18818 static void
_control_power_schedule_emit_changed(ControlPowerSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)18819 _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18820 {
18821 ChangedProperty *cp;
18822 GList *l;
18823 cp = NULL;
18824 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18825 {
18826 ChangedProperty *i_cp = l->data;
18827 if (i_cp->info == info)
18828 {
18829 cp = i_cp;
18830 break;
18831 }
18832 }
18833 if (cp == NULL)
18834 {
18835 cp = g_new0 (ChangedProperty, 1);
18836 cp->prop_id = prop_id;
18837 cp->info = info;
18838 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18839 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18840 g_value_copy (orig_value, &cp->orig_value);
18841 }
18842 }
18843
18844 static void
control_power_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)18845 control_power_skeleton_notify (GObject *object,
18846 GParamSpec *pspec G_GNUC_UNUSED)
18847 {
18848 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18849 g_mutex_lock (&skeleton->priv->lock);
18850 if (skeleton->priv->changed_properties != NULL &&
18851 skeleton->priv->changed_properties_idle_source == NULL)
18852 {
18853 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18854 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18855 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
18856 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed");
18857 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18858 g_source_unref (skeleton->priv->changed_properties_idle_source);
18859 }
18860 g_mutex_unlock (&skeleton->priv->lock);
18861 }
18862
18863 static void
control_power_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)18864 control_power_skeleton_set_property (GObject *object,
18865 guint prop_id,
18866 const GValue *value,
18867 GParamSpec *pspec)
18868 {
18869 const _ExtendedGDBusPropertyInfo *info;
18870 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18871 g_assert (prop_id != 0 && prop_id - 1 < 3);
18872 info = (const _ExtendedGDBusPropertyInfo *) _control_power_property_info_pointers[prop_id - 1];
18873 g_mutex_lock (&skeleton->priv->lock);
18874 g_object_freeze_notify (object);
18875 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18876 {
18877 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
18878 info->emits_changed_signal)
18879 _control_power_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
18880 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18881 g_object_notify_by_pspec (object, pspec);
18882 }
18883 g_mutex_unlock (&skeleton->priv->lock);
18884 g_object_thaw_notify (object);
18885 }
18886
18887 static void
control_power_skeleton_init(ControlPowerSkeleton * skeleton)18888 control_power_skeleton_init (ControlPowerSkeleton *skeleton)
18889 {
18890 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18891 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
18892 #else
18893 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
18894 #endif
18895
18896 g_mutex_init (&skeleton->priv->lock);
18897 skeleton->priv->context = g_main_context_ref_thread_default ();
18898 skeleton->priv->properties = g_new0 (GValue, 3);
18899 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
18900 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
18901 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
18902 }
18903
18904 static gint
control_power_skeleton_get_pgood(ControlPower * object)18905 control_power_skeleton_get_pgood (ControlPower *object)
18906 {
18907 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18908 gint value;
18909 g_mutex_lock (&skeleton->priv->lock);
18910 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
18911 g_mutex_unlock (&skeleton->priv->lock);
18912 return value;
18913 }
18914
18915 static gint
control_power_skeleton_get_state(ControlPower * object)18916 control_power_skeleton_get_state (ControlPower *object)
18917 {
18918 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18919 gint value;
18920 g_mutex_lock (&skeleton->priv->lock);
18921 value = g_marshal_value_peek_int (&(skeleton->priv->properties[1]));
18922 g_mutex_unlock (&skeleton->priv->lock);
18923 return value;
18924 }
18925
18926 static gint
control_power_skeleton_get_pgood_timeout(ControlPower * object)18927 control_power_skeleton_get_pgood_timeout (ControlPower *object)
18928 {
18929 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18930 gint value;
18931 g_mutex_lock (&skeleton->priv->lock);
18932 value = g_marshal_value_peek_int (&(skeleton->priv->properties[2]));
18933 g_mutex_unlock (&skeleton->priv->lock);
18934 return value;
18935 }
18936
18937 static void
control_power_skeleton_class_init(ControlPowerSkeletonClass * klass)18938 control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
18939 {
18940 GObjectClass *gobject_class;
18941 GDBusInterfaceSkeletonClass *skeleton_class;
18942
18943 gobject_class = G_OBJECT_CLASS (klass);
18944 gobject_class->finalize = control_power_skeleton_finalize;
18945 gobject_class->get_property = control_power_skeleton_get_property;
18946 gobject_class->set_property = control_power_skeleton_set_property;
18947 gobject_class->notify = control_power_skeleton_notify;
18948
18949
18950 control_power_override_properties (gobject_class, 1);
18951
18952 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18953 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
18954 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
18955 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
18956 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
18957
18958 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18959 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
18960 #endif
18961 }
18962
18963 static void
control_power_skeleton_iface_init(ControlPowerIface * iface)18964 control_power_skeleton_iface_init (ControlPowerIface *iface)
18965 {
18966 iface->power_good = _control_power_on_signal_power_good;
18967 iface->power_lost = _control_power_on_signal_power_lost;
18968 iface->get_pgood = control_power_skeleton_get_pgood;
18969 iface->get_state = control_power_skeleton_get_state;
18970 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
18971 }
18972
18973 /**
18974 * control_power_skeleton_new:
18975 *
18976 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
18977 *
18978 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
18979 */
18980 ControlPower *
control_power_skeleton_new(void)18981 control_power_skeleton_new (void)
18982 {
18983 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
18984 }
18985
18986 /* ------------------------------------------------------------------------
18987 * Code for interface org.openbmc.control.Checkstop
18988 * ------------------------------------------------------------------------
18989 */
18990
18991 /**
18992 * SECTION:ControlCheckstop
18993 * @title: ControlCheckstop
18994 * @short_description: Generated C code for the org.openbmc.control.Checkstop D-Bus interface
18995 *
18996 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface in C.
18997 */
18998
18999 /* ---- Introspection data for org.openbmc.control.Checkstop ---- */
19000
19001 static const _ExtendedGDBusInterfaceInfo _control_checkstop_interface_info =
19002 {
19003 {
19004 -1,
19005 (gchar *) "org.openbmc.control.Checkstop",
19006 NULL,
19007 NULL,
19008 NULL,
19009 NULL
19010 },
19011 "control-checkstop",
19012 };
19013
19014
19015 /**
19016 * control_checkstop_interface_info:
19017 *
19018 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface.
19019 *
19020 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19021 */
19022 GDBusInterfaceInfo *
control_checkstop_interface_info(void)19023 control_checkstop_interface_info (void)
19024 {
19025 return (GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct;
19026 }
19027
19028 /**
19029 * control_checkstop_override_properties:
19030 * @klass: The class structure for a #GObject derived class.
19031 * @property_id_begin: The property id to assign to the first overridden property.
19032 *
19033 * Overrides all #GObject properties in the #ControlCheckstop interface for a concrete class.
19034 * The properties are overridden in the order they are defined.
19035 *
19036 * Returns: The last property id.
19037 */
19038 guint
control_checkstop_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)19039 control_checkstop_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
19040 {
19041 return property_id_begin - 1;
19042 }
19043
19044
19045
19046 /**
19047 * ControlCheckstop:
19048 *
19049 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
19050 */
19051
19052 /**
19053 * ControlCheckstopIface:
19054 * @parent_iface: The parent interface.
19055 *
19056 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
19057 */
19058
19059 typedef ControlCheckstopIface ControlCheckstopInterface;
G_DEFINE_INTERFACE(ControlCheckstop,control_checkstop,G_TYPE_OBJECT)19060 G_DEFINE_INTERFACE (ControlCheckstop, control_checkstop, G_TYPE_OBJECT)
19061
19062 static void
19063 control_checkstop_default_init (ControlCheckstopIface *iface G_GNUC_UNUSED)
19064 {
19065 }
19066
19067 /* ------------------------------------------------------------------------ */
19068
19069 /**
19070 * ControlCheckstopProxy:
19071 *
19072 * The #ControlCheckstopProxy structure contains only private data and should only be accessed using the provided API.
19073 */
19074
19075 /**
19076 * ControlCheckstopProxyClass:
19077 * @parent_class: The parent class.
19078 *
19079 * Class structure for #ControlCheckstopProxy.
19080 */
19081
19082 struct _ControlCheckstopProxyPrivate
19083 {
19084 GData *qdata;
19085 };
19086
19087 static void control_checkstop_proxy_iface_init (ControlCheckstopIface *iface);
19088
19089 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlCheckstopProxy,control_checkstop_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ControlCheckstopProxy)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP,control_checkstop_proxy_iface_init))19090 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
19091 G_ADD_PRIVATE (ControlCheckstopProxy)
19092 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init))
19093
19094 #else
19095 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
19096 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init))
19097
19098 #endif
19099 static void
19100 control_checkstop_proxy_finalize (GObject *object)
19101 {
19102 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (object);
19103 g_datalist_clear (&proxy->priv->qdata);
19104 G_OBJECT_CLASS (control_checkstop_proxy_parent_class)->finalize (object);
19105 }
19106
19107 static void
control_checkstop_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)19108 control_checkstop_proxy_get_property (GObject *object G_GNUC_UNUSED,
19109 guint prop_id G_GNUC_UNUSED,
19110 GValue *value G_GNUC_UNUSED,
19111 GParamSpec *pspec G_GNUC_UNUSED)
19112 {
19113 }
19114
19115 static void
control_checkstop_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)19116 control_checkstop_proxy_set_property (GObject *object G_GNUC_UNUSED,
19117 guint prop_id G_GNUC_UNUSED,
19118 const GValue *value G_GNUC_UNUSED,
19119 GParamSpec *pspec G_GNUC_UNUSED)
19120 {
19121 }
19122
19123 static void
control_checkstop_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)19124 control_checkstop_proxy_g_signal (GDBusProxy *proxy,
19125 const gchar *sender_name G_GNUC_UNUSED,
19126 const gchar *signal_name,
19127 GVariant *parameters)
19128 {
19129 _ExtendedGDBusSignalInfo *info;
19130 GVariantIter iter;
19131 GVariant *child;
19132 GValue *paramv;
19133 gsize num_params;
19134 gsize n;
19135 guint signal_id;
19136 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, signal_name);
19137 if (info == NULL)
19138 return;
19139 num_params = g_variant_n_children (parameters);
19140 paramv = g_new0 (GValue, num_params + 1);
19141 g_value_init (¶mv[0], TYPE_CONTROL_CHECKSTOP);
19142 g_value_set_object (¶mv[0], proxy);
19143 g_variant_iter_init (&iter, parameters);
19144 n = 1;
19145 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19146 {
19147 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19148 if (arg_info->use_gvariant)
19149 {
19150 g_value_init (¶mv[n], G_TYPE_VARIANT);
19151 g_value_set_variant (¶mv[n], child);
19152 n++;
19153 }
19154 else
19155 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
19156 g_variant_unref (child);
19157 }
19158 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
19159 g_signal_emitv (paramv, signal_id, 0, NULL);
19160 for (n = 0; n < num_params + 1; n++)
19161 g_value_unset (¶mv[n]);
19162 g_free (paramv);
19163 }
19164
19165 static void
control_checkstop_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)19166 control_checkstop_proxy_g_properties_changed (GDBusProxy *_proxy,
19167 GVariant *changed_properties,
19168 const gchar *const *invalidated_properties)
19169 {
19170 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (_proxy);
19171 guint n;
19172 const gchar *key;
19173 GVariantIter *iter;
19174 _ExtendedGDBusPropertyInfo *info;
19175 g_variant_get (changed_properties, "a{sv}", &iter);
19176 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19177 {
19178 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, key);
19179 g_datalist_remove_data (&proxy->priv->qdata, key);
19180 if (info != NULL)
19181 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19182 }
19183 g_variant_iter_free (iter);
19184 for (n = 0; invalidated_properties[n] != NULL; n++)
19185 {
19186 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, invalidated_properties[n]);
19187 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19188 if (info != NULL)
19189 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19190 }
19191 }
19192
19193 static void
control_checkstop_proxy_init(ControlCheckstopProxy * proxy)19194 control_checkstop_proxy_init (ControlCheckstopProxy *proxy)
19195 {
19196 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19197 proxy->priv = control_checkstop_proxy_get_instance_private (proxy);
19198 #else
19199 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_CHECKSTOP_PROXY, ControlCheckstopProxyPrivate);
19200 #endif
19201
19202 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_checkstop_interface_info ());
19203 }
19204
19205 static void
control_checkstop_proxy_class_init(ControlCheckstopProxyClass * klass)19206 control_checkstop_proxy_class_init (ControlCheckstopProxyClass *klass)
19207 {
19208 GObjectClass *gobject_class;
19209 GDBusProxyClass *proxy_class;
19210
19211 gobject_class = G_OBJECT_CLASS (klass);
19212 gobject_class->finalize = control_checkstop_proxy_finalize;
19213 gobject_class->get_property = control_checkstop_proxy_get_property;
19214 gobject_class->set_property = control_checkstop_proxy_set_property;
19215
19216 proxy_class = G_DBUS_PROXY_CLASS (klass);
19217 proxy_class->g_signal = control_checkstop_proxy_g_signal;
19218 proxy_class->g_properties_changed = control_checkstop_proxy_g_properties_changed;
19219
19220 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19221 g_type_class_add_private (klass, sizeof (ControlCheckstopProxyPrivate));
19222 #endif
19223 }
19224
19225 static void
control_checkstop_proxy_iface_init(ControlCheckstopIface * iface G_GNUC_UNUSED)19226 control_checkstop_proxy_iface_init (ControlCheckstopIface *iface G_GNUC_UNUSED)
19227 {
19228 }
19229
19230 /**
19231 * control_checkstop_proxy_new:
19232 * @connection: A #GDBusConnection.
19233 * @flags: Flags from the #GDBusProxyFlags enumeration.
19234 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19235 * @object_path: An object path.
19236 * @cancellable: (nullable): A #GCancellable or %NULL.
19237 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19238 * @user_data: User data to pass to @callback.
19239 *
19240 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new() for more details.
19241 *
19242 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
19243 * You can then call control_checkstop_proxy_new_finish() to get the result of the operation.
19244 *
19245 * See control_checkstop_proxy_new_sync() for the synchronous, blocking version of this constructor.
19246 */
19247 void
control_checkstop_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)19248 control_checkstop_proxy_new (
19249 GDBusConnection *connection,
19250 GDBusProxyFlags flags,
19251 const gchar *name,
19252 const gchar *object_path,
19253 GCancellable *cancellable,
19254 GAsyncReadyCallback callback,
19255 gpointer user_data)
19256 {
19257 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_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.control.Checkstop", NULL);
19258 }
19259
19260 /**
19261 * control_checkstop_proxy_new_finish:
19262 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new().
19263 * @error: Return location for error or %NULL
19264 *
19265 * Finishes an operation started with control_checkstop_proxy_new().
19266 *
19267 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
19268 */
19269 ControlCheckstop *
control_checkstop_proxy_new_finish(GAsyncResult * res,GError ** error)19270 control_checkstop_proxy_new_finish (
19271 GAsyncResult *res,
19272 GError **error)
19273 {
19274 GObject *ret;
19275 GObject *source_object;
19276 source_object = g_async_result_get_source_object (res);
19277 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19278 g_object_unref (source_object);
19279 if (ret != NULL)
19280 return CONTROL_CHECKSTOP (ret);
19281 else
19282 return NULL;
19283 }
19284
19285 /**
19286 * control_checkstop_proxy_new_sync:
19287 * @connection: A #GDBusConnection.
19288 * @flags: Flags from the #GDBusProxyFlags enumeration.
19289 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19290 * @object_path: An object path.
19291 * @cancellable: (nullable): A #GCancellable or %NULL.
19292 * @error: Return location for error or %NULL
19293 *
19294 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new_sync() for more details.
19295 *
19296 * The calling thread is blocked until a reply is received.
19297 *
19298 * See control_checkstop_proxy_new() for the asynchronous version of this constructor.
19299 *
19300 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
19301 */
19302 ControlCheckstop *
control_checkstop_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)19303 control_checkstop_proxy_new_sync (
19304 GDBusConnection *connection,
19305 GDBusProxyFlags flags,
19306 const gchar *name,
19307 const gchar *object_path,
19308 GCancellable *cancellable,
19309 GError **error)
19310 {
19311 GInitable *ret;
19312 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
19313 if (ret != NULL)
19314 return CONTROL_CHECKSTOP (ret);
19315 else
19316 return NULL;
19317 }
19318
19319
19320 /**
19321 * control_checkstop_proxy_new_for_bus:
19322 * @bus_type: A #GBusType.
19323 * @flags: Flags from the #GDBusProxyFlags enumeration.
19324 * @name: A bus name (well-known or unique).
19325 * @object_path: An object path.
19326 * @cancellable: (nullable): A #GCancellable or %NULL.
19327 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19328 * @user_data: User data to pass to @callback.
19329 *
19330 * Like control_checkstop_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19331 *
19332 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
19333 * You can then call control_checkstop_proxy_new_for_bus_finish() to get the result of the operation.
19334 *
19335 * See control_checkstop_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19336 */
19337 void
control_checkstop_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)19338 control_checkstop_proxy_new_for_bus (
19339 GBusType bus_type,
19340 GDBusProxyFlags flags,
19341 const gchar *name,
19342 const gchar *object_path,
19343 GCancellable *cancellable,
19344 GAsyncReadyCallback callback,
19345 gpointer user_data)
19346 {
19347 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_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.control.Checkstop", NULL);
19348 }
19349
19350 /**
19351 * control_checkstop_proxy_new_for_bus_finish:
19352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new_for_bus().
19353 * @error: Return location for error or %NULL
19354 *
19355 * Finishes an operation started with control_checkstop_proxy_new_for_bus().
19356 *
19357 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
19358 */
19359 ControlCheckstop *
control_checkstop_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)19360 control_checkstop_proxy_new_for_bus_finish (
19361 GAsyncResult *res,
19362 GError **error)
19363 {
19364 GObject *ret;
19365 GObject *source_object;
19366 source_object = g_async_result_get_source_object (res);
19367 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19368 g_object_unref (source_object);
19369 if (ret != NULL)
19370 return CONTROL_CHECKSTOP (ret);
19371 else
19372 return NULL;
19373 }
19374
19375 /**
19376 * control_checkstop_proxy_new_for_bus_sync:
19377 * @bus_type: A #GBusType.
19378 * @flags: Flags from the #GDBusProxyFlags enumeration.
19379 * @name: A bus name (well-known or unique).
19380 * @object_path: An object path.
19381 * @cancellable: (nullable): A #GCancellable or %NULL.
19382 * @error: Return location for error or %NULL
19383 *
19384 * Like control_checkstop_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19385 *
19386 * The calling thread is blocked until a reply is received.
19387 *
19388 * See control_checkstop_proxy_new_for_bus() for the asynchronous version of this constructor.
19389 *
19390 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
19391 */
19392 ControlCheckstop *
control_checkstop_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)19393 control_checkstop_proxy_new_for_bus_sync (
19394 GBusType bus_type,
19395 GDBusProxyFlags flags,
19396 const gchar *name,
19397 const gchar *object_path,
19398 GCancellable *cancellable,
19399 GError **error)
19400 {
19401 GInitable *ret;
19402 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
19403 if (ret != NULL)
19404 return CONTROL_CHECKSTOP (ret);
19405 else
19406 return NULL;
19407 }
19408
19409
19410 /* ------------------------------------------------------------------------ */
19411
19412 /**
19413 * ControlCheckstopSkeleton:
19414 *
19415 * The #ControlCheckstopSkeleton structure contains only private data and should only be accessed using the provided API.
19416 */
19417
19418 /**
19419 * ControlCheckstopSkeletonClass:
19420 * @parent_class: The parent class.
19421 *
19422 * Class structure for #ControlCheckstopSkeleton.
19423 */
19424
19425 struct _ControlCheckstopSkeletonPrivate
19426 {
19427 GValue *properties;
19428 GList *changed_properties;
19429 GSource *changed_properties_idle_source;
19430 GMainContext *context;
19431 GMutex lock;
19432 };
19433
19434 static void
_control_checkstop_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)19435 _control_checkstop_skeleton_handle_method_call (
19436 GDBusConnection *connection G_GNUC_UNUSED,
19437 const gchar *sender G_GNUC_UNUSED,
19438 const gchar *object_path G_GNUC_UNUSED,
19439 const gchar *interface_name,
19440 const gchar *method_name,
19441 GVariant *parameters,
19442 GDBusMethodInvocation *invocation,
19443 gpointer user_data)
19444 {
19445 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19446 _ExtendedGDBusMethodInfo *info;
19447 GVariantIter iter;
19448 GVariant *child;
19449 GValue *paramv;
19450 gsize num_params;
19451 guint num_extra;
19452 gsize n;
19453 guint signal_id;
19454 GValue return_value = G_VALUE_INIT;
19455 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19456 g_assert (info != NULL);
19457 num_params = g_variant_n_children (parameters);
19458 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19459 n = 0;
19460 g_value_init (¶mv[n], TYPE_CONTROL_CHECKSTOP);
19461 g_value_set_object (¶mv[n++], skeleton);
19462 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19463 g_value_set_object (¶mv[n++], invocation);
19464 if (info->pass_fdlist)
19465 {
19466 #ifdef G_OS_UNIX
19467 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
19468 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19469 #else
19470 g_assert_not_reached ();
19471 #endif
19472 }
19473 g_variant_iter_init (&iter, parameters);
19474 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19475 {
19476 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19477 if (arg_info->use_gvariant)
19478 {
19479 g_value_init (¶mv[n], G_TYPE_VARIANT);
19480 g_value_set_variant (¶mv[n], child);
19481 n++;
19482 }
19483 else
19484 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
19485 g_variant_unref (child);
19486 }
19487 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
19488 g_value_init (&return_value, G_TYPE_BOOLEAN);
19489 g_signal_emitv (paramv, signal_id, 0, &return_value);
19490 if (!g_value_get_boolean (&return_value))
19491 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);
19492 g_value_unset (&return_value);
19493 for (n = 0; n < num_params + num_extra; n++)
19494 g_value_unset (¶mv[n]);
19495 g_free (paramv);
19496 }
19497
19498 static GVariant *
_control_checkstop_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)19499 _control_checkstop_skeleton_handle_get_property (
19500 GDBusConnection *connection G_GNUC_UNUSED,
19501 const gchar *sender G_GNUC_UNUSED,
19502 const gchar *object_path G_GNUC_UNUSED,
19503 const gchar *interface_name G_GNUC_UNUSED,
19504 const gchar *property_name,
19505 GError **error,
19506 gpointer user_data)
19507 {
19508 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19509 GValue value = G_VALUE_INIT;
19510 GParamSpec *pspec;
19511 _ExtendedGDBusPropertyInfo *info;
19512 GVariant *ret;
19513 ret = NULL;
19514 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
19515 g_assert (info != NULL);
19516 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19517 if (pspec == NULL)
19518 {
19519 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19520 }
19521 else
19522 {
19523 g_value_init (&value, pspec->value_type);
19524 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19525 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19526 g_value_unset (&value);
19527 }
19528 return ret;
19529 }
19530
19531 static gboolean
_control_checkstop_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)19532 _control_checkstop_skeleton_handle_set_property (
19533 GDBusConnection *connection G_GNUC_UNUSED,
19534 const gchar *sender G_GNUC_UNUSED,
19535 const gchar *object_path G_GNUC_UNUSED,
19536 const gchar *interface_name G_GNUC_UNUSED,
19537 const gchar *property_name,
19538 GVariant *variant,
19539 GError **error,
19540 gpointer user_data)
19541 {
19542 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19543 GValue value = G_VALUE_INIT;
19544 GParamSpec *pspec;
19545 _ExtendedGDBusPropertyInfo *info;
19546 gboolean ret;
19547 ret = FALSE;
19548 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
19549 g_assert (info != NULL);
19550 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19551 if (pspec == NULL)
19552 {
19553 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19554 }
19555 else
19556 {
19557 if (info->use_gvariant)
19558 g_value_set_variant (&value, variant);
19559 else
19560 g_dbus_gvariant_to_gvalue (variant, &value);
19561 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19562 g_value_unset (&value);
19563 ret = TRUE;
19564 }
19565 return ret;
19566 }
19567
19568 static const GDBusInterfaceVTable _control_checkstop_skeleton_vtable =
19569 {
19570 _control_checkstop_skeleton_handle_method_call,
19571 _control_checkstop_skeleton_handle_get_property,
19572 _control_checkstop_skeleton_handle_set_property,
19573 {NULL}
19574 };
19575
19576 static GDBusInterfaceInfo *
control_checkstop_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)19577 control_checkstop_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19578 {
19579 return control_checkstop_interface_info ();
19580 }
19581
19582 static GDBusInterfaceVTable *
control_checkstop_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)19583 control_checkstop_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19584 {
19585 return (GDBusInterfaceVTable *) &_control_checkstop_skeleton_vtable;
19586 }
19587
19588 static GVariant *
control_checkstop_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)19589 control_checkstop_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19590 {
19591 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (_skeleton);
19592
19593 GVariantBuilder builder;
19594 guint n;
19595 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19596 if (_control_checkstop_interface_info.parent_struct.properties == NULL)
19597 goto out;
19598 for (n = 0; _control_checkstop_interface_info.parent_struct.properties[n] != NULL; n++)
19599 {
19600 GDBusPropertyInfo *info = _control_checkstop_interface_info.parent_struct.properties[n];
19601 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19602 {
19603 GVariant *value;
19604 value = _control_checkstop_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.control.Checkstop", info->name, NULL, skeleton);
19605 if (value != NULL)
19606 {
19607 g_variant_take_ref (value);
19608 g_variant_builder_add (&builder, "{sv}", info->name, value);
19609 g_variant_unref (value);
19610 }
19611 }
19612 }
19613 out:
19614 return g_variant_builder_end (&builder);
19615 }
19616
19617 static void
control_checkstop_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)19618 control_checkstop_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
19619 {
19620 }
19621
19622 static void control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface);
19623 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ControlCheckstopSkeleton,control_checkstop_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ControlCheckstopSkeleton)G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP,control_checkstop_skeleton_iface_init))19624 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19625 G_ADD_PRIVATE (ControlCheckstopSkeleton)
19626 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init))
19627
19628 #else
19629 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19630 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init))
19631
19632 #endif
19633 static void
19634 control_checkstop_skeleton_finalize (GObject *object)
19635 {
19636 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (object);
19637 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19638 if (skeleton->priv->changed_properties_idle_source != NULL)
19639 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19640 g_main_context_unref (skeleton->priv->context);
19641 g_mutex_clear (&skeleton->priv->lock);
19642 G_OBJECT_CLASS (control_checkstop_skeleton_parent_class)->finalize (object);
19643 }
19644
19645 static void
control_checkstop_skeleton_init(ControlCheckstopSkeleton * skeleton)19646 control_checkstop_skeleton_init (ControlCheckstopSkeleton *skeleton)
19647 {
19648 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19649 skeleton->priv = control_checkstop_skeleton_get_instance_private (skeleton);
19650 #else
19651 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_CHECKSTOP_SKELETON, ControlCheckstopSkeletonPrivate);
19652 #endif
19653
19654 g_mutex_init (&skeleton->priv->lock);
19655 skeleton->priv->context = g_main_context_ref_thread_default ();
19656 }
19657
19658 static void
control_checkstop_skeleton_class_init(ControlCheckstopSkeletonClass * klass)19659 control_checkstop_skeleton_class_init (ControlCheckstopSkeletonClass *klass)
19660 {
19661 GObjectClass *gobject_class;
19662 GDBusInterfaceSkeletonClass *skeleton_class;
19663
19664 gobject_class = G_OBJECT_CLASS (klass);
19665 gobject_class->finalize = control_checkstop_skeleton_finalize;
19666
19667 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19668 skeleton_class->get_info = control_checkstop_skeleton_dbus_interface_get_info;
19669 skeleton_class->get_properties = control_checkstop_skeleton_dbus_interface_get_properties;
19670 skeleton_class->flush = control_checkstop_skeleton_dbus_interface_flush;
19671 skeleton_class->get_vtable = control_checkstop_skeleton_dbus_interface_get_vtable;
19672
19673 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19674 g_type_class_add_private (klass, sizeof (ControlCheckstopSkeletonPrivate));
19675 #endif
19676 }
19677
19678 static void
control_checkstop_skeleton_iface_init(ControlCheckstopIface * iface G_GNUC_UNUSED)19679 control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface G_GNUC_UNUSED)
19680 {
19681 }
19682
19683 /**
19684 * control_checkstop_skeleton_new:
19685 *
19686 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
19687 *
19688 * Returns: (transfer full) (type ControlCheckstopSkeleton): The skeleton object.
19689 */
19690 ControlCheckstop *
control_checkstop_skeleton_new(void)19691 control_checkstop_skeleton_new (void)
19692 {
19693 return CONTROL_CHECKSTOP (g_object_new (TYPE_CONTROL_CHECKSTOP_SKELETON, NULL));
19694 }
19695
19696 /* ------------------------------------------------------------------------
19697 * Code for interface org.openbmc.Watchdog
19698 * ------------------------------------------------------------------------
19699 */
19700
19701 /**
19702 * SECTION:Watchdog
19703 * @title: Watchdog
19704 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
19705 *
19706 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C.
19707 */
19708
19709 enum
19710 {
19711 _WATCHDOG_WATCHDOG_ERROR,
19712 };
19713
19714 static unsigned _WATCHDOG_SIGNALS[1] = { 0 };
19715
19716 /* ---- Introspection data for org.openbmc.Watchdog ---- */
19717
19718 static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
19719 {
19720 {
19721 -1,
19722 (gchar *) "start",
19723 NULL,
19724 NULL,
19725 NULL
19726 },
19727 "handle-start",
19728 FALSE
19729 };
19730
19731 static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
19732 {
19733 {
19734 -1,
19735 (gchar *) "poke",
19736 NULL,
19737 NULL,
19738 NULL
19739 },
19740 "handle-poke",
19741 FALSE
19742 };
19743
19744 static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
19745 {
19746 {
19747 -1,
19748 (gchar *) "stop",
19749 NULL,
19750 NULL,
19751 NULL
19752 },
19753 "handle-stop",
19754 FALSE
19755 };
19756
19757 static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
19758 {
19759 {
19760 -1,
19761 (gchar *) "interval",
19762 (gchar *) "i",
19763 NULL
19764 },
19765 FALSE
19766 };
19767
19768 static const GDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
19769 {
19770 &_watchdog_method_info_set_IN_ARG_interval.parent_struct,
19771 NULL
19772 };
19773
19774 static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
19775 {
19776 {
19777 -1,
19778 (gchar *) "set",
19779 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
19780 NULL,
19781 NULL
19782 },
19783 "handle-set",
19784 FALSE
19785 };
19786
19787 static const GDBusMethodInfo * const _watchdog_method_info_pointers[] =
19788 {
19789 &_watchdog_method_info_start.parent_struct,
19790 &_watchdog_method_info_poke.parent_struct,
19791 &_watchdog_method_info_stop.parent_struct,
19792 &_watchdog_method_info_set.parent_struct,
19793 NULL
19794 };
19795
19796 static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
19797 {
19798 {
19799 -1,
19800 (gchar *) "WatchdogError",
19801 NULL,
19802 NULL
19803 },
19804 "watchdog-error"
19805 };
19806
19807 static const GDBusSignalInfo * const _watchdog_signal_info_pointers[] =
19808 {
19809 &_watchdog_signal_info_watchdog_error.parent_struct,
19810 NULL
19811 };
19812
19813 static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
19814 {
19815 {
19816 -1,
19817 (gchar *) "watchdog",
19818 (gchar *) "i",
19819 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
19820 NULL
19821 },
19822 "watchdog",
19823 FALSE,
19824 TRUE
19825 };
19826
19827 static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
19828 {
19829 {
19830 -1,
19831 (gchar *) "poll_interval",
19832 (gchar *) "i",
19833 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
19834 NULL
19835 },
19836 "poll-interval",
19837 FALSE,
19838 TRUE
19839 };
19840
19841 static const GDBusPropertyInfo * const _watchdog_property_info_pointers[] =
19842 {
19843 &_watchdog_property_info_watchdog.parent_struct,
19844 &_watchdog_property_info_poll_interval.parent_struct,
19845 NULL
19846 };
19847
19848 static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
19849 {
19850 {
19851 -1,
19852 (gchar *) "org.openbmc.Watchdog",
19853 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
19854 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
19855 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
19856 NULL
19857 },
19858 "watchdog",
19859 };
19860
19861
19862 /**
19863 * watchdog_interface_info:
19864 *
19865 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
19866 *
19867 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19868 */
19869 GDBusInterfaceInfo *
watchdog_interface_info(void)19870 watchdog_interface_info (void)
19871 {
19872 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
19873 }
19874
19875 /**
19876 * watchdog_override_properties:
19877 * @klass: The class structure for a #GObject derived class.
19878 * @property_id_begin: The property id to assign to the first overridden property.
19879 *
19880 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
19881 * The properties are overridden in the order they are defined.
19882 *
19883 * Returns: The last property id.
19884 */
19885 guint
watchdog_override_properties(GObjectClass * klass,guint property_id_begin)19886 watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
19887 {
19888 g_object_class_override_property (klass, property_id_begin++, "watchdog");
19889 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
19890 return property_id_begin - 1;
19891 }
19892
19893
19894 inline static void
watchdog_signal_marshal_watchdog_error(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)19895 watchdog_signal_marshal_watchdog_error (
19896 GClosure *closure,
19897 GValue *return_value,
19898 unsigned int n_param_values,
19899 const GValue *param_values,
19900 void *invocation_hint,
19901 void *marshal_data)
19902 {
19903 g_cclosure_marshal_VOID__VOID (closure,
19904 return_value, n_param_values, param_values, invocation_hint, marshal_data);
19905 }
19906
19907 inline static void
watchdog_method_marshal_start(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)19908 watchdog_method_marshal_start (
19909 GClosure *closure,
19910 GValue *return_value,
19911 unsigned int n_param_values,
19912 const GValue *param_values,
19913 void *invocation_hint,
19914 void *marshal_data)
19915 {
19916 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
19917 return_value, n_param_values, param_values, invocation_hint, marshal_data);
19918 }
19919
19920 inline static void
watchdog_method_marshal_poke(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)19921 watchdog_method_marshal_poke (
19922 GClosure *closure,
19923 GValue *return_value,
19924 unsigned int n_param_values,
19925 const GValue *param_values,
19926 void *invocation_hint,
19927 void *marshal_data)
19928 {
19929 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
19930 return_value, n_param_values, param_values, invocation_hint, marshal_data);
19931 }
19932
19933 inline static void
watchdog_method_marshal_stop(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)19934 watchdog_method_marshal_stop (
19935 GClosure *closure,
19936 GValue *return_value,
19937 unsigned int n_param_values,
19938 const GValue *param_values,
19939 void *invocation_hint,
19940 void *marshal_data)
19941 {
19942 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
19943 return_value, n_param_values, param_values, invocation_hint, marshal_data);
19944 }
19945
19946 inline static void
watchdog_method_marshal_set(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)19947 watchdog_method_marshal_set (
19948 GClosure *closure,
19949 GValue *return_value,
19950 unsigned int n_param_values,
19951 const GValue *param_values,
19952 void *invocation_hint,
19953 void *marshal_data)
19954 {
19955 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT (closure,
19956 return_value, n_param_values, param_values, invocation_hint, marshal_data);
19957 }
19958
19959
19960 /**
19961 * Watchdog:
19962 *
19963 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19964 */
19965
19966 /**
19967 * WatchdogIface:
19968 * @parent_iface: The parent interface.
19969 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
19970 * @handle_set: Handler for the #Watchdog::handle-set signal.
19971 * @handle_start: Handler for the #Watchdog::handle-start signal.
19972 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
19973 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
19974 * @get_watchdog: Getter for the #Watchdog:watchdog property.
19975 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
19976 *
19977 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19978 */
19979
19980 typedef WatchdogIface WatchdogInterface;
G_DEFINE_INTERFACE(Watchdog,watchdog,G_TYPE_OBJECT)19981 G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT)
19982
19983 static void
19984 watchdog_default_init (WatchdogIface *iface)
19985 {
19986 /* GObject signals for incoming D-Bus method calls: */
19987 /**
19988 * Watchdog::handle-start:
19989 * @object: A #Watchdog.
19990 * @invocation: A #GDBusMethodInvocation.
19991 *
19992 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
19993 *
19994 * 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 watchdog_complete_start() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
19995 *
19996 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
19997 */
19998 g_signal_new ("handle-start",
19999 G_TYPE_FROM_INTERFACE (iface),
20000 G_SIGNAL_RUN_LAST,
20001 G_STRUCT_OFFSET (WatchdogIface, handle_start),
20002 g_signal_accumulator_true_handled,
20003 NULL,
20004 watchdog_method_marshal_start,
20005 G_TYPE_BOOLEAN,
20006 1,
20007 G_TYPE_DBUS_METHOD_INVOCATION);
20008
20009 /**
20010 * Watchdog::handle-poke:
20011 * @object: A #Watchdog.
20012 * @invocation: A #GDBusMethodInvocation.
20013 *
20014 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
20015 *
20016 * 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 watchdog_complete_poke() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
20017 *
20018 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
20019 */
20020 g_signal_new ("handle-poke",
20021 G_TYPE_FROM_INTERFACE (iface),
20022 G_SIGNAL_RUN_LAST,
20023 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
20024 g_signal_accumulator_true_handled,
20025 NULL,
20026 watchdog_method_marshal_poke,
20027 G_TYPE_BOOLEAN,
20028 1,
20029 G_TYPE_DBUS_METHOD_INVOCATION);
20030
20031 /**
20032 * Watchdog::handle-stop:
20033 * @object: A #Watchdog.
20034 * @invocation: A #GDBusMethodInvocation.
20035 *
20036 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
20037 *
20038 * 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 watchdog_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
20039 *
20040 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
20041 */
20042 g_signal_new ("handle-stop",
20043 G_TYPE_FROM_INTERFACE (iface),
20044 G_SIGNAL_RUN_LAST,
20045 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
20046 g_signal_accumulator_true_handled,
20047 NULL,
20048 watchdog_method_marshal_stop,
20049 G_TYPE_BOOLEAN,
20050 1,
20051 G_TYPE_DBUS_METHOD_INVOCATION);
20052
20053 /**
20054 * Watchdog::handle-set:
20055 * @object: A #Watchdog.
20056 * @invocation: A #GDBusMethodInvocation.
20057 * @arg_interval: Argument passed by remote caller.
20058 *
20059 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
20060 *
20061 * 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 watchdog_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
20062 *
20063 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
20064 */
20065 g_signal_new ("handle-set",
20066 G_TYPE_FROM_INTERFACE (iface),
20067 G_SIGNAL_RUN_LAST,
20068 G_STRUCT_OFFSET (WatchdogIface, handle_set),
20069 g_signal_accumulator_true_handled,
20070 NULL,
20071 watchdog_method_marshal_set,
20072 G_TYPE_BOOLEAN,
20073 2,
20074 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
20075
20076 /* GObject signals for received D-Bus signals: */
20077 /**
20078 * Watchdog::watchdog-error:
20079 * @object: A #Watchdog.
20080 *
20081 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received.
20082 *
20083 * 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.
20084 */
20085 _WATCHDOG_SIGNALS[_WATCHDOG_WATCHDOG_ERROR] =
20086 g_signal_new ("watchdog-error",
20087 G_TYPE_FROM_INTERFACE (iface),
20088 G_SIGNAL_RUN_LAST,
20089 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
20090 NULL,
20091 NULL,
20092 watchdog_signal_marshal_watchdog_error,
20093 G_TYPE_NONE,
20094 0);
20095
20096 /* GObject properties for D-Bus properties: */
20097 /**
20098 * Watchdog:watchdog:
20099 *
20100 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
20101 *
20102 * 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.
20103 */
20104 g_object_interface_install_property (iface,
20105 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20106 /**
20107 * Watchdog:poll-interval:
20108 *
20109 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
20110 *
20111 * 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.
20112 */
20113 g_object_interface_install_property (iface,
20114 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20115 }
20116
20117 /**
20118 * watchdog_get_watchdog: (skip)
20119 * @object: A #Watchdog.
20120 *
20121 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
20122 *
20123 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
20124 *
20125 * Returns: The property value.
20126 */
20127 gint
watchdog_get_watchdog(Watchdog * object)20128 watchdog_get_watchdog (Watchdog *object)
20129 {
20130 g_return_val_if_fail (IS_WATCHDOG (object), 0);
20131
20132 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
20133 }
20134
20135 /**
20136 * watchdog_set_watchdog: (skip)
20137 * @object: A #Watchdog.
20138 * @value: The value to set.
20139 *
20140 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
20141 *
20142 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
20143 */
20144 void
watchdog_set_watchdog(Watchdog * object,gint value)20145 watchdog_set_watchdog (Watchdog *object, gint value)
20146 {
20147 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
20148 }
20149
20150 /**
20151 * watchdog_get_poll_interval: (skip)
20152 * @object: A #Watchdog.
20153 *
20154 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
20155 *
20156 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
20157 *
20158 * Returns: The property value.
20159 */
20160 gint
watchdog_get_poll_interval(Watchdog * object)20161 watchdog_get_poll_interval (Watchdog *object)
20162 {
20163 g_return_val_if_fail (IS_WATCHDOG (object), 0);
20164
20165 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
20166 }
20167
20168 /**
20169 * watchdog_set_poll_interval: (skip)
20170 * @object: A #Watchdog.
20171 * @value: The value to set.
20172 *
20173 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
20174 *
20175 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
20176 */
20177 void
watchdog_set_poll_interval(Watchdog * object,gint value)20178 watchdog_set_poll_interval (Watchdog *object, gint value)
20179 {
20180 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
20181 }
20182
20183 /**
20184 * watchdog_emit_watchdog_error:
20185 * @object: A #Watchdog.
20186 *
20187 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
20188 */
20189 void
watchdog_emit_watchdog_error(Watchdog * object)20190 watchdog_emit_watchdog_error (
20191 Watchdog *object)
20192 {
20193 g_signal_emit (object, _WATCHDOG_SIGNALS[_WATCHDOG_WATCHDOG_ERROR], 0);
20194 }
20195
20196 /**
20197 * watchdog_call_start:
20198 * @proxy: A #WatchdogProxy.
20199 * @cancellable: (nullable): A #GCancellable or %NULL.
20200 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20201 * @user_data: User data to pass to @callback.
20202 *
20203 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
20204 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20205 * You can then call watchdog_call_start_finish() to get the result of the operation.
20206 *
20207 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
20208 */
20209 void
watchdog_call_start(Watchdog * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20210 watchdog_call_start (
20211 Watchdog *proxy,
20212 GCancellable *cancellable,
20213 GAsyncReadyCallback callback,
20214 gpointer user_data)
20215 {
20216 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20217 "start",
20218 g_variant_new ("()"),
20219 G_DBUS_CALL_FLAGS_NONE,
20220 -1,
20221 cancellable,
20222 callback,
20223 user_data);
20224 }
20225
20226 /**
20227 * watchdog_call_start_finish:
20228 * @proxy: A #WatchdogProxy.
20229 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
20230 * @error: Return location for error or %NULL.
20231 *
20232 * Finishes an operation started with watchdog_call_start().
20233 *
20234 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20235 */
20236 gboolean
watchdog_call_start_finish(Watchdog * proxy,GAsyncResult * res,GError ** error)20237 watchdog_call_start_finish (
20238 Watchdog *proxy,
20239 GAsyncResult *res,
20240 GError **error)
20241 {
20242 GVariant *_ret;
20243 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20244 if (_ret == NULL)
20245 goto _out;
20246 g_variant_get (_ret,
20247 "()");
20248 g_variant_unref (_ret);
20249 _out:
20250 return _ret != NULL;
20251 }
20252
20253 /**
20254 * watchdog_call_start_sync:
20255 * @proxy: A #WatchdogProxy.
20256 * @cancellable: (nullable): A #GCancellable or %NULL.
20257 * @error: Return location for error or %NULL.
20258 *
20259 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20260 *
20261 * See watchdog_call_start() for the asynchronous version of this method.
20262 *
20263 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20264 */
20265 gboolean
watchdog_call_start_sync(Watchdog * proxy,GCancellable * cancellable,GError ** error)20266 watchdog_call_start_sync (
20267 Watchdog *proxy,
20268 GCancellable *cancellable,
20269 GError **error)
20270 {
20271 GVariant *_ret;
20272 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20273 "start",
20274 g_variant_new ("()"),
20275 G_DBUS_CALL_FLAGS_NONE,
20276 -1,
20277 cancellable,
20278 error);
20279 if (_ret == NULL)
20280 goto _out;
20281 g_variant_get (_ret,
20282 "()");
20283 g_variant_unref (_ret);
20284 _out:
20285 return _ret != NULL;
20286 }
20287
20288 /**
20289 * watchdog_call_poke:
20290 * @proxy: A #WatchdogProxy.
20291 * @cancellable: (nullable): A #GCancellable or %NULL.
20292 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20293 * @user_data: User data to pass to @callback.
20294 *
20295 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
20296 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20297 * You can then call watchdog_call_poke_finish() to get the result of the operation.
20298 *
20299 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
20300 */
20301 void
watchdog_call_poke(Watchdog * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20302 watchdog_call_poke (
20303 Watchdog *proxy,
20304 GCancellable *cancellable,
20305 GAsyncReadyCallback callback,
20306 gpointer user_data)
20307 {
20308 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20309 "poke",
20310 g_variant_new ("()"),
20311 G_DBUS_CALL_FLAGS_NONE,
20312 -1,
20313 cancellable,
20314 callback,
20315 user_data);
20316 }
20317
20318 /**
20319 * watchdog_call_poke_finish:
20320 * @proxy: A #WatchdogProxy.
20321 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
20322 * @error: Return location for error or %NULL.
20323 *
20324 * Finishes an operation started with watchdog_call_poke().
20325 *
20326 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20327 */
20328 gboolean
watchdog_call_poke_finish(Watchdog * proxy,GAsyncResult * res,GError ** error)20329 watchdog_call_poke_finish (
20330 Watchdog *proxy,
20331 GAsyncResult *res,
20332 GError **error)
20333 {
20334 GVariant *_ret;
20335 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20336 if (_ret == NULL)
20337 goto _out;
20338 g_variant_get (_ret,
20339 "()");
20340 g_variant_unref (_ret);
20341 _out:
20342 return _ret != NULL;
20343 }
20344
20345 /**
20346 * watchdog_call_poke_sync:
20347 * @proxy: A #WatchdogProxy.
20348 * @cancellable: (nullable): A #GCancellable or %NULL.
20349 * @error: Return location for error or %NULL.
20350 *
20351 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20352 *
20353 * See watchdog_call_poke() for the asynchronous version of this method.
20354 *
20355 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20356 */
20357 gboolean
watchdog_call_poke_sync(Watchdog * proxy,GCancellable * cancellable,GError ** error)20358 watchdog_call_poke_sync (
20359 Watchdog *proxy,
20360 GCancellable *cancellable,
20361 GError **error)
20362 {
20363 GVariant *_ret;
20364 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20365 "poke",
20366 g_variant_new ("()"),
20367 G_DBUS_CALL_FLAGS_NONE,
20368 -1,
20369 cancellable,
20370 error);
20371 if (_ret == NULL)
20372 goto _out;
20373 g_variant_get (_ret,
20374 "()");
20375 g_variant_unref (_ret);
20376 _out:
20377 return _ret != NULL;
20378 }
20379
20380 /**
20381 * watchdog_call_stop:
20382 * @proxy: A #WatchdogProxy.
20383 * @cancellable: (nullable): A #GCancellable or %NULL.
20384 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20385 * @user_data: User data to pass to @callback.
20386 *
20387 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
20388 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20389 * You can then call watchdog_call_stop_finish() to get the result of the operation.
20390 *
20391 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
20392 */
20393 void
watchdog_call_stop(Watchdog * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20394 watchdog_call_stop (
20395 Watchdog *proxy,
20396 GCancellable *cancellable,
20397 GAsyncReadyCallback callback,
20398 gpointer user_data)
20399 {
20400 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20401 "stop",
20402 g_variant_new ("()"),
20403 G_DBUS_CALL_FLAGS_NONE,
20404 -1,
20405 cancellable,
20406 callback,
20407 user_data);
20408 }
20409
20410 /**
20411 * watchdog_call_stop_finish:
20412 * @proxy: A #WatchdogProxy.
20413 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
20414 * @error: Return location for error or %NULL.
20415 *
20416 * Finishes an operation started with watchdog_call_stop().
20417 *
20418 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20419 */
20420 gboolean
watchdog_call_stop_finish(Watchdog * proxy,GAsyncResult * res,GError ** error)20421 watchdog_call_stop_finish (
20422 Watchdog *proxy,
20423 GAsyncResult *res,
20424 GError **error)
20425 {
20426 GVariant *_ret;
20427 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20428 if (_ret == NULL)
20429 goto _out;
20430 g_variant_get (_ret,
20431 "()");
20432 g_variant_unref (_ret);
20433 _out:
20434 return _ret != NULL;
20435 }
20436
20437 /**
20438 * watchdog_call_stop_sync:
20439 * @proxy: A #WatchdogProxy.
20440 * @cancellable: (nullable): A #GCancellable or %NULL.
20441 * @error: Return location for error or %NULL.
20442 *
20443 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20444 *
20445 * See watchdog_call_stop() for the asynchronous version of this method.
20446 *
20447 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20448 */
20449 gboolean
watchdog_call_stop_sync(Watchdog * proxy,GCancellable * cancellable,GError ** error)20450 watchdog_call_stop_sync (
20451 Watchdog *proxy,
20452 GCancellable *cancellable,
20453 GError **error)
20454 {
20455 GVariant *_ret;
20456 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20457 "stop",
20458 g_variant_new ("()"),
20459 G_DBUS_CALL_FLAGS_NONE,
20460 -1,
20461 cancellable,
20462 error);
20463 if (_ret == NULL)
20464 goto _out;
20465 g_variant_get (_ret,
20466 "()");
20467 g_variant_unref (_ret);
20468 _out:
20469 return _ret != NULL;
20470 }
20471
20472 /**
20473 * watchdog_call_set:
20474 * @proxy: A #WatchdogProxy.
20475 * @arg_interval: Argument to pass with the method invocation.
20476 * @cancellable: (nullable): A #GCancellable or %NULL.
20477 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20478 * @user_data: User data to pass to @callback.
20479 *
20480 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
20481 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20482 * You can then call watchdog_call_set_finish() to get the result of the operation.
20483 *
20484 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
20485 */
20486 void
watchdog_call_set(Watchdog * proxy,gint arg_interval,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20487 watchdog_call_set (
20488 Watchdog *proxy,
20489 gint arg_interval,
20490 GCancellable *cancellable,
20491 GAsyncReadyCallback callback,
20492 gpointer user_data)
20493 {
20494 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20495 "set",
20496 g_variant_new ("(i)",
20497 arg_interval),
20498 G_DBUS_CALL_FLAGS_NONE,
20499 -1,
20500 cancellable,
20501 callback,
20502 user_data);
20503 }
20504
20505 /**
20506 * watchdog_call_set_finish:
20507 * @proxy: A #WatchdogProxy.
20508 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
20509 * @error: Return location for error or %NULL.
20510 *
20511 * Finishes an operation started with watchdog_call_set().
20512 *
20513 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20514 */
20515 gboolean
watchdog_call_set_finish(Watchdog * proxy,GAsyncResult * res,GError ** error)20516 watchdog_call_set_finish (
20517 Watchdog *proxy,
20518 GAsyncResult *res,
20519 GError **error)
20520 {
20521 GVariant *_ret;
20522 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20523 if (_ret == NULL)
20524 goto _out;
20525 g_variant_get (_ret,
20526 "()");
20527 g_variant_unref (_ret);
20528 _out:
20529 return _ret != NULL;
20530 }
20531
20532 /**
20533 * watchdog_call_set_sync:
20534 * @proxy: A #WatchdogProxy.
20535 * @arg_interval: Argument to pass with the method invocation.
20536 * @cancellable: (nullable): A #GCancellable or %NULL.
20537 * @error: Return location for error or %NULL.
20538 *
20539 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20540 *
20541 * See watchdog_call_set() for the asynchronous version of this method.
20542 *
20543 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
20544 */
20545 gboolean
watchdog_call_set_sync(Watchdog * proxy,gint arg_interval,GCancellable * cancellable,GError ** error)20546 watchdog_call_set_sync (
20547 Watchdog *proxy,
20548 gint arg_interval,
20549 GCancellable *cancellable,
20550 GError **error)
20551 {
20552 GVariant *_ret;
20553 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20554 "set",
20555 g_variant_new ("(i)",
20556 arg_interval),
20557 G_DBUS_CALL_FLAGS_NONE,
20558 -1,
20559 cancellable,
20560 error);
20561 if (_ret == NULL)
20562 goto _out;
20563 g_variant_get (_ret,
20564 "()");
20565 g_variant_unref (_ret);
20566 _out:
20567 return _ret != NULL;
20568 }
20569
20570 /**
20571 * watchdog_complete_start:
20572 * @object: A #Watchdog.
20573 * @invocation: (transfer full): A #GDBusMethodInvocation.
20574 *
20575 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</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.
20576 *
20577 * This method will free @invocation, you cannot use it afterwards.
20578 */
20579 void
watchdog_complete_start(Watchdog * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)20580 watchdog_complete_start (
20581 Watchdog *object G_GNUC_UNUSED,
20582 GDBusMethodInvocation *invocation)
20583 {
20584 g_dbus_method_invocation_return_value (invocation,
20585 g_variant_new ("()"));
20586 }
20587
20588 /**
20589 * watchdog_complete_poke:
20590 * @object: A #Watchdog.
20591 * @invocation: (transfer full): A #GDBusMethodInvocation.
20592 *
20593 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</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.
20594 *
20595 * This method will free @invocation, you cannot use it afterwards.
20596 */
20597 void
watchdog_complete_poke(Watchdog * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)20598 watchdog_complete_poke (
20599 Watchdog *object G_GNUC_UNUSED,
20600 GDBusMethodInvocation *invocation)
20601 {
20602 g_dbus_method_invocation_return_value (invocation,
20603 g_variant_new ("()"));
20604 }
20605
20606 /**
20607 * watchdog_complete_stop:
20608 * @object: A #Watchdog.
20609 * @invocation: (transfer full): A #GDBusMethodInvocation.
20610 *
20611 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</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.
20612 *
20613 * This method will free @invocation, you cannot use it afterwards.
20614 */
20615 void
watchdog_complete_stop(Watchdog * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)20616 watchdog_complete_stop (
20617 Watchdog *object G_GNUC_UNUSED,
20618 GDBusMethodInvocation *invocation)
20619 {
20620 g_dbus_method_invocation_return_value (invocation,
20621 g_variant_new ("()"));
20622 }
20623
20624 /**
20625 * watchdog_complete_set:
20626 * @object: A #Watchdog.
20627 * @invocation: (transfer full): A #GDBusMethodInvocation.
20628 *
20629 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</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.
20630 *
20631 * This method will free @invocation, you cannot use it afterwards.
20632 */
20633 void
watchdog_complete_set(Watchdog * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)20634 watchdog_complete_set (
20635 Watchdog *object G_GNUC_UNUSED,
20636 GDBusMethodInvocation *invocation)
20637 {
20638 g_dbus_method_invocation_return_value (invocation,
20639 g_variant_new ("()"));
20640 }
20641
20642 /* ------------------------------------------------------------------------ */
20643
20644 /**
20645 * WatchdogProxy:
20646 *
20647 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
20648 */
20649
20650 /**
20651 * WatchdogProxyClass:
20652 * @parent_class: The parent class.
20653 *
20654 * Class structure for #WatchdogProxy.
20655 */
20656
20657 struct _WatchdogProxyPrivate
20658 {
20659 GData *qdata;
20660 };
20661
20662 static void watchdog_proxy_iface_init (WatchdogIface *iface);
20663
20664 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(WatchdogProxy,watchdog_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (WatchdogProxy)G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG,watchdog_proxy_iface_init))20665 G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
20666 G_ADD_PRIVATE (WatchdogProxy)
20667 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init))
20668
20669 #else
20670 G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
20671 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init))
20672
20673 #endif
20674 static void
20675 watchdog_proxy_finalize (GObject *object)
20676 {
20677 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20678 g_datalist_clear (&proxy->priv->qdata);
20679 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
20680 }
20681
20682 static void
watchdog_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)20683 watchdog_proxy_get_property (GObject *object,
20684 guint prop_id,
20685 GValue *value,
20686 GParamSpec *pspec G_GNUC_UNUSED)
20687 {
20688 const _ExtendedGDBusPropertyInfo *info;
20689 GVariant *variant;
20690 g_assert (prop_id != 0 && prop_id - 1 < 2);
20691 info = (const _ExtendedGDBusPropertyInfo *) _watchdog_property_info_pointers[prop_id - 1];
20692 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20693 if (info->use_gvariant)
20694 {
20695 g_value_set_variant (value, variant);
20696 }
20697 else
20698 {
20699 if (variant != NULL)
20700 g_dbus_gvariant_to_gvalue (variant, value);
20701 }
20702 if (variant != NULL)
20703 g_variant_unref (variant);
20704 }
20705
20706 static void
watchdog_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)20707 watchdog_proxy_set_property_cb (GDBusProxy *proxy,
20708 GAsyncResult *res,
20709 gpointer user_data)
20710 {
20711 const _ExtendedGDBusPropertyInfo *info = user_data;
20712 GError *error;
20713 GVariant *_ret;
20714 error = NULL;
20715 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20716 if (!_ret)
20717 {
20718 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
20719 info->parent_struct.name,
20720 error->message, g_quark_to_string (error->domain), error->code);
20721 g_error_free (error);
20722 }
20723 else
20724 {
20725 g_variant_unref (_ret);
20726 }
20727 }
20728
20729 static void
watchdog_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)20730 watchdog_proxy_set_property (GObject *object,
20731 guint prop_id,
20732 const GValue *value,
20733 GParamSpec *pspec G_GNUC_UNUSED)
20734 {
20735 const _ExtendedGDBusPropertyInfo *info;
20736 GVariant *variant;
20737 g_assert (prop_id != 0 && prop_id - 1 < 2);
20738 info = (const _ExtendedGDBusPropertyInfo *) _watchdog_property_info_pointers[prop_id - 1];
20739 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20740 g_dbus_proxy_call (G_DBUS_PROXY (object),
20741 "org.freedesktop.DBus.Properties.Set",
20742 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
20743 G_DBUS_CALL_FLAGS_NONE,
20744 -1,
20745 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20746 g_variant_unref (variant);
20747 }
20748
20749 static void
watchdog_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)20750 watchdog_proxy_g_signal (GDBusProxy *proxy,
20751 const gchar *sender_name G_GNUC_UNUSED,
20752 const gchar *signal_name,
20753 GVariant *parameters)
20754 {
20755 _ExtendedGDBusSignalInfo *info;
20756 GVariantIter iter;
20757 GVariant *child;
20758 GValue *paramv;
20759 gsize num_params;
20760 gsize n;
20761 guint signal_id;
20762 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
20763 if (info == NULL)
20764 return;
20765 num_params = g_variant_n_children (parameters);
20766 paramv = g_new0 (GValue, num_params + 1);
20767 g_value_init (¶mv[0], TYPE_WATCHDOG);
20768 g_value_set_object (¶mv[0], proxy);
20769 g_variant_iter_init (&iter, parameters);
20770 n = 1;
20771 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20772 {
20773 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20774 if (arg_info->use_gvariant)
20775 {
20776 g_value_init (¶mv[n], G_TYPE_VARIANT);
20777 g_value_set_variant (¶mv[n], child);
20778 n++;
20779 }
20780 else
20781 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
20782 g_variant_unref (child);
20783 }
20784 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
20785 g_signal_emitv (paramv, signal_id, 0, NULL);
20786 for (n = 0; n < num_params + 1; n++)
20787 g_value_unset (¶mv[n]);
20788 g_free (paramv);
20789 }
20790
20791 static void
watchdog_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)20792 watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
20793 GVariant *changed_properties,
20794 const gchar *const *invalidated_properties)
20795 {
20796 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
20797 guint n;
20798 const gchar *key;
20799 GVariantIter *iter;
20800 _ExtendedGDBusPropertyInfo *info;
20801 g_variant_get (changed_properties, "a{sv}", &iter);
20802 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20803 {
20804 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
20805 g_datalist_remove_data (&proxy->priv->qdata, key);
20806 if (info != NULL)
20807 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20808 }
20809 g_variant_iter_free (iter);
20810 for (n = 0; invalidated_properties[n] != NULL; n++)
20811 {
20812 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
20813 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20814 if (info != NULL)
20815 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20816 }
20817 }
20818
20819 static gint
watchdog_proxy_get_watchdog(Watchdog * object)20820 watchdog_proxy_get_watchdog (Watchdog *object)
20821 {
20822 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20823 GVariant *variant;
20824 gint value = 0;
20825 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
20826 if (variant != NULL)
20827 {
20828 value = g_variant_get_int32 (variant);
20829 g_variant_unref (variant);
20830 }
20831 return value;
20832 }
20833
20834 static gint
watchdog_proxy_get_poll_interval(Watchdog * object)20835 watchdog_proxy_get_poll_interval (Watchdog *object)
20836 {
20837 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20838 GVariant *variant;
20839 gint value = 0;
20840 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
20841 if (variant != NULL)
20842 {
20843 value = g_variant_get_int32 (variant);
20844 g_variant_unref (variant);
20845 }
20846 return value;
20847 }
20848
20849 static void
watchdog_proxy_init(WatchdogProxy * proxy)20850 watchdog_proxy_init (WatchdogProxy *proxy)
20851 {
20852 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20853 proxy->priv = watchdog_proxy_get_instance_private (proxy);
20854 #else
20855 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
20856 #endif
20857
20858 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
20859 }
20860
20861 static void
watchdog_proxy_class_init(WatchdogProxyClass * klass)20862 watchdog_proxy_class_init (WatchdogProxyClass *klass)
20863 {
20864 GObjectClass *gobject_class;
20865 GDBusProxyClass *proxy_class;
20866
20867 gobject_class = G_OBJECT_CLASS (klass);
20868 gobject_class->finalize = watchdog_proxy_finalize;
20869 gobject_class->get_property = watchdog_proxy_get_property;
20870 gobject_class->set_property = watchdog_proxy_set_property;
20871
20872 proxy_class = G_DBUS_PROXY_CLASS (klass);
20873 proxy_class->g_signal = watchdog_proxy_g_signal;
20874 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
20875
20876 watchdog_override_properties (gobject_class, 1);
20877
20878 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20879 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
20880 #endif
20881 }
20882
20883 static void
watchdog_proxy_iface_init(WatchdogIface * iface)20884 watchdog_proxy_iface_init (WatchdogIface *iface)
20885 {
20886 iface->get_watchdog = watchdog_proxy_get_watchdog;
20887 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
20888 }
20889
20890 /**
20891 * watchdog_proxy_new:
20892 * @connection: A #GDBusConnection.
20893 * @flags: Flags from the #GDBusProxyFlags enumeration.
20894 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20895 * @object_path: An object path.
20896 * @cancellable: (nullable): A #GCancellable or %NULL.
20897 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20898 * @user_data: User data to pass to @callback.
20899 *
20900 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details.
20901 *
20902 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20903 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
20904 *
20905 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
20906 */
20907 void
watchdog_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20908 watchdog_proxy_new (
20909 GDBusConnection *connection,
20910 GDBusProxyFlags flags,
20911 const gchar *name,
20912 const gchar *object_path,
20913 GCancellable *cancellable,
20914 GAsyncReadyCallback callback,
20915 gpointer user_data)
20916 {
20917 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
20918 }
20919
20920 /**
20921 * watchdog_proxy_new_finish:
20922 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
20923 * @error: Return location for error or %NULL
20924 *
20925 * Finishes an operation started with watchdog_proxy_new().
20926 *
20927 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20928 */
20929 Watchdog *
watchdog_proxy_new_finish(GAsyncResult * res,GError ** error)20930 watchdog_proxy_new_finish (
20931 GAsyncResult *res,
20932 GError **error)
20933 {
20934 GObject *ret;
20935 GObject *source_object;
20936 source_object = g_async_result_get_source_object (res);
20937 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20938 g_object_unref (source_object);
20939 if (ret != NULL)
20940 return WATCHDOG (ret);
20941 else
20942 return NULL;
20943 }
20944
20945 /**
20946 * watchdog_proxy_new_sync:
20947 * @connection: A #GDBusConnection.
20948 * @flags: Flags from the #GDBusProxyFlags enumeration.
20949 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20950 * @object_path: An object path.
20951 * @cancellable: (nullable): A #GCancellable or %NULL.
20952 * @error: Return location for error or %NULL
20953 *
20954 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details.
20955 *
20956 * The calling thread is blocked until a reply is received.
20957 *
20958 * See watchdog_proxy_new() for the asynchronous version of this constructor.
20959 *
20960 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20961 */
20962 Watchdog *
watchdog_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)20963 watchdog_proxy_new_sync (
20964 GDBusConnection *connection,
20965 GDBusProxyFlags flags,
20966 const gchar *name,
20967 const gchar *object_path,
20968 GCancellable *cancellable,
20969 GError **error)
20970 {
20971 GInitable *ret;
20972 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
20973 if (ret != NULL)
20974 return WATCHDOG (ret);
20975 else
20976 return NULL;
20977 }
20978
20979
20980 /**
20981 * watchdog_proxy_new_for_bus:
20982 * @bus_type: A #GBusType.
20983 * @flags: Flags from the #GDBusProxyFlags enumeration.
20984 * @name: A bus name (well-known or unique).
20985 * @object_path: An object path.
20986 * @cancellable: (nullable): A #GCancellable or %NULL.
20987 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20988 * @user_data: User data to pass to @callback.
20989 *
20990 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20991 *
20992 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
20993 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
20994 *
20995 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20996 */
20997 void
watchdog_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)20998 watchdog_proxy_new_for_bus (
20999 GBusType bus_type,
21000 GDBusProxyFlags flags,
21001 const gchar *name,
21002 const gchar *object_path,
21003 GCancellable *cancellable,
21004 GAsyncReadyCallback callback,
21005 gpointer user_data)
21006 {
21007 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
21008 }
21009
21010 /**
21011 * watchdog_proxy_new_for_bus_finish:
21012 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
21013 * @error: Return location for error or %NULL
21014 *
21015 * Finishes an operation started with watchdog_proxy_new_for_bus().
21016 *
21017 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
21018 */
21019 Watchdog *
watchdog_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)21020 watchdog_proxy_new_for_bus_finish (
21021 GAsyncResult *res,
21022 GError **error)
21023 {
21024 GObject *ret;
21025 GObject *source_object;
21026 source_object = g_async_result_get_source_object (res);
21027 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21028 g_object_unref (source_object);
21029 if (ret != NULL)
21030 return WATCHDOG (ret);
21031 else
21032 return NULL;
21033 }
21034
21035 /**
21036 * watchdog_proxy_new_for_bus_sync:
21037 * @bus_type: A #GBusType.
21038 * @flags: Flags from the #GDBusProxyFlags enumeration.
21039 * @name: A bus name (well-known or unique).
21040 * @object_path: An object path.
21041 * @cancellable: (nullable): A #GCancellable or %NULL.
21042 * @error: Return location for error or %NULL
21043 *
21044 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21045 *
21046 * The calling thread is blocked until a reply is received.
21047 *
21048 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
21049 *
21050 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
21051 */
21052 Watchdog *
watchdog_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)21053 watchdog_proxy_new_for_bus_sync (
21054 GBusType bus_type,
21055 GDBusProxyFlags flags,
21056 const gchar *name,
21057 const gchar *object_path,
21058 GCancellable *cancellable,
21059 GError **error)
21060 {
21061 GInitable *ret;
21062 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
21063 if (ret != NULL)
21064 return WATCHDOG (ret);
21065 else
21066 return NULL;
21067 }
21068
21069
21070 /* ------------------------------------------------------------------------ */
21071
21072 /**
21073 * WatchdogSkeleton:
21074 *
21075 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
21076 */
21077
21078 /**
21079 * WatchdogSkeletonClass:
21080 * @parent_class: The parent class.
21081 *
21082 * Class structure for #WatchdogSkeleton.
21083 */
21084
21085 struct _WatchdogSkeletonPrivate
21086 {
21087 GValue *properties;
21088 GList *changed_properties;
21089 GSource *changed_properties_idle_source;
21090 GMainContext *context;
21091 GMutex lock;
21092 };
21093
21094 static void
_watchdog_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)21095 _watchdog_skeleton_handle_method_call (
21096 GDBusConnection *connection G_GNUC_UNUSED,
21097 const gchar *sender G_GNUC_UNUSED,
21098 const gchar *object_path G_GNUC_UNUSED,
21099 const gchar *interface_name,
21100 const gchar *method_name,
21101 GVariant *parameters,
21102 GDBusMethodInvocation *invocation,
21103 gpointer user_data)
21104 {
21105 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
21106 _ExtendedGDBusMethodInfo *info;
21107 GVariantIter iter;
21108 GVariant *child;
21109 GValue *paramv;
21110 gsize num_params;
21111 guint num_extra;
21112 gsize n;
21113 guint signal_id;
21114 GValue return_value = G_VALUE_INIT;
21115 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21116 g_assert (info != NULL);
21117 num_params = g_variant_n_children (parameters);
21118 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21119 n = 0;
21120 g_value_init (¶mv[n], TYPE_WATCHDOG);
21121 g_value_set_object (¶mv[n++], skeleton);
21122 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21123 g_value_set_object (¶mv[n++], invocation);
21124 if (info->pass_fdlist)
21125 {
21126 #ifdef G_OS_UNIX
21127 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
21128 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21129 #else
21130 g_assert_not_reached ();
21131 #endif
21132 }
21133 g_variant_iter_init (&iter, parameters);
21134 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21135 {
21136 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21137 if (arg_info->use_gvariant)
21138 {
21139 g_value_init (¶mv[n], G_TYPE_VARIANT);
21140 g_value_set_variant (¶mv[n], child);
21141 n++;
21142 }
21143 else
21144 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
21145 g_variant_unref (child);
21146 }
21147 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
21148 g_value_init (&return_value, G_TYPE_BOOLEAN);
21149 g_signal_emitv (paramv, signal_id, 0, &return_value);
21150 if (!g_value_get_boolean (&return_value))
21151 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);
21152 g_value_unset (&return_value);
21153 for (n = 0; n < num_params + num_extra; n++)
21154 g_value_unset (¶mv[n]);
21155 g_free (paramv);
21156 }
21157
21158 static GVariant *
_watchdog_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)21159 _watchdog_skeleton_handle_get_property (
21160 GDBusConnection *connection G_GNUC_UNUSED,
21161 const gchar *sender G_GNUC_UNUSED,
21162 const gchar *object_path G_GNUC_UNUSED,
21163 const gchar *interface_name G_GNUC_UNUSED,
21164 const gchar *property_name,
21165 GError **error,
21166 gpointer user_data)
21167 {
21168 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
21169 GValue value = G_VALUE_INIT;
21170 GParamSpec *pspec;
21171 _ExtendedGDBusPropertyInfo *info;
21172 GVariant *ret;
21173 ret = NULL;
21174 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
21175 g_assert (info != NULL);
21176 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21177 if (pspec == NULL)
21178 {
21179 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21180 }
21181 else
21182 {
21183 g_value_init (&value, pspec->value_type);
21184 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21185 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21186 g_value_unset (&value);
21187 }
21188 return ret;
21189 }
21190
21191 static gboolean
_watchdog_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)21192 _watchdog_skeleton_handle_set_property (
21193 GDBusConnection *connection G_GNUC_UNUSED,
21194 const gchar *sender G_GNUC_UNUSED,
21195 const gchar *object_path G_GNUC_UNUSED,
21196 const gchar *interface_name G_GNUC_UNUSED,
21197 const gchar *property_name,
21198 GVariant *variant,
21199 GError **error,
21200 gpointer user_data)
21201 {
21202 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
21203 GValue value = G_VALUE_INIT;
21204 GParamSpec *pspec;
21205 _ExtendedGDBusPropertyInfo *info;
21206 gboolean ret;
21207 ret = FALSE;
21208 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
21209 g_assert (info != NULL);
21210 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21211 if (pspec == NULL)
21212 {
21213 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21214 }
21215 else
21216 {
21217 if (info->use_gvariant)
21218 g_value_set_variant (&value, variant);
21219 else
21220 g_dbus_gvariant_to_gvalue (variant, &value);
21221 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21222 g_value_unset (&value);
21223 ret = TRUE;
21224 }
21225 return ret;
21226 }
21227
21228 static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
21229 {
21230 _watchdog_skeleton_handle_method_call,
21231 _watchdog_skeleton_handle_get_property,
21232 _watchdog_skeleton_handle_set_property,
21233 {NULL}
21234 };
21235
21236 static GDBusInterfaceInfo *
watchdog_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)21237 watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21238 {
21239 return watchdog_interface_info ();
21240 }
21241
21242 static GDBusInterfaceVTable *
watchdog_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)21243 watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21244 {
21245 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
21246 }
21247
21248 static GVariant *
watchdog_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)21249 watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21250 {
21251 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
21252
21253 GVariantBuilder builder;
21254 guint n;
21255 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21256 if (_watchdog_interface_info.parent_struct.properties == NULL)
21257 goto out;
21258 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
21259 {
21260 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
21261 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21262 {
21263 GVariant *value;
21264 value = _watchdog_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.Watchdog", info->name, NULL, skeleton);
21265 if (value != NULL)
21266 {
21267 g_variant_take_ref (value);
21268 g_variant_builder_add (&builder, "{sv}", info->name, value);
21269 g_variant_unref (value);
21270 }
21271 }
21272 }
21273 out:
21274 return g_variant_builder_end (&builder);
21275 }
21276
21277 static gboolean _watchdog_emit_changed (gpointer user_data);
21278
21279 static void
watchdog_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)21280 watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21281 {
21282 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
21283 gboolean emit_changed = FALSE;
21284
21285 g_mutex_lock (&skeleton->priv->lock);
21286 if (skeleton->priv->changed_properties_idle_source != NULL)
21287 {
21288 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21289 skeleton->priv->changed_properties_idle_source = NULL;
21290 emit_changed = TRUE;
21291 }
21292 g_mutex_unlock (&skeleton->priv->lock);
21293
21294 if (emit_changed)
21295 _watchdog_emit_changed (skeleton);
21296 }
21297
21298 static void
_watchdog_on_signal_watchdog_error(Watchdog * object)21299 _watchdog_on_signal_watchdog_error (
21300 Watchdog *object)
21301 {
21302 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21303
21304 GList *connections, *l;
21305 GVariant *signal_variant;
21306 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21307
21308 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21309 for (l = connections; l != NULL; l = l->next)
21310 {
21311 GDBusConnection *connection = l->data;
21312 g_dbus_connection_emit_signal (connection,
21313 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
21314 signal_variant, NULL);
21315 }
21316 g_variant_unref (signal_variant);
21317 g_list_free_full (connections, g_object_unref);
21318 }
21319
21320 static void watchdog_skeleton_iface_init (WatchdogIface *iface);
21321 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(WatchdogSkeleton,watchdog_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (WatchdogSkeleton)G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG,watchdog_skeleton_iface_init))21322 G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21323 G_ADD_PRIVATE (WatchdogSkeleton)
21324 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init))
21325
21326 #else
21327 G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21328 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init))
21329
21330 #endif
21331 static void
21332 watchdog_skeleton_finalize (GObject *object)
21333 {
21334 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21335 guint n;
21336 for (n = 0; n < 2; n++)
21337 g_value_unset (&skeleton->priv->properties[n]);
21338 g_free (skeleton->priv->properties);
21339 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21340 if (skeleton->priv->changed_properties_idle_source != NULL)
21341 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21342 g_main_context_unref (skeleton->priv->context);
21343 g_mutex_clear (&skeleton->priv->lock);
21344 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
21345 }
21346
21347 static void
watchdog_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)21348 watchdog_skeleton_get_property (GObject *object,
21349 guint prop_id,
21350 GValue *value,
21351 GParamSpec *pspec G_GNUC_UNUSED)
21352 {
21353 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21354 g_assert (prop_id != 0 && prop_id - 1 < 2);
21355 g_mutex_lock (&skeleton->priv->lock);
21356 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21357 g_mutex_unlock (&skeleton->priv->lock);
21358 }
21359
21360 static gboolean
_watchdog_emit_changed(gpointer user_data)21361 _watchdog_emit_changed (gpointer user_data)
21362 {
21363 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
21364 GList *l;
21365 GVariantBuilder builder;
21366 GVariantBuilder invalidated_builder;
21367 guint num_changes;
21368
21369 g_mutex_lock (&skeleton->priv->lock);
21370 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21371 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21372 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21373 {
21374 ChangedProperty *cp = l->data;
21375 GVariant *variant;
21376 const GValue *cur_value;
21377
21378 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21379 if (!_g_value_equal (cur_value, &cp->orig_value))
21380 {
21381 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21382 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21383 g_variant_unref (variant);
21384 num_changes++;
21385 }
21386 }
21387 if (num_changes > 0)
21388 {
21389 GList *connections, *ll;
21390 GVariant *signal_variant;
21391 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
21392 &builder, &invalidated_builder));
21393 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21394 for (ll = connections; ll != NULL; ll = ll->next)
21395 {
21396 GDBusConnection *connection = ll->data;
21397
21398 g_dbus_connection_emit_signal (connection,
21399 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21400 "org.freedesktop.DBus.Properties",
21401 "PropertiesChanged",
21402 signal_variant,
21403 NULL);
21404 }
21405 g_variant_unref (signal_variant);
21406 g_list_free_full (connections, g_object_unref);
21407 }
21408 else
21409 {
21410 g_variant_builder_clear (&builder);
21411 g_variant_builder_clear (&invalidated_builder);
21412 }
21413 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21414 skeleton->priv->changed_properties = NULL;
21415 skeleton->priv->changed_properties_idle_source = NULL;
21416 g_mutex_unlock (&skeleton->priv->lock);
21417 return FALSE;
21418 }
21419
21420 static void
_watchdog_schedule_emit_changed(WatchdogSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)21421 _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21422 {
21423 ChangedProperty *cp;
21424 GList *l;
21425 cp = NULL;
21426 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21427 {
21428 ChangedProperty *i_cp = l->data;
21429 if (i_cp->info == info)
21430 {
21431 cp = i_cp;
21432 break;
21433 }
21434 }
21435 if (cp == NULL)
21436 {
21437 cp = g_new0 (ChangedProperty, 1);
21438 cp->prop_id = prop_id;
21439 cp->info = info;
21440 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21441 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21442 g_value_copy (orig_value, &cp->orig_value);
21443 }
21444 }
21445
21446 static void
watchdog_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)21447 watchdog_skeleton_notify (GObject *object,
21448 GParamSpec *pspec G_GNUC_UNUSED)
21449 {
21450 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21451 g_mutex_lock (&skeleton->priv->lock);
21452 if (skeleton->priv->changed_properties != NULL &&
21453 skeleton->priv->changed_properties_idle_source == NULL)
21454 {
21455 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21456 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21457 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21458 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed");
21459 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21460 g_source_unref (skeleton->priv->changed_properties_idle_source);
21461 }
21462 g_mutex_unlock (&skeleton->priv->lock);
21463 }
21464
21465 static void
watchdog_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)21466 watchdog_skeleton_set_property (GObject *object,
21467 guint prop_id,
21468 const GValue *value,
21469 GParamSpec *pspec)
21470 {
21471 const _ExtendedGDBusPropertyInfo *info;
21472 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21473 g_assert (prop_id != 0 && prop_id - 1 < 2);
21474 info = (const _ExtendedGDBusPropertyInfo *) _watchdog_property_info_pointers[prop_id - 1];
21475 g_mutex_lock (&skeleton->priv->lock);
21476 g_object_freeze_notify (object);
21477 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21478 {
21479 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
21480 info->emits_changed_signal)
21481 _watchdog_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
21482 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21483 g_object_notify_by_pspec (object, pspec);
21484 }
21485 g_mutex_unlock (&skeleton->priv->lock);
21486 g_object_thaw_notify (object);
21487 }
21488
21489 static void
watchdog_skeleton_init(WatchdogSkeleton * skeleton)21490 watchdog_skeleton_init (WatchdogSkeleton *skeleton)
21491 {
21492 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21493 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
21494 #else
21495 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
21496 #endif
21497
21498 g_mutex_init (&skeleton->priv->lock);
21499 skeleton->priv->context = g_main_context_ref_thread_default ();
21500 skeleton->priv->properties = g_new0 (GValue, 2);
21501 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
21502 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
21503 }
21504
21505 static gint
watchdog_skeleton_get_watchdog(Watchdog * object)21506 watchdog_skeleton_get_watchdog (Watchdog *object)
21507 {
21508 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21509 gint value;
21510 g_mutex_lock (&skeleton->priv->lock);
21511 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
21512 g_mutex_unlock (&skeleton->priv->lock);
21513 return value;
21514 }
21515
21516 static gint
watchdog_skeleton_get_poll_interval(Watchdog * object)21517 watchdog_skeleton_get_poll_interval (Watchdog *object)
21518 {
21519 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21520 gint value;
21521 g_mutex_lock (&skeleton->priv->lock);
21522 value = g_marshal_value_peek_int (&(skeleton->priv->properties[1]));
21523 g_mutex_unlock (&skeleton->priv->lock);
21524 return value;
21525 }
21526
21527 static void
watchdog_skeleton_class_init(WatchdogSkeletonClass * klass)21528 watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
21529 {
21530 GObjectClass *gobject_class;
21531 GDBusInterfaceSkeletonClass *skeleton_class;
21532
21533 gobject_class = G_OBJECT_CLASS (klass);
21534 gobject_class->finalize = watchdog_skeleton_finalize;
21535 gobject_class->get_property = watchdog_skeleton_get_property;
21536 gobject_class->set_property = watchdog_skeleton_set_property;
21537 gobject_class->notify = watchdog_skeleton_notify;
21538
21539
21540 watchdog_override_properties (gobject_class, 1);
21541
21542 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21543 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
21544 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
21545 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
21546 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
21547
21548 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21549 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
21550 #endif
21551 }
21552
21553 static void
watchdog_skeleton_iface_init(WatchdogIface * iface)21554 watchdog_skeleton_iface_init (WatchdogIface *iface)
21555 {
21556 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
21557 iface->get_watchdog = watchdog_skeleton_get_watchdog;
21558 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
21559 }
21560
21561 /**
21562 * watchdog_skeleton_new:
21563 *
21564 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
21565 *
21566 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
21567 */
21568 Watchdog *
watchdog_skeleton_new(void)21569 watchdog_skeleton_new (void)
21570 {
21571 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
21572 }
21573
21574 /* ------------------------------------------------------------------------
21575 * Code for interface org.openbmc.EventLog
21576 * ------------------------------------------------------------------------
21577 */
21578
21579 /**
21580 * SECTION:EventLog
21581 * @title: EventLog
21582 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
21583 *
21584 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C.
21585 */
21586
21587 enum
21588 {
21589 _EVENT_LOG_EVENT_LOG,
21590 };
21591
21592 static unsigned _EVENT_LOG_SIGNALS[1] = { 0 };
21593
21594 /* ---- Introspection data for org.openbmc.EventLog ---- */
21595
21596 static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
21597 {
21598 {
21599 -1,
21600 (gchar *) "log",
21601 (gchar *) "a(s)",
21602 NULL
21603 },
21604 FALSE
21605 };
21606
21607 static const GDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
21608 {
21609 &_event_log_method_info_get_event_log_OUT_ARG_log.parent_struct,
21610 NULL
21611 };
21612
21613 static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
21614 {
21615 {
21616 -1,
21617 (gchar *) "getEventLog",
21618 NULL,
21619 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
21620 NULL
21621 },
21622 "handle-get-event-log",
21623 FALSE
21624 };
21625
21626 static const GDBusMethodInfo * const _event_log_method_info_pointers[] =
21627 {
21628 &_event_log_method_info_get_event_log.parent_struct,
21629 NULL
21630 };
21631
21632 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
21633 {
21634 {
21635 -1,
21636 (gchar *) "priority",
21637 (gchar *) "i",
21638 NULL
21639 },
21640 FALSE
21641 };
21642
21643 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
21644 {
21645 {
21646 -1,
21647 (gchar *) "message",
21648 (gchar *) "s",
21649 NULL
21650 },
21651 FALSE
21652 };
21653
21654 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
21655 {
21656 {
21657 -1,
21658 (gchar *) "rc",
21659 (gchar *) "i",
21660 NULL
21661 },
21662 FALSE
21663 };
21664
21665 static const GDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
21666 {
21667 &_event_log_signal_info_event_log_ARG_priority.parent_struct,
21668 &_event_log_signal_info_event_log_ARG_message.parent_struct,
21669 &_event_log_signal_info_event_log_ARG_rc.parent_struct,
21670 NULL
21671 };
21672
21673 static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
21674 {
21675 {
21676 -1,
21677 (gchar *) "EventLog",
21678 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
21679 NULL
21680 },
21681 "event-log"
21682 };
21683
21684 static const GDBusSignalInfo * const _event_log_signal_info_pointers[] =
21685 {
21686 &_event_log_signal_info_event_log.parent_struct,
21687 NULL
21688 };
21689
21690 static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
21691 {
21692 {
21693 -1,
21694 (gchar *) "org.openbmc.EventLog",
21695 (GDBusMethodInfo **) &_event_log_method_info_pointers,
21696 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
21697 NULL,
21698 NULL
21699 },
21700 "event-log",
21701 };
21702
21703
21704 /**
21705 * event_log_interface_info:
21706 *
21707 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
21708 *
21709 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21710 */
21711 GDBusInterfaceInfo *
event_log_interface_info(void)21712 event_log_interface_info (void)
21713 {
21714 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
21715 }
21716
21717 /**
21718 * event_log_override_properties:
21719 * @klass: The class structure for a #GObject derived class.
21720 * @property_id_begin: The property id to assign to the first overridden property.
21721 *
21722 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
21723 * The properties are overridden in the order they are defined.
21724 *
21725 * Returns: The last property id.
21726 */
21727 guint
event_log_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)21728 event_log_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
21729 {
21730 return property_id_begin - 1;
21731 }
21732
21733
21734 inline static void
event_log_signal_marshal_event_log(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)21735 event_log_signal_marshal_event_log (
21736 GClosure *closure,
21737 GValue *return_value,
21738 unsigned int n_param_values,
21739 const GValue *param_values,
21740 void *invocation_hint,
21741 void *marshal_data)
21742 {
21743 _g_dbus_codegen_marshal_VOID__INT_STRING_INT (closure,
21744 return_value, n_param_values, param_values, invocation_hint, marshal_data);
21745 }
21746
21747 inline static void
event_log_method_marshal_get_event_log(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)21748 event_log_method_marshal_get_event_log (
21749 GClosure *closure,
21750 GValue *return_value,
21751 unsigned int n_param_values,
21752 const GValue *param_values,
21753 void *invocation_hint,
21754 void *marshal_data)
21755 {
21756 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
21757 return_value, n_param_values, param_values, invocation_hint, marshal_data);
21758 }
21759
21760
21761 /**
21762 * EventLog:
21763 *
21764 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21765 */
21766
21767 /**
21768 * EventLogIface:
21769 * @parent_iface: The parent interface.
21770 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
21771 * @event_log: Handler for the #EventLog::event-log signal.
21772 *
21773 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21774 */
21775
21776 typedef EventLogIface EventLogInterface;
G_DEFINE_INTERFACE(EventLog,event_log,G_TYPE_OBJECT)21777 G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT)
21778
21779 static void
21780 event_log_default_init (EventLogIface *iface)
21781 {
21782 /* GObject signals for incoming D-Bus method calls: */
21783 /**
21784 * EventLog::handle-get-event-log:
21785 * @object: A #EventLog.
21786 * @invocation: A #GDBusMethodInvocation.
21787 *
21788 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
21789 *
21790 * 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 event_log_complete_get_event_log() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
21791 *
21792 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
21793 */
21794 g_signal_new ("handle-get-event-log",
21795 G_TYPE_FROM_INTERFACE (iface),
21796 G_SIGNAL_RUN_LAST,
21797 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
21798 g_signal_accumulator_true_handled,
21799 NULL,
21800 event_log_method_marshal_get_event_log,
21801 G_TYPE_BOOLEAN,
21802 1,
21803 G_TYPE_DBUS_METHOD_INVOCATION);
21804
21805 /* GObject signals for received D-Bus signals: */
21806 /**
21807 * EventLog::event-log:
21808 * @object: A #EventLog.
21809 * @arg_priority: Argument.
21810 * @arg_message: Argument.
21811 * @arg_rc: Argument.
21812 *
21813 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received.
21814 *
21815 * 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.
21816 */
21817 _EVENT_LOG_SIGNALS[_EVENT_LOG_EVENT_LOG] =
21818 g_signal_new ("event-log",
21819 G_TYPE_FROM_INTERFACE (iface),
21820 G_SIGNAL_RUN_LAST,
21821 G_STRUCT_OFFSET (EventLogIface, event_log),
21822 NULL,
21823 NULL,
21824 event_log_signal_marshal_event_log,
21825 G_TYPE_NONE,
21826 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
21827
21828 }
21829
21830 /**
21831 * event_log_emit_event_log:
21832 * @object: A #EventLog.
21833 * @arg_priority: Argument to pass with the signal.
21834 * @arg_message: Argument to pass with the signal.
21835 * @arg_rc: Argument to pass with the signal.
21836 *
21837 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
21838 */
21839 void
event_log_emit_event_log(EventLog * object,gint arg_priority,const gchar * arg_message,gint arg_rc)21840 event_log_emit_event_log (
21841 EventLog *object,
21842 gint arg_priority,
21843 const gchar *arg_message,
21844 gint arg_rc)
21845 {
21846 g_signal_emit (object, _EVENT_LOG_SIGNALS[_EVENT_LOG_EVENT_LOG], 0, arg_priority, arg_message, arg_rc);
21847 }
21848
21849 /**
21850 * event_log_call_get_event_log:
21851 * @proxy: A #EventLogProxy.
21852 * @cancellable: (nullable): A #GCancellable or %NULL.
21853 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21854 * @user_data: User data to pass to @callback.
21855 *
21856 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
21857 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
21858 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
21859 *
21860 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
21861 */
21862 void
event_log_call_get_event_log(EventLog * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)21863 event_log_call_get_event_log (
21864 EventLog *proxy,
21865 GCancellable *cancellable,
21866 GAsyncReadyCallback callback,
21867 gpointer user_data)
21868 {
21869 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21870 "getEventLog",
21871 g_variant_new ("()"),
21872 G_DBUS_CALL_FLAGS_NONE,
21873 -1,
21874 cancellable,
21875 callback,
21876 user_data);
21877 }
21878
21879 /**
21880 * event_log_call_get_event_log_finish:
21881 * @proxy: A #EventLogProxy.
21882 * @out_log: (out) (optional): Return location for return parameter or %NULL to ignore.
21883 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
21884 * @error: Return location for error or %NULL.
21885 *
21886 * Finishes an operation started with event_log_call_get_event_log().
21887 *
21888 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
21889 */
21890 gboolean
event_log_call_get_event_log_finish(EventLog * proxy,GVariant ** out_log,GAsyncResult * res,GError ** error)21891 event_log_call_get_event_log_finish (
21892 EventLog *proxy,
21893 GVariant **out_log,
21894 GAsyncResult *res,
21895 GError **error)
21896 {
21897 GVariant *_ret;
21898 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21899 if (_ret == NULL)
21900 goto _out;
21901 g_variant_get (_ret,
21902 "(@a(s))",
21903 out_log);
21904 g_variant_unref (_ret);
21905 _out:
21906 return _ret != NULL;
21907 }
21908
21909 /**
21910 * event_log_call_get_event_log_sync:
21911 * @proxy: A #EventLogProxy.
21912 * @out_log: (out) (optional): Return location for return parameter or %NULL to ignore.
21913 * @cancellable: (nullable): A #GCancellable or %NULL.
21914 * @error: Return location for error or %NULL.
21915 *
21916 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21917 *
21918 * See event_log_call_get_event_log() for the asynchronous version of this method.
21919 *
21920 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
21921 */
21922 gboolean
event_log_call_get_event_log_sync(EventLog * proxy,GVariant ** out_log,GCancellable * cancellable,GError ** error)21923 event_log_call_get_event_log_sync (
21924 EventLog *proxy,
21925 GVariant **out_log,
21926 GCancellable *cancellable,
21927 GError **error)
21928 {
21929 GVariant *_ret;
21930 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21931 "getEventLog",
21932 g_variant_new ("()"),
21933 G_DBUS_CALL_FLAGS_NONE,
21934 -1,
21935 cancellable,
21936 error);
21937 if (_ret == NULL)
21938 goto _out;
21939 g_variant_get (_ret,
21940 "(@a(s))",
21941 out_log);
21942 g_variant_unref (_ret);
21943 _out:
21944 return _ret != NULL;
21945 }
21946
21947 /**
21948 * event_log_complete_get_event_log:
21949 * @object: A #EventLog.
21950 * @invocation: (transfer full): A #GDBusMethodInvocation.
21951 * @log: Parameter to return.
21952 *
21953 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</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.
21954 *
21955 * This method will free @invocation, you cannot use it afterwards.
21956 */
21957 void
event_log_complete_get_event_log(EventLog * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * log)21958 event_log_complete_get_event_log (
21959 EventLog *object G_GNUC_UNUSED,
21960 GDBusMethodInvocation *invocation,
21961 GVariant *log)
21962 {
21963 g_dbus_method_invocation_return_value (invocation,
21964 g_variant_new ("(@a(s))",
21965 log));
21966 }
21967
21968 /* ------------------------------------------------------------------------ */
21969
21970 /**
21971 * EventLogProxy:
21972 *
21973 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
21974 */
21975
21976 /**
21977 * EventLogProxyClass:
21978 * @parent_class: The parent class.
21979 *
21980 * Class structure for #EventLogProxy.
21981 */
21982
21983 struct _EventLogProxyPrivate
21984 {
21985 GData *qdata;
21986 };
21987
21988 static void event_log_proxy_iface_init (EventLogIface *iface);
21989
21990 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(EventLogProxy,event_log_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (EventLogProxy)G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG,event_log_proxy_iface_init))21991 G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
21992 G_ADD_PRIVATE (EventLogProxy)
21993 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init))
21994
21995 #else
21996 G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
21997 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init))
21998
21999 #endif
22000 static void
22001 event_log_proxy_finalize (GObject *object)
22002 {
22003 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
22004 g_datalist_clear (&proxy->priv->qdata);
22005 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
22006 }
22007
22008 static void
event_log_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)22009 event_log_proxy_get_property (GObject *object G_GNUC_UNUSED,
22010 guint prop_id G_GNUC_UNUSED,
22011 GValue *value G_GNUC_UNUSED,
22012 GParamSpec *pspec G_GNUC_UNUSED)
22013 {
22014 }
22015
22016 static void
event_log_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)22017 event_log_proxy_set_property (GObject *object G_GNUC_UNUSED,
22018 guint prop_id G_GNUC_UNUSED,
22019 const GValue *value G_GNUC_UNUSED,
22020 GParamSpec *pspec G_GNUC_UNUSED)
22021 {
22022 }
22023
22024 static void
event_log_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)22025 event_log_proxy_g_signal (GDBusProxy *proxy,
22026 const gchar *sender_name G_GNUC_UNUSED,
22027 const gchar *signal_name,
22028 GVariant *parameters)
22029 {
22030 _ExtendedGDBusSignalInfo *info;
22031 GVariantIter iter;
22032 GVariant *child;
22033 GValue *paramv;
22034 gsize num_params;
22035 gsize n;
22036 guint signal_id;
22037 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
22038 if (info == NULL)
22039 return;
22040 num_params = g_variant_n_children (parameters);
22041 paramv = g_new0 (GValue, num_params + 1);
22042 g_value_init (¶mv[0], TYPE_EVENT_LOG);
22043 g_value_set_object (¶mv[0], proxy);
22044 g_variant_iter_init (&iter, parameters);
22045 n = 1;
22046 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22047 {
22048 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22049 if (arg_info->use_gvariant)
22050 {
22051 g_value_init (¶mv[n], G_TYPE_VARIANT);
22052 g_value_set_variant (¶mv[n], child);
22053 n++;
22054 }
22055 else
22056 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
22057 g_variant_unref (child);
22058 }
22059 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
22060 g_signal_emitv (paramv, signal_id, 0, NULL);
22061 for (n = 0; n < num_params + 1; n++)
22062 g_value_unset (¶mv[n]);
22063 g_free (paramv);
22064 }
22065
22066 static void
event_log_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)22067 event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
22068 GVariant *changed_properties,
22069 const gchar *const *invalidated_properties)
22070 {
22071 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
22072 guint n;
22073 const gchar *key;
22074 GVariantIter *iter;
22075 _ExtendedGDBusPropertyInfo *info;
22076 g_variant_get (changed_properties, "a{sv}", &iter);
22077 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22078 {
22079 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
22080 g_datalist_remove_data (&proxy->priv->qdata, key);
22081 if (info != NULL)
22082 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22083 }
22084 g_variant_iter_free (iter);
22085 for (n = 0; invalidated_properties[n] != NULL; n++)
22086 {
22087 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
22088 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22089 if (info != NULL)
22090 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22091 }
22092 }
22093
22094 static void
event_log_proxy_init(EventLogProxy * proxy)22095 event_log_proxy_init (EventLogProxy *proxy)
22096 {
22097 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22098 proxy->priv = event_log_proxy_get_instance_private (proxy);
22099 #else
22100 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
22101 #endif
22102
22103 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
22104 }
22105
22106 static void
event_log_proxy_class_init(EventLogProxyClass * klass)22107 event_log_proxy_class_init (EventLogProxyClass *klass)
22108 {
22109 GObjectClass *gobject_class;
22110 GDBusProxyClass *proxy_class;
22111
22112 gobject_class = G_OBJECT_CLASS (klass);
22113 gobject_class->finalize = event_log_proxy_finalize;
22114 gobject_class->get_property = event_log_proxy_get_property;
22115 gobject_class->set_property = event_log_proxy_set_property;
22116
22117 proxy_class = G_DBUS_PROXY_CLASS (klass);
22118 proxy_class->g_signal = event_log_proxy_g_signal;
22119 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
22120
22121 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22122 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
22123 #endif
22124 }
22125
22126 static void
event_log_proxy_iface_init(EventLogIface * iface G_GNUC_UNUSED)22127 event_log_proxy_iface_init (EventLogIface *iface G_GNUC_UNUSED)
22128 {
22129 }
22130
22131 /**
22132 * event_log_proxy_new:
22133 * @connection: A #GDBusConnection.
22134 * @flags: Flags from the #GDBusProxyFlags enumeration.
22135 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22136 * @object_path: An object path.
22137 * @cancellable: (nullable): A #GCancellable or %NULL.
22138 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22139 * @user_data: User data to pass to @callback.
22140 *
22141 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details.
22142 *
22143 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
22144 * You can then call event_log_proxy_new_finish() to get the result of the operation.
22145 *
22146 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
22147 */
22148 void
event_log_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)22149 event_log_proxy_new (
22150 GDBusConnection *connection,
22151 GDBusProxyFlags flags,
22152 const gchar *name,
22153 const gchar *object_path,
22154 GCancellable *cancellable,
22155 GAsyncReadyCallback callback,
22156 gpointer user_data)
22157 {
22158 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
22159 }
22160
22161 /**
22162 * event_log_proxy_new_finish:
22163 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
22164 * @error: Return location for error or %NULL
22165 *
22166 * Finishes an operation started with event_log_proxy_new().
22167 *
22168 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
22169 */
22170 EventLog *
event_log_proxy_new_finish(GAsyncResult * res,GError ** error)22171 event_log_proxy_new_finish (
22172 GAsyncResult *res,
22173 GError **error)
22174 {
22175 GObject *ret;
22176 GObject *source_object;
22177 source_object = g_async_result_get_source_object (res);
22178 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22179 g_object_unref (source_object);
22180 if (ret != NULL)
22181 return EVENT_LOG (ret);
22182 else
22183 return NULL;
22184 }
22185
22186 /**
22187 * event_log_proxy_new_sync:
22188 * @connection: A #GDBusConnection.
22189 * @flags: Flags from the #GDBusProxyFlags enumeration.
22190 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22191 * @object_path: An object path.
22192 * @cancellable: (nullable): A #GCancellable or %NULL.
22193 * @error: Return location for error or %NULL
22194 *
22195 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details.
22196 *
22197 * The calling thread is blocked until a reply is received.
22198 *
22199 * See event_log_proxy_new() for the asynchronous version of this constructor.
22200 *
22201 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
22202 */
22203 EventLog *
event_log_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)22204 event_log_proxy_new_sync (
22205 GDBusConnection *connection,
22206 GDBusProxyFlags flags,
22207 const gchar *name,
22208 const gchar *object_path,
22209 GCancellable *cancellable,
22210 GError **error)
22211 {
22212 GInitable *ret;
22213 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
22214 if (ret != NULL)
22215 return EVENT_LOG (ret);
22216 else
22217 return NULL;
22218 }
22219
22220
22221 /**
22222 * event_log_proxy_new_for_bus:
22223 * @bus_type: A #GBusType.
22224 * @flags: Flags from the #GDBusProxyFlags enumeration.
22225 * @name: A bus name (well-known or unique).
22226 * @object_path: An object path.
22227 * @cancellable: (nullable): A #GCancellable or %NULL.
22228 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22229 * @user_data: User data to pass to @callback.
22230 *
22231 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22232 *
22233 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
22234 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
22235 *
22236 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22237 */
22238 void
event_log_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)22239 event_log_proxy_new_for_bus (
22240 GBusType bus_type,
22241 GDBusProxyFlags flags,
22242 const gchar *name,
22243 const gchar *object_path,
22244 GCancellable *cancellable,
22245 GAsyncReadyCallback callback,
22246 gpointer user_data)
22247 {
22248 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
22249 }
22250
22251 /**
22252 * event_log_proxy_new_for_bus_finish:
22253 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
22254 * @error: Return location for error or %NULL
22255 *
22256 * Finishes an operation started with event_log_proxy_new_for_bus().
22257 *
22258 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
22259 */
22260 EventLog *
event_log_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)22261 event_log_proxy_new_for_bus_finish (
22262 GAsyncResult *res,
22263 GError **error)
22264 {
22265 GObject *ret;
22266 GObject *source_object;
22267 source_object = g_async_result_get_source_object (res);
22268 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22269 g_object_unref (source_object);
22270 if (ret != NULL)
22271 return EVENT_LOG (ret);
22272 else
22273 return NULL;
22274 }
22275
22276 /**
22277 * event_log_proxy_new_for_bus_sync:
22278 * @bus_type: A #GBusType.
22279 * @flags: Flags from the #GDBusProxyFlags enumeration.
22280 * @name: A bus name (well-known or unique).
22281 * @object_path: An object path.
22282 * @cancellable: (nullable): A #GCancellable or %NULL.
22283 * @error: Return location for error or %NULL
22284 *
22285 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22286 *
22287 * The calling thread is blocked until a reply is received.
22288 *
22289 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
22290 *
22291 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
22292 */
22293 EventLog *
event_log_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)22294 event_log_proxy_new_for_bus_sync (
22295 GBusType bus_type,
22296 GDBusProxyFlags flags,
22297 const gchar *name,
22298 const gchar *object_path,
22299 GCancellable *cancellable,
22300 GError **error)
22301 {
22302 GInitable *ret;
22303 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
22304 if (ret != NULL)
22305 return EVENT_LOG (ret);
22306 else
22307 return NULL;
22308 }
22309
22310
22311 /* ------------------------------------------------------------------------ */
22312
22313 /**
22314 * EventLogSkeleton:
22315 *
22316 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
22317 */
22318
22319 /**
22320 * EventLogSkeletonClass:
22321 * @parent_class: The parent class.
22322 *
22323 * Class structure for #EventLogSkeleton.
22324 */
22325
22326 struct _EventLogSkeletonPrivate
22327 {
22328 GValue *properties;
22329 GList *changed_properties;
22330 GSource *changed_properties_idle_source;
22331 GMainContext *context;
22332 GMutex lock;
22333 };
22334
22335 static void
_event_log_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)22336 _event_log_skeleton_handle_method_call (
22337 GDBusConnection *connection G_GNUC_UNUSED,
22338 const gchar *sender G_GNUC_UNUSED,
22339 const gchar *object_path G_GNUC_UNUSED,
22340 const gchar *interface_name,
22341 const gchar *method_name,
22342 GVariant *parameters,
22343 GDBusMethodInvocation *invocation,
22344 gpointer user_data)
22345 {
22346 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
22347 _ExtendedGDBusMethodInfo *info;
22348 GVariantIter iter;
22349 GVariant *child;
22350 GValue *paramv;
22351 gsize num_params;
22352 guint num_extra;
22353 gsize n;
22354 guint signal_id;
22355 GValue return_value = G_VALUE_INIT;
22356 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22357 g_assert (info != NULL);
22358 num_params = g_variant_n_children (parameters);
22359 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22360 n = 0;
22361 g_value_init (¶mv[n], TYPE_EVENT_LOG);
22362 g_value_set_object (¶mv[n++], skeleton);
22363 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22364 g_value_set_object (¶mv[n++], invocation);
22365 if (info->pass_fdlist)
22366 {
22367 #ifdef G_OS_UNIX
22368 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
22369 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22370 #else
22371 g_assert_not_reached ();
22372 #endif
22373 }
22374 g_variant_iter_init (&iter, parameters);
22375 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22376 {
22377 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22378 if (arg_info->use_gvariant)
22379 {
22380 g_value_init (¶mv[n], G_TYPE_VARIANT);
22381 g_value_set_variant (¶mv[n], child);
22382 n++;
22383 }
22384 else
22385 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
22386 g_variant_unref (child);
22387 }
22388 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
22389 g_value_init (&return_value, G_TYPE_BOOLEAN);
22390 g_signal_emitv (paramv, signal_id, 0, &return_value);
22391 if (!g_value_get_boolean (&return_value))
22392 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);
22393 g_value_unset (&return_value);
22394 for (n = 0; n < num_params + num_extra; n++)
22395 g_value_unset (¶mv[n]);
22396 g_free (paramv);
22397 }
22398
22399 static GVariant *
_event_log_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)22400 _event_log_skeleton_handle_get_property (
22401 GDBusConnection *connection G_GNUC_UNUSED,
22402 const gchar *sender G_GNUC_UNUSED,
22403 const gchar *object_path G_GNUC_UNUSED,
22404 const gchar *interface_name G_GNUC_UNUSED,
22405 const gchar *property_name,
22406 GError **error,
22407 gpointer user_data)
22408 {
22409 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
22410 GValue value = G_VALUE_INIT;
22411 GParamSpec *pspec;
22412 _ExtendedGDBusPropertyInfo *info;
22413 GVariant *ret;
22414 ret = NULL;
22415 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
22416 g_assert (info != NULL);
22417 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22418 if (pspec == NULL)
22419 {
22420 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22421 }
22422 else
22423 {
22424 g_value_init (&value, pspec->value_type);
22425 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22426 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22427 g_value_unset (&value);
22428 }
22429 return ret;
22430 }
22431
22432 static gboolean
_event_log_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)22433 _event_log_skeleton_handle_set_property (
22434 GDBusConnection *connection G_GNUC_UNUSED,
22435 const gchar *sender G_GNUC_UNUSED,
22436 const gchar *object_path G_GNUC_UNUSED,
22437 const gchar *interface_name G_GNUC_UNUSED,
22438 const gchar *property_name,
22439 GVariant *variant,
22440 GError **error,
22441 gpointer user_data)
22442 {
22443 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
22444 GValue value = G_VALUE_INIT;
22445 GParamSpec *pspec;
22446 _ExtendedGDBusPropertyInfo *info;
22447 gboolean ret;
22448 ret = FALSE;
22449 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
22450 g_assert (info != NULL);
22451 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22452 if (pspec == NULL)
22453 {
22454 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22455 }
22456 else
22457 {
22458 if (info->use_gvariant)
22459 g_value_set_variant (&value, variant);
22460 else
22461 g_dbus_gvariant_to_gvalue (variant, &value);
22462 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22463 g_value_unset (&value);
22464 ret = TRUE;
22465 }
22466 return ret;
22467 }
22468
22469 static const GDBusInterfaceVTable _event_log_skeleton_vtable =
22470 {
22471 _event_log_skeleton_handle_method_call,
22472 _event_log_skeleton_handle_get_property,
22473 _event_log_skeleton_handle_set_property,
22474 {NULL}
22475 };
22476
22477 static GDBusInterfaceInfo *
event_log_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)22478 event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22479 {
22480 return event_log_interface_info ();
22481 }
22482
22483 static GDBusInterfaceVTable *
event_log_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)22484 event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22485 {
22486 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
22487 }
22488
22489 static GVariant *
event_log_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)22490 event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22491 {
22492 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
22493
22494 GVariantBuilder builder;
22495 guint n;
22496 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22497 if (_event_log_interface_info.parent_struct.properties == NULL)
22498 goto out;
22499 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
22500 {
22501 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
22502 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22503 {
22504 GVariant *value;
22505 value = _event_log_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.EventLog", info->name, NULL, skeleton);
22506 if (value != NULL)
22507 {
22508 g_variant_take_ref (value);
22509 g_variant_builder_add (&builder, "{sv}", info->name, value);
22510 g_variant_unref (value);
22511 }
22512 }
22513 }
22514 out:
22515 return g_variant_builder_end (&builder);
22516 }
22517
22518 static void
event_log_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)22519 event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
22520 {
22521 }
22522
22523 static void
_event_log_on_signal_event_log(EventLog * object,gint arg_priority,const gchar * arg_message,gint arg_rc)22524 _event_log_on_signal_event_log (
22525 EventLog *object,
22526 gint arg_priority,
22527 const gchar *arg_message,
22528 gint arg_rc)
22529 {
22530 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
22531
22532 GList *connections, *l;
22533 GVariant *signal_variant;
22534 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22535
22536 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
22537 arg_priority,
22538 arg_message,
22539 arg_rc));
22540 for (l = connections; l != NULL; l = l->next)
22541 {
22542 GDBusConnection *connection = l->data;
22543 g_dbus_connection_emit_signal (connection,
22544 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
22545 signal_variant, NULL);
22546 }
22547 g_variant_unref (signal_variant);
22548 g_list_free_full (connections, g_object_unref);
22549 }
22550
22551 static void event_log_skeleton_iface_init (EventLogIface *iface);
22552 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(EventLogSkeleton,event_log_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (EventLogSkeleton)G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG,event_log_skeleton_iface_init))22553 G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22554 G_ADD_PRIVATE (EventLogSkeleton)
22555 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init))
22556
22557 #else
22558 G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22559 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init))
22560
22561 #endif
22562 static void
22563 event_log_skeleton_finalize (GObject *object)
22564 {
22565 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
22566 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22567 if (skeleton->priv->changed_properties_idle_source != NULL)
22568 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22569 g_main_context_unref (skeleton->priv->context);
22570 g_mutex_clear (&skeleton->priv->lock);
22571 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
22572 }
22573
22574 static void
event_log_skeleton_init(EventLogSkeleton * skeleton)22575 event_log_skeleton_init (EventLogSkeleton *skeleton)
22576 {
22577 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22578 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
22579 #else
22580 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
22581 #endif
22582
22583 g_mutex_init (&skeleton->priv->lock);
22584 skeleton->priv->context = g_main_context_ref_thread_default ();
22585 }
22586
22587 static void
event_log_skeleton_class_init(EventLogSkeletonClass * klass)22588 event_log_skeleton_class_init (EventLogSkeletonClass *klass)
22589 {
22590 GObjectClass *gobject_class;
22591 GDBusInterfaceSkeletonClass *skeleton_class;
22592
22593 gobject_class = G_OBJECT_CLASS (klass);
22594 gobject_class->finalize = event_log_skeleton_finalize;
22595
22596 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22597 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
22598 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
22599 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
22600 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
22601
22602 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22603 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
22604 #endif
22605 }
22606
22607 static void
event_log_skeleton_iface_init(EventLogIface * iface)22608 event_log_skeleton_iface_init (EventLogIface *iface)
22609 {
22610 iface->event_log = _event_log_on_signal_event_log;
22611 }
22612
22613 /**
22614 * event_log_skeleton_new:
22615 *
22616 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
22617 *
22618 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
22619 */
22620 EventLog *
event_log_skeleton_new(void)22621 event_log_skeleton_new (void)
22622 {
22623 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
22624 }
22625
22626 /* ------------------------------------------------------------------------
22627 * Code for interface org.openbmc.Flash
22628 * ------------------------------------------------------------------------
22629 */
22630
22631 /**
22632 * SECTION:Flash
22633 * @title: Flash
22634 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
22635 *
22636 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface in C.
22637 */
22638
22639 enum
22640 {
22641 _FLASH_UPDATED,
22642 _FLASH_DOWNLOAD,
22643 };
22644
22645 static unsigned _FLASH_SIGNALS[2] = { 0 };
22646
22647 /* ---- Introspection data for org.openbmc.Flash ---- */
22648
22649 static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
22650 {
22651 {
22652 -1,
22653 (gchar *) "filename",
22654 (gchar *) "s",
22655 NULL
22656 },
22657 FALSE
22658 };
22659
22660 static const GDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
22661 {
22662 &_flash_method_info_update_IN_ARG_filename.parent_struct,
22663 NULL
22664 };
22665
22666 static const _ExtendedGDBusMethodInfo _flash_method_info_update =
22667 {
22668 {
22669 -1,
22670 (gchar *) "update",
22671 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
22672 NULL,
22673 NULL
22674 },
22675 "handle-update",
22676 FALSE
22677 };
22678
22679 static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
22680 {
22681 {
22682 -1,
22683 (gchar *) "message",
22684 (gchar *) "s",
22685 NULL
22686 },
22687 FALSE
22688 };
22689
22690 static const GDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
22691 {
22692 &_flash_method_info_error_IN_ARG_message.parent_struct,
22693 NULL
22694 };
22695
22696 static const _ExtendedGDBusMethodInfo _flash_method_info_error =
22697 {
22698 {
22699 -1,
22700 (gchar *) "error",
22701 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
22702 NULL,
22703 NULL
22704 },
22705 "handle-error",
22706 FALSE
22707 };
22708
22709 static const _ExtendedGDBusMethodInfo _flash_method_info_done =
22710 {
22711 {
22712 -1,
22713 (gchar *) "done",
22714 NULL,
22715 NULL,
22716 NULL
22717 },
22718 "handle-done",
22719 FALSE
22720 };
22721
22722 static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
22723 {
22724 {
22725 -1,
22726 (gchar *) "url",
22727 (gchar *) "s",
22728 NULL
22729 },
22730 FALSE
22731 };
22732
22733 static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
22734 {
22735 {
22736 -1,
22737 (gchar *) "filename",
22738 (gchar *) "s",
22739 NULL
22740 },
22741 FALSE
22742 };
22743
22744 static const GDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
22745 {
22746 &_flash_method_info_update_via_tftp_IN_ARG_url.parent_struct,
22747 &_flash_method_info_update_via_tftp_IN_ARG_filename.parent_struct,
22748 NULL
22749 };
22750
22751 static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
22752 {
22753 {
22754 -1,
22755 (gchar *) "updateViaTftp",
22756 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
22757 NULL,
22758 NULL
22759 },
22760 "handle-update-via-tftp",
22761 FALSE
22762 };
22763
22764 static const _ExtendedGDBusMethodInfo _flash_method_info_init =
22765 {
22766 {
22767 -1,
22768 (gchar *) "init",
22769 NULL,
22770 NULL,
22771 NULL
22772 },
22773 "handle-init",
22774 FALSE
22775 };
22776
22777 static const GDBusMethodInfo * const _flash_method_info_pointers[] =
22778 {
22779 &_flash_method_info_update.parent_struct,
22780 &_flash_method_info_error.parent_struct,
22781 &_flash_method_info_done.parent_struct,
22782 &_flash_method_info_update_via_tftp.parent_struct,
22783 &_flash_method_info_init.parent_struct,
22784 NULL
22785 };
22786
22787 static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
22788 {
22789 {
22790 -1,
22791 (gchar *) "Updated",
22792 NULL,
22793 NULL
22794 },
22795 "updated"
22796 };
22797
22798 static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
22799 {
22800 {
22801 -1,
22802 (gchar *) "url",
22803 (gchar *) "s",
22804 NULL
22805 },
22806 FALSE
22807 };
22808
22809 static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
22810 {
22811 {
22812 -1,
22813 (gchar *) "filename",
22814 (gchar *) "s",
22815 NULL
22816 },
22817 FALSE
22818 };
22819
22820 static const GDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
22821 {
22822 &_flash_signal_info_download_ARG_url.parent_struct,
22823 &_flash_signal_info_download_ARG_filename.parent_struct,
22824 NULL
22825 };
22826
22827 static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
22828 {
22829 {
22830 -1,
22831 (gchar *) "Download",
22832 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
22833 NULL
22834 },
22835 "download"
22836 };
22837
22838 static const GDBusSignalInfo * const _flash_signal_info_pointers[] =
22839 {
22840 &_flash_signal_info_updated.parent_struct,
22841 &_flash_signal_info_download.parent_struct,
22842 NULL
22843 };
22844
22845 static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
22846 {
22847 {
22848 -1,
22849 (gchar *) "filename",
22850 (gchar *) "s",
22851 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22852 NULL
22853 },
22854 "filename",
22855 FALSE,
22856 TRUE
22857 };
22858
22859 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
22860 {
22861 {
22862 -1,
22863 (gchar *) "flasher_path",
22864 (gchar *) "s",
22865 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22866 NULL
22867 },
22868 "flasher-path",
22869 FALSE,
22870 TRUE
22871 };
22872
22873 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
22874 {
22875 {
22876 -1,
22877 (gchar *) "flasher_name",
22878 (gchar *) "s",
22879 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22880 NULL
22881 },
22882 "flasher-name",
22883 FALSE,
22884 TRUE
22885 };
22886
22887 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
22888 {
22889 {
22890 -1,
22891 (gchar *) "flasher_instance",
22892 (gchar *) "s",
22893 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22894 NULL
22895 },
22896 "flasher-instance",
22897 FALSE,
22898 TRUE
22899 };
22900
22901 static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
22902 {
22903 {
22904 -1,
22905 (gchar *) "status",
22906 (gchar *) "s",
22907 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22908 NULL
22909 },
22910 "status",
22911 FALSE,
22912 TRUE
22913 };
22914
22915 static const GDBusPropertyInfo * const _flash_property_info_pointers[] =
22916 {
22917 &_flash_property_info_filename.parent_struct,
22918 &_flash_property_info_flasher_path.parent_struct,
22919 &_flash_property_info_flasher_name.parent_struct,
22920 &_flash_property_info_flasher_instance.parent_struct,
22921 &_flash_property_info_status.parent_struct,
22922 NULL
22923 };
22924
22925 static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
22926 {
22927 {
22928 -1,
22929 (gchar *) "org.openbmc.Flash",
22930 (GDBusMethodInfo **) &_flash_method_info_pointers,
22931 (GDBusSignalInfo **) &_flash_signal_info_pointers,
22932 (GDBusPropertyInfo **) &_flash_property_info_pointers,
22933 NULL
22934 },
22935 "flash",
22936 };
22937
22938
22939 /**
22940 * flash_interface_info:
22941 *
22942 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
22943 *
22944 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22945 */
22946 GDBusInterfaceInfo *
flash_interface_info(void)22947 flash_interface_info (void)
22948 {
22949 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
22950 }
22951
22952 /**
22953 * flash_override_properties:
22954 * @klass: The class structure for a #GObject derived class.
22955 * @property_id_begin: The property id to assign to the first overridden property.
22956 *
22957 * Overrides all #GObject properties in the #Flash interface for a concrete class.
22958 * The properties are overridden in the order they are defined.
22959 *
22960 * Returns: The last property id.
22961 */
22962 guint
flash_override_properties(GObjectClass * klass,guint property_id_begin)22963 flash_override_properties (GObjectClass *klass, guint property_id_begin)
22964 {
22965 g_object_class_override_property (klass, property_id_begin++, "filename");
22966 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
22967 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
22968 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
22969 g_object_class_override_property (klass, property_id_begin++, "status");
22970 return property_id_begin - 1;
22971 }
22972
22973
22974 inline static void
flash_signal_marshal_updated(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)22975 flash_signal_marshal_updated (
22976 GClosure *closure,
22977 GValue *return_value,
22978 unsigned int n_param_values,
22979 const GValue *param_values,
22980 void *invocation_hint,
22981 void *marshal_data)
22982 {
22983 g_cclosure_marshal_VOID__VOID (closure,
22984 return_value, n_param_values, param_values, invocation_hint, marshal_data);
22985 }
22986
22987 inline static void
flash_signal_marshal_download(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)22988 flash_signal_marshal_download (
22989 GClosure *closure,
22990 GValue *return_value,
22991 unsigned int n_param_values,
22992 const GValue *param_values,
22993 void *invocation_hint,
22994 void *marshal_data)
22995 {
22996 _g_dbus_codegen_marshal_VOID__STRING_STRING (closure,
22997 return_value, n_param_values, param_values, invocation_hint, marshal_data);
22998 }
22999
23000 inline static void
flash_method_marshal_update(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)23001 flash_method_marshal_update (
23002 GClosure *closure,
23003 GValue *return_value,
23004 unsigned int n_param_values,
23005 const GValue *param_values,
23006 void *invocation_hint,
23007 void *marshal_data)
23008 {
23009 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure,
23010 return_value, n_param_values, param_values, invocation_hint, marshal_data);
23011 }
23012
23013 inline static void
flash_method_marshal_error(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)23014 flash_method_marshal_error (
23015 GClosure *closure,
23016 GValue *return_value,
23017 unsigned int n_param_values,
23018 const GValue *param_values,
23019 void *invocation_hint,
23020 void *marshal_data)
23021 {
23022 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure,
23023 return_value, n_param_values, param_values, invocation_hint, marshal_data);
23024 }
23025
23026 inline static void
flash_method_marshal_done(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)23027 flash_method_marshal_done (
23028 GClosure *closure,
23029 GValue *return_value,
23030 unsigned int n_param_values,
23031 const GValue *param_values,
23032 void *invocation_hint,
23033 void *marshal_data)
23034 {
23035 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
23036 return_value, n_param_values, param_values, invocation_hint, marshal_data);
23037 }
23038
23039 inline static void
flash_method_marshal_update_via_tftp(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)23040 flash_method_marshal_update_via_tftp (
23041 GClosure *closure,
23042 GValue *return_value,
23043 unsigned int n_param_values,
23044 const GValue *param_values,
23045 void *invocation_hint,
23046 void *marshal_data)
23047 {
23048 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING (closure,
23049 return_value, n_param_values, param_values, invocation_hint, marshal_data);
23050 }
23051
23052 inline static void
flash_method_marshal_init(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)23053 flash_method_marshal_init (
23054 GClosure *closure,
23055 GValue *return_value,
23056 unsigned int n_param_values,
23057 const GValue *param_values,
23058 void *invocation_hint,
23059 void *marshal_data)
23060 {
23061 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
23062 return_value, n_param_values, param_values, invocation_hint, marshal_data);
23063 }
23064
23065
23066 /**
23067 * Flash:
23068 *
23069 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23070 */
23071
23072 /**
23073 * FlashIface:
23074 * @parent_iface: The parent interface.
23075 * @handle_done: Handler for the #Flash::handle-done signal.
23076 * @handle_error: Handler for the #Flash::handle-error signal.
23077 * @handle_init: Handler for the #Flash::handle-init signal.
23078 * @handle_update: Handler for the #Flash::handle-update signal.
23079 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
23080 * @get_filename: Getter for the #Flash:filename property.
23081 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
23082 * @get_flasher_name: Getter for the #Flash:flasher-name property.
23083 * @get_flasher_path: Getter for the #Flash:flasher-path property.
23084 * @get_status: Getter for the #Flash:status property.
23085 * @download: Handler for the #Flash::download signal.
23086 * @updated: Handler for the #Flash::updated signal.
23087 *
23088 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23089 */
23090
23091 typedef FlashIface FlashInterface;
G_DEFINE_INTERFACE(Flash,flash,G_TYPE_OBJECT)23092 G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT)
23093
23094 static void
23095 flash_default_init (FlashIface *iface)
23096 {
23097 /* GObject signals for incoming D-Bus method calls: */
23098 /**
23099 * Flash::handle-update:
23100 * @object: A #Flash.
23101 * @invocation: A #GDBusMethodInvocation.
23102 * @arg_filename: Argument passed by remote caller.
23103 *
23104 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method.
23105 *
23106 * 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 flash_complete_update() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
23107 *
23108 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
23109 */
23110 g_signal_new ("handle-update",
23111 G_TYPE_FROM_INTERFACE (iface),
23112 G_SIGNAL_RUN_LAST,
23113 G_STRUCT_OFFSET (FlashIface, handle_update),
23114 g_signal_accumulator_true_handled,
23115 NULL,
23116 flash_method_marshal_update,
23117 G_TYPE_BOOLEAN,
23118 2,
23119 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
23120
23121 /**
23122 * Flash::handle-error:
23123 * @object: A #Flash.
23124 * @invocation: A #GDBusMethodInvocation.
23125 * @arg_message: Argument passed by remote caller.
23126 *
23127 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
23128 *
23129 * 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 flash_complete_error() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
23130 *
23131 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
23132 */
23133 g_signal_new ("handle-error",
23134 G_TYPE_FROM_INTERFACE (iface),
23135 G_SIGNAL_RUN_LAST,
23136 G_STRUCT_OFFSET (FlashIface, handle_error),
23137 g_signal_accumulator_true_handled,
23138 NULL,
23139 flash_method_marshal_error,
23140 G_TYPE_BOOLEAN,
23141 2,
23142 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
23143
23144 /**
23145 * Flash::handle-done:
23146 * @object: A #Flash.
23147 * @invocation: A #GDBusMethodInvocation.
23148 *
23149 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
23150 *
23151 * 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 flash_complete_done() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
23152 *
23153 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
23154 */
23155 g_signal_new ("handle-done",
23156 G_TYPE_FROM_INTERFACE (iface),
23157 G_SIGNAL_RUN_LAST,
23158 G_STRUCT_OFFSET (FlashIface, handle_done),
23159 g_signal_accumulator_true_handled,
23160 NULL,
23161 flash_method_marshal_done,
23162 G_TYPE_BOOLEAN,
23163 1,
23164 G_TYPE_DBUS_METHOD_INVOCATION);
23165
23166 /**
23167 * Flash::handle-update-via-tftp:
23168 * @object: A #Flash.
23169 * @invocation: A #GDBusMethodInvocation.
23170 * @arg_url: Argument passed by remote caller.
23171 * @arg_filename: Argument passed by remote caller.
23172 *
23173 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
23174 *
23175 * 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 flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
23176 *
23177 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
23178 */
23179 g_signal_new ("handle-update-via-tftp",
23180 G_TYPE_FROM_INTERFACE (iface),
23181 G_SIGNAL_RUN_LAST,
23182 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
23183 g_signal_accumulator_true_handled,
23184 NULL,
23185 flash_method_marshal_update_via_tftp,
23186 G_TYPE_BOOLEAN,
23187 3,
23188 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
23189
23190 /**
23191 * Flash::handle-init:
23192 * @object: A #Flash.
23193 * @invocation: A #GDBusMethodInvocation.
23194 *
23195 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
23196 *
23197 * 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 flash_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
23198 *
23199 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
23200 */
23201 g_signal_new ("handle-init",
23202 G_TYPE_FROM_INTERFACE (iface),
23203 G_SIGNAL_RUN_LAST,
23204 G_STRUCT_OFFSET (FlashIface, handle_init),
23205 g_signal_accumulator_true_handled,
23206 NULL,
23207 flash_method_marshal_init,
23208 G_TYPE_BOOLEAN,
23209 1,
23210 G_TYPE_DBUS_METHOD_INVOCATION);
23211
23212 /* GObject signals for received D-Bus signals: */
23213 /**
23214 * Flash::updated:
23215 * @object: A #Flash.
23216 *
23217 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> is received.
23218 *
23219 * 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.
23220 */
23221 _FLASH_SIGNALS[_FLASH_UPDATED] =
23222 g_signal_new ("updated",
23223 G_TYPE_FROM_INTERFACE (iface),
23224 G_SIGNAL_RUN_LAST,
23225 G_STRUCT_OFFSET (FlashIface, updated),
23226 NULL,
23227 NULL,
23228 flash_signal_marshal_updated,
23229 G_TYPE_NONE,
23230 0);
23231
23232 /**
23233 * Flash::download:
23234 * @object: A #Flash.
23235 * @arg_url: Argument.
23236 * @arg_filename: Argument.
23237 *
23238 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
23239 *
23240 * 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.
23241 */
23242 _FLASH_SIGNALS[_FLASH_DOWNLOAD] =
23243 g_signal_new ("download",
23244 G_TYPE_FROM_INTERFACE (iface),
23245 G_SIGNAL_RUN_LAST,
23246 G_STRUCT_OFFSET (FlashIface, download),
23247 NULL,
23248 NULL,
23249 flash_signal_marshal_download,
23250 G_TYPE_NONE,
23251 2, G_TYPE_STRING, G_TYPE_STRING);
23252
23253 /* GObject properties for D-Bus properties: */
23254 /**
23255 * Flash:filename:
23256 *
23257 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
23258 *
23259 * 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.
23260 */
23261 g_object_interface_install_property (iface,
23262 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23263 /**
23264 * Flash:flasher-path:
23265 *
23266 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
23267 *
23268 * 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.
23269 */
23270 g_object_interface_install_property (iface,
23271 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23272 /**
23273 * Flash:flasher-name:
23274 *
23275 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
23276 *
23277 * 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.
23278 */
23279 g_object_interface_install_property (iface,
23280 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23281 /**
23282 * Flash:flasher-instance:
23283 *
23284 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
23285 *
23286 * 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.
23287 */
23288 g_object_interface_install_property (iface,
23289 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23290 /**
23291 * Flash:status:
23292 *
23293 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
23294 *
23295 * 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.
23296 */
23297 g_object_interface_install_property (iface,
23298 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23299 }
23300
23301 /**
23302 * flash_get_filename: (skip)
23303 * @object: A #Flash.
23304 *
23305 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
23306 *
23307 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23308 *
23309 * 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 flash_dup_filename() if on another thread.
23310 *
23311 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23312 */
23313 const gchar *
flash_get_filename(Flash * object)23314 flash_get_filename (Flash *object)
23315 {
23316 g_return_val_if_fail (IS_FLASH (object), NULL);
23317
23318 return FLASH_GET_IFACE (object)->get_filename (object);
23319 }
23320
23321 /**
23322 * flash_dup_filename: (skip)
23323 * @object: A #Flash.
23324 *
23325 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
23326 *
23327 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23328 *
23329 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23330 */
23331 gchar *
flash_dup_filename(Flash * object)23332 flash_dup_filename (Flash *object)
23333 {
23334 gchar *value;
23335 g_object_get (G_OBJECT (object), "filename", &value, NULL);
23336 return value;
23337 }
23338
23339 /**
23340 * flash_set_filename: (skip)
23341 * @object: A #Flash.
23342 * @value: The value to set.
23343 *
23344 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
23345 *
23346 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23347 */
23348 void
flash_set_filename(Flash * object,const gchar * value)23349 flash_set_filename (Flash *object, const gchar *value)
23350 {
23351 g_object_set (G_OBJECT (object), "filename", value, NULL);
23352 }
23353
23354 /**
23355 * flash_get_flasher_path: (skip)
23356 * @object: A #Flash.
23357 *
23358 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
23359 *
23360 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23361 *
23362 * 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 flash_dup_flasher_path() if on another thread.
23363 *
23364 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23365 */
23366 const gchar *
flash_get_flasher_path(Flash * object)23367 flash_get_flasher_path (Flash *object)
23368 {
23369 g_return_val_if_fail (IS_FLASH (object), NULL);
23370
23371 return FLASH_GET_IFACE (object)->get_flasher_path (object);
23372 }
23373
23374 /**
23375 * flash_dup_flasher_path: (skip)
23376 * @object: A #Flash.
23377 *
23378 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
23379 *
23380 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23381 *
23382 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23383 */
23384 gchar *
flash_dup_flasher_path(Flash * object)23385 flash_dup_flasher_path (Flash *object)
23386 {
23387 gchar *value;
23388 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
23389 return value;
23390 }
23391
23392 /**
23393 * flash_set_flasher_path: (skip)
23394 * @object: A #Flash.
23395 * @value: The value to set.
23396 *
23397 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
23398 *
23399 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23400 */
23401 void
flash_set_flasher_path(Flash * object,const gchar * value)23402 flash_set_flasher_path (Flash *object, const gchar *value)
23403 {
23404 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
23405 }
23406
23407 /**
23408 * flash_get_flasher_name: (skip)
23409 * @object: A #Flash.
23410 *
23411 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
23412 *
23413 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23414 *
23415 * 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 flash_dup_flasher_name() if on another thread.
23416 *
23417 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23418 */
23419 const gchar *
flash_get_flasher_name(Flash * object)23420 flash_get_flasher_name (Flash *object)
23421 {
23422 g_return_val_if_fail (IS_FLASH (object), NULL);
23423
23424 return FLASH_GET_IFACE (object)->get_flasher_name (object);
23425 }
23426
23427 /**
23428 * flash_dup_flasher_name: (skip)
23429 * @object: A #Flash.
23430 *
23431 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
23432 *
23433 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23434 *
23435 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23436 */
23437 gchar *
flash_dup_flasher_name(Flash * object)23438 flash_dup_flasher_name (Flash *object)
23439 {
23440 gchar *value;
23441 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
23442 return value;
23443 }
23444
23445 /**
23446 * flash_set_flasher_name: (skip)
23447 * @object: A #Flash.
23448 * @value: The value to set.
23449 *
23450 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
23451 *
23452 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23453 */
23454 void
flash_set_flasher_name(Flash * object,const gchar * value)23455 flash_set_flasher_name (Flash *object, const gchar *value)
23456 {
23457 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
23458 }
23459
23460 /**
23461 * flash_get_flasher_instance: (skip)
23462 * @object: A #Flash.
23463 *
23464 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
23465 *
23466 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23467 *
23468 * 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 flash_dup_flasher_instance() if on another thread.
23469 *
23470 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23471 */
23472 const gchar *
flash_get_flasher_instance(Flash * object)23473 flash_get_flasher_instance (Flash *object)
23474 {
23475 g_return_val_if_fail (IS_FLASH (object), NULL);
23476
23477 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
23478 }
23479
23480 /**
23481 * flash_dup_flasher_instance: (skip)
23482 * @object: A #Flash.
23483 *
23484 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
23485 *
23486 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23487 *
23488 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23489 */
23490 gchar *
flash_dup_flasher_instance(Flash * object)23491 flash_dup_flasher_instance (Flash *object)
23492 {
23493 gchar *value;
23494 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
23495 return value;
23496 }
23497
23498 /**
23499 * flash_set_flasher_instance: (skip)
23500 * @object: A #Flash.
23501 * @value: The value to set.
23502 *
23503 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
23504 *
23505 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23506 */
23507 void
flash_set_flasher_instance(Flash * object,const gchar * value)23508 flash_set_flasher_instance (Flash *object, const gchar *value)
23509 {
23510 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
23511 }
23512
23513 /**
23514 * flash_get_status: (skip)
23515 * @object: A #Flash.
23516 *
23517 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
23518 *
23519 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23520 *
23521 * 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 flash_dup_status() if on another thread.
23522 *
23523 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23524 */
23525 const gchar *
flash_get_status(Flash * object)23526 flash_get_status (Flash *object)
23527 {
23528 g_return_val_if_fail (IS_FLASH (object), NULL);
23529
23530 return FLASH_GET_IFACE (object)->get_status (object);
23531 }
23532
23533 /**
23534 * flash_dup_status: (skip)
23535 * @object: A #Flash.
23536 *
23537 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
23538 *
23539 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23540 *
23541 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23542 */
23543 gchar *
flash_dup_status(Flash * object)23544 flash_dup_status (Flash *object)
23545 {
23546 gchar *value;
23547 g_object_get (G_OBJECT (object), "status", &value, NULL);
23548 return value;
23549 }
23550
23551 /**
23552 * flash_set_status: (skip)
23553 * @object: A #Flash.
23554 * @value: The value to set.
23555 *
23556 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
23557 *
23558 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23559 */
23560 void
flash_set_status(Flash * object,const gchar * value)23561 flash_set_status (Flash *object, const gchar *value)
23562 {
23563 g_object_set (G_OBJECT (object), "status", value, NULL);
23564 }
23565
23566 /**
23567 * flash_emit_updated:
23568 * @object: A #Flash.
23569 *
23570 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
23571 */
23572 void
flash_emit_updated(Flash * object)23573 flash_emit_updated (
23574 Flash *object)
23575 {
23576 g_signal_emit (object, _FLASH_SIGNALS[_FLASH_UPDATED], 0);
23577 }
23578
23579 /**
23580 * flash_emit_download:
23581 * @object: A #Flash.
23582 * @arg_url: Argument to pass with the signal.
23583 * @arg_filename: Argument to pass with the signal.
23584 *
23585 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
23586 */
23587 void
flash_emit_download(Flash * object,const gchar * arg_url,const gchar * arg_filename)23588 flash_emit_download (
23589 Flash *object,
23590 const gchar *arg_url,
23591 const gchar *arg_filename)
23592 {
23593 g_signal_emit (object, _FLASH_SIGNALS[_FLASH_DOWNLOAD], 0, arg_url, arg_filename);
23594 }
23595
23596 /**
23597 * flash_call_update:
23598 * @proxy: A #FlashProxy.
23599 * @arg_filename: Argument to pass with the method invocation.
23600 * @cancellable: (nullable): A #GCancellable or %NULL.
23601 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23602 * @user_data: User data to pass to @callback.
23603 *
23604 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy.
23605 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
23606 * You can then call flash_call_update_finish() to get the result of the operation.
23607 *
23608 * See flash_call_update_sync() for the synchronous, blocking version of this method.
23609 */
23610 void
flash_call_update(Flash * proxy,const gchar * arg_filename,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)23611 flash_call_update (
23612 Flash *proxy,
23613 const gchar *arg_filename,
23614 GCancellable *cancellable,
23615 GAsyncReadyCallback callback,
23616 gpointer user_data)
23617 {
23618 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23619 "update",
23620 g_variant_new ("(s)",
23621 arg_filename),
23622 G_DBUS_CALL_FLAGS_NONE,
23623 -1,
23624 cancellable,
23625 callback,
23626 user_data);
23627 }
23628
23629 /**
23630 * flash_call_update_finish:
23631 * @proxy: A #FlashProxy.
23632 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
23633 * @error: Return location for error or %NULL.
23634 *
23635 * Finishes an operation started with flash_call_update().
23636 *
23637 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23638 */
23639 gboolean
flash_call_update_finish(Flash * proxy,GAsyncResult * res,GError ** error)23640 flash_call_update_finish (
23641 Flash *proxy,
23642 GAsyncResult *res,
23643 GError **error)
23644 {
23645 GVariant *_ret;
23646 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23647 if (_ret == NULL)
23648 goto _out;
23649 g_variant_get (_ret,
23650 "()");
23651 g_variant_unref (_ret);
23652 _out:
23653 return _ret != NULL;
23654 }
23655
23656 /**
23657 * flash_call_update_sync:
23658 * @proxy: A #FlashProxy.
23659 * @arg_filename: Argument to pass with the method invocation.
23660 * @cancellable: (nullable): A #GCancellable or %NULL.
23661 * @error: Return location for error or %NULL.
23662 *
23663 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23664 *
23665 * See flash_call_update() for the asynchronous version of this method.
23666 *
23667 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23668 */
23669 gboolean
flash_call_update_sync(Flash * proxy,const gchar * arg_filename,GCancellable * cancellable,GError ** error)23670 flash_call_update_sync (
23671 Flash *proxy,
23672 const gchar *arg_filename,
23673 GCancellable *cancellable,
23674 GError **error)
23675 {
23676 GVariant *_ret;
23677 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23678 "update",
23679 g_variant_new ("(s)",
23680 arg_filename),
23681 G_DBUS_CALL_FLAGS_NONE,
23682 -1,
23683 cancellable,
23684 error);
23685 if (_ret == NULL)
23686 goto _out;
23687 g_variant_get (_ret,
23688 "()");
23689 g_variant_unref (_ret);
23690 _out:
23691 return _ret != NULL;
23692 }
23693
23694 /**
23695 * flash_call_error:
23696 * @proxy: A #FlashProxy.
23697 * @arg_message: Argument to pass with the method invocation.
23698 * @cancellable: (nullable): A #GCancellable or %NULL.
23699 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23700 * @user_data: User data to pass to @callback.
23701 *
23702 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
23703 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
23704 * You can then call flash_call_error_finish() to get the result of the operation.
23705 *
23706 * See flash_call_error_sync() for the synchronous, blocking version of this method.
23707 */
23708 void
flash_call_error(Flash * proxy,const gchar * arg_message,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)23709 flash_call_error (
23710 Flash *proxy,
23711 const gchar *arg_message,
23712 GCancellable *cancellable,
23713 GAsyncReadyCallback callback,
23714 gpointer user_data)
23715 {
23716 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23717 "error",
23718 g_variant_new ("(s)",
23719 arg_message),
23720 G_DBUS_CALL_FLAGS_NONE,
23721 -1,
23722 cancellable,
23723 callback,
23724 user_data);
23725 }
23726
23727 /**
23728 * flash_call_error_finish:
23729 * @proxy: A #FlashProxy.
23730 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
23731 * @error: Return location for error or %NULL.
23732 *
23733 * Finishes an operation started with flash_call_error().
23734 *
23735 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23736 */
23737 gboolean
flash_call_error_finish(Flash * proxy,GAsyncResult * res,GError ** error)23738 flash_call_error_finish (
23739 Flash *proxy,
23740 GAsyncResult *res,
23741 GError **error)
23742 {
23743 GVariant *_ret;
23744 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23745 if (_ret == NULL)
23746 goto _out;
23747 g_variant_get (_ret,
23748 "()");
23749 g_variant_unref (_ret);
23750 _out:
23751 return _ret != NULL;
23752 }
23753
23754 /**
23755 * flash_call_error_sync:
23756 * @proxy: A #FlashProxy.
23757 * @arg_message: Argument to pass with the method invocation.
23758 * @cancellable: (nullable): A #GCancellable or %NULL.
23759 * @error: Return location for error or %NULL.
23760 *
23761 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23762 *
23763 * See flash_call_error() for the asynchronous version of this method.
23764 *
23765 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23766 */
23767 gboolean
flash_call_error_sync(Flash * proxy,const gchar * arg_message,GCancellable * cancellable,GError ** error)23768 flash_call_error_sync (
23769 Flash *proxy,
23770 const gchar *arg_message,
23771 GCancellable *cancellable,
23772 GError **error)
23773 {
23774 GVariant *_ret;
23775 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23776 "error",
23777 g_variant_new ("(s)",
23778 arg_message),
23779 G_DBUS_CALL_FLAGS_NONE,
23780 -1,
23781 cancellable,
23782 error);
23783 if (_ret == NULL)
23784 goto _out;
23785 g_variant_get (_ret,
23786 "()");
23787 g_variant_unref (_ret);
23788 _out:
23789 return _ret != NULL;
23790 }
23791
23792 /**
23793 * flash_call_done:
23794 * @proxy: A #FlashProxy.
23795 * @cancellable: (nullable): A #GCancellable or %NULL.
23796 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23797 * @user_data: User data to pass to @callback.
23798 *
23799 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
23800 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
23801 * You can then call flash_call_done_finish() to get the result of the operation.
23802 *
23803 * See flash_call_done_sync() for the synchronous, blocking version of this method.
23804 */
23805 void
flash_call_done(Flash * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)23806 flash_call_done (
23807 Flash *proxy,
23808 GCancellable *cancellable,
23809 GAsyncReadyCallback callback,
23810 gpointer user_data)
23811 {
23812 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23813 "done",
23814 g_variant_new ("()"),
23815 G_DBUS_CALL_FLAGS_NONE,
23816 -1,
23817 cancellable,
23818 callback,
23819 user_data);
23820 }
23821
23822 /**
23823 * flash_call_done_finish:
23824 * @proxy: A #FlashProxy.
23825 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
23826 * @error: Return location for error or %NULL.
23827 *
23828 * Finishes an operation started with flash_call_done().
23829 *
23830 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23831 */
23832 gboolean
flash_call_done_finish(Flash * proxy,GAsyncResult * res,GError ** error)23833 flash_call_done_finish (
23834 Flash *proxy,
23835 GAsyncResult *res,
23836 GError **error)
23837 {
23838 GVariant *_ret;
23839 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23840 if (_ret == NULL)
23841 goto _out;
23842 g_variant_get (_ret,
23843 "()");
23844 g_variant_unref (_ret);
23845 _out:
23846 return _ret != NULL;
23847 }
23848
23849 /**
23850 * flash_call_done_sync:
23851 * @proxy: A #FlashProxy.
23852 * @cancellable: (nullable): A #GCancellable or %NULL.
23853 * @error: Return location for error or %NULL.
23854 *
23855 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23856 *
23857 * See flash_call_done() for the asynchronous version of this method.
23858 *
23859 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23860 */
23861 gboolean
flash_call_done_sync(Flash * proxy,GCancellable * cancellable,GError ** error)23862 flash_call_done_sync (
23863 Flash *proxy,
23864 GCancellable *cancellable,
23865 GError **error)
23866 {
23867 GVariant *_ret;
23868 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23869 "done",
23870 g_variant_new ("()"),
23871 G_DBUS_CALL_FLAGS_NONE,
23872 -1,
23873 cancellable,
23874 error);
23875 if (_ret == NULL)
23876 goto _out;
23877 g_variant_get (_ret,
23878 "()");
23879 g_variant_unref (_ret);
23880 _out:
23881 return _ret != NULL;
23882 }
23883
23884 /**
23885 * flash_call_update_via_tftp:
23886 * @proxy: A #FlashProxy.
23887 * @arg_url: Argument to pass with the method invocation.
23888 * @arg_filename: Argument to pass with the method invocation.
23889 * @cancellable: (nullable): A #GCancellable or %NULL.
23890 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23891 * @user_data: User data to pass to @callback.
23892 *
23893 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
23894 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
23895 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
23896 *
23897 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
23898 */
23899 void
flash_call_update_via_tftp(Flash * proxy,const gchar * arg_url,const gchar * arg_filename,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)23900 flash_call_update_via_tftp (
23901 Flash *proxy,
23902 const gchar *arg_url,
23903 const gchar *arg_filename,
23904 GCancellable *cancellable,
23905 GAsyncReadyCallback callback,
23906 gpointer user_data)
23907 {
23908 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23909 "updateViaTftp",
23910 g_variant_new ("(ss)",
23911 arg_url,
23912 arg_filename),
23913 G_DBUS_CALL_FLAGS_NONE,
23914 -1,
23915 cancellable,
23916 callback,
23917 user_data);
23918 }
23919
23920 /**
23921 * flash_call_update_via_tftp_finish:
23922 * @proxy: A #FlashProxy.
23923 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
23924 * @error: Return location for error or %NULL.
23925 *
23926 * Finishes an operation started with flash_call_update_via_tftp().
23927 *
23928 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23929 */
23930 gboolean
flash_call_update_via_tftp_finish(Flash * proxy,GAsyncResult * res,GError ** error)23931 flash_call_update_via_tftp_finish (
23932 Flash *proxy,
23933 GAsyncResult *res,
23934 GError **error)
23935 {
23936 GVariant *_ret;
23937 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23938 if (_ret == NULL)
23939 goto _out;
23940 g_variant_get (_ret,
23941 "()");
23942 g_variant_unref (_ret);
23943 _out:
23944 return _ret != NULL;
23945 }
23946
23947 /**
23948 * flash_call_update_via_tftp_sync:
23949 * @proxy: A #FlashProxy.
23950 * @arg_url: Argument to pass with the method invocation.
23951 * @arg_filename: Argument to pass with the method invocation.
23952 * @cancellable: (nullable): A #GCancellable or %NULL.
23953 * @error: Return location for error or %NULL.
23954 *
23955 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23956 *
23957 * See flash_call_update_via_tftp() for the asynchronous version of this method.
23958 *
23959 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
23960 */
23961 gboolean
flash_call_update_via_tftp_sync(Flash * proxy,const gchar * arg_url,const gchar * arg_filename,GCancellable * cancellable,GError ** error)23962 flash_call_update_via_tftp_sync (
23963 Flash *proxy,
23964 const gchar *arg_url,
23965 const gchar *arg_filename,
23966 GCancellable *cancellable,
23967 GError **error)
23968 {
23969 GVariant *_ret;
23970 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23971 "updateViaTftp",
23972 g_variant_new ("(ss)",
23973 arg_url,
23974 arg_filename),
23975 G_DBUS_CALL_FLAGS_NONE,
23976 -1,
23977 cancellable,
23978 error);
23979 if (_ret == NULL)
23980 goto _out;
23981 g_variant_get (_ret,
23982 "()");
23983 g_variant_unref (_ret);
23984 _out:
23985 return _ret != NULL;
23986 }
23987
23988 /**
23989 * flash_call_init:
23990 * @proxy: A #FlashProxy.
23991 * @cancellable: (nullable): A #GCancellable or %NULL.
23992 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23993 * @user_data: User data to pass to @callback.
23994 *
23995 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
23996 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
23997 * You can then call flash_call_init_finish() to get the result of the operation.
23998 *
23999 * See flash_call_init_sync() for the synchronous, blocking version of this method.
24000 */
24001 void
flash_call_init(Flash * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)24002 flash_call_init (
24003 Flash *proxy,
24004 GCancellable *cancellable,
24005 GAsyncReadyCallback callback,
24006 gpointer user_data)
24007 {
24008 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24009 "init",
24010 g_variant_new ("()"),
24011 G_DBUS_CALL_FLAGS_NONE,
24012 -1,
24013 cancellable,
24014 callback,
24015 user_data);
24016 }
24017
24018 /**
24019 * flash_call_init_finish:
24020 * @proxy: A #FlashProxy.
24021 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
24022 * @error: Return location for error or %NULL.
24023 *
24024 * Finishes an operation started with flash_call_init().
24025 *
24026 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
24027 */
24028 gboolean
flash_call_init_finish(Flash * proxy,GAsyncResult * res,GError ** error)24029 flash_call_init_finish (
24030 Flash *proxy,
24031 GAsyncResult *res,
24032 GError **error)
24033 {
24034 GVariant *_ret;
24035 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24036 if (_ret == NULL)
24037 goto _out;
24038 g_variant_get (_ret,
24039 "()");
24040 g_variant_unref (_ret);
24041 _out:
24042 return _ret != NULL;
24043 }
24044
24045 /**
24046 * flash_call_init_sync:
24047 * @proxy: A #FlashProxy.
24048 * @cancellable: (nullable): A #GCancellable or %NULL.
24049 * @error: Return location for error or %NULL.
24050 *
24051 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
24052 *
24053 * See flash_call_init() for the asynchronous version of this method.
24054 *
24055 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
24056 */
24057 gboolean
flash_call_init_sync(Flash * proxy,GCancellable * cancellable,GError ** error)24058 flash_call_init_sync (
24059 Flash *proxy,
24060 GCancellable *cancellable,
24061 GError **error)
24062 {
24063 GVariant *_ret;
24064 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24065 "init",
24066 g_variant_new ("()"),
24067 G_DBUS_CALL_FLAGS_NONE,
24068 -1,
24069 cancellable,
24070 error);
24071 if (_ret == NULL)
24072 goto _out;
24073 g_variant_get (_ret,
24074 "()");
24075 g_variant_unref (_ret);
24076 _out:
24077 return _ret != NULL;
24078 }
24079
24080 /**
24081 * flash_complete_update:
24082 * @object: A #Flash.
24083 * @invocation: (transfer full): A #GDBusMethodInvocation.
24084 *
24085 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</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.
24086 *
24087 * This method will free @invocation, you cannot use it afterwards.
24088 */
24089 void
flash_complete_update(Flash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)24090 flash_complete_update (
24091 Flash *object G_GNUC_UNUSED,
24092 GDBusMethodInvocation *invocation)
24093 {
24094 g_dbus_method_invocation_return_value (invocation,
24095 g_variant_new ("()"));
24096 }
24097
24098 /**
24099 * flash_complete_error:
24100 * @object: A #Flash.
24101 * @invocation: (transfer full): A #GDBusMethodInvocation.
24102 *
24103 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</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.
24104 *
24105 * This method will free @invocation, you cannot use it afterwards.
24106 */
24107 void
flash_complete_error(Flash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)24108 flash_complete_error (
24109 Flash *object G_GNUC_UNUSED,
24110 GDBusMethodInvocation *invocation)
24111 {
24112 g_dbus_method_invocation_return_value (invocation,
24113 g_variant_new ("()"));
24114 }
24115
24116 /**
24117 * flash_complete_done:
24118 * @object: A #Flash.
24119 * @invocation: (transfer full): A #GDBusMethodInvocation.
24120 *
24121 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</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.
24122 *
24123 * This method will free @invocation, you cannot use it afterwards.
24124 */
24125 void
flash_complete_done(Flash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)24126 flash_complete_done (
24127 Flash *object G_GNUC_UNUSED,
24128 GDBusMethodInvocation *invocation)
24129 {
24130 g_dbus_method_invocation_return_value (invocation,
24131 g_variant_new ("()"));
24132 }
24133
24134 /**
24135 * flash_complete_update_via_tftp:
24136 * @object: A #Flash.
24137 * @invocation: (transfer full): A #GDBusMethodInvocation.
24138 *
24139 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</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.
24140 *
24141 * This method will free @invocation, you cannot use it afterwards.
24142 */
24143 void
flash_complete_update_via_tftp(Flash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)24144 flash_complete_update_via_tftp (
24145 Flash *object G_GNUC_UNUSED,
24146 GDBusMethodInvocation *invocation)
24147 {
24148 g_dbus_method_invocation_return_value (invocation,
24149 g_variant_new ("()"));
24150 }
24151
24152 /**
24153 * flash_complete_init:
24154 * @object: A #Flash.
24155 * @invocation: (transfer full): A #GDBusMethodInvocation.
24156 *
24157 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.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.
24158 *
24159 * This method will free @invocation, you cannot use it afterwards.
24160 */
24161 void
flash_complete_init(Flash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)24162 flash_complete_init (
24163 Flash *object G_GNUC_UNUSED,
24164 GDBusMethodInvocation *invocation)
24165 {
24166 g_dbus_method_invocation_return_value (invocation,
24167 g_variant_new ("()"));
24168 }
24169
24170 /* ------------------------------------------------------------------------ */
24171
24172 /**
24173 * FlashProxy:
24174 *
24175 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
24176 */
24177
24178 /**
24179 * FlashProxyClass:
24180 * @parent_class: The parent class.
24181 *
24182 * Class structure for #FlashProxy.
24183 */
24184
24185 struct _FlashProxyPrivate
24186 {
24187 GData *qdata;
24188 };
24189
24190 static void flash_proxy_iface_init (FlashIface *iface);
24191
24192 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FlashProxy,flash_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (FlashProxy)G_IMPLEMENT_INTERFACE (TYPE_FLASH,flash_proxy_iface_init))24193 G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
24194 G_ADD_PRIVATE (FlashProxy)
24195 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init))
24196
24197 #else
24198 G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
24199 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init))
24200
24201 #endif
24202 static void
24203 flash_proxy_finalize (GObject *object)
24204 {
24205 FlashProxy *proxy = FLASH_PROXY (object);
24206 g_datalist_clear (&proxy->priv->qdata);
24207 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
24208 }
24209
24210 static void
flash_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)24211 flash_proxy_get_property (GObject *object,
24212 guint prop_id,
24213 GValue *value,
24214 GParamSpec *pspec G_GNUC_UNUSED)
24215 {
24216 const _ExtendedGDBusPropertyInfo *info;
24217 GVariant *variant;
24218 g_assert (prop_id != 0 && prop_id - 1 < 5);
24219 info = (const _ExtendedGDBusPropertyInfo *) _flash_property_info_pointers[prop_id - 1];
24220 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24221 if (info->use_gvariant)
24222 {
24223 g_value_set_variant (value, variant);
24224 }
24225 else
24226 {
24227 if (variant != NULL)
24228 g_dbus_gvariant_to_gvalue (variant, value);
24229 }
24230 if (variant != NULL)
24231 g_variant_unref (variant);
24232 }
24233
24234 static void
flash_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)24235 flash_proxy_set_property_cb (GDBusProxy *proxy,
24236 GAsyncResult *res,
24237 gpointer user_data)
24238 {
24239 const _ExtendedGDBusPropertyInfo *info = user_data;
24240 GError *error;
24241 GVariant *_ret;
24242 error = NULL;
24243 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24244 if (!_ret)
24245 {
24246 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
24247 info->parent_struct.name,
24248 error->message, g_quark_to_string (error->domain), error->code);
24249 g_error_free (error);
24250 }
24251 else
24252 {
24253 g_variant_unref (_ret);
24254 }
24255 }
24256
24257 static void
flash_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)24258 flash_proxy_set_property (GObject *object,
24259 guint prop_id,
24260 const GValue *value,
24261 GParamSpec *pspec G_GNUC_UNUSED)
24262 {
24263 const _ExtendedGDBusPropertyInfo *info;
24264 GVariant *variant;
24265 g_assert (prop_id != 0 && prop_id - 1 < 5);
24266 info = (const _ExtendedGDBusPropertyInfo *) _flash_property_info_pointers[prop_id - 1];
24267 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24268 g_dbus_proxy_call (G_DBUS_PROXY (object),
24269 "org.freedesktop.DBus.Properties.Set",
24270 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
24271 G_DBUS_CALL_FLAGS_NONE,
24272 -1,
24273 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24274 g_variant_unref (variant);
24275 }
24276
24277 static void
flash_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)24278 flash_proxy_g_signal (GDBusProxy *proxy,
24279 const gchar *sender_name G_GNUC_UNUSED,
24280 const gchar *signal_name,
24281 GVariant *parameters)
24282 {
24283 _ExtendedGDBusSignalInfo *info;
24284 GVariantIter iter;
24285 GVariant *child;
24286 GValue *paramv;
24287 gsize num_params;
24288 gsize n;
24289 guint signal_id;
24290 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
24291 if (info == NULL)
24292 return;
24293 num_params = g_variant_n_children (parameters);
24294 paramv = g_new0 (GValue, num_params + 1);
24295 g_value_init (¶mv[0], TYPE_FLASH);
24296 g_value_set_object (¶mv[0], proxy);
24297 g_variant_iter_init (&iter, parameters);
24298 n = 1;
24299 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24300 {
24301 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24302 if (arg_info->use_gvariant)
24303 {
24304 g_value_init (¶mv[n], G_TYPE_VARIANT);
24305 g_value_set_variant (¶mv[n], child);
24306 n++;
24307 }
24308 else
24309 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
24310 g_variant_unref (child);
24311 }
24312 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
24313 g_signal_emitv (paramv, signal_id, 0, NULL);
24314 for (n = 0; n < num_params + 1; n++)
24315 g_value_unset (¶mv[n]);
24316 g_free (paramv);
24317 }
24318
24319 static void
flash_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)24320 flash_proxy_g_properties_changed (GDBusProxy *_proxy,
24321 GVariant *changed_properties,
24322 const gchar *const *invalidated_properties)
24323 {
24324 FlashProxy *proxy = FLASH_PROXY (_proxy);
24325 guint n;
24326 const gchar *key;
24327 GVariantIter *iter;
24328 _ExtendedGDBusPropertyInfo *info;
24329 g_variant_get (changed_properties, "a{sv}", &iter);
24330 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24331 {
24332 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
24333 g_datalist_remove_data (&proxy->priv->qdata, key);
24334 if (info != NULL)
24335 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24336 }
24337 g_variant_iter_free (iter);
24338 for (n = 0; invalidated_properties[n] != NULL; n++)
24339 {
24340 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
24341 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24342 if (info != NULL)
24343 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24344 }
24345 }
24346
24347 static const gchar *
flash_proxy_get_filename(Flash * object)24348 flash_proxy_get_filename (Flash *object)
24349 {
24350 FlashProxy *proxy = FLASH_PROXY (object);
24351 GVariant *variant;
24352 const gchar *value = NULL;
24353 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
24354 if (variant != NULL)
24355 {
24356 value = g_variant_get_string (variant, NULL);
24357 g_variant_unref (variant);
24358 }
24359 return value;
24360 }
24361
24362 static const gchar *
flash_proxy_get_flasher_path(Flash * object)24363 flash_proxy_get_flasher_path (Flash *object)
24364 {
24365 FlashProxy *proxy = FLASH_PROXY (object);
24366 GVariant *variant;
24367 const gchar *value = NULL;
24368 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
24369 if (variant != NULL)
24370 {
24371 value = g_variant_get_string (variant, NULL);
24372 g_variant_unref (variant);
24373 }
24374 return value;
24375 }
24376
24377 static const gchar *
flash_proxy_get_flasher_name(Flash * object)24378 flash_proxy_get_flasher_name (Flash *object)
24379 {
24380 FlashProxy *proxy = FLASH_PROXY (object);
24381 GVariant *variant;
24382 const gchar *value = NULL;
24383 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
24384 if (variant != NULL)
24385 {
24386 value = g_variant_get_string (variant, NULL);
24387 g_variant_unref (variant);
24388 }
24389 return value;
24390 }
24391
24392 static const gchar *
flash_proxy_get_flasher_instance(Flash * object)24393 flash_proxy_get_flasher_instance (Flash *object)
24394 {
24395 FlashProxy *proxy = FLASH_PROXY (object);
24396 GVariant *variant;
24397 const gchar *value = NULL;
24398 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
24399 if (variant != NULL)
24400 {
24401 value = g_variant_get_string (variant, NULL);
24402 g_variant_unref (variant);
24403 }
24404 return value;
24405 }
24406
24407 static const gchar *
flash_proxy_get_status(Flash * object)24408 flash_proxy_get_status (Flash *object)
24409 {
24410 FlashProxy *proxy = FLASH_PROXY (object);
24411 GVariant *variant;
24412 const gchar *value = NULL;
24413 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
24414 if (variant != NULL)
24415 {
24416 value = g_variant_get_string (variant, NULL);
24417 g_variant_unref (variant);
24418 }
24419 return value;
24420 }
24421
24422 static void
flash_proxy_init(FlashProxy * proxy)24423 flash_proxy_init (FlashProxy *proxy)
24424 {
24425 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24426 proxy->priv = flash_proxy_get_instance_private (proxy);
24427 #else
24428 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
24429 #endif
24430
24431 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
24432 }
24433
24434 static void
flash_proxy_class_init(FlashProxyClass * klass)24435 flash_proxy_class_init (FlashProxyClass *klass)
24436 {
24437 GObjectClass *gobject_class;
24438 GDBusProxyClass *proxy_class;
24439
24440 gobject_class = G_OBJECT_CLASS (klass);
24441 gobject_class->finalize = flash_proxy_finalize;
24442 gobject_class->get_property = flash_proxy_get_property;
24443 gobject_class->set_property = flash_proxy_set_property;
24444
24445 proxy_class = G_DBUS_PROXY_CLASS (klass);
24446 proxy_class->g_signal = flash_proxy_g_signal;
24447 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
24448
24449 flash_override_properties (gobject_class, 1);
24450
24451 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24452 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
24453 #endif
24454 }
24455
24456 static void
flash_proxy_iface_init(FlashIface * iface)24457 flash_proxy_iface_init (FlashIface *iface)
24458 {
24459 iface->get_filename = flash_proxy_get_filename;
24460 iface->get_flasher_path = flash_proxy_get_flasher_path;
24461 iface->get_flasher_name = flash_proxy_get_flasher_name;
24462 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
24463 iface->get_status = flash_proxy_get_status;
24464 }
24465
24466 /**
24467 * flash_proxy_new:
24468 * @connection: A #GDBusConnection.
24469 * @flags: Flags from the #GDBusProxyFlags enumeration.
24470 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24471 * @object_path: An object path.
24472 * @cancellable: (nullable): A #GCancellable or %NULL.
24473 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24474 * @user_data: User data to pass to @callback.
24475 *
24476 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new() for more details.
24477 *
24478 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
24479 * You can then call flash_proxy_new_finish() to get the result of the operation.
24480 *
24481 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
24482 */
24483 void
flash_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)24484 flash_proxy_new (
24485 GDBusConnection *connection,
24486 GDBusProxyFlags flags,
24487 const gchar *name,
24488 const gchar *object_path,
24489 GCancellable *cancellable,
24490 GAsyncReadyCallback callback,
24491 gpointer user_data)
24492 {
24493 g_async_initable_new_async (TYPE_FLASH_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.Flash", NULL);
24494 }
24495
24496 /**
24497 * flash_proxy_new_finish:
24498 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
24499 * @error: Return location for error or %NULL
24500 *
24501 * Finishes an operation started with flash_proxy_new().
24502 *
24503 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
24504 */
24505 Flash *
flash_proxy_new_finish(GAsyncResult * res,GError ** error)24506 flash_proxy_new_finish (
24507 GAsyncResult *res,
24508 GError **error)
24509 {
24510 GObject *ret;
24511 GObject *source_object;
24512 source_object = g_async_result_get_source_object (res);
24513 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24514 g_object_unref (source_object);
24515 if (ret != NULL)
24516 return FLASH (ret);
24517 else
24518 return NULL;
24519 }
24520
24521 /**
24522 * flash_proxy_new_sync:
24523 * @connection: A #GDBusConnection.
24524 * @flags: Flags from the #GDBusProxyFlags enumeration.
24525 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24526 * @object_path: An object path.
24527 * @cancellable: (nullable): A #GCancellable or %NULL.
24528 * @error: Return location for error or %NULL
24529 *
24530 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new_sync() for more details.
24531 *
24532 * The calling thread is blocked until a reply is received.
24533 *
24534 * See flash_proxy_new() for the asynchronous version of this constructor.
24535 *
24536 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
24537 */
24538 Flash *
flash_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)24539 flash_proxy_new_sync (
24540 GDBusConnection *connection,
24541 GDBusProxyFlags flags,
24542 const gchar *name,
24543 const gchar *object_path,
24544 GCancellable *cancellable,
24545 GError **error)
24546 {
24547 GInitable *ret;
24548 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
24549 if (ret != NULL)
24550 return FLASH (ret);
24551 else
24552 return NULL;
24553 }
24554
24555
24556 /**
24557 * flash_proxy_new_for_bus:
24558 * @bus_type: A #GBusType.
24559 * @flags: Flags from the #GDBusProxyFlags enumeration.
24560 * @name: A bus name (well-known or unique).
24561 * @object_path: An object path.
24562 * @cancellable: (nullable): A #GCancellable or %NULL.
24563 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24564 * @user_data: User data to pass to @callback.
24565 *
24566 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24567 *
24568 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
24569 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
24570 *
24571 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24572 */
24573 void
flash_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)24574 flash_proxy_new_for_bus (
24575 GBusType bus_type,
24576 GDBusProxyFlags flags,
24577 const gchar *name,
24578 const gchar *object_path,
24579 GCancellable *cancellable,
24580 GAsyncReadyCallback callback,
24581 gpointer user_data)
24582 {
24583 g_async_initable_new_async (TYPE_FLASH_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.Flash", NULL);
24584 }
24585
24586 /**
24587 * flash_proxy_new_for_bus_finish:
24588 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
24589 * @error: Return location for error or %NULL
24590 *
24591 * Finishes an operation started with flash_proxy_new_for_bus().
24592 *
24593 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
24594 */
24595 Flash *
flash_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)24596 flash_proxy_new_for_bus_finish (
24597 GAsyncResult *res,
24598 GError **error)
24599 {
24600 GObject *ret;
24601 GObject *source_object;
24602 source_object = g_async_result_get_source_object (res);
24603 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24604 g_object_unref (source_object);
24605 if (ret != NULL)
24606 return FLASH (ret);
24607 else
24608 return NULL;
24609 }
24610
24611 /**
24612 * flash_proxy_new_for_bus_sync:
24613 * @bus_type: A #GBusType.
24614 * @flags: Flags from the #GDBusProxyFlags enumeration.
24615 * @name: A bus name (well-known or unique).
24616 * @object_path: An object path.
24617 * @cancellable: (nullable): A #GCancellable or %NULL.
24618 * @error: Return location for error or %NULL
24619 *
24620 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24621 *
24622 * The calling thread is blocked until a reply is received.
24623 *
24624 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
24625 *
24626 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
24627 */
24628 Flash *
flash_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)24629 flash_proxy_new_for_bus_sync (
24630 GBusType bus_type,
24631 GDBusProxyFlags flags,
24632 const gchar *name,
24633 const gchar *object_path,
24634 GCancellable *cancellable,
24635 GError **error)
24636 {
24637 GInitable *ret;
24638 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
24639 if (ret != NULL)
24640 return FLASH (ret);
24641 else
24642 return NULL;
24643 }
24644
24645
24646 /* ------------------------------------------------------------------------ */
24647
24648 /**
24649 * FlashSkeleton:
24650 *
24651 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
24652 */
24653
24654 /**
24655 * FlashSkeletonClass:
24656 * @parent_class: The parent class.
24657 *
24658 * Class structure for #FlashSkeleton.
24659 */
24660
24661 struct _FlashSkeletonPrivate
24662 {
24663 GValue *properties;
24664 GList *changed_properties;
24665 GSource *changed_properties_idle_source;
24666 GMainContext *context;
24667 GMutex lock;
24668 };
24669
24670 static void
_flash_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)24671 _flash_skeleton_handle_method_call (
24672 GDBusConnection *connection G_GNUC_UNUSED,
24673 const gchar *sender G_GNUC_UNUSED,
24674 const gchar *object_path G_GNUC_UNUSED,
24675 const gchar *interface_name,
24676 const gchar *method_name,
24677 GVariant *parameters,
24678 GDBusMethodInvocation *invocation,
24679 gpointer user_data)
24680 {
24681 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24682 _ExtendedGDBusMethodInfo *info;
24683 GVariantIter iter;
24684 GVariant *child;
24685 GValue *paramv;
24686 gsize num_params;
24687 guint num_extra;
24688 gsize n;
24689 guint signal_id;
24690 GValue return_value = G_VALUE_INIT;
24691 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24692 g_assert (info != NULL);
24693 num_params = g_variant_n_children (parameters);
24694 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
24695 n = 0;
24696 g_value_init (¶mv[n], TYPE_FLASH);
24697 g_value_set_object (¶mv[n++], skeleton);
24698 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
24699 g_value_set_object (¶mv[n++], invocation);
24700 if (info->pass_fdlist)
24701 {
24702 #ifdef G_OS_UNIX
24703 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
24704 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
24705 #else
24706 g_assert_not_reached ();
24707 #endif
24708 }
24709 g_variant_iter_init (&iter, parameters);
24710 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24711 {
24712 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24713 if (arg_info->use_gvariant)
24714 {
24715 g_value_init (¶mv[n], G_TYPE_VARIANT);
24716 g_value_set_variant (¶mv[n], child);
24717 n++;
24718 }
24719 else
24720 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
24721 g_variant_unref (child);
24722 }
24723 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
24724 g_value_init (&return_value, G_TYPE_BOOLEAN);
24725 g_signal_emitv (paramv, signal_id, 0, &return_value);
24726 if (!g_value_get_boolean (&return_value))
24727 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);
24728 g_value_unset (&return_value);
24729 for (n = 0; n < num_params + num_extra; n++)
24730 g_value_unset (¶mv[n]);
24731 g_free (paramv);
24732 }
24733
24734 static GVariant *
_flash_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)24735 _flash_skeleton_handle_get_property (
24736 GDBusConnection *connection G_GNUC_UNUSED,
24737 const gchar *sender G_GNUC_UNUSED,
24738 const gchar *object_path G_GNUC_UNUSED,
24739 const gchar *interface_name G_GNUC_UNUSED,
24740 const gchar *property_name,
24741 GError **error,
24742 gpointer user_data)
24743 {
24744 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24745 GValue value = G_VALUE_INIT;
24746 GParamSpec *pspec;
24747 _ExtendedGDBusPropertyInfo *info;
24748 GVariant *ret;
24749 ret = NULL;
24750 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
24751 g_assert (info != NULL);
24752 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24753 if (pspec == NULL)
24754 {
24755 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24756 }
24757 else
24758 {
24759 g_value_init (&value, pspec->value_type);
24760 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24761 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24762 g_value_unset (&value);
24763 }
24764 return ret;
24765 }
24766
24767 static gboolean
_flash_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)24768 _flash_skeleton_handle_set_property (
24769 GDBusConnection *connection G_GNUC_UNUSED,
24770 const gchar *sender G_GNUC_UNUSED,
24771 const gchar *object_path G_GNUC_UNUSED,
24772 const gchar *interface_name G_GNUC_UNUSED,
24773 const gchar *property_name,
24774 GVariant *variant,
24775 GError **error,
24776 gpointer user_data)
24777 {
24778 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24779 GValue value = G_VALUE_INIT;
24780 GParamSpec *pspec;
24781 _ExtendedGDBusPropertyInfo *info;
24782 gboolean ret;
24783 ret = FALSE;
24784 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
24785 g_assert (info != NULL);
24786 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24787 if (pspec == NULL)
24788 {
24789 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24790 }
24791 else
24792 {
24793 if (info->use_gvariant)
24794 g_value_set_variant (&value, variant);
24795 else
24796 g_dbus_gvariant_to_gvalue (variant, &value);
24797 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24798 g_value_unset (&value);
24799 ret = TRUE;
24800 }
24801 return ret;
24802 }
24803
24804 static const GDBusInterfaceVTable _flash_skeleton_vtable =
24805 {
24806 _flash_skeleton_handle_method_call,
24807 _flash_skeleton_handle_get_property,
24808 _flash_skeleton_handle_set_property,
24809 {NULL}
24810 };
24811
24812 static GDBusInterfaceInfo *
flash_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)24813 flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24814 {
24815 return flash_interface_info ();
24816 }
24817
24818 static GDBusInterfaceVTable *
flash_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)24819 flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24820 {
24821 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
24822 }
24823
24824 static GVariant *
flash_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)24825 flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24826 {
24827 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
24828
24829 GVariantBuilder builder;
24830 guint n;
24831 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24832 if (_flash_interface_info.parent_struct.properties == NULL)
24833 goto out;
24834 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
24835 {
24836 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
24837 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24838 {
24839 GVariant *value;
24840 value = _flash_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.Flash", info->name, NULL, skeleton);
24841 if (value != NULL)
24842 {
24843 g_variant_take_ref (value);
24844 g_variant_builder_add (&builder, "{sv}", info->name, value);
24845 g_variant_unref (value);
24846 }
24847 }
24848 }
24849 out:
24850 return g_variant_builder_end (&builder);
24851 }
24852
24853 static gboolean _flash_emit_changed (gpointer user_data);
24854
24855 static void
flash_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)24856 flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24857 {
24858 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
24859 gboolean emit_changed = FALSE;
24860
24861 g_mutex_lock (&skeleton->priv->lock);
24862 if (skeleton->priv->changed_properties_idle_source != NULL)
24863 {
24864 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24865 skeleton->priv->changed_properties_idle_source = NULL;
24866 emit_changed = TRUE;
24867 }
24868 g_mutex_unlock (&skeleton->priv->lock);
24869
24870 if (emit_changed)
24871 _flash_emit_changed (skeleton);
24872 }
24873
24874 static void
_flash_on_signal_updated(Flash * object)24875 _flash_on_signal_updated (
24876 Flash *object)
24877 {
24878 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24879
24880 GList *connections, *l;
24881 GVariant *signal_variant;
24882 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24883
24884 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24885 for (l = connections; l != NULL; l = l->next)
24886 {
24887 GDBusConnection *connection = l->data;
24888 g_dbus_connection_emit_signal (connection,
24889 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
24890 signal_variant, NULL);
24891 }
24892 g_variant_unref (signal_variant);
24893 g_list_free_full (connections, g_object_unref);
24894 }
24895
24896 static void
_flash_on_signal_download(Flash * object,const gchar * arg_url,const gchar * arg_filename)24897 _flash_on_signal_download (
24898 Flash *object,
24899 const gchar *arg_url,
24900 const gchar *arg_filename)
24901 {
24902 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24903
24904 GList *connections, *l;
24905 GVariant *signal_variant;
24906 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24907
24908 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
24909 arg_url,
24910 arg_filename));
24911 for (l = connections; l != NULL; l = l->next)
24912 {
24913 GDBusConnection *connection = l->data;
24914 g_dbus_connection_emit_signal (connection,
24915 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
24916 signal_variant, NULL);
24917 }
24918 g_variant_unref (signal_variant);
24919 g_list_free_full (connections, g_object_unref);
24920 }
24921
24922 static void flash_skeleton_iface_init (FlashIface *iface);
24923 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FlashSkeleton,flash_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (FlashSkeleton)G_IMPLEMENT_INTERFACE (TYPE_FLASH,flash_skeleton_iface_init))24924 G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24925 G_ADD_PRIVATE (FlashSkeleton)
24926 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init))
24927
24928 #else
24929 G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24930 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init))
24931
24932 #endif
24933 static void
24934 flash_skeleton_finalize (GObject *object)
24935 {
24936 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24937 guint n;
24938 for (n = 0; n < 5; n++)
24939 g_value_unset (&skeleton->priv->properties[n]);
24940 g_free (skeleton->priv->properties);
24941 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24942 if (skeleton->priv->changed_properties_idle_source != NULL)
24943 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24944 g_main_context_unref (skeleton->priv->context);
24945 g_mutex_clear (&skeleton->priv->lock);
24946 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
24947 }
24948
24949 static void
flash_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)24950 flash_skeleton_get_property (GObject *object,
24951 guint prop_id,
24952 GValue *value,
24953 GParamSpec *pspec G_GNUC_UNUSED)
24954 {
24955 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24956 g_assert (prop_id != 0 && prop_id - 1 < 5);
24957 g_mutex_lock (&skeleton->priv->lock);
24958 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
24959 g_mutex_unlock (&skeleton->priv->lock);
24960 }
24961
24962 static gboolean
_flash_emit_changed(gpointer user_data)24963 _flash_emit_changed (gpointer user_data)
24964 {
24965 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24966 GList *l;
24967 GVariantBuilder builder;
24968 GVariantBuilder invalidated_builder;
24969 guint num_changes;
24970
24971 g_mutex_lock (&skeleton->priv->lock);
24972 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24973 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
24974 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
24975 {
24976 ChangedProperty *cp = l->data;
24977 GVariant *variant;
24978 const GValue *cur_value;
24979
24980 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
24981 if (!_g_value_equal (cur_value, &cp->orig_value))
24982 {
24983 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
24984 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
24985 g_variant_unref (variant);
24986 num_changes++;
24987 }
24988 }
24989 if (num_changes > 0)
24990 {
24991 GList *connections, *ll;
24992 GVariant *signal_variant;
24993 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
24994 &builder, &invalidated_builder));
24995 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24996 for (ll = connections; ll != NULL; ll = ll->next)
24997 {
24998 GDBusConnection *connection = ll->data;
24999
25000 g_dbus_connection_emit_signal (connection,
25001 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25002 "org.freedesktop.DBus.Properties",
25003 "PropertiesChanged",
25004 signal_variant,
25005 NULL);
25006 }
25007 g_variant_unref (signal_variant);
25008 g_list_free_full (connections, g_object_unref);
25009 }
25010 else
25011 {
25012 g_variant_builder_clear (&builder);
25013 g_variant_builder_clear (&invalidated_builder);
25014 }
25015 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25016 skeleton->priv->changed_properties = NULL;
25017 skeleton->priv->changed_properties_idle_source = NULL;
25018 g_mutex_unlock (&skeleton->priv->lock);
25019 return FALSE;
25020 }
25021
25022 static void
_flash_schedule_emit_changed(FlashSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)25023 _flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25024 {
25025 ChangedProperty *cp;
25026 GList *l;
25027 cp = NULL;
25028 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25029 {
25030 ChangedProperty *i_cp = l->data;
25031 if (i_cp->info == info)
25032 {
25033 cp = i_cp;
25034 break;
25035 }
25036 }
25037 if (cp == NULL)
25038 {
25039 cp = g_new0 (ChangedProperty, 1);
25040 cp->prop_id = prop_id;
25041 cp->info = info;
25042 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25043 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25044 g_value_copy (orig_value, &cp->orig_value);
25045 }
25046 }
25047
25048 static void
flash_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)25049 flash_skeleton_notify (GObject *object,
25050 GParamSpec *pspec G_GNUC_UNUSED)
25051 {
25052 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25053 g_mutex_lock (&skeleton->priv->lock);
25054 if (skeleton->priv->changed_properties != NULL &&
25055 skeleton->priv->changed_properties_idle_source == NULL)
25056 {
25057 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25058 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25059 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25060 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed");
25061 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25062 g_source_unref (skeleton->priv->changed_properties_idle_source);
25063 }
25064 g_mutex_unlock (&skeleton->priv->lock);
25065 }
25066
25067 static void
flash_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)25068 flash_skeleton_set_property (GObject *object,
25069 guint prop_id,
25070 const GValue *value,
25071 GParamSpec *pspec)
25072 {
25073 const _ExtendedGDBusPropertyInfo *info;
25074 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25075 g_assert (prop_id != 0 && prop_id - 1 < 5);
25076 info = (const _ExtendedGDBusPropertyInfo *) _flash_property_info_pointers[prop_id - 1];
25077 g_mutex_lock (&skeleton->priv->lock);
25078 g_object_freeze_notify (object);
25079 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25080 {
25081 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
25082 info->emits_changed_signal)
25083 _flash_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
25084 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25085 g_object_notify_by_pspec (object, pspec);
25086 }
25087 g_mutex_unlock (&skeleton->priv->lock);
25088 g_object_thaw_notify (object);
25089 }
25090
25091 static void
flash_skeleton_init(FlashSkeleton * skeleton)25092 flash_skeleton_init (FlashSkeleton *skeleton)
25093 {
25094 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25095 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
25096 #else
25097 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
25098 #endif
25099
25100 g_mutex_init (&skeleton->priv->lock);
25101 skeleton->priv->context = g_main_context_ref_thread_default ();
25102 skeleton->priv->properties = g_new0 (GValue, 5);
25103 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
25104 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25105 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
25106 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
25107 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
25108 }
25109
25110 static const gchar *
flash_skeleton_get_filename(Flash * object)25111 flash_skeleton_get_filename (Flash *object)
25112 {
25113 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25114 const gchar *value;
25115 g_mutex_lock (&skeleton->priv->lock);
25116 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
25117 g_mutex_unlock (&skeleton->priv->lock);
25118 return value;
25119 }
25120
25121 static const gchar *
flash_skeleton_get_flasher_path(Flash * object)25122 flash_skeleton_get_flasher_path (Flash *object)
25123 {
25124 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25125 const gchar *value;
25126 g_mutex_lock (&skeleton->priv->lock);
25127 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
25128 g_mutex_unlock (&skeleton->priv->lock);
25129 return value;
25130 }
25131
25132 static const gchar *
flash_skeleton_get_flasher_name(Flash * object)25133 flash_skeleton_get_flasher_name (Flash *object)
25134 {
25135 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25136 const gchar *value;
25137 g_mutex_lock (&skeleton->priv->lock);
25138 value = g_marshal_value_peek_string (&(skeleton->priv->properties[2]));
25139 g_mutex_unlock (&skeleton->priv->lock);
25140 return value;
25141 }
25142
25143 static const gchar *
flash_skeleton_get_flasher_instance(Flash * object)25144 flash_skeleton_get_flasher_instance (Flash *object)
25145 {
25146 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25147 const gchar *value;
25148 g_mutex_lock (&skeleton->priv->lock);
25149 value = g_marshal_value_peek_string (&(skeleton->priv->properties[3]));
25150 g_mutex_unlock (&skeleton->priv->lock);
25151 return value;
25152 }
25153
25154 static const gchar *
flash_skeleton_get_status(Flash * object)25155 flash_skeleton_get_status (Flash *object)
25156 {
25157 FlashSkeleton *skeleton = FLASH_SKELETON (object);
25158 const gchar *value;
25159 g_mutex_lock (&skeleton->priv->lock);
25160 value = g_marshal_value_peek_string (&(skeleton->priv->properties[4]));
25161 g_mutex_unlock (&skeleton->priv->lock);
25162 return value;
25163 }
25164
25165 static void
flash_skeleton_class_init(FlashSkeletonClass * klass)25166 flash_skeleton_class_init (FlashSkeletonClass *klass)
25167 {
25168 GObjectClass *gobject_class;
25169 GDBusInterfaceSkeletonClass *skeleton_class;
25170
25171 gobject_class = G_OBJECT_CLASS (klass);
25172 gobject_class->finalize = flash_skeleton_finalize;
25173 gobject_class->get_property = flash_skeleton_get_property;
25174 gobject_class->set_property = flash_skeleton_set_property;
25175 gobject_class->notify = flash_skeleton_notify;
25176
25177
25178 flash_override_properties (gobject_class, 1);
25179
25180 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25181 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
25182 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
25183 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
25184 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
25185
25186 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25187 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
25188 #endif
25189 }
25190
25191 static void
flash_skeleton_iface_init(FlashIface * iface)25192 flash_skeleton_iface_init (FlashIface *iface)
25193 {
25194 iface->updated = _flash_on_signal_updated;
25195 iface->download = _flash_on_signal_download;
25196 iface->get_filename = flash_skeleton_get_filename;
25197 iface->get_flasher_path = flash_skeleton_get_flasher_path;
25198 iface->get_flasher_name = flash_skeleton_get_flasher_name;
25199 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
25200 iface->get_status = flash_skeleton_get_status;
25201 }
25202
25203 /**
25204 * flash_skeleton_new:
25205 *
25206 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
25207 *
25208 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
25209 */
25210 Flash *
flash_skeleton_new(void)25211 flash_skeleton_new (void)
25212 {
25213 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
25214 }
25215
25216 /* ------------------------------------------------------------------------
25217 * Code for interface org.openbmc.FlashControl
25218 * ------------------------------------------------------------------------
25219 */
25220
25221 /**
25222 * SECTION:FlashControl
25223 * @title: FlashControl
25224 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
25225 *
25226 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C.
25227 */
25228
25229 enum
25230 {
25231 _FLASH_CONTROL_DONE,
25232 _FLASH_CONTROL_ERROR,
25233 _FLASH_CONTROL_PROGRESS,
25234 };
25235
25236 static unsigned _FLASH_CONTROL_SIGNALS[3] = { 0 };
25237
25238 /* ---- Introspection data for org.openbmc.FlashControl ---- */
25239
25240 static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
25241 {
25242 {
25243 -1,
25244 (gchar *) "type",
25245 (gchar *) "s",
25246 NULL
25247 },
25248 FALSE
25249 };
25250
25251 static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
25252 {
25253 {
25254 -1,
25255 (gchar *) "filename",
25256 (gchar *) "s",
25257 NULL
25258 },
25259 FALSE
25260 };
25261
25262 static const GDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
25263 {
25264 &_flash_control_method_info_flash_IN_ARG_type.parent_struct,
25265 &_flash_control_method_info_flash_IN_ARG_filename.parent_struct,
25266 NULL
25267 };
25268
25269 static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
25270 {
25271 {
25272 -1,
25273 (gchar *) "flash",
25274 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
25275 NULL,
25276 NULL
25277 },
25278 "handle-flash",
25279 FALSE
25280 };
25281
25282 static const GDBusMethodInfo * const _flash_control_method_info_pointers[] =
25283 {
25284 &_flash_control_method_info_flash.parent_struct,
25285 NULL
25286 };
25287
25288 static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
25289 {
25290 {
25291 -1,
25292 (gchar *) "filename",
25293 (gchar *) "s",
25294 NULL
25295 },
25296 FALSE
25297 };
25298
25299 static const GDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
25300 {
25301 &_flash_control_signal_info_done_ARG_filename.parent_struct,
25302 NULL
25303 };
25304
25305 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
25306 {
25307 {
25308 -1,
25309 (gchar *) "Done",
25310 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
25311 NULL
25312 },
25313 "done"
25314 };
25315
25316 static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
25317 {
25318 {
25319 -1,
25320 (gchar *) "filename",
25321 (gchar *) "s",
25322 NULL
25323 },
25324 FALSE
25325 };
25326
25327 static const GDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
25328 {
25329 &_flash_control_signal_info_error_ARG_filename.parent_struct,
25330 NULL
25331 };
25332
25333 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
25334 {
25335 {
25336 -1,
25337 (gchar *) "Error",
25338 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
25339 NULL
25340 },
25341 "error"
25342 };
25343
25344 static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
25345 {
25346 {
25347 -1,
25348 (gchar *) "filename",
25349 (gchar *) "s",
25350 NULL
25351 },
25352 FALSE
25353 };
25354
25355 static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
25356 {
25357 {
25358 -1,
25359 (gchar *) "progress",
25360 (gchar *) "y",
25361 NULL
25362 },
25363 FALSE
25364 };
25365
25366 static const GDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
25367 {
25368 &_flash_control_signal_info_progress_ARG_filename.parent_struct,
25369 &_flash_control_signal_info_progress_ARG_progress.parent_struct,
25370 NULL
25371 };
25372
25373 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
25374 {
25375 {
25376 -1,
25377 (gchar *) "Progress",
25378 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
25379 NULL
25380 },
25381 "progress"
25382 };
25383
25384 static const GDBusSignalInfo * const _flash_control_signal_info_pointers[] =
25385 {
25386 &_flash_control_signal_info_done.parent_struct,
25387 &_flash_control_signal_info_error.parent_struct,
25388 &_flash_control_signal_info_progress.parent_struct,
25389 NULL
25390 };
25391
25392 static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
25393 {
25394 {
25395 -1,
25396 (gchar *) "filename",
25397 (gchar *) "s",
25398 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25399 NULL
25400 },
25401 "filename",
25402 FALSE,
25403 TRUE
25404 };
25405
25406 static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
25407 {
25408 {
25409 -1,
25410 (gchar *) "type",
25411 (gchar *) "s",
25412 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25413 NULL
25414 },
25415 "type",
25416 FALSE,
25417 TRUE
25418 };
25419
25420 static const GDBusPropertyInfo * const _flash_control_property_info_pointers[] =
25421 {
25422 &_flash_control_property_info_filename.parent_struct,
25423 &_flash_control_property_info_type_.parent_struct,
25424 NULL
25425 };
25426
25427 static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
25428 {
25429 {
25430 -1,
25431 (gchar *) "org.openbmc.FlashControl",
25432 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
25433 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
25434 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
25435 NULL
25436 },
25437 "flash-control",
25438 };
25439
25440
25441 /**
25442 * flash_control_interface_info:
25443 *
25444 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
25445 *
25446 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25447 */
25448 GDBusInterfaceInfo *
flash_control_interface_info(void)25449 flash_control_interface_info (void)
25450 {
25451 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
25452 }
25453
25454 /**
25455 * flash_control_override_properties:
25456 * @klass: The class structure for a #GObject derived class.
25457 * @property_id_begin: The property id to assign to the first overridden property.
25458 *
25459 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
25460 * The properties are overridden in the order they are defined.
25461 *
25462 * Returns: The last property id.
25463 */
25464 guint
flash_control_override_properties(GObjectClass * klass,guint property_id_begin)25465 flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
25466 {
25467 g_object_class_override_property (klass, property_id_begin++, "filename");
25468 g_object_class_override_property (klass, property_id_begin++, "type");
25469 return property_id_begin - 1;
25470 }
25471
25472
25473 inline static void
flash_control_signal_marshal_done(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)25474 flash_control_signal_marshal_done (
25475 GClosure *closure,
25476 GValue *return_value,
25477 unsigned int n_param_values,
25478 const GValue *param_values,
25479 void *invocation_hint,
25480 void *marshal_data)
25481 {
25482 g_cclosure_marshal_VOID__STRING (closure,
25483 return_value, n_param_values, param_values, invocation_hint, marshal_data);
25484 }
25485
25486 inline static void
flash_control_signal_marshal_error(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)25487 flash_control_signal_marshal_error (
25488 GClosure *closure,
25489 GValue *return_value,
25490 unsigned int n_param_values,
25491 const GValue *param_values,
25492 void *invocation_hint,
25493 void *marshal_data)
25494 {
25495 g_cclosure_marshal_VOID__STRING (closure,
25496 return_value, n_param_values, param_values, invocation_hint, marshal_data);
25497 }
25498
25499 inline static void
flash_control_signal_marshal_progress(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)25500 flash_control_signal_marshal_progress (
25501 GClosure *closure,
25502 GValue *return_value,
25503 unsigned int n_param_values,
25504 const GValue *param_values,
25505 void *invocation_hint,
25506 void *marshal_data)
25507 {
25508 _g_dbus_codegen_marshal_VOID__STRING_UCHAR (closure,
25509 return_value, n_param_values, param_values, invocation_hint, marshal_data);
25510 }
25511
25512 inline static void
flash_control_method_marshal_flash(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)25513 flash_control_method_marshal_flash (
25514 GClosure *closure,
25515 GValue *return_value,
25516 unsigned int n_param_values,
25517 const GValue *param_values,
25518 void *invocation_hint,
25519 void *marshal_data)
25520 {
25521 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING (closure,
25522 return_value, n_param_values, param_values, invocation_hint, marshal_data);
25523 }
25524
25525
25526 /**
25527 * FlashControl:
25528 *
25529 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25530 */
25531
25532 /**
25533 * FlashControlIface:
25534 * @parent_iface: The parent interface.
25535 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
25536 * @get_filename: Getter for the #FlashControl:filename property.
25537 * @get_type_: Getter for the #FlashControl:type property.
25538 * @done: Handler for the #FlashControl::done signal.
25539 * @error: Handler for the #FlashControl::error signal.
25540 * @progress: Handler for the #FlashControl::progress signal.
25541 *
25542 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25543 */
25544
25545 typedef FlashControlIface FlashControlInterface;
G_DEFINE_INTERFACE(FlashControl,flash_control,G_TYPE_OBJECT)25546 G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT)
25547
25548 static void
25549 flash_control_default_init (FlashControlIface *iface)
25550 {
25551 /* GObject signals for incoming D-Bus method calls: */
25552 /**
25553 * FlashControl::handle-flash:
25554 * @object: A #FlashControl.
25555 * @invocation: A #GDBusMethodInvocation.
25556 * @arg_type: Argument passed by remote caller.
25557 * @arg_filename: Argument passed by remote caller.
25558 *
25559 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
25560 *
25561 * 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 flash_control_complete_flash() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
25562 *
25563 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
25564 */
25565 g_signal_new ("handle-flash",
25566 G_TYPE_FROM_INTERFACE (iface),
25567 G_SIGNAL_RUN_LAST,
25568 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
25569 g_signal_accumulator_true_handled,
25570 NULL,
25571 flash_control_method_marshal_flash,
25572 G_TYPE_BOOLEAN,
25573 3,
25574 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
25575
25576 /* GObject signals for received D-Bus signals: */
25577 /**
25578 * FlashControl::done:
25579 * @object: A #FlashControl.
25580 * @arg_filename: Argument.
25581 *
25582 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received.
25583 *
25584 * 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.
25585 */
25586 _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_DONE] =
25587 g_signal_new ("done",
25588 G_TYPE_FROM_INTERFACE (iface),
25589 G_SIGNAL_RUN_LAST,
25590 G_STRUCT_OFFSET (FlashControlIface, done),
25591 NULL,
25592 NULL,
25593 flash_control_signal_marshal_done,
25594 G_TYPE_NONE,
25595 1, G_TYPE_STRING);
25596
25597 /**
25598 * FlashControl::error:
25599 * @object: A #FlashControl.
25600 * @arg_filename: Argument.
25601 *
25602 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received.
25603 *
25604 * 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.
25605 */
25606 _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_ERROR] =
25607 g_signal_new ("error",
25608 G_TYPE_FROM_INTERFACE (iface),
25609 G_SIGNAL_RUN_LAST,
25610 G_STRUCT_OFFSET (FlashControlIface, error),
25611 NULL,
25612 NULL,
25613 flash_control_signal_marshal_error,
25614 G_TYPE_NONE,
25615 1, G_TYPE_STRING);
25616
25617 /**
25618 * FlashControl::progress:
25619 * @object: A #FlashControl.
25620 * @arg_filename: Argument.
25621 * @arg_progress: Argument.
25622 *
25623 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received.
25624 *
25625 * 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.
25626 */
25627 _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_PROGRESS] =
25628 g_signal_new ("progress",
25629 G_TYPE_FROM_INTERFACE (iface),
25630 G_SIGNAL_RUN_LAST,
25631 G_STRUCT_OFFSET (FlashControlIface, progress),
25632 NULL,
25633 NULL,
25634 flash_control_signal_marshal_progress,
25635 G_TYPE_NONE,
25636 2, G_TYPE_STRING, G_TYPE_UCHAR);
25637
25638 /* GObject properties for D-Bus properties: */
25639 /**
25640 * FlashControl:filename:
25641 *
25642 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
25643 *
25644 * 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.
25645 */
25646 g_object_interface_install_property (iface,
25647 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25648 /**
25649 * FlashControl:type:
25650 *
25651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
25652 *
25653 * 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.
25654 */
25655 g_object_interface_install_property (iface,
25656 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25657 }
25658
25659 /**
25660 * flash_control_get_filename: (skip)
25661 * @object: A #FlashControl.
25662 *
25663 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
25664 *
25665 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25666 *
25667 * 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 flash_control_dup_filename() if on another thread.
25668 *
25669 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
25670 */
25671 const gchar *
flash_control_get_filename(FlashControl * object)25672 flash_control_get_filename (FlashControl *object)
25673 {
25674 g_return_val_if_fail (IS_FLASH_CONTROL (object), NULL);
25675
25676 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
25677 }
25678
25679 /**
25680 * flash_control_dup_filename: (skip)
25681 * @object: A #FlashControl.
25682 *
25683 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
25684 *
25685 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25686 *
25687 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25688 */
25689 gchar *
flash_control_dup_filename(FlashControl * object)25690 flash_control_dup_filename (FlashControl *object)
25691 {
25692 gchar *value;
25693 g_object_get (G_OBJECT (object), "filename", &value, NULL);
25694 return value;
25695 }
25696
25697 /**
25698 * flash_control_set_filename: (skip)
25699 * @object: A #FlashControl.
25700 * @value: The value to set.
25701 *
25702 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
25703 *
25704 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25705 */
25706 void
flash_control_set_filename(FlashControl * object,const gchar * value)25707 flash_control_set_filename (FlashControl *object, const gchar *value)
25708 {
25709 g_object_set (G_OBJECT (object), "filename", value, NULL);
25710 }
25711
25712 /**
25713 * flash_control_get_type_: (skip)
25714 * @object: A #FlashControl.
25715 *
25716 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
25717 *
25718 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25719 *
25720 * 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 flash_control_dup_type_() if on another thread.
25721 *
25722 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
25723 */
25724 const gchar *
flash_control_get_type_(FlashControl * object)25725 flash_control_get_type_ (FlashControl *object)
25726 {
25727 g_return_val_if_fail (IS_FLASH_CONTROL (object), NULL);
25728
25729 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
25730 }
25731
25732 /**
25733 * flash_control_dup_type_: (skip)
25734 * @object: A #FlashControl.
25735 *
25736 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
25737 *
25738 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25739 *
25740 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25741 */
25742 gchar *
flash_control_dup_type_(FlashControl * object)25743 flash_control_dup_type_ (FlashControl *object)
25744 {
25745 gchar *value;
25746 g_object_get (G_OBJECT (object), "type", &value, NULL);
25747 return value;
25748 }
25749
25750 /**
25751 * flash_control_set_type_: (skip)
25752 * @object: A #FlashControl.
25753 * @value: The value to set.
25754 *
25755 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
25756 *
25757 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25758 */
25759 void
flash_control_set_type_(FlashControl * object,const gchar * value)25760 flash_control_set_type_ (FlashControl *object, const gchar *value)
25761 {
25762 g_object_set (G_OBJECT (object), "type", value, NULL);
25763 }
25764
25765 /**
25766 * flash_control_emit_done:
25767 * @object: A #FlashControl.
25768 * @arg_filename: Argument to pass with the signal.
25769 *
25770 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
25771 */
25772 void
flash_control_emit_done(FlashControl * object,const gchar * arg_filename)25773 flash_control_emit_done (
25774 FlashControl *object,
25775 const gchar *arg_filename)
25776 {
25777 g_signal_emit (object, _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_DONE], 0, arg_filename);
25778 }
25779
25780 /**
25781 * flash_control_emit_error:
25782 * @object: A #FlashControl.
25783 * @arg_filename: Argument to pass with the signal.
25784 *
25785 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
25786 */
25787 void
flash_control_emit_error(FlashControl * object,const gchar * arg_filename)25788 flash_control_emit_error (
25789 FlashControl *object,
25790 const gchar *arg_filename)
25791 {
25792 g_signal_emit (object, _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_ERROR], 0, arg_filename);
25793 }
25794
25795 /**
25796 * flash_control_emit_progress:
25797 * @object: A #FlashControl.
25798 * @arg_filename: Argument to pass with the signal.
25799 * @arg_progress: Argument to pass with the signal.
25800 *
25801 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
25802 */
25803 void
flash_control_emit_progress(FlashControl * object,const gchar * arg_filename,guchar arg_progress)25804 flash_control_emit_progress (
25805 FlashControl *object,
25806 const gchar *arg_filename,
25807 guchar arg_progress)
25808 {
25809 g_signal_emit (object, _FLASH_CONTROL_SIGNALS[_FLASH_CONTROL_PROGRESS], 0, arg_filename, arg_progress);
25810 }
25811
25812 /**
25813 * flash_control_call_flash:
25814 * @proxy: A #FlashControlProxy.
25815 * @arg_type: Argument to pass with the method invocation.
25816 * @arg_filename: Argument to pass with the method invocation.
25817 * @cancellable: (nullable): A #GCancellable or %NULL.
25818 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25819 * @user_data: User data to pass to @callback.
25820 *
25821 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
25822 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
25823 * You can then call flash_control_call_flash_finish() to get the result of the operation.
25824 *
25825 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
25826 */
25827 void
flash_control_call_flash(FlashControl * proxy,const gchar * arg_type,const gchar * arg_filename,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)25828 flash_control_call_flash (
25829 FlashControl *proxy,
25830 const gchar *arg_type,
25831 const gchar *arg_filename,
25832 GCancellable *cancellable,
25833 GAsyncReadyCallback callback,
25834 gpointer user_data)
25835 {
25836 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25837 "flash",
25838 g_variant_new ("(ss)",
25839 arg_type,
25840 arg_filename),
25841 G_DBUS_CALL_FLAGS_NONE,
25842 -1,
25843 cancellable,
25844 callback,
25845 user_data);
25846 }
25847
25848 /**
25849 * flash_control_call_flash_finish:
25850 * @proxy: A #FlashControlProxy.
25851 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
25852 * @error: Return location for error or %NULL.
25853 *
25854 * Finishes an operation started with flash_control_call_flash().
25855 *
25856 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
25857 */
25858 gboolean
flash_control_call_flash_finish(FlashControl * proxy,GAsyncResult * res,GError ** error)25859 flash_control_call_flash_finish (
25860 FlashControl *proxy,
25861 GAsyncResult *res,
25862 GError **error)
25863 {
25864 GVariant *_ret;
25865 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25866 if (_ret == NULL)
25867 goto _out;
25868 g_variant_get (_ret,
25869 "()");
25870 g_variant_unref (_ret);
25871 _out:
25872 return _ret != NULL;
25873 }
25874
25875 /**
25876 * flash_control_call_flash_sync:
25877 * @proxy: A #FlashControlProxy.
25878 * @arg_type: Argument to pass with the method invocation.
25879 * @arg_filename: Argument to pass with the method invocation.
25880 * @cancellable: (nullable): A #GCancellable or %NULL.
25881 * @error: Return location for error or %NULL.
25882 *
25883 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
25884 *
25885 * See flash_control_call_flash() for the asynchronous version of this method.
25886 *
25887 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
25888 */
25889 gboolean
flash_control_call_flash_sync(FlashControl * proxy,const gchar * arg_type,const gchar * arg_filename,GCancellable * cancellable,GError ** error)25890 flash_control_call_flash_sync (
25891 FlashControl *proxy,
25892 const gchar *arg_type,
25893 const gchar *arg_filename,
25894 GCancellable *cancellable,
25895 GError **error)
25896 {
25897 GVariant *_ret;
25898 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25899 "flash",
25900 g_variant_new ("(ss)",
25901 arg_type,
25902 arg_filename),
25903 G_DBUS_CALL_FLAGS_NONE,
25904 -1,
25905 cancellable,
25906 error);
25907 if (_ret == NULL)
25908 goto _out;
25909 g_variant_get (_ret,
25910 "()");
25911 g_variant_unref (_ret);
25912 _out:
25913 return _ret != NULL;
25914 }
25915
25916 /**
25917 * flash_control_complete_flash:
25918 * @object: A #FlashControl.
25919 * @invocation: (transfer full): A #GDBusMethodInvocation.
25920 *
25921 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</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.
25922 *
25923 * This method will free @invocation, you cannot use it afterwards.
25924 */
25925 void
flash_control_complete_flash(FlashControl * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)25926 flash_control_complete_flash (
25927 FlashControl *object G_GNUC_UNUSED,
25928 GDBusMethodInvocation *invocation)
25929 {
25930 g_dbus_method_invocation_return_value (invocation,
25931 g_variant_new ("()"));
25932 }
25933
25934 /* ------------------------------------------------------------------------ */
25935
25936 /**
25937 * FlashControlProxy:
25938 *
25939 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
25940 */
25941
25942 /**
25943 * FlashControlProxyClass:
25944 * @parent_class: The parent class.
25945 *
25946 * Class structure for #FlashControlProxy.
25947 */
25948
25949 struct _FlashControlProxyPrivate
25950 {
25951 GData *qdata;
25952 };
25953
25954 static void flash_control_proxy_iface_init (FlashControlIface *iface);
25955
25956 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FlashControlProxy,flash_control_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (FlashControlProxy)G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL,flash_control_proxy_iface_init))25957 G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
25958 G_ADD_PRIVATE (FlashControlProxy)
25959 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init))
25960
25961 #else
25962 G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
25963 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init))
25964
25965 #endif
25966 static void
25967 flash_control_proxy_finalize (GObject *object)
25968 {
25969 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
25970 g_datalist_clear (&proxy->priv->qdata);
25971 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
25972 }
25973
25974 static void
flash_control_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)25975 flash_control_proxy_get_property (GObject *object,
25976 guint prop_id,
25977 GValue *value,
25978 GParamSpec *pspec G_GNUC_UNUSED)
25979 {
25980 const _ExtendedGDBusPropertyInfo *info;
25981 GVariant *variant;
25982 g_assert (prop_id != 0 && prop_id - 1 < 2);
25983 info = (const _ExtendedGDBusPropertyInfo *) _flash_control_property_info_pointers[prop_id - 1];
25984 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
25985 if (info->use_gvariant)
25986 {
25987 g_value_set_variant (value, variant);
25988 }
25989 else
25990 {
25991 if (variant != NULL)
25992 g_dbus_gvariant_to_gvalue (variant, value);
25993 }
25994 if (variant != NULL)
25995 g_variant_unref (variant);
25996 }
25997
25998 static void
flash_control_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)25999 flash_control_proxy_set_property_cb (GDBusProxy *proxy,
26000 GAsyncResult *res,
26001 gpointer user_data)
26002 {
26003 const _ExtendedGDBusPropertyInfo *info = user_data;
26004 GError *error;
26005 GVariant *_ret;
26006 error = NULL;
26007 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26008 if (!_ret)
26009 {
26010 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
26011 info->parent_struct.name,
26012 error->message, g_quark_to_string (error->domain), error->code);
26013 g_error_free (error);
26014 }
26015 else
26016 {
26017 g_variant_unref (_ret);
26018 }
26019 }
26020
26021 static void
flash_control_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)26022 flash_control_proxy_set_property (GObject *object,
26023 guint prop_id,
26024 const GValue *value,
26025 GParamSpec *pspec G_GNUC_UNUSED)
26026 {
26027 const _ExtendedGDBusPropertyInfo *info;
26028 GVariant *variant;
26029 g_assert (prop_id != 0 && prop_id - 1 < 2);
26030 info = (const _ExtendedGDBusPropertyInfo *) _flash_control_property_info_pointers[prop_id - 1];
26031 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26032 g_dbus_proxy_call (G_DBUS_PROXY (object),
26033 "org.freedesktop.DBus.Properties.Set",
26034 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
26035 G_DBUS_CALL_FLAGS_NONE,
26036 -1,
26037 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26038 g_variant_unref (variant);
26039 }
26040
26041 static void
flash_control_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)26042 flash_control_proxy_g_signal (GDBusProxy *proxy,
26043 const gchar *sender_name G_GNUC_UNUSED,
26044 const gchar *signal_name,
26045 GVariant *parameters)
26046 {
26047 _ExtendedGDBusSignalInfo *info;
26048 GVariantIter iter;
26049 GVariant *child;
26050 GValue *paramv;
26051 gsize num_params;
26052 gsize n;
26053 guint signal_id;
26054 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
26055 if (info == NULL)
26056 return;
26057 num_params = g_variant_n_children (parameters);
26058 paramv = g_new0 (GValue, num_params + 1);
26059 g_value_init (¶mv[0], TYPE_FLASH_CONTROL);
26060 g_value_set_object (¶mv[0], proxy);
26061 g_variant_iter_init (&iter, parameters);
26062 n = 1;
26063 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26064 {
26065 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26066 if (arg_info->use_gvariant)
26067 {
26068 g_value_init (¶mv[n], G_TYPE_VARIANT);
26069 g_value_set_variant (¶mv[n], child);
26070 n++;
26071 }
26072 else
26073 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
26074 g_variant_unref (child);
26075 }
26076 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
26077 g_signal_emitv (paramv, signal_id, 0, NULL);
26078 for (n = 0; n < num_params + 1; n++)
26079 g_value_unset (¶mv[n]);
26080 g_free (paramv);
26081 }
26082
26083 static void
flash_control_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)26084 flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
26085 GVariant *changed_properties,
26086 const gchar *const *invalidated_properties)
26087 {
26088 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
26089 guint n;
26090 const gchar *key;
26091 GVariantIter *iter;
26092 _ExtendedGDBusPropertyInfo *info;
26093 g_variant_get (changed_properties, "a{sv}", &iter);
26094 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26095 {
26096 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
26097 g_datalist_remove_data (&proxy->priv->qdata, key);
26098 if (info != NULL)
26099 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26100 }
26101 g_variant_iter_free (iter);
26102 for (n = 0; invalidated_properties[n] != NULL; n++)
26103 {
26104 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
26105 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26106 if (info != NULL)
26107 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26108 }
26109 }
26110
26111 static const gchar *
flash_control_proxy_get_filename(FlashControl * object)26112 flash_control_proxy_get_filename (FlashControl *object)
26113 {
26114 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
26115 GVariant *variant;
26116 const gchar *value = NULL;
26117 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
26118 if (variant != NULL)
26119 {
26120 value = g_variant_get_string (variant, NULL);
26121 g_variant_unref (variant);
26122 }
26123 return value;
26124 }
26125
26126 static const gchar *
flash_control_proxy_get_type_(FlashControl * object)26127 flash_control_proxy_get_type_ (FlashControl *object)
26128 {
26129 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
26130 GVariant *variant;
26131 const gchar *value = NULL;
26132 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
26133 if (variant != NULL)
26134 {
26135 value = g_variant_get_string (variant, NULL);
26136 g_variant_unref (variant);
26137 }
26138 return value;
26139 }
26140
26141 static void
flash_control_proxy_init(FlashControlProxy * proxy)26142 flash_control_proxy_init (FlashControlProxy *proxy)
26143 {
26144 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26145 proxy->priv = flash_control_proxy_get_instance_private (proxy);
26146 #else
26147 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
26148 #endif
26149
26150 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
26151 }
26152
26153 static void
flash_control_proxy_class_init(FlashControlProxyClass * klass)26154 flash_control_proxy_class_init (FlashControlProxyClass *klass)
26155 {
26156 GObjectClass *gobject_class;
26157 GDBusProxyClass *proxy_class;
26158
26159 gobject_class = G_OBJECT_CLASS (klass);
26160 gobject_class->finalize = flash_control_proxy_finalize;
26161 gobject_class->get_property = flash_control_proxy_get_property;
26162 gobject_class->set_property = flash_control_proxy_set_property;
26163
26164 proxy_class = G_DBUS_PROXY_CLASS (klass);
26165 proxy_class->g_signal = flash_control_proxy_g_signal;
26166 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
26167
26168 flash_control_override_properties (gobject_class, 1);
26169
26170 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26171 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
26172 #endif
26173 }
26174
26175 static void
flash_control_proxy_iface_init(FlashControlIface * iface)26176 flash_control_proxy_iface_init (FlashControlIface *iface)
26177 {
26178 iface->get_filename = flash_control_proxy_get_filename;
26179 iface->get_type_ = flash_control_proxy_get_type_;
26180 }
26181
26182 /**
26183 * flash_control_proxy_new:
26184 * @connection: A #GDBusConnection.
26185 * @flags: Flags from the #GDBusProxyFlags enumeration.
26186 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26187 * @object_path: An object path.
26188 * @cancellable: (nullable): A #GCancellable or %NULL.
26189 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26190 * @user_data: User data to pass to @callback.
26191 *
26192 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details.
26193 *
26194 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
26195 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
26196 *
26197 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
26198 */
26199 void
flash_control_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)26200 flash_control_proxy_new (
26201 GDBusConnection *connection,
26202 GDBusProxyFlags flags,
26203 const gchar *name,
26204 const gchar *object_path,
26205 GCancellable *cancellable,
26206 GAsyncReadyCallback callback,
26207 gpointer user_data)
26208 {
26209 g_async_initable_new_async (TYPE_FLASH_CONTROL_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.FlashControl", NULL);
26210 }
26211
26212 /**
26213 * flash_control_proxy_new_finish:
26214 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
26215 * @error: Return location for error or %NULL
26216 *
26217 * Finishes an operation started with flash_control_proxy_new().
26218 *
26219 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
26220 */
26221 FlashControl *
flash_control_proxy_new_finish(GAsyncResult * res,GError ** error)26222 flash_control_proxy_new_finish (
26223 GAsyncResult *res,
26224 GError **error)
26225 {
26226 GObject *ret;
26227 GObject *source_object;
26228 source_object = g_async_result_get_source_object (res);
26229 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26230 g_object_unref (source_object);
26231 if (ret != NULL)
26232 return FLASH_CONTROL (ret);
26233 else
26234 return NULL;
26235 }
26236
26237 /**
26238 * flash_control_proxy_new_sync:
26239 * @connection: A #GDBusConnection.
26240 * @flags: Flags from the #GDBusProxyFlags enumeration.
26241 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26242 * @object_path: An object path.
26243 * @cancellable: (nullable): A #GCancellable or %NULL.
26244 * @error: Return location for error or %NULL
26245 *
26246 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details.
26247 *
26248 * The calling thread is blocked until a reply is received.
26249 *
26250 * See flash_control_proxy_new() for the asynchronous version of this constructor.
26251 *
26252 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
26253 */
26254 FlashControl *
flash_control_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)26255 flash_control_proxy_new_sync (
26256 GDBusConnection *connection,
26257 GDBusProxyFlags flags,
26258 const gchar *name,
26259 const gchar *object_path,
26260 GCancellable *cancellable,
26261 GError **error)
26262 {
26263 GInitable *ret;
26264 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
26265 if (ret != NULL)
26266 return FLASH_CONTROL (ret);
26267 else
26268 return NULL;
26269 }
26270
26271
26272 /**
26273 * flash_control_proxy_new_for_bus:
26274 * @bus_type: A #GBusType.
26275 * @flags: Flags from the #GDBusProxyFlags enumeration.
26276 * @name: A bus name (well-known or unique).
26277 * @object_path: An object path.
26278 * @cancellable: (nullable): A #GCancellable or %NULL.
26279 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26280 * @user_data: User data to pass to @callback.
26281 *
26282 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26283 *
26284 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
26285 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
26286 *
26287 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26288 */
26289 void
flash_control_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)26290 flash_control_proxy_new_for_bus (
26291 GBusType bus_type,
26292 GDBusProxyFlags flags,
26293 const gchar *name,
26294 const gchar *object_path,
26295 GCancellable *cancellable,
26296 GAsyncReadyCallback callback,
26297 gpointer user_data)
26298 {
26299 g_async_initable_new_async (TYPE_FLASH_CONTROL_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.FlashControl", NULL);
26300 }
26301
26302 /**
26303 * flash_control_proxy_new_for_bus_finish:
26304 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
26305 * @error: Return location for error or %NULL
26306 *
26307 * Finishes an operation started with flash_control_proxy_new_for_bus().
26308 *
26309 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
26310 */
26311 FlashControl *
flash_control_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)26312 flash_control_proxy_new_for_bus_finish (
26313 GAsyncResult *res,
26314 GError **error)
26315 {
26316 GObject *ret;
26317 GObject *source_object;
26318 source_object = g_async_result_get_source_object (res);
26319 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26320 g_object_unref (source_object);
26321 if (ret != NULL)
26322 return FLASH_CONTROL (ret);
26323 else
26324 return NULL;
26325 }
26326
26327 /**
26328 * flash_control_proxy_new_for_bus_sync:
26329 * @bus_type: A #GBusType.
26330 * @flags: Flags from the #GDBusProxyFlags enumeration.
26331 * @name: A bus name (well-known or unique).
26332 * @object_path: An object path.
26333 * @cancellable: (nullable): A #GCancellable or %NULL.
26334 * @error: Return location for error or %NULL
26335 *
26336 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26337 *
26338 * The calling thread is blocked until a reply is received.
26339 *
26340 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
26341 *
26342 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
26343 */
26344 FlashControl *
flash_control_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)26345 flash_control_proxy_new_for_bus_sync (
26346 GBusType bus_type,
26347 GDBusProxyFlags flags,
26348 const gchar *name,
26349 const gchar *object_path,
26350 GCancellable *cancellable,
26351 GError **error)
26352 {
26353 GInitable *ret;
26354 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
26355 if (ret != NULL)
26356 return FLASH_CONTROL (ret);
26357 else
26358 return NULL;
26359 }
26360
26361
26362 /* ------------------------------------------------------------------------ */
26363
26364 /**
26365 * FlashControlSkeleton:
26366 *
26367 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
26368 */
26369
26370 /**
26371 * FlashControlSkeletonClass:
26372 * @parent_class: The parent class.
26373 *
26374 * Class structure for #FlashControlSkeleton.
26375 */
26376
26377 struct _FlashControlSkeletonPrivate
26378 {
26379 GValue *properties;
26380 GList *changed_properties;
26381 GSource *changed_properties_idle_source;
26382 GMainContext *context;
26383 GMutex lock;
26384 };
26385
26386 static void
_flash_control_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)26387 _flash_control_skeleton_handle_method_call (
26388 GDBusConnection *connection G_GNUC_UNUSED,
26389 const gchar *sender G_GNUC_UNUSED,
26390 const gchar *object_path G_GNUC_UNUSED,
26391 const gchar *interface_name,
26392 const gchar *method_name,
26393 GVariant *parameters,
26394 GDBusMethodInvocation *invocation,
26395 gpointer user_data)
26396 {
26397 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
26398 _ExtendedGDBusMethodInfo *info;
26399 GVariantIter iter;
26400 GVariant *child;
26401 GValue *paramv;
26402 gsize num_params;
26403 guint num_extra;
26404 gsize n;
26405 guint signal_id;
26406 GValue return_value = G_VALUE_INIT;
26407 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26408 g_assert (info != NULL);
26409 num_params = g_variant_n_children (parameters);
26410 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26411 n = 0;
26412 g_value_init (¶mv[n], TYPE_FLASH_CONTROL);
26413 g_value_set_object (¶mv[n++], skeleton);
26414 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26415 g_value_set_object (¶mv[n++], invocation);
26416 if (info->pass_fdlist)
26417 {
26418 #ifdef G_OS_UNIX
26419 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
26420 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26421 #else
26422 g_assert_not_reached ();
26423 #endif
26424 }
26425 g_variant_iter_init (&iter, parameters);
26426 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26427 {
26428 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26429 if (arg_info->use_gvariant)
26430 {
26431 g_value_init (¶mv[n], G_TYPE_VARIANT);
26432 g_value_set_variant (¶mv[n], child);
26433 n++;
26434 }
26435 else
26436 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
26437 g_variant_unref (child);
26438 }
26439 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
26440 g_value_init (&return_value, G_TYPE_BOOLEAN);
26441 g_signal_emitv (paramv, signal_id, 0, &return_value);
26442 if (!g_value_get_boolean (&return_value))
26443 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);
26444 g_value_unset (&return_value);
26445 for (n = 0; n < num_params + num_extra; n++)
26446 g_value_unset (¶mv[n]);
26447 g_free (paramv);
26448 }
26449
26450 static GVariant *
_flash_control_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)26451 _flash_control_skeleton_handle_get_property (
26452 GDBusConnection *connection G_GNUC_UNUSED,
26453 const gchar *sender G_GNUC_UNUSED,
26454 const gchar *object_path G_GNUC_UNUSED,
26455 const gchar *interface_name G_GNUC_UNUSED,
26456 const gchar *property_name,
26457 GError **error,
26458 gpointer user_data)
26459 {
26460 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
26461 GValue value = G_VALUE_INIT;
26462 GParamSpec *pspec;
26463 _ExtendedGDBusPropertyInfo *info;
26464 GVariant *ret;
26465 ret = NULL;
26466 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
26467 g_assert (info != NULL);
26468 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26469 if (pspec == NULL)
26470 {
26471 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26472 }
26473 else
26474 {
26475 g_value_init (&value, pspec->value_type);
26476 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26477 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26478 g_value_unset (&value);
26479 }
26480 return ret;
26481 }
26482
26483 static gboolean
_flash_control_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)26484 _flash_control_skeleton_handle_set_property (
26485 GDBusConnection *connection G_GNUC_UNUSED,
26486 const gchar *sender G_GNUC_UNUSED,
26487 const gchar *object_path G_GNUC_UNUSED,
26488 const gchar *interface_name G_GNUC_UNUSED,
26489 const gchar *property_name,
26490 GVariant *variant,
26491 GError **error,
26492 gpointer user_data)
26493 {
26494 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
26495 GValue value = G_VALUE_INIT;
26496 GParamSpec *pspec;
26497 _ExtendedGDBusPropertyInfo *info;
26498 gboolean ret;
26499 ret = FALSE;
26500 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
26501 g_assert (info != NULL);
26502 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26503 if (pspec == NULL)
26504 {
26505 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26506 }
26507 else
26508 {
26509 if (info->use_gvariant)
26510 g_value_set_variant (&value, variant);
26511 else
26512 g_dbus_gvariant_to_gvalue (variant, &value);
26513 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26514 g_value_unset (&value);
26515 ret = TRUE;
26516 }
26517 return ret;
26518 }
26519
26520 static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
26521 {
26522 _flash_control_skeleton_handle_method_call,
26523 _flash_control_skeleton_handle_get_property,
26524 _flash_control_skeleton_handle_set_property,
26525 {NULL}
26526 };
26527
26528 static GDBusInterfaceInfo *
flash_control_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)26529 flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26530 {
26531 return flash_control_interface_info ();
26532 }
26533
26534 static GDBusInterfaceVTable *
flash_control_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)26535 flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26536 {
26537 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
26538 }
26539
26540 static GVariant *
flash_control_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)26541 flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26542 {
26543 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
26544
26545 GVariantBuilder builder;
26546 guint n;
26547 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26548 if (_flash_control_interface_info.parent_struct.properties == NULL)
26549 goto out;
26550 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
26551 {
26552 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
26553 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26554 {
26555 GVariant *value;
26556 value = _flash_control_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.FlashControl", info->name, NULL, skeleton);
26557 if (value != NULL)
26558 {
26559 g_variant_take_ref (value);
26560 g_variant_builder_add (&builder, "{sv}", info->name, value);
26561 g_variant_unref (value);
26562 }
26563 }
26564 }
26565 out:
26566 return g_variant_builder_end (&builder);
26567 }
26568
26569 static gboolean _flash_control_emit_changed (gpointer user_data);
26570
26571 static void
flash_control_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)26572 flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26573 {
26574 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
26575 gboolean emit_changed = FALSE;
26576
26577 g_mutex_lock (&skeleton->priv->lock);
26578 if (skeleton->priv->changed_properties_idle_source != NULL)
26579 {
26580 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26581 skeleton->priv->changed_properties_idle_source = NULL;
26582 emit_changed = TRUE;
26583 }
26584 g_mutex_unlock (&skeleton->priv->lock);
26585
26586 if (emit_changed)
26587 _flash_control_emit_changed (skeleton);
26588 }
26589
26590 static void
_flash_control_on_signal_done(FlashControl * object,const gchar * arg_filename)26591 _flash_control_on_signal_done (
26592 FlashControl *object,
26593 const gchar *arg_filename)
26594 {
26595 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26596
26597 GList *connections, *l;
26598 GVariant *signal_variant;
26599 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26600
26601 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
26602 arg_filename));
26603 for (l = connections; l != NULL; l = l->next)
26604 {
26605 GDBusConnection *connection = l->data;
26606 g_dbus_connection_emit_signal (connection,
26607 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
26608 signal_variant, NULL);
26609 }
26610 g_variant_unref (signal_variant);
26611 g_list_free_full (connections, g_object_unref);
26612 }
26613
26614 static void
_flash_control_on_signal_error(FlashControl * object,const gchar * arg_filename)26615 _flash_control_on_signal_error (
26616 FlashControl *object,
26617 const gchar *arg_filename)
26618 {
26619 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26620
26621 GList *connections, *l;
26622 GVariant *signal_variant;
26623 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26624
26625 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
26626 arg_filename));
26627 for (l = connections; l != NULL; l = l->next)
26628 {
26629 GDBusConnection *connection = l->data;
26630 g_dbus_connection_emit_signal (connection,
26631 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
26632 signal_variant, NULL);
26633 }
26634 g_variant_unref (signal_variant);
26635 g_list_free_full (connections, g_object_unref);
26636 }
26637
26638 static void
_flash_control_on_signal_progress(FlashControl * object,const gchar * arg_filename,guchar arg_progress)26639 _flash_control_on_signal_progress (
26640 FlashControl *object,
26641 const gchar *arg_filename,
26642 guchar arg_progress)
26643 {
26644 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26645
26646 GList *connections, *l;
26647 GVariant *signal_variant;
26648 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26649
26650 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
26651 arg_filename,
26652 arg_progress));
26653 for (l = connections; l != NULL; l = l->next)
26654 {
26655 GDBusConnection *connection = l->data;
26656 g_dbus_connection_emit_signal (connection,
26657 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
26658 signal_variant, NULL);
26659 }
26660 g_variant_unref (signal_variant);
26661 g_list_free_full (connections, g_object_unref);
26662 }
26663
26664 static void flash_control_skeleton_iface_init (FlashControlIface *iface);
26665 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(FlashControlSkeleton,flash_control_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (FlashControlSkeleton)G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL,flash_control_skeleton_iface_init))26666 G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26667 G_ADD_PRIVATE (FlashControlSkeleton)
26668 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init))
26669
26670 #else
26671 G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26672 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init))
26673
26674 #endif
26675 static void
26676 flash_control_skeleton_finalize (GObject *object)
26677 {
26678 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26679 guint n;
26680 for (n = 0; n < 2; n++)
26681 g_value_unset (&skeleton->priv->properties[n]);
26682 g_free (skeleton->priv->properties);
26683 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26684 if (skeleton->priv->changed_properties_idle_source != NULL)
26685 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26686 g_main_context_unref (skeleton->priv->context);
26687 g_mutex_clear (&skeleton->priv->lock);
26688 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
26689 }
26690
26691 static void
flash_control_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)26692 flash_control_skeleton_get_property (GObject *object,
26693 guint prop_id,
26694 GValue *value,
26695 GParamSpec *pspec G_GNUC_UNUSED)
26696 {
26697 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26698 g_assert (prop_id != 0 && prop_id - 1 < 2);
26699 g_mutex_lock (&skeleton->priv->lock);
26700 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
26701 g_mutex_unlock (&skeleton->priv->lock);
26702 }
26703
26704 static gboolean
_flash_control_emit_changed(gpointer user_data)26705 _flash_control_emit_changed (gpointer user_data)
26706 {
26707 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
26708 GList *l;
26709 GVariantBuilder builder;
26710 GVariantBuilder invalidated_builder;
26711 guint num_changes;
26712
26713 g_mutex_lock (&skeleton->priv->lock);
26714 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26715 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
26716 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
26717 {
26718 ChangedProperty *cp = l->data;
26719 GVariant *variant;
26720 const GValue *cur_value;
26721
26722 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
26723 if (!_g_value_equal (cur_value, &cp->orig_value))
26724 {
26725 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
26726 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
26727 g_variant_unref (variant);
26728 num_changes++;
26729 }
26730 }
26731 if (num_changes > 0)
26732 {
26733 GList *connections, *ll;
26734 GVariant *signal_variant;
26735 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
26736 &builder, &invalidated_builder));
26737 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26738 for (ll = connections; ll != NULL; ll = ll->next)
26739 {
26740 GDBusConnection *connection = ll->data;
26741
26742 g_dbus_connection_emit_signal (connection,
26743 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
26744 "org.freedesktop.DBus.Properties",
26745 "PropertiesChanged",
26746 signal_variant,
26747 NULL);
26748 }
26749 g_variant_unref (signal_variant);
26750 g_list_free_full (connections, g_object_unref);
26751 }
26752 else
26753 {
26754 g_variant_builder_clear (&builder);
26755 g_variant_builder_clear (&invalidated_builder);
26756 }
26757 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26758 skeleton->priv->changed_properties = NULL;
26759 skeleton->priv->changed_properties_idle_source = NULL;
26760 g_mutex_unlock (&skeleton->priv->lock);
26761 return FALSE;
26762 }
26763
26764 static void
_flash_control_schedule_emit_changed(FlashControlSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)26765 _flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
26766 {
26767 ChangedProperty *cp;
26768 GList *l;
26769 cp = NULL;
26770 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
26771 {
26772 ChangedProperty *i_cp = l->data;
26773 if (i_cp->info == info)
26774 {
26775 cp = i_cp;
26776 break;
26777 }
26778 }
26779 if (cp == NULL)
26780 {
26781 cp = g_new0 (ChangedProperty, 1);
26782 cp->prop_id = prop_id;
26783 cp->info = info;
26784 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
26785 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
26786 g_value_copy (orig_value, &cp->orig_value);
26787 }
26788 }
26789
26790 static void
flash_control_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)26791 flash_control_skeleton_notify (GObject *object,
26792 GParamSpec *pspec G_GNUC_UNUSED)
26793 {
26794 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26795 g_mutex_lock (&skeleton->priv->lock);
26796 if (skeleton->priv->changed_properties != NULL &&
26797 skeleton->priv->changed_properties_idle_source == NULL)
26798 {
26799 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
26800 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
26801 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
26802 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed");
26803 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
26804 g_source_unref (skeleton->priv->changed_properties_idle_source);
26805 }
26806 g_mutex_unlock (&skeleton->priv->lock);
26807 }
26808
26809 static void
flash_control_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)26810 flash_control_skeleton_set_property (GObject *object,
26811 guint prop_id,
26812 const GValue *value,
26813 GParamSpec *pspec)
26814 {
26815 const _ExtendedGDBusPropertyInfo *info;
26816 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26817 g_assert (prop_id != 0 && prop_id - 1 < 2);
26818 info = (const _ExtendedGDBusPropertyInfo *) _flash_control_property_info_pointers[prop_id - 1];
26819 g_mutex_lock (&skeleton->priv->lock);
26820 g_object_freeze_notify (object);
26821 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
26822 {
26823 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
26824 info->emits_changed_signal)
26825 _flash_control_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
26826 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
26827 g_object_notify_by_pspec (object, pspec);
26828 }
26829 g_mutex_unlock (&skeleton->priv->lock);
26830 g_object_thaw_notify (object);
26831 }
26832
26833 static void
flash_control_skeleton_init(FlashControlSkeleton * skeleton)26834 flash_control_skeleton_init (FlashControlSkeleton *skeleton)
26835 {
26836 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26837 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
26838 #else
26839 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
26840 #endif
26841
26842 g_mutex_init (&skeleton->priv->lock);
26843 skeleton->priv->context = g_main_context_ref_thread_default ();
26844 skeleton->priv->properties = g_new0 (GValue, 2);
26845 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
26846 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
26847 }
26848
26849 static const gchar *
flash_control_skeleton_get_filename(FlashControl * object)26850 flash_control_skeleton_get_filename (FlashControl *object)
26851 {
26852 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26853 const gchar *value;
26854 g_mutex_lock (&skeleton->priv->lock);
26855 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
26856 g_mutex_unlock (&skeleton->priv->lock);
26857 return value;
26858 }
26859
26860 static const gchar *
flash_control_skeleton_get_type_(FlashControl * object)26861 flash_control_skeleton_get_type_ (FlashControl *object)
26862 {
26863 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26864 const gchar *value;
26865 g_mutex_lock (&skeleton->priv->lock);
26866 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
26867 g_mutex_unlock (&skeleton->priv->lock);
26868 return value;
26869 }
26870
26871 static void
flash_control_skeleton_class_init(FlashControlSkeletonClass * klass)26872 flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
26873 {
26874 GObjectClass *gobject_class;
26875 GDBusInterfaceSkeletonClass *skeleton_class;
26876
26877 gobject_class = G_OBJECT_CLASS (klass);
26878 gobject_class->finalize = flash_control_skeleton_finalize;
26879 gobject_class->get_property = flash_control_skeleton_get_property;
26880 gobject_class->set_property = flash_control_skeleton_set_property;
26881 gobject_class->notify = flash_control_skeleton_notify;
26882
26883
26884 flash_control_override_properties (gobject_class, 1);
26885
26886 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
26887 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
26888 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
26889 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
26890 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
26891
26892 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26893 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
26894 #endif
26895 }
26896
26897 static void
flash_control_skeleton_iface_init(FlashControlIface * iface)26898 flash_control_skeleton_iface_init (FlashControlIface *iface)
26899 {
26900 iface->done = _flash_control_on_signal_done;
26901 iface->error = _flash_control_on_signal_error;
26902 iface->progress = _flash_control_on_signal_progress;
26903 iface->get_filename = flash_control_skeleton_get_filename;
26904 iface->get_type_ = flash_control_skeleton_get_type_;
26905 }
26906
26907 /**
26908 * flash_control_skeleton_new:
26909 *
26910 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
26911 *
26912 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
26913 */
26914 FlashControl *
flash_control_skeleton_new(void)26915 flash_control_skeleton_new (void)
26916 {
26917 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
26918 }
26919
26920 /* ------------------------------------------------------------------------
26921 * Code for interface org.openbmc.Button
26922 * ------------------------------------------------------------------------
26923 */
26924
26925 /**
26926 * SECTION:Button
26927 * @title: Button
26928 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
26929 *
26930 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface in C.
26931 */
26932
26933 enum
26934 {
26935 _BUTTON_RELEASED,
26936 _BUTTON_PRESSED,
26937 _BUTTON_PRESSED_LONG,
26938 };
26939
26940 static unsigned _BUTTON_SIGNALS[3] = { 0 };
26941
26942 /* ---- Introspection data for org.openbmc.Button ---- */
26943
26944 static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
26945 {
26946 {
26947 -1,
26948 (gchar *) "state",
26949 (gchar *) "b",
26950 NULL
26951 },
26952 FALSE
26953 };
26954
26955 static const GDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
26956 {
26957 &_button_method_info_is_on_OUT_ARG_state.parent_struct,
26958 NULL
26959 };
26960
26961 static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
26962 {
26963 {
26964 -1,
26965 (gchar *) "isOn",
26966 NULL,
26967 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
26968 NULL
26969 },
26970 "handle-is-on",
26971 FALSE
26972 };
26973
26974 static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
26975 {
26976 {
26977 -1,
26978 (gchar *) "simPress",
26979 NULL,
26980 NULL,
26981 NULL
26982 },
26983 "handle-sim-press",
26984 FALSE
26985 };
26986
26987 static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
26988 {
26989 {
26990 -1,
26991 (gchar *) "simLongPress",
26992 NULL,
26993 NULL,
26994 NULL
26995 },
26996 "handle-sim-long-press",
26997 FALSE
26998 };
26999
27000 static const GDBusMethodInfo * const _button_method_info_pointers[] =
27001 {
27002 &_button_method_info_is_on.parent_struct,
27003 &_button_method_info_sim_press.parent_struct,
27004 &_button_method_info_sim_long_press.parent_struct,
27005 NULL
27006 };
27007
27008 static const _ExtendedGDBusSignalInfo _button_signal_info_released =
27009 {
27010 {
27011 -1,
27012 (gchar *) "Released",
27013 NULL,
27014 NULL
27015 },
27016 "released"
27017 };
27018
27019 static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
27020 {
27021 {
27022 -1,
27023 (gchar *) "Pressed",
27024 NULL,
27025 NULL
27026 },
27027 "pressed"
27028 };
27029
27030 static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
27031 {
27032 {
27033 -1,
27034 (gchar *) "PressedLong",
27035 NULL,
27036 NULL
27037 },
27038 "pressed-long"
27039 };
27040
27041 static const GDBusSignalInfo * const _button_signal_info_pointers[] =
27042 {
27043 &_button_signal_info_released.parent_struct,
27044 &_button_signal_info_pressed.parent_struct,
27045 &_button_signal_info_pressed_long.parent_struct,
27046 NULL
27047 };
27048
27049 static const _ExtendedGDBusPropertyInfo _button_property_info_state =
27050 {
27051 {
27052 -1,
27053 (gchar *) "state",
27054 (gchar *) "b",
27055 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27056 NULL
27057 },
27058 "state",
27059 FALSE,
27060 TRUE
27061 };
27062
27063 static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
27064 {
27065 {
27066 -1,
27067 (gchar *) "timer",
27068 (gchar *) "t",
27069 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27070 NULL
27071 },
27072 "timer",
27073 FALSE,
27074 TRUE
27075 };
27076
27077 static const GDBusPropertyInfo * const _button_property_info_pointers[] =
27078 {
27079 &_button_property_info_state.parent_struct,
27080 &_button_property_info_timer.parent_struct,
27081 NULL
27082 };
27083
27084 static const _ExtendedGDBusInterfaceInfo _button_interface_info =
27085 {
27086 {
27087 -1,
27088 (gchar *) "org.openbmc.Button",
27089 (GDBusMethodInfo **) &_button_method_info_pointers,
27090 (GDBusSignalInfo **) &_button_signal_info_pointers,
27091 (GDBusPropertyInfo **) &_button_property_info_pointers,
27092 NULL
27093 },
27094 "button",
27095 };
27096
27097
27098 /**
27099 * button_interface_info:
27100 *
27101 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
27102 *
27103 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27104 */
27105 GDBusInterfaceInfo *
button_interface_info(void)27106 button_interface_info (void)
27107 {
27108 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
27109 }
27110
27111 /**
27112 * button_override_properties:
27113 * @klass: The class structure for a #GObject derived class.
27114 * @property_id_begin: The property id to assign to the first overridden property.
27115 *
27116 * Overrides all #GObject properties in the #Button interface for a concrete class.
27117 * The properties are overridden in the order they are defined.
27118 *
27119 * Returns: The last property id.
27120 */
27121 guint
button_override_properties(GObjectClass * klass,guint property_id_begin)27122 button_override_properties (GObjectClass *klass, guint property_id_begin)
27123 {
27124 g_object_class_override_property (klass, property_id_begin++, "state");
27125 g_object_class_override_property (klass, property_id_begin++, "timer");
27126 return property_id_begin - 1;
27127 }
27128
27129
27130 inline static void
button_signal_marshal_released(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27131 button_signal_marshal_released (
27132 GClosure *closure,
27133 GValue *return_value,
27134 unsigned int n_param_values,
27135 const GValue *param_values,
27136 void *invocation_hint,
27137 void *marshal_data)
27138 {
27139 g_cclosure_marshal_VOID__VOID (closure,
27140 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27141 }
27142
27143 inline static void
button_signal_marshal_pressed(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27144 button_signal_marshal_pressed (
27145 GClosure *closure,
27146 GValue *return_value,
27147 unsigned int n_param_values,
27148 const GValue *param_values,
27149 void *invocation_hint,
27150 void *marshal_data)
27151 {
27152 g_cclosure_marshal_VOID__VOID (closure,
27153 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27154 }
27155
27156 inline static void
button_signal_marshal_pressed_long(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27157 button_signal_marshal_pressed_long (
27158 GClosure *closure,
27159 GValue *return_value,
27160 unsigned int n_param_values,
27161 const GValue *param_values,
27162 void *invocation_hint,
27163 void *marshal_data)
27164 {
27165 g_cclosure_marshal_VOID__VOID (closure,
27166 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27167 }
27168
27169 inline static void
button_method_marshal_is_on(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27170 button_method_marshal_is_on (
27171 GClosure *closure,
27172 GValue *return_value,
27173 unsigned int n_param_values,
27174 const GValue *param_values,
27175 void *invocation_hint,
27176 void *marshal_data)
27177 {
27178 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
27179 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27180 }
27181
27182 inline static void
button_method_marshal_sim_press(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27183 button_method_marshal_sim_press (
27184 GClosure *closure,
27185 GValue *return_value,
27186 unsigned int n_param_values,
27187 const GValue *param_values,
27188 void *invocation_hint,
27189 void *marshal_data)
27190 {
27191 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
27192 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27193 }
27194
27195 inline static void
button_method_marshal_sim_long_press(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)27196 button_method_marshal_sim_long_press (
27197 GClosure *closure,
27198 GValue *return_value,
27199 unsigned int n_param_values,
27200 const GValue *param_values,
27201 void *invocation_hint,
27202 void *marshal_data)
27203 {
27204 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
27205 return_value, n_param_values, param_values, invocation_hint, marshal_data);
27206 }
27207
27208
27209 /**
27210 * Button:
27211 *
27212 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27213 */
27214
27215 /**
27216 * ButtonIface:
27217 * @parent_iface: The parent interface.
27218 * @handle_is_on: Handler for the #Button::handle-is-on signal.
27219 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
27220 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
27221 * @get_state: Getter for the #Button:state property.
27222 * @get_timer: Getter for the #Button:timer property.
27223 * @pressed: Handler for the #Button::pressed signal.
27224 * @pressed_long: Handler for the #Button::pressed-long signal.
27225 * @released: Handler for the #Button::released signal.
27226 *
27227 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27228 */
27229
27230 typedef ButtonIface ButtonInterface;
G_DEFINE_INTERFACE(Button,button,G_TYPE_OBJECT)27231 G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT)
27232
27233 static void
27234 button_default_init (ButtonIface *iface)
27235 {
27236 /* GObject signals for incoming D-Bus method calls: */
27237 /**
27238 * Button::handle-is-on:
27239 * @object: A #Button.
27240 * @invocation: A #GDBusMethodInvocation.
27241 *
27242 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
27243 *
27244 * 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 button_complete_is_on() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27245 *
27246 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
27247 */
27248 g_signal_new ("handle-is-on",
27249 G_TYPE_FROM_INTERFACE (iface),
27250 G_SIGNAL_RUN_LAST,
27251 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
27252 g_signal_accumulator_true_handled,
27253 NULL,
27254 button_method_marshal_is_on,
27255 G_TYPE_BOOLEAN,
27256 1,
27257 G_TYPE_DBUS_METHOD_INVOCATION);
27258
27259 /**
27260 * Button::handle-sim-press:
27261 * @object: A #Button.
27262 * @invocation: A #GDBusMethodInvocation.
27263 *
27264 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method.
27265 *
27266 * 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 button_complete_sim_press() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27267 *
27268 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
27269 */
27270 g_signal_new ("handle-sim-press",
27271 G_TYPE_FROM_INTERFACE (iface),
27272 G_SIGNAL_RUN_LAST,
27273 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
27274 g_signal_accumulator_true_handled,
27275 NULL,
27276 button_method_marshal_sim_press,
27277 G_TYPE_BOOLEAN,
27278 1,
27279 G_TYPE_DBUS_METHOD_INVOCATION);
27280
27281 /**
27282 * Button::handle-sim-long-press:
27283 * @object: A #Button.
27284 * @invocation: A #GDBusMethodInvocation.
27285 *
27286 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method.
27287 *
27288 * 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 button_complete_sim_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27289 *
27290 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
27291 */
27292 g_signal_new ("handle-sim-long-press",
27293 G_TYPE_FROM_INTERFACE (iface),
27294 G_SIGNAL_RUN_LAST,
27295 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
27296 g_signal_accumulator_true_handled,
27297 NULL,
27298 button_method_marshal_sim_long_press,
27299 G_TYPE_BOOLEAN,
27300 1,
27301 G_TYPE_DBUS_METHOD_INVOCATION);
27302
27303 /* GObject signals for received D-Bus signals: */
27304 /**
27305 * Button::released:
27306 * @object: A #Button.
27307 *
27308 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> is received.
27309 *
27310 * 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.
27311 */
27312 _BUTTON_SIGNALS[_BUTTON_RELEASED] =
27313 g_signal_new ("released",
27314 G_TYPE_FROM_INTERFACE (iface),
27315 G_SIGNAL_RUN_LAST,
27316 G_STRUCT_OFFSET (ButtonIface, released),
27317 NULL,
27318 NULL,
27319 button_signal_marshal_released,
27320 G_TYPE_NONE,
27321 0);
27322
27323 /**
27324 * Button::pressed:
27325 * @object: A #Button.
27326 *
27327 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> is received.
27328 *
27329 * 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.
27330 */
27331 _BUTTON_SIGNALS[_BUTTON_PRESSED] =
27332 g_signal_new ("pressed",
27333 G_TYPE_FROM_INTERFACE (iface),
27334 G_SIGNAL_RUN_LAST,
27335 G_STRUCT_OFFSET (ButtonIface, pressed),
27336 NULL,
27337 NULL,
27338 button_signal_marshal_pressed,
27339 G_TYPE_NONE,
27340 0);
27341
27342 /**
27343 * Button::pressed-long:
27344 * @object: A #Button.
27345 *
27346 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> is received.
27347 *
27348 * 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.
27349 */
27350 _BUTTON_SIGNALS[_BUTTON_PRESSED_LONG] =
27351 g_signal_new ("pressed-long",
27352 G_TYPE_FROM_INTERFACE (iface),
27353 G_SIGNAL_RUN_LAST,
27354 G_STRUCT_OFFSET (ButtonIface, pressed_long),
27355 NULL,
27356 NULL,
27357 button_signal_marshal_pressed_long,
27358 G_TYPE_NONE,
27359 0);
27360
27361 /* GObject properties for D-Bus properties: */
27362 /**
27363 * Button:state:
27364 *
27365 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
27366 *
27367 * 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.
27368 */
27369 g_object_interface_install_property (iface,
27370 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27371 /**
27372 * Button:timer:
27373 *
27374 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
27375 *
27376 * 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.
27377 */
27378 g_object_interface_install_property (iface,
27379 g_param_spec_uint64 ("timer", "timer", "timer", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27380 }
27381
27382 /**
27383 * button_get_state: (skip)
27384 * @object: A #Button.
27385 *
27386 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
27387 *
27388 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27389 *
27390 * Returns: The property value.
27391 */
27392 gboolean
button_get_state(Button * object)27393 button_get_state (Button *object)
27394 {
27395 g_return_val_if_fail (IS_BUTTON (object), FALSE);
27396
27397 return BUTTON_GET_IFACE (object)->get_state (object);
27398 }
27399
27400 /**
27401 * button_set_state: (skip)
27402 * @object: A #Button.
27403 * @value: The value to set.
27404 *
27405 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
27406 *
27407 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27408 */
27409 void
button_set_state(Button * object,gboolean value)27410 button_set_state (Button *object, gboolean value)
27411 {
27412 g_object_set (G_OBJECT (object), "state", value, NULL);
27413 }
27414
27415 /**
27416 * button_get_timer: (skip)
27417 * @object: A #Button.
27418 *
27419 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
27420 *
27421 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27422 *
27423 * Returns: The property value.
27424 */
27425 guint64
button_get_timer(Button * object)27426 button_get_timer (Button *object)
27427 {
27428 g_return_val_if_fail (IS_BUTTON (object), 0);
27429
27430 return BUTTON_GET_IFACE (object)->get_timer (object);
27431 }
27432
27433 /**
27434 * button_set_timer: (skip)
27435 * @object: A #Button.
27436 * @value: The value to set.
27437 *
27438 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
27439 *
27440 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27441 */
27442 void
button_set_timer(Button * object,guint64 value)27443 button_set_timer (Button *object, guint64 value)
27444 {
27445 g_object_set (G_OBJECT (object), "timer", value, NULL);
27446 }
27447
27448 /**
27449 * button_emit_released:
27450 * @object: A #Button.
27451 *
27452 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
27453 */
27454 void
button_emit_released(Button * object)27455 button_emit_released (
27456 Button *object)
27457 {
27458 g_signal_emit (object, _BUTTON_SIGNALS[_BUTTON_RELEASED], 0);
27459 }
27460
27461 /**
27462 * button_emit_pressed:
27463 * @object: A #Button.
27464 *
27465 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
27466 */
27467 void
button_emit_pressed(Button * object)27468 button_emit_pressed (
27469 Button *object)
27470 {
27471 g_signal_emit (object, _BUTTON_SIGNALS[_BUTTON_PRESSED], 0);
27472 }
27473
27474 /**
27475 * button_emit_pressed_long:
27476 * @object: A #Button.
27477 *
27478 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
27479 */
27480 void
button_emit_pressed_long(Button * object)27481 button_emit_pressed_long (
27482 Button *object)
27483 {
27484 g_signal_emit (object, _BUTTON_SIGNALS[_BUTTON_PRESSED_LONG], 0);
27485 }
27486
27487 /**
27488 * button_call_is_on:
27489 * @proxy: A #ButtonProxy.
27490 * @cancellable: (nullable): A #GCancellable or %NULL.
27491 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27492 * @user_data: User data to pass to @callback.
27493 *
27494 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
27495 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
27496 * You can then call button_call_is_on_finish() to get the result of the operation.
27497 *
27498 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
27499 */
27500 void
button_call_is_on(Button * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)27501 button_call_is_on (
27502 Button *proxy,
27503 GCancellable *cancellable,
27504 GAsyncReadyCallback callback,
27505 gpointer user_data)
27506 {
27507 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27508 "isOn",
27509 g_variant_new ("()"),
27510 G_DBUS_CALL_FLAGS_NONE,
27511 -1,
27512 cancellable,
27513 callback,
27514 user_data);
27515 }
27516
27517 /**
27518 * button_call_is_on_finish:
27519 * @proxy: A #ButtonProxy.
27520 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
27521 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
27522 * @error: Return location for error or %NULL.
27523 *
27524 * Finishes an operation started with button_call_is_on().
27525 *
27526 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27527 */
27528 gboolean
button_call_is_on_finish(Button * proxy,gboolean * out_state,GAsyncResult * res,GError ** error)27529 button_call_is_on_finish (
27530 Button *proxy,
27531 gboolean *out_state,
27532 GAsyncResult *res,
27533 GError **error)
27534 {
27535 GVariant *_ret;
27536 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27537 if (_ret == NULL)
27538 goto _out;
27539 g_variant_get (_ret,
27540 "(b)",
27541 out_state);
27542 g_variant_unref (_ret);
27543 _out:
27544 return _ret != NULL;
27545 }
27546
27547 /**
27548 * button_call_is_on_sync:
27549 * @proxy: A #ButtonProxy.
27550 * @out_state: (out) (optional): Return location for return parameter or %NULL to ignore.
27551 * @cancellable: (nullable): A #GCancellable or %NULL.
27552 * @error: Return location for error or %NULL.
27553 *
27554 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27555 *
27556 * See button_call_is_on() for the asynchronous version of this method.
27557 *
27558 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27559 */
27560 gboolean
button_call_is_on_sync(Button * proxy,gboolean * out_state,GCancellable * cancellable,GError ** error)27561 button_call_is_on_sync (
27562 Button *proxy,
27563 gboolean *out_state,
27564 GCancellable *cancellable,
27565 GError **error)
27566 {
27567 GVariant *_ret;
27568 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27569 "isOn",
27570 g_variant_new ("()"),
27571 G_DBUS_CALL_FLAGS_NONE,
27572 -1,
27573 cancellable,
27574 error);
27575 if (_ret == NULL)
27576 goto _out;
27577 g_variant_get (_ret,
27578 "(b)",
27579 out_state);
27580 g_variant_unref (_ret);
27581 _out:
27582 return _ret != NULL;
27583 }
27584
27585 /**
27586 * button_call_sim_press:
27587 * @proxy: A #ButtonProxy.
27588 * @cancellable: (nullable): A #GCancellable or %NULL.
27589 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27590 * @user_data: User data to pass to @callback.
27591 *
27592 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy.
27593 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
27594 * You can then call button_call_sim_press_finish() to get the result of the operation.
27595 *
27596 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
27597 */
27598 void
button_call_sim_press(Button * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)27599 button_call_sim_press (
27600 Button *proxy,
27601 GCancellable *cancellable,
27602 GAsyncReadyCallback callback,
27603 gpointer user_data)
27604 {
27605 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27606 "simPress",
27607 g_variant_new ("()"),
27608 G_DBUS_CALL_FLAGS_NONE,
27609 -1,
27610 cancellable,
27611 callback,
27612 user_data);
27613 }
27614
27615 /**
27616 * button_call_sim_press_finish:
27617 * @proxy: A #ButtonProxy.
27618 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
27619 * @error: Return location for error or %NULL.
27620 *
27621 * Finishes an operation started with button_call_sim_press().
27622 *
27623 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27624 */
27625 gboolean
button_call_sim_press_finish(Button * proxy,GAsyncResult * res,GError ** error)27626 button_call_sim_press_finish (
27627 Button *proxy,
27628 GAsyncResult *res,
27629 GError **error)
27630 {
27631 GVariant *_ret;
27632 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27633 if (_ret == NULL)
27634 goto _out;
27635 g_variant_get (_ret,
27636 "()");
27637 g_variant_unref (_ret);
27638 _out:
27639 return _ret != NULL;
27640 }
27641
27642 /**
27643 * button_call_sim_press_sync:
27644 * @proxy: A #ButtonProxy.
27645 * @cancellable: (nullable): A #GCancellable or %NULL.
27646 * @error: Return location for error or %NULL.
27647 *
27648 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27649 *
27650 * See button_call_sim_press() for the asynchronous version of this method.
27651 *
27652 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27653 */
27654 gboolean
button_call_sim_press_sync(Button * proxy,GCancellable * cancellable,GError ** error)27655 button_call_sim_press_sync (
27656 Button *proxy,
27657 GCancellable *cancellable,
27658 GError **error)
27659 {
27660 GVariant *_ret;
27661 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27662 "simPress",
27663 g_variant_new ("()"),
27664 G_DBUS_CALL_FLAGS_NONE,
27665 -1,
27666 cancellable,
27667 error);
27668 if (_ret == NULL)
27669 goto _out;
27670 g_variant_get (_ret,
27671 "()");
27672 g_variant_unref (_ret);
27673 _out:
27674 return _ret != NULL;
27675 }
27676
27677 /**
27678 * button_call_sim_long_press:
27679 * @proxy: A #ButtonProxy.
27680 * @cancellable: (nullable): A #GCancellable or %NULL.
27681 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27682 * @user_data: User data to pass to @callback.
27683 *
27684 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy.
27685 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
27686 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
27687 *
27688 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
27689 */
27690 void
button_call_sim_long_press(Button * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)27691 button_call_sim_long_press (
27692 Button *proxy,
27693 GCancellable *cancellable,
27694 GAsyncReadyCallback callback,
27695 gpointer user_data)
27696 {
27697 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27698 "simLongPress",
27699 g_variant_new ("()"),
27700 G_DBUS_CALL_FLAGS_NONE,
27701 -1,
27702 cancellable,
27703 callback,
27704 user_data);
27705 }
27706
27707 /**
27708 * button_call_sim_long_press_finish:
27709 * @proxy: A #ButtonProxy.
27710 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
27711 * @error: Return location for error or %NULL.
27712 *
27713 * Finishes an operation started with button_call_sim_long_press().
27714 *
27715 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27716 */
27717 gboolean
button_call_sim_long_press_finish(Button * proxy,GAsyncResult * res,GError ** error)27718 button_call_sim_long_press_finish (
27719 Button *proxy,
27720 GAsyncResult *res,
27721 GError **error)
27722 {
27723 GVariant *_ret;
27724 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27725 if (_ret == NULL)
27726 goto _out;
27727 g_variant_get (_ret,
27728 "()");
27729 g_variant_unref (_ret);
27730 _out:
27731 return _ret != NULL;
27732 }
27733
27734 /**
27735 * button_call_sim_long_press_sync:
27736 * @proxy: A #ButtonProxy.
27737 * @cancellable: (nullable): A #GCancellable or %NULL.
27738 * @error: Return location for error or %NULL.
27739 *
27740 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27741 *
27742 * See button_call_sim_long_press() for the asynchronous version of this method.
27743 *
27744 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
27745 */
27746 gboolean
button_call_sim_long_press_sync(Button * proxy,GCancellable * cancellable,GError ** error)27747 button_call_sim_long_press_sync (
27748 Button *proxy,
27749 GCancellable *cancellable,
27750 GError **error)
27751 {
27752 GVariant *_ret;
27753 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27754 "simLongPress",
27755 g_variant_new ("()"),
27756 G_DBUS_CALL_FLAGS_NONE,
27757 -1,
27758 cancellable,
27759 error);
27760 if (_ret == NULL)
27761 goto _out;
27762 g_variant_get (_ret,
27763 "()");
27764 g_variant_unref (_ret);
27765 _out:
27766 return _ret != NULL;
27767 }
27768
27769 /**
27770 * button_complete_is_on:
27771 * @object: A #Button.
27772 * @invocation: (transfer full): A #GDBusMethodInvocation.
27773 * @state: Parameter to return.
27774 *
27775 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</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.
27776 *
27777 * This method will free @invocation, you cannot use it afterwards.
27778 */
27779 void
button_complete_is_on(Button * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gboolean state)27780 button_complete_is_on (
27781 Button *object G_GNUC_UNUSED,
27782 GDBusMethodInvocation *invocation,
27783 gboolean state)
27784 {
27785 g_dbus_method_invocation_return_value (invocation,
27786 g_variant_new ("(b)",
27787 state));
27788 }
27789
27790 /**
27791 * button_complete_sim_press:
27792 * @object: A #Button.
27793 * @invocation: (transfer full): A #GDBusMethodInvocation.
27794 *
27795 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</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.
27796 *
27797 * This method will free @invocation, you cannot use it afterwards.
27798 */
27799 void
button_complete_sim_press(Button * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)27800 button_complete_sim_press (
27801 Button *object G_GNUC_UNUSED,
27802 GDBusMethodInvocation *invocation)
27803 {
27804 g_dbus_method_invocation_return_value (invocation,
27805 g_variant_new ("()"));
27806 }
27807
27808 /**
27809 * button_complete_sim_long_press:
27810 * @object: A #Button.
27811 * @invocation: (transfer full): A #GDBusMethodInvocation.
27812 *
27813 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</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.
27814 *
27815 * This method will free @invocation, you cannot use it afterwards.
27816 */
27817 void
button_complete_sim_long_press(Button * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)27818 button_complete_sim_long_press (
27819 Button *object G_GNUC_UNUSED,
27820 GDBusMethodInvocation *invocation)
27821 {
27822 g_dbus_method_invocation_return_value (invocation,
27823 g_variant_new ("()"));
27824 }
27825
27826 /* ------------------------------------------------------------------------ */
27827
27828 /**
27829 * ButtonProxy:
27830 *
27831 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
27832 */
27833
27834 /**
27835 * ButtonProxyClass:
27836 * @parent_class: The parent class.
27837 *
27838 * Class structure for #ButtonProxy.
27839 */
27840
27841 struct _ButtonProxyPrivate
27842 {
27843 GData *qdata;
27844 };
27845
27846 static void button_proxy_iface_init (ButtonIface *iface);
27847
27848 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ButtonProxy,button_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (ButtonProxy)G_IMPLEMENT_INTERFACE (TYPE_BUTTON,button_proxy_iface_init))27849 G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
27850 G_ADD_PRIVATE (ButtonProxy)
27851 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init))
27852
27853 #else
27854 G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
27855 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init))
27856
27857 #endif
27858 static void
27859 button_proxy_finalize (GObject *object)
27860 {
27861 ButtonProxy *proxy = BUTTON_PROXY (object);
27862 g_datalist_clear (&proxy->priv->qdata);
27863 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
27864 }
27865
27866 static void
button_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)27867 button_proxy_get_property (GObject *object,
27868 guint prop_id,
27869 GValue *value,
27870 GParamSpec *pspec G_GNUC_UNUSED)
27871 {
27872 const _ExtendedGDBusPropertyInfo *info;
27873 GVariant *variant;
27874 g_assert (prop_id != 0 && prop_id - 1 < 2);
27875 info = (const _ExtendedGDBusPropertyInfo *) _button_property_info_pointers[prop_id - 1];
27876 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
27877 if (info->use_gvariant)
27878 {
27879 g_value_set_variant (value, variant);
27880 }
27881 else
27882 {
27883 if (variant != NULL)
27884 g_dbus_gvariant_to_gvalue (variant, value);
27885 }
27886 if (variant != NULL)
27887 g_variant_unref (variant);
27888 }
27889
27890 static void
button_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)27891 button_proxy_set_property_cb (GDBusProxy *proxy,
27892 GAsyncResult *res,
27893 gpointer user_data)
27894 {
27895 const _ExtendedGDBusPropertyInfo *info = user_data;
27896 GError *error;
27897 GVariant *_ret;
27898 error = NULL;
27899 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
27900 if (!_ret)
27901 {
27902 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
27903 info->parent_struct.name,
27904 error->message, g_quark_to_string (error->domain), error->code);
27905 g_error_free (error);
27906 }
27907 else
27908 {
27909 g_variant_unref (_ret);
27910 }
27911 }
27912
27913 static void
button_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)27914 button_proxy_set_property (GObject *object,
27915 guint prop_id,
27916 const GValue *value,
27917 GParamSpec *pspec G_GNUC_UNUSED)
27918 {
27919 const _ExtendedGDBusPropertyInfo *info;
27920 GVariant *variant;
27921 g_assert (prop_id != 0 && prop_id - 1 < 2);
27922 info = (const _ExtendedGDBusPropertyInfo *) _button_property_info_pointers[prop_id - 1];
27923 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
27924 g_dbus_proxy_call (G_DBUS_PROXY (object),
27925 "org.freedesktop.DBus.Properties.Set",
27926 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
27927 G_DBUS_CALL_FLAGS_NONE,
27928 -1,
27929 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
27930 g_variant_unref (variant);
27931 }
27932
27933 static void
button_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)27934 button_proxy_g_signal (GDBusProxy *proxy,
27935 const gchar *sender_name G_GNUC_UNUSED,
27936 const gchar *signal_name,
27937 GVariant *parameters)
27938 {
27939 _ExtendedGDBusSignalInfo *info;
27940 GVariantIter iter;
27941 GVariant *child;
27942 GValue *paramv;
27943 gsize num_params;
27944 gsize n;
27945 guint signal_id;
27946 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
27947 if (info == NULL)
27948 return;
27949 num_params = g_variant_n_children (parameters);
27950 paramv = g_new0 (GValue, num_params + 1);
27951 g_value_init (¶mv[0], TYPE_BUTTON);
27952 g_value_set_object (¶mv[0], proxy);
27953 g_variant_iter_init (&iter, parameters);
27954 n = 1;
27955 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27956 {
27957 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
27958 if (arg_info->use_gvariant)
27959 {
27960 g_value_init (¶mv[n], G_TYPE_VARIANT);
27961 g_value_set_variant (¶mv[n], child);
27962 n++;
27963 }
27964 else
27965 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
27966 g_variant_unref (child);
27967 }
27968 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
27969 g_signal_emitv (paramv, signal_id, 0, NULL);
27970 for (n = 0; n < num_params + 1; n++)
27971 g_value_unset (¶mv[n]);
27972 g_free (paramv);
27973 }
27974
27975 static void
button_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)27976 button_proxy_g_properties_changed (GDBusProxy *_proxy,
27977 GVariant *changed_properties,
27978 const gchar *const *invalidated_properties)
27979 {
27980 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
27981 guint n;
27982 const gchar *key;
27983 GVariantIter *iter;
27984 _ExtendedGDBusPropertyInfo *info;
27985 g_variant_get (changed_properties, "a{sv}", &iter);
27986 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
27987 {
27988 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
27989 g_datalist_remove_data (&proxy->priv->qdata, key);
27990 if (info != NULL)
27991 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27992 }
27993 g_variant_iter_free (iter);
27994 for (n = 0; invalidated_properties[n] != NULL; n++)
27995 {
27996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
27997 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
27998 if (info != NULL)
27999 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28000 }
28001 }
28002
28003 static gboolean
button_proxy_get_state(Button * object)28004 button_proxy_get_state (Button *object)
28005 {
28006 ButtonProxy *proxy = BUTTON_PROXY (object);
28007 GVariant *variant;
28008 gboolean value = FALSE;
28009 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
28010 if (variant != NULL)
28011 {
28012 value = g_variant_get_boolean (variant);
28013 g_variant_unref (variant);
28014 }
28015 return value;
28016 }
28017
28018 static guint64
button_proxy_get_timer(Button * object)28019 button_proxy_get_timer (Button *object)
28020 {
28021 ButtonProxy *proxy = BUTTON_PROXY (object);
28022 GVariant *variant;
28023 guint64 value = 0;
28024 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
28025 if (variant != NULL)
28026 {
28027 value = g_variant_get_uint64 (variant);
28028 g_variant_unref (variant);
28029 }
28030 return value;
28031 }
28032
28033 static void
button_proxy_init(ButtonProxy * proxy)28034 button_proxy_init (ButtonProxy *proxy)
28035 {
28036 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28037 proxy->priv = button_proxy_get_instance_private (proxy);
28038 #else
28039 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
28040 #endif
28041
28042 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
28043 }
28044
28045 static void
button_proxy_class_init(ButtonProxyClass * klass)28046 button_proxy_class_init (ButtonProxyClass *klass)
28047 {
28048 GObjectClass *gobject_class;
28049 GDBusProxyClass *proxy_class;
28050
28051 gobject_class = G_OBJECT_CLASS (klass);
28052 gobject_class->finalize = button_proxy_finalize;
28053 gobject_class->get_property = button_proxy_get_property;
28054 gobject_class->set_property = button_proxy_set_property;
28055
28056 proxy_class = G_DBUS_PROXY_CLASS (klass);
28057 proxy_class->g_signal = button_proxy_g_signal;
28058 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
28059
28060 button_override_properties (gobject_class, 1);
28061
28062 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28063 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
28064 #endif
28065 }
28066
28067 static void
button_proxy_iface_init(ButtonIface * iface)28068 button_proxy_iface_init (ButtonIface *iface)
28069 {
28070 iface->get_state = button_proxy_get_state;
28071 iface->get_timer = button_proxy_get_timer;
28072 }
28073
28074 /**
28075 * button_proxy_new:
28076 * @connection: A #GDBusConnection.
28077 * @flags: Flags from the #GDBusProxyFlags enumeration.
28078 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28079 * @object_path: An object path.
28080 * @cancellable: (nullable): A #GCancellable or %NULL.
28081 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28082 * @user_data: User data to pass to @callback.
28083 *
28084 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new() for more details.
28085 *
28086 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
28087 * You can then call button_proxy_new_finish() to get the result of the operation.
28088 *
28089 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
28090 */
28091 void
button_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)28092 button_proxy_new (
28093 GDBusConnection *connection,
28094 GDBusProxyFlags flags,
28095 const gchar *name,
28096 const gchar *object_path,
28097 GCancellable *cancellable,
28098 GAsyncReadyCallback callback,
28099 gpointer user_data)
28100 {
28101 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
28102 }
28103
28104 /**
28105 * button_proxy_new_finish:
28106 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
28107 * @error: Return location for error or %NULL
28108 *
28109 * Finishes an operation started with button_proxy_new().
28110 *
28111 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
28112 */
28113 Button *
button_proxy_new_finish(GAsyncResult * res,GError ** error)28114 button_proxy_new_finish (
28115 GAsyncResult *res,
28116 GError **error)
28117 {
28118 GObject *ret;
28119 GObject *source_object;
28120 source_object = g_async_result_get_source_object (res);
28121 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28122 g_object_unref (source_object);
28123 if (ret != NULL)
28124 return BUTTON (ret);
28125 else
28126 return NULL;
28127 }
28128
28129 /**
28130 * button_proxy_new_sync:
28131 * @connection: A #GDBusConnection.
28132 * @flags: Flags from the #GDBusProxyFlags enumeration.
28133 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28134 * @object_path: An object path.
28135 * @cancellable: (nullable): A #GCancellable or %NULL.
28136 * @error: Return location for error or %NULL
28137 *
28138 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new_sync() for more details.
28139 *
28140 * The calling thread is blocked until a reply is received.
28141 *
28142 * See button_proxy_new() for the asynchronous version of this constructor.
28143 *
28144 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
28145 */
28146 Button *
button_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)28147 button_proxy_new_sync (
28148 GDBusConnection *connection,
28149 GDBusProxyFlags flags,
28150 const gchar *name,
28151 const gchar *object_path,
28152 GCancellable *cancellable,
28153 GError **error)
28154 {
28155 GInitable *ret;
28156 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
28157 if (ret != NULL)
28158 return BUTTON (ret);
28159 else
28160 return NULL;
28161 }
28162
28163
28164 /**
28165 * button_proxy_new_for_bus:
28166 * @bus_type: A #GBusType.
28167 * @flags: Flags from the #GDBusProxyFlags enumeration.
28168 * @name: A bus name (well-known or unique).
28169 * @object_path: An object path.
28170 * @cancellable: (nullable): A #GCancellable or %NULL.
28171 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28172 * @user_data: User data to pass to @callback.
28173 *
28174 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28175 *
28176 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
28177 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
28178 *
28179 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28180 */
28181 void
button_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)28182 button_proxy_new_for_bus (
28183 GBusType bus_type,
28184 GDBusProxyFlags flags,
28185 const gchar *name,
28186 const gchar *object_path,
28187 GCancellable *cancellable,
28188 GAsyncReadyCallback callback,
28189 gpointer user_data)
28190 {
28191 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
28192 }
28193
28194 /**
28195 * button_proxy_new_for_bus_finish:
28196 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
28197 * @error: Return location for error or %NULL
28198 *
28199 * Finishes an operation started with button_proxy_new_for_bus().
28200 *
28201 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
28202 */
28203 Button *
button_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)28204 button_proxy_new_for_bus_finish (
28205 GAsyncResult *res,
28206 GError **error)
28207 {
28208 GObject *ret;
28209 GObject *source_object;
28210 source_object = g_async_result_get_source_object (res);
28211 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28212 g_object_unref (source_object);
28213 if (ret != NULL)
28214 return BUTTON (ret);
28215 else
28216 return NULL;
28217 }
28218
28219 /**
28220 * button_proxy_new_for_bus_sync:
28221 * @bus_type: A #GBusType.
28222 * @flags: Flags from the #GDBusProxyFlags enumeration.
28223 * @name: A bus name (well-known or unique).
28224 * @object_path: An object path.
28225 * @cancellable: (nullable): A #GCancellable or %NULL.
28226 * @error: Return location for error or %NULL
28227 *
28228 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28229 *
28230 * The calling thread is blocked until a reply is received.
28231 *
28232 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
28233 *
28234 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
28235 */
28236 Button *
button_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)28237 button_proxy_new_for_bus_sync (
28238 GBusType bus_type,
28239 GDBusProxyFlags flags,
28240 const gchar *name,
28241 const gchar *object_path,
28242 GCancellable *cancellable,
28243 GError **error)
28244 {
28245 GInitable *ret;
28246 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
28247 if (ret != NULL)
28248 return BUTTON (ret);
28249 else
28250 return NULL;
28251 }
28252
28253
28254 /* ------------------------------------------------------------------------ */
28255
28256 /**
28257 * ButtonSkeleton:
28258 *
28259 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
28260 */
28261
28262 /**
28263 * ButtonSkeletonClass:
28264 * @parent_class: The parent class.
28265 *
28266 * Class structure for #ButtonSkeleton.
28267 */
28268
28269 struct _ButtonSkeletonPrivate
28270 {
28271 GValue *properties;
28272 GList *changed_properties;
28273 GSource *changed_properties_idle_source;
28274 GMainContext *context;
28275 GMutex lock;
28276 };
28277
28278 static void
_button_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)28279 _button_skeleton_handle_method_call (
28280 GDBusConnection *connection G_GNUC_UNUSED,
28281 const gchar *sender G_GNUC_UNUSED,
28282 const gchar *object_path G_GNUC_UNUSED,
28283 const gchar *interface_name,
28284 const gchar *method_name,
28285 GVariant *parameters,
28286 GDBusMethodInvocation *invocation,
28287 gpointer user_data)
28288 {
28289 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
28290 _ExtendedGDBusMethodInfo *info;
28291 GVariantIter iter;
28292 GVariant *child;
28293 GValue *paramv;
28294 gsize num_params;
28295 guint num_extra;
28296 gsize n;
28297 guint signal_id;
28298 GValue return_value = G_VALUE_INIT;
28299 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28300 g_assert (info != NULL);
28301 num_params = g_variant_n_children (parameters);
28302 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28303 n = 0;
28304 g_value_init (¶mv[n], TYPE_BUTTON);
28305 g_value_set_object (¶mv[n++], skeleton);
28306 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28307 g_value_set_object (¶mv[n++], invocation);
28308 if (info->pass_fdlist)
28309 {
28310 #ifdef G_OS_UNIX
28311 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
28312 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28313 #else
28314 g_assert_not_reached ();
28315 #endif
28316 }
28317 g_variant_iter_init (&iter, parameters);
28318 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28319 {
28320 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28321 if (arg_info->use_gvariant)
28322 {
28323 g_value_init (¶mv[n], G_TYPE_VARIANT);
28324 g_value_set_variant (¶mv[n], child);
28325 n++;
28326 }
28327 else
28328 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
28329 g_variant_unref (child);
28330 }
28331 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
28332 g_value_init (&return_value, G_TYPE_BOOLEAN);
28333 g_signal_emitv (paramv, signal_id, 0, &return_value);
28334 if (!g_value_get_boolean (&return_value))
28335 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);
28336 g_value_unset (&return_value);
28337 for (n = 0; n < num_params + num_extra; n++)
28338 g_value_unset (¶mv[n]);
28339 g_free (paramv);
28340 }
28341
28342 static GVariant *
_button_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)28343 _button_skeleton_handle_get_property (
28344 GDBusConnection *connection G_GNUC_UNUSED,
28345 const gchar *sender G_GNUC_UNUSED,
28346 const gchar *object_path G_GNUC_UNUSED,
28347 const gchar *interface_name G_GNUC_UNUSED,
28348 const gchar *property_name,
28349 GError **error,
28350 gpointer user_data)
28351 {
28352 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
28353 GValue value = G_VALUE_INIT;
28354 GParamSpec *pspec;
28355 _ExtendedGDBusPropertyInfo *info;
28356 GVariant *ret;
28357 ret = NULL;
28358 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
28359 g_assert (info != NULL);
28360 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28361 if (pspec == NULL)
28362 {
28363 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28364 }
28365 else
28366 {
28367 g_value_init (&value, pspec->value_type);
28368 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28369 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28370 g_value_unset (&value);
28371 }
28372 return ret;
28373 }
28374
28375 static gboolean
_button_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)28376 _button_skeleton_handle_set_property (
28377 GDBusConnection *connection G_GNUC_UNUSED,
28378 const gchar *sender G_GNUC_UNUSED,
28379 const gchar *object_path G_GNUC_UNUSED,
28380 const gchar *interface_name G_GNUC_UNUSED,
28381 const gchar *property_name,
28382 GVariant *variant,
28383 GError **error,
28384 gpointer user_data)
28385 {
28386 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
28387 GValue value = G_VALUE_INIT;
28388 GParamSpec *pspec;
28389 _ExtendedGDBusPropertyInfo *info;
28390 gboolean ret;
28391 ret = FALSE;
28392 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
28393 g_assert (info != NULL);
28394 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28395 if (pspec == NULL)
28396 {
28397 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28398 }
28399 else
28400 {
28401 if (info->use_gvariant)
28402 g_value_set_variant (&value, variant);
28403 else
28404 g_dbus_gvariant_to_gvalue (variant, &value);
28405 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28406 g_value_unset (&value);
28407 ret = TRUE;
28408 }
28409 return ret;
28410 }
28411
28412 static const GDBusInterfaceVTable _button_skeleton_vtable =
28413 {
28414 _button_skeleton_handle_method_call,
28415 _button_skeleton_handle_get_property,
28416 _button_skeleton_handle_set_property,
28417 {NULL}
28418 };
28419
28420 static GDBusInterfaceInfo *
button_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)28421 button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28422 {
28423 return button_interface_info ();
28424 }
28425
28426 static GDBusInterfaceVTable *
button_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)28427 button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28428 {
28429 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
28430 }
28431
28432 static GVariant *
button_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)28433 button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28434 {
28435 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
28436
28437 GVariantBuilder builder;
28438 guint n;
28439 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28440 if (_button_interface_info.parent_struct.properties == NULL)
28441 goto out;
28442 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
28443 {
28444 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
28445 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28446 {
28447 GVariant *value;
28448 value = _button_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.Button", info->name, NULL, skeleton);
28449 if (value != NULL)
28450 {
28451 g_variant_take_ref (value);
28452 g_variant_builder_add (&builder, "{sv}", info->name, value);
28453 g_variant_unref (value);
28454 }
28455 }
28456 }
28457 out:
28458 return g_variant_builder_end (&builder);
28459 }
28460
28461 static gboolean _button_emit_changed (gpointer user_data);
28462
28463 static void
button_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)28464 button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28465 {
28466 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
28467 gboolean emit_changed = FALSE;
28468
28469 g_mutex_lock (&skeleton->priv->lock);
28470 if (skeleton->priv->changed_properties_idle_source != NULL)
28471 {
28472 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28473 skeleton->priv->changed_properties_idle_source = NULL;
28474 emit_changed = TRUE;
28475 }
28476 g_mutex_unlock (&skeleton->priv->lock);
28477
28478 if (emit_changed)
28479 _button_emit_changed (skeleton);
28480 }
28481
28482 static void
_button_on_signal_released(Button * object)28483 _button_on_signal_released (
28484 Button *object)
28485 {
28486 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28487
28488 GList *connections, *l;
28489 GVariant *signal_variant;
28490 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28491
28492 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
28493 for (l = connections; l != NULL; l = l->next)
28494 {
28495 GDBusConnection *connection = l->data;
28496 g_dbus_connection_emit_signal (connection,
28497 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
28498 signal_variant, NULL);
28499 }
28500 g_variant_unref (signal_variant);
28501 g_list_free_full (connections, g_object_unref);
28502 }
28503
28504 static void
_button_on_signal_pressed(Button * object)28505 _button_on_signal_pressed (
28506 Button *object)
28507 {
28508 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28509
28510 GList *connections, *l;
28511 GVariant *signal_variant;
28512 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28513
28514 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
28515 for (l = connections; l != NULL; l = l->next)
28516 {
28517 GDBusConnection *connection = l->data;
28518 g_dbus_connection_emit_signal (connection,
28519 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
28520 signal_variant, NULL);
28521 }
28522 g_variant_unref (signal_variant);
28523 g_list_free_full (connections, g_object_unref);
28524 }
28525
28526 static void
_button_on_signal_pressed_long(Button * object)28527 _button_on_signal_pressed_long (
28528 Button *object)
28529 {
28530 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28531
28532 GList *connections, *l;
28533 GVariant *signal_variant;
28534 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28535
28536 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
28537 for (l = connections; l != NULL; l = l->next)
28538 {
28539 GDBusConnection *connection = l->data;
28540 g_dbus_connection_emit_signal (connection,
28541 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
28542 signal_variant, NULL);
28543 }
28544 g_variant_unref (signal_variant);
28545 g_list_free_full (connections, g_object_unref);
28546 }
28547
28548 static void button_skeleton_iface_init (ButtonIface *iface);
28549 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(ButtonSkeleton,button_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (ButtonSkeleton)G_IMPLEMENT_INTERFACE (TYPE_BUTTON,button_skeleton_iface_init))28550 G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28551 G_ADD_PRIVATE (ButtonSkeleton)
28552 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init))
28553
28554 #else
28555 G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28556 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init))
28557
28558 #endif
28559 static void
28560 button_skeleton_finalize (GObject *object)
28561 {
28562 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28563 guint n;
28564 for (n = 0; n < 2; n++)
28565 g_value_unset (&skeleton->priv->properties[n]);
28566 g_free (skeleton->priv->properties);
28567 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28568 if (skeleton->priv->changed_properties_idle_source != NULL)
28569 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28570 g_main_context_unref (skeleton->priv->context);
28571 g_mutex_clear (&skeleton->priv->lock);
28572 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
28573 }
28574
28575 static void
button_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)28576 button_skeleton_get_property (GObject *object,
28577 guint prop_id,
28578 GValue *value,
28579 GParamSpec *pspec G_GNUC_UNUSED)
28580 {
28581 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28582 g_assert (prop_id != 0 && prop_id - 1 < 2);
28583 g_mutex_lock (&skeleton->priv->lock);
28584 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
28585 g_mutex_unlock (&skeleton->priv->lock);
28586 }
28587
28588 static gboolean
_button_emit_changed(gpointer user_data)28589 _button_emit_changed (gpointer user_data)
28590 {
28591 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
28592 GList *l;
28593 GVariantBuilder builder;
28594 GVariantBuilder invalidated_builder;
28595 guint num_changes;
28596
28597 g_mutex_lock (&skeleton->priv->lock);
28598 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28599 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
28600 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
28601 {
28602 ChangedProperty *cp = l->data;
28603 GVariant *variant;
28604 const GValue *cur_value;
28605
28606 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
28607 if (!_g_value_equal (cur_value, &cp->orig_value))
28608 {
28609 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
28610 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
28611 g_variant_unref (variant);
28612 num_changes++;
28613 }
28614 }
28615 if (num_changes > 0)
28616 {
28617 GList *connections, *ll;
28618 GVariant *signal_variant;
28619 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
28620 &builder, &invalidated_builder));
28621 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28622 for (ll = connections; ll != NULL; ll = ll->next)
28623 {
28624 GDBusConnection *connection = ll->data;
28625
28626 g_dbus_connection_emit_signal (connection,
28627 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
28628 "org.freedesktop.DBus.Properties",
28629 "PropertiesChanged",
28630 signal_variant,
28631 NULL);
28632 }
28633 g_variant_unref (signal_variant);
28634 g_list_free_full (connections, g_object_unref);
28635 }
28636 else
28637 {
28638 g_variant_builder_clear (&builder);
28639 g_variant_builder_clear (&invalidated_builder);
28640 }
28641 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28642 skeleton->priv->changed_properties = NULL;
28643 skeleton->priv->changed_properties_idle_source = NULL;
28644 g_mutex_unlock (&skeleton->priv->lock);
28645 return FALSE;
28646 }
28647
28648 static void
_button_schedule_emit_changed(ButtonSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)28649 _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
28650 {
28651 ChangedProperty *cp;
28652 GList *l;
28653 cp = NULL;
28654 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
28655 {
28656 ChangedProperty *i_cp = l->data;
28657 if (i_cp->info == info)
28658 {
28659 cp = i_cp;
28660 break;
28661 }
28662 }
28663 if (cp == NULL)
28664 {
28665 cp = g_new0 (ChangedProperty, 1);
28666 cp->prop_id = prop_id;
28667 cp->info = info;
28668 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
28669 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
28670 g_value_copy (orig_value, &cp->orig_value);
28671 }
28672 }
28673
28674 static void
button_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)28675 button_skeleton_notify (GObject *object,
28676 GParamSpec *pspec G_GNUC_UNUSED)
28677 {
28678 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28679 g_mutex_lock (&skeleton->priv->lock);
28680 if (skeleton->priv->changed_properties != NULL &&
28681 skeleton->priv->changed_properties_idle_source == NULL)
28682 {
28683 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
28684 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
28685 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
28686 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed");
28687 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
28688 g_source_unref (skeleton->priv->changed_properties_idle_source);
28689 }
28690 g_mutex_unlock (&skeleton->priv->lock);
28691 }
28692
28693 static void
button_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)28694 button_skeleton_set_property (GObject *object,
28695 guint prop_id,
28696 const GValue *value,
28697 GParamSpec *pspec)
28698 {
28699 const _ExtendedGDBusPropertyInfo *info;
28700 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28701 g_assert (prop_id != 0 && prop_id - 1 < 2);
28702 info = (const _ExtendedGDBusPropertyInfo *) _button_property_info_pointers[prop_id - 1];
28703 g_mutex_lock (&skeleton->priv->lock);
28704 g_object_freeze_notify (object);
28705 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
28706 {
28707 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
28708 info->emits_changed_signal)
28709 _button_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
28710 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
28711 g_object_notify_by_pspec (object, pspec);
28712 }
28713 g_mutex_unlock (&skeleton->priv->lock);
28714 g_object_thaw_notify (object);
28715 }
28716
28717 static void
button_skeleton_init(ButtonSkeleton * skeleton)28718 button_skeleton_init (ButtonSkeleton *skeleton)
28719 {
28720 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28721 skeleton->priv = button_skeleton_get_instance_private (skeleton);
28722 #else
28723 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
28724 #endif
28725
28726 g_mutex_init (&skeleton->priv->lock);
28727 skeleton->priv->context = g_main_context_ref_thread_default ();
28728 skeleton->priv->properties = g_new0 (GValue, 2);
28729 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
28730 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
28731 }
28732
28733 static gboolean
button_skeleton_get_state(Button * object)28734 button_skeleton_get_state (Button *object)
28735 {
28736 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28737 gboolean value;
28738 g_mutex_lock (&skeleton->priv->lock);
28739 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[0]));
28740 g_mutex_unlock (&skeleton->priv->lock);
28741 return value;
28742 }
28743
28744 static guint64
button_skeleton_get_timer(Button * object)28745 button_skeleton_get_timer (Button *object)
28746 {
28747 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
28748 guint64 value;
28749 g_mutex_lock (&skeleton->priv->lock);
28750 value = g_marshal_value_peek_uint64 (&(skeleton->priv->properties[1]));
28751 g_mutex_unlock (&skeleton->priv->lock);
28752 return value;
28753 }
28754
28755 static void
button_skeleton_class_init(ButtonSkeletonClass * klass)28756 button_skeleton_class_init (ButtonSkeletonClass *klass)
28757 {
28758 GObjectClass *gobject_class;
28759 GDBusInterfaceSkeletonClass *skeleton_class;
28760
28761 gobject_class = G_OBJECT_CLASS (klass);
28762 gobject_class->finalize = button_skeleton_finalize;
28763 gobject_class->get_property = button_skeleton_get_property;
28764 gobject_class->set_property = button_skeleton_set_property;
28765 gobject_class->notify = button_skeleton_notify;
28766
28767
28768 button_override_properties (gobject_class, 1);
28769
28770 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
28771 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
28772 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
28773 skeleton_class->flush = button_skeleton_dbus_interface_flush;
28774 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
28775
28776 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28777 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
28778 #endif
28779 }
28780
28781 static void
button_skeleton_iface_init(ButtonIface * iface)28782 button_skeleton_iface_init (ButtonIface *iface)
28783 {
28784 iface->released = _button_on_signal_released;
28785 iface->pressed = _button_on_signal_pressed;
28786 iface->pressed_long = _button_on_signal_pressed_long;
28787 iface->get_state = button_skeleton_get_state;
28788 iface->get_timer = button_skeleton_get_timer;
28789 }
28790
28791 /**
28792 * button_skeleton_new:
28793 *
28794 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
28795 *
28796 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
28797 */
28798 Button *
button_skeleton_new(void)28799 button_skeleton_new (void)
28800 {
28801 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
28802 }
28803
28804 /* ------------------------------------------------------------------------
28805 * Code for interface org.openbmc.Led
28806 * ------------------------------------------------------------------------
28807 */
28808
28809 /**
28810 * SECTION:Led
28811 * @title: Led
28812 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
28813 *
28814 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface in C.
28815 */
28816
28817 /* ---- Introspection data for org.openbmc.Led ---- */
28818
28819 static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
28820 {
28821 {
28822 -1,
28823 (gchar *) "setOn",
28824 NULL,
28825 NULL,
28826 NULL
28827 },
28828 "handle-set-on",
28829 FALSE
28830 };
28831
28832 static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
28833 {
28834 {
28835 -1,
28836 (gchar *) "setOff",
28837 NULL,
28838 NULL,
28839 NULL
28840 },
28841 "handle-set-off",
28842 FALSE
28843 };
28844
28845 static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
28846 {
28847 {
28848 -1,
28849 (gchar *) "setBlinkSlow",
28850 NULL,
28851 NULL,
28852 NULL
28853 },
28854 "handle-set-blink-slow",
28855 FALSE
28856 };
28857
28858 static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
28859 {
28860 {
28861 -1,
28862 (gchar *) "setBlinkFast",
28863 NULL,
28864 NULL,
28865 NULL
28866 },
28867 "handle-set-blink-fast",
28868 FALSE
28869 };
28870
28871 static const GDBusMethodInfo * const _led_method_info_pointers[] =
28872 {
28873 &_led_method_info_set_on.parent_struct,
28874 &_led_method_info_set_off.parent_struct,
28875 &_led_method_info_set_blink_slow.parent_struct,
28876 &_led_method_info_set_blink_fast.parent_struct,
28877 NULL
28878 };
28879
28880 static const _ExtendedGDBusPropertyInfo _led_property_info_color =
28881 {
28882 {
28883 -1,
28884 (gchar *) "color",
28885 (gchar *) "i",
28886 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28887 NULL
28888 },
28889 "color",
28890 FALSE,
28891 TRUE
28892 };
28893
28894 static const _ExtendedGDBusPropertyInfo _led_property_info_function =
28895 {
28896 {
28897 -1,
28898 (gchar *) "function",
28899 (gchar *) "s",
28900 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28901 NULL
28902 },
28903 "function",
28904 FALSE,
28905 TRUE
28906 };
28907
28908 static const _ExtendedGDBusPropertyInfo _led_property_info_state =
28909 {
28910 {
28911 -1,
28912 (gchar *) "state",
28913 (gchar *) "s",
28914 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28915 NULL
28916 },
28917 "state",
28918 FALSE,
28919 TRUE
28920 };
28921
28922 static const GDBusPropertyInfo * const _led_property_info_pointers[] =
28923 {
28924 &_led_property_info_color.parent_struct,
28925 &_led_property_info_function.parent_struct,
28926 &_led_property_info_state.parent_struct,
28927 NULL
28928 };
28929
28930 static const _ExtendedGDBusInterfaceInfo _led_interface_info =
28931 {
28932 {
28933 -1,
28934 (gchar *) "org.openbmc.Led",
28935 (GDBusMethodInfo **) &_led_method_info_pointers,
28936 NULL,
28937 (GDBusPropertyInfo **) &_led_property_info_pointers,
28938 NULL
28939 },
28940 "led",
28941 };
28942
28943
28944 /**
28945 * led_interface_info:
28946 *
28947 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
28948 *
28949 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
28950 */
28951 GDBusInterfaceInfo *
led_interface_info(void)28952 led_interface_info (void)
28953 {
28954 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
28955 }
28956
28957 /**
28958 * led_override_properties:
28959 * @klass: The class structure for a #GObject derived class.
28960 * @property_id_begin: The property id to assign to the first overridden property.
28961 *
28962 * Overrides all #GObject properties in the #Led interface for a concrete class.
28963 * The properties are overridden in the order they are defined.
28964 *
28965 * Returns: The last property id.
28966 */
28967 guint
led_override_properties(GObjectClass * klass,guint property_id_begin)28968 led_override_properties (GObjectClass *klass, guint property_id_begin)
28969 {
28970 g_object_class_override_property (klass, property_id_begin++, "color");
28971 g_object_class_override_property (klass, property_id_begin++, "function");
28972 g_object_class_override_property (klass, property_id_begin++, "state");
28973 return property_id_begin - 1;
28974 }
28975
28976
28977 inline static void
led_method_marshal_set_on(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)28978 led_method_marshal_set_on (
28979 GClosure *closure,
28980 GValue *return_value,
28981 unsigned int n_param_values,
28982 const GValue *param_values,
28983 void *invocation_hint,
28984 void *marshal_data)
28985 {
28986 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
28987 return_value, n_param_values, param_values, invocation_hint, marshal_data);
28988 }
28989
28990 inline static void
led_method_marshal_set_off(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)28991 led_method_marshal_set_off (
28992 GClosure *closure,
28993 GValue *return_value,
28994 unsigned int n_param_values,
28995 const GValue *param_values,
28996 void *invocation_hint,
28997 void *marshal_data)
28998 {
28999 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
29000 return_value, n_param_values, param_values, invocation_hint, marshal_data);
29001 }
29002
29003 inline static void
led_method_marshal_set_blink_slow(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)29004 led_method_marshal_set_blink_slow (
29005 GClosure *closure,
29006 GValue *return_value,
29007 unsigned int n_param_values,
29008 const GValue *param_values,
29009 void *invocation_hint,
29010 void *marshal_data)
29011 {
29012 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
29013 return_value, n_param_values, param_values, invocation_hint, marshal_data);
29014 }
29015
29016 inline static void
led_method_marshal_set_blink_fast(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)29017 led_method_marshal_set_blink_fast (
29018 GClosure *closure,
29019 GValue *return_value,
29020 unsigned int n_param_values,
29021 const GValue *param_values,
29022 void *invocation_hint,
29023 void *marshal_data)
29024 {
29025 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
29026 return_value, n_param_values, param_values, invocation_hint, marshal_data);
29027 }
29028
29029
29030 /**
29031 * Led:
29032 *
29033 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29034 */
29035
29036 /**
29037 * LedIface:
29038 * @parent_iface: The parent interface.
29039 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
29040 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
29041 * @handle_set_off: Handler for the #Led::handle-set-off signal.
29042 * @handle_set_on: Handler for the #Led::handle-set-on signal.
29043 * @get_color: Getter for the #Led:color property.
29044 * @get_function: Getter for the #Led:function property.
29045 * @get_state: Getter for the #Led:state property.
29046 *
29047 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29048 */
29049
29050 typedef LedIface LedInterface;
G_DEFINE_INTERFACE(Led,led,G_TYPE_OBJECT)29051 G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT)
29052
29053 static void
29054 led_default_init (LedIface *iface)
29055 {
29056 /* GObject signals for incoming D-Bus method calls: */
29057 /**
29058 * Led::handle-set-on:
29059 * @object: A #Led.
29060 * @invocation: A #GDBusMethodInvocation.
29061 *
29062 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
29063 *
29064 * 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 led_complete_set_on() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
29065 *
29066 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
29067 */
29068 g_signal_new ("handle-set-on",
29069 G_TYPE_FROM_INTERFACE (iface),
29070 G_SIGNAL_RUN_LAST,
29071 G_STRUCT_OFFSET (LedIface, handle_set_on),
29072 g_signal_accumulator_true_handled,
29073 NULL,
29074 led_method_marshal_set_on,
29075 G_TYPE_BOOLEAN,
29076 1,
29077 G_TYPE_DBUS_METHOD_INVOCATION);
29078
29079 /**
29080 * Led::handle-set-off:
29081 * @object: A #Led.
29082 * @invocation: A #GDBusMethodInvocation.
29083 *
29084 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
29085 *
29086 * 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 led_complete_set_off() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
29087 *
29088 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
29089 */
29090 g_signal_new ("handle-set-off",
29091 G_TYPE_FROM_INTERFACE (iface),
29092 G_SIGNAL_RUN_LAST,
29093 G_STRUCT_OFFSET (LedIface, handle_set_off),
29094 g_signal_accumulator_true_handled,
29095 NULL,
29096 led_method_marshal_set_off,
29097 G_TYPE_BOOLEAN,
29098 1,
29099 G_TYPE_DBUS_METHOD_INVOCATION);
29100
29101 /**
29102 * Led::handle-set-blink-slow:
29103 * @object: A #Led.
29104 * @invocation: A #GDBusMethodInvocation.
29105 *
29106 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
29107 *
29108 * 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 led_complete_set_blink_slow() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
29109 *
29110 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
29111 */
29112 g_signal_new ("handle-set-blink-slow",
29113 G_TYPE_FROM_INTERFACE (iface),
29114 G_SIGNAL_RUN_LAST,
29115 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
29116 g_signal_accumulator_true_handled,
29117 NULL,
29118 led_method_marshal_set_blink_slow,
29119 G_TYPE_BOOLEAN,
29120 1,
29121 G_TYPE_DBUS_METHOD_INVOCATION);
29122
29123 /**
29124 * Led::handle-set-blink-fast:
29125 * @object: A #Led.
29126 * @invocation: A #GDBusMethodInvocation.
29127 *
29128 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
29129 *
29130 * 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 led_complete_set_blink_fast() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
29131 *
29132 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
29133 */
29134 g_signal_new ("handle-set-blink-fast",
29135 G_TYPE_FROM_INTERFACE (iface),
29136 G_SIGNAL_RUN_LAST,
29137 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
29138 g_signal_accumulator_true_handled,
29139 NULL,
29140 led_method_marshal_set_blink_fast,
29141 G_TYPE_BOOLEAN,
29142 1,
29143 G_TYPE_DBUS_METHOD_INVOCATION);
29144
29145 /* GObject properties for D-Bus properties: */
29146 /**
29147 * Led:color:
29148 *
29149 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
29150 *
29151 * 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.
29152 */
29153 g_object_interface_install_property (iface,
29154 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
29155 /**
29156 * Led:function:
29157 *
29158 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
29159 *
29160 * 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.
29161 */
29162 g_object_interface_install_property (iface,
29163 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
29164 /**
29165 * Led:state:
29166 *
29167 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
29168 *
29169 * 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.
29170 */
29171 g_object_interface_install_property (iface,
29172 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
29173 }
29174
29175 /**
29176 * led_get_color: (skip)
29177 * @object: A #Led.
29178 *
29179 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
29180 *
29181 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
29182 *
29183 * Returns: The property value.
29184 */
29185 gint
led_get_color(Led * object)29186 led_get_color (Led *object)
29187 {
29188 g_return_val_if_fail (IS_LED (object), 0);
29189
29190 return LED_GET_IFACE (object)->get_color (object);
29191 }
29192
29193 /**
29194 * led_set_color: (skip)
29195 * @object: A #Led.
29196 * @value: The value to set.
29197 *
29198 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
29199 *
29200 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
29201 */
29202 void
led_set_color(Led * object,gint value)29203 led_set_color (Led *object, gint value)
29204 {
29205 g_object_set (G_OBJECT (object), "color", value, NULL);
29206 }
29207
29208 /**
29209 * led_get_function: (skip)
29210 * @object: A #Led.
29211 *
29212 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
29213 *
29214 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
29215 *
29216 * 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 led_dup_function() if on another thread.
29217 *
29218 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
29219 */
29220 const gchar *
led_get_function(Led * object)29221 led_get_function (Led *object)
29222 {
29223 g_return_val_if_fail (IS_LED (object), NULL);
29224
29225 return LED_GET_IFACE (object)->get_function (object);
29226 }
29227
29228 /**
29229 * led_dup_function: (skip)
29230 * @object: A #Led.
29231 *
29232 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
29233 *
29234 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
29235 *
29236 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
29237 */
29238 gchar *
led_dup_function(Led * object)29239 led_dup_function (Led *object)
29240 {
29241 gchar *value;
29242 g_object_get (G_OBJECT (object), "function", &value, NULL);
29243 return value;
29244 }
29245
29246 /**
29247 * led_set_function: (skip)
29248 * @object: A #Led.
29249 * @value: The value to set.
29250 *
29251 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
29252 *
29253 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
29254 */
29255 void
led_set_function(Led * object,const gchar * value)29256 led_set_function (Led *object, const gchar *value)
29257 {
29258 g_object_set (G_OBJECT (object), "function", value, NULL);
29259 }
29260
29261 /**
29262 * led_get_state: (skip)
29263 * @object: A #Led.
29264 *
29265 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
29266 *
29267 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
29268 *
29269 * 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 led_dup_state() if on another thread.
29270 *
29271 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
29272 */
29273 const gchar *
led_get_state(Led * object)29274 led_get_state (Led *object)
29275 {
29276 g_return_val_if_fail (IS_LED (object), NULL);
29277
29278 return LED_GET_IFACE (object)->get_state (object);
29279 }
29280
29281 /**
29282 * led_dup_state: (skip)
29283 * @object: A #Led.
29284 *
29285 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
29286 *
29287 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
29288 *
29289 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
29290 */
29291 gchar *
led_dup_state(Led * object)29292 led_dup_state (Led *object)
29293 {
29294 gchar *value;
29295 g_object_get (G_OBJECT (object), "state", &value, NULL);
29296 return value;
29297 }
29298
29299 /**
29300 * led_set_state: (skip)
29301 * @object: A #Led.
29302 * @value: The value to set.
29303 *
29304 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
29305 *
29306 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
29307 */
29308 void
led_set_state(Led * object,const gchar * value)29309 led_set_state (Led *object, const gchar *value)
29310 {
29311 g_object_set (G_OBJECT (object), "state", value, NULL);
29312 }
29313
29314 /**
29315 * led_call_set_on:
29316 * @proxy: A #LedProxy.
29317 * @cancellable: (nullable): A #GCancellable or %NULL.
29318 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29319 * @user_data: User data to pass to @callback.
29320 *
29321 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
29322 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
29323 * You can then call led_call_set_on_finish() to get the result of the operation.
29324 *
29325 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
29326 */
29327 void
led_call_set_on(Led * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)29328 led_call_set_on (
29329 Led *proxy,
29330 GCancellable *cancellable,
29331 GAsyncReadyCallback callback,
29332 gpointer user_data)
29333 {
29334 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29335 "setOn",
29336 g_variant_new ("()"),
29337 G_DBUS_CALL_FLAGS_NONE,
29338 -1,
29339 cancellable,
29340 callback,
29341 user_data);
29342 }
29343
29344 /**
29345 * led_call_set_on_finish:
29346 * @proxy: A #LedProxy.
29347 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
29348 * @error: Return location for error or %NULL.
29349 *
29350 * Finishes an operation started with led_call_set_on().
29351 *
29352 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29353 */
29354 gboolean
led_call_set_on_finish(Led * proxy,GAsyncResult * res,GError ** error)29355 led_call_set_on_finish (
29356 Led *proxy,
29357 GAsyncResult *res,
29358 GError **error)
29359 {
29360 GVariant *_ret;
29361 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29362 if (_ret == NULL)
29363 goto _out;
29364 g_variant_get (_ret,
29365 "()");
29366 g_variant_unref (_ret);
29367 _out:
29368 return _ret != NULL;
29369 }
29370
29371 /**
29372 * led_call_set_on_sync:
29373 * @proxy: A #LedProxy.
29374 * @cancellable: (nullable): A #GCancellable or %NULL.
29375 * @error: Return location for error or %NULL.
29376 *
29377 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
29378 *
29379 * See led_call_set_on() for the asynchronous version of this method.
29380 *
29381 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29382 */
29383 gboolean
led_call_set_on_sync(Led * proxy,GCancellable * cancellable,GError ** error)29384 led_call_set_on_sync (
29385 Led *proxy,
29386 GCancellable *cancellable,
29387 GError **error)
29388 {
29389 GVariant *_ret;
29390 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29391 "setOn",
29392 g_variant_new ("()"),
29393 G_DBUS_CALL_FLAGS_NONE,
29394 -1,
29395 cancellable,
29396 error);
29397 if (_ret == NULL)
29398 goto _out;
29399 g_variant_get (_ret,
29400 "()");
29401 g_variant_unref (_ret);
29402 _out:
29403 return _ret != NULL;
29404 }
29405
29406 /**
29407 * led_call_set_off:
29408 * @proxy: A #LedProxy.
29409 * @cancellable: (nullable): A #GCancellable or %NULL.
29410 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29411 * @user_data: User data to pass to @callback.
29412 *
29413 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
29414 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
29415 * You can then call led_call_set_off_finish() to get the result of the operation.
29416 *
29417 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
29418 */
29419 void
led_call_set_off(Led * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)29420 led_call_set_off (
29421 Led *proxy,
29422 GCancellable *cancellable,
29423 GAsyncReadyCallback callback,
29424 gpointer user_data)
29425 {
29426 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29427 "setOff",
29428 g_variant_new ("()"),
29429 G_DBUS_CALL_FLAGS_NONE,
29430 -1,
29431 cancellable,
29432 callback,
29433 user_data);
29434 }
29435
29436 /**
29437 * led_call_set_off_finish:
29438 * @proxy: A #LedProxy.
29439 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
29440 * @error: Return location for error or %NULL.
29441 *
29442 * Finishes an operation started with led_call_set_off().
29443 *
29444 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29445 */
29446 gboolean
led_call_set_off_finish(Led * proxy,GAsyncResult * res,GError ** error)29447 led_call_set_off_finish (
29448 Led *proxy,
29449 GAsyncResult *res,
29450 GError **error)
29451 {
29452 GVariant *_ret;
29453 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29454 if (_ret == NULL)
29455 goto _out;
29456 g_variant_get (_ret,
29457 "()");
29458 g_variant_unref (_ret);
29459 _out:
29460 return _ret != NULL;
29461 }
29462
29463 /**
29464 * led_call_set_off_sync:
29465 * @proxy: A #LedProxy.
29466 * @cancellable: (nullable): A #GCancellable or %NULL.
29467 * @error: Return location for error or %NULL.
29468 *
29469 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
29470 *
29471 * See led_call_set_off() for the asynchronous version of this method.
29472 *
29473 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29474 */
29475 gboolean
led_call_set_off_sync(Led * proxy,GCancellable * cancellable,GError ** error)29476 led_call_set_off_sync (
29477 Led *proxy,
29478 GCancellable *cancellable,
29479 GError **error)
29480 {
29481 GVariant *_ret;
29482 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29483 "setOff",
29484 g_variant_new ("()"),
29485 G_DBUS_CALL_FLAGS_NONE,
29486 -1,
29487 cancellable,
29488 error);
29489 if (_ret == NULL)
29490 goto _out;
29491 g_variant_get (_ret,
29492 "()");
29493 g_variant_unref (_ret);
29494 _out:
29495 return _ret != NULL;
29496 }
29497
29498 /**
29499 * led_call_set_blink_slow:
29500 * @proxy: A #LedProxy.
29501 * @cancellable: (nullable): A #GCancellable or %NULL.
29502 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29503 * @user_data: User data to pass to @callback.
29504 *
29505 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
29506 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
29507 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
29508 *
29509 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
29510 */
29511 void
led_call_set_blink_slow(Led * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)29512 led_call_set_blink_slow (
29513 Led *proxy,
29514 GCancellable *cancellable,
29515 GAsyncReadyCallback callback,
29516 gpointer user_data)
29517 {
29518 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29519 "setBlinkSlow",
29520 g_variant_new ("()"),
29521 G_DBUS_CALL_FLAGS_NONE,
29522 -1,
29523 cancellable,
29524 callback,
29525 user_data);
29526 }
29527
29528 /**
29529 * led_call_set_blink_slow_finish:
29530 * @proxy: A #LedProxy.
29531 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
29532 * @error: Return location for error or %NULL.
29533 *
29534 * Finishes an operation started with led_call_set_blink_slow().
29535 *
29536 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29537 */
29538 gboolean
led_call_set_blink_slow_finish(Led * proxy,GAsyncResult * res,GError ** error)29539 led_call_set_blink_slow_finish (
29540 Led *proxy,
29541 GAsyncResult *res,
29542 GError **error)
29543 {
29544 GVariant *_ret;
29545 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29546 if (_ret == NULL)
29547 goto _out;
29548 g_variant_get (_ret,
29549 "()");
29550 g_variant_unref (_ret);
29551 _out:
29552 return _ret != NULL;
29553 }
29554
29555 /**
29556 * led_call_set_blink_slow_sync:
29557 * @proxy: A #LedProxy.
29558 * @cancellable: (nullable): A #GCancellable or %NULL.
29559 * @error: Return location for error or %NULL.
29560 *
29561 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
29562 *
29563 * See led_call_set_blink_slow() for the asynchronous version of this method.
29564 *
29565 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29566 */
29567 gboolean
led_call_set_blink_slow_sync(Led * proxy,GCancellable * cancellable,GError ** error)29568 led_call_set_blink_slow_sync (
29569 Led *proxy,
29570 GCancellable *cancellable,
29571 GError **error)
29572 {
29573 GVariant *_ret;
29574 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29575 "setBlinkSlow",
29576 g_variant_new ("()"),
29577 G_DBUS_CALL_FLAGS_NONE,
29578 -1,
29579 cancellable,
29580 error);
29581 if (_ret == NULL)
29582 goto _out;
29583 g_variant_get (_ret,
29584 "()");
29585 g_variant_unref (_ret);
29586 _out:
29587 return _ret != NULL;
29588 }
29589
29590 /**
29591 * led_call_set_blink_fast:
29592 * @proxy: A #LedProxy.
29593 * @cancellable: (nullable): A #GCancellable or %NULL.
29594 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29595 * @user_data: User data to pass to @callback.
29596 *
29597 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
29598 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
29599 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
29600 *
29601 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
29602 */
29603 void
led_call_set_blink_fast(Led * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)29604 led_call_set_blink_fast (
29605 Led *proxy,
29606 GCancellable *cancellable,
29607 GAsyncReadyCallback callback,
29608 gpointer user_data)
29609 {
29610 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29611 "setBlinkFast",
29612 g_variant_new ("()"),
29613 G_DBUS_CALL_FLAGS_NONE,
29614 -1,
29615 cancellable,
29616 callback,
29617 user_data);
29618 }
29619
29620 /**
29621 * led_call_set_blink_fast_finish:
29622 * @proxy: A #LedProxy.
29623 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
29624 * @error: Return location for error or %NULL.
29625 *
29626 * Finishes an operation started with led_call_set_blink_fast().
29627 *
29628 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29629 */
29630 gboolean
led_call_set_blink_fast_finish(Led * proxy,GAsyncResult * res,GError ** error)29631 led_call_set_blink_fast_finish (
29632 Led *proxy,
29633 GAsyncResult *res,
29634 GError **error)
29635 {
29636 GVariant *_ret;
29637 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29638 if (_ret == NULL)
29639 goto _out;
29640 g_variant_get (_ret,
29641 "()");
29642 g_variant_unref (_ret);
29643 _out:
29644 return _ret != NULL;
29645 }
29646
29647 /**
29648 * led_call_set_blink_fast_sync:
29649 * @proxy: A #LedProxy.
29650 * @cancellable: (nullable): A #GCancellable or %NULL.
29651 * @error: Return location for error or %NULL.
29652 *
29653 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
29654 *
29655 * See led_call_set_blink_fast() for the asynchronous version of this method.
29656 *
29657 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
29658 */
29659 gboolean
led_call_set_blink_fast_sync(Led * proxy,GCancellable * cancellable,GError ** error)29660 led_call_set_blink_fast_sync (
29661 Led *proxy,
29662 GCancellable *cancellable,
29663 GError **error)
29664 {
29665 GVariant *_ret;
29666 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29667 "setBlinkFast",
29668 g_variant_new ("()"),
29669 G_DBUS_CALL_FLAGS_NONE,
29670 -1,
29671 cancellable,
29672 error);
29673 if (_ret == NULL)
29674 goto _out;
29675 g_variant_get (_ret,
29676 "()");
29677 g_variant_unref (_ret);
29678 _out:
29679 return _ret != NULL;
29680 }
29681
29682 /**
29683 * led_complete_set_on:
29684 * @object: A #Led.
29685 * @invocation: (transfer full): A #GDBusMethodInvocation.
29686 *
29687 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</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.
29688 *
29689 * This method will free @invocation, you cannot use it afterwards.
29690 */
29691 void
led_complete_set_on(Led * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)29692 led_complete_set_on (
29693 Led *object G_GNUC_UNUSED,
29694 GDBusMethodInvocation *invocation)
29695 {
29696 g_dbus_method_invocation_return_value (invocation,
29697 g_variant_new ("()"));
29698 }
29699
29700 /**
29701 * led_complete_set_off:
29702 * @object: A #Led.
29703 * @invocation: (transfer full): A #GDBusMethodInvocation.
29704 *
29705 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</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.
29706 *
29707 * This method will free @invocation, you cannot use it afterwards.
29708 */
29709 void
led_complete_set_off(Led * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)29710 led_complete_set_off (
29711 Led *object G_GNUC_UNUSED,
29712 GDBusMethodInvocation *invocation)
29713 {
29714 g_dbus_method_invocation_return_value (invocation,
29715 g_variant_new ("()"));
29716 }
29717
29718 /**
29719 * led_complete_set_blink_slow:
29720 * @object: A #Led.
29721 * @invocation: (transfer full): A #GDBusMethodInvocation.
29722 *
29723 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</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.
29724 *
29725 * This method will free @invocation, you cannot use it afterwards.
29726 */
29727 void
led_complete_set_blink_slow(Led * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)29728 led_complete_set_blink_slow (
29729 Led *object G_GNUC_UNUSED,
29730 GDBusMethodInvocation *invocation)
29731 {
29732 g_dbus_method_invocation_return_value (invocation,
29733 g_variant_new ("()"));
29734 }
29735
29736 /**
29737 * led_complete_set_blink_fast:
29738 * @object: A #Led.
29739 * @invocation: (transfer full): A #GDBusMethodInvocation.
29740 *
29741 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</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.
29742 *
29743 * This method will free @invocation, you cannot use it afterwards.
29744 */
29745 void
led_complete_set_blink_fast(Led * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)29746 led_complete_set_blink_fast (
29747 Led *object G_GNUC_UNUSED,
29748 GDBusMethodInvocation *invocation)
29749 {
29750 g_dbus_method_invocation_return_value (invocation,
29751 g_variant_new ("()"));
29752 }
29753
29754 /* ------------------------------------------------------------------------ */
29755
29756 /**
29757 * LedProxy:
29758 *
29759 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
29760 */
29761
29762 /**
29763 * LedProxyClass:
29764 * @parent_class: The parent class.
29765 *
29766 * Class structure for #LedProxy.
29767 */
29768
29769 struct _LedProxyPrivate
29770 {
29771 GData *qdata;
29772 };
29773
29774 static void led_proxy_iface_init (LedIface *iface);
29775
29776 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(LedProxy,led_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (LedProxy)G_IMPLEMENT_INTERFACE (TYPE_LED,led_proxy_iface_init))29777 G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
29778 G_ADD_PRIVATE (LedProxy)
29779 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init))
29780
29781 #else
29782 G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
29783 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init))
29784
29785 #endif
29786 static void
29787 led_proxy_finalize (GObject *object)
29788 {
29789 LedProxy *proxy = LED_PROXY (object);
29790 g_datalist_clear (&proxy->priv->qdata);
29791 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
29792 }
29793
29794 static void
led_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)29795 led_proxy_get_property (GObject *object,
29796 guint prop_id,
29797 GValue *value,
29798 GParamSpec *pspec G_GNUC_UNUSED)
29799 {
29800 const _ExtendedGDBusPropertyInfo *info;
29801 GVariant *variant;
29802 g_assert (prop_id != 0 && prop_id - 1 < 3);
29803 info = (const _ExtendedGDBusPropertyInfo *) _led_property_info_pointers[prop_id - 1];
29804 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
29805 if (info->use_gvariant)
29806 {
29807 g_value_set_variant (value, variant);
29808 }
29809 else
29810 {
29811 if (variant != NULL)
29812 g_dbus_gvariant_to_gvalue (variant, value);
29813 }
29814 if (variant != NULL)
29815 g_variant_unref (variant);
29816 }
29817
29818 static void
led_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)29819 led_proxy_set_property_cb (GDBusProxy *proxy,
29820 GAsyncResult *res,
29821 gpointer user_data)
29822 {
29823 const _ExtendedGDBusPropertyInfo *info = user_data;
29824 GError *error;
29825 GVariant *_ret;
29826 error = NULL;
29827 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
29828 if (!_ret)
29829 {
29830 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
29831 info->parent_struct.name,
29832 error->message, g_quark_to_string (error->domain), error->code);
29833 g_error_free (error);
29834 }
29835 else
29836 {
29837 g_variant_unref (_ret);
29838 }
29839 }
29840
29841 static void
led_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)29842 led_proxy_set_property (GObject *object,
29843 guint prop_id,
29844 const GValue *value,
29845 GParamSpec *pspec G_GNUC_UNUSED)
29846 {
29847 const _ExtendedGDBusPropertyInfo *info;
29848 GVariant *variant;
29849 g_assert (prop_id != 0 && prop_id - 1 < 3);
29850 info = (const _ExtendedGDBusPropertyInfo *) _led_property_info_pointers[prop_id - 1];
29851 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
29852 g_dbus_proxy_call (G_DBUS_PROXY (object),
29853 "org.freedesktop.DBus.Properties.Set",
29854 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
29855 G_DBUS_CALL_FLAGS_NONE,
29856 -1,
29857 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
29858 g_variant_unref (variant);
29859 }
29860
29861 static void
led_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)29862 led_proxy_g_signal (GDBusProxy *proxy,
29863 const gchar *sender_name G_GNUC_UNUSED,
29864 const gchar *signal_name,
29865 GVariant *parameters)
29866 {
29867 _ExtendedGDBusSignalInfo *info;
29868 GVariantIter iter;
29869 GVariant *child;
29870 GValue *paramv;
29871 gsize num_params;
29872 gsize n;
29873 guint signal_id;
29874 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
29875 if (info == NULL)
29876 return;
29877 num_params = g_variant_n_children (parameters);
29878 paramv = g_new0 (GValue, num_params + 1);
29879 g_value_init (¶mv[0], TYPE_LED);
29880 g_value_set_object (¶mv[0], proxy);
29881 g_variant_iter_init (&iter, parameters);
29882 n = 1;
29883 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29884 {
29885 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29886 if (arg_info->use_gvariant)
29887 {
29888 g_value_init (¶mv[n], G_TYPE_VARIANT);
29889 g_value_set_variant (¶mv[n], child);
29890 n++;
29891 }
29892 else
29893 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
29894 g_variant_unref (child);
29895 }
29896 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
29897 g_signal_emitv (paramv, signal_id, 0, NULL);
29898 for (n = 0; n < num_params + 1; n++)
29899 g_value_unset (¶mv[n]);
29900 g_free (paramv);
29901 }
29902
29903 static void
led_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)29904 led_proxy_g_properties_changed (GDBusProxy *_proxy,
29905 GVariant *changed_properties,
29906 const gchar *const *invalidated_properties)
29907 {
29908 LedProxy *proxy = LED_PROXY (_proxy);
29909 guint n;
29910 const gchar *key;
29911 GVariantIter *iter;
29912 _ExtendedGDBusPropertyInfo *info;
29913 g_variant_get (changed_properties, "a{sv}", &iter);
29914 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29915 {
29916 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
29917 g_datalist_remove_data (&proxy->priv->qdata, key);
29918 if (info != NULL)
29919 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29920 }
29921 g_variant_iter_free (iter);
29922 for (n = 0; invalidated_properties[n] != NULL; n++)
29923 {
29924 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
29925 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29926 if (info != NULL)
29927 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29928 }
29929 }
29930
29931 static gint
led_proxy_get_color(Led * object)29932 led_proxy_get_color (Led *object)
29933 {
29934 LedProxy *proxy = LED_PROXY (object);
29935 GVariant *variant;
29936 gint value = 0;
29937 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
29938 if (variant != NULL)
29939 {
29940 value = g_variant_get_int32 (variant);
29941 g_variant_unref (variant);
29942 }
29943 return value;
29944 }
29945
29946 static const gchar *
led_proxy_get_function(Led * object)29947 led_proxy_get_function (Led *object)
29948 {
29949 LedProxy *proxy = LED_PROXY (object);
29950 GVariant *variant;
29951 const gchar *value = NULL;
29952 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
29953 if (variant != NULL)
29954 {
29955 value = g_variant_get_string (variant, NULL);
29956 g_variant_unref (variant);
29957 }
29958 return value;
29959 }
29960
29961 static const gchar *
led_proxy_get_state(Led * object)29962 led_proxy_get_state (Led *object)
29963 {
29964 LedProxy *proxy = LED_PROXY (object);
29965 GVariant *variant;
29966 const gchar *value = NULL;
29967 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
29968 if (variant != NULL)
29969 {
29970 value = g_variant_get_string (variant, NULL);
29971 g_variant_unref (variant);
29972 }
29973 return value;
29974 }
29975
29976 static void
led_proxy_init(LedProxy * proxy)29977 led_proxy_init (LedProxy *proxy)
29978 {
29979 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29980 proxy->priv = led_proxy_get_instance_private (proxy);
29981 #else
29982 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
29983 #endif
29984
29985 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
29986 }
29987
29988 static void
led_proxy_class_init(LedProxyClass * klass)29989 led_proxy_class_init (LedProxyClass *klass)
29990 {
29991 GObjectClass *gobject_class;
29992 GDBusProxyClass *proxy_class;
29993
29994 gobject_class = G_OBJECT_CLASS (klass);
29995 gobject_class->finalize = led_proxy_finalize;
29996 gobject_class->get_property = led_proxy_get_property;
29997 gobject_class->set_property = led_proxy_set_property;
29998
29999 proxy_class = G_DBUS_PROXY_CLASS (klass);
30000 proxy_class->g_signal = led_proxy_g_signal;
30001 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
30002
30003 led_override_properties (gobject_class, 1);
30004
30005 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30006 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
30007 #endif
30008 }
30009
30010 static void
led_proxy_iface_init(LedIface * iface)30011 led_proxy_iface_init (LedIface *iface)
30012 {
30013 iface->get_color = led_proxy_get_color;
30014 iface->get_function = led_proxy_get_function;
30015 iface->get_state = led_proxy_get_state;
30016 }
30017
30018 /**
30019 * led_proxy_new:
30020 * @connection: A #GDBusConnection.
30021 * @flags: Flags from the #GDBusProxyFlags enumeration.
30022 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30023 * @object_path: An object path.
30024 * @cancellable: (nullable): A #GCancellable or %NULL.
30025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30026 * @user_data: User data to pass to @callback.
30027 *
30028 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new() for more details.
30029 *
30030 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
30031 * You can then call led_proxy_new_finish() to get the result of the operation.
30032 *
30033 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
30034 */
30035 void
led_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)30036 led_proxy_new (
30037 GDBusConnection *connection,
30038 GDBusProxyFlags flags,
30039 const gchar *name,
30040 const gchar *object_path,
30041 GCancellable *cancellable,
30042 GAsyncReadyCallback callback,
30043 gpointer user_data)
30044 {
30045 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
30046 }
30047
30048 /**
30049 * led_proxy_new_finish:
30050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
30051 * @error: Return location for error or %NULL
30052 *
30053 * Finishes an operation started with led_proxy_new().
30054 *
30055 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
30056 */
30057 Led *
led_proxy_new_finish(GAsyncResult * res,GError ** error)30058 led_proxy_new_finish (
30059 GAsyncResult *res,
30060 GError **error)
30061 {
30062 GObject *ret;
30063 GObject *source_object;
30064 source_object = g_async_result_get_source_object (res);
30065 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30066 g_object_unref (source_object);
30067 if (ret != NULL)
30068 return LED (ret);
30069 else
30070 return NULL;
30071 }
30072
30073 /**
30074 * led_proxy_new_sync:
30075 * @connection: A #GDBusConnection.
30076 * @flags: Flags from the #GDBusProxyFlags enumeration.
30077 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30078 * @object_path: An object path.
30079 * @cancellable: (nullable): A #GCancellable or %NULL.
30080 * @error: Return location for error or %NULL
30081 *
30082 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new_sync() for more details.
30083 *
30084 * The calling thread is blocked until a reply is received.
30085 *
30086 * See led_proxy_new() for the asynchronous version of this constructor.
30087 *
30088 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
30089 */
30090 Led *
led_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)30091 led_proxy_new_sync (
30092 GDBusConnection *connection,
30093 GDBusProxyFlags flags,
30094 const gchar *name,
30095 const gchar *object_path,
30096 GCancellable *cancellable,
30097 GError **error)
30098 {
30099 GInitable *ret;
30100 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
30101 if (ret != NULL)
30102 return LED (ret);
30103 else
30104 return NULL;
30105 }
30106
30107
30108 /**
30109 * led_proxy_new_for_bus:
30110 * @bus_type: A #GBusType.
30111 * @flags: Flags from the #GDBusProxyFlags enumeration.
30112 * @name: A bus name (well-known or unique).
30113 * @object_path: An object path.
30114 * @cancellable: (nullable): A #GCancellable or %NULL.
30115 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30116 * @user_data: User data to pass to @callback.
30117 *
30118 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
30119 *
30120 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
30121 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
30122 *
30123 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
30124 */
30125 void
led_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)30126 led_proxy_new_for_bus (
30127 GBusType bus_type,
30128 GDBusProxyFlags flags,
30129 const gchar *name,
30130 const gchar *object_path,
30131 GCancellable *cancellable,
30132 GAsyncReadyCallback callback,
30133 gpointer user_data)
30134 {
30135 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
30136 }
30137
30138 /**
30139 * led_proxy_new_for_bus_finish:
30140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
30141 * @error: Return location for error or %NULL
30142 *
30143 * Finishes an operation started with led_proxy_new_for_bus().
30144 *
30145 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
30146 */
30147 Led *
led_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)30148 led_proxy_new_for_bus_finish (
30149 GAsyncResult *res,
30150 GError **error)
30151 {
30152 GObject *ret;
30153 GObject *source_object;
30154 source_object = g_async_result_get_source_object (res);
30155 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30156 g_object_unref (source_object);
30157 if (ret != NULL)
30158 return LED (ret);
30159 else
30160 return NULL;
30161 }
30162
30163 /**
30164 * led_proxy_new_for_bus_sync:
30165 * @bus_type: A #GBusType.
30166 * @flags: Flags from the #GDBusProxyFlags enumeration.
30167 * @name: A bus name (well-known or unique).
30168 * @object_path: An object path.
30169 * @cancellable: (nullable): A #GCancellable or %NULL.
30170 * @error: Return location for error or %NULL
30171 *
30172 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
30173 *
30174 * The calling thread is blocked until a reply is received.
30175 *
30176 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
30177 *
30178 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
30179 */
30180 Led *
led_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)30181 led_proxy_new_for_bus_sync (
30182 GBusType bus_type,
30183 GDBusProxyFlags flags,
30184 const gchar *name,
30185 const gchar *object_path,
30186 GCancellable *cancellable,
30187 GError **error)
30188 {
30189 GInitable *ret;
30190 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
30191 if (ret != NULL)
30192 return LED (ret);
30193 else
30194 return NULL;
30195 }
30196
30197
30198 /* ------------------------------------------------------------------------ */
30199
30200 /**
30201 * LedSkeleton:
30202 *
30203 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
30204 */
30205
30206 /**
30207 * LedSkeletonClass:
30208 * @parent_class: The parent class.
30209 *
30210 * Class structure for #LedSkeleton.
30211 */
30212
30213 struct _LedSkeletonPrivate
30214 {
30215 GValue *properties;
30216 GList *changed_properties;
30217 GSource *changed_properties_idle_source;
30218 GMainContext *context;
30219 GMutex lock;
30220 };
30221
30222 static void
_led_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)30223 _led_skeleton_handle_method_call (
30224 GDBusConnection *connection G_GNUC_UNUSED,
30225 const gchar *sender G_GNUC_UNUSED,
30226 const gchar *object_path G_GNUC_UNUSED,
30227 const gchar *interface_name,
30228 const gchar *method_name,
30229 GVariant *parameters,
30230 GDBusMethodInvocation *invocation,
30231 gpointer user_data)
30232 {
30233 LedSkeleton *skeleton = LED_SKELETON (user_data);
30234 _ExtendedGDBusMethodInfo *info;
30235 GVariantIter iter;
30236 GVariant *child;
30237 GValue *paramv;
30238 gsize num_params;
30239 guint num_extra;
30240 gsize n;
30241 guint signal_id;
30242 GValue return_value = G_VALUE_INIT;
30243 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
30244 g_assert (info != NULL);
30245 num_params = g_variant_n_children (parameters);
30246 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
30247 n = 0;
30248 g_value_init (¶mv[n], TYPE_LED);
30249 g_value_set_object (¶mv[n++], skeleton);
30250 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
30251 g_value_set_object (¶mv[n++], invocation);
30252 if (info->pass_fdlist)
30253 {
30254 #ifdef G_OS_UNIX
30255 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
30256 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
30257 #else
30258 g_assert_not_reached ();
30259 #endif
30260 }
30261 g_variant_iter_init (&iter, parameters);
30262 while ((child = g_variant_iter_next_value (&iter)) != NULL)
30263 {
30264 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
30265 if (arg_info->use_gvariant)
30266 {
30267 g_value_init (¶mv[n], G_TYPE_VARIANT);
30268 g_value_set_variant (¶mv[n], child);
30269 n++;
30270 }
30271 else
30272 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
30273 g_variant_unref (child);
30274 }
30275 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
30276 g_value_init (&return_value, G_TYPE_BOOLEAN);
30277 g_signal_emitv (paramv, signal_id, 0, &return_value);
30278 if (!g_value_get_boolean (&return_value))
30279 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);
30280 g_value_unset (&return_value);
30281 for (n = 0; n < num_params + num_extra; n++)
30282 g_value_unset (¶mv[n]);
30283 g_free (paramv);
30284 }
30285
30286 static GVariant *
_led_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)30287 _led_skeleton_handle_get_property (
30288 GDBusConnection *connection G_GNUC_UNUSED,
30289 const gchar *sender G_GNUC_UNUSED,
30290 const gchar *object_path G_GNUC_UNUSED,
30291 const gchar *interface_name G_GNUC_UNUSED,
30292 const gchar *property_name,
30293 GError **error,
30294 gpointer user_data)
30295 {
30296 LedSkeleton *skeleton = LED_SKELETON (user_data);
30297 GValue value = G_VALUE_INIT;
30298 GParamSpec *pspec;
30299 _ExtendedGDBusPropertyInfo *info;
30300 GVariant *ret;
30301 ret = NULL;
30302 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
30303 g_assert (info != NULL);
30304 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30305 if (pspec == NULL)
30306 {
30307 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30308 }
30309 else
30310 {
30311 g_value_init (&value, pspec->value_type);
30312 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30313 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
30314 g_value_unset (&value);
30315 }
30316 return ret;
30317 }
30318
30319 static gboolean
_led_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)30320 _led_skeleton_handle_set_property (
30321 GDBusConnection *connection G_GNUC_UNUSED,
30322 const gchar *sender G_GNUC_UNUSED,
30323 const gchar *object_path G_GNUC_UNUSED,
30324 const gchar *interface_name G_GNUC_UNUSED,
30325 const gchar *property_name,
30326 GVariant *variant,
30327 GError **error,
30328 gpointer user_data)
30329 {
30330 LedSkeleton *skeleton = LED_SKELETON (user_data);
30331 GValue value = G_VALUE_INIT;
30332 GParamSpec *pspec;
30333 _ExtendedGDBusPropertyInfo *info;
30334 gboolean ret;
30335 ret = FALSE;
30336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
30337 g_assert (info != NULL);
30338 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30339 if (pspec == NULL)
30340 {
30341 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30342 }
30343 else
30344 {
30345 if (info->use_gvariant)
30346 g_value_set_variant (&value, variant);
30347 else
30348 g_dbus_gvariant_to_gvalue (variant, &value);
30349 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30350 g_value_unset (&value);
30351 ret = TRUE;
30352 }
30353 return ret;
30354 }
30355
30356 static const GDBusInterfaceVTable _led_skeleton_vtable =
30357 {
30358 _led_skeleton_handle_method_call,
30359 _led_skeleton_handle_get_property,
30360 _led_skeleton_handle_set_property,
30361 {NULL}
30362 };
30363
30364 static GDBusInterfaceInfo *
led_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)30365 led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30366 {
30367 return led_interface_info ();
30368 }
30369
30370 static GDBusInterfaceVTable *
led_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)30371 led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30372 {
30373 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
30374 }
30375
30376 static GVariant *
led_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)30377 led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
30378 {
30379 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
30380
30381 GVariantBuilder builder;
30382 guint n;
30383 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30384 if (_led_interface_info.parent_struct.properties == NULL)
30385 goto out;
30386 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
30387 {
30388 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
30389 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30390 {
30391 GVariant *value;
30392 value = _led_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.Led", info->name, NULL, skeleton);
30393 if (value != NULL)
30394 {
30395 g_variant_take_ref (value);
30396 g_variant_builder_add (&builder, "{sv}", info->name, value);
30397 g_variant_unref (value);
30398 }
30399 }
30400 }
30401 out:
30402 return g_variant_builder_end (&builder);
30403 }
30404
30405 static gboolean _led_emit_changed (gpointer user_data);
30406
30407 static void
led_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)30408 led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30409 {
30410 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
30411 gboolean emit_changed = FALSE;
30412
30413 g_mutex_lock (&skeleton->priv->lock);
30414 if (skeleton->priv->changed_properties_idle_source != NULL)
30415 {
30416 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30417 skeleton->priv->changed_properties_idle_source = NULL;
30418 emit_changed = TRUE;
30419 }
30420 g_mutex_unlock (&skeleton->priv->lock);
30421
30422 if (emit_changed)
30423 _led_emit_changed (skeleton);
30424 }
30425
30426 static void led_skeleton_iface_init (LedIface *iface);
30427 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(LedSkeleton,led_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (LedSkeleton)G_IMPLEMENT_INTERFACE (TYPE_LED,led_skeleton_iface_init))30428 G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30429 G_ADD_PRIVATE (LedSkeleton)
30430 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init))
30431
30432 #else
30433 G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30434 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init))
30435
30436 #endif
30437 static void
30438 led_skeleton_finalize (GObject *object)
30439 {
30440 LedSkeleton *skeleton = LED_SKELETON (object);
30441 guint n;
30442 for (n = 0; n < 3; n++)
30443 g_value_unset (&skeleton->priv->properties[n]);
30444 g_free (skeleton->priv->properties);
30445 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30446 if (skeleton->priv->changed_properties_idle_source != NULL)
30447 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30448 g_main_context_unref (skeleton->priv->context);
30449 g_mutex_clear (&skeleton->priv->lock);
30450 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
30451 }
30452
30453 static void
led_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)30454 led_skeleton_get_property (GObject *object,
30455 guint prop_id,
30456 GValue *value,
30457 GParamSpec *pspec G_GNUC_UNUSED)
30458 {
30459 LedSkeleton *skeleton = LED_SKELETON (object);
30460 g_assert (prop_id != 0 && prop_id - 1 < 3);
30461 g_mutex_lock (&skeleton->priv->lock);
30462 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
30463 g_mutex_unlock (&skeleton->priv->lock);
30464 }
30465
30466 static gboolean
_led_emit_changed(gpointer user_data)30467 _led_emit_changed (gpointer user_data)
30468 {
30469 LedSkeleton *skeleton = LED_SKELETON (user_data);
30470 GList *l;
30471 GVariantBuilder builder;
30472 GVariantBuilder invalidated_builder;
30473 guint num_changes;
30474
30475 g_mutex_lock (&skeleton->priv->lock);
30476 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30477 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
30478 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
30479 {
30480 ChangedProperty *cp = l->data;
30481 GVariant *variant;
30482 const GValue *cur_value;
30483
30484 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
30485 if (!_g_value_equal (cur_value, &cp->orig_value))
30486 {
30487 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
30488 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
30489 g_variant_unref (variant);
30490 num_changes++;
30491 }
30492 }
30493 if (num_changes > 0)
30494 {
30495 GList *connections, *ll;
30496 GVariant *signal_variant;
30497 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
30498 &builder, &invalidated_builder));
30499 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30500 for (ll = connections; ll != NULL; ll = ll->next)
30501 {
30502 GDBusConnection *connection = ll->data;
30503
30504 g_dbus_connection_emit_signal (connection,
30505 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
30506 "org.freedesktop.DBus.Properties",
30507 "PropertiesChanged",
30508 signal_variant,
30509 NULL);
30510 }
30511 g_variant_unref (signal_variant);
30512 g_list_free_full (connections, g_object_unref);
30513 }
30514 else
30515 {
30516 g_variant_builder_clear (&builder);
30517 g_variant_builder_clear (&invalidated_builder);
30518 }
30519 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30520 skeleton->priv->changed_properties = NULL;
30521 skeleton->priv->changed_properties_idle_source = NULL;
30522 g_mutex_unlock (&skeleton->priv->lock);
30523 return FALSE;
30524 }
30525
30526 static void
_led_schedule_emit_changed(LedSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)30527 _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
30528 {
30529 ChangedProperty *cp;
30530 GList *l;
30531 cp = NULL;
30532 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
30533 {
30534 ChangedProperty *i_cp = l->data;
30535 if (i_cp->info == info)
30536 {
30537 cp = i_cp;
30538 break;
30539 }
30540 }
30541 if (cp == NULL)
30542 {
30543 cp = g_new0 (ChangedProperty, 1);
30544 cp->prop_id = prop_id;
30545 cp->info = info;
30546 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
30547 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
30548 g_value_copy (orig_value, &cp->orig_value);
30549 }
30550 }
30551
30552 static void
led_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)30553 led_skeleton_notify (GObject *object,
30554 GParamSpec *pspec G_GNUC_UNUSED)
30555 {
30556 LedSkeleton *skeleton = LED_SKELETON (object);
30557 g_mutex_lock (&skeleton->priv->lock);
30558 if (skeleton->priv->changed_properties != NULL &&
30559 skeleton->priv->changed_properties_idle_source == NULL)
30560 {
30561 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
30562 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
30563 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
30564 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed");
30565 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
30566 g_source_unref (skeleton->priv->changed_properties_idle_source);
30567 }
30568 g_mutex_unlock (&skeleton->priv->lock);
30569 }
30570
30571 static void
led_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)30572 led_skeleton_set_property (GObject *object,
30573 guint prop_id,
30574 const GValue *value,
30575 GParamSpec *pspec)
30576 {
30577 const _ExtendedGDBusPropertyInfo *info;
30578 LedSkeleton *skeleton = LED_SKELETON (object);
30579 g_assert (prop_id != 0 && prop_id - 1 < 3);
30580 info = (const _ExtendedGDBusPropertyInfo *) _led_property_info_pointers[prop_id - 1];
30581 g_mutex_lock (&skeleton->priv->lock);
30582 g_object_freeze_notify (object);
30583 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
30584 {
30585 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
30586 info->emits_changed_signal)
30587 _led_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
30588 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
30589 g_object_notify_by_pspec (object, pspec);
30590 }
30591 g_mutex_unlock (&skeleton->priv->lock);
30592 g_object_thaw_notify (object);
30593 }
30594
30595 static void
led_skeleton_init(LedSkeleton * skeleton)30596 led_skeleton_init (LedSkeleton *skeleton)
30597 {
30598 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30599 skeleton->priv = led_skeleton_get_instance_private (skeleton);
30600 #else
30601 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
30602 #endif
30603
30604 g_mutex_init (&skeleton->priv->lock);
30605 skeleton->priv->context = g_main_context_ref_thread_default ();
30606 skeleton->priv->properties = g_new0 (GValue, 3);
30607 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
30608 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
30609 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
30610 }
30611
30612 static gint
led_skeleton_get_color(Led * object)30613 led_skeleton_get_color (Led *object)
30614 {
30615 LedSkeleton *skeleton = LED_SKELETON (object);
30616 gint value;
30617 g_mutex_lock (&skeleton->priv->lock);
30618 value = g_marshal_value_peek_int (&(skeleton->priv->properties[0]));
30619 g_mutex_unlock (&skeleton->priv->lock);
30620 return value;
30621 }
30622
30623 static const gchar *
led_skeleton_get_function(Led * object)30624 led_skeleton_get_function (Led *object)
30625 {
30626 LedSkeleton *skeleton = LED_SKELETON (object);
30627 const gchar *value;
30628 g_mutex_lock (&skeleton->priv->lock);
30629 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
30630 g_mutex_unlock (&skeleton->priv->lock);
30631 return value;
30632 }
30633
30634 static const gchar *
led_skeleton_get_state(Led * object)30635 led_skeleton_get_state (Led *object)
30636 {
30637 LedSkeleton *skeleton = LED_SKELETON (object);
30638 const gchar *value;
30639 g_mutex_lock (&skeleton->priv->lock);
30640 value = g_marshal_value_peek_string (&(skeleton->priv->properties[2]));
30641 g_mutex_unlock (&skeleton->priv->lock);
30642 return value;
30643 }
30644
30645 static void
led_skeleton_class_init(LedSkeletonClass * klass)30646 led_skeleton_class_init (LedSkeletonClass *klass)
30647 {
30648 GObjectClass *gobject_class;
30649 GDBusInterfaceSkeletonClass *skeleton_class;
30650
30651 gobject_class = G_OBJECT_CLASS (klass);
30652 gobject_class->finalize = led_skeleton_finalize;
30653 gobject_class->get_property = led_skeleton_get_property;
30654 gobject_class->set_property = led_skeleton_set_property;
30655 gobject_class->notify = led_skeleton_notify;
30656
30657
30658 led_override_properties (gobject_class, 1);
30659
30660 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30661 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
30662 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
30663 skeleton_class->flush = led_skeleton_dbus_interface_flush;
30664 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
30665
30666 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30667 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
30668 #endif
30669 }
30670
30671 static void
led_skeleton_iface_init(LedIface * iface)30672 led_skeleton_iface_init (LedIface *iface)
30673 {
30674 iface->get_color = led_skeleton_get_color;
30675 iface->get_function = led_skeleton_get_function;
30676 iface->get_state = led_skeleton_get_state;
30677 }
30678
30679 /**
30680 * led_skeleton_new:
30681 *
30682 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
30683 *
30684 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
30685 */
30686 Led *
led_skeleton_new(void)30687 led_skeleton_new (void)
30688 {
30689 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
30690 }
30691
30692 /* ------------------------------------------------------------------------
30693 * Code for interface org.openbmc.HostIpmi
30694 * ------------------------------------------------------------------------
30695 */
30696
30697 /**
30698 * SECTION:HostIpmi
30699 * @title: HostIpmi
30700 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
30701 *
30702 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C.
30703 */
30704
30705 enum
30706 {
30707 _HOST_IPMI_RECEIVED_MESSAGE,
30708 };
30709
30710 static unsigned _HOST_IPMI_SIGNALS[1] = { 0 };
30711
30712 /* ---- Introspection data for org.openbmc.HostIpmi ---- */
30713
30714 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
30715 {
30716 {
30717 -1,
30718 (gchar *) "seq",
30719 (gchar *) "y",
30720 NULL
30721 },
30722 FALSE
30723 };
30724
30725 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
30726 {
30727 {
30728 -1,
30729 (gchar *) "netfn",
30730 (gchar *) "y",
30731 NULL
30732 },
30733 FALSE
30734 };
30735
30736 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
30737 {
30738 {
30739 -1,
30740 (gchar *) "cmd",
30741 (gchar *) "y",
30742 NULL
30743 },
30744 FALSE
30745 };
30746
30747 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
30748 {
30749 {
30750 -1,
30751 (gchar *) "data",
30752 (gchar *) "ay",
30753 NULL
30754 },
30755 FALSE
30756 };
30757
30758 static const GDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
30759 {
30760 &_host_ipmi_method_info_send_message_IN_ARG_seq.parent_struct,
30761 &_host_ipmi_method_info_send_message_IN_ARG_netfn.parent_struct,
30762 &_host_ipmi_method_info_send_message_IN_ARG_cmd.parent_struct,
30763 &_host_ipmi_method_info_send_message_IN_ARG_data.parent_struct,
30764 NULL
30765 };
30766
30767 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
30768 {
30769 {
30770 -1,
30771 (gchar *) "unnamed_arg4",
30772 (gchar *) "x",
30773 NULL
30774 },
30775 FALSE
30776 };
30777
30778 static const GDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
30779 {
30780 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4.parent_struct,
30781 NULL
30782 };
30783
30784 static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
30785 {
30786 {
30787 -1,
30788 (gchar *) "sendMessage",
30789 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
30790 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
30791 NULL
30792 },
30793 "handle-send-message",
30794 FALSE
30795 };
30796
30797 static const GDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
30798 {
30799 &_host_ipmi_method_info_send_message.parent_struct,
30800 NULL
30801 };
30802
30803 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
30804 {
30805 {
30806 -1,
30807 (gchar *) "seq",
30808 (gchar *) "y",
30809 NULL
30810 },
30811 FALSE
30812 };
30813
30814 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
30815 {
30816 {
30817 -1,
30818 (gchar *) "netfn",
30819 (gchar *) "y",
30820 NULL
30821 },
30822 FALSE
30823 };
30824
30825 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
30826 {
30827 {
30828 -1,
30829 (gchar *) "cmd",
30830 (gchar *) "y",
30831 NULL
30832 },
30833 FALSE
30834 };
30835
30836 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
30837 {
30838 {
30839 -1,
30840 (gchar *) "data",
30841 (gchar *) "ay",
30842 NULL
30843 },
30844 FALSE
30845 };
30846
30847 static const GDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
30848 {
30849 &_host_ipmi_signal_info_received_message_ARG_seq.parent_struct,
30850 &_host_ipmi_signal_info_received_message_ARG_netfn.parent_struct,
30851 &_host_ipmi_signal_info_received_message_ARG_cmd.parent_struct,
30852 &_host_ipmi_signal_info_received_message_ARG_data.parent_struct,
30853 NULL
30854 };
30855
30856 static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
30857 {
30858 {
30859 -1,
30860 (gchar *) "ReceivedMessage",
30861 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
30862 NULL
30863 },
30864 "received-message"
30865 };
30866
30867 static const GDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
30868 {
30869 &_host_ipmi_signal_info_received_message.parent_struct,
30870 NULL
30871 };
30872
30873 static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
30874 {
30875 {
30876 -1,
30877 (gchar *) "org.openbmc.HostIpmi",
30878 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
30879 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
30880 NULL,
30881 NULL
30882 },
30883 "host-ipmi",
30884 };
30885
30886
30887 /**
30888 * host_ipmi_interface_info:
30889 *
30890 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
30891 *
30892 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
30893 */
30894 GDBusInterfaceInfo *
host_ipmi_interface_info(void)30895 host_ipmi_interface_info (void)
30896 {
30897 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
30898 }
30899
30900 /**
30901 * host_ipmi_override_properties:
30902 * @klass: The class structure for a #GObject derived class.
30903 * @property_id_begin: The property id to assign to the first overridden property.
30904 *
30905 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
30906 * The properties are overridden in the order they are defined.
30907 *
30908 * Returns: The last property id.
30909 */
30910 guint
host_ipmi_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)30911 host_ipmi_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
30912 {
30913 return property_id_begin - 1;
30914 }
30915
30916
30917 inline static void
host_ipmi_signal_marshal_received_message(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)30918 host_ipmi_signal_marshal_received_message (
30919 GClosure *closure,
30920 GValue *return_value,
30921 unsigned int n_param_values,
30922 const GValue *param_values,
30923 void *invocation_hint,
30924 void *marshal_data)
30925 {
30926 _g_dbus_codegen_marshal_VOID__UCHAR_UCHAR_UCHAR_STRING (closure,
30927 return_value, n_param_values, param_values, invocation_hint, marshal_data);
30928 }
30929
30930 inline static void
host_ipmi_method_marshal_send_message(GClosure * closure,GValue * return_value,unsigned int n_param_values,const GValue * param_values,void * invocation_hint,void * marshal_data)30931 host_ipmi_method_marshal_send_message (
30932 GClosure *closure,
30933 GValue *return_value,
30934 unsigned int n_param_values,
30935 const GValue *param_values,
30936 void *invocation_hint,
30937 void *marshal_data)
30938 {
30939 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_UCHAR_UCHAR_UCHAR_STRING (closure,
30940 return_value, n_param_values, param_values, invocation_hint, marshal_data);
30941 }
30942
30943
30944 /**
30945 * HostIpmi:
30946 *
30947 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30948 */
30949
30950 /**
30951 * HostIpmiIface:
30952 * @parent_iface: The parent interface.
30953 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
30954 * @received_message: Handler for the #HostIpmi::received-message signal.
30955 *
30956 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30957 */
30958
30959 typedef HostIpmiIface HostIpmiInterface;
G_DEFINE_INTERFACE(HostIpmi,host_ipmi,G_TYPE_OBJECT)30960 G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT)
30961
30962 static void
30963 host_ipmi_default_init (HostIpmiIface *iface)
30964 {
30965 /* GObject signals for incoming D-Bus method calls: */
30966 /**
30967 * HostIpmi::handle-send-message:
30968 * @object: A #HostIpmi.
30969 * @invocation: A #GDBusMethodInvocation.
30970 * @arg_seq: Argument passed by remote caller.
30971 * @arg_netfn: Argument passed by remote caller.
30972 * @arg_cmd: Argument passed by remote caller.
30973 * @arg_data: Argument passed by remote caller.
30974 *
30975 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
30976 *
30977 * 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 host_ipmi_complete_send_message() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
30978 *
30979 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
30980 */
30981 g_signal_new ("handle-send-message",
30982 G_TYPE_FROM_INTERFACE (iface),
30983 G_SIGNAL_RUN_LAST,
30984 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
30985 g_signal_accumulator_true_handled,
30986 NULL,
30987 host_ipmi_method_marshal_send_message,
30988 G_TYPE_BOOLEAN,
30989 5,
30990 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
30991
30992 /* GObject signals for received D-Bus signals: */
30993 /**
30994 * HostIpmi::received-message:
30995 * @object: A #HostIpmi.
30996 * @arg_seq: Argument.
30997 * @arg_netfn: Argument.
30998 * @arg_cmd: Argument.
30999 * @arg_data: Argument.
31000 *
31001 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received.
31002 *
31003 * 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.
31004 */
31005 _HOST_IPMI_SIGNALS[_HOST_IPMI_RECEIVED_MESSAGE] =
31006 g_signal_new ("received-message",
31007 G_TYPE_FROM_INTERFACE (iface),
31008 G_SIGNAL_RUN_LAST,
31009 G_STRUCT_OFFSET (HostIpmiIface, received_message),
31010 NULL,
31011 NULL,
31012 host_ipmi_signal_marshal_received_message,
31013 G_TYPE_NONE,
31014 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
31015
31016 }
31017
31018 /**
31019 * host_ipmi_emit_received_message:
31020 * @object: A #HostIpmi.
31021 * @arg_seq: Argument to pass with the signal.
31022 * @arg_netfn: Argument to pass with the signal.
31023 * @arg_cmd: Argument to pass with the signal.
31024 * @arg_data: Argument to pass with the signal.
31025 *
31026 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
31027 */
31028 void
host_ipmi_emit_received_message(HostIpmi * object,guchar arg_seq,guchar arg_netfn,guchar arg_cmd,const gchar * arg_data)31029 host_ipmi_emit_received_message (
31030 HostIpmi *object,
31031 guchar arg_seq,
31032 guchar arg_netfn,
31033 guchar arg_cmd,
31034 const gchar *arg_data)
31035 {
31036 g_signal_emit (object, _HOST_IPMI_SIGNALS[_HOST_IPMI_RECEIVED_MESSAGE], 0, arg_seq, arg_netfn, arg_cmd, arg_data);
31037 }
31038
31039 /**
31040 * host_ipmi_call_send_message:
31041 * @proxy: A #HostIpmiProxy.
31042 * @arg_seq: Argument to pass with the method invocation.
31043 * @arg_netfn: Argument to pass with the method invocation.
31044 * @arg_cmd: Argument to pass with the method invocation.
31045 * @arg_data: Argument to pass with the method invocation.
31046 * @cancellable: (nullable): A #GCancellable or %NULL.
31047 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
31048 * @user_data: User data to pass to @callback.
31049 *
31050 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
31051 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
31052 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
31053 *
31054 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
31055 */
31056 void
host_ipmi_call_send_message(HostIpmi * proxy,guchar arg_seq,guchar arg_netfn,guchar arg_cmd,const gchar * arg_data,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)31057 host_ipmi_call_send_message (
31058 HostIpmi *proxy,
31059 guchar arg_seq,
31060 guchar arg_netfn,
31061 guchar arg_cmd,
31062 const gchar *arg_data,
31063 GCancellable *cancellable,
31064 GAsyncReadyCallback callback,
31065 gpointer user_data)
31066 {
31067 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
31068 "sendMessage",
31069 g_variant_new ("(yyy^ay)",
31070 arg_seq,
31071 arg_netfn,
31072 arg_cmd,
31073 arg_data),
31074 G_DBUS_CALL_FLAGS_NONE,
31075 -1,
31076 cancellable,
31077 callback,
31078 user_data);
31079 }
31080
31081 /**
31082 * host_ipmi_call_send_message_finish:
31083 * @proxy: A #HostIpmiProxy.
31084 * @out_unnamed_arg4: (out) (optional): Return location for return parameter or %NULL to ignore.
31085 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
31086 * @error: Return location for error or %NULL.
31087 *
31088 * Finishes an operation started with host_ipmi_call_send_message().
31089 *
31090 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
31091 */
31092 gboolean
host_ipmi_call_send_message_finish(HostIpmi * proxy,gint64 * out_unnamed_arg4,GAsyncResult * res,GError ** error)31093 host_ipmi_call_send_message_finish (
31094 HostIpmi *proxy,
31095 gint64 *out_unnamed_arg4,
31096 GAsyncResult *res,
31097 GError **error)
31098 {
31099 GVariant *_ret;
31100 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
31101 if (_ret == NULL)
31102 goto _out;
31103 g_variant_get (_ret,
31104 "(x)",
31105 out_unnamed_arg4);
31106 g_variant_unref (_ret);
31107 _out:
31108 return _ret != NULL;
31109 }
31110
31111 /**
31112 * host_ipmi_call_send_message_sync:
31113 * @proxy: A #HostIpmiProxy.
31114 * @arg_seq: Argument to pass with the method invocation.
31115 * @arg_netfn: Argument to pass with the method invocation.
31116 * @arg_cmd: Argument to pass with the method invocation.
31117 * @arg_data: Argument to pass with the method invocation.
31118 * @out_unnamed_arg4: (out) (optional): Return location for return parameter or %NULL to ignore.
31119 * @cancellable: (nullable): A #GCancellable or %NULL.
31120 * @error: Return location for error or %NULL.
31121 *
31122 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
31123 *
31124 * See host_ipmi_call_send_message() for the asynchronous version of this method.
31125 *
31126 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
31127 */
31128 gboolean
host_ipmi_call_send_message_sync(HostIpmi * proxy,guchar arg_seq,guchar arg_netfn,guchar arg_cmd,const gchar * arg_data,gint64 * out_unnamed_arg4,GCancellable * cancellable,GError ** error)31129 host_ipmi_call_send_message_sync (
31130 HostIpmi *proxy,
31131 guchar arg_seq,
31132 guchar arg_netfn,
31133 guchar arg_cmd,
31134 const gchar *arg_data,
31135 gint64 *out_unnamed_arg4,
31136 GCancellable *cancellable,
31137 GError **error)
31138 {
31139 GVariant *_ret;
31140 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
31141 "sendMessage",
31142 g_variant_new ("(yyy^ay)",
31143 arg_seq,
31144 arg_netfn,
31145 arg_cmd,
31146 arg_data),
31147 G_DBUS_CALL_FLAGS_NONE,
31148 -1,
31149 cancellable,
31150 error);
31151 if (_ret == NULL)
31152 goto _out;
31153 g_variant_get (_ret,
31154 "(x)",
31155 out_unnamed_arg4);
31156 g_variant_unref (_ret);
31157 _out:
31158 return _ret != NULL;
31159 }
31160
31161 /**
31162 * host_ipmi_complete_send_message:
31163 * @object: A #HostIpmi.
31164 * @invocation: (transfer full): A #GDBusMethodInvocation.
31165 * @unnamed_arg4: Parameter to return.
31166 *
31167 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</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.
31168 *
31169 * This method will free @invocation, you cannot use it afterwards.
31170 */
31171 void
host_ipmi_complete_send_message(HostIpmi * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gint64 unnamed_arg4)31172 host_ipmi_complete_send_message (
31173 HostIpmi *object G_GNUC_UNUSED,
31174 GDBusMethodInvocation *invocation,
31175 gint64 unnamed_arg4)
31176 {
31177 g_dbus_method_invocation_return_value (invocation,
31178 g_variant_new ("(x)",
31179 unnamed_arg4));
31180 }
31181
31182 /* ------------------------------------------------------------------------ */
31183
31184 /**
31185 * HostIpmiProxy:
31186 *
31187 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
31188 */
31189
31190 /**
31191 * HostIpmiProxyClass:
31192 * @parent_class: The parent class.
31193 *
31194 * Class structure for #HostIpmiProxy.
31195 */
31196
31197 struct _HostIpmiProxyPrivate
31198 {
31199 GData *qdata;
31200 };
31201
31202 static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
31203
31204 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(HostIpmiProxy,host_ipmi_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (HostIpmiProxy)G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI,host_ipmi_proxy_iface_init))31205 G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
31206 G_ADD_PRIVATE (HostIpmiProxy)
31207 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init))
31208
31209 #else
31210 G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
31211 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init))
31212
31213 #endif
31214 static void
31215 host_ipmi_proxy_finalize (GObject *object)
31216 {
31217 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
31218 g_datalist_clear (&proxy->priv->qdata);
31219 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
31220 }
31221
31222 static void
host_ipmi_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)31223 host_ipmi_proxy_get_property (GObject *object G_GNUC_UNUSED,
31224 guint prop_id G_GNUC_UNUSED,
31225 GValue *value G_GNUC_UNUSED,
31226 GParamSpec *pspec G_GNUC_UNUSED)
31227 {
31228 }
31229
31230 static void
host_ipmi_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)31231 host_ipmi_proxy_set_property (GObject *object G_GNUC_UNUSED,
31232 guint prop_id G_GNUC_UNUSED,
31233 const GValue *value G_GNUC_UNUSED,
31234 GParamSpec *pspec G_GNUC_UNUSED)
31235 {
31236 }
31237
31238 static void
host_ipmi_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)31239 host_ipmi_proxy_g_signal (GDBusProxy *proxy,
31240 const gchar *sender_name G_GNUC_UNUSED,
31241 const gchar *signal_name,
31242 GVariant *parameters)
31243 {
31244 _ExtendedGDBusSignalInfo *info;
31245 GVariantIter iter;
31246 GVariant *child;
31247 GValue *paramv;
31248 gsize num_params;
31249 gsize n;
31250 guint signal_id;
31251 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
31252 if (info == NULL)
31253 return;
31254 num_params = g_variant_n_children (parameters);
31255 paramv = g_new0 (GValue, num_params + 1);
31256 g_value_init (¶mv[0], TYPE_HOST_IPMI);
31257 g_value_set_object (¶mv[0], proxy);
31258 g_variant_iter_init (&iter, parameters);
31259 n = 1;
31260 while ((child = g_variant_iter_next_value (&iter)) != NULL)
31261 {
31262 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
31263 if (arg_info->use_gvariant)
31264 {
31265 g_value_init (¶mv[n], G_TYPE_VARIANT);
31266 g_value_set_variant (¶mv[n], child);
31267 n++;
31268 }
31269 else
31270 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
31271 g_variant_unref (child);
31272 }
31273 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
31274 g_signal_emitv (paramv, signal_id, 0, NULL);
31275 for (n = 0; n < num_params + 1; n++)
31276 g_value_unset (¶mv[n]);
31277 g_free (paramv);
31278 }
31279
31280 static void
host_ipmi_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)31281 host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
31282 GVariant *changed_properties,
31283 const gchar *const *invalidated_properties)
31284 {
31285 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
31286 guint n;
31287 const gchar *key;
31288 GVariantIter *iter;
31289 _ExtendedGDBusPropertyInfo *info;
31290 g_variant_get (changed_properties, "a{sv}", &iter);
31291 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
31292 {
31293 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
31294 g_datalist_remove_data (&proxy->priv->qdata, key);
31295 if (info != NULL)
31296 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
31297 }
31298 g_variant_iter_free (iter);
31299 for (n = 0; invalidated_properties[n] != NULL; n++)
31300 {
31301 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
31302 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
31303 if (info != NULL)
31304 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
31305 }
31306 }
31307
31308 static void
host_ipmi_proxy_init(HostIpmiProxy * proxy)31309 host_ipmi_proxy_init (HostIpmiProxy *proxy)
31310 {
31311 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
31312 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
31313 #else
31314 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
31315 #endif
31316
31317 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
31318 }
31319
31320 static void
host_ipmi_proxy_class_init(HostIpmiProxyClass * klass)31321 host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
31322 {
31323 GObjectClass *gobject_class;
31324 GDBusProxyClass *proxy_class;
31325
31326 gobject_class = G_OBJECT_CLASS (klass);
31327 gobject_class->finalize = host_ipmi_proxy_finalize;
31328 gobject_class->get_property = host_ipmi_proxy_get_property;
31329 gobject_class->set_property = host_ipmi_proxy_set_property;
31330
31331 proxy_class = G_DBUS_PROXY_CLASS (klass);
31332 proxy_class->g_signal = host_ipmi_proxy_g_signal;
31333 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
31334
31335 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
31336 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
31337 #endif
31338 }
31339
31340 static void
host_ipmi_proxy_iface_init(HostIpmiIface * iface G_GNUC_UNUSED)31341 host_ipmi_proxy_iface_init (HostIpmiIface *iface G_GNUC_UNUSED)
31342 {
31343 }
31344
31345 /**
31346 * host_ipmi_proxy_new:
31347 * @connection: A #GDBusConnection.
31348 * @flags: Flags from the #GDBusProxyFlags enumeration.
31349 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
31350 * @object_path: An object path.
31351 * @cancellable: (nullable): A #GCancellable or %NULL.
31352 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
31353 * @user_data: User data to pass to @callback.
31354 *
31355 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details.
31356 *
31357 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
31358 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
31359 *
31360 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
31361 */
31362 void
host_ipmi_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)31363 host_ipmi_proxy_new (
31364 GDBusConnection *connection,
31365 GDBusProxyFlags flags,
31366 const gchar *name,
31367 const gchar *object_path,
31368 GCancellable *cancellable,
31369 GAsyncReadyCallback callback,
31370 gpointer user_data)
31371 {
31372 g_async_initable_new_async (TYPE_HOST_IPMI_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.HostIpmi", NULL);
31373 }
31374
31375 /**
31376 * host_ipmi_proxy_new_finish:
31377 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
31378 * @error: Return location for error or %NULL
31379 *
31380 * Finishes an operation started with host_ipmi_proxy_new().
31381 *
31382 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
31383 */
31384 HostIpmi *
host_ipmi_proxy_new_finish(GAsyncResult * res,GError ** error)31385 host_ipmi_proxy_new_finish (
31386 GAsyncResult *res,
31387 GError **error)
31388 {
31389 GObject *ret;
31390 GObject *source_object;
31391 source_object = g_async_result_get_source_object (res);
31392 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
31393 g_object_unref (source_object);
31394 if (ret != NULL)
31395 return HOST_IPMI (ret);
31396 else
31397 return NULL;
31398 }
31399
31400 /**
31401 * host_ipmi_proxy_new_sync:
31402 * @connection: A #GDBusConnection.
31403 * @flags: Flags from the #GDBusProxyFlags enumeration.
31404 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
31405 * @object_path: An object path.
31406 * @cancellable: (nullable): A #GCancellable or %NULL.
31407 * @error: Return location for error or %NULL
31408 *
31409 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details.
31410 *
31411 * The calling thread is blocked until a reply is received.
31412 *
31413 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
31414 *
31415 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
31416 */
31417 HostIpmi *
host_ipmi_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)31418 host_ipmi_proxy_new_sync (
31419 GDBusConnection *connection,
31420 GDBusProxyFlags flags,
31421 const gchar *name,
31422 const gchar *object_path,
31423 GCancellable *cancellable,
31424 GError **error)
31425 {
31426 GInitable *ret;
31427 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
31428 if (ret != NULL)
31429 return HOST_IPMI (ret);
31430 else
31431 return NULL;
31432 }
31433
31434
31435 /**
31436 * host_ipmi_proxy_new_for_bus:
31437 * @bus_type: A #GBusType.
31438 * @flags: Flags from the #GDBusProxyFlags enumeration.
31439 * @name: A bus name (well-known or unique).
31440 * @object_path: An object path.
31441 * @cancellable: (nullable): A #GCancellable or %NULL.
31442 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
31443 * @user_data: User data to pass to @callback.
31444 *
31445 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
31446 *
31447 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
31448 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
31449 *
31450 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
31451 */
31452 void
host_ipmi_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)31453 host_ipmi_proxy_new_for_bus (
31454 GBusType bus_type,
31455 GDBusProxyFlags flags,
31456 const gchar *name,
31457 const gchar *object_path,
31458 GCancellable *cancellable,
31459 GAsyncReadyCallback callback,
31460 gpointer user_data)
31461 {
31462 g_async_initable_new_async (TYPE_HOST_IPMI_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.HostIpmi", NULL);
31463 }
31464
31465 /**
31466 * host_ipmi_proxy_new_for_bus_finish:
31467 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
31468 * @error: Return location for error or %NULL
31469 *
31470 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
31471 *
31472 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
31473 */
31474 HostIpmi *
host_ipmi_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)31475 host_ipmi_proxy_new_for_bus_finish (
31476 GAsyncResult *res,
31477 GError **error)
31478 {
31479 GObject *ret;
31480 GObject *source_object;
31481 source_object = g_async_result_get_source_object (res);
31482 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
31483 g_object_unref (source_object);
31484 if (ret != NULL)
31485 return HOST_IPMI (ret);
31486 else
31487 return NULL;
31488 }
31489
31490 /**
31491 * host_ipmi_proxy_new_for_bus_sync:
31492 * @bus_type: A #GBusType.
31493 * @flags: Flags from the #GDBusProxyFlags enumeration.
31494 * @name: A bus name (well-known or unique).
31495 * @object_path: An object path.
31496 * @cancellable: (nullable): A #GCancellable or %NULL.
31497 * @error: Return location for error or %NULL
31498 *
31499 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
31500 *
31501 * The calling thread is blocked until a reply is received.
31502 *
31503 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
31504 *
31505 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
31506 */
31507 HostIpmi *
host_ipmi_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)31508 host_ipmi_proxy_new_for_bus_sync (
31509 GBusType bus_type,
31510 GDBusProxyFlags flags,
31511 const gchar *name,
31512 const gchar *object_path,
31513 GCancellable *cancellable,
31514 GError **error)
31515 {
31516 GInitable *ret;
31517 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
31518 if (ret != NULL)
31519 return HOST_IPMI (ret);
31520 else
31521 return NULL;
31522 }
31523
31524
31525 /* ------------------------------------------------------------------------ */
31526
31527 /**
31528 * HostIpmiSkeleton:
31529 *
31530 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
31531 */
31532
31533 /**
31534 * HostIpmiSkeletonClass:
31535 * @parent_class: The parent class.
31536 *
31537 * Class structure for #HostIpmiSkeleton.
31538 */
31539
31540 struct _HostIpmiSkeletonPrivate
31541 {
31542 GValue *properties;
31543 GList *changed_properties;
31544 GSource *changed_properties_idle_source;
31545 GMainContext *context;
31546 GMutex lock;
31547 };
31548
31549 static void
_host_ipmi_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)31550 _host_ipmi_skeleton_handle_method_call (
31551 GDBusConnection *connection G_GNUC_UNUSED,
31552 const gchar *sender G_GNUC_UNUSED,
31553 const gchar *object_path G_GNUC_UNUSED,
31554 const gchar *interface_name,
31555 const gchar *method_name,
31556 GVariant *parameters,
31557 GDBusMethodInvocation *invocation,
31558 gpointer user_data)
31559 {
31560 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
31561 _ExtendedGDBusMethodInfo *info;
31562 GVariantIter iter;
31563 GVariant *child;
31564 GValue *paramv;
31565 gsize num_params;
31566 guint num_extra;
31567 gsize n;
31568 guint signal_id;
31569 GValue return_value = G_VALUE_INIT;
31570 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
31571 g_assert (info != NULL);
31572 num_params = g_variant_n_children (parameters);
31573 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
31574 n = 0;
31575 g_value_init (¶mv[n], TYPE_HOST_IPMI);
31576 g_value_set_object (¶mv[n++], skeleton);
31577 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
31578 g_value_set_object (¶mv[n++], invocation);
31579 if (info->pass_fdlist)
31580 {
31581 #ifdef G_OS_UNIX
31582 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
31583 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
31584 #else
31585 g_assert_not_reached ();
31586 #endif
31587 }
31588 g_variant_iter_init (&iter, parameters);
31589 while ((child = g_variant_iter_next_value (&iter)) != NULL)
31590 {
31591 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
31592 if (arg_info->use_gvariant)
31593 {
31594 g_value_init (¶mv[n], G_TYPE_VARIANT);
31595 g_value_set_variant (¶mv[n], child);
31596 n++;
31597 }
31598 else
31599 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
31600 g_variant_unref (child);
31601 }
31602 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
31603 g_value_init (&return_value, G_TYPE_BOOLEAN);
31604 g_signal_emitv (paramv, signal_id, 0, &return_value);
31605 if (!g_value_get_boolean (&return_value))
31606 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);
31607 g_value_unset (&return_value);
31608 for (n = 0; n < num_params + num_extra; n++)
31609 g_value_unset (¶mv[n]);
31610 g_free (paramv);
31611 }
31612
31613 static GVariant *
_host_ipmi_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)31614 _host_ipmi_skeleton_handle_get_property (
31615 GDBusConnection *connection G_GNUC_UNUSED,
31616 const gchar *sender G_GNUC_UNUSED,
31617 const gchar *object_path G_GNUC_UNUSED,
31618 const gchar *interface_name G_GNUC_UNUSED,
31619 const gchar *property_name,
31620 GError **error,
31621 gpointer user_data)
31622 {
31623 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
31624 GValue value = G_VALUE_INIT;
31625 GParamSpec *pspec;
31626 _ExtendedGDBusPropertyInfo *info;
31627 GVariant *ret;
31628 ret = NULL;
31629 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
31630 g_assert (info != NULL);
31631 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
31632 if (pspec == NULL)
31633 {
31634 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
31635 }
31636 else
31637 {
31638 g_value_init (&value, pspec->value_type);
31639 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
31640 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
31641 g_value_unset (&value);
31642 }
31643 return ret;
31644 }
31645
31646 static gboolean
_host_ipmi_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)31647 _host_ipmi_skeleton_handle_set_property (
31648 GDBusConnection *connection G_GNUC_UNUSED,
31649 const gchar *sender G_GNUC_UNUSED,
31650 const gchar *object_path G_GNUC_UNUSED,
31651 const gchar *interface_name G_GNUC_UNUSED,
31652 const gchar *property_name,
31653 GVariant *variant,
31654 GError **error,
31655 gpointer user_data)
31656 {
31657 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
31658 GValue value = G_VALUE_INIT;
31659 GParamSpec *pspec;
31660 _ExtendedGDBusPropertyInfo *info;
31661 gboolean ret;
31662 ret = FALSE;
31663 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
31664 g_assert (info != NULL);
31665 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
31666 if (pspec == NULL)
31667 {
31668 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
31669 }
31670 else
31671 {
31672 if (info->use_gvariant)
31673 g_value_set_variant (&value, variant);
31674 else
31675 g_dbus_gvariant_to_gvalue (variant, &value);
31676 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
31677 g_value_unset (&value);
31678 ret = TRUE;
31679 }
31680 return ret;
31681 }
31682
31683 static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
31684 {
31685 _host_ipmi_skeleton_handle_method_call,
31686 _host_ipmi_skeleton_handle_get_property,
31687 _host_ipmi_skeleton_handle_set_property,
31688 {NULL}
31689 };
31690
31691 static GDBusInterfaceInfo *
host_ipmi_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)31692 host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
31693 {
31694 return host_ipmi_interface_info ();
31695 }
31696
31697 static GDBusInterfaceVTable *
host_ipmi_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)31698 host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
31699 {
31700 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
31701 }
31702
31703 static GVariant *
host_ipmi_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)31704 host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
31705 {
31706 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
31707
31708 GVariantBuilder builder;
31709 guint n;
31710 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
31711 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
31712 goto out;
31713 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
31714 {
31715 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
31716 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
31717 {
31718 GVariant *value;
31719 value = _host_ipmi_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.HostIpmi", info->name, NULL, skeleton);
31720 if (value != NULL)
31721 {
31722 g_variant_take_ref (value);
31723 g_variant_builder_add (&builder, "{sv}", info->name, value);
31724 g_variant_unref (value);
31725 }
31726 }
31727 }
31728 out:
31729 return g_variant_builder_end (&builder);
31730 }
31731
31732 static void
host_ipmi_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)31733 host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
31734 {
31735 }
31736
31737 static void
_host_ipmi_on_signal_received_message(HostIpmi * object,guchar arg_seq,guchar arg_netfn,guchar arg_cmd,const gchar * arg_data)31738 _host_ipmi_on_signal_received_message (
31739 HostIpmi *object,
31740 guchar arg_seq,
31741 guchar arg_netfn,
31742 guchar arg_cmd,
31743 const gchar *arg_data)
31744 {
31745 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
31746
31747 GList *connections, *l;
31748 GVariant *signal_variant;
31749 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
31750
31751 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
31752 arg_seq,
31753 arg_netfn,
31754 arg_cmd,
31755 arg_data));
31756 for (l = connections; l != NULL; l = l->next)
31757 {
31758 GDBusConnection *connection = l->data;
31759 g_dbus_connection_emit_signal (connection,
31760 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
31761 signal_variant, NULL);
31762 }
31763 g_variant_unref (signal_variant);
31764 g_list_free_full (connections, g_object_unref);
31765 }
31766
31767 static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
31768 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(HostIpmiSkeleton,host_ipmi_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (HostIpmiSkeleton)G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI,host_ipmi_skeleton_iface_init))31769 G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
31770 G_ADD_PRIVATE (HostIpmiSkeleton)
31771 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init))
31772
31773 #else
31774 G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
31775 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init))
31776
31777 #endif
31778 static void
31779 host_ipmi_skeleton_finalize (GObject *object)
31780 {
31781 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
31782 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
31783 if (skeleton->priv->changed_properties_idle_source != NULL)
31784 g_source_destroy (skeleton->priv->changed_properties_idle_source);
31785 g_main_context_unref (skeleton->priv->context);
31786 g_mutex_clear (&skeleton->priv->lock);
31787 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
31788 }
31789
31790 static void
host_ipmi_skeleton_init(HostIpmiSkeleton * skeleton)31791 host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
31792 {
31793 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
31794 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
31795 #else
31796 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
31797 #endif
31798
31799 g_mutex_init (&skeleton->priv->lock);
31800 skeleton->priv->context = g_main_context_ref_thread_default ();
31801 }
31802
31803 static void
host_ipmi_skeleton_class_init(HostIpmiSkeletonClass * klass)31804 host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
31805 {
31806 GObjectClass *gobject_class;
31807 GDBusInterfaceSkeletonClass *skeleton_class;
31808
31809 gobject_class = G_OBJECT_CLASS (klass);
31810 gobject_class->finalize = host_ipmi_skeleton_finalize;
31811
31812 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
31813 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
31814 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
31815 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
31816 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
31817
31818 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
31819 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
31820 #endif
31821 }
31822
31823 static void
host_ipmi_skeleton_iface_init(HostIpmiIface * iface)31824 host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
31825 {
31826 iface->received_message = _host_ipmi_on_signal_received_message;
31827 }
31828
31829 /**
31830 * host_ipmi_skeleton_new:
31831 *
31832 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
31833 *
31834 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
31835 */
31836 HostIpmi *
host_ipmi_skeleton_new(void)31837 host_ipmi_skeleton_new (void)
31838 {
31839 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
31840 }
31841
31842 /* ------------------------------------------------------------------------
31843 * Code for Object, ObjectProxy and ObjectSkeleton
31844 * ------------------------------------------------------------------------
31845 */
31846
31847 /**
31848 * SECTION:Object
31849 * @title: Object
31850 * @short_description: Specialized GDBusObject types
31851 *
31852 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
31853 */
31854
31855 /**
31856 * Object:
31857 *
31858 * The #Object type is a specialized container of interfaces.
31859 */
31860
31861 /**
31862 * ObjectIface:
31863 * @parent_iface: The parent interface.
31864 *
31865 * Virtual table for the #Object interface.
31866 */
31867
31868 typedef ObjectIface ObjectInterface;
G_DEFINE_INTERFACE_WITH_CODE(Object,object,G_TYPE_OBJECT,g_type_interface_add_prerequisite (g_define_type_id,G_TYPE_DBUS_OBJECT);)31869 G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT);)
31870
31871 static void
31872 object_default_init (ObjectIface *iface)
31873 {
31874 /**
31875 * Object:hwmon:
31876 *
31877 * The #Hwmon instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>, if any.
31878 *
31879 * Connect to the #GObject::notify signal to get informed of property changes.
31880 */
31881 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31882
31883 /**
31884 * Object:fan:
31885 *
31886 * The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
31887 *
31888 * Connect to the #GObject::notify signal to get informed of property changes.
31889 */
31890 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31891
31892 /**
31893 * Object:sensor-value:
31894 *
31895 * 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.
31896 *
31897 * Connect to the #GObject::notify signal to get informed of property changes.
31898 */
31899 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));
31900
31901 /**
31902 * Object:sensor-threshold:
31903 *
31904 * 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.
31905 *
31906 * Connect to the #GObject::notify signal to get informed of property changes.
31907 */
31908 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));
31909
31910 /**
31911 * Object:sensor-i2c:
31912 *
31913 * 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.
31914 *
31915 * Connect to the #GObject::notify signal to get informed of property changes.
31916 */
31917 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));
31918
31919 /**
31920 * Object:sensor-match:
31921 *
31922 * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any.
31923 *
31924 * Connect to the #GObject::notify signal to get informed of property changes.
31925 */
31926 g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31927
31928 /**
31929 * Object:process:
31930 *
31931 * The #Process instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>, if any.
31932 *
31933 * Connect to the #GObject::notify signal to get informed of property changes.
31934 */
31935 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31936
31937 /**
31938 * Object:shared-resource:
31939 *
31940 * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any.
31941 *
31942 * Connect to the #GObject::notify signal to get informed of property changes.
31943 */
31944 g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31945
31946 /**
31947 * Object:control:
31948 *
31949 * The #Control instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>, if any.
31950 *
31951 * Connect to the #GObject::notify signal to get informed of property changes.
31952 */
31953 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31954
31955 /**
31956 * Object:control-bmc:
31957 *
31958 * The #ControlBmc instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>, if any.
31959 *
31960 * Connect to the #GObject::notify signal to get informed of property changes.
31961 */
31962 g_object_interface_install_property (iface, g_param_spec_object ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31963
31964 /**
31965 * Object:control-host:
31966 *
31967 * The #ControlHost instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>, if any.
31968 *
31969 * Connect to the #GObject::notify signal to get informed of property changes.
31970 */
31971 g_object_interface_install_property (iface, g_param_spec_object ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31972
31973 /**
31974 * Object:control-power:
31975 *
31976 * The #ControlPower instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>, if any.
31977 *
31978 * Connect to the #GObject::notify signal to get informed of property changes.
31979 */
31980 g_object_interface_install_property (iface, g_param_spec_object ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31981
31982 /**
31983 * Object:control-checkstop:
31984 *
31985 * The #ControlCheckstop instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>, if any.
31986 *
31987 * Connect to the #GObject::notify signal to get informed of property changes.
31988 */
31989 g_object_interface_install_property (iface, g_param_spec_object ("control-checkstop", "control-checkstop", "control-checkstop", TYPE_CONTROL_CHECKSTOP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31990
31991 /**
31992 * Object:watchdog:
31993 *
31994 * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any.
31995 *
31996 * Connect to the #GObject::notify signal to get informed of property changes.
31997 */
31998 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
31999
32000 /**
32001 * Object:event-log:
32002 *
32003 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any.
32004 *
32005 * Connect to the #GObject::notify signal to get informed of property changes.
32006 */
32007 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32008
32009 /**
32010 * Object:flash:
32011 *
32012 * The #Flash instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>, if any.
32013 *
32014 * Connect to the #GObject::notify signal to get informed of property changes.
32015 */
32016 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32017
32018 /**
32019 * Object:flash-control:
32020 *
32021 * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any.
32022 *
32023 * Connect to the #GObject::notify signal to get informed of property changes.
32024 */
32025 g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32026
32027 /**
32028 * Object:button:
32029 *
32030 * The #Button instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>, if any.
32031 *
32032 * Connect to the #GObject::notify signal to get informed of property changes.
32033 */
32034 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32035
32036 /**
32037 * Object:led:
32038 *
32039 * The #Led instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>, if any.
32040 *
32041 * Connect to the #GObject::notify signal to get informed of property changes.
32042 */
32043 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32044
32045 /**
32046 * Object:host-ipmi:
32047 *
32048 * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any.
32049 *
32050 * Connect to the #GObject::notify signal to get informed of property changes.
32051 */
32052 g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
32053
32054 }
32055
32056 /**
32057 * object_get_hwmon:
32058 * @object: A #Object.
32059 *
32060 * Gets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object, if any.
32061 *
32062 * Returns: (transfer full) (nullable): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32063 */
object_get_hwmon(Object * object)32064 Hwmon *object_get_hwmon (Object *object)
32065 {
32066 GDBusInterface *ret;
32067 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
32068 if (ret == NULL)
32069 return NULL;
32070 return HWMON (ret);
32071 }
32072
32073 /**
32074 * object_get_fan:
32075 * @object: A #Object.
32076 *
32077 * Gets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object, if any.
32078 *
32079 * Returns: (transfer full) (nullable): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32080 */
object_get_fan(Object * object)32081 Fan *object_get_fan (Object *object)
32082 {
32083 GDBusInterface *ret;
32084 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
32085 if (ret == NULL)
32086 return NULL;
32087 return FAN (ret);
32088 }
32089
32090 /**
32091 * object_get_sensor_value:
32092 * @object: A #Object.
32093 *
32094 * 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.
32095 *
32096 * Returns: (transfer full) (nullable): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32097 */
object_get_sensor_value(Object * object)32098 SensorValue *object_get_sensor_value (Object *object)
32099 {
32100 GDBusInterface *ret;
32101 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
32102 if (ret == NULL)
32103 return NULL;
32104 return SENSOR_VALUE (ret);
32105 }
32106
32107 /**
32108 * object_get_sensor_threshold:
32109 * @object: A #Object.
32110 *
32111 * 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.
32112 *
32113 * Returns: (transfer full) (nullable): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32114 */
object_get_sensor_threshold(Object * object)32115 SensorThreshold *object_get_sensor_threshold (Object *object)
32116 {
32117 GDBusInterface *ret;
32118 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
32119 if (ret == NULL)
32120 return NULL;
32121 return SENSOR_THRESHOLD (ret);
32122 }
32123
32124 /**
32125 * object_get_sensor_i2c:
32126 * @object: A #Object.
32127 *
32128 * 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.
32129 *
32130 * Returns: (transfer full) (nullable): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32131 */
object_get_sensor_i2c(Object * object)32132 SensorI2c *object_get_sensor_i2c (Object *object)
32133 {
32134 GDBusInterface *ret;
32135 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
32136 if (ret == NULL)
32137 return NULL;
32138 return SENSOR_I2C (ret);
32139 }
32140
32141 /**
32142 * object_get_sensor_match:
32143 * @object: A #Object.
32144 *
32145 * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any.
32146 *
32147 * Returns: (transfer full) (nullable): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32148 */
object_get_sensor_match(Object * object)32149 SensorMatch *object_get_sensor_match (Object *object)
32150 {
32151 GDBusInterface *ret;
32152 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
32153 if (ret == NULL)
32154 return NULL;
32155 return SENSOR_MATCH (ret);
32156 }
32157
32158 /**
32159 * object_get_process:
32160 * @object: A #Object.
32161 *
32162 * Gets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object, if any.
32163 *
32164 * Returns: (transfer full) (nullable): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32165 */
object_get_process(Object * object)32166 Process *object_get_process (Object *object)
32167 {
32168 GDBusInterface *ret;
32169 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
32170 if (ret == NULL)
32171 return NULL;
32172 return PROCESS (ret);
32173 }
32174
32175 /**
32176 * object_get_shared_resource:
32177 * @object: A #Object.
32178 *
32179 * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any.
32180 *
32181 * Returns: (transfer full) (nullable): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32182 */
object_get_shared_resource(Object * object)32183 SharedResource *object_get_shared_resource (Object *object)
32184 {
32185 GDBusInterface *ret;
32186 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
32187 if (ret == NULL)
32188 return NULL;
32189 return SHARED_RESOURCE (ret);
32190 }
32191
32192 /**
32193 * object_get_control:
32194 * @object: A #Object.
32195 *
32196 * Gets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object, if any.
32197 *
32198 * Returns: (transfer full) (nullable): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32199 */
object_get_control(Object * object)32200 Control *object_get_control (Object *object)
32201 {
32202 GDBusInterface *ret;
32203 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
32204 if (ret == NULL)
32205 return NULL;
32206 return CONTROL (ret);
32207 }
32208
32209 /**
32210 * object_get_control_bmc:
32211 * @object: A #Object.
32212 *
32213 * Gets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object, if any.
32214 *
32215 * Returns: (transfer full) (nullable): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32216 */
object_get_control_bmc(Object * object)32217 ControlBmc *object_get_control_bmc (Object *object)
32218 {
32219 GDBusInterface *ret;
32220 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
32221 if (ret == NULL)
32222 return NULL;
32223 return CONTROL_BMC (ret);
32224 }
32225
32226 /**
32227 * object_get_control_host:
32228 * @object: A #Object.
32229 *
32230 * Gets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object, if any.
32231 *
32232 * Returns: (transfer full) (nullable): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32233 */
object_get_control_host(Object * object)32234 ControlHost *object_get_control_host (Object *object)
32235 {
32236 GDBusInterface *ret;
32237 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
32238 if (ret == NULL)
32239 return NULL;
32240 return CONTROL_HOST (ret);
32241 }
32242
32243 /**
32244 * object_get_control_power:
32245 * @object: A #Object.
32246 *
32247 * Gets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object, if any.
32248 *
32249 * Returns: (transfer full) (nullable): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32250 */
object_get_control_power(Object * object)32251 ControlPower *object_get_control_power (Object *object)
32252 {
32253 GDBusInterface *ret;
32254 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
32255 if (ret == NULL)
32256 return NULL;
32257 return CONTROL_POWER (ret);
32258 }
32259
32260 /**
32261 * object_get_control_checkstop:
32262 * @object: A #Object.
32263 *
32264 * Gets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object, if any.
32265 *
32266 * Returns: (transfer full) (nullable): A #ControlCheckstop that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32267 */
object_get_control_checkstop(Object * object)32268 ControlCheckstop *object_get_control_checkstop (Object *object)
32269 {
32270 GDBusInterface *ret;
32271 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
32272 if (ret == NULL)
32273 return NULL;
32274 return CONTROL_CHECKSTOP (ret);
32275 }
32276
32277 /**
32278 * object_get_watchdog:
32279 * @object: A #Object.
32280 *
32281 * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any.
32282 *
32283 * Returns: (transfer full) (nullable): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32284 */
object_get_watchdog(Object * object)32285 Watchdog *object_get_watchdog (Object *object)
32286 {
32287 GDBusInterface *ret;
32288 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
32289 if (ret == NULL)
32290 return NULL;
32291 return WATCHDOG (ret);
32292 }
32293
32294 /**
32295 * object_get_event_log:
32296 * @object: A #Object.
32297 *
32298 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any.
32299 *
32300 * Returns: (transfer full) (nullable): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32301 */
object_get_event_log(Object * object)32302 EventLog *object_get_event_log (Object *object)
32303 {
32304 GDBusInterface *ret;
32305 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
32306 if (ret == NULL)
32307 return NULL;
32308 return EVENT_LOG (ret);
32309 }
32310
32311 /**
32312 * object_get_flash:
32313 * @object: A #Object.
32314 *
32315 * Gets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object, if any.
32316 *
32317 * Returns: (transfer full) (nullable): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32318 */
object_get_flash(Object * object)32319 Flash *object_get_flash (Object *object)
32320 {
32321 GDBusInterface *ret;
32322 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
32323 if (ret == NULL)
32324 return NULL;
32325 return FLASH (ret);
32326 }
32327
32328 /**
32329 * object_get_flash_control:
32330 * @object: A #Object.
32331 *
32332 * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any.
32333 *
32334 * Returns: (transfer full) (nullable): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32335 */
object_get_flash_control(Object * object)32336 FlashControl *object_get_flash_control (Object *object)
32337 {
32338 GDBusInterface *ret;
32339 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
32340 if (ret == NULL)
32341 return NULL;
32342 return FLASH_CONTROL (ret);
32343 }
32344
32345 /**
32346 * object_get_button:
32347 * @object: A #Object.
32348 *
32349 * Gets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object, if any.
32350 *
32351 * Returns: (transfer full) (nullable): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32352 */
object_get_button(Object * object)32353 Button *object_get_button (Object *object)
32354 {
32355 GDBusInterface *ret;
32356 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
32357 if (ret == NULL)
32358 return NULL;
32359 return BUTTON (ret);
32360 }
32361
32362 /**
32363 * object_get_led:
32364 * @object: A #Object.
32365 *
32366 * Gets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object, if any.
32367 *
32368 * Returns: (transfer full) (nullable): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32369 */
object_get_led(Object * object)32370 Led *object_get_led (Object *object)
32371 {
32372 GDBusInterface *ret;
32373 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
32374 if (ret == NULL)
32375 return NULL;
32376 return LED (ret);
32377 }
32378
32379 /**
32380 * object_get_host_ipmi:
32381 * @object: A #Object.
32382 *
32383 * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any.
32384 *
32385 * Returns: (transfer full) (nullable): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
32386 */
object_get_host_ipmi(Object * object)32387 HostIpmi *object_get_host_ipmi (Object *object)
32388 {
32389 GDBusInterface *ret;
32390 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
32391 if (ret == NULL)
32392 return NULL;
32393 return HOST_IPMI (ret);
32394 }
32395
32396
32397 /**
32398 * object_peek_hwmon: (skip)
32399 * @object: A #Object.
32400 *
32401 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
32402 *
32403 * 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.
32404 *
32405 * Returns: (transfer none) (nullable): A #Hwmon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32406 */
object_peek_hwmon(Object * object)32407 Hwmon *object_peek_hwmon (Object *object)
32408 {
32409 GDBusInterface *ret;
32410 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
32411 if (ret == NULL)
32412 return NULL;
32413 g_object_unref (ret);
32414 return HWMON (ret);
32415 }
32416
32417 /**
32418 * object_peek_fan: (skip)
32419 * @object: A #Object.
32420 *
32421 * Like object_get_fan() but doesn't increase the reference count on the returned object.
32422 *
32423 * 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.
32424 *
32425 * Returns: (transfer none) (nullable): A #Fan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32426 */
object_peek_fan(Object * object)32427 Fan *object_peek_fan (Object *object)
32428 {
32429 GDBusInterface *ret;
32430 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
32431 if (ret == NULL)
32432 return NULL;
32433 g_object_unref (ret);
32434 return FAN (ret);
32435 }
32436
32437 /**
32438 * object_peek_sensor_value: (skip)
32439 * @object: A #Object.
32440 *
32441 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
32442 *
32443 * 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.
32444 *
32445 * Returns: (transfer none) (nullable): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32446 */
object_peek_sensor_value(Object * object)32447 SensorValue *object_peek_sensor_value (Object *object)
32448 {
32449 GDBusInterface *ret;
32450 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
32451 if (ret == NULL)
32452 return NULL;
32453 g_object_unref (ret);
32454 return SENSOR_VALUE (ret);
32455 }
32456
32457 /**
32458 * object_peek_sensor_threshold: (skip)
32459 * @object: A #Object.
32460 *
32461 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
32462 *
32463 * 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.
32464 *
32465 * Returns: (transfer none) (nullable): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32466 */
object_peek_sensor_threshold(Object * object)32467 SensorThreshold *object_peek_sensor_threshold (Object *object)
32468 {
32469 GDBusInterface *ret;
32470 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
32471 if (ret == NULL)
32472 return NULL;
32473 g_object_unref (ret);
32474 return SENSOR_THRESHOLD (ret);
32475 }
32476
32477 /**
32478 * object_peek_sensor_i2c: (skip)
32479 * @object: A #Object.
32480 *
32481 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
32482 *
32483 * 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.
32484 *
32485 * Returns: (transfer none) (nullable): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32486 */
object_peek_sensor_i2c(Object * object)32487 SensorI2c *object_peek_sensor_i2c (Object *object)
32488 {
32489 GDBusInterface *ret;
32490 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
32491 if (ret == NULL)
32492 return NULL;
32493 g_object_unref (ret);
32494 return SENSOR_I2C (ret);
32495 }
32496
32497 /**
32498 * object_peek_sensor_match: (skip)
32499 * @object: A #Object.
32500 *
32501 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
32502 *
32503 * 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.
32504 *
32505 * Returns: (transfer none) (nullable): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32506 */
object_peek_sensor_match(Object * object)32507 SensorMatch *object_peek_sensor_match (Object *object)
32508 {
32509 GDBusInterface *ret;
32510 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
32511 if (ret == NULL)
32512 return NULL;
32513 g_object_unref (ret);
32514 return SENSOR_MATCH (ret);
32515 }
32516
32517 /**
32518 * object_peek_process: (skip)
32519 * @object: A #Object.
32520 *
32521 * Like object_get_process() but doesn't increase the reference count on the returned object.
32522 *
32523 * 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.
32524 *
32525 * Returns: (transfer none) (nullable): A #Process or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32526 */
object_peek_process(Object * object)32527 Process *object_peek_process (Object *object)
32528 {
32529 GDBusInterface *ret;
32530 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
32531 if (ret == NULL)
32532 return NULL;
32533 g_object_unref (ret);
32534 return PROCESS (ret);
32535 }
32536
32537 /**
32538 * object_peek_shared_resource: (skip)
32539 * @object: A #Object.
32540 *
32541 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
32542 *
32543 * 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.
32544 *
32545 * Returns: (transfer none) (nullable): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32546 */
object_peek_shared_resource(Object * object)32547 SharedResource *object_peek_shared_resource (Object *object)
32548 {
32549 GDBusInterface *ret;
32550 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
32551 if (ret == NULL)
32552 return NULL;
32553 g_object_unref (ret);
32554 return SHARED_RESOURCE (ret);
32555 }
32556
32557 /**
32558 * object_peek_control: (skip)
32559 * @object: A #Object.
32560 *
32561 * Like object_get_control() but doesn't increase the reference count on the returned object.
32562 *
32563 * 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.
32564 *
32565 * Returns: (transfer none) (nullable): A #Control or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32566 */
object_peek_control(Object * object)32567 Control *object_peek_control (Object *object)
32568 {
32569 GDBusInterface *ret;
32570 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
32571 if (ret == NULL)
32572 return NULL;
32573 g_object_unref (ret);
32574 return CONTROL (ret);
32575 }
32576
32577 /**
32578 * object_peek_control_bmc: (skip)
32579 * @object: A #Object.
32580 *
32581 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
32582 *
32583 * 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.
32584 *
32585 * Returns: (transfer none) (nullable): A #ControlBmc or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32586 */
object_peek_control_bmc(Object * object)32587 ControlBmc *object_peek_control_bmc (Object *object)
32588 {
32589 GDBusInterface *ret;
32590 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
32591 if (ret == NULL)
32592 return NULL;
32593 g_object_unref (ret);
32594 return CONTROL_BMC (ret);
32595 }
32596
32597 /**
32598 * object_peek_control_host: (skip)
32599 * @object: A #Object.
32600 *
32601 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
32602 *
32603 * 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.
32604 *
32605 * Returns: (transfer none) (nullable): A #ControlHost or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32606 */
object_peek_control_host(Object * object)32607 ControlHost *object_peek_control_host (Object *object)
32608 {
32609 GDBusInterface *ret;
32610 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
32611 if (ret == NULL)
32612 return NULL;
32613 g_object_unref (ret);
32614 return CONTROL_HOST (ret);
32615 }
32616
32617 /**
32618 * object_peek_control_power: (skip)
32619 * @object: A #Object.
32620 *
32621 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
32622 *
32623 * 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.
32624 *
32625 * Returns: (transfer none) (nullable): A #ControlPower or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32626 */
object_peek_control_power(Object * object)32627 ControlPower *object_peek_control_power (Object *object)
32628 {
32629 GDBusInterface *ret;
32630 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
32631 if (ret == NULL)
32632 return NULL;
32633 g_object_unref (ret);
32634 return CONTROL_POWER (ret);
32635 }
32636
32637 /**
32638 * object_peek_control_checkstop: (skip)
32639 * @object: A #Object.
32640 *
32641 * Like object_get_control_checkstop() but doesn't increase the reference count on the returned object.
32642 *
32643 * 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.
32644 *
32645 * Returns: (transfer none) (nullable): A #ControlCheckstop or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32646 */
object_peek_control_checkstop(Object * object)32647 ControlCheckstop *object_peek_control_checkstop (Object *object)
32648 {
32649 GDBusInterface *ret;
32650 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
32651 if (ret == NULL)
32652 return NULL;
32653 g_object_unref (ret);
32654 return CONTROL_CHECKSTOP (ret);
32655 }
32656
32657 /**
32658 * object_peek_watchdog: (skip)
32659 * @object: A #Object.
32660 *
32661 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
32662 *
32663 * 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.
32664 *
32665 * Returns: (transfer none) (nullable): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32666 */
object_peek_watchdog(Object * object)32667 Watchdog *object_peek_watchdog (Object *object)
32668 {
32669 GDBusInterface *ret;
32670 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
32671 if (ret == NULL)
32672 return NULL;
32673 g_object_unref (ret);
32674 return WATCHDOG (ret);
32675 }
32676
32677 /**
32678 * object_peek_event_log: (skip)
32679 * @object: A #Object.
32680 *
32681 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
32682 *
32683 * 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.
32684 *
32685 * Returns: (transfer none) (nullable): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32686 */
object_peek_event_log(Object * object)32687 EventLog *object_peek_event_log (Object *object)
32688 {
32689 GDBusInterface *ret;
32690 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
32691 if (ret == NULL)
32692 return NULL;
32693 g_object_unref (ret);
32694 return EVENT_LOG (ret);
32695 }
32696
32697 /**
32698 * object_peek_flash: (skip)
32699 * @object: A #Object.
32700 *
32701 * Like object_get_flash() but doesn't increase the reference count on the returned object.
32702 *
32703 * 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.
32704 *
32705 * Returns: (transfer none) (nullable): A #Flash or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32706 */
object_peek_flash(Object * object)32707 Flash *object_peek_flash (Object *object)
32708 {
32709 GDBusInterface *ret;
32710 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
32711 if (ret == NULL)
32712 return NULL;
32713 g_object_unref (ret);
32714 return FLASH (ret);
32715 }
32716
32717 /**
32718 * object_peek_flash_control: (skip)
32719 * @object: A #Object.
32720 *
32721 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
32722 *
32723 * 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.
32724 *
32725 * Returns: (transfer none) (nullable): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32726 */
object_peek_flash_control(Object * object)32727 FlashControl *object_peek_flash_control (Object *object)
32728 {
32729 GDBusInterface *ret;
32730 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
32731 if (ret == NULL)
32732 return NULL;
32733 g_object_unref (ret);
32734 return FLASH_CONTROL (ret);
32735 }
32736
32737 /**
32738 * object_peek_button: (skip)
32739 * @object: A #Object.
32740 *
32741 * Like object_get_button() but doesn't increase the reference count on the returned object.
32742 *
32743 * 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.
32744 *
32745 * Returns: (transfer none) (nullable): A #Button or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32746 */
object_peek_button(Object * object)32747 Button *object_peek_button (Object *object)
32748 {
32749 GDBusInterface *ret;
32750 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
32751 if (ret == NULL)
32752 return NULL;
32753 g_object_unref (ret);
32754 return BUTTON (ret);
32755 }
32756
32757 /**
32758 * object_peek_led: (skip)
32759 * @object: A #Object.
32760 *
32761 * Like object_get_led() but doesn't increase the reference count on the returned object.
32762 *
32763 * 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.
32764 *
32765 * Returns: (transfer none) (nullable): A #Led or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32766 */
object_peek_led(Object * object)32767 Led *object_peek_led (Object *object)
32768 {
32769 GDBusInterface *ret;
32770 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
32771 if (ret == NULL)
32772 return NULL;
32773 g_object_unref (ret);
32774 return LED (ret);
32775 }
32776
32777 /**
32778 * object_peek_host_ipmi: (skip)
32779 * @object: A #Object.
32780 *
32781 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
32782 *
32783 * 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.
32784 *
32785 * Returns: (transfer none) (nullable): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
32786 */
object_peek_host_ipmi(Object * object)32787 HostIpmi *object_peek_host_ipmi (Object *object)
32788 {
32789 GDBusInterface *ret;
32790 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
32791 if (ret == NULL)
32792 return NULL;
32793 g_object_unref (ret);
32794 return HOST_IPMI (ret);
32795 }
32796
32797
32798 static void
object_notify(GDBusObject * object,GDBusInterface * interface)32799 object_notify (GDBusObject *object, GDBusInterface *interface)
32800 {
32801 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
32802 /* info can be NULL if the other end is using a D-Bus interface we don't know
32803 * anything about, for example old generated code in this process talking to
32804 * newer generated code in the other process. */
32805 if (info != NULL)
32806 g_object_notify (G_OBJECT (object), info->hyphen_name);
32807 }
32808
32809 /**
32810 * ObjectProxy:
32811 *
32812 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
32813 */
32814
32815 /**
32816 * ObjectProxyClass:
32817 * @parent_class: The parent class.
32818 *
32819 * Class structure for #ObjectProxy.
32820 */
32821
32822 static void
object_proxy__object_iface_init(ObjectIface * iface G_GNUC_UNUSED)32823 object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
32824 {
32825 }
32826
32827 static void
object_proxy__g_dbus_object_iface_init(GDBusObjectIface * iface)32828 object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
32829 {
32830 iface->interface_added = object_notify;
32831 iface->interface_removed = object_notify;
32832 }
32833
32834
G_DEFINE_TYPE_WITH_CODE(ObjectProxy,object_proxy,G_TYPE_DBUS_OBJECT_PROXY,G_IMPLEMENT_INTERFACE (TYPE_OBJECT,object_proxy__object_iface_init)G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT,object_proxy__g_dbus_object_iface_init))32835 G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
32836 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
32837 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init))
32838
32839 static void
32840 object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
32841 {
32842 }
32843
32844 static void
object_proxy_set_property(GObject * gobject,guint prop_id,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec)32845 object_proxy_set_property (GObject *gobject,
32846 guint prop_id,
32847 const GValue *value G_GNUC_UNUSED,
32848 GParamSpec *pspec)
32849 {
32850 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32851 }
32852
32853 static void
object_proxy_get_property(GObject * gobject,guint prop_id,GValue * value,GParamSpec * pspec)32854 object_proxy_get_property (GObject *gobject,
32855 guint prop_id,
32856 GValue *value,
32857 GParamSpec *pspec)
32858 {
32859 ObjectProxy *object = OBJECT_PROXY (gobject);
32860 GDBusInterface *interface;
32861
32862 switch (prop_id)
32863 {
32864 case 1:
32865 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
32866 g_value_take_object (value, interface);
32867 break;
32868
32869 case 2:
32870 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
32871 g_value_take_object (value, interface);
32872 break;
32873
32874 case 3:
32875 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
32876 g_value_take_object (value, interface);
32877 break;
32878
32879 case 4:
32880 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
32881 g_value_take_object (value, interface);
32882 break;
32883
32884 case 5:
32885 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
32886 g_value_take_object (value, interface);
32887 break;
32888
32889 case 6:
32890 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
32891 g_value_take_object (value, interface);
32892 break;
32893
32894 case 7:
32895 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
32896 g_value_take_object (value, interface);
32897 break;
32898
32899 case 8:
32900 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
32901 g_value_take_object (value, interface);
32902 break;
32903
32904 case 9:
32905 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
32906 g_value_take_object (value, interface);
32907 break;
32908
32909 case 10:
32910 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
32911 g_value_take_object (value, interface);
32912 break;
32913
32914 case 11:
32915 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
32916 g_value_take_object (value, interface);
32917 break;
32918
32919 case 12:
32920 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
32921 g_value_take_object (value, interface);
32922 break;
32923
32924 case 13:
32925 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
32926 g_value_take_object (value, interface);
32927 break;
32928
32929 case 14:
32930 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
32931 g_value_take_object (value, interface);
32932 break;
32933
32934 case 15:
32935 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
32936 g_value_take_object (value, interface);
32937 break;
32938
32939 case 16:
32940 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
32941 g_value_take_object (value, interface);
32942 break;
32943
32944 case 17:
32945 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
32946 g_value_take_object (value, interface);
32947 break;
32948
32949 case 18:
32950 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
32951 g_value_take_object (value, interface);
32952 break;
32953
32954 case 19:
32955 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
32956 g_value_take_object (value, interface);
32957 break;
32958
32959 case 20:
32960 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
32961 g_value_take_object (value, interface);
32962 break;
32963
32964 default:
32965 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32966 break;
32967 }
32968 }
32969
32970 static void
object_proxy_class_init(ObjectProxyClass * klass)32971 object_proxy_class_init (ObjectProxyClass *klass)
32972 {
32973 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
32974
32975 gobject_class->set_property = object_proxy_set_property;
32976 gobject_class->get_property = object_proxy_get_property;
32977
32978 g_object_class_override_property (gobject_class, 1, "hwmon");
32979 g_object_class_override_property (gobject_class, 2, "fan");
32980 g_object_class_override_property (gobject_class, 3, "sensor-value");
32981 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
32982 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
32983 g_object_class_override_property (gobject_class, 6, "sensor-match");
32984 g_object_class_override_property (gobject_class, 7, "process");
32985 g_object_class_override_property (gobject_class, 8, "shared-resource");
32986 g_object_class_override_property (gobject_class, 9, "control");
32987 g_object_class_override_property (gobject_class, 10, "control-bmc");
32988 g_object_class_override_property (gobject_class, 11, "control-host");
32989 g_object_class_override_property (gobject_class, 12, "control-power");
32990 g_object_class_override_property (gobject_class, 13, "control-checkstop");
32991 g_object_class_override_property (gobject_class, 14, "watchdog");
32992 g_object_class_override_property (gobject_class, 15, "event-log");
32993 g_object_class_override_property (gobject_class, 16, "flash");
32994 g_object_class_override_property (gobject_class, 17, "flash-control");
32995 g_object_class_override_property (gobject_class, 18, "button");
32996 g_object_class_override_property (gobject_class, 19, "led");
32997 g_object_class_override_property (gobject_class, 20, "host-ipmi");
32998 }
32999
33000 /**
33001 * object_proxy_new:
33002 * @connection: A #GDBusConnection.
33003 * @object_path: An object path.
33004 *
33005 * Creates a new proxy object.
33006 *
33007 * Returns: (transfer full): The proxy object.
33008 */
33009 ObjectProxy *
object_proxy_new(GDBusConnection * connection,const gchar * object_path)33010 object_proxy_new (GDBusConnection *connection,
33011 const gchar *object_path)
33012 {
33013 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
33014 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
33015 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
33016 }
33017
33018 /**
33019 * ObjectSkeleton:
33020 *
33021 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
33022 */
33023
33024 /**
33025 * ObjectSkeletonClass:
33026 * @parent_class: The parent class.
33027 *
33028 * Class structure for #ObjectSkeleton.
33029 */
33030
33031 static void
object_skeleton__object_iface_init(ObjectIface * iface G_GNUC_UNUSED)33032 object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
33033 {
33034 }
33035
33036
33037 static void
object_skeleton__g_dbus_object_iface_init(GDBusObjectIface * iface)33038 object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
33039 {
33040 iface->interface_added = object_notify;
33041 iface->interface_removed = object_notify;
33042 }
33043
G_DEFINE_TYPE_WITH_CODE(ObjectSkeleton,object_skeleton,G_TYPE_DBUS_OBJECT_SKELETON,G_IMPLEMENT_INTERFACE (TYPE_OBJECT,object_skeleton__object_iface_init)G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT,object_skeleton__g_dbus_object_iface_init))33044 G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
33045 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
33046 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init))
33047
33048 static void
33049 object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
33050 {
33051 }
33052
33053 static void
object_skeleton_set_property(GObject * gobject,guint prop_id,const GValue * value,GParamSpec * pspec)33054 object_skeleton_set_property (GObject *gobject,
33055 guint prop_id,
33056 const GValue *value,
33057 GParamSpec *pspec)
33058 {
33059 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
33060 GDBusInterfaceSkeleton *interface;
33061
33062 switch (prop_id)
33063 {
33064 case 1:
33065 interface = g_value_get_object (value);
33066 if (interface != NULL)
33067 {
33068 g_warn_if_fail (IS_HWMON (interface));
33069 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33070 }
33071 else
33072 {
33073 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
33074 }
33075 break;
33076
33077 case 2:
33078 interface = g_value_get_object (value);
33079 if (interface != NULL)
33080 {
33081 g_warn_if_fail (IS_FAN (interface));
33082 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33083 }
33084 else
33085 {
33086 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
33087 }
33088 break;
33089
33090 case 3:
33091 interface = g_value_get_object (value);
33092 if (interface != NULL)
33093 {
33094 g_warn_if_fail (IS_SENSOR_VALUE (interface));
33095 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33096 }
33097 else
33098 {
33099 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
33100 }
33101 break;
33102
33103 case 4:
33104 interface = g_value_get_object (value);
33105 if (interface != NULL)
33106 {
33107 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
33108 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33109 }
33110 else
33111 {
33112 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
33113 }
33114 break;
33115
33116 case 5:
33117 interface = g_value_get_object (value);
33118 if (interface != NULL)
33119 {
33120 g_warn_if_fail (IS_SENSOR_I2C (interface));
33121 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33122 }
33123 else
33124 {
33125 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
33126 }
33127 break;
33128
33129 case 6:
33130 interface = g_value_get_object (value);
33131 if (interface != NULL)
33132 {
33133 g_warn_if_fail (IS_SENSOR_MATCH (interface));
33134 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33135 }
33136 else
33137 {
33138 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
33139 }
33140 break;
33141
33142 case 7:
33143 interface = g_value_get_object (value);
33144 if (interface != NULL)
33145 {
33146 g_warn_if_fail (IS_PROCESS (interface));
33147 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33148 }
33149 else
33150 {
33151 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
33152 }
33153 break;
33154
33155 case 8:
33156 interface = g_value_get_object (value);
33157 if (interface != NULL)
33158 {
33159 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
33160 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33161 }
33162 else
33163 {
33164 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
33165 }
33166 break;
33167
33168 case 9:
33169 interface = g_value_get_object (value);
33170 if (interface != NULL)
33171 {
33172 g_warn_if_fail (IS_CONTROL (interface));
33173 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33174 }
33175 else
33176 {
33177 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
33178 }
33179 break;
33180
33181 case 10:
33182 interface = g_value_get_object (value);
33183 if (interface != NULL)
33184 {
33185 g_warn_if_fail (IS_CONTROL_BMC (interface));
33186 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33187 }
33188 else
33189 {
33190 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
33191 }
33192 break;
33193
33194 case 11:
33195 interface = g_value_get_object (value);
33196 if (interface != NULL)
33197 {
33198 g_warn_if_fail (IS_CONTROL_HOST (interface));
33199 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33200 }
33201 else
33202 {
33203 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
33204 }
33205 break;
33206
33207 case 12:
33208 interface = g_value_get_object (value);
33209 if (interface != NULL)
33210 {
33211 g_warn_if_fail (IS_CONTROL_POWER (interface));
33212 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33213 }
33214 else
33215 {
33216 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
33217 }
33218 break;
33219
33220 case 13:
33221 interface = g_value_get_object (value);
33222 if (interface != NULL)
33223 {
33224 g_warn_if_fail (IS_CONTROL_CHECKSTOP (interface));
33225 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33226 }
33227 else
33228 {
33229 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Checkstop");
33230 }
33231 break;
33232
33233 case 14:
33234 interface = g_value_get_object (value);
33235 if (interface != NULL)
33236 {
33237 g_warn_if_fail (IS_WATCHDOG (interface));
33238 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33239 }
33240 else
33241 {
33242 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
33243 }
33244 break;
33245
33246 case 15:
33247 interface = g_value_get_object (value);
33248 if (interface != NULL)
33249 {
33250 g_warn_if_fail (IS_EVENT_LOG (interface));
33251 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33252 }
33253 else
33254 {
33255 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
33256 }
33257 break;
33258
33259 case 16:
33260 interface = g_value_get_object (value);
33261 if (interface != NULL)
33262 {
33263 g_warn_if_fail (IS_FLASH (interface));
33264 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33265 }
33266 else
33267 {
33268 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
33269 }
33270 break;
33271
33272 case 17:
33273 interface = g_value_get_object (value);
33274 if (interface != NULL)
33275 {
33276 g_warn_if_fail (IS_FLASH_CONTROL (interface));
33277 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33278 }
33279 else
33280 {
33281 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
33282 }
33283 break;
33284
33285 case 18:
33286 interface = g_value_get_object (value);
33287 if (interface != NULL)
33288 {
33289 g_warn_if_fail (IS_BUTTON (interface));
33290 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33291 }
33292 else
33293 {
33294 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
33295 }
33296 break;
33297
33298 case 19:
33299 interface = g_value_get_object (value);
33300 if (interface != NULL)
33301 {
33302 g_warn_if_fail (IS_LED (interface));
33303 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33304 }
33305 else
33306 {
33307 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
33308 }
33309 break;
33310
33311 case 20:
33312 interface = g_value_get_object (value);
33313 if (interface != NULL)
33314 {
33315 g_warn_if_fail (IS_HOST_IPMI (interface));
33316 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
33317 }
33318 else
33319 {
33320 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
33321 }
33322 break;
33323
33324 default:
33325 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
33326 break;
33327 }
33328 }
33329
33330 static void
object_skeleton_get_property(GObject * gobject,guint prop_id,GValue * value,GParamSpec * pspec)33331 object_skeleton_get_property (GObject *gobject,
33332 guint prop_id,
33333 GValue *value,
33334 GParamSpec *pspec)
33335 {
33336 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
33337 GDBusInterface *interface;
33338
33339 switch (prop_id)
33340 {
33341 case 1:
33342 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
33343 g_value_take_object (value, interface);
33344 break;
33345
33346 case 2:
33347 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
33348 g_value_take_object (value, interface);
33349 break;
33350
33351 case 3:
33352 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
33353 g_value_take_object (value, interface);
33354 break;
33355
33356 case 4:
33357 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
33358 g_value_take_object (value, interface);
33359 break;
33360
33361 case 5:
33362 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
33363 g_value_take_object (value, interface);
33364 break;
33365
33366 case 6:
33367 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
33368 g_value_take_object (value, interface);
33369 break;
33370
33371 case 7:
33372 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
33373 g_value_take_object (value, interface);
33374 break;
33375
33376 case 8:
33377 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
33378 g_value_take_object (value, interface);
33379 break;
33380
33381 case 9:
33382 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
33383 g_value_take_object (value, interface);
33384 break;
33385
33386 case 10:
33387 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
33388 g_value_take_object (value, interface);
33389 break;
33390
33391 case 11:
33392 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
33393 g_value_take_object (value, interface);
33394 break;
33395
33396 case 12:
33397 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
33398 g_value_take_object (value, interface);
33399 break;
33400
33401 case 13:
33402 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
33403 g_value_take_object (value, interface);
33404 break;
33405
33406 case 14:
33407 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
33408 g_value_take_object (value, interface);
33409 break;
33410
33411 case 15:
33412 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
33413 g_value_take_object (value, interface);
33414 break;
33415
33416 case 16:
33417 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
33418 g_value_take_object (value, interface);
33419 break;
33420
33421 case 17:
33422 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
33423 g_value_take_object (value, interface);
33424 break;
33425
33426 case 18:
33427 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
33428 g_value_take_object (value, interface);
33429 break;
33430
33431 case 19:
33432 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
33433 g_value_take_object (value, interface);
33434 break;
33435
33436 case 20:
33437 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
33438 g_value_take_object (value, interface);
33439 break;
33440
33441 default:
33442 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
33443 break;
33444 }
33445 }
33446
33447 static void
object_skeleton_class_init(ObjectSkeletonClass * klass)33448 object_skeleton_class_init (ObjectSkeletonClass *klass)
33449 {
33450 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
33451
33452 gobject_class->set_property = object_skeleton_set_property;
33453 gobject_class->get_property = object_skeleton_get_property;
33454
33455 g_object_class_override_property (gobject_class, 1, "hwmon");
33456 g_object_class_override_property (gobject_class, 2, "fan");
33457 g_object_class_override_property (gobject_class, 3, "sensor-value");
33458 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
33459 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
33460 g_object_class_override_property (gobject_class, 6, "sensor-match");
33461 g_object_class_override_property (gobject_class, 7, "process");
33462 g_object_class_override_property (gobject_class, 8, "shared-resource");
33463 g_object_class_override_property (gobject_class, 9, "control");
33464 g_object_class_override_property (gobject_class, 10, "control-bmc");
33465 g_object_class_override_property (gobject_class, 11, "control-host");
33466 g_object_class_override_property (gobject_class, 12, "control-power");
33467 g_object_class_override_property (gobject_class, 13, "control-checkstop");
33468 g_object_class_override_property (gobject_class, 14, "watchdog");
33469 g_object_class_override_property (gobject_class, 15, "event-log");
33470 g_object_class_override_property (gobject_class, 16, "flash");
33471 g_object_class_override_property (gobject_class, 17, "flash-control");
33472 g_object_class_override_property (gobject_class, 18, "button");
33473 g_object_class_override_property (gobject_class, 19, "led");
33474 g_object_class_override_property (gobject_class, 20, "host-ipmi");
33475 }
33476
33477 /**
33478 * object_skeleton_new:
33479 * @object_path: An object path.
33480 *
33481 * Creates a new skeleton object.
33482 *
33483 * Returns: (transfer full): The skeleton object.
33484 */
33485 ObjectSkeleton *
object_skeleton_new(const gchar * object_path)33486 object_skeleton_new (const gchar *object_path)
33487 {
33488 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
33489 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
33490 }
33491
33492 /**
33493 * object_skeleton_set_hwmon:
33494 * @object: A #ObjectSkeleton.
33495 * @interface_: (nullable): A #Hwmon or %NULL to clear the interface.
33496 *
33497 * Sets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object.
33498 */
object_skeleton_set_hwmon(ObjectSkeleton * object,Hwmon * interface_)33499 void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
33500 {
33501 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
33502 }
33503
33504 /**
33505 * object_skeleton_set_fan:
33506 * @object: A #ObjectSkeleton.
33507 * @interface_: (nullable): A #Fan or %NULL to clear the interface.
33508 *
33509 * Sets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object.
33510 */
object_skeleton_set_fan(ObjectSkeleton * object,Fan * interface_)33511 void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
33512 {
33513 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
33514 }
33515
33516 /**
33517 * object_skeleton_set_sensor_value:
33518 * @object: A #ObjectSkeleton.
33519 * @interface_: (nullable): A #SensorValue or %NULL to clear the interface.
33520 *
33521 * 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.
33522 */
object_skeleton_set_sensor_value(ObjectSkeleton * object,SensorValue * interface_)33523 void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
33524 {
33525 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
33526 }
33527
33528 /**
33529 * object_skeleton_set_sensor_threshold:
33530 * @object: A #ObjectSkeleton.
33531 * @interface_: (nullable): A #SensorThreshold or %NULL to clear the interface.
33532 *
33533 * 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.
33534 */
object_skeleton_set_sensor_threshold(ObjectSkeleton * object,SensorThreshold * interface_)33535 void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
33536 {
33537 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
33538 }
33539
33540 /**
33541 * object_skeleton_set_sensor_i2c:
33542 * @object: A #ObjectSkeleton.
33543 * @interface_: (nullable): A #SensorI2c or %NULL to clear the interface.
33544 *
33545 * 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.
33546 */
object_skeleton_set_sensor_i2c(ObjectSkeleton * object,SensorI2c * interface_)33547 void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
33548 {
33549 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
33550 }
33551
33552 /**
33553 * object_skeleton_set_sensor_match:
33554 * @object: A #ObjectSkeleton.
33555 * @interface_: (nullable): A #SensorMatch or %NULL to clear the interface.
33556 *
33557 * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object.
33558 */
object_skeleton_set_sensor_match(ObjectSkeleton * object,SensorMatch * interface_)33559 void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
33560 {
33561 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
33562 }
33563
33564 /**
33565 * object_skeleton_set_process:
33566 * @object: A #ObjectSkeleton.
33567 * @interface_: (nullable): A #Process or %NULL to clear the interface.
33568 *
33569 * Sets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object.
33570 */
object_skeleton_set_process(ObjectSkeleton * object,Process * interface_)33571 void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
33572 {
33573 g_object_set (G_OBJECT (object), "process", interface_, NULL);
33574 }
33575
33576 /**
33577 * object_skeleton_set_shared_resource:
33578 * @object: A #ObjectSkeleton.
33579 * @interface_: (nullable): A #SharedResource or %NULL to clear the interface.
33580 *
33581 * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object.
33582 */
object_skeleton_set_shared_resource(ObjectSkeleton * object,SharedResource * interface_)33583 void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
33584 {
33585 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
33586 }
33587
33588 /**
33589 * object_skeleton_set_control:
33590 * @object: A #ObjectSkeleton.
33591 * @interface_: (nullable): A #Control or %NULL to clear the interface.
33592 *
33593 * Sets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object.
33594 */
object_skeleton_set_control(ObjectSkeleton * object,Control * interface_)33595 void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
33596 {
33597 g_object_set (G_OBJECT (object), "control", interface_, NULL);
33598 }
33599
33600 /**
33601 * object_skeleton_set_control_bmc:
33602 * @object: A #ObjectSkeleton.
33603 * @interface_: (nullable): A #ControlBmc or %NULL to clear the interface.
33604 *
33605 * Sets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object.
33606 */
object_skeleton_set_control_bmc(ObjectSkeleton * object,ControlBmc * interface_)33607 void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
33608 {
33609 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
33610 }
33611
33612 /**
33613 * object_skeleton_set_control_host:
33614 * @object: A #ObjectSkeleton.
33615 * @interface_: (nullable): A #ControlHost or %NULL to clear the interface.
33616 *
33617 * Sets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object.
33618 */
object_skeleton_set_control_host(ObjectSkeleton * object,ControlHost * interface_)33619 void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
33620 {
33621 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
33622 }
33623
33624 /**
33625 * object_skeleton_set_control_power:
33626 * @object: A #ObjectSkeleton.
33627 * @interface_: (nullable): A #ControlPower or %NULL to clear the interface.
33628 *
33629 * Sets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object.
33630 */
object_skeleton_set_control_power(ObjectSkeleton * object,ControlPower * interface_)33631 void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
33632 {
33633 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
33634 }
33635
33636 /**
33637 * object_skeleton_set_control_checkstop:
33638 * @object: A #ObjectSkeleton.
33639 * @interface_: (nullable): A #ControlCheckstop or %NULL to clear the interface.
33640 *
33641 * Sets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object.
33642 */
object_skeleton_set_control_checkstop(ObjectSkeleton * object,ControlCheckstop * interface_)33643 void object_skeleton_set_control_checkstop (ObjectSkeleton *object, ControlCheckstop *interface_)
33644 {
33645 g_object_set (G_OBJECT (object), "control-checkstop", interface_, NULL);
33646 }
33647
33648 /**
33649 * object_skeleton_set_watchdog:
33650 * @object: A #ObjectSkeleton.
33651 * @interface_: (nullable): A #Watchdog or %NULL to clear the interface.
33652 *
33653 * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object.
33654 */
object_skeleton_set_watchdog(ObjectSkeleton * object,Watchdog * interface_)33655 void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
33656 {
33657 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
33658 }
33659
33660 /**
33661 * object_skeleton_set_event_log:
33662 * @object: A #ObjectSkeleton.
33663 * @interface_: (nullable): A #EventLog or %NULL to clear the interface.
33664 *
33665 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object.
33666 */
object_skeleton_set_event_log(ObjectSkeleton * object,EventLog * interface_)33667 void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
33668 {
33669 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
33670 }
33671
33672 /**
33673 * object_skeleton_set_flash:
33674 * @object: A #ObjectSkeleton.
33675 * @interface_: (nullable): A #Flash or %NULL to clear the interface.
33676 *
33677 * Sets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object.
33678 */
object_skeleton_set_flash(ObjectSkeleton * object,Flash * interface_)33679 void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
33680 {
33681 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
33682 }
33683
33684 /**
33685 * object_skeleton_set_flash_control:
33686 * @object: A #ObjectSkeleton.
33687 * @interface_: (nullable): A #FlashControl or %NULL to clear the interface.
33688 *
33689 * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object.
33690 */
object_skeleton_set_flash_control(ObjectSkeleton * object,FlashControl * interface_)33691 void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
33692 {
33693 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
33694 }
33695
33696 /**
33697 * object_skeleton_set_button:
33698 * @object: A #ObjectSkeleton.
33699 * @interface_: (nullable): A #Button or %NULL to clear the interface.
33700 *
33701 * Sets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object.
33702 */
object_skeleton_set_button(ObjectSkeleton * object,Button * interface_)33703 void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
33704 {
33705 g_object_set (G_OBJECT (object), "button", interface_, NULL);
33706 }
33707
33708 /**
33709 * object_skeleton_set_led:
33710 * @object: A #ObjectSkeleton.
33711 * @interface_: (nullable): A #Led or %NULL to clear the interface.
33712 *
33713 * Sets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object.
33714 */
object_skeleton_set_led(ObjectSkeleton * object,Led * interface_)33715 void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
33716 {
33717 g_object_set (G_OBJECT (object), "led", interface_, NULL);
33718 }
33719
33720 /**
33721 * object_skeleton_set_host_ipmi:
33722 * @object: A #ObjectSkeleton.
33723 * @interface_: (nullable): A #HostIpmi or %NULL to clear the interface.
33724 *
33725 * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object.
33726 */
object_skeleton_set_host_ipmi(ObjectSkeleton * object,HostIpmi * interface_)33727 void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
33728 {
33729 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
33730 }
33731
33732
33733 /* ------------------------------------------------------------------------
33734 * Code for ObjectManager client
33735 * ------------------------------------------------------------------------
33736 */
33737
33738 /**
33739 * SECTION:ObjectManagerClient
33740 * @title: ObjectManagerClient
33741 * @short_description: Generated GDBusObjectManagerClient type
33742 *
33743 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
33744 */
33745
33746 /**
33747 * ObjectManagerClient:
33748 *
33749 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
33750 */
33751
33752 /**
33753 * ObjectManagerClientClass:
33754 * @parent_class: The parent class.
33755 *
33756 * Class structure for #ObjectManagerClient.
33757 */
33758
G_DEFINE_TYPE(ObjectManagerClient,object_manager_client,G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)33759 G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)
33760
33761 static void
33762 object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
33763 {
33764 }
33765
33766 static void
object_manager_client_class_init(ObjectManagerClientClass * klass G_GNUC_UNUSED)33767 object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
33768 {
33769 }
33770
33771 /**
33772 * object_manager_client_get_proxy_type:
33773 * @manager: A #GDBusObjectManagerClient.
33774 * @object_path: The object path of the remote object (unused).
33775 * @interface_name: (nullable): Interface name of the remote object or %NULL to get the object proxy #GType.
33776 * @user_data: User data (unused).
33777 *
33778 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy derived and #GDBusProxy derived types.
33779 *
33780 * Returns: A #GDBusProxy derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
33781 */
33782 GType
object_manager_client_get_proxy_type(GDBusObjectManagerClient * manager G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,gpointer user_data G_GNUC_UNUSED)33783 object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
33784 {
33785 static gsize once_init_value = 0;
33786 static GHashTable *lookup_hash;
33787 GType ret;
33788
33789 if (interface_name == NULL)
33790 return TYPE_OBJECT_PROXY;
33791 if (g_once_init_enter (&once_init_value))
33792 {
33793 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
33794 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
33795 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
33796 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
33797 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
33798 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
33799 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
33800 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
33801 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
33802 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
33803 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
33804 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
33805 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
33806 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Checkstop", GSIZE_TO_POINTER (TYPE_CONTROL_CHECKSTOP_PROXY));
33807 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
33808 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
33809 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
33810 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
33811 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
33812 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
33813 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
33814 g_once_init_leave (&once_init_value, 1);
33815 }
33816 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
33817 if (ret == (GType) 0)
33818 ret = G_TYPE_DBUS_PROXY;
33819 return ret;
33820 }
33821
33822 /**
33823 * object_manager_client_new:
33824 * @connection: A #GDBusConnection.
33825 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33826 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
33827 * @object_path: An object path.
33828 * @cancellable: (nullable): A #GCancellable or %NULL.
33829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
33830 * @user_data: User data to pass to @callback.
33831 *
33832 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
33833 *
33834 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
33835 * You can then call object_manager_client_new_finish() to get the result of the operation.
33836 *
33837 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
33838 */
33839 void
object_manager_client_new(GDBusConnection * connection,GDBusObjectManagerClientFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)33840 object_manager_client_new (
33841 GDBusConnection *connection,
33842 GDBusObjectManagerClientFlags flags,
33843 const gchar *name,
33844 const gchar *object_path,
33845 GCancellable *cancellable,
33846 GAsyncReadyCallback callback,
33847 gpointer user_data)
33848 {
33849 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);
33850 }
33851
33852 /**
33853 * object_manager_client_new_finish:
33854 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
33855 * @error: Return location for error or %NULL
33856 *
33857 * Finishes an operation started with object_manager_client_new().
33858 *
33859 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33860 */
33861 GDBusObjectManager *
object_manager_client_new_finish(GAsyncResult * res,GError ** error)33862 object_manager_client_new_finish (
33863 GAsyncResult *res,
33864 GError **error)
33865 {
33866 GObject *ret;
33867 GObject *source_object;
33868 source_object = g_async_result_get_source_object (res);
33869 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
33870 g_object_unref (source_object);
33871 if (ret != NULL)
33872 return G_DBUS_OBJECT_MANAGER (ret);
33873 else
33874 return NULL;
33875 }
33876
33877 /**
33878 * object_manager_client_new_sync:
33879 * @connection: A #GDBusConnection.
33880 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33881 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
33882 * @object_path: An object path.
33883 * @cancellable: (nullable): A #GCancellable or %NULL.
33884 * @error: Return location for error or %NULL
33885 *
33886 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
33887 *
33888 * The calling thread is blocked until a reply is received.
33889 *
33890 * See object_manager_client_new() for the asynchronous version of this constructor.
33891 *
33892 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33893 */
33894 GDBusObjectManager *
object_manager_client_new_sync(GDBusConnection * connection,GDBusObjectManagerClientFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)33895 object_manager_client_new_sync (
33896 GDBusConnection *connection,
33897 GDBusObjectManagerClientFlags flags,
33898 const gchar *name,
33899 const gchar *object_path,
33900 GCancellable *cancellable,
33901 GError **error)
33902 {
33903 GInitable *ret;
33904 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);
33905 if (ret != NULL)
33906 return G_DBUS_OBJECT_MANAGER (ret);
33907 else
33908 return NULL;
33909 }
33910
33911
33912 /**
33913 * object_manager_client_new_for_bus:
33914 * @bus_type: A #GBusType.
33915 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33916 * @name: A bus name (well-known or unique).
33917 * @object_path: An object path.
33918 * @cancellable: (nullable): A #GCancellable or %NULL.
33919 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
33920 * @user_data: User data to pass to @callback.
33921 *
33922 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
33923 *
33924 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
33925 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
33926 *
33927 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
33928 */
33929 void
object_manager_client_new_for_bus(GBusType bus_type,GDBusObjectManagerClientFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)33930 object_manager_client_new_for_bus (
33931 GBusType bus_type,
33932 GDBusObjectManagerClientFlags flags,
33933 const gchar *name,
33934 const gchar *object_path,
33935 GCancellable *cancellable,
33936 GAsyncReadyCallback callback,
33937 gpointer user_data)
33938 {
33939 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);
33940 }
33941
33942 /**
33943 * object_manager_client_new_for_bus_finish:
33944 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
33945 * @error: Return location for error or %NULL
33946 *
33947 * Finishes an operation started with object_manager_client_new_for_bus().
33948 *
33949 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33950 */
33951 GDBusObjectManager *
object_manager_client_new_for_bus_finish(GAsyncResult * res,GError ** error)33952 object_manager_client_new_for_bus_finish (
33953 GAsyncResult *res,
33954 GError **error)
33955 {
33956 GObject *ret;
33957 GObject *source_object;
33958 source_object = g_async_result_get_source_object (res);
33959 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
33960 g_object_unref (source_object);
33961 if (ret != NULL)
33962 return G_DBUS_OBJECT_MANAGER (ret);
33963 else
33964 return NULL;
33965 }
33966
33967 /**
33968 * object_manager_client_new_for_bus_sync:
33969 * @bus_type: A #GBusType.
33970 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33971 * @name: A bus name (well-known or unique).
33972 * @object_path: An object path.
33973 * @cancellable: (nullable): A #GCancellable or %NULL.
33974 * @error: Return location for error or %NULL
33975 *
33976 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
33977 *
33978 * The calling thread is blocked until a reply is received.
33979 *
33980 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
33981 *
33982 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33983 */
33984 GDBusObjectManager *
object_manager_client_new_for_bus_sync(GBusType bus_type,GDBusObjectManagerClientFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)33985 object_manager_client_new_for_bus_sync (
33986 GBusType bus_type,
33987 GDBusObjectManagerClientFlags flags,
33988 const gchar *name,
33989 const gchar *object_path,
33990 GCancellable *cancellable,
33991 GError **error)
33992 {
33993 GInitable *ret;
33994 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);
33995 if (ret != NULL)
33996 return G_DBUS_OBJECT_MANAGER (ret);
33997 else
33998 return NULL;
33999 }
34000
34001
34002