/work/build/rauc-installer-generated.c
Line | Count | Source |
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 "rauc-installer-generated.h" |
14 | | |
15 | | #include <string.h> |
16 | | #ifdef G_OS_UNIX |
17 | | # include <gio/gunixfdlist.h> |
18 | | #endif |
19 | | |
20 | | typedef struct |
21 | | { |
22 | | GDBusArgInfo parent_struct; |
23 | | gboolean use_gvariant; |
24 | | } _ExtendedGDBusArgInfo; |
25 | | |
26 | | typedef struct |
27 | | { |
28 | | GDBusMethodInfo parent_struct; |
29 | | const gchar *signal_name; |
30 | | gboolean pass_fdlist; |
31 | | } _ExtendedGDBusMethodInfo; |
32 | | |
33 | | typedef struct |
34 | | { |
35 | | GDBusSignalInfo parent_struct; |
36 | | const gchar *signal_name; |
37 | | } _ExtendedGDBusSignalInfo; |
38 | | |
39 | | typedef struct |
40 | | { |
41 | | GDBusPropertyInfo parent_struct; |
42 | | const gchar *hyphen_name; |
43 | | guint use_gvariant : 1; |
44 | | guint emits_changed_signal : 1; |
45 | | } _ExtendedGDBusPropertyInfo; |
46 | | |
47 | | typedef struct |
48 | | { |
49 | | GDBusInterfaceInfo parent_struct; |
50 | | const gchar *hyphen_name; |
51 | | } _ExtendedGDBusInterfaceInfo; |
52 | | |
53 | | typedef struct |
54 | | { |
55 | | const _ExtendedGDBusPropertyInfo *info; |
56 | | guint prop_id; |
57 | | GValue orig_value; /* the value before the change */ |
58 | | } ChangedProperty; |
59 | | |
60 | | static void |
61 | | _changed_property_free (ChangedProperty *data) |
62 | 0 | { |
63 | 0 | g_value_unset (&data->orig_value); |
64 | 0 | g_free (data); |
65 | 0 | } |
66 | | |
67 | | static gboolean |
68 | | _g_strv_equal0 (gchar **a, gchar **b) |
69 | 0 | { |
70 | 0 | gboolean ret = FALSE; |
71 | 0 | guint n; |
72 | 0 | if (a == NULL && b == NULL) |
73 | 0 | { |
74 | 0 | ret = TRUE; |
75 | 0 | goto out; |
76 | 0 | } |
77 | 0 | if (a == NULL || b == NULL) |
78 | 0 | goto out; |
79 | 0 | if (g_strv_length (a) != g_strv_length (b)) |
80 | 0 | goto out; |
81 | 0 | for (n = 0; a[n] != NULL; n++) |
82 | 0 | if (g_strcmp0 (a[n], b[n]) != 0) |
83 | 0 | goto out; |
84 | 0 | ret = TRUE; |
85 | 0 | out: |
86 | 0 | return ret; |
87 | 0 | } |
88 | | |
89 | | static gboolean |
90 | | _g_variant_equal0 (GVariant *a, GVariant *b) |
91 | 0 | { |
92 | 0 | gboolean ret = FALSE; |
93 | 0 | if (a == NULL && b == NULL) |
94 | 0 | { |
95 | 0 | ret = TRUE; |
96 | 0 | goto out; |
97 | 0 | } |
98 | 0 | if (a == NULL || b == NULL) |
99 | 0 | goto out; |
100 | 0 | ret = g_variant_equal (a, b); |
101 | 0 | out: |
102 | 0 | return ret; |
103 | 0 | } |
104 | | |
105 | | G_GNUC_UNUSED static gboolean |
106 | | _g_value_equal (const GValue *a, const GValue *b) |
107 | 0 | { |
108 | 0 | gboolean ret = FALSE; |
109 | 0 | g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
110 | 0 | switch (G_VALUE_TYPE (a)) |
111 | 0 | { |
112 | 0 | case G_TYPE_BOOLEAN: |
113 | 0 | ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
114 | 0 | break; |
115 | 0 | case G_TYPE_UCHAR: |
116 | 0 | ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
117 | 0 | break; |
118 | 0 | case G_TYPE_INT: |
119 | 0 | ret = (g_value_get_int (a) == g_value_get_int (b)); |
120 | 0 | break; |
121 | 0 | case G_TYPE_UINT: |
122 | 0 | ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
123 | 0 | break; |
124 | 0 | case G_TYPE_INT64: |
125 | 0 | ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
126 | 0 | break; |
127 | 0 | case G_TYPE_UINT64: |
128 | 0 | ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
129 | 0 | break; |
130 | 0 | case G_TYPE_DOUBLE: |
131 | 0 | { |
132 | | /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
133 | 0 | gdouble da = g_value_get_double (a); |
134 | 0 | gdouble db = g_value_get_double (b); |
135 | 0 | ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
136 | 0 | } |
137 | 0 | break; |
138 | 0 | case G_TYPE_STRING: |
139 | 0 | ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
140 | 0 | break; |
141 | 0 | case G_TYPE_VARIANT: |
142 | 0 | ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
143 | 0 | break; |
144 | 0 | default: |
145 | 0 | if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
146 | 0 | ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
147 | 0 | else |
148 | 0 | g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
149 | 0 | break; |
150 | 0 | } |
151 | 0 | return ret; |
152 | 0 | } |
153 | | |
154 | | /* ------------------------------------------------------------------------ |
155 | | * Code for interface de.pengutronix.rauc.Installer |
156 | | * ------------------------------------------------------------------------ |
157 | | */ |
158 | | |
159 | | /** |
160 | | * SECTION:RInstaller |
161 | | * @title: RInstaller |
162 | | * @short_description: Generated C code for the de.pengutronix.rauc.Installer D-Bus interface |
163 | | * |
164 | | * This section contains code for working with the <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link> D-Bus interface in C. |
165 | | */ |
166 | | |
167 | | /* ---- Introspection data for de.pengutronix.rauc.Installer ---- */ |
168 | | |
169 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_install_IN_ARG_source = |
170 | | { |
171 | | { |
172 | | -1, |
173 | | (gchar *) "source", |
174 | | (gchar *) "s", |
175 | | NULL |
176 | | }, |
177 | | FALSE |
178 | | }; |
179 | | |
180 | | static const GDBusArgInfo * const _r_installer_method_info_install_IN_ARG_pointers[] = |
181 | | { |
182 | | &_r_installer_method_info_install_IN_ARG_source.parent_struct, |
183 | | NULL |
184 | | }; |
185 | | |
186 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_install = |
187 | | { |
188 | | { |
189 | | -1, |
190 | | (gchar *) "Install", |
191 | | (GDBusArgInfo **) &_r_installer_method_info_install_IN_ARG_pointers, |
192 | | NULL, |
193 | | NULL |
194 | | }, |
195 | | "handle-install", |
196 | | FALSE |
197 | | }; |
198 | | |
199 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_install_bundle_IN_ARG_source = |
200 | | { |
201 | | { |
202 | | -1, |
203 | | (gchar *) "source", |
204 | | (gchar *) "s", |
205 | | NULL |
206 | | }, |
207 | | FALSE |
208 | | }; |
209 | | |
210 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_install_bundle_IN_ARG_args = |
211 | | { |
212 | | { |
213 | | -1, |
214 | | (gchar *) "args", |
215 | | (gchar *) "a{sv}", |
216 | | NULL |
217 | | }, |
218 | | FALSE |
219 | | }; |
220 | | |
221 | | static const GDBusArgInfo * const _r_installer_method_info_install_bundle_IN_ARG_pointers[] = |
222 | | { |
223 | | &_r_installer_method_info_install_bundle_IN_ARG_source.parent_struct, |
224 | | &_r_installer_method_info_install_bundle_IN_ARG_args.parent_struct, |
225 | | NULL |
226 | | }; |
227 | | |
228 | | static const GDBusAnnotationInfo _r_installer_method_install_bundle_annotation_info_0 = |
229 | | { |
230 | | -1, |
231 | | (gchar *) "org.qtproject.QtDBus.QtTypeName.In1", |
232 | | (gchar *) "QVariantMap", |
233 | | NULL |
234 | | }; |
235 | | |
236 | | static const GDBusAnnotationInfo * const _r_installer_method_install_bundle_annotation_info_pointers[] = |
237 | | { |
238 | | &_r_installer_method_install_bundle_annotation_info_0, |
239 | | NULL |
240 | | }; |
241 | | |
242 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_install_bundle = |
243 | | { |
244 | | { |
245 | | -1, |
246 | | (gchar *) "InstallBundle", |
247 | | (GDBusArgInfo **) &_r_installer_method_info_install_bundle_IN_ARG_pointers, |
248 | | NULL, |
249 | | (GDBusAnnotationInfo **) &_r_installer_method_install_bundle_annotation_info_pointers |
250 | | }, |
251 | | "handle-install-bundle", |
252 | | FALSE |
253 | | }; |
254 | | |
255 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_info_IN_ARG_bundle = |
256 | | { |
257 | | { |
258 | | -1, |
259 | | (gchar *) "bundle", |
260 | | (gchar *) "s", |
261 | | NULL |
262 | | }, |
263 | | FALSE |
264 | | }; |
265 | | |
266 | | static const GDBusArgInfo * const _r_installer_method_info_info_IN_ARG_pointers[] = |
267 | | { |
268 | | &_r_installer_method_info_info_IN_ARG_bundle.parent_struct, |
269 | | NULL |
270 | | }; |
271 | | |
272 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_info_OUT_ARG_compatible = |
273 | | { |
274 | | { |
275 | | -1, |
276 | | (gchar *) "compatible", |
277 | | (gchar *) "s", |
278 | | NULL |
279 | | }, |
280 | | FALSE |
281 | | }; |
282 | | |
283 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_info_OUT_ARG_version = |
284 | | { |
285 | | { |
286 | | -1, |
287 | | (gchar *) "version", |
288 | | (gchar *) "s", |
289 | | NULL |
290 | | }, |
291 | | FALSE |
292 | | }; |
293 | | |
294 | | static const GDBusArgInfo * const _r_installer_method_info_info_OUT_ARG_pointers[] = |
295 | | { |
296 | | &_r_installer_method_info_info_OUT_ARG_compatible.parent_struct, |
297 | | &_r_installer_method_info_info_OUT_ARG_version.parent_struct, |
298 | | NULL |
299 | | }; |
300 | | |
301 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_info = |
302 | | { |
303 | | { |
304 | | -1, |
305 | | (gchar *) "Info", |
306 | | (GDBusArgInfo **) &_r_installer_method_info_info_IN_ARG_pointers, |
307 | | (GDBusArgInfo **) &_r_installer_method_info_info_OUT_ARG_pointers, |
308 | | NULL |
309 | | }, |
310 | | "handle-info", |
311 | | FALSE |
312 | | }; |
313 | | |
314 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_inspect_bundle_IN_ARG_source = |
315 | | { |
316 | | { |
317 | | -1, |
318 | | (gchar *) "source", |
319 | | (gchar *) "s", |
320 | | NULL |
321 | | }, |
322 | | FALSE |
323 | | }; |
324 | | |
325 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_inspect_bundle_IN_ARG_args = |
326 | | { |
327 | | { |
328 | | -1, |
329 | | (gchar *) "args", |
330 | | (gchar *) "a{sv}", |
331 | | NULL |
332 | | }, |
333 | | FALSE |
334 | | }; |
335 | | |
336 | | static const GDBusArgInfo * const _r_installer_method_info_inspect_bundle_IN_ARG_pointers[] = |
337 | | { |
338 | | &_r_installer_method_info_inspect_bundle_IN_ARG_source.parent_struct, |
339 | | &_r_installer_method_info_inspect_bundle_IN_ARG_args.parent_struct, |
340 | | NULL |
341 | | }; |
342 | | |
343 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_inspect_bundle_OUT_ARG_info = |
344 | | { |
345 | | { |
346 | | -1, |
347 | | (gchar *) "info", |
348 | | (gchar *) "a{sv}", |
349 | | NULL |
350 | | }, |
351 | | FALSE |
352 | | }; |
353 | | |
354 | | static const GDBusArgInfo * const _r_installer_method_info_inspect_bundle_OUT_ARG_pointers[] = |
355 | | { |
356 | | &_r_installer_method_info_inspect_bundle_OUT_ARG_info.parent_struct, |
357 | | NULL |
358 | | }; |
359 | | |
360 | | static const GDBusAnnotationInfo _r_installer_method_inspect_bundle_annotation_info_0 = |
361 | | { |
362 | | -1, |
363 | | (gchar *) "org.qtproject.QtDBus.QtTypeName.In1", |
364 | | (gchar *) "QVariantMap", |
365 | | NULL |
366 | | }; |
367 | | |
368 | | static const GDBusAnnotationInfo _r_installer_method_inspect_bundle_annotation_info_1 = |
369 | | { |
370 | | -1, |
371 | | (gchar *) "org.qtproject.QtDBus.QtTypeName.Out0", |
372 | | (gchar *) "QVariantMap", |
373 | | NULL |
374 | | }; |
375 | | |
376 | | static const GDBusAnnotationInfo * const _r_installer_method_inspect_bundle_annotation_info_pointers[] = |
377 | | { |
378 | | &_r_installer_method_inspect_bundle_annotation_info_0, |
379 | | &_r_installer_method_inspect_bundle_annotation_info_1, |
380 | | NULL |
381 | | }; |
382 | | |
383 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_inspect_bundle = |
384 | | { |
385 | | { |
386 | | -1, |
387 | | (gchar *) "InspectBundle", |
388 | | (GDBusArgInfo **) &_r_installer_method_info_inspect_bundle_IN_ARG_pointers, |
389 | | (GDBusArgInfo **) &_r_installer_method_info_inspect_bundle_OUT_ARG_pointers, |
390 | | (GDBusAnnotationInfo **) &_r_installer_method_inspect_bundle_annotation_info_pointers |
391 | | }, |
392 | | "handle-inspect-bundle", |
393 | | FALSE |
394 | | }; |
395 | | |
396 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_mark_IN_ARG_state = |
397 | | { |
398 | | { |
399 | | -1, |
400 | | (gchar *) "state", |
401 | | (gchar *) "s", |
402 | | NULL |
403 | | }, |
404 | | FALSE |
405 | | }; |
406 | | |
407 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_mark_IN_ARG_slot_identifier = |
408 | | { |
409 | | { |
410 | | -1, |
411 | | (gchar *) "slot_identifier", |
412 | | (gchar *) "s", |
413 | | NULL |
414 | | }, |
415 | | FALSE |
416 | | }; |
417 | | |
418 | | static const GDBusArgInfo * const _r_installer_method_info_mark_IN_ARG_pointers[] = |
419 | | { |
420 | | &_r_installer_method_info_mark_IN_ARG_state.parent_struct, |
421 | | &_r_installer_method_info_mark_IN_ARG_slot_identifier.parent_struct, |
422 | | NULL |
423 | | }; |
424 | | |
425 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_mark_OUT_ARG_slot_name = |
426 | | { |
427 | | { |
428 | | -1, |
429 | | (gchar *) "slot_name", |
430 | | (gchar *) "s", |
431 | | NULL |
432 | | }, |
433 | | FALSE |
434 | | }; |
435 | | |
436 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_mark_OUT_ARG_message = |
437 | | { |
438 | | { |
439 | | -1, |
440 | | (gchar *) "message", |
441 | | (gchar *) "s", |
442 | | NULL |
443 | | }, |
444 | | FALSE |
445 | | }; |
446 | | |
447 | | static const GDBusArgInfo * const _r_installer_method_info_mark_OUT_ARG_pointers[] = |
448 | | { |
449 | | &_r_installer_method_info_mark_OUT_ARG_slot_name.parent_struct, |
450 | | &_r_installer_method_info_mark_OUT_ARG_message.parent_struct, |
451 | | NULL |
452 | | }; |
453 | | |
454 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_mark = |
455 | | { |
456 | | { |
457 | | -1, |
458 | | (gchar *) "Mark", |
459 | | (GDBusArgInfo **) &_r_installer_method_info_mark_IN_ARG_pointers, |
460 | | (GDBusArgInfo **) &_r_installer_method_info_mark_OUT_ARG_pointers, |
461 | | NULL |
462 | | }, |
463 | | "handle-mark", |
464 | | FALSE |
465 | | }; |
466 | | |
467 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_get_slot_status_OUT_ARG_slot_status_array = |
468 | | { |
469 | | { |
470 | | -1, |
471 | | (gchar *) "slot_status_array", |
472 | | (gchar *) "a(sa{sv})", |
473 | | NULL |
474 | | }, |
475 | | FALSE |
476 | | }; |
477 | | |
478 | | static const GDBusArgInfo * const _r_installer_method_info_get_slot_status_OUT_ARG_pointers[] = |
479 | | { |
480 | | &_r_installer_method_info_get_slot_status_OUT_ARG_slot_status_array.parent_struct, |
481 | | NULL |
482 | | }; |
483 | | |
484 | | static const GDBusAnnotationInfo _r_installer_method_get_slot_status_annotation_info_0 = |
485 | | { |
486 | | -1, |
487 | | (gchar *) "org.qtproject.QtDBus.QtTypeName.Out0", |
488 | | (gchar *) "RaucSlotStatusArray", |
489 | | NULL |
490 | | }; |
491 | | |
492 | | static const GDBusAnnotationInfo * const _r_installer_method_get_slot_status_annotation_info_pointers[] = |
493 | | { |
494 | | &_r_installer_method_get_slot_status_annotation_info_0, |
495 | | NULL |
496 | | }; |
497 | | |
498 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_get_slot_status = |
499 | | { |
500 | | { |
501 | | -1, |
502 | | (gchar *) "GetSlotStatus", |
503 | | NULL, |
504 | | (GDBusArgInfo **) &_r_installer_method_info_get_slot_status_OUT_ARG_pointers, |
505 | | (GDBusAnnotationInfo **) &_r_installer_method_get_slot_status_annotation_info_pointers |
506 | | }, |
507 | | "handle-get-slot-status", |
508 | | FALSE |
509 | | }; |
510 | | |
511 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_get_artifact_status_OUT_ARG_artifacts = |
512 | | { |
513 | | { |
514 | | -1, |
515 | | (gchar *) "artifacts", |
516 | | (gchar *) "aa{sv}", |
517 | | NULL |
518 | | }, |
519 | | FALSE |
520 | | }; |
521 | | |
522 | | static const GDBusArgInfo * const _r_installer_method_info_get_artifact_status_OUT_ARG_pointers[] = |
523 | | { |
524 | | &_r_installer_method_info_get_artifact_status_OUT_ARG_artifacts.parent_struct, |
525 | | NULL |
526 | | }; |
527 | | |
528 | | static const GDBusAnnotationInfo _r_installer_method_get_artifact_status_annotation_info_0 = |
529 | | { |
530 | | -1, |
531 | | (gchar *) "org.qtproject.QtDBus.QtTypeName.Out0", |
532 | | (gchar *) "QList<QVariantMap>", |
533 | | NULL |
534 | | }; |
535 | | |
536 | | static const GDBusAnnotationInfo * const _r_installer_method_get_artifact_status_annotation_info_pointers[] = |
537 | | { |
538 | | &_r_installer_method_get_artifact_status_annotation_info_0, |
539 | | NULL |
540 | | }; |
541 | | |
542 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_get_artifact_status = |
543 | | { |
544 | | { |
545 | | -1, |
546 | | (gchar *) "GetArtifactStatus", |
547 | | NULL, |
548 | | (GDBusArgInfo **) &_r_installer_method_info_get_artifact_status_OUT_ARG_pointers, |
549 | | (GDBusAnnotationInfo **) &_r_installer_method_get_artifact_status_annotation_info_pointers |
550 | | }, |
551 | | "handle-get-artifact-status", |
552 | | FALSE |
553 | | }; |
554 | | |
555 | | static const _ExtendedGDBusArgInfo _r_installer_method_info_get_primary_OUT_ARG_primary = |
556 | | { |
557 | | { |
558 | | -1, |
559 | | (gchar *) "primary", |
560 | | (gchar *) "s", |
561 | | NULL |
562 | | }, |
563 | | FALSE |
564 | | }; |
565 | | |
566 | | static const GDBusArgInfo * const _r_installer_method_info_get_primary_OUT_ARG_pointers[] = |
567 | | { |
568 | | &_r_installer_method_info_get_primary_OUT_ARG_primary.parent_struct, |
569 | | NULL |
570 | | }; |
571 | | |
572 | | static const _ExtendedGDBusMethodInfo _r_installer_method_info_get_primary = |
573 | | { |
574 | | { |
575 | | -1, |
576 | | (gchar *) "GetPrimary", |
577 | | NULL, |
578 | | (GDBusArgInfo **) &_r_installer_method_info_get_primary_OUT_ARG_pointers, |
579 | | NULL |
580 | | }, |
581 | | "handle-get-primary", |
582 | | FALSE |
583 | | }; |
584 | | |
585 | | static const GDBusMethodInfo * const _r_installer_method_info_pointers[] = |
586 | | { |
587 | | &_r_installer_method_info_install.parent_struct, |
588 | | &_r_installer_method_info_install_bundle.parent_struct, |
589 | | &_r_installer_method_info_info.parent_struct, |
590 | | &_r_installer_method_info_inspect_bundle.parent_struct, |
591 | | &_r_installer_method_info_mark.parent_struct, |
592 | | &_r_installer_method_info_get_slot_status.parent_struct, |
593 | | &_r_installer_method_info_get_artifact_status.parent_struct, |
594 | | &_r_installer_method_info_get_primary.parent_struct, |
595 | | NULL |
596 | | }; |
597 | | |
598 | | static const _ExtendedGDBusArgInfo _r_installer_signal_info_completed_ARG_result = |
599 | | { |
600 | | { |
601 | | -1, |
602 | | (gchar *) "result", |
603 | | (gchar *) "i", |
604 | | NULL |
605 | | }, |
606 | | FALSE |
607 | | }; |
608 | | |
609 | | static const GDBusArgInfo * const _r_installer_signal_info_completed_ARG_pointers[] = |
610 | | { |
611 | | &_r_installer_signal_info_completed_ARG_result.parent_struct, |
612 | | NULL |
613 | | }; |
614 | | |
615 | | static const _ExtendedGDBusSignalInfo _r_installer_signal_info_completed = |
616 | | { |
617 | | { |
618 | | -1, |
619 | | (gchar *) "Completed", |
620 | | (GDBusArgInfo **) &_r_installer_signal_info_completed_ARG_pointers, |
621 | | NULL |
622 | | }, |
623 | | "completed" |
624 | | }; |
625 | | |
626 | | static const GDBusSignalInfo * const _r_installer_signal_info_pointers[] = |
627 | | { |
628 | | &_r_installer_signal_info_completed.parent_struct, |
629 | | NULL |
630 | | }; |
631 | | |
632 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_operation = |
633 | | { |
634 | | { |
635 | | -1, |
636 | | (gchar *) "Operation", |
637 | | (gchar *) "s", |
638 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
639 | | NULL |
640 | | }, |
641 | | "operation", |
642 | | FALSE, |
643 | | TRUE |
644 | | }; |
645 | | |
646 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_last_error = |
647 | | { |
648 | | { |
649 | | -1, |
650 | | (gchar *) "LastError", |
651 | | (gchar *) "s", |
652 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
653 | | NULL |
654 | | }, |
655 | | "last-error", |
656 | | FALSE, |
657 | | TRUE |
658 | | }; |
659 | | |
660 | | static const GDBusAnnotationInfo _r_installer_property_progress_annotation_info_0 = |
661 | | { |
662 | | -1, |
663 | | (gchar *) "org.qtproject.QtDBus.QtTypeName", |
664 | | (gchar *) "RaucProgress", |
665 | | NULL |
666 | | }; |
667 | | |
668 | | static const GDBusAnnotationInfo * const _r_installer_property_progress_annotation_info_pointers[] = |
669 | | { |
670 | | &_r_installer_property_progress_annotation_info_0, |
671 | | NULL |
672 | | }; |
673 | | |
674 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_progress = |
675 | | { |
676 | | { |
677 | | -1, |
678 | | (gchar *) "Progress", |
679 | | (gchar *) "(isi)", |
680 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
681 | | (GDBusAnnotationInfo **) &_r_installer_property_progress_annotation_info_pointers |
682 | | }, |
683 | | "progress", |
684 | | FALSE, |
685 | | TRUE |
686 | | }; |
687 | | |
688 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_compatible = |
689 | | { |
690 | | { |
691 | | -1, |
692 | | (gchar *) "Compatible", |
693 | | (gchar *) "s", |
694 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
695 | | NULL |
696 | | }, |
697 | | "compatible", |
698 | | FALSE, |
699 | | TRUE |
700 | | }; |
701 | | |
702 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_variant = |
703 | | { |
704 | | { |
705 | | -1, |
706 | | (gchar *) "Variant", |
707 | | (gchar *) "s", |
708 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
709 | | NULL |
710 | | }, |
711 | | "variant", |
712 | | FALSE, |
713 | | TRUE |
714 | | }; |
715 | | |
716 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_system_version = |
717 | | { |
718 | | { |
719 | | -1, |
720 | | (gchar *) "SystemVersion", |
721 | | (gchar *) "s", |
722 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
723 | | NULL |
724 | | }, |
725 | | "system-version", |
726 | | FALSE, |
727 | | TRUE |
728 | | }; |
729 | | |
730 | | static const _ExtendedGDBusPropertyInfo _r_installer_property_info_boot_slot = |
731 | | { |
732 | | { |
733 | | -1, |
734 | | (gchar *) "BootSlot", |
735 | | (gchar *) "s", |
736 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
737 | | NULL |
738 | | }, |
739 | | "boot-slot", |
740 | | FALSE, |
741 | | TRUE |
742 | | }; |
743 | | |
744 | | static const GDBusPropertyInfo * const _r_installer_property_info_pointers[] = |
745 | | { |
746 | | &_r_installer_property_info_operation.parent_struct, |
747 | | &_r_installer_property_info_last_error.parent_struct, |
748 | | &_r_installer_property_info_progress.parent_struct, |
749 | | &_r_installer_property_info_compatible.parent_struct, |
750 | | &_r_installer_property_info_variant.parent_struct, |
751 | | &_r_installer_property_info_system_version.parent_struct, |
752 | | &_r_installer_property_info_boot_slot.parent_struct, |
753 | | NULL |
754 | | }; |
755 | | |
756 | | static const _ExtendedGDBusInterfaceInfo _r_installer_interface_info = |
757 | | { |
758 | | { |
759 | | -1, |
760 | | (gchar *) "de.pengutronix.rauc.Installer", |
761 | | (GDBusMethodInfo **) &_r_installer_method_info_pointers, |
762 | | (GDBusSignalInfo **) &_r_installer_signal_info_pointers, |
763 | | (GDBusPropertyInfo **) &_r_installer_property_info_pointers, |
764 | | NULL |
765 | | }, |
766 | | "installer", |
767 | | }; |
768 | | |
769 | | |
770 | | /** |
771 | | * r_installer_interface_info: |
772 | | * |
773 | | * Gets a machine-readable description of the <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link> D-Bus interface. |
774 | | * |
775 | | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
776 | | */ |
777 | | GDBusInterfaceInfo * |
778 | | r_installer_interface_info (void) |
779 | 0 | { |
780 | 0 | return (GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct; |
781 | 0 | } |
782 | | |
783 | | /** |
784 | | * r_installer_override_properties: |
785 | | * @klass: The class structure for a #GObject derived class. |
786 | | * @property_id_begin: The property id to assign to the first overridden property. |
787 | | * |
788 | | * Overrides all #GObject properties in the #RInstaller interface for a concrete class. |
789 | | * The properties are overridden in the order they are defined. |
790 | | * |
791 | | * Returns: The last property id. |
792 | | */ |
793 | | guint |
794 | | r_installer_override_properties (GObjectClass *klass, guint property_id_begin) |
795 | 0 | { |
796 | 0 | g_object_class_override_property (klass, property_id_begin++, "operation"); |
797 | 0 | g_object_class_override_property (klass, property_id_begin++, "last-error"); |
798 | 0 | g_object_class_override_property (klass, property_id_begin++, "progress"); |
799 | 0 | g_object_class_override_property (klass, property_id_begin++, "compatible"); |
800 | 0 | g_object_class_override_property (klass, property_id_begin++, "variant"); |
801 | 0 | g_object_class_override_property (klass, property_id_begin++, "system-version"); |
802 | 0 | g_object_class_override_property (klass, property_id_begin++, "boot-slot"); |
803 | 0 | return property_id_begin - 1; |
804 | 0 | } |
805 | | |
806 | | |
807 | | |
808 | | /** |
809 | | * RInstaller: |
810 | | * |
811 | | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link>. |
812 | | */ |
813 | | |
814 | | /** |
815 | | * RInstallerIface: |
816 | | * @parent_iface: The parent interface. |
817 | | * @handle_get_artifact_status: Handler for the #RInstaller::handle-get-artifact-status signal. |
818 | | * @handle_get_primary: Handler for the #RInstaller::handle-get-primary signal. |
819 | | * @handle_get_slot_status: Handler for the #RInstaller::handle-get-slot-status signal. |
820 | | * @handle_info: Handler for the #RInstaller::handle-info signal. |
821 | | * @handle_inspect_bundle: Handler for the #RInstaller::handle-inspect-bundle signal. |
822 | | * @handle_install: Handler for the #RInstaller::handle-install signal. |
823 | | * @handle_install_bundle: Handler for the #RInstaller::handle-install-bundle signal. |
824 | | * @handle_mark: Handler for the #RInstaller::handle-mark signal. |
825 | | * @get_boot_slot: Getter for the #RInstaller:boot-slot property. |
826 | | * @get_compatible: Getter for the #RInstaller:compatible property. |
827 | | * @get_last_error: Getter for the #RInstaller:last-error property. |
828 | | * @get_operation: Getter for the #RInstaller:operation property. |
829 | | * @get_progress: Getter for the #RInstaller:progress property. |
830 | | * @get_system_version: Getter for the #RInstaller:system-version property. |
831 | | * @get_variant: Getter for the #RInstaller:variant property. |
832 | | * @completed: Handler for the #RInstaller::completed signal. |
833 | | * |
834 | | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link>. |
835 | | */ |
836 | | |
837 | | typedef RInstallerIface RInstallerInterface; |
838 | 0 | G_DEFINE_INTERFACE (RInstaller, r_installer, G_TYPE_OBJECT) |
839 | 0 |
|
840 | 0 | static void |
841 | 0 | r_installer_default_init (RInstallerIface *iface) |
842 | 0 | { |
843 | | /* GObject signals for incoming D-Bus method calls: */ |
844 | | /** |
845 | | * RInstaller::handle-install: |
846 | | * @object: A #RInstaller. |
847 | | * @invocation: A #GDBusMethodInvocation. |
848 | | * @arg_source: Argument passed by remote caller. |
849 | | * |
850 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Install">Install()</link> D-Bus method. |
851 | | * |
852 | | * 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 r_installer_complete_install() 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. |
853 | | * |
854 | | * 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. |
855 | | */ |
856 | 0 | g_signal_new ("handle-install", |
857 | 0 | G_TYPE_FROM_INTERFACE (iface), |
858 | 0 | G_SIGNAL_RUN_LAST, |
859 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_install), |
860 | 0 | g_signal_accumulator_true_handled, |
861 | 0 | NULL, |
862 | 0 | g_cclosure_marshal_generic, |
863 | 0 | G_TYPE_BOOLEAN, |
864 | 0 | 2, |
865 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
866 | | |
867 | | /** |
868 | | * RInstaller::handle-install-bundle: |
869 | | * @object: A #RInstaller. |
870 | | * @invocation: A #GDBusMethodInvocation. |
871 | | * @arg_source: Argument passed by remote caller. |
872 | | * @arg_args: Argument passed by remote caller. |
873 | | * |
874 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InstallBundle">InstallBundle()</link> D-Bus method. |
875 | | * |
876 | | * 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 r_installer_complete_install_bundle() 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. |
877 | | * |
878 | | * 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. |
879 | | */ |
880 | 0 | g_signal_new ("handle-install-bundle", |
881 | 0 | G_TYPE_FROM_INTERFACE (iface), |
882 | 0 | G_SIGNAL_RUN_LAST, |
883 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_install_bundle), |
884 | 0 | g_signal_accumulator_true_handled, |
885 | 0 | NULL, |
886 | 0 | g_cclosure_marshal_generic, |
887 | 0 | G_TYPE_BOOLEAN, |
888 | 0 | 3, |
889 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); |
890 | | |
891 | | /** |
892 | | * RInstaller::handle-info: |
893 | | * @object: A #RInstaller. |
894 | | * @invocation: A #GDBusMethodInvocation. |
895 | | * @arg_bundle: Argument passed by remote caller. |
896 | | * |
897 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Info">Info()</link> D-Bus method. |
898 | | * |
899 | | * 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 r_installer_complete_info() 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. |
900 | | * |
901 | | * 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. |
902 | | */ |
903 | 0 | g_signal_new ("handle-info", |
904 | 0 | G_TYPE_FROM_INTERFACE (iface), |
905 | 0 | G_SIGNAL_RUN_LAST, |
906 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_info), |
907 | 0 | g_signal_accumulator_true_handled, |
908 | 0 | NULL, |
909 | 0 | g_cclosure_marshal_generic, |
910 | 0 | G_TYPE_BOOLEAN, |
911 | 0 | 2, |
912 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
913 | | |
914 | | /** |
915 | | * RInstaller::handle-inspect-bundle: |
916 | | * @object: A #RInstaller. |
917 | | * @invocation: A #GDBusMethodInvocation. |
918 | | * @arg_source: Argument passed by remote caller. |
919 | | * @arg_args: Argument passed by remote caller. |
920 | | * |
921 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InspectBundle">InspectBundle()</link> D-Bus method. |
922 | | * |
923 | | * 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 r_installer_complete_inspect_bundle() 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. |
924 | | * |
925 | | * 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. |
926 | | */ |
927 | 0 | g_signal_new ("handle-inspect-bundle", |
928 | 0 | G_TYPE_FROM_INTERFACE (iface), |
929 | 0 | G_SIGNAL_RUN_LAST, |
930 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_inspect_bundle), |
931 | 0 | g_signal_accumulator_true_handled, |
932 | 0 | NULL, |
933 | 0 | g_cclosure_marshal_generic, |
934 | 0 | G_TYPE_BOOLEAN, |
935 | 0 | 3, |
936 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); |
937 | | |
938 | | /** |
939 | | * RInstaller::handle-mark: |
940 | | * @object: A #RInstaller. |
941 | | * @invocation: A #GDBusMethodInvocation. |
942 | | * @arg_state: Argument passed by remote caller. |
943 | | * @arg_slot_identifier: Argument passed by remote caller. |
944 | | * |
945 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Mark">Mark()</link> D-Bus method. |
946 | | * |
947 | | * 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 r_installer_complete_mark() 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. |
948 | | * |
949 | | * 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. |
950 | | */ |
951 | 0 | g_signal_new ("handle-mark", |
952 | 0 | G_TYPE_FROM_INTERFACE (iface), |
953 | 0 | G_SIGNAL_RUN_LAST, |
954 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_mark), |
955 | 0 | g_signal_accumulator_true_handled, |
956 | 0 | NULL, |
957 | 0 | g_cclosure_marshal_generic, |
958 | 0 | G_TYPE_BOOLEAN, |
959 | 0 | 3, |
960 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
961 | | |
962 | | /** |
963 | | * RInstaller::handle-get-slot-status: |
964 | | * @object: A #RInstaller. |
965 | | * @invocation: A #GDBusMethodInvocation. |
966 | | * |
967 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetSlotStatus">GetSlotStatus()</link> D-Bus method. |
968 | | * |
969 | | * 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 r_installer_complete_get_slot_status() 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. |
970 | | * |
971 | | * 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. |
972 | | */ |
973 | 0 | g_signal_new ("handle-get-slot-status", |
974 | 0 | G_TYPE_FROM_INTERFACE (iface), |
975 | 0 | G_SIGNAL_RUN_LAST, |
976 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_get_slot_status), |
977 | 0 | g_signal_accumulator_true_handled, |
978 | 0 | NULL, |
979 | 0 | g_cclosure_marshal_generic, |
980 | 0 | G_TYPE_BOOLEAN, |
981 | 0 | 1, |
982 | 0 | G_TYPE_DBUS_METHOD_INVOCATION); |
983 | | |
984 | | /** |
985 | | * RInstaller::handle-get-artifact-status: |
986 | | * @object: A #RInstaller. |
987 | | * @invocation: A #GDBusMethodInvocation. |
988 | | * |
989 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetArtifactStatus">GetArtifactStatus()</link> D-Bus method. |
990 | | * |
991 | | * 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 r_installer_complete_get_artifact_status() 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. |
992 | | * |
993 | | * 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. |
994 | | */ |
995 | 0 | g_signal_new ("handle-get-artifact-status", |
996 | 0 | G_TYPE_FROM_INTERFACE (iface), |
997 | 0 | G_SIGNAL_RUN_LAST, |
998 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_get_artifact_status), |
999 | 0 | g_signal_accumulator_true_handled, |
1000 | 0 | NULL, |
1001 | 0 | g_cclosure_marshal_generic, |
1002 | 0 | G_TYPE_BOOLEAN, |
1003 | 0 | 1, |
1004 | 0 | G_TYPE_DBUS_METHOD_INVOCATION); |
1005 | | |
1006 | | /** |
1007 | | * RInstaller::handle-get-primary: |
1008 | | * @object: A #RInstaller. |
1009 | | * @invocation: A #GDBusMethodInvocation. |
1010 | | * |
1011 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetPrimary">GetPrimary()</link> D-Bus method. |
1012 | | * |
1013 | | * 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 r_installer_complete_get_primary() 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. |
1014 | | * |
1015 | | * 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. |
1016 | | */ |
1017 | 0 | g_signal_new ("handle-get-primary", |
1018 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1019 | 0 | G_SIGNAL_RUN_LAST, |
1020 | 0 | G_STRUCT_OFFSET (RInstallerIface, handle_get_primary), |
1021 | 0 | g_signal_accumulator_true_handled, |
1022 | 0 | NULL, |
1023 | 0 | g_cclosure_marshal_generic, |
1024 | 0 | G_TYPE_BOOLEAN, |
1025 | 0 | 1, |
1026 | 0 | G_TYPE_DBUS_METHOD_INVOCATION); |
1027 | | |
1028 | | /* GObject signals for received D-Bus signals: */ |
1029 | | /** |
1030 | | * RInstaller::completed: |
1031 | | * @object: A #RInstaller. |
1032 | | * @arg_result: Argument. |
1033 | | * |
1034 | | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-de-pengutronix-rauc-Installer.Completed">"Completed"</link> is received. |
1035 | | * |
1036 | | * 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. |
1037 | | */ |
1038 | 0 | g_signal_new ("completed", |
1039 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1040 | 0 | G_SIGNAL_RUN_LAST, |
1041 | 0 | G_STRUCT_OFFSET (RInstallerIface, completed), |
1042 | 0 | NULL, |
1043 | 0 | NULL, |
1044 | 0 | g_cclosure_marshal_generic, |
1045 | 0 | G_TYPE_NONE, |
1046 | 0 | 1, G_TYPE_INT); |
1047 | | |
1048 | | /* GObject properties for D-Bus properties: */ |
1049 | | /** |
1050 | | * RInstaller:operation: |
1051 | | * |
1052 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Operation">"Operation"</link>. |
1053 | | * |
1054 | | * 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. |
1055 | | */ |
1056 | 0 | g_object_interface_install_property (iface, |
1057 | 0 | g_param_spec_string ("operation", "Operation", "Operation", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1058 | | /** |
1059 | | * RInstaller:last-error: |
1060 | | * |
1061 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.LastError">"LastError"</link>. |
1062 | | * |
1063 | | * 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. |
1064 | | */ |
1065 | 0 | g_object_interface_install_property (iface, |
1066 | 0 | g_param_spec_string ("last-error", "LastError", "LastError", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1067 | | /** |
1068 | | * RInstaller:progress: |
1069 | | * |
1070 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Progress">"Progress"</link>. |
1071 | | * |
1072 | | * 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. |
1073 | | */ |
1074 | 0 | g_object_interface_install_property (iface, |
1075 | 0 | g_param_spec_variant ("progress", "Progress", "Progress", G_VARIANT_TYPE ("(isi)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1076 | | /** |
1077 | | * RInstaller:compatible: |
1078 | | * |
1079 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Compatible">"Compatible"</link>. |
1080 | | * |
1081 | | * 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. |
1082 | | */ |
1083 | 0 | g_object_interface_install_property (iface, |
1084 | 0 | g_param_spec_string ("compatible", "Compatible", "Compatible", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1085 | | /** |
1086 | | * RInstaller:variant: |
1087 | | * |
1088 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Variant">"Variant"</link>. |
1089 | | * |
1090 | | * 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. |
1091 | | */ |
1092 | 0 | g_object_interface_install_property (iface, |
1093 | 0 | g_param_spec_string ("variant", "Variant", "Variant", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1094 | | /** |
1095 | | * RInstaller:system-version: |
1096 | | * |
1097 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.SystemVersion">"SystemVersion"</link>. |
1098 | | * |
1099 | | * 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. |
1100 | | */ |
1101 | 0 | g_object_interface_install_property (iface, |
1102 | 0 | g_param_spec_string ("system-version", "SystemVersion", "SystemVersion", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1103 | | /** |
1104 | | * RInstaller:boot-slot: |
1105 | | * |
1106 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Installer.BootSlot">"BootSlot"</link>. |
1107 | | * |
1108 | | * 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. |
1109 | | */ |
1110 | 0 | g_object_interface_install_property (iface, |
1111 | 0 | g_param_spec_string ("boot-slot", "BootSlot", "BootSlot", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1112 | 0 | } |
1113 | | |
1114 | | /** |
1115 | | * r_installer_get_operation: (skip) |
1116 | | * @object: A #RInstaller. |
1117 | | * |
1118 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Operation">"Operation"</link> D-Bus property. |
1119 | | * |
1120 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1121 | | * |
1122 | | * 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 r_installer_dup_operation() if on another thread. |
1123 | | * |
1124 | | * 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. |
1125 | | */ |
1126 | | const gchar * |
1127 | | r_installer_get_operation (RInstaller *object) |
1128 | 0 | { |
1129 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1130 | | |
1131 | 0 | return R_INSTALLER_GET_IFACE (object)->get_operation (object); |
1132 | 0 | } |
1133 | | |
1134 | | /** |
1135 | | * r_installer_dup_operation: (skip) |
1136 | | * @object: A #RInstaller. |
1137 | | * |
1138 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Operation">"Operation"</link> D-Bus property. |
1139 | | * |
1140 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1141 | | * |
1142 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1143 | | */ |
1144 | | gchar * |
1145 | | r_installer_dup_operation (RInstaller *object) |
1146 | 0 | { |
1147 | 0 | gchar *value; |
1148 | 0 | g_object_get (G_OBJECT (object), "operation", &value, NULL); |
1149 | 0 | return value; |
1150 | 0 | } |
1151 | | |
1152 | | /** |
1153 | | * r_installer_set_operation: (skip) |
1154 | | * @object: A #RInstaller. |
1155 | | * @value: The value to set. |
1156 | | * |
1157 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Operation">"Operation"</link> D-Bus property to @value. |
1158 | | * |
1159 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1160 | | */ |
1161 | | void |
1162 | | r_installer_set_operation (RInstaller *object, const gchar *value) |
1163 | 0 | { |
1164 | 0 | g_object_set (G_OBJECT (object), "operation", value, NULL); |
1165 | 0 | } |
1166 | | |
1167 | | /** |
1168 | | * r_installer_get_last_error: (skip) |
1169 | | * @object: A #RInstaller. |
1170 | | * |
1171 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.LastError">"LastError"</link> D-Bus property. |
1172 | | * |
1173 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1174 | | * |
1175 | | * 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 r_installer_dup_last_error() if on another thread. |
1176 | | * |
1177 | | * 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. |
1178 | | */ |
1179 | | const gchar * |
1180 | | r_installer_get_last_error (RInstaller *object) |
1181 | 0 | { |
1182 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1183 | | |
1184 | 0 | return R_INSTALLER_GET_IFACE (object)->get_last_error (object); |
1185 | 0 | } |
1186 | | |
1187 | | /** |
1188 | | * r_installer_dup_last_error: (skip) |
1189 | | * @object: A #RInstaller. |
1190 | | * |
1191 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.LastError">"LastError"</link> D-Bus property. |
1192 | | * |
1193 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1194 | | * |
1195 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1196 | | */ |
1197 | | gchar * |
1198 | | r_installer_dup_last_error (RInstaller *object) |
1199 | 0 | { |
1200 | 0 | gchar *value; |
1201 | 0 | g_object_get (G_OBJECT (object), "last-error", &value, NULL); |
1202 | 0 | return value; |
1203 | 0 | } |
1204 | | |
1205 | | /** |
1206 | | * r_installer_set_last_error: (skip) |
1207 | | * @object: A #RInstaller. |
1208 | | * @value: The value to set. |
1209 | | * |
1210 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.LastError">"LastError"</link> D-Bus property to @value. |
1211 | | * |
1212 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1213 | | */ |
1214 | | void |
1215 | | r_installer_set_last_error (RInstaller *object, const gchar *value) |
1216 | 0 | { |
1217 | 0 | g_object_set (G_OBJECT (object), "last-error", value, NULL); |
1218 | 0 | } |
1219 | | |
1220 | | /** |
1221 | | * r_installer_get_progress: (skip) |
1222 | | * @object: A #RInstaller. |
1223 | | * |
1224 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Progress">"Progress"</link> D-Bus property. |
1225 | | * |
1226 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1227 | | * |
1228 | | * 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 r_installer_dup_progress() if on another thread. |
1229 | | * |
1230 | | * 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. |
1231 | | */ |
1232 | | GVariant * |
1233 | | r_installer_get_progress (RInstaller *object) |
1234 | 0 | { |
1235 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1236 | | |
1237 | 0 | return R_INSTALLER_GET_IFACE (object)->get_progress (object); |
1238 | 0 | } |
1239 | | |
1240 | | /** |
1241 | | * r_installer_dup_progress: (skip) |
1242 | | * @object: A #RInstaller. |
1243 | | * |
1244 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Progress">"Progress"</link> D-Bus property. |
1245 | | * |
1246 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1247 | | * |
1248 | | * 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(). |
1249 | | */ |
1250 | | GVariant * |
1251 | | r_installer_dup_progress (RInstaller *object) |
1252 | 0 | { |
1253 | 0 | GVariant *value; |
1254 | 0 | g_object_get (G_OBJECT (object), "progress", &value, NULL); |
1255 | 0 | return value; |
1256 | 0 | } |
1257 | | |
1258 | | /** |
1259 | | * r_installer_set_progress: (skip) |
1260 | | * @object: A #RInstaller. |
1261 | | * @value: The value to set. |
1262 | | * |
1263 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Progress">"Progress"</link> D-Bus property to @value. |
1264 | | * |
1265 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1266 | | */ |
1267 | | void |
1268 | | r_installer_set_progress (RInstaller *object, GVariant *value) |
1269 | 0 | { |
1270 | 0 | g_object_set (G_OBJECT (object), "progress", value, NULL); |
1271 | 0 | } |
1272 | | |
1273 | | /** |
1274 | | * r_installer_get_compatible: (skip) |
1275 | | * @object: A #RInstaller. |
1276 | | * |
1277 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Compatible">"Compatible"</link> D-Bus property. |
1278 | | * |
1279 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1280 | | * |
1281 | | * 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 r_installer_dup_compatible() if on another thread. |
1282 | | * |
1283 | | * 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. |
1284 | | */ |
1285 | | const gchar * |
1286 | | r_installer_get_compatible (RInstaller *object) |
1287 | 0 | { |
1288 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1289 | | |
1290 | 0 | return R_INSTALLER_GET_IFACE (object)->get_compatible (object); |
1291 | 0 | } |
1292 | | |
1293 | | /** |
1294 | | * r_installer_dup_compatible: (skip) |
1295 | | * @object: A #RInstaller. |
1296 | | * |
1297 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Compatible">"Compatible"</link> D-Bus property. |
1298 | | * |
1299 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1300 | | * |
1301 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1302 | | */ |
1303 | | gchar * |
1304 | | r_installer_dup_compatible (RInstaller *object) |
1305 | 0 | { |
1306 | 0 | gchar *value; |
1307 | 0 | g_object_get (G_OBJECT (object), "compatible", &value, NULL); |
1308 | 0 | return value; |
1309 | 0 | } |
1310 | | |
1311 | | /** |
1312 | | * r_installer_set_compatible: (skip) |
1313 | | * @object: A #RInstaller. |
1314 | | * @value: The value to set. |
1315 | | * |
1316 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Compatible">"Compatible"</link> D-Bus property to @value. |
1317 | | * |
1318 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1319 | | */ |
1320 | | void |
1321 | | r_installer_set_compatible (RInstaller *object, const gchar *value) |
1322 | 0 | { |
1323 | 0 | g_object_set (G_OBJECT (object), "compatible", value, NULL); |
1324 | 0 | } |
1325 | | |
1326 | | /** |
1327 | | * r_installer_get_variant: (skip) |
1328 | | * @object: A #RInstaller. |
1329 | | * |
1330 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Variant">"Variant"</link> D-Bus property. |
1331 | | * |
1332 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1333 | | * |
1334 | | * 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 r_installer_dup_variant() if on another thread. |
1335 | | * |
1336 | | * 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. |
1337 | | */ |
1338 | | const gchar * |
1339 | | r_installer_get_variant (RInstaller *object) |
1340 | 0 | { |
1341 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1342 | | |
1343 | 0 | return R_INSTALLER_GET_IFACE (object)->get_variant (object); |
1344 | 0 | } |
1345 | | |
1346 | | /** |
1347 | | * r_installer_dup_variant: (skip) |
1348 | | * @object: A #RInstaller. |
1349 | | * |
1350 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Variant">"Variant"</link> D-Bus property. |
1351 | | * |
1352 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1353 | | * |
1354 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1355 | | */ |
1356 | | gchar * |
1357 | | r_installer_dup_variant (RInstaller *object) |
1358 | 0 | { |
1359 | 0 | gchar *value; |
1360 | 0 | g_object_get (G_OBJECT (object), "variant", &value, NULL); |
1361 | 0 | return value; |
1362 | 0 | } |
1363 | | |
1364 | | /** |
1365 | | * r_installer_set_variant: (skip) |
1366 | | * @object: A #RInstaller. |
1367 | | * @value: The value to set. |
1368 | | * |
1369 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.Variant">"Variant"</link> D-Bus property to @value. |
1370 | | * |
1371 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1372 | | */ |
1373 | | void |
1374 | | r_installer_set_variant (RInstaller *object, const gchar *value) |
1375 | 0 | { |
1376 | 0 | g_object_set (G_OBJECT (object), "variant", value, NULL); |
1377 | 0 | } |
1378 | | |
1379 | | /** |
1380 | | * r_installer_get_system_version: (skip) |
1381 | | * @object: A #RInstaller. |
1382 | | * |
1383 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.SystemVersion">"SystemVersion"</link> D-Bus property. |
1384 | | * |
1385 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1386 | | * |
1387 | | * 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 r_installer_dup_system_version() if on another thread. |
1388 | | * |
1389 | | * 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. |
1390 | | */ |
1391 | | const gchar * |
1392 | | r_installer_get_system_version (RInstaller *object) |
1393 | 0 | { |
1394 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1395 | | |
1396 | 0 | return R_INSTALLER_GET_IFACE (object)->get_system_version (object); |
1397 | 0 | } |
1398 | | |
1399 | | /** |
1400 | | * r_installer_dup_system_version: (skip) |
1401 | | * @object: A #RInstaller. |
1402 | | * |
1403 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.SystemVersion">"SystemVersion"</link> D-Bus property. |
1404 | | * |
1405 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1406 | | * |
1407 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1408 | | */ |
1409 | | gchar * |
1410 | | r_installer_dup_system_version (RInstaller *object) |
1411 | 0 | { |
1412 | 0 | gchar *value; |
1413 | 0 | g_object_get (G_OBJECT (object), "system-version", &value, NULL); |
1414 | 0 | return value; |
1415 | 0 | } |
1416 | | |
1417 | | /** |
1418 | | * r_installer_set_system_version: (skip) |
1419 | | * @object: A #RInstaller. |
1420 | | * @value: The value to set. |
1421 | | * |
1422 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.SystemVersion">"SystemVersion"</link> D-Bus property to @value. |
1423 | | * |
1424 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1425 | | */ |
1426 | | void |
1427 | | r_installer_set_system_version (RInstaller *object, const gchar *value) |
1428 | 0 | { |
1429 | 0 | g_object_set (G_OBJECT (object), "system-version", value, NULL); |
1430 | 0 | } |
1431 | | |
1432 | | /** |
1433 | | * r_installer_get_boot_slot: (skip) |
1434 | | * @object: A #RInstaller. |
1435 | | * |
1436 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.BootSlot">"BootSlot"</link> D-Bus property. |
1437 | | * |
1438 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1439 | | * |
1440 | | * 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 r_installer_dup_boot_slot() if on another thread. |
1441 | | * |
1442 | | * 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. |
1443 | | */ |
1444 | | const gchar * |
1445 | | r_installer_get_boot_slot (RInstaller *object) |
1446 | 0 | { |
1447 | 0 | g_return_val_if_fail (R_IS_INSTALLER (object), NULL); |
1448 | | |
1449 | 0 | return R_INSTALLER_GET_IFACE (object)->get_boot_slot (object); |
1450 | 0 | } |
1451 | | |
1452 | | /** |
1453 | | * r_installer_dup_boot_slot: (skip) |
1454 | | * @object: A #RInstaller. |
1455 | | * |
1456 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.BootSlot">"BootSlot"</link> D-Bus property. |
1457 | | * |
1458 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1459 | | * |
1460 | | * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1461 | | */ |
1462 | | gchar * |
1463 | | r_installer_dup_boot_slot (RInstaller *object) |
1464 | 0 | { |
1465 | 0 | gchar *value; |
1466 | 0 | g_object_get (G_OBJECT (object), "boot-slot", &value, NULL); |
1467 | 0 | return value; |
1468 | 0 | } |
1469 | | |
1470 | | /** |
1471 | | * r_installer_set_boot_slot: (skip) |
1472 | | * @object: A #RInstaller. |
1473 | | * @value: The value to set. |
1474 | | * |
1475 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Installer.BootSlot">"BootSlot"</link> D-Bus property to @value. |
1476 | | * |
1477 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1478 | | */ |
1479 | | void |
1480 | | r_installer_set_boot_slot (RInstaller *object, const gchar *value) |
1481 | 0 | { |
1482 | 0 | g_object_set (G_OBJECT (object), "boot-slot", value, NULL); |
1483 | 0 | } |
1484 | | |
1485 | | /** |
1486 | | * r_installer_emit_completed: |
1487 | | * @object: A #RInstaller. |
1488 | | * @arg_result: Argument to pass with the signal. |
1489 | | * |
1490 | | * Emits the <link linkend="gdbus-signal-de-pengutronix-rauc-Installer.Completed">"Completed"</link> D-Bus signal. |
1491 | | */ |
1492 | | void |
1493 | | r_installer_emit_completed ( |
1494 | | RInstaller *object, |
1495 | | gint arg_result) |
1496 | 0 | { |
1497 | 0 | g_signal_emit_by_name (object, "completed", arg_result); |
1498 | 0 | } |
1499 | | |
1500 | | /** |
1501 | | * r_installer_call_install: |
1502 | | * @proxy: A #RInstallerProxy. |
1503 | | * @arg_source: Argument to pass with the method invocation. |
1504 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1505 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1506 | | * @user_data: User data to pass to @callback. |
1507 | | * |
1508 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Install">Install()</link> D-Bus method on @proxy. |
1509 | | * 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()). |
1510 | | * You can then call r_installer_call_install_finish() to get the result of the operation. |
1511 | | * |
1512 | | * See r_installer_call_install_sync() for the synchronous, blocking version of this method. |
1513 | | */ |
1514 | | void |
1515 | | r_installer_call_install ( |
1516 | | RInstaller *proxy, |
1517 | | const gchar *arg_source, |
1518 | | GCancellable *cancellable, |
1519 | | GAsyncReadyCallback callback, |
1520 | | gpointer user_data) |
1521 | 0 | { |
1522 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1523 | 0 | "Install", |
1524 | 0 | g_variant_new ("(s)", |
1525 | 0 | arg_source), |
1526 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1527 | 0 | -1, |
1528 | 0 | cancellable, |
1529 | 0 | callback, |
1530 | 0 | user_data); |
1531 | 0 | } |
1532 | | |
1533 | | /** |
1534 | | * r_installer_call_install_finish: |
1535 | | * @proxy: A #RInstallerProxy. |
1536 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_install(). |
1537 | | * @error: Return location for error or %NULL. |
1538 | | * |
1539 | | * Finishes an operation started with r_installer_call_install(). |
1540 | | * |
1541 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1542 | | */ |
1543 | | gboolean |
1544 | | r_installer_call_install_finish ( |
1545 | | RInstaller *proxy, |
1546 | | GAsyncResult *res, |
1547 | | GError **error) |
1548 | 0 | { |
1549 | 0 | GVariant *_ret; |
1550 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1551 | 0 | if (_ret == NULL) |
1552 | 0 | goto _out; |
1553 | 0 | g_variant_get (_ret, |
1554 | 0 | "()"); |
1555 | 0 | g_variant_unref (_ret); |
1556 | 0 | _out: |
1557 | 0 | return _ret != NULL; |
1558 | 0 | } |
1559 | | |
1560 | | /** |
1561 | | * r_installer_call_install_sync: |
1562 | | * @proxy: A #RInstallerProxy. |
1563 | | * @arg_source: Argument to pass with the method invocation. |
1564 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1565 | | * @error: Return location for error or %NULL. |
1566 | | * |
1567 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Install">Install()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1568 | | * |
1569 | | * See r_installer_call_install() for the asynchronous version of this method. |
1570 | | * |
1571 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1572 | | */ |
1573 | | gboolean |
1574 | | r_installer_call_install_sync ( |
1575 | | RInstaller *proxy, |
1576 | | const gchar *arg_source, |
1577 | | GCancellable *cancellable, |
1578 | | GError **error) |
1579 | 0 | { |
1580 | 0 | GVariant *_ret; |
1581 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1582 | 0 | "Install", |
1583 | 0 | g_variant_new ("(s)", |
1584 | 0 | arg_source), |
1585 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1586 | 0 | -1, |
1587 | 0 | cancellable, |
1588 | 0 | error); |
1589 | 0 | if (_ret == NULL) |
1590 | 0 | goto _out; |
1591 | 0 | g_variant_get (_ret, |
1592 | 0 | "()"); |
1593 | 0 | g_variant_unref (_ret); |
1594 | 0 | _out: |
1595 | 0 | return _ret != NULL; |
1596 | 0 | } |
1597 | | |
1598 | | /** |
1599 | | * r_installer_call_install_bundle: |
1600 | | * @proxy: A #RInstallerProxy. |
1601 | | * @arg_source: Argument to pass with the method invocation. |
1602 | | * @arg_args: Argument to pass with the method invocation. |
1603 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1604 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1605 | | * @user_data: User data to pass to @callback. |
1606 | | * |
1607 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InstallBundle">InstallBundle()</link> D-Bus method on @proxy. |
1608 | | * 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()). |
1609 | | * You can then call r_installer_call_install_bundle_finish() to get the result of the operation. |
1610 | | * |
1611 | | * See r_installer_call_install_bundle_sync() for the synchronous, blocking version of this method. |
1612 | | */ |
1613 | | void |
1614 | | r_installer_call_install_bundle ( |
1615 | | RInstaller *proxy, |
1616 | | const gchar *arg_source, |
1617 | | GVariant *arg_args, |
1618 | | GCancellable *cancellable, |
1619 | | GAsyncReadyCallback callback, |
1620 | | gpointer user_data) |
1621 | 0 | { |
1622 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1623 | 0 | "InstallBundle", |
1624 | 0 | g_variant_new ("(s@a{sv})", |
1625 | 0 | arg_source, |
1626 | 0 | arg_args), |
1627 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1628 | 0 | -1, |
1629 | 0 | cancellable, |
1630 | 0 | callback, |
1631 | 0 | user_data); |
1632 | 0 | } |
1633 | | |
1634 | | /** |
1635 | | * r_installer_call_install_bundle_finish: |
1636 | | * @proxy: A #RInstallerProxy. |
1637 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_install_bundle(). |
1638 | | * @error: Return location for error or %NULL. |
1639 | | * |
1640 | | * Finishes an operation started with r_installer_call_install_bundle(). |
1641 | | * |
1642 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1643 | | */ |
1644 | | gboolean |
1645 | | r_installer_call_install_bundle_finish ( |
1646 | | RInstaller *proxy, |
1647 | | GAsyncResult *res, |
1648 | | GError **error) |
1649 | 0 | { |
1650 | 0 | GVariant *_ret; |
1651 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1652 | 0 | if (_ret == NULL) |
1653 | 0 | goto _out; |
1654 | 0 | g_variant_get (_ret, |
1655 | 0 | "()"); |
1656 | 0 | g_variant_unref (_ret); |
1657 | 0 | _out: |
1658 | 0 | return _ret != NULL; |
1659 | 0 | } |
1660 | | |
1661 | | /** |
1662 | | * r_installer_call_install_bundle_sync: |
1663 | | * @proxy: A #RInstallerProxy. |
1664 | | * @arg_source: Argument to pass with the method invocation. |
1665 | | * @arg_args: Argument to pass with the method invocation. |
1666 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1667 | | * @error: Return location for error or %NULL. |
1668 | | * |
1669 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InstallBundle">InstallBundle()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1670 | | * |
1671 | | * See r_installer_call_install_bundle() for the asynchronous version of this method. |
1672 | | * |
1673 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1674 | | */ |
1675 | | gboolean |
1676 | | r_installer_call_install_bundle_sync ( |
1677 | | RInstaller *proxy, |
1678 | | const gchar *arg_source, |
1679 | | GVariant *arg_args, |
1680 | | GCancellable *cancellable, |
1681 | | GError **error) |
1682 | 0 | { |
1683 | 0 | GVariant *_ret; |
1684 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1685 | 0 | "InstallBundle", |
1686 | 0 | g_variant_new ("(s@a{sv})", |
1687 | 0 | arg_source, |
1688 | 0 | arg_args), |
1689 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1690 | 0 | -1, |
1691 | 0 | cancellable, |
1692 | 0 | error); |
1693 | 0 | if (_ret == NULL) |
1694 | 0 | goto _out; |
1695 | 0 | g_variant_get (_ret, |
1696 | 0 | "()"); |
1697 | 0 | g_variant_unref (_ret); |
1698 | 0 | _out: |
1699 | 0 | return _ret != NULL; |
1700 | 0 | } |
1701 | | |
1702 | | /** |
1703 | | * r_installer_call_info: |
1704 | | * @proxy: A #RInstallerProxy. |
1705 | | * @arg_bundle: Argument to pass with the method invocation. |
1706 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1707 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1708 | | * @user_data: User data to pass to @callback. |
1709 | | * |
1710 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Info">Info()</link> D-Bus method on @proxy. |
1711 | | * 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()). |
1712 | | * You can then call r_installer_call_info_finish() to get the result of the operation. |
1713 | | * |
1714 | | * See r_installer_call_info_sync() for the synchronous, blocking version of this method. |
1715 | | */ |
1716 | | void |
1717 | | r_installer_call_info ( |
1718 | | RInstaller *proxy, |
1719 | | const gchar *arg_bundle, |
1720 | | GCancellable *cancellable, |
1721 | | GAsyncReadyCallback callback, |
1722 | | gpointer user_data) |
1723 | 0 | { |
1724 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1725 | 0 | "Info", |
1726 | 0 | g_variant_new ("(s)", |
1727 | 0 | arg_bundle), |
1728 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1729 | 0 | -1, |
1730 | 0 | cancellable, |
1731 | 0 | callback, |
1732 | 0 | user_data); |
1733 | 0 | } |
1734 | | |
1735 | | /** |
1736 | | * r_installer_call_info_finish: |
1737 | | * @proxy: A #RInstallerProxy. |
1738 | | * @out_compatible: (out) (optional): Return location for return parameter or %NULL to ignore. |
1739 | | * @out_version: (out) (optional): Return location for return parameter or %NULL to ignore. |
1740 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_info(). |
1741 | | * @error: Return location for error or %NULL. |
1742 | | * |
1743 | | * Finishes an operation started with r_installer_call_info(). |
1744 | | * |
1745 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1746 | | */ |
1747 | | gboolean |
1748 | | r_installer_call_info_finish ( |
1749 | | RInstaller *proxy, |
1750 | | gchar **out_compatible, |
1751 | | gchar **out_version, |
1752 | | GAsyncResult *res, |
1753 | | GError **error) |
1754 | 0 | { |
1755 | 0 | GVariant *_ret; |
1756 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1757 | 0 | if (_ret == NULL) |
1758 | 0 | goto _out; |
1759 | 0 | g_variant_get (_ret, |
1760 | 0 | "(ss)", |
1761 | 0 | out_compatible, |
1762 | 0 | out_version); |
1763 | 0 | g_variant_unref (_ret); |
1764 | 0 | _out: |
1765 | 0 | return _ret != NULL; |
1766 | 0 | } |
1767 | | |
1768 | | /** |
1769 | | * r_installer_call_info_sync: |
1770 | | * @proxy: A #RInstallerProxy. |
1771 | | * @arg_bundle: Argument to pass with the method invocation. |
1772 | | * @out_compatible: (out) (optional): Return location for return parameter or %NULL to ignore. |
1773 | | * @out_version: (out) (optional): Return location for return parameter or %NULL to ignore. |
1774 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1775 | | * @error: Return location for error or %NULL. |
1776 | | * |
1777 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Info">Info()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1778 | | * |
1779 | | * See r_installer_call_info() for the asynchronous version of this method. |
1780 | | * |
1781 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1782 | | */ |
1783 | | gboolean |
1784 | | r_installer_call_info_sync ( |
1785 | | RInstaller *proxy, |
1786 | | const gchar *arg_bundle, |
1787 | | gchar **out_compatible, |
1788 | | gchar **out_version, |
1789 | | GCancellable *cancellable, |
1790 | | GError **error) |
1791 | 0 | { |
1792 | 0 | GVariant *_ret; |
1793 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1794 | 0 | "Info", |
1795 | 0 | g_variant_new ("(s)", |
1796 | 0 | arg_bundle), |
1797 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1798 | 0 | -1, |
1799 | 0 | cancellable, |
1800 | 0 | error); |
1801 | 0 | if (_ret == NULL) |
1802 | 0 | goto _out; |
1803 | 0 | g_variant_get (_ret, |
1804 | 0 | "(ss)", |
1805 | 0 | out_compatible, |
1806 | 0 | out_version); |
1807 | 0 | g_variant_unref (_ret); |
1808 | 0 | _out: |
1809 | 0 | return _ret != NULL; |
1810 | 0 | } |
1811 | | |
1812 | | /** |
1813 | | * r_installer_call_inspect_bundle: |
1814 | | * @proxy: A #RInstallerProxy. |
1815 | | * @arg_source: Argument to pass with the method invocation. |
1816 | | * @arg_args: Argument to pass with the method invocation. |
1817 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1818 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1819 | | * @user_data: User data to pass to @callback. |
1820 | | * |
1821 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InspectBundle">InspectBundle()</link> D-Bus method on @proxy. |
1822 | | * 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()). |
1823 | | * You can then call r_installer_call_inspect_bundle_finish() to get the result of the operation. |
1824 | | * |
1825 | | * See r_installer_call_inspect_bundle_sync() for the synchronous, blocking version of this method. |
1826 | | */ |
1827 | | void |
1828 | | r_installer_call_inspect_bundle ( |
1829 | | RInstaller *proxy, |
1830 | | const gchar *arg_source, |
1831 | | GVariant *arg_args, |
1832 | | GCancellable *cancellable, |
1833 | | GAsyncReadyCallback callback, |
1834 | | gpointer user_data) |
1835 | 0 | { |
1836 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1837 | 0 | "InspectBundle", |
1838 | 0 | g_variant_new ("(s@a{sv})", |
1839 | 0 | arg_source, |
1840 | 0 | arg_args), |
1841 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1842 | 0 | -1, |
1843 | 0 | cancellable, |
1844 | 0 | callback, |
1845 | 0 | user_data); |
1846 | 0 | } |
1847 | | |
1848 | | /** |
1849 | | * r_installer_call_inspect_bundle_finish: |
1850 | | * @proxy: A #RInstallerProxy. |
1851 | | * @out_info: (out) (optional): Return location for return parameter or %NULL to ignore. |
1852 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_inspect_bundle(). |
1853 | | * @error: Return location for error or %NULL. |
1854 | | * |
1855 | | * Finishes an operation started with r_installer_call_inspect_bundle(). |
1856 | | * |
1857 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1858 | | */ |
1859 | | gboolean |
1860 | | r_installer_call_inspect_bundle_finish ( |
1861 | | RInstaller *proxy, |
1862 | | GVariant **out_info, |
1863 | | GAsyncResult *res, |
1864 | | GError **error) |
1865 | 0 | { |
1866 | 0 | GVariant *_ret; |
1867 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1868 | 0 | if (_ret == NULL) |
1869 | 0 | goto _out; |
1870 | 0 | g_variant_get (_ret, |
1871 | 0 | "(@a{sv})", |
1872 | 0 | out_info); |
1873 | 0 | g_variant_unref (_ret); |
1874 | 0 | _out: |
1875 | 0 | return _ret != NULL; |
1876 | 0 | } |
1877 | | |
1878 | | /** |
1879 | | * r_installer_call_inspect_bundle_sync: |
1880 | | * @proxy: A #RInstallerProxy. |
1881 | | * @arg_source: Argument to pass with the method invocation. |
1882 | | * @arg_args: Argument to pass with the method invocation. |
1883 | | * @out_info: (out) (optional): Return location for return parameter or %NULL to ignore. |
1884 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1885 | | * @error: Return location for error or %NULL. |
1886 | | * |
1887 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InspectBundle">InspectBundle()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1888 | | * |
1889 | | * See r_installer_call_inspect_bundle() for the asynchronous version of this method. |
1890 | | * |
1891 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1892 | | */ |
1893 | | gboolean |
1894 | | r_installer_call_inspect_bundle_sync ( |
1895 | | RInstaller *proxy, |
1896 | | const gchar *arg_source, |
1897 | | GVariant *arg_args, |
1898 | | GVariant **out_info, |
1899 | | GCancellable *cancellable, |
1900 | | GError **error) |
1901 | 0 | { |
1902 | 0 | GVariant *_ret; |
1903 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1904 | 0 | "InspectBundle", |
1905 | 0 | g_variant_new ("(s@a{sv})", |
1906 | 0 | arg_source, |
1907 | 0 | arg_args), |
1908 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1909 | 0 | -1, |
1910 | 0 | cancellable, |
1911 | 0 | error); |
1912 | 0 | if (_ret == NULL) |
1913 | 0 | goto _out; |
1914 | 0 | g_variant_get (_ret, |
1915 | 0 | "(@a{sv})", |
1916 | 0 | out_info); |
1917 | 0 | g_variant_unref (_ret); |
1918 | 0 | _out: |
1919 | 0 | return _ret != NULL; |
1920 | 0 | } |
1921 | | |
1922 | | /** |
1923 | | * r_installer_call_mark: |
1924 | | * @proxy: A #RInstallerProxy. |
1925 | | * @arg_state: Argument to pass with the method invocation. |
1926 | | * @arg_slot_identifier: Argument to pass with the method invocation. |
1927 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1928 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1929 | | * @user_data: User data to pass to @callback. |
1930 | | * |
1931 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Mark">Mark()</link> D-Bus method on @proxy. |
1932 | | * 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()). |
1933 | | * You can then call r_installer_call_mark_finish() to get the result of the operation. |
1934 | | * |
1935 | | * See r_installer_call_mark_sync() for the synchronous, blocking version of this method. |
1936 | | */ |
1937 | | void |
1938 | | r_installer_call_mark ( |
1939 | | RInstaller *proxy, |
1940 | | const gchar *arg_state, |
1941 | | const gchar *arg_slot_identifier, |
1942 | | GCancellable *cancellable, |
1943 | | GAsyncReadyCallback callback, |
1944 | | gpointer user_data) |
1945 | 0 | { |
1946 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1947 | 0 | "Mark", |
1948 | 0 | g_variant_new ("(ss)", |
1949 | 0 | arg_state, |
1950 | 0 | arg_slot_identifier), |
1951 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1952 | 0 | -1, |
1953 | 0 | cancellable, |
1954 | 0 | callback, |
1955 | 0 | user_data); |
1956 | 0 | } |
1957 | | |
1958 | | /** |
1959 | | * r_installer_call_mark_finish: |
1960 | | * @proxy: A #RInstallerProxy. |
1961 | | * @out_slot_name: (out) (optional): Return location for return parameter or %NULL to ignore. |
1962 | | * @out_message: (out) (optional): Return location for return parameter or %NULL to ignore. |
1963 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_mark(). |
1964 | | * @error: Return location for error or %NULL. |
1965 | | * |
1966 | | * Finishes an operation started with r_installer_call_mark(). |
1967 | | * |
1968 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1969 | | */ |
1970 | | gboolean |
1971 | | r_installer_call_mark_finish ( |
1972 | | RInstaller *proxy, |
1973 | | gchar **out_slot_name, |
1974 | | gchar **out_message, |
1975 | | GAsyncResult *res, |
1976 | | GError **error) |
1977 | 0 | { |
1978 | 0 | GVariant *_ret; |
1979 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1980 | 0 | if (_ret == NULL) |
1981 | 0 | goto _out; |
1982 | 0 | g_variant_get (_ret, |
1983 | 0 | "(ss)", |
1984 | 0 | out_slot_name, |
1985 | 0 | out_message); |
1986 | 0 | g_variant_unref (_ret); |
1987 | 0 | _out: |
1988 | 0 | return _ret != NULL; |
1989 | 0 | } |
1990 | | |
1991 | | /** |
1992 | | * r_installer_call_mark_sync: |
1993 | | * @proxy: A #RInstallerProxy. |
1994 | | * @arg_state: Argument to pass with the method invocation. |
1995 | | * @arg_slot_identifier: Argument to pass with the method invocation. |
1996 | | * @out_slot_name: (out) (optional): Return location for return parameter or %NULL to ignore. |
1997 | | * @out_message: (out) (optional): Return location for return parameter or %NULL to ignore. |
1998 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1999 | | * @error: Return location for error or %NULL. |
2000 | | * |
2001 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Mark">Mark()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2002 | | * |
2003 | | * See r_installer_call_mark() for the asynchronous version of this method. |
2004 | | * |
2005 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2006 | | */ |
2007 | | gboolean |
2008 | | r_installer_call_mark_sync ( |
2009 | | RInstaller *proxy, |
2010 | | const gchar *arg_state, |
2011 | | const gchar *arg_slot_identifier, |
2012 | | gchar **out_slot_name, |
2013 | | gchar **out_message, |
2014 | | GCancellable *cancellable, |
2015 | | GError **error) |
2016 | 0 | { |
2017 | 0 | GVariant *_ret; |
2018 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2019 | 0 | "Mark", |
2020 | 0 | g_variant_new ("(ss)", |
2021 | 0 | arg_state, |
2022 | 0 | arg_slot_identifier), |
2023 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2024 | 0 | -1, |
2025 | 0 | cancellable, |
2026 | 0 | error); |
2027 | 0 | if (_ret == NULL) |
2028 | 0 | goto _out; |
2029 | 0 | g_variant_get (_ret, |
2030 | 0 | "(ss)", |
2031 | 0 | out_slot_name, |
2032 | 0 | out_message); |
2033 | 0 | g_variant_unref (_ret); |
2034 | 0 | _out: |
2035 | 0 | return _ret != NULL; |
2036 | 0 | } |
2037 | | |
2038 | | /** |
2039 | | * r_installer_call_get_slot_status: |
2040 | | * @proxy: A #RInstallerProxy. |
2041 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2042 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2043 | | * @user_data: User data to pass to @callback. |
2044 | | * |
2045 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetSlotStatus">GetSlotStatus()</link> D-Bus method on @proxy. |
2046 | | * 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()). |
2047 | | * You can then call r_installer_call_get_slot_status_finish() to get the result of the operation. |
2048 | | * |
2049 | | * See r_installer_call_get_slot_status_sync() for the synchronous, blocking version of this method. |
2050 | | */ |
2051 | | void |
2052 | | r_installer_call_get_slot_status ( |
2053 | | RInstaller *proxy, |
2054 | | GCancellable *cancellable, |
2055 | | GAsyncReadyCallback callback, |
2056 | | gpointer user_data) |
2057 | 0 | { |
2058 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2059 | 0 | "GetSlotStatus", |
2060 | 0 | g_variant_new ("()"), |
2061 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2062 | 0 | -1, |
2063 | 0 | cancellable, |
2064 | 0 | callback, |
2065 | 0 | user_data); |
2066 | 0 | } |
2067 | | |
2068 | | /** |
2069 | | * r_installer_call_get_slot_status_finish: |
2070 | | * @proxy: A #RInstallerProxy. |
2071 | | * @out_slot_status_array: (out) (optional): Return location for return parameter or %NULL to ignore. |
2072 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_get_slot_status(). |
2073 | | * @error: Return location for error or %NULL. |
2074 | | * |
2075 | | * Finishes an operation started with r_installer_call_get_slot_status(). |
2076 | | * |
2077 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2078 | | */ |
2079 | | gboolean |
2080 | | r_installer_call_get_slot_status_finish ( |
2081 | | RInstaller *proxy, |
2082 | | GVariant **out_slot_status_array, |
2083 | | GAsyncResult *res, |
2084 | | GError **error) |
2085 | 0 | { |
2086 | 0 | GVariant *_ret; |
2087 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2088 | 0 | if (_ret == NULL) |
2089 | 0 | goto _out; |
2090 | 0 | g_variant_get (_ret, |
2091 | 0 | "(@a(sa{sv}))", |
2092 | 0 | out_slot_status_array); |
2093 | 0 | g_variant_unref (_ret); |
2094 | 0 | _out: |
2095 | 0 | return _ret != NULL; |
2096 | 0 | } |
2097 | | |
2098 | | /** |
2099 | | * r_installer_call_get_slot_status_sync: |
2100 | | * @proxy: A #RInstallerProxy. |
2101 | | * @out_slot_status_array: (out) (optional): Return location for return parameter or %NULL to ignore. |
2102 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2103 | | * @error: Return location for error or %NULL. |
2104 | | * |
2105 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetSlotStatus">GetSlotStatus()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2106 | | * |
2107 | | * See r_installer_call_get_slot_status() for the asynchronous version of this method. |
2108 | | * |
2109 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2110 | | */ |
2111 | | gboolean |
2112 | | r_installer_call_get_slot_status_sync ( |
2113 | | RInstaller *proxy, |
2114 | | GVariant **out_slot_status_array, |
2115 | | GCancellable *cancellable, |
2116 | | GError **error) |
2117 | 0 | { |
2118 | 0 | GVariant *_ret; |
2119 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2120 | 0 | "GetSlotStatus", |
2121 | 0 | g_variant_new ("()"), |
2122 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2123 | 0 | -1, |
2124 | 0 | cancellable, |
2125 | 0 | error); |
2126 | 0 | if (_ret == NULL) |
2127 | 0 | goto _out; |
2128 | 0 | g_variant_get (_ret, |
2129 | 0 | "(@a(sa{sv}))", |
2130 | 0 | out_slot_status_array); |
2131 | 0 | g_variant_unref (_ret); |
2132 | 0 | _out: |
2133 | 0 | return _ret != NULL; |
2134 | 0 | } |
2135 | | |
2136 | | /** |
2137 | | * r_installer_call_get_artifact_status: |
2138 | | * @proxy: A #RInstallerProxy. |
2139 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2140 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2141 | | * @user_data: User data to pass to @callback. |
2142 | | * |
2143 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetArtifactStatus">GetArtifactStatus()</link> D-Bus method on @proxy. |
2144 | | * 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()). |
2145 | | * You can then call r_installer_call_get_artifact_status_finish() to get the result of the operation. |
2146 | | * |
2147 | | * See r_installer_call_get_artifact_status_sync() for the synchronous, blocking version of this method. |
2148 | | */ |
2149 | | void |
2150 | | r_installer_call_get_artifact_status ( |
2151 | | RInstaller *proxy, |
2152 | | GCancellable *cancellable, |
2153 | | GAsyncReadyCallback callback, |
2154 | | gpointer user_data) |
2155 | 0 | { |
2156 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2157 | 0 | "GetArtifactStatus", |
2158 | 0 | g_variant_new ("()"), |
2159 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2160 | 0 | -1, |
2161 | 0 | cancellable, |
2162 | 0 | callback, |
2163 | 0 | user_data); |
2164 | 0 | } |
2165 | | |
2166 | | /** |
2167 | | * r_installer_call_get_artifact_status_finish: |
2168 | | * @proxy: A #RInstallerProxy. |
2169 | | * @out_artifacts: (out) (optional): Return location for return parameter or %NULL to ignore. |
2170 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_get_artifact_status(). |
2171 | | * @error: Return location for error or %NULL. |
2172 | | * |
2173 | | * Finishes an operation started with r_installer_call_get_artifact_status(). |
2174 | | * |
2175 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2176 | | */ |
2177 | | gboolean |
2178 | | r_installer_call_get_artifact_status_finish ( |
2179 | | RInstaller *proxy, |
2180 | | GVariant **out_artifacts, |
2181 | | GAsyncResult *res, |
2182 | | GError **error) |
2183 | 0 | { |
2184 | 0 | GVariant *_ret; |
2185 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2186 | 0 | if (_ret == NULL) |
2187 | 0 | goto _out; |
2188 | 0 | g_variant_get (_ret, |
2189 | 0 | "(@aa{sv})", |
2190 | 0 | out_artifacts); |
2191 | 0 | g_variant_unref (_ret); |
2192 | 0 | _out: |
2193 | 0 | return _ret != NULL; |
2194 | 0 | } |
2195 | | |
2196 | | /** |
2197 | | * r_installer_call_get_artifact_status_sync: |
2198 | | * @proxy: A #RInstallerProxy. |
2199 | | * @out_artifacts: (out) (optional): Return location for return parameter or %NULL to ignore. |
2200 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2201 | | * @error: Return location for error or %NULL. |
2202 | | * |
2203 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetArtifactStatus">GetArtifactStatus()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2204 | | * |
2205 | | * See r_installer_call_get_artifact_status() for the asynchronous version of this method. |
2206 | | * |
2207 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2208 | | */ |
2209 | | gboolean |
2210 | | r_installer_call_get_artifact_status_sync ( |
2211 | | RInstaller *proxy, |
2212 | | GVariant **out_artifacts, |
2213 | | GCancellable *cancellable, |
2214 | | GError **error) |
2215 | 0 | { |
2216 | 0 | GVariant *_ret; |
2217 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2218 | 0 | "GetArtifactStatus", |
2219 | 0 | g_variant_new ("()"), |
2220 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2221 | 0 | -1, |
2222 | 0 | cancellable, |
2223 | 0 | error); |
2224 | 0 | if (_ret == NULL) |
2225 | 0 | goto _out; |
2226 | 0 | g_variant_get (_ret, |
2227 | 0 | "(@aa{sv})", |
2228 | 0 | out_artifacts); |
2229 | 0 | g_variant_unref (_ret); |
2230 | 0 | _out: |
2231 | 0 | return _ret != NULL; |
2232 | 0 | } |
2233 | | |
2234 | | /** |
2235 | | * r_installer_call_get_primary: |
2236 | | * @proxy: A #RInstallerProxy. |
2237 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2238 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2239 | | * @user_data: User data to pass to @callback. |
2240 | | * |
2241 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetPrimary">GetPrimary()</link> D-Bus method on @proxy. |
2242 | | * 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()). |
2243 | | * You can then call r_installer_call_get_primary_finish() to get the result of the operation. |
2244 | | * |
2245 | | * See r_installer_call_get_primary_sync() for the synchronous, blocking version of this method. |
2246 | | */ |
2247 | | void |
2248 | | r_installer_call_get_primary ( |
2249 | | RInstaller *proxy, |
2250 | | GCancellable *cancellable, |
2251 | | GAsyncReadyCallback callback, |
2252 | | gpointer user_data) |
2253 | 0 | { |
2254 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2255 | 0 | "GetPrimary", |
2256 | 0 | g_variant_new ("()"), |
2257 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2258 | 0 | -1, |
2259 | 0 | cancellable, |
2260 | 0 | callback, |
2261 | 0 | user_data); |
2262 | 0 | } |
2263 | | |
2264 | | /** |
2265 | | * r_installer_call_get_primary_finish: |
2266 | | * @proxy: A #RInstallerProxy. |
2267 | | * @out_primary: (out) (optional): Return location for return parameter or %NULL to ignore. |
2268 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_call_get_primary(). |
2269 | | * @error: Return location for error or %NULL. |
2270 | | * |
2271 | | * Finishes an operation started with r_installer_call_get_primary(). |
2272 | | * |
2273 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2274 | | */ |
2275 | | gboolean |
2276 | | r_installer_call_get_primary_finish ( |
2277 | | RInstaller *proxy, |
2278 | | gchar **out_primary, |
2279 | | GAsyncResult *res, |
2280 | | GError **error) |
2281 | 0 | { |
2282 | 0 | GVariant *_ret; |
2283 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2284 | 0 | if (_ret == NULL) |
2285 | 0 | goto _out; |
2286 | 0 | g_variant_get (_ret, |
2287 | 0 | "(s)", |
2288 | 0 | out_primary); |
2289 | 0 | g_variant_unref (_ret); |
2290 | 0 | _out: |
2291 | 0 | return _ret != NULL; |
2292 | 0 | } |
2293 | | |
2294 | | /** |
2295 | | * r_installer_call_get_primary_sync: |
2296 | | * @proxy: A #RInstallerProxy. |
2297 | | * @out_primary: (out) (optional): Return location for return parameter or %NULL to ignore. |
2298 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2299 | | * @error: Return location for error or %NULL. |
2300 | | * |
2301 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetPrimary">GetPrimary()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2302 | | * |
2303 | | * See r_installer_call_get_primary() for the asynchronous version of this method. |
2304 | | * |
2305 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
2306 | | */ |
2307 | | gboolean |
2308 | | r_installer_call_get_primary_sync ( |
2309 | | RInstaller *proxy, |
2310 | | gchar **out_primary, |
2311 | | GCancellable *cancellable, |
2312 | | GError **error) |
2313 | 0 | { |
2314 | 0 | GVariant *_ret; |
2315 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2316 | 0 | "GetPrimary", |
2317 | 0 | g_variant_new ("()"), |
2318 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2319 | 0 | -1, |
2320 | 0 | cancellable, |
2321 | 0 | error); |
2322 | 0 | if (_ret == NULL) |
2323 | 0 | goto _out; |
2324 | 0 | g_variant_get (_ret, |
2325 | 0 | "(s)", |
2326 | 0 | out_primary); |
2327 | 0 | g_variant_unref (_ret); |
2328 | 0 | _out: |
2329 | 0 | return _ret != NULL; |
2330 | 0 | } |
2331 | | |
2332 | | /** |
2333 | | * r_installer_complete_install: |
2334 | | * @object: A #RInstaller. |
2335 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2336 | | * |
2337 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Install">Install()</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. |
2338 | | * |
2339 | | * This method will free @invocation, you cannot use it afterwards. |
2340 | | */ |
2341 | | void |
2342 | | r_installer_complete_install ( |
2343 | | RInstaller *object G_GNUC_UNUSED, |
2344 | | GDBusMethodInvocation *invocation) |
2345 | 0 | { |
2346 | 0 | g_dbus_method_invocation_return_value (invocation, |
2347 | 0 | g_variant_new ("()")); |
2348 | 0 | } |
2349 | | |
2350 | | /** |
2351 | | * r_installer_complete_install_bundle: |
2352 | | * @object: A #RInstaller. |
2353 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2354 | | * |
2355 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InstallBundle">InstallBundle()</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. |
2356 | | * |
2357 | | * This method will free @invocation, you cannot use it afterwards. |
2358 | | */ |
2359 | | void |
2360 | | r_installer_complete_install_bundle ( |
2361 | | RInstaller *object G_GNUC_UNUSED, |
2362 | | GDBusMethodInvocation *invocation) |
2363 | 0 | { |
2364 | 0 | g_dbus_method_invocation_return_value (invocation, |
2365 | 0 | g_variant_new ("()")); |
2366 | 0 | } |
2367 | | |
2368 | | /** |
2369 | | * r_installer_complete_info: |
2370 | | * @object: A #RInstaller. |
2371 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2372 | | * @compatible: Parameter to return. |
2373 | | * @version: Parameter to return. |
2374 | | * |
2375 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Info">Info()</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. |
2376 | | * |
2377 | | * This method will free @invocation, you cannot use it afterwards. |
2378 | | */ |
2379 | | void |
2380 | | r_installer_complete_info ( |
2381 | | RInstaller *object G_GNUC_UNUSED, |
2382 | | GDBusMethodInvocation *invocation, |
2383 | | const gchar *compatible, |
2384 | | const gchar *version) |
2385 | 0 | { |
2386 | 0 | g_dbus_method_invocation_return_value (invocation, |
2387 | 0 | g_variant_new ("(ss)", |
2388 | 0 | compatible, |
2389 | 0 | version)); |
2390 | 0 | } |
2391 | | |
2392 | | /** |
2393 | | * r_installer_complete_inspect_bundle: |
2394 | | * @object: A #RInstaller. |
2395 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2396 | | * @info: Parameter to return. |
2397 | | * |
2398 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.InspectBundle">InspectBundle()</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. |
2399 | | * |
2400 | | * This method will free @invocation, you cannot use it afterwards. |
2401 | | */ |
2402 | | void |
2403 | | r_installer_complete_inspect_bundle ( |
2404 | | RInstaller *object G_GNUC_UNUSED, |
2405 | | GDBusMethodInvocation *invocation, |
2406 | | GVariant *info) |
2407 | 0 | { |
2408 | 0 | g_dbus_method_invocation_return_value (invocation, |
2409 | 0 | g_variant_new ("(@a{sv})", |
2410 | 0 | info)); |
2411 | 0 | } |
2412 | | |
2413 | | /** |
2414 | | * r_installer_complete_mark: |
2415 | | * @object: A #RInstaller. |
2416 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2417 | | * @slot_name: Parameter to return. |
2418 | | * @message: Parameter to return. |
2419 | | * |
2420 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.Mark">Mark()</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. |
2421 | | * |
2422 | | * This method will free @invocation, you cannot use it afterwards. |
2423 | | */ |
2424 | | void |
2425 | | r_installer_complete_mark ( |
2426 | | RInstaller *object G_GNUC_UNUSED, |
2427 | | GDBusMethodInvocation *invocation, |
2428 | | const gchar *slot_name, |
2429 | | const gchar *message) |
2430 | 0 | { |
2431 | 0 | g_dbus_method_invocation_return_value (invocation, |
2432 | 0 | g_variant_new ("(ss)", |
2433 | 0 | slot_name, |
2434 | 0 | message)); |
2435 | 0 | } |
2436 | | |
2437 | | /** |
2438 | | * r_installer_complete_get_slot_status: |
2439 | | * @object: A #RInstaller. |
2440 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2441 | | * @slot_status_array: Parameter to return. |
2442 | | * |
2443 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetSlotStatus">GetSlotStatus()</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. |
2444 | | * |
2445 | | * This method will free @invocation, you cannot use it afterwards. |
2446 | | */ |
2447 | | void |
2448 | | r_installer_complete_get_slot_status ( |
2449 | | RInstaller *object G_GNUC_UNUSED, |
2450 | | GDBusMethodInvocation *invocation, |
2451 | | GVariant *slot_status_array) |
2452 | 0 | { |
2453 | 0 | g_dbus_method_invocation_return_value (invocation, |
2454 | 0 | g_variant_new ("(@a(sa{sv}))", |
2455 | 0 | slot_status_array)); |
2456 | 0 | } |
2457 | | |
2458 | | /** |
2459 | | * r_installer_complete_get_artifact_status: |
2460 | | * @object: A #RInstaller. |
2461 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2462 | | * @artifacts: Parameter to return. |
2463 | | * |
2464 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetArtifactStatus">GetArtifactStatus()</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. |
2465 | | * |
2466 | | * This method will free @invocation, you cannot use it afterwards. |
2467 | | */ |
2468 | | void |
2469 | | r_installer_complete_get_artifact_status ( |
2470 | | RInstaller *object G_GNUC_UNUSED, |
2471 | | GDBusMethodInvocation *invocation, |
2472 | | GVariant *artifacts) |
2473 | 0 | { |
2474 | 0 | g_dbus_method_invocation_return_value (invocation, |
2475 | 0 | g_variant_new ("(@aa{sv})", |
2476 | 0 | artifacts)); |
2477 | 0 | } |
2478 | | |
2479 | | /** |
2480 | | * r_installer_complete_get_primary: |
2481 | | * @object: A #RInstaller. |
2482 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2483 | | * @primary: Parameter to return. |
2484 | | * |
2485 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Installer.GetPrimary">GetPrimary()</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. |
2486 | | * |
2487 | | * This method will free @invocation, you cannot use it afterwards. |
2488 | | */ |
2489 | | void |
2490 | | r_installer_complete_get_primary ( |
2491 | | RInstaller *object G_GNUC_UNUSED, |
2492 | | GDBusMethodInvocation *invocation, |
2493 | | const gchar *primary) |
2494 | 0 | { |
2495 | 0 | g_dbus_method_invocation_return_value (invocation, |
2496 | 0 | g_variant_new ("(s)", |
2497 | 0 | primary)); |
2498 | 0 | } |
2499 | | |
2500 | | /* ------------------------------------------------------------------------ */ |
2501 | | |
2502 | | /** |
2503 | | * RInstallerProxy: |
2504 | | * |
2505 | | * The #RInstallerProxy structure contains only private data and should only be accessed using the provided API. |
2506 | | */ |
2507 | | |
2508 | | /** |
2509 | | * RInstallerProxyClass: |
2510 | | * @parent_class: The parent class. |
2511 | | * |
2512 | | * Class structure for #RInstallerProxy. |
2513 | | */ |
2514 | | |
2515 | | struct _RInstallerProxyPrivate |
2516 | | { |
2517 | | GData *qdata; |
2518 | | }; |
2519 | | |
2520 | | static void r_installer_proxy_iface_init (RInstallerIface *iface); |
2521 | | |
2522 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2523 | 0 | G_DEFINE_TYPE_WITH_CODE (RInstallerProxy, r_installer_proxy, G_TYPE_DBUS_PROXY, |
2524 | 0 | G_ADD_PRIVATE (RInstallerProxy) |
2525 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_INSTALLER, r_installer_proxy_iface_init)) |
2526 | 0 |
|
2527 | 0 | #else |
2528 | 0 | G_DEFINE_TYPE_WITH_CODE (RInstallerProxy, r_installer_proxy, G_TYPE_DBUS_PROXY, |
2529 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_INSTALLER, r_installer_proxy_iface_init)) |
2530 | 0 |
|
2531 | 0 | #endif |
2532 | 0 | static void |
2533 | 0 | r_installer_proxy_finalize (GObject *object) |
2534 | 0 | { |
2535 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2536 | 0 | g_datalist_clear (&proxy->priv->qdata); |
2537 | 0 | G_OBJECT_CLASS (r_installer_proxy_parent_class)->finalize (object); |
2538 | 0 | } |
2539 | | |
2540 | | static void |
2541 | | r_installer_proxy_get_property (GObject *object, |
2542 | | guint prop_id, |
2543 | | GValue *value, |
2544 | | GParamSpec *pspec G_GNUC_UNUSED) |
2545 | 0 | { |
2546 | 0 | const _ExtendedGDBusPropertyInfo *info; |
2547 | 0 | GVariant *variant; |
2548 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
2549 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_installer_property_info_pointers[prop_id - 1]; |
2550 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
2551 | 0 | if (info->use_gvariant) |
2552 | 0 | { |
2553 | 0 | g_value_set_variant (value, variant); |
2554 | 0 | } |
2555 | 0 | else |
2556 | 0 | { |
2557 | 0 | if (variant != NULL) |
2558 | 0 | g_dbus_gvariant_to_gvalue (variant, value); |
2559 | 0 | } |
2560 | 0 | if (variant != NULL) |
2561 | 0 | g_variant_unref (variant); |
2562 | 0 | } |
2563 | | |
2564 | | static void |
2565 | | r_installer_proxy_set_property_cb (GDBusProxy *proxy, |
2566 | | GAsyncResult *res, |
2567 | | gpointer user_data) |
2568 | 0 | { |
2569 | 0 | const _ExtendedGDBusPropertyInfo *info = user_data; |
2570 | 0 | GError *error; |
2571 | 0 | GVariant *_ret; |
2572 | 0 | error = NULL; |
2573 | 0 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
2574 | 0 | if (!_ret) |
2575 | 0 | { |
2576 | 0 | g_warning ("Error setting property '%s' on interface de.pengutronix.rauc.Installer: %s (%s, %d)", |
2577 | 0 | info->parent_struct.name, |
2578 | 0 | error->message, g_quark_to_string (error->domain), error->code); |
2579 | 0 | g_error_free (error); |
2580 | 0 | } |
2581 | 0 | else |
2582 | 0 | { |
2583 | 0 | g_variant_unref (_ret); |
2584 | 0 | } |
2585 | 0 | } |
2586 | | |
2587 | | static void |
2588 | | r_installer_proxy_set_property (GObject *object, |
2589 | | guint prop_id, |
2590 | | const GValue *value, |
2591 | | GParamSpec *pspec G_GNUC_UNUSED) |
2592 | 0 | { |
2593 | 0 | const _ExtendedGDBusPropertyInfo *info; |
2594 | 0 | GVariant *variant; |
2595 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
2596 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_installer_property_info_pointers[prop_id - 1]; |
2597 | 0 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
2598 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
2599 | 0 | "org.freedesktop.DBus.Properties.Set", |
2600 | 0 | g_variant_new ("(ssv)", "de.pengutronix.rauc.Installer", info->parent_struct.name, variant), |
2601 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2602 | 0 | -1, |
2603 | 0 | NULL, (GAsyncReadyCallback) r_installer_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
2604 | 0 | g_variant_unref (variant); |
2605 | 0 | } |
2606 | | |
2607 | | static void |
2608 | | r_installer_proxy_g_signal (GDBusProxy *proxy, |
2609 | | const gchar *sender_name G_GNUC_UNUSED, |
2610 | | const gchar *signal_name, |
2611 | | GVariant *parameters) |
2612 | 0 | { |
2613 | 0 | _ExtendedGDBusSignalInfo *info; |
2614 | 0 | GVariantIter iter; |
2615 | 0 | GVariant *child; |
2616 | 0 | GValue *paramv; |
2617 | 0 | gsize num_params; |
2618 | 0 | gsize n; |
2619 | 0 | guint signal_id; |
2620 | 0 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct, signal_name); |
2621 | 0 | if (info == NULL) |
2622 | 0 | return; |
2623 | 0 | num_params = g_variant_n_children (parameters); |
2624 | 0 | paramv = g_new0 (GValue, num_params + 1); |
2625 | 0 | g_value_init (¶mv[0], R_TYPE_INSTALLER); |
2626 | 0 | g_value_set_object (¶mv[0], proxy); |
2627 | 0 | g_variant_iter_init (&iter, parameters); |
2628 | 0 | n = 1; |
2629 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
2630 | 0 | { |
2631 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
2632 | 0 | if (arg_info->use_gvariant) |
2633 | 0 | { |
2634 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
2635 | 0 | g_value_set_variant (¶mv[n], child); |
2636 | 0 | n++; |
2637 | 0 | } |
2638 | 0 | else |
2639 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
2640 | 0 | g_variant_unref (child); |
2641 | 0 | } |
2642 | 0 | signal_id = g_signal_lookup (info->signal_name, R_TYPE_INSTALLER); |
2643 | 0 | g_signal_emitv (paramv, signal_id, 0, NULL); |
2644 | 0 | for (n = 0; n < num_params + 1; n++) |
2645 | 0 | g_value_unset (¶mv[n]); |
2646 | 0 | g_free (paramv); |
2647 | 0 | } |
2648 | | |
2649 | | static void |
2650 | | r_installer_proxy_g_properties_changed (GDBusProxy *_proxy, |
2651 | | GVariant *changed_properties, |
2652 | | const gchar *const *invalidated_properties) |
2653 | 0 | { |
2654 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (_proxy); |
2655 | 0 | guint n; |
2656 | 0 | const gchar *key; |
2657 | 0 | GVariantIter *iter; |
2658 | 0 | _ExtendedGDBusPropertyInfo *info; |
2659 | 0 | g_variant_get (changed_properties, "a{sv}", &iter); |
2660 | 0 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
2661 | 0 | { |
2662 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct, key); |
2663 | 0 | g_datalist_remove_data (&proxy->priv->qdata, key); |
2664 | 0 | if (info != NULL) |
2665 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
2666 | 0 | } |
2667 | 0 | g_variant_iter_free (iter); |
2668 | 0 | for (n = 0; invalidated_properties[n] != NULL; n++) |
2669 | 0 | { |
2670 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct, invalidated_properties[n]); |
2671 | 0 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
2672 | 0 | if (info != NULL) |
2673 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
2674 | 0 | } |
2675 | 0 | } |
2676 | | |
2677 | | static const gchar * |
2678 | | r_installer_proxy_get_operation (RInstaller *object) |
2679 | 0 | { |
2680 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2681 | 0 | GVariant *variant; |
2682 | 0 | const gchar *value = NULL; |
2683 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Operation"); |
2684 | 0 | if (variant != NULL) |
2685 | 0 | { |
2686 | 0 | value = g_variant_get_string (variant, NULL); |
2687 | 0 | g_variant_unref (variant); |
2688 | 0 | } |
2689 | 0 | return value; |
2690 | 0 | } |
2691 | | |
2692 | | static const gchar * |
2693 | | r_installer_proxy_get_last_error (RInstaller *object) |
2694 | 0 | { |
2695 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2696 | 0 | GVariant *variant; |
2697 | 0 | const gchar *value = NULL; |
2698 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LastError"); |
2699 | 0 | if (variant != NULL) |
2700 | 0 | { |
2701 | 0 | value = g_variant_get_string (variant, NULL); |
2702 | 0 | g_variant_unref (variant); |
2703 | 0 | } |
2704 | 0 | return value; |
2705 | 0 | } |
2706 | | |
2707 | | static GVariant * |
2708 | | r_installer_proxy_get_progress (RInstaller *object) |
2709 | 0 | { |
2710 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2711 | 0 | GVariant *variant; |
2712 | 0 | GVariant *value = NULL; |
2713 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Progress"); |
2714 | 0 | value = variant; |
2715 | 0 | if (variant != NULL) |
2716 | 0 | g_variant_unref (variant); |
2717 | 0 | return value; |
2718 | 0 | } |
2719 | | |
2720 | | static const gchar * |
2721 | | r_installer_proxy_get_compatible (RInstaller *object) |
2722 | 0 | { |
2723 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2724 | 0 | GVariant *variant; |
2725 | 0 | const gchar *value = NULL; |
2726 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Compatible"); |
2727 | 0 | if (variant != NULL) |
2728 | 0 | { |
2729 | 0 | value = g_variant_get_string (variant, NULL); |
2730 | 0 | g_variant_unref (variant); |
2731 | 0 | } |
2732 | 0 | return value; |
2733 | 0 | } |
2734 | | |
2735 | | static const gchar * |
2736 | | r_installer_proxy_get_variant (RInstaller *object) |
2737 | 0 | { |
2738 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2739 | 0 | GVariant *variant; |
2740 | 0 | const gchar *value = NULL; |
2741 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Variant"); |
2742 | 0 | if (variant != NULL) |
2743 | 0 | { |
2744 | 0 | value = g_variant_get_string (variant, NULL); |
2745 | 0 | g_variant_unref (variant); |
2746 | 0 | } |
2747 | 0 | return value; |
2748 | 0 | } |
2749 | | |
2750 | | static const gchar * |
2751 | | r_installer_proxy_get_system_version (RInstaller *object) |
2752 | 0 | { |
2753 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2754 | 0 | GVariant *variant; |
2755 | 0 | const gchar *value = NULL; |
2756 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SystemVersion"); |
2757 | 0 | if (variant != NULL) |
2758 | 0 | { |
2759 | 0 | value = g_variant_get_string (variant, NULL); |
2760 | 0 | g_variant_unref (variant); |
2761 | 0 | } |
2762 | 0 | return value; |
2763 | 0 | } |
2764 | | |
2765 | | static const gchar * |
2766 | | r_installer_proxy_get_boot_slot (RInstaller *object) |
2767 | 0 | { |
2768 | 0 | RInstallerProxy *proxy = R_INSTALLER_PROXY (object); |
2769 | 0 | GVariant *variant; |
2770 | 0 | const gchar *value = NULL; |
2771 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "BootSlot"); |
2772 | 0 | if (variant != NULL) |
2773 | 0 | { |
2774 | 0 | value = g_variant_get_string (variant, NULL); |
2775 | 0 | g_variant_unref (variant); |
2776 | 0 | } |
2777 | 0 | return value; |
2778 | 0 | } |
2779 | | |
2780 | | static void |
2781 | | r_installer_proxy_init (RInstallerProxy *proxy) |
2782 | 0 | { |
2783 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2784 | 0 | proxy->priv = r_installer_proxy_get_instance_private (proxy); |
2785 | | #else |
2786 | | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, R_TYPE_INSTALLER_PROXY, RInstallerProxyPrivate); |
2787 | | #endif |
2788 | |
|
2789 | 0 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), r_installer_interface_info ()); |
2790 | 0 | } |
2791 | | |
2792 | | static void |
2793 | | r_installer_proxy_class_init (RInstallerProxyClass *klass) |
2794 | 0 | { |
2795 | 0 | GObjectClass *gobject_class; |
2796 | 0 | GDBusProxyClass *proxy_class; |
2797 | |
|
2798 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
2799 | 0 | gobject_class->finalize = r_installer_proxy_finalize; |
2800 | 0 | gobject_class->get_property = r_installer_proxy_get_property; |
2801 | 0 | gobject_class->set_property = r_installer_proxy_set_property; |
2802 | |
|
2803 | 0 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
2804 | 0 | proxy_class->g_signal = r_installer_proxy_g_signal; |
2805 | 0 | proxy_class->g_properties_changed = r_installer_proxy_g_properties_changed; |
2806 | |
|
2807 | 0 | r_installer_override_properties (gobject_class, 1); |
2808 | |
|
2809 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2810 | | g_type_class_add_private (klass, sizeof (RInstallerProxyPrivate)); |
2811 | | #endif |
2812 | 0 | } |
2813 | | |
2814 | | static void |
2815 | | r_installer_proxy_iface_init (RInstallerIface *iface) |
2816 | 0 | { |
2817 | 0 | iface->get_operation = r_installer_proxy_get_operation; |
2818 | 0 | iface->get_last_error = r_installer_proxy_get_last_error; |
2819 | 0 | iface->get_progress = r_installer_proxy_get_progress; |
2820 | 0 | iface->get_compatible = r_installer_proxy_get_compatible; |
2821 | 0 | iface->get_variant = r_installer_proxy_get_variant; |
2822 | 0 | iface->get_system_version = r_installer_proxy_get_system_version; |
2823 | 0 | iface->get_boot_slot = r_installer_proxy_get_boot_slot; |
2824 | 0 | } |
2825 | | |
2826 | | /** |
2827 | | * r_installer_proxy_new: |
2828 | | * @connection: A #GDBusConnection. |
2829 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2830 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
2831 | | * @object_path: An object path. |
2832 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2833 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
2834 | | * @user_data: User data to pass to @callback. |
2835 | | * |
2836 | | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link>. See g_dbus_proxy_new() for more details. |
2837 | | * |
2838 | | * 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()). |
2839 | | * You can then call r_installer_proxy_new_finish() to get the result of the operation. |
2840 | | * |
2841 | | * See r_installer_proxy_new_sync() for the synchronous, blocking version of this constructor. |
2842 | | */ |
2843 | | void |
2844 | | r_installer_proxy_new ( |
2845 | | GDBusConnection *connection, |
2846 | | GDBusProxyFlags flags, |
2847 | | const gchar *name, |
2848 | | const gchar *object_path, |
2849 | | GCancellable *cancellable, |
2850 | | GAsyncReadyCallback callback, |
2851 | | gpointer user_data) |
2852 | 0 | { |
2853 | 0 | g_async_initable_new_async (R_TYPE_INSTALLER_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", "de.pengutronix.rauc.Installer", NULL); |
2854 | 0 | } |
2855 | | |
2856 | | /** |
2857 | | * r_installer_proxy_new_finish: |
2858 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_proxy_new(). |
2859 | | * @error: Return location for error or %NULL |
2860 | | * |
2861 | | * Finishes an operation started with r_installer_proxy_new(). |
2862 | | * |
2863 | | * Returns: (transfer full) (type RInstallerProxy): The constructed proxy object or %NULL if @error is set. |
2864 | | */ |
2865 | | RInstaller * |
2866 | | r_installer_proxy_new_finish ( |
2867 | | GAsyncResult *res, |
2868 | | GError **error) |
2869 | 0 | { |
2870 | 0 | GObject *ret; |
2871 | 0 | GObject *source_object; |
2872 | 0 | source_object = g_async_result_get_source_object (res); |
2873 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
2874 | 0 | g_object_unref (source_object); |
2875 | 0 | if (ret != NULL) |
2876 | 0 | return R_INSTALLER (ret); |
2877 | 0 | else |
2878 | 0 | return NULL; |
2879 | 0 | } |
2880 | | |
2881 | | /** |
2882 | | * r_installer_proxy_new_sync: |
2883 | | * @connection: A #GDBusConnection. |
2884 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2885 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
2886 | | * @object_path: An object path. |
2887 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2888 | | * @error: Return location for error or %NULL |
2889 | | * |
2890 | | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link>. See g_dbus_proxy_new_sync() for more details. |
2891 | | * |
2892 | | * The calling thread is blocked until a reply is received. |
2893 | | * |
2894 | | * See r_installer_proxy_new() for the asynchronous version of this constructor. |
2895 | | * |
2896 | | * Returns: (transfer full) (type RInstallerProxy): The constructed proxy object or %NULL if @error is set. |
2897 | | */ |
2898 | | RInstaller * |
2899 | | r_installer_proxy_new_sync ( |
2900 | | GDBusConnection *connection, |
2901 | | GDBusProxyFlags flags, |
2902 | | const gchar *name, |
2903 | | const gchar *object_path, |
2904 | | GCancellable *cancellable, |
2905 | | GError **error) |
2906 | 0 | { |
2907 | 0 | GInitable *ret; |
2908 | 0 | ret = g_initable_new (R_TYPE_INSTALLER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "de.pengutronix.rauc.Installer", NULL); |
2909 | 0 | if (ret != NULL) |
2910 | 0 | return R_INSTALLER (ret); |
2911 | 0 | else |
2912 | 0 | return NULL; |
2913 | 0 | } |
2914 | | |
2915 | | |
2916 | | /** |
2917 | | * r_installer_proxy_new_for_bus: |
2918 | | * @bus_type: A #GBusType. |
2919 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2920 | | * @name: A bus name (well-known or unique). |
2921 | | * @object_path: An object path. |
2922 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2923 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
2924 | | * @user_data: User data to pass to @callback. |
2925 | | * |
2926 | | * Like r_installer_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
2927 | | * |
2928 | | * 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()). |
2929 | | * You can then call r_installer_proxy_new_for_bus_finish() to get the result of the operation. |
2930 | | * |
2931 | | * See r_installer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
2932 | | */ |
2933 | | void |
2934 | | r_installer_proxy_new_for_bus ( |
2935 | | GBusType bus_type, |
2936 | | GDBusProxyFlags flags, |
2937 | | const gchar *name, |
2938 | | const gchar *object_path, |
2939 | | GCancellable *cancellable, |
2940 | | GAsyncReadyCallback callback, |
2941 | | gpointer user_data) |
2942 | 0 | { |
2943 | 0 | g_async_initable_new_async (R_TYPE_INSTALLER_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", "de.pengutronix.rauc.Installer", NULL); |
2944 | 0 | } |
2945 | | |
2946 | | /** |
2947 | | * r_installer_proxy_new_for_bus_finish: |
2948 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_installer_proxy_new_for_bus(). |
2949 | | * @error: Return location for error or %NULL |
2950 | | * |
2951 | | * Finishes an operation started with r_installer_proxy_new_for_bus(). |
2952 | | * |
2953 | | * Returns: (transfer full) (type RInstallerProxy): The constructed proxy object or %NULL if @error is set. |
2954 | | */ |
2955 | | RInstaller * |
2956 | | r_installer_proxy_new_for_bus_finish ( |
2957 | | GAsyncResult *res, |
2958 | | GError **error) |
2959 | 0 | { |
2960 | 0 | GObject *ret; |
2961 | 0 | GObject *source_object; |
2962 | 0 | source_object = g_async_result_get_source_object (res); |
2963 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
2964 | 0 | g_object_unref (source_object); |
2965 | 0 | if (ret != NULL) |
2966 | 0 | return R_INSTALLER (ret); |
2967 | 0 | else |
2968 | 0 | return NULL; |
2969 | 0 | } |
2970 | | |
2971 | | /** |
2972 | | * r_installer_proxy_new_for_bus_sync: |
2973 | | * @bus_type: A #GBusType. |
2974 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2975 | | * @name: A bus name (well-known or unique). |
2976 | | * @object_path: An object path. |
2977 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2978 | | * @error: Return location for error or %NULL |
2979 | | * |
2980 | | * Like r_installer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
2981 | | * |
2982 | | * The calling thread is blocked until a reply is received. |
2983 | | * |
2984 | | * See r_installer_proxy_new_for_bus() for the asynchronous version of this constructor. |
2985 | | * |
2986 | | * Returns: (transfer full) (type RInstallerProxy): The constructed proxy object or %NULL if @error is set. |
2987 | | */ |
2988 | | RInstaller * |
2989 | | r_installer_proxy_new_for_bus_sync ( |
2990 | | GBusType bus_type, |
2991 | | GDBusProxyFlags flags, |
2992 | | const gchar *name, |
2993 | | const gchar *object_path, |
2994 | | GCancellable *cancellable, |
2995 | | GError **error) |
2996 | 0 | { |
2997 | 0 | GInitable *ret; |
2998 | 0 | ret = g_initable_new (R_TYPE_INSTALLER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "de.pengutronix.rauc.Installer", NULL); |
2999 | 0 | if (ret != NULL) |
3000 | 0 | return R_INSTALLER (ret); |
3001 | 0 | else |
3002 | 0 | return NULL; |
3003 | 0 | } |
3004 | | |
3005 | | |
3006 | | /* ------------------------------------------------------------------------ */ |
3007 | | |
3008 | | /** |
3009 | | * RInstallerSkeleton: |
3010 | | * |
3011 | | * The #RInstallerSkeleton structure contains only private data and should only be accessed using the provided API. |
3012 | | */ |
3013 | | |
3014 | | /** |
3015 | | * RInstallerSkeletonClass: |
3016 | | * @parent_class: The parent class. |
3017 | | * |
3018 | | * Class structure for #RInstallerSkeleton. |
3019 | | */ |
3020 | | |
3021 | | struct _RInstallerSkeletonPrivate |
3022 | | { |
3023 | | GValue *properties; |
3024 | | GList *changed_properties; |
3025 | | GSource *changed_properties_idle_source; |
3026 | | GMainContext *context; |
3027 | | GMutex lock; |
3028 | | }; |
3029 | | |
3030 | | static void |
3031 | | _r_installer_skeleton_handle_method_call ( |
3032 | | GDBusConnection *connection G_GNUC_UNUSED, |
3033 | | const gchar *sender G_GNUC_UNUSED, |
3034 | | const gchar *object_path G_GNUC_UNUSED, |
3035 | | const gchar *interface_name, |
3036 | | const gchar *method_name, |
3037 | | GVariant *parameters, |
3038 | | GDBusMethodInvocation *invocation, |
3039 | | gpointer user_data) |
3040 | 0 | { |
3041 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (user_data); |
3042 | 0 | _ExtendedGDBusMethodInfo *info; |
3043 | 0 | GVariantIter iter; |
3044 | 0 | GVariant *child; |
3045 | 0 | GValue *paramv; |
3046 | 0 | gsize num_params; |
3047 | 0 | guint num_extra; |
3048 | 0 | gsize n; |
3049 | 0 | guint signal_id; |
3050 | 0 | GValue return_value = G_VALUE_INIT; |
3051 | 0 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
3052 | 0 | g_assert (info != NULL); |
3053 | 0 | num_params = g_variant_n_children (parameters); |
3054 | 0 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
3055 | 0 | n = 0; |
3056 | 0 | g_value_init (¶mv[n], R_TYPE_INSTALLER); |
3057 | 0 | g_value_set_object (¶mv[n++], skeleton); |
3058 | 0 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
3059 | 0 | g_value_set_object (¶mv[n++], invocation); |
3060 | 0 | if (info->pass_fdlist) |
3061 | 0 | { |
3062 | 0 | #ifdef G_OS_UNIX |
3063 | 0 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
3064 | 0 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
3065 | | #else |
3066 | | g_assert_not_reached (); |
3067 | | #endif |
3068 | 0 | } |
3069 | 0 | g_variant_iter_init (&iter, parameters); |
3070 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
3071 | 0 | { |
3072 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
3073 | 0 | if (arg_info->use_gvariant) |
3074 | 0 | { |
3075 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
3076 | 0 | g_value_set_variant (¶mv[n], child); |
3077 | 0 | n++; |
3078 | 0 | } |
3079 | 0 | else |
3080 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
3081 | 0 | g_variant_unref (child); |
3082 | 0 | } |
3083 | 0 | signal_id = g_signal_lookup (info->signal_name, R_TYPE_INSTALLER); |
3084 | 0 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
3085 | 0 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
3086 | 0 | if (!g_value_get_boolean (&return_value)) |
3087 | 0 | 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); |
3088 | 0 | g_value_unset (&return_value); |
3089 | 0 | for (n = 0; n < num_params + num_extra; n++) |
3090 | 0 | g_value_unset (¶mv[n]); |
3091 | 0 | g_free (paramv); |
3092 | 0 | } |
3093 | | |
3094 | | static GVariant * |
3095 | | _r_installer_skeleton_handle_get_property ( |
3096 | | GDBusConnection *connection G_GNUC_UNUSED, |
3097 | | const gchar *sender G_GNUC_UNUSED, |
3098 | | const gchar *object_path G_GNUC_UNUSED, |
3099 | | const gchar *interface_name G_GNUC_UNUSED, |
3100 | | const gchar *property_name, |
3101 | | GError **error, |
3102 | | gpointer user_data) |
3103 | 0 | { |
3104 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (user_data); |
3105 | 0 | GValue value = G_VALUE_INIT; |
3106 | 0 | GParamSpec *pspec; |
3107 | 0 | _ExtendedGDBusPropertyInfo *info; |
3108 | 0 | GVariant *ret; |
3109 | 0 | ret = NULL; |
3110 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct, property_name); |
3111 | 0 | g_assert (info != NULL); |
3112 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3113 | 0 | if (pspec == NULL) |
3114 | 0 | { |
3115 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3116 | 0 | } |
3117 | 0 | else |
3118 | 0 | { |
3119 | 0 | g_value_init (&value, pspec->value_type); |
3120 | 0 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3121 | 0 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
3122 | 0 | g_value_unset (&value); |
3123 | 0 | } |
3124 | 0 | return ret; |
3125 | 0 | } |
3126 | | |
3127 | | static gboolean |
3128 | | _r_installer_skeleton_handle_set_property ( |
3129 | | GDBusConnection *connection G_GNUC_UNUSED, |
3130 | | const gchar *sender G_GNUC_UNUSED, |
3131 | | const gchar *object_path G_GNUC_UNUSED, |
3132 | | const gchar *interface_name G_GNUC_UNUSED, |
3133 | | const gchar *property_name, |
3134 | | GVariant *variant, |
3135 | | GError **error, |
3136 | | gpointer user_data) |
3137 | 0 | { |
3138 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (user_data); |
3139 | 0 | GValue value = G_VALUE_INIT; |
3140 | 0 | GParamSpec *pspec; |
3141 | 0 | _ExtendedGDBusPropertyInfo *info; |
3142 | 0 | gboolean ret; |
3143 | 0 | ret = FALSE; |
3144 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_installer_interface_info.parent_struct, property_name); |
3145 | 0 | g_assert (info != NULL); |
3146 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3147 | 0 | if (pspec == NULL) |
3148 | 0 | { |
3149 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3150 | 0 | } |
3151 | 0 | else |
3152 | 0 | { |
3153 | 0 | if (info->use_gvariant) |
3154 | 0 | g_value_set_variant (&value, variant); |
3155 | 0 | else |
3156 | 0 | g_dbus_gvariant_to_gvalue (variant, &value); |
3157 | 0 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3158 | 0 | g_value_unset (&value); |
3159 | 0 | ret = TRUE; |
3160 | 0 | } |
3161 | 0 | return ret; |
3162 | 0 | } |
3163 | | |
3164 | | static const GDBusInterfaceVTable _r_installer_skeleton_vtable = |
3165 | | { |
3166 | | _r_installer_skeleton_handle_method_call, |
3167 | | _r_installer_skeleton_handle_get_property, |
3168 | | _r_installer_skeleton_handle_set_property, |
3169 | | {NULL} |
3170 | | }; |
3171 | | |
3172 | | static GDBusInterfaceInfo * |
3173 | | r_installer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3174 | 0 | { |
3175 | 0 | return r_installer_interface_info (); |
3176 | 0 | } |
3177 | | |
3178 | | static GDBusInterfaceVTable * |
3179 | | r_installer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3180 | 0 | { |
3181 | 0 | return (GDBusInterfaceVTable *) &_r_installer_skeleton_vtable; |
3182 | 0 | } |
3183 | | |
3184 | | static GVariant * |
3185 | | r_installer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
3186 | 0 | { |
3187 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (_skeleton); |
3188 | |
|
3189 | 0 | GVariantBuilder builder; |
3190 | 0 | guint n; |
3191 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
3192 | 0 | if (_r_installer_interface_info.parent_struct.properties == NULL) |
3193 | 0 | goto out; |
3194 | 0 | for (n = 0; _r_installer_interface_info.parent_struct.properties[n] != NULL; n++) |
3195 | 0 | { |
3196 | 0 | GDBusPropertyInfo *info = _r_installer_interface_info.parent_struct.properties[n]; |
3197 | 0 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
3198 | 0 | { |
3199 | 0 | GVariant *value; |
3200 | 0 | value = _r_installer_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)), "de.pengutronix.rauc.Installer", info->name, NULL, skeleton); |
3201 | 0 | if (value != NULL) |
3202 | 0 | { |
3203 | 0 | g_variant_take_ref (value); |
3204 | 0 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
3205 | 0 | g_variant_unref (value); |
3206 | 0 | } |
3207 | 0 | } |
3208 | 0 | } |
3209 | 0 | out: |
3210 | 0 | return g_variant_builder_end (&builder); |
3211 | 0 | } |
3212 | | |
3213 | | static gboolean _r_installer_emit_changed (gpointer user_data); |
3214 | | |
3215 | | static void |
3216 | | r_installer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
3217 | 0 | { |
3218 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (_skeleton); |
3219 | 0 | gboolean emit_changed = FALSE; |
3220 | |
|
3221 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3222 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
3223 | 0 | { |
3224 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
3225 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
3226 | 0 | emit_changed = TRUE; |
3227 | 0 | } |
3228 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3229 | |
|
3230 | 0 | if (emit_changed) |
3231 | 0 | _r_installer_emit_changed (skeleton); |
3232 | 0 | } |
3233 | | |
3234 | | static void |
3235 | | _r_installer_on_signal_completed ( |
3236 | | RInstaller *object, |
3237 | | gint arg_result) |
3238 | 0 | { |
3239 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3240 | |
|
3241 | 0 | GList *connections, *l; |
3242 | 0 | GVariant *signal_variant; |
3243 | 0 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
3244 | |
|
3245 | 0 | signal_variant = g_variant_ref_sink (g_variant_new ("(i)", |
3246 | 0 | arg_result)); |
3247 | 0 | for (l = connections; l != NULL; l = l->next) |
3248 | 0 | { |
3249 | 0 | GDBusConnection *connection = l->data; |
3250 | 0 | g_dbus_connection_emit_signal (connection, |
3251 | 0 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "de.pengutronix.rauc.Installer", "Completed", |
3252 | 0 | signal_variant, NULL); |
3253 | 0 | } |
3254 | 0 | g_variant_unref (signal_variant); |
3255 | 0 | g_list_free_full (connections, g_object_unref); |
3256 | 0 | } |
3257 | | |
3258 | | static void r_installer_skeleton_iface_init (RInstallerIface *iface); |
3259 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3260 | 0 | G_DEFINE_TYPE_WITH_CODE (RInstallerSkeleton, r_installer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3261 | 0 | G_ADD_PRIVATE (RInstallerSkeleton) |
3262 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_INSTALLER, r_installer_skeleton_iface_init)) |
3263 | 0 |
|
3264 | 0 | #else |
3265 | 0 | G_DEFINE_TYPE_WITH_CODE (RInstallerSkeleton, r_installer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3266 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_INSTALLER, r_installer_skeleton_iface_init)) |
3267 | 0 |
|
3268 | 0 | #endif |
3269 | 0 | static void |
3270 | 0 | r_installer_skeleton_finalize (GObject *object) |
3271 | 0 | { |
3272 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3273 | 0 | guint n; |
3274 | 0 | for (n = 0; n < 7; n++) |
3275 | 0 | g_value_unset (&skeleton->priv->properties[n]); |
3276 | 0 | g_free (skeleton->priv->properties); |
3277 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
3278 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
3279 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
3280 | 0 | g_main_context_unref (skeleton->priv->context); |
3281 | 0 | g_mutex_clear (&skeleton->priv->lock); |
3282 | 0 | G_OBJECT_CLASS (r_installer_skeleton_parent_class)->finalize (object); |
3283 | 0 | } |
3284 | | |
3285 | | static void |
3286 | | r_installer_skeleton_get_property (GObject *object, |
3287 | | guint prop_id, |
3288 | | GValue *value, |
3289 | | GParamSpec *pspec G_GNUC_UNUSED) |
3290 | 0 | { |
3291 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3292 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
3293 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3294 | 0 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
3295 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3296 | 0 | } |
3297 | | |
3298 | | static gboolean |
3299 | | _r_installer_emit_changed (gpointer user_data) |
3300 | 0 | { |
3301 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (user_data); |
3302 | 0 | GList *l; |
3303 | 0 | GVariantBuilder builder; |
3304 | 0 | GVariantBuilder invalidated_builder; |
3305 | 0 | guint num_changes; |
3306 | |
|
3307 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3308 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
3309 | 0 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
3310 | 0 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
3311 | 0 | { |
3312 | 0 | ChangedProperty *cp = l->data; |
3313 | 0 | GVariant *variant; |
3314 | 0 | const GValue *cur_value; |
3315 | |
|
3316 | 0 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
3317 | 0 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
3318 | 0 | { |
3319 | 0 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
3320 | 0 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
3321 | 0 | g_variant_unref (variant); |
3322 | 0 | num_changes++; |
3323 | 0 | } |
3324 | 0 | } |
3325 | 0 | if (num_changes > 0) |
3326 | 0 | { |
3327 | 0 | GList *connections, *ll; |
3328 | 0 | GVariant *signal_variant; |
3329 | 0 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "de.pengutronix.rauc.Installer", |
3330 | 0 | &builder, &invalidated_builder)); |
3331 | 0 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
3332 | 0 | for (ll = connections; ll != NULL; ll = ll->next) |
3333 | 0 | { |
3334 | 0 | GDBusConnection *connection = ll->data; |
3335 | |
|
3336 | 0 | g_dbus_connection_emit_signal (connection, |
3337 | 0 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
3338 | 0 | "org.freedesktop.DBus.Properties", |
3339 | 0 | "PropertiesChanged", |
3340 | 0 | signal_variant, |
3341 | 0 | NULL); |
3342 | 0 | } |
3343 | 0 | g_variant_unref (signal_variant); |
3344 | 0 | g_list_free_full (connections, g_object_unref); |
3345 | 0 | } |
3346 | 0 | else |
3347 | 0 | { |
3348 | 0 | g_variant_builder_clear (&builder); |
3349 | 0 | g_variant_builder_clear (&invalidated_builder); |
3350 | 0 | } |
3351 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
3352 | 0 | skeleton->priv->changed_properties = NULL; |
3353 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
3354 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3355 | 0 | return FALSE; |
3356 | 0 | } |
3357 | | |
3358 | | static void |
3359 | | _r_installer_schedule_emit_changed (RInstallerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
3360 | 0 | { |
3361 | 0 | ChangedProperty *cp; |
3362 | 0 | GList *l; |
3363 | 0 | cp = NULL; |
3364 | 0 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
3365 | 0 | { |
3366 | 0 | ChangedProperty *i_cp = l->data; |
3367 | 0 | if (i_cp->info == info) |
3368 | 0 | { |
3369 | 0 | cp = i_cp; |
3370 | 0 | break; |
3371 | 0 | } |
3372 | 0 | } |
3373 | 0 | if (cp == NULL) |
3374 | 0 | { |
3375 | 0 | cp = g_new0 (ChangedProperty, 1); |
3376 | 0 | cp->prop_id = prop_id; |
3377 | 0 | cp->info = info; |
3378 | 0 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
3379 | 0 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
3380 | 0 | g_value_copy (orig_value, &cp->orig_value); |
3381 | 0 | } |
3382 | 0 | } |
3383 | | |
3384 | | static void |
3385 | | r_installer_skeleton_notify (GObject *object, |
3386 | | GParamSpec *pspec G_GNUC_UNUSED) |
3387 | 0 | { |
3388 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3389 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3390 | 0 | if (skeleton->priv->changed_properties != NULL && |
3391 | 0 | skeleton->priv->changed_properties_idle_source == NULL) |
3392 | 0 | { |
3393 | 0 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
3394 | 0 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
3395 | 0 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _r_installer_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
3396 | 0 | g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _r_installer_emit_changed"); |
3397 | 0 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
3398 | 0 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
3399 | 0 | } |
3400 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3401 | 0 | } |
3402 | | |
3403 | | static void |
3404 | | r_installer_skeleton_set_property (GObject *object, |
3405 | | guint prop_id, |
3406 | | const GValue *value, |
3407 | | GParamSpec *pspec) |
3408 | 0 | { |
3409 | 0 | const _ExtendedGDBusPropertyInfo *info; |
3410 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3411 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
3412 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_installer_property_info_pointers[prop_id - 1]; |
3413 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3414 | 0 | g_object_freeze_notify (object); |
3415 | 0 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
3416 | 0 | { |
3417 | 0 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
3418 | 0 | info->emits_changed_signal) |
3419 | 0 | _r_installer_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
3420 | 0 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
3421 | 0 | g_object_notify_by_pspec (object, pspec); |
3422 | 0 | } |
3423 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3424 | 0 | g_object_thaw_notify (object); |
3425 | 0 | } |
3426 | | |
3427 | | static void |
3428 | | r_installer_skeleton_init (RInstallerSkeleton *skeleton) |
3429 | 0 | { |
3430 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3431 | 0 | skeleton->priv = r_installer_skeleton_get_instance_private (skeleton); |
3432 | | #else |
3433 | | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, R_TYPE_INSTALLER_SKELETON, RInstallerSkeletonPrivate); |
3434 | | #endif |
3435 | |
|
3436 | 0 | g_mutex_init (&skeleton->priv->lock); |
3437 | 0 | skeleton->priv->context = g_main_context_ref_thread_default (); |
3438 | 0 | skeleton->priv->properties = g_new0 (GValue, 7); |
3439 | 0 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
3440 | 0 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
3441 | 0 | g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); |
3442 | 0 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
3443 | 0 | g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
3444 | 0 | g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); |
3445 | 0 | g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); |
3446 | 0 | } |
3447 | | |
3448 | | static const gchar * |
3449 | | r_installer_skeleton_get_operation (RInstaller *object) |
3450 | 0 | { |
3451 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3452 | 0 | const gchar *value; |
3453 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3454 | 0 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
3455 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3456 | 0 | return value; |
3457 | 0 | } |
3458 | | |
3459 | | static const gchar * |
3460 | | r_installer_skeleton_get_last_error (RInstaller *object) |
3461 | 0 | { |
3462 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3463 | 0 | const gchar *value; |
3464 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3465 | 0 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
3466 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3467 | 0 | return value; |
3468 | 0 | } |
3469 | | |
3470 | | static GVariant * |
3471 | | r_installer_skeleton_get_progress (RInstaller *object) |
3472 | 0 | { |
3473 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3474 | 0 | GVariant *value; |
3475 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3476 | 0 | value = g_value_get_variant (&(skeleton->priv->properties[2])); |
3477 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3478 | 0 | return value; |
3479 | 0 | } |
3480 | | |
3481 | | static const gchar * |
3482 | | r_installer_skeleton_get_compatible (RInstaller *object) |
3483 | 0 | { |
3484 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3485 | 0 | const gchar *value; |
3486 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3487 | 0 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
3488 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3489 | 0 | return value; |
3490 | 0 | } |
3491 | | |
3492 | | static const gchar * |
3493 | | r_installer_skeleton_get_variant (RInstaller *object) |
3494 | 0 | { |
3495 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3496 | 0 | const gchar *value; |
3497 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3498 | 0 | value = g_value_get_string (&(skeleton->priv->properties[4])); |
3499 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3500 | 0 | return value; |
3501 | 0 | } |
3502 | | |
3503 | | static const gchar * |
3504 | | r_installer_skeleton_get_system_version (RInstaller *object) |
3505 | 0 | { |
3506 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3507 | 0 | const gchar *value; |
3508 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3509 | 0 | value = g_value_get_string (&(skeleton->priv->properties[5])); |
3510 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3511 | 0 | return value; |
3512 | 0 | } |
3513 | | |
3514 | | static const gchar * |
3515 | | r_installer_skeleton_get_boot_slot (RInstaller *object) |
3516 | 0 | { |
3517 | 0 | RInstallerSkeleton *skeleton = R_INSTALLER_SKELETON (object); |
3518 | 0 | const gchar *value; |
3519 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3520 | 0 | value = g_value_get_string (&(skeleton->priv->properties[6])); |
3521 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3522 | 0 | return value; |
3523 | 0 | } |
3524 | | |
3525 | | static void |
3526 | | r_installer_skeleton_class_init (RInstallerSkeletonClass *klass) |
3527 | 0 | { |
3528 | 0 | GObjectClass *gobject_class; |
3529 | 0 | GDBusInterfaceSkeletonClass *skeleton_class; |
3530 | |
|
3531 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
3532 | 0 | gobject_class->finalize = r_installer_skeleton_finalize; |
3533 | 0 | gobject_class->get_property = r_installer_skeleton_get_property; |
3534 | 0 | gobject_class->set_property = r_installer_skeleton_set_property; |
3535 | 0 | gobject_class->notify = r_installer_skeleton_notify; |
3536 | | |
3537 | |
|
3538 | 0 | r_installer_override_properties (gobject_class, 1); |
3539 | |
|
3540 | 0 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
3541 | 0 | skeleton_class->get_info = r_installer_skeleton_dbus_interface_get_info; |
3542 | 0 | skeleton_class->get_properties = r_installer_skeleton_dbus_interface_get_properties; |
3543 | 0 | skeleton_class->flush = r_installer_skeleton_dbus_interface_flush; |
3544 | 0 | skeleton_class->get_vtable = r_installer_skeleton_dbus_interface_get_vtable; |
3545 | |
|
3546 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
3547 | | g_type_class_add_private (klass, sizeof (RInstallerSkeletonPrivate)); |
3548 | | #endif |
3549 | 0 | } |
3550 | | |
3551 | | static void |
3552 | | r_installer_skeleton_iface_init (RInstallerIface *iface) |
3553 | 0 | { |
3554 | 0 | iface->completed = _r_installer_on_signal_completed; |
3555 | 0 | iface->get_operation = r_installer_skeleton_get_operation; |
3556 | 0 | iface->get_last_error = r_installer_skeleton_get_last_error; |
3557 | 0 | iface->get_progress = r_installer_skeleton_get_progress; |
3558 | 0 | iface->get_compatible = r_installer_skeleton_get_compatible; |
3559 | 0 | iface->get_variant = r_installer_skeleton_get_variant; |
3560 | 0 | iface->get_system_version = r_installer_skeleton_get_system_version; |
3561 | 0 | iface->get_boot_slot = r_installer_skeleton_get_boot_slot; |
3562 | 0 | } |
3563 | | |
3564 | | /** |
3565 | | * r_installer_skeleton_new: |
3566 | | * |
3567 | | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Installer.top_of_page">de.pengutronix.rauc.Installer</link>. |
3568 | | * |
3569 | | * Returns: (transfer full) (type RInstallerSkeleton): The skeleton object. |
3570 | | */ |
3571 | | RInstaller * |
3572 | | r_installer_skeleton_new (void) |
3573 | 0 | { |
3574 | 0 | return R_INSTALLER (g_object_new (R_TYPE_INSTALLER_SKELETON, NULL)); |
3575 | 0 | } |
3576 | | |
3577 | | /* ------------------------------------------------------------------------ |
3578 | | * Code for interface de.pengutronix.rauc.Poller |
3579 | | * ------------------------------------------------------------------------ |
3580 | | */ |
3581 | | |
3582 | | /** |
3583 | | * SECTION:RPoller |
3584 | | * @title: RPoller |
3585 | | * @short_description: Generated C code for the de.pengutronix.rauc.Poller D-Bus interface |
3586 | | * |
3587 | | * This section contains code for working with the <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link> D-Bus interface in C. |
3588 | | */ |
3589 | | |
3590 | | /* ---- Introspection data for de.pengutronix.rauc.Poller ---- */ |
3591 | | |
3592 | | static const _ExtendedGDBusMethodInfo _r_poller_method_info_poll = |
3593 | | { |
3594 | | { |
3595 | | -1, |
3596 | | (gchar *) "Poll", |
3597 | | NULL, |
3598 | | NULL, |
3599 | | NULL |
3600 | | }, |
3601 | | "handle-poll", |
3602 | | FALSE |
3603 | | }; |
3604 | | |
3605 | | static const GDBusMethodInfo * const _r_poller_method_info_pointers[] = |
3606 | | { |
3607 | | &_r_poller_method_info_poll.parent_struct, |
3608 | | NULL |
3609 | | }; |
3610 | | |
3611 | | static const _ExtendedGDBusPropertyInfo _r_poller_property_info_next_poll = |
3612 | | { |
3613 | | { |
3614 | | -1, |
3615 | | (gchar *) "NextPoll", |
3616 | | (gchar *) "x", |
3617 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3618 | | NULL |
3619 | | }, |
3620 | | "next-poll", |
3621 | | FALSE, |
3622 | | TRUE |
3623 | | }; |
3624 | | |
3625 | | static const _ExtendedGDBusPropertyInfo _r_poller_property_info_status = |
3626 | | { |
3627 | | { |
3628 | | -1, |
3629 | | (gchar *) "Status", |
3630 | | (gchar *) "a{sv}", |
3631 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3632 | | NULL |
3633 | | }, |
3634 | | "status", |
3635 | | FALSE, |
3636 | | TRUE |
3637 | | }; |
3638 | | |
3639 | | static const GDBusPropertyInfo * const _r_poller_property_info_pointers[] = |
3640 | | { |
3641 | | &_r_poller_property_info_next_poll.parent_struct, |
3642 | | &_r_poller_property_info_status.parent_struct, |
3643 | | NULL |
3644 | | }; |
3645 | | |
3646 | | static const _ExtendedGDBusInterfaceInfo _r_poller_interface_info = |
3647 | | { |
3648 | | { |
3649 | | -1, |
3650 | | (gchar *) "de.pengutronix.rauc.Poller", |
3651 | | (GDBusMethodInfo **) &_r_poller_method_info_pointers, |
3652 | | NULL, |
3653 | | (GDBusPropertyInfo **) &_r_poller_property_info_pointers, |
3654 | | NULL |
3655 | | }, |
3656 | | "poller", |
3657 | | }; |
3658 | | |
3659 | | |
3660 | | /** |
3661 | | * r_poller_interface_info: |
3662 | | * |
3663 | | * Gets a machine-readable description of the <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link> D-Bus interface. |
3664 | | * |
3665 | | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
3666 | | */ |
3667 | | GDBusInterfaceInfo * |
3668 | | r_poller_interface_info (void) |
3669 | 0 | { |
3670 | 0 | return (GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct; |
3671 | 0 | } |
3672 | | |
3673 | | /** |
3674 | | * r_poller_override_properties: |
3675 | | * @klass: The class structure for a #GObject derived class. |
3676 | | * @property_id_begin: The property id to assign to the first overridden property. |
3677 | | * |
3678 | | * Overrides all #GObject properties in the #RPoller interface for a concrete class. |
3679 | | * The properties are overridden in the order they are defined. |
3680 | | * |
3681 | | * Returns: The last property id. |
3682 | | */ |
3683 | | guint |
3684 | | r_poller_override_properties (GObjectClass *klass, guint property_id_begin) |
3685 | 0 | { |
3686 | 0 | g_object_class_override_property (klass, property_id_begin++, "next-poll"); |
3687 | 0 | g_object_class_override_property (klass, property_id_begin++, "status"); |
3688 | 0 | return property_id_begin - 1; |
3689 | 0 | } |
3690 | | |
3691 | | |
3692 | | |
3693 | | /** |
3694 | | * RPoller: |
3695 | | * |
3696 | | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link>. |
3697 | | */ |
3698 | | |
3699 | | /** |
3700 | | * RPollerIface: |
3701 | | * @parent_iface: The parent interface. |
3702 | | * @handle_poll: Handler for the #RPoller::handle-poll signal. |
3703 | | * @get_next_poll: Getter for the #RPoller:next-poll property. |
3704 | | * @get_status: Getter for the #RPoller:status property. |
3705 | | * |
3706 | | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link>. |
3707 | | */ |
3708 | | |
3709 | | typedef RPollerIface RPollerInterface; |
3710 | 0 | G_DEFINE_INTERFACE (RPoller, r_poller, G_TYPE_OBJECT) |
3711 | 0 |
|
3712 | 0 | static void |
3713 | 0 | r_poller_default_init (RPollerIface *iface) |
3714 | 0 | { |
3715 | | /* GObject signals for incoming D-Bus method calls: */ |
3716 | | /** |
3717 | | * RPoller::handle-poll: |
3718 | | * @object: A #RPoller. |
3719 | | * @invocation: A #GDBusMethodInvocation. |
3720 | | * |
3721 | | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-de-pengutronix-rauc-Poller.Poll">Poll()</link> D-Bus method. |
3722 | | * |
3723 | | * 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 r_poller_complete_poll() 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. |
3724 | | * |
3725 | | * 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. |
3726 | | */ |
3727 | 0 | g_signal_new ("handle-poll", |
3728 | 0 | G_TYPE_FROM_INTERFACE (iface), |
3729 | 0 | G_SIGNAL_RUN_LAST, |
3730 | 0 | G_STRUCT_OFFSET (RPollerIface, handle_poll), |
3731 | 0 | g_signal_accumulator_true_handled, |
3732 | 0 | NULL, |
3733 | 0 | g_cclosure_marshal_generic, |
3734 | 0 | G_TYPE_BOOLEAN, |
3735 | 0 | 1, |
3736 | 0 | G_TYPE_DBUS_METHOD_INVOCATION); |
3737 | | |
3738 | | /* GObject properties for D-Bus properties: */ |
3739 | | /** |
3740 | | * RPoller:next-poll: |
3741 | | * |
3742 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Poller.NextPoll">"NextPoll"</link>. |
3743 | | * |
3744 | | * 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. |
3745 | | */ |
3746 | 0 | g_object_interface_install_property (iface, |
3747 | 0 | g_param_spec_int64 ("next-poll", "NextPoll", "NextPoll", G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
3748 | | /** |
3749 | | * RPoller:status: |
3750 | | * |
3751 | | * Represents the D-Bus property <link linkend="gdbus-property-de-pengutronix-rauc-Poller.Status">"Status"</link>. |
3752 | | * |
3753 | | * 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. |
3754 | | */ |
3755 | 0 | g_object_interface_install_property (iface, |
3756 | 0 | g_param_spec_variant ("status", "Status", "Status", G_VARIANT_TYPE ("a{sv}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
3757 | 0 | } |
3758 | | |
3759 | | /** |
3760 | | * r_poller_get_next_poll: (skip) |
3761 | | * @object: A #RPoller. |
3762 | | * |
3763 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Poller.NextPoll">"NextPoll"</link> D-Bus property. |
3764 | | * |
3765 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
3766 | | * |
3767 | | * Returns: The property value. |
3768 | | */ |
3769 | | gint64 |
3770 | | r_poller_get_next_poll (RPoller *object) |
3771 | 0 | { |
3772 | 0 | g_return_val_if_fail (R_IS_POLLER (object), 0); |
3773 | | |
3774 | 0 | return R_POLLER_GET_IFACE (object)->get_next_poll (object); |
3775 | 0 | } |
3776 | | |
3777 | | /** |
3778 | | * r_poller_set_next_poll: (skip) |
3779 | | * @object: A #RPoller. |
3780 | | * @value: The value to set. |
3781 | | * |
3782 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Poller.NextPoll">"NextPoll"</link> D-Bus property to @value. |
3783 | | * |
3784 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
3785 | | */ |
3786 | | void |
3787 | | r_poller_set_next_poll (RPoller *object, gint64 value) |
3788 | 0 | { |
3789 | 0 | g_object_set (G_OBJECT (object), "next-poll", value, NULL); |
3790 | 0 | } |
3791 | | |
3792 | | /** |
3793 | | * r_poller_get_status: (skip) |
3794 | | * @object: A #RPoller. |
3795 | | * |
3796 | | * Gets the value of the <link linkend="gdbus-property-de-pengutronix-rauc-Poller.Status">"Status"</link> D-Bus property. |
3797 | | * |
3798 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
3799 | | * |
3800 | | * 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 r_poller_dup_status() if on another thread. |
3801 | | * |
3802 | | * 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. |
3803 | | */ |
3804 | | GVariant * |
3805 | | r_poller_get_status (RPoller *object) |
3806 | 0 | { |
3807 | 0 | g_return_val_if_fail (R_IS_POLLER (object), NULL); |
3808 | | |
3809 | 0 | return R_POLLER_GET_IFACE (object)->get_status (object); |
3810 | 0 | } |
3811 | | |
3812 | | /** |
3813 | | * r_poller_dup_status: (skip) |
3814 | | * @object: A #RPoller. |
3815 | | * |
3816 | | * Gets a copy of the <link linkend="gdbus-property-de-pengutronix-rauc-Poller.Status">"Status"</link> D-Bus property. |
3817 | | * |
3818 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
3819 | | * |
3820 | | * 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(). |
3821 | | */ |
3822 | | GVariant * |
3823 | | r_poller_dup_status (RPoller *object) |
3824 | 0 | { |
3825 | 0 | GVariant *value; |
3826 | 0 | g_object_get (G_OBJECT (object), "status", &value, NULL); |
3827 | 0 | return value; |
3828 | 0 | } |
3829 | | |
3830 | | /** |
3831 | | * r_poller_set_status: (skip) |
3832 | | * @object: A #RPoller. |
3833 | | * @value: The value to set. |
3834 | | * |
3835 | | * Sets the <link linkend="gdbus-property-de-pengutronix-rauc-Poller.Status">"Status"</link> D-Bus property to @value. |
3836 | | * |
3837 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
3838 | | */ |
3839 | | void |
3840 | | r_poller_set_status (RPoller *object, GVariant *value) |
3841 | 0 | { |
3842 | 0 | g_object_set (G_OBJECT (object), "status", value, NULL); |
3843 | 0 | } |
3844 | | |
3845 | | /** |
3846 | | * r_poller_call_poll: |
3847 | | * @proxy: A #RPollerProxy. |
3848 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3849 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
3850 | | * @user_data: User data to pass to @callback. |
3851 | | * |
3852 | | * Asynchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Poller.Poll">Poll()</link> D-Bus method on @proxy. |
3853 | | * 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()). |
3854 | | * You can then call r_poller_call_poll_finish() to get the result of the operation. |
3855 | | * |
3856 | | * See r_poller_call_poll_sync() for the synchronous, blocking version of this method. |
3857 | | */ |
3858 | | void |
3859 | | r_poller_call_poll ( |
3860 | | RPoller *proxy, |
3861 | | GCancellable *cancellable, |
3862 | | GAsyncReadyCallback callback, |
3863 | | gpointer user_data) |
3864 | 0 | { |
3865 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
3866 | 0 | "Poll", |
3867 | 0 | g_variant_new ("()"), |
3868 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3869 | 0 | -1, |
3870 | 0 | cancellable, |
3871 | 0 | callback, |
3872 | 0 | user_data); |
3873 | 0 | } |
3874 | | |
3875 | | /** |
3876 | | * r_poller_call_poll_finish: |
3877 | | * @proxy: A #RPollerProxy. |
3878 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_poller_call_poll(). |
3879 | | * @error: Return location for error or %NULL. |
3880 | | * |
3881 | | * Finishes an operation started with r_poller_call_poll(). |
3882 | | * |
3883 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
3884 | | */ |
3885 | | gboolean |
3886 | | r_poller_call_poll_finish ( |
3887 | | RPoller *proxy, |
3888 | | GAsyncResult *res, |
3889 | | GError **error) |
3890 | 0 | { |
3891 | 0 | GVariant *_ret; |
3892 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
3893 | 0 | if (_ret == NULL) |
3894 | 0 | goto _out; |
3895 | 0 | g_variant_get (_ret, |
3896 | 0 | "()"); |
3897 | 0 | g_variant_unref (_ret); |
3898 | 0 | _out: |
3899 | 0 | return _ret != NULL; |
3900 | 0 | } |
3901 | | |
3902 | | /** |
3903 | | * r_poller_call_poll_sync: |
3904 | | * @proxy: A #RPollerProxy. |
3905 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3906 | | * @error: Return location for error or %NULL. |
3907 | | * |
3908 | | * Synchronously invokes the <link linkend="gdbus-method-de-pengutronix-rauc-Poller.Poll">Poll()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
3909 | | * |
3910 | | * See r_poller_call_poll() for the asynchronous version of this method. |
3911 | | * |
3912 | | * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
3913 | | */ |
3914 | | gboolean |
3915 | | r_poller_call_poll_sync ( |
3916 | | RPoller *proxy, |
3917 | | GCancellable *cancellable, |
3918 | | GError **error) |
3919 | 0 | { |
3920 | 0 | GVariant *_ret; |
3921 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
3922 | 0 | "Poll", |
3923 | 0 | g_variant_new ("()"), |
3924 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3925 | 0 | -1, |
3926 | 0 | cancellable, |
3927 | 0 | error); |
3928 | 0 | if (_ret == NULL) |
3929 | 0 | goto _out; |
3930 | 0 | g_variant_get (_ret, |
3931 | 0 | "()"); |
3932 | 0 | g_variant_unref (_ret); |
3933 | 0 | _out: |
3934 | 0 | return _ret != NULL; |
3935 | 0 | } |
3936 | | |
3937 | | /** |
3938 | | * r_poller_complete_poll: |
3939 | | * @object: A #RPoller. |
3940 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
3941 | | * |
3942 | | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-de-pengutronix-rauc-Poller.Poll">Poll()</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. |
3943 | | * |
3944 | | * This method will free @invocation, you cannot use it afterwards. |
3945 | | */ |
3946 | | void |
3947 | | r_poller_complete_poll ( |
3948 | | RPoller *object G_GNUC_UNUSED, |
3949 | | GDBusMethodInvocation *invocation) |
3950 | 0 | { |
3951 | 0 | g_dbus_method_invocation_return_value (invocation, |
3952 | 0 | g_variant_new ("()")); |
3953 | 0 | } |
3954 | | |
3955 | | /* ------------------------------------------------------------------------ */ |
3956 | | |
3957 | | /** |
3958 | | * RPollerProxy: |
3959 | | * |
3960 | | * The #RPollerProxy structure contains only private data and should only be accessed using the provided API. |
3961 | | */ |
3962 | | |
3963 | | /** |
3964 | | * RPollerProxyClass: |
3965 | | * @parent_class: The parent class. |
3966 | | * |
3967 | | * Class structure for #RPollerProxy. |
3968 | | */ |
3969 | | |
3970 | | struct _RPollerProxyPrivate |
3971 | | { |
3972 | | GData *qdata; |
3973 | | }; |
3974 | | |
3975 | | static void r_poller_proxy_iface_init (RPollerIface *iface); |
3976 | | |
3977 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3978 | 0 | G_DEFINE_TYPE_WITH_CODE (RPollerProxy, r_poller_proxy, G_TYPE_DBUS_PROXY, |
3979 | 0 | G_ADD_PRIVATE (RPollerProxy) |
3980 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_POLLER, r_poller_proxy_iface_init)) |
3981 | 0 |
|
3982 | 0 | #else |
3983 | 0 | G_DEFINE_TYPE_WITH_CODE (RPollerProxy, r_poller_proxy, G_TYPE_DBUS_PROXY, |
3984 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_POLLER, r_poller_proxy_iface_init)) |
3985 | 0 |
|
3986 | 0 | #endif |
3987 | 0 | static void |
3988 | 0 | r_poller_proxy_finalize (GObject *object) |
3989 | 0 | { |
3990 | 0 | RPollerProxy *proxy = R_POLLER_PROXY (object); |
3991 | 0 | g_datalist_clear (&proxy->priv->qdata); |
3992 | 0 | G_OBJECT_CLASS (r_poller_proxy_parent_class)->finalize (object); |
3993 | 0 | } |
3994 | | |
3995 | | static void |
3996 | | r_poller_proxy_get_property (GObject *object, |
3997 | | guint prop_id, |
3998 | | GValue *value, |
3999 | | GParamSpec *pspec G_GNUC_UNUSED) |
4000 | 0 | { |
4001 | 0 | const _ExtendedGDBusPropertyInfo *info; |
4002 | 0 | GVariant *variant; |
4003 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
4004 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_poller_property_info_pointers[prop_id - 1]; |
4005 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
4006 | 0 | if (info->use_gvariant) |
4007 | 0 | { |
4008 | 0 | g_value_set_variant (value, variant); |
4009 | 0 | } |
4010 | 0 | else |
4011 | 0 | { |
4012 | 0 | if (variant != NULL) |
4013 | 0 | g_dbus_gvariant_to_gvalue (variant, value); |
4014 | 0 | } |
4015 | 0 | if (variant != NULL) |
4016 | 0 | g_variant_unref (variant); |
4017 | 0 | } |
4018 | | |
4019 | | static void |
4020 | | r_poller_proxy_set_property_cb (GDBusProxy *proxy, |
4021 | | GAsyncResult *res, |
4022 | | gpointer user_data) |
4023 | 0 | { |
4024 | 0 | const _ExtendedGDBusPropertyInfo *info = user_data; |
4025 | 0 | GError *error; |
4026 | 0 | GVariant *_ret; |
4027 | 0 | error = NULL; |
4028 | 0 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
4029 | 0 | if (!_ret) |
4030 | 0 | { |
4031 | 0 | g_warning ("Error setting property '%s' on interface de.pengutronix.rauc.Poller: %s (%s, %d)", |
4032 | 0 | info->parent_struct.name, |
4033 | 0 | error->message, g_quark_to_string (error->domain), error->code); |
4034 | 0 | g_error_free (error); |
4035 | 0 | } |
4036 | 0 | else |
4037 | 0 | { |
4038 | 0 | g_variant_unref (_ret); |
4039 | 0 | } |
4040 | 0 | } |
4041 | | |
4042 | | static void |
4043 | | r_poller_proxy_set_property (GObject *object, |
4044 | | guint prop_id, |
4045 | | const GValue *value, |
4046 | | GParamSpec *pspec G_GNUC_UNUSED) |
4047 | 0 | { |
4048 | 0 | const _ExtendedGDBusPropertyInfo *info; |
4049 | 0 | GVariant *variant; |
4050 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
4051 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_poller_property_info_pointers[prop_id - 1]; |
4052 | 0 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
4053 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
4054 | 0 | "org.freedesktop.DBus.Properties.Set", |
4055 | 0 | g_variant_new ("(ssv)", "de.pengutronix.rauc.Poller", info->parent_struct.name, variant), |
4056 | 0 | G_DBUS_CALL_FLAGS_NONE, |
4057 | 0 | -1, |
4058 | 0 | NULL, (GAsyncReadyCallback) r_poller_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
4059 | 0 | g_variant_unref (variant); |
4060 | 0 | } |
4061 | | |
4062 | | static void |
4063 | | r_poller_proxy_g_signal (GDBusProxy *proxy, |
4064 | | const gchar *sender_name G_GNUC_UNUSED, |
4065 | | const gchar *signal_name, |
4066 | | GVariant *parameters) |
4067 | 0 | { |
4068 | 0 | _ExtendedGDBusSignalInfo *info; |
4069 | 0 | GVariantIter iter; |
4070 | 0 | GVariant *child; |
4071 | 0 | GValue *paramv; |
4072 | 0 | gsize num_params; |
4073 | 0 | gsize n; |
4074 | 0 | guint signal_id; |
4075 | 0 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct, signal_name); |
4076 | 0 | if (info == NULL) |
4077 | 0 | return; |
4078 | 0 | num_params = g_variant_n_children (parameters); |
4079 | 0 | paramv = g_new0 (GValue, num_params + 1); |
4080 | 0 | g_value_init (¶mv[0], R_TYPE_POLLER); |
4081 | 0 | g_value_set_object (¶mv[0], proxy); |
4082 | 0 | g_variant_iter_init (&iter, parameters); |
4083 | 0 | n = 1; |
4084 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
4085 | 0 | { |
4086 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
4087 | 0 | if (arg_info->use_gvariant) |
4088 | 0 | { |
4089 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
4090 | 0 | g_value_set_variant (¶mv[n], child); |
4091 | 0 | n++; |
4092 | 0 | } |
4093 | 0 | else |
4094 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
4095 | 0 | g_variant_unref (child); |
4096 | 0 | } |
4097 | 0 | signal_id = g_signal_lookup (info->signal_name, R_TYPE_POLLER); |
4098 | 0 | g_signal_emitv (paramv, signal_id, 0, NULL); |
4099 | 0 | for (n = 0; n < num_params + 1; n++) |
4100 | 0 | g_value_unset (¶mv[n]); |
4101 | 0 | g_free (paramv); |
4102 | 0 | } |
4103 | | |
4104 | | static void |
4105 | | r_poller_proxy_g_properties_changed (GDBusProxy *_proxy, |
4106 | | GVariant *changed_properties, |
4107 | | const gchar *const *invalidated_properties) |
4108 | 0 | { |
4109 | 0 | RPollerProxy *proxy = R_POLLER_PROXY (_proxy); |
4110 | 0 | guint n; |
4111 | 0 | const gchar *key; |
4112 | 0 | GVariantIter *iter; |
4113 | 0 | _ExtendedGDBusPropertyInfo *info; |
4114 | 0 | g_variant_get (changed_properties, "a{sv}", &iter); |
4115 | 0 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
4116 | 0 | { |
4117 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct, key); |
4118 | 0 | g_datalist_remove_data (&proxy->priv->qdata, key); |
4119 | 0 | if (info != NULL) |
4120 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
4121 | 0 | } |
4122 | 0 | g_variant_iter_free (iter); |
4123 | 0 | for (n = 0; invalidated_properties[n] != NULL; n++) |
4124 | 0 | { |
4125 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct, invalidated_properties[n]); |
4126 | 0 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
4127 | 0 | if (info != NULL) |
4128 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
4129 | 0 | } |
4130 | 0 | } |
4131 | | |
4132 | | static gint64 |
4133 | | r_poller_proxy_get_next_poll (RPoller *object) |
4134 | 0 | { |
4135 | 0 | RPollerProxy *proxy = R_POLLER_PROXY (object); |
4136 | 0 | GVariant *variant; |
4137 | 0 | gint64 value = 0; |
4138 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "NextPoll"); |
4139 | 0 | if (variant != NULL) |
4140 | 0 | { |
4141 | 0 | value = g_variant_get_int64 (variant); |
4142 | 0 | g_variant_unref (variant); |
4143 | 0 | } |
4144 | 0 | return value; |
4145 | 0 | } |
4146 | | |
4147 | | static GVariant * |
4148 | | r_poller_proxy_get_status (RPoller *object) |
4149 | 0 | { |
4150 | 0 | RPollerProxy *proxy = R_POLLER_PROXY (object); |
4151 | 0 | GVariant *variant; |
4152 | 0 | GVariant *value = NULL; |
4153 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Status"); |
4154 | 0 | value = variant; |
4155 | 0 | if (variant != NULL) |
4156 | 0 | g_variant_unref (variant); |
4157 | 0 | return value; |
4158 | 0 | } |
4159 | | |
4160 | | static void |
4161 | | r_poller_proxy_init (RPollerProxy *proxy) |
4162 | 0 | { |
4163 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4164 | 0 | proxy->priv = r_poller_proxy_get_instance_private (proxy); |
4165 | | #else |
4166 | | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, R_TYPE_POLLER_PROXY, RPollerProxyPrivate); |
4167 | | #endif |
4168 | |
|
4169 | 0 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), r_poller_interface_info ()); |
4170 | 0 | } |
4171 | | |
4172 | | static void |
4173 | | r_poller_proxy_class_init (RPollerProxyClass *klass) |
4174 | 0 | { |
4175 | 0 | GObjectClass *gobject_class; |
4176 | 0 | GDBusProxyClass *proxy_class; |
4177 | |
|
4178 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
4179 | 0 | gobject_class->finalize = r_poller_proxy_finalize; |
4180 | 0 | gobject_class->get_property = r_poller_proxy_get_property; |
4181 | 0 | gobject_class->set_property = r_poller_proxy_set_property; |
4182 | |
|
4183 | 0 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
4184 | 0 | proxy_class->g_signal = r_poller_proxy_g_signal; |
4185 | 0 | proxy_class->g_properties_changed = r_poller_proxy_g_properties_changed; |
4186 | |
|
4187 | 0 | r_poller_override_properties (gobject_class, 1); |
4188 | |
|
4189 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
4190 | | g_type_class_add_private (klass, sizeof (RPollerProxyPrivate)); |
4191 | | #endif |
4192 | 0 | } |
4193 | | |
4194 | | static void |
4195 | | r_poller_proxy_iface_init (RPollerIface *iface) |
4196 | 0 | { |
4197 | 0 | iface->get_next_poll = r_poller_proxy_get_next_poll; |
4198 | 0 | iface->get_status = r_poller_proxy_get_status; |
4199 | 0 | } |
4200 | | |
4201 | | /** |
4202 | | * r_poller_proxy_new: |
4203 | | * @connection: A #GDBusConnection. |
4204 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4205 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
4206 | | * @object_path: An object path. |
4207 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4208 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
4209 | | * @user_data: User data to pass to @callback. |
4210 | | * |
4211 | | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link>. See g_dbus_proxy_new() for more details. |
4212 | | * |
4213 | | * 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()). |
4214 | | * You can then call r_poller_proxy_new_finish() to get the result of the operation. |
4215 | | * |
4216 | | * See r_poller_proxy_new_sync() for the synchronous, blocking version of this constructor. |
4217 | | */ |
4218 | | void |
4219 | | r_poller_proxy_new ( |
4220 | | GDBusConnection *connection, |
4221 | | GDBusProxyFlags flags, |
4222 | | const gchar *name, |
4223 | | const gchar *object_path, |
4224 | | GCancellable *cancellable, |
4225 | | GAsyncReadyCallback callback, |
4226 | | gpointer user_data) |
4227 | 0 | { |
4228 | 0 | g_async_initable_new_async (R_TYPE_POLLER_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", "de.pengutronix.rauc.Poller", NULL); |
4229 | 0 | } |
4230 | | |
4231 | | /** |
4232 | | * r_poller_proxy_new_finish: |
4233 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_poller_proxy_new(). |
4234 | | * @error: Return location for error or %NULL |
4235 | | * |
4236 | | * Finishes an operation started with r_poller_proxy_new(). |
4237 | | * |
4238 | | * Returns: (transfer full) (type RPollerProxy): The constructed proxy object or %NULL if @error is set. |
4239 | | */ |
4240 | | RPoller * |
4241 | | r_poller_proxy_new_finish ( |
4242 | | GAsyncResult *res, |
4243 | | GError **error) |
4244 | 0 | { |
4245 | 0 | GObject *ret; |
4246 | 0 | GObject *source_object; |
4247 | 0 | source_object = g_async_result_get_source_object (res); |
4248 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
4249 | 0 | g_object_unref (source_object); |
4250 | 0 | if (ret != NULL) |
4251 | 0 | return R_POLLER (ret); |
4252 | 0 | else |
4253 | 0 | return NULL; |
4254 | 0 | } |
4255 | | |
4256 | | /** |
4257 | | * r_poller_proxy_new_sync: |
4258 | | * @connection: A #GDBusConnection. |
4259 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4260 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
4261 | | * @object_path: An object path. |
4262 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4263 | | * @error: Return location for error or %NULL |
4264 | | * |
4265 | | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link>. See g_dbus_proxy_new_sync() for more details. |
4266 | | * |
4267 | | * The calling thread is blocked until a reply is received. |
4268 | | * |
4269 | | * See r_poller_proxy_new() for the asynchronous version of this constructor. |
4270 | | * |
4271 | | * Returns: (transfer full) (type RPollerProxy): The constructed proxy object or %NULL if @error is set. |
4272 | | */ |
4273 | | RPoller * |
4274 | | r_poller_proxy_new_sync ( |
4275 | | GDBusConnection *connection, |
4276 | | GDBusProxyFlags flags, |
4277 | | const gchar *name, |
4278 | | const gchar *object_path, |
4279 | | GCancellable *cancellable, |
4280 | | GError **error) |
4281 | 0 | { |
4282 | 0 | GInitable *ret; |
4283 | 0 | ret = g_initable_new (R_TYPE_POLLER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "de.pengutronix.rauc.Poller", NULL); |
4284 | 0 | if (ret != NULL) |
4285 | 0 | return R_POLLER (ret); |
4286 | 0 | else |
4287 | 0 | return NULL; |
4288 | 0 | } |
4289 | | |
4290 | | |
4291 | | /** |
4292 | | * r_poller_proxy_new_for_bus: |
4293 | | * @bus_type: A #GBusType. |
4294 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4295 | | * @name: A bus name (well-known or unique). |
4296 | | * @object_path: An object path. |
4297 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4298 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
4299 | | * @user_data: User data to pass to @callback. |
4300 | | * |
4301 | | * Like r_poller_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
4302 | | * |
4303 | | * 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()). |
4304 | | * You can then call r_poller_proxy_new_for_bus_finish() to get the result of the operation. |
4305 | | * |
4306 | | * See r_poller_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
4307 | | */ |
4308 | | void |
4309 | | r_poller_proxy_new_for_bus ( |
4310 | | GBusType bus_type, |
4311 | | GDBusProxyFlags flags, |
4312 | | const gchar *name, |
4313 | | const gchar *object_path, |
4314 | | GCancellable *cancellable, |
4315 | | GAsyncReadyCallback callback, |
4316 | | gpointer user_data) |
4317 | 0 | { |
4318 | 0 | g_async_initable_new_async (R_TYPE_POLLER_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", "de.pengutronix.rauc.Poller", NULL); |
4319 | 0 | } |
4320 | | |
4321 | | /** |
4322 | | * r_poller_proxy_new_for_bus_finish: |
4323 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to r_poller_proxy_new_for_bus(). |
4324 | | * @error: Return location for error or %NULL |
4325 | | * |
4326 | | * Finishes an operation started with r_poller_proxy_new_for_bus(). |
4327 | | * |
4328 | | * Returns: (transfer full) (type RPollerProxy): The constructed proxy object or %NULL if @error is set. |
4329 | | */ |
4330 | | RPoller * |
4331 | | r_poller_proxy_new_for_bus_finish ( |
4332 | | GAsyncResult *res, |
4333 | | GError **error) |
4334 | 0 | { |
4335 | 0 | GObject *ret; |
4336 | 0 | GObject *source_object; |
4337 | 0 | source_object = g_async_result_get_source_object (res); |
4338 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
4339 | 0 | g_object_unref (source_object); |
4340 | 0 | if (ret != NULL) |
4341 | 0 | return R_POLLER (ret); |
4342 | 0 | else |
4343 | 0 | return NULL; |
4344 | 0 | } |
4345 | | |
4346 | | /** |
4347 | | * r_poller_proxy_new_for_bus_sync: |
4348 | | * @bus_type: A #GBusType. |
4349 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4350 | | * @name: A bus name (well-known or unique). |
4351 | | * @object_path: An object path. |
4352 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4353 | | * @error: Return location for error or %NULL |
4354 | | * |
4355 | | * Like r_poller_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
4356 | | * |
4357 | | * The calling thread is blocked until a reply is received. |
4358 | | * |
4359 | | * See r_poller_proxy_new_for_bus() for the asynchronous version of this constructor. |
4360 | | * |
4361 | | * Returns: (transfer full) (type RPollerProxy): The constructed proxy object or %NULL if @error is set. |
4362 | | */ |
4363 | | RPoller * |
4364 | | r_poller_proxy_new_for_bus_sync ( |
4365 | | GBusType bus_type, |
4366 | | GDBusProxyFlags flags, |
4367 | | const gchar *name, |
4368 | | const gchar *object_path, |
4369 | | GCancellable *cancellable, |
4370 | | GError **error) |
4371 | 0 | { |
4372 | 0 | GInitable *ret; |
4373 | 0 | ret = g_initable_new (R_TYPE_POLLER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "de.pengutronix.rauc.Poller", NULL); |
4374 | 0 | if (ret != NULL) |
4375 | 0 | return R_POLLER (ret); |
4376 | 0 | else |
4377 | 0 | return NULL; |
4378 | 0 | } |
4379 | | |
4380 | | |
4381 | | /* ------------------------------------------------------------------------ */ |
4382 | | |
4383 | | /** |
4384 | | * RPollerSkeleton: |
4385 | | * |
4386 | | * The #RPollerSkeleton structure contains only private data and should only be accessed using the provided API. |
4387 | | */ |
4388 | | |
4389 | | /** |
4390 | | * RPollerSkeletonClass: |
4391 | | * @parent_class: The parent class. |
4392 | | * |
4393 | | * Class structure for #RPollerSkeleton. |
4394 | | */ |
4395 | | |
4396 | | struct _RPollerSkeletonPrivate |
4397 | | { |
4398 | | GValue *properties; |
4399 | | GList *changed_properties; |
4400 | | GSource *changed_properties_idle_source; |
4401 | | GMainContext *context; |
4402 | | GMutex lock; |
4403 | | }; |
4404 | | |
4405 | | static void |
4406 | | _r_poller_skeleton_handle_method_call ( |
4407 | | GDBusConnection *connection G_GNUC_UNUSED, |
4408 | | const gchar *sender G_GNUC_UNUSED, |
4409 | | const gchar *object_path G_GNUC_UNUSED, |
4410 | | const gchar *interface_name, |
4411 | | const gchar *method_name, |
4412 | | GVariant *parameters, |
4413 | | GDBusMethodInvocation *invocation, |
4414 | | gpointer user_data) |
4415 | 0 | { |
4416 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (user_data); |
4417 | 0 | _ExtendedGDBusMethodInfo *info; |
4418 | 0 | GVariantIter iter; |
4419 | 0 | GVariant *child; |
4420 | 0 | GValue *paramv; |
4421 | 0 | gsize num_params; |
4422 | 0 | guint num_extra; |
4423 | 0 | gsize n; |
4424 | 0 | guint signal_id; |
4425 | 0 | GValue return_value = G_VALUE_INIT; |
4426 | 0 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
4427 | 0 | g_assert (info != NULL); |
4428 | 0 | num_params = g_variant_n_children (parameters); |
4429 | 0 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
4430 | 0 | n = 0; |
4431 | 0 | g_value_init (¶mv[n], R_TYPE_POLLER); |
4432 | 0 | g_value_set_object (¶mv[n++], skeleton); |
4433 | 0 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
4434 | 0 | g_value_set_object (¶mv[n++], invocation); |
4435 | 0 | if (info->pass_fdlist) |
4436 | 0 | { |
4437 | 0 | #ifdef G_OS_UNIX |
4438 | 0 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
4439 | 0 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
4440 | | #else |
4441 | | g_assert_not_reached (); |
4442 | | #endif |
4443 | 0 | } |
4444 | 0 | g_variant_iter_init (&iter, parameters); |
4445 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
4446 | 0 | { |
4447 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
4448 | 0 | if (arg_info->use_gvariant) |
4449 | 0 | { |
4450 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
4451 | 0 | g_value_set_variant (¶mv[n], child); |
4452 | 0 | n++; |
4453 | 0 | } |
4454 | 0 | else |
4455 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
4456 | 0 | g_variant_unref (child); |
4457 | 0 | } |
4458 | 0 | signal_id = g_signal_lookup (info->signal_name, R_TYPE_POLLER); |
4459 | 0 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
4460 | 0 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
4461 | 0 | if (!g_value_get_boolean (&return_value)) |
4462 | 0 | 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); |
4463 | 0 | g_value_unset (&return_value); |
4464 | 0 | for (n = 0; n < num_params + num_extra; n++) |
4465 | 0 | g_value_unset (¶mv[n]); |
4466 | 0 | g_free (paramv); |
4467 | 0 | } |
4468 | | |
4469 | | static GVariant * |
4470 | | _r_poller_skeleton_handle_get_property ( |
4471 | | GDBusConnection *connection G_GNUC_UNUSED, |
4472 | | const gchar *sender G_GNUC_UNUSED, |
4473 | | const gchar *object_path G_GNUC_UNUSED, |
4474 | | const gchar *interface_name G_GNUC_UNUSED, |
4475 | | const gchar *property_name, |
4476 | | GError **error, |
4477 | | gpointer user_data) |
4478 | 0 | { |
4479 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (user_data); |
4480 | 0 | GValue value = G_VALUE_INIT; |
4481 | 0 | GParamSpec *pspec; |
4482 | 0 | _ExtendedGDBusPropertyInfo *info; |
4483 | 0 | GVariant *ret; |
4484 | 0 | ret = NULL; |
4485 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct, property_name); |
4486 | 0 | g_assert (info != NULL); |
4487 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
4488 | 0 | if (pspec == NULL) |
4489 | 0 | { |
4490 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
4491 | 0 | } |
4492 | 0 | else |
4493 | 0 | { |
4494 | 0 | g_value_init (&value, pspec->value_type); |
4495 | 0 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
4496 | 0 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
4497 | 0 | g_value_unset (&value); |
4498 | 0 | } |
4499 | 0 | return ret; |
4500 | 0 | } |
4501 | | |
4502 | | static gboolean |
4503 | | _r_poller_skeleton_handle_set_property ( |
4504 | | GDBusConnection *connection G_GNUC_UNUSED, |
4505 | | const gchar *sender G_GNUC_UNUSED, |
4506 | | const gchar *object_path G_GNUC_UNUSED, |
4507 | | const gchar *interface_name G_GNUC_UNUSED, |
4508 | | const gchar *property_name, |
4509 | | GVariant *variant, |
4510 | | GError **error, |
4511 | | gpointer user_data) |
4512 | 0 | { |
4513 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (user_data); |
4514 | 0 | GValue value = G_VALUE_INIT; |
4515 | 0 | GParamSpec *pspec; |
4516 | 0 | _ExtendedGDBusPropertyInfo *info; |
4517 | 0 | gboolean ret; |
4518 | 0 | ret = FALSE; |
4519 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_r_poller_interface_info.parent_struct, property_name); |
4520 | 0 | g_assert (info != NULL); |
4521 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
4522 | 0 | if (pspec == NULL) |
4523 | 0 | { |
4524 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
4525 | 0 | } |
4526 | 0 | else |
4527 | 0 | { |
4528 | 0 | if (info->use_gvariant) |
4529 | 0 | g_value_set_variant (&value, variant); |
4530 | 0 | else |
4531 | 0 | g_dbus_gvariant_to_gvalue (variant, &value); |
4532 | 0 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
4533 | 0 | g_value_unset (&value); |
4534 | 0 | ret = TRUE; |
4535 | 0 | } |
4536 | 0 | return ret; |
4537 | 0 | } |
4538 | | |
4539 | | static const GDBusInterfaceVTable _r_poller_skeleton_vtable = |
4540 | | { |
4541 | | _r_poller_skeleton_handle_method_call, |
4542 | | _r_poller_skeleton_handle_get_property, |
4543 | | _r_poller_skeleton_handle_set_property, |
4544 | | {NULL} |
4545 | | }; |
4546 | | |
4547 | | static GDBusInterfaceInfo * |
4548 | | r_poller_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
4549 | 0 | { |
4550 | 0 | return r_poller_interface_info (); |
4551 | 0 | } |
4552 | | |
4553 | | static GDBusInterfaceVTable * |
4554 | | r_poller_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
4555 | 0 | { |
4556 | 0 | return (GDBusInterfaceVTable *) &_r_poller_skeleton_vtable; |
4557 | 0 | } |
4558 | | |
4559 | | static GVariant * |
4560 | | r_poller_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
4561 | 0 | { |
4562 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (_skeleton); |
4563 | |
|
4564 | 0 | GVariantBuilder builder; |
4565 | 0 | guint n; |
4566 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
4567 | 0 | if (_r_poller_interface_info.parent_struct.properties == NULL) |
4568 | 0 | goto out; |
4569 | 0 | for (n = 0; _r_poller_interface_info.parent_struct.properties[n] != NULL; n++) |
4570 | 0 | { |
4571 | 0 | GDBusPropertyInfo *info = _r_poller_interface_info.parent_struct.properties[n]; |
4572 | 0 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
4573 | 0 | { |
4574 | 0 | GVariant *value; |
4575 | 0 | value = _r_poller_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)), "de.pengutronix.rauc.Poller", info->name, NULL, skeleton); |
4576 | 0 | if (value != NULL) |
4577 | 0 | { |
4578 | 0 | g_variant_take_ref (value); |
4579 | 0 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
4580 | 0 | g_variant_unref (value); |
4581 | 0 | } |
4582 | 0 | } |
4583 | 0 | } |
4584 | 0 | out: |
4585 | 0 | return g_variant_builder_end (&builder); |
4586 | 0 | } |
4587 | | |
4588 | | static gboolean _r_poller_emit_changed (gpointer user_data); |
4589 | | |
4590 | | static void |
4591 | | r_poller_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
4592 | 0 | { |
4593 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (_skeleton); |
4594 | 0 | gboolean emit_changed = FALSE; |
4595 | |
|
4596 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4597 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
4598 | 0 | { |
4599 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
4600 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
4601 | 0 | emit_changed = TRUE; |
4602 | 0 | } |
4603 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4604 | |
|
4605 | 0 | if (emit_changed) |
4606 | 0 | _r_poller_emit_changed (skeleton); |
4607 | 0 | } |
4608 | | |
4609 | | static void r_poller_skeleton_iface_init (RPollerIface *iface); |
4610 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4611 | 0 | G_DEFINE_TYPE_WITH_CODE (RPollerSkeleton, r_poller_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
4612 | 0 | G_ADD_PRIVATE (RPollerSkeleton) |
4613 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_POLLER, r_poller_skeleton_iface_init)) |
4614 | 0 |
|
4615 | 0 | #else |
4616 | 0 | G_DEFINE_TYPE_WITH_CODE (RPollerSkeleton, r_poller_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
4617 | 0 | G_IMPLEMENT_INTERFACE (R_TYPE_POLLER, r_poller_skeleton_iface_init)) |
4618 | 0 |
|
4619 | 0 | #endif |
4620 | 0 | static void |
4621 | 0 | r_poller_skeleton_finalize (GObject *object) |
4622 | 0 | { |
4623 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4624 | 0 | guint n; |
4625 | 0 | for (n = 0; n < 2; n++) |
4626 | 0 | g_value_unset (&skeleton->priv->properties[n]); |
4627 | 0 | g_free (skeleton->priv->properties); |
4628 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
4629 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
4630 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
4631 | 0 | g_main_context_unref (skeleton->priv->context); |
4632 | 0 | g_mutex_clear (&skeleton->priv->lock); |
4633 | 0 | G_OBJECT_CLASS (r_poller_skeleton_parent_class)->finalize (object); |
4634 | 0 | } |
4635 | | |
4636 | | static void |
4637 | | r_poller_skeleton_get_property (GObject *object, |
4638 | | guint prop_id, |
4639 | | GValue *value, |
4640 | | GParamSpec *pspec G_GNUC_UNUSED) |
4641 | 0 | { |
4642 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4643 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
4644 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4645 | 0 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
4646 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4647 | 0 | } |
4648 | | |
4649 | | static gboolean |
4650 | | _r_poller_emit_changed (gpointer user_data) |
4651 | 0 | { |
4652 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (user_data); |
4653 | 0 | GList *l; |
4654 | 0 | GVariantBuilder builder; |
4655 | 0 | GVariantBuilder invalidated_builder; |
4656 | 0 | guint num_changes; |
4657 | |
|
4658 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4659 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
4660 | 0 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
4661 | 0 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
4662 | 0 | { |
4663 | 0 | ChangedProperty *cp = l->data; |
4664 | 0 | GVariant *variant; |
4665 | 0 | const GValue *cur_value; |
4666 | |
|
4667 | 0 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
4668 | 0 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
4669 | 0 | { |
4670 | 0 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
4671 | 0 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
4672 | 0 | g_variant_unref (variant); |
4673 | 0 | num_changes++; |
4674 | 0 | } |
4675 | 0 | } |
4676 | 0 | if (num_changes > 0) |
4677 | 0 | { |
4678 | 0 | GList *connections, *ll; |
4679 | 0 | GVariant *signal_variant; |
4680 | 0 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "de.pengutronix.rauc.Poller", |
4681 | 0 | &builder, &invalidated_builder)); |
4682 | 0 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
4683 | 0 | for (ll = connections; ll != NULL; ll = ll->next) |
4684 | 0 | { |
4685 | 0 | GDBusConnection *connection = ll->data; |
4686 | |
|
4687 | 0 | g_dbus_connection_emit_signal (connection, |
4688 | 0 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
4689 | 0 | "org.freedesktop.DBus.Properties", |
4690 | 0 | "PropertiesChanged", |
4691 | 0 | signal_variant, |
4692 | 0 | NULL); |
4693 | 0 | } |
4694 | 0 | g_variant_unref (signal_variant); |
4695 | 0 | g_list_free_full (connections, g_object_unref); |
4696 | 0 | } |
4697 | 0 | else |
4698 | 0 | { |
4699 | 0 | g_variant_builder_clear (&builder); |
4700 | 0 | g_variant_builder_clear (&invalidated_builder); |
4701 | 0 | } |
4702 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
4703 | 0 | skeleton->priv->changed_properties = NULL; |
4704 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
4705 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4706 | 0 | return FALSE; |
4707 | 0 | } |
4708 | | |
4709 | | static void |
4710 | | _r_poller_schedule_emit_changed (RPollerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
4711 | 0 | { |
4712 | 0 | ChangedProperty *cp; |
4713 | 0 | GList *l; |
4714 | 0 | cp = NULL; |
4715 | 0 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
4716 | 0 | { |
4717 | 0 | ChangedProperty *i_cp = l->data; |
4718 | 0 | if (i_cp->info == info) |
4719 | 0 | { |
4720 | 0 | cp = i_cp; |
4721 | 0 | break; |
4722 | 0 | } |
4723 | 0 | } |
4724 | 0 | if (cp == NULL) |
4725 | 0 | { |
4726 | 0 | cp = g_new0 (ChangedProperty, 1); |
4727 | 0 | cp->prop_id = prop_id; |
4728 | 0 | cp->info = info; |
4729 | 0 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
4730 | 0 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
4731 | 0 | g_value_copy (orig_value, &cp->orig_value); |
4732 | 0 | } |
4733 | 0 | } |
4734 | | |
4735 | | static void |
4736 | | r_poller_skeleton_notify (GObject *object, |
4737 | | GParamSpec *pspec G_GNUC_UNUSED) |
4738 | 0 | { |
4739 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4740 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4741 | 0 | if (skeleton->priv->changed_properties != NULL && |
4742 | 0 | skeleton->priv->changed_properties_idle_source == NULL) |
4743 | 0 | { |
4744 | 0 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
4745 | 0 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
4746 | 0 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _r_poller_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
4747 | 0 | g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _r_poller_emit_changed"); |
4748 | 0 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
4749 | 0 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
4750 | 0 | } |
4751 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4752 | 0 | } |
4753 | | |
4754 | | static void |
4755 | | r_poller_skeleton_set_property (GObject *object, |
4756 | | guint prop_id, |
4757 | | const GValue *value, |
4758 | | GParamSpec *pspec) |
4759 | 0 | { |
4760 | 0 | const _ExtendedGDBusPropertyInfo *info; |
4761 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4762 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 2); |
4763 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _r_poller_property_info_pointers[prop_id - 1]; |
4764 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4765 | 0 | g_object_freeze_notify (object); |
4766 | 0 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
4767 | 0 | { |
4768 | 0 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
4769 | 0 | info->emits_changed_signal) |
4770 | 0 | _r_poller_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
4771 | 0 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
4772 | 0 | g_object_notify_by_pspec (object, pspec); |
4773 | 0 | } |
4774 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4775 | 0 | g_object_thaw_notify (object); |
4776 | 0 | } |
4777 | | |
4778 | | static void |
4779 | | r_poller_skeleton_init (RPollerSkeleton *skeleton) |
4780 | 0 | { |
4781 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4782 | 0 | skeleton->priv = r_poller_skeleton_get_instance_private (skeleton); |
4783 | | #else |
4784 | | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, R_TYPE_POLLER_SKELETON, RPollerSkeletonPrivate); |
4785 | | #endif |
4786 | |
|
4787 | 0 | g_mutex_init (&skeleton->priv->lock); |
4788 | 0 | skeleton->priv->context = g_main_context_ref_thread_default (); |
4789 | 0 | skeleton->priv->properties = g_new0 (GValue, 2); |
4790 | 0 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT64); |
4791 | 0 | g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); |
4792 | 0 | } |
4793 | | |
4794 | | static gint64 |
4795 | | r_poller_skeleton_get_next_poll (RPoller *object) |
4796 | 0 | { |
4797 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4798 | 0 | gint64 value; |
4799 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4800 | 0 | value = g_value_get_int64 (&(skeleton->priv->properties[0])); |
4801 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4802 | 0 | return value; |
4803 | 0 | } |
4804 | | |
4805 | | static GVariant * |
4806 | | r_poller_skeleton_get_status (RPoller *object) |
4807 | 0 | { |
4808 | 0 | RPollerSkeleton *skeleton = R_POLLER_SKELETON (object); |
4809 | 0 | GVariant *value; |
4810 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4811 | 0 | value = g_value_get_variant (&(skeleton->priv->properties[1])); |
4812 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4813 | 0 | return value; |
4814 | 0 | } |
4815 | | |
4816 | | static void |
4817 | | r_poller_skeleton_class_init (RPollerSkeletonClass *klass) |
4818 | 0 | { |
4819 | 0 | GObjectClass *gobject_class; |
4820 | 0 | GDBusInterfaceSkeletonClass *skeleton_class; |
4821 | |
|
4822 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
4823 | 0 | gobject_class->finalize = r_poller_skeleton_finalize; |
4824 | 0 | gobject_class->get_property = r_poller_skeleton_get_property; |
4825 | 0 | gobject_class->set_property = r_poller_skeleton_set_property; |
4826 | 0 | gobject_class->notify = r_poller_skeleton_notify; |
4827 | | |
4828 | |
|
4829 | 0 | r_poller_override_properties (gobject_class, 1); |
4830 | |
|
4831 | 0 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
4832 | 0 | skeleton_class->get_info = r_poller_skeleton_dbus_interface_get_info; |
4833 | 0 | skeleton_class->get_properties = r_poller_skeleton_dbus_interface_get_properties; |
4834 | 0 | skeleton_class->flush = r_poller_skeleton_dbus_interface_flush; |
4835 | 0 | skeleton_class->get_vtable = r_poller_skeleton_dbus_interface_get_vtable; |
4836 | |
|
4837 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
4838 | | g_type_class_add_private (klass, sizeof (RPollerSkeletonPrivate)); |
4839 | | #endif |
4840 | 0 | } |
4841 | | |
4842 | | static void |
4843 | | r_poller_skeleton_iface_init (RPollerIface *iface) |
4844 | 0 | { |
4845 | 0 | iface->get_next_poll = r_poller_skeleton_get_next_poll; |
4846 | 0 | iface->get_status = r_poller_skeleton_get_status; |
4847 | 0 | } |
4848 | | |
4849 | | /** |
4850 | | * r_poller_skeleton_new: |
4851 | | * |
4852 | | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-de-pengutronix-rauc-Poller.top_of_page">de.pengutronix.rauc.Poller</link>. |
4853 | | * |
4854 | | * Returns: (transfer full) (type RPollerSkeleton): The skeleton object. |
4855 | | */ |
4856 | | RPoller * |
4857 | | r_poller_skeleton_new (void) |
4858 | 0 | { |
4859 | 0 | return R_POLLER (g_object_new (R_TYPE_POLLER_SKELETON, NULL)); |
4860 | 0 | } |
4861 | | |