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 "up-device-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
_changed_property_free(ChangedProperty * data)61 _changed_property_free (ChangedProperty *data)
62 {
63 g_value_unset (&data->orig_value);
64 g_free (data);
65 }
66
67 static gboolean
_g_strv_equal0(gchar ** a,gchar ** b)68 _g_strv_equal0 (gchar **a, gchar **b)
69 {
70 gboolean ret = FALSE;
71 guint n;
72 if (a == NULL && b == NULL)
73 {
74 ret = TRUE;
75 goto out;
76 }
77 if (a == NULL || b == NULL)
78 goto out;
79 if (g_strv_length (a) != g_strv_length (b))
80 goto out;
81 for (n = 0; a[n] != NULL; n++)
82 if (g_strcmp0 (a[n], b[n]) != 0)
83 goto out;
84 ret = TRUE;
85 out:
86 return ret;
87 }
88
89 static gboolean
_g_variant_equal0(GVariant * a,GVariant * b)90 _g_variant_equal0 (GVariant *a, GVariant *b)
91 {
92 gboolean ret = FALSE;
93 if (a == NULL && b == NULL)
94 {
95 ret = TRUE;
96 goto out;
97 }
98 if (a == NULL || b == NULL)
99 goto out;
100 ret = g_variant_equal (a, b);
101 out:
102 return ret;
103 }
104
105 G_GNUC_UNUSED static gboolean
_g_value_equal(const GValue * a,const GValue * b)106 _g_value_equal (const GValue *a, const GValue *b)
107 {
108 gboolean ret = FALSE;
109 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
110 switch (G_VALUE_TYPE (a))
111 {
112 case G_TYPE_BOOLEAN:
113 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
114 break;
115 case G_TYPE_UCHAR:
116 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
117 break;
118 case G_TYPE_INT:
119 ret = (g_value_get_int (a) == g_value_get_int (b));
120 break;
121 case G_TYPE_UINT:
122 ret = (g_value_get_uint (a) == g_value_get_uint (b));
123 break;
124 case G_TYPE_INT64:
125 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
126 break;
127 case G_TYPE_UINT64:
128 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
129 break;
130 case G_TYPE_DOUBLE:
131 {
132 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
133 gdouble da = g_value_get_double (a);
134 gdouble db = g_value_get_double (b);
135 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
136 }
137 break;
138 case G_TYPE_STRING:
139 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
140 break;
141 case G_TYPE_VARIANT:
142 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
143 break;
144 default:
145 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
146 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
147 else
148 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
149 break;
150 }
151 return ret;
152 }
153
154 /* ------------------------------------------------------------------------
155 * Code for interface org.freedesktop.UPower.Device
156 * ------------------------------------------------------------------------
157 */
158
159 /**
160 * SECTION:UpExportedDevice
161 * @title: UpExportedDevice
162 * @short_description: Generated C code for the org.freedesktop.UPower.Device D-Bus interface
163 *
164 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link> D-Bus interface in C.
165 */
166
167 /* ---- Introspection data for org.freedesktop.UPower.Device ---- */
168
169 static const GDBusAnnotationInfo _up_exported_device_method_refresh_annotation_info_0 =
170 {
171 -1,
172 (gchar *) "org.freedesktop.DBus.GLib.Async",
173 (gchar *) "",
174 NULL
175 };
176
177 static const GDBusAnnotationInfo * const _up_exported_device_method_refresh_annotation_info_pointers[] =
178 {
179 &_up_exported_device_method_refresh_annotation_info_0,
180 NULL
181 };
182
183 static const _ExtendedGDBusMethodInfo _up_exported_device_method_info_refresh =
184 {
185 {
186 -1,
187 (gchar *) "Refresh",
188 NULL,
189 NULL,
190 (GDBusAnnotationInfo **) &_up_exported_device_method_refresh_annotation_info_pointers
191 },
192 "handle-refresh",
193 FALSE
194 };
195
196 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_history_IN_ARG_type =
197 {
198 {
199 -1,
200 (gchar *) "type",
201 (gchar *) "s",
202 NULL
203 },
204 FALSE
205 };
206
207 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_history_IN_ARG_timespan =
208 {
209 {
210 -1,
211 (gchar *) "timespan",
212 (gchar *) "u",
213 NULL
214 },
215 FALSE
216 };
217
218 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_history_IN_ARG_resolution =
219 {
220 {
221 -1,
222 (gchar *) "resolution",
223 (gchar *) "u",
224 NULL
225 },
226 FALSE
227 };
228
229 static const GDBusArgInfo * const _up_exported_device_method_info_get_history_IN_ARG_pointers[] =
230 {
231 &_up_exported_device_method_info_get_history_IN_ARG_type.parent_struct,
232 &_up_exported_device_method_info_get_history_IN_ARG_timespan.parent_struct,
233 &_up_exported_device_method_info_get_history_IN_ARG_resolution.parent_struct,
234 NULL
235 };
236
237 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_history_OUT_ARG_data =
238 {
239 {
240 -1,
241 (gchar *) "data",
242 (gchar *) "a(udu)",
243 NULL
244 },
245 FALSE
246 };
247
248 static const GDBusArgInfo * const _up_exported_device_method_info_get_history_OUT_ARG_pointers[] =
249 {
250 &_up_exported_device_method_info_get_history_OUT_ARG_data.parent_struct,
251 NULL
252 };
253
254 static const GDBusAnnotationInfo _up_exported_device_method_get_history_annotation_info_0 =
255 {
256 -1,
257 (gchar *) "org.freedesktop.DBus.GLib.Async",
258 (gchar *) "",
259 NULL
260 };
261
262 static const GDBusAnnotationInfo * const _up_exported_device_method_get_history_annotation_info_pointers[] =
263 {
264 &_up_exported_device_method_get_history_annotation_info_0,
265 NULL
266 };
267
268 static const _ExtendedGDBusMethodInfo _up_exported_device_method_info_get_history =
269 {
270 {
271 -1,
272 (gchar *) "GetHistory",
273 (GDBusArgInfo **) &_up_exported_device_method_info_get_history_IN_ARG_pointers,
274 (GDBusArgInfo **) &_up_exported_device_method_info_get_history_OUT_ARG_pointers,
275 (GDBusAnnotationInfo **) &_up_exported_device_method_get_history_annotation_info_pointers
276 },
277 "handle-get-history",
278 FALSE
279 };
280
281 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_statistics_IN_ARG_type =
282 {
283 {
284 -1,
285 (gchar *) "type",
286 (gchar *) "s",
287 NULL
288 },
289 FALSE
290 };
291
292 static const GDBusArgInfo * const _up_exported_device_method_info_get_statistics_IN_ARG_pointers[] =
293 {
294 &_up_exported_device_method_info_get_statistics_IN_ARG_type.parent_struct,
295 NULL
296 };
297
298 static const _ExtendedGDBusArgInfo _up_exported_device_method_info_get_statistics_OUT_ARG_data =
299 {
300 {
301 -1,
302 (gchar *) "data",
303 (gchar *) "a(dd)",
304 NULL
305 },
306 FALSE
307 };
308
309 static const GDBusArgInfo * const _up_exported_device_method_info_get_statistics_OUT_ARG_pointers[] =
310 {
311 &_up_exported_device_method_info_get_statistics_OUT_ARG_data.parent_struct,
312 NULL
313 };
314
315 static const GDBusAnnotationInfo _up_exported_device_method_get_statistics_annotation_info_0 =
316 {
317 -1,
318 (gchar *) "org.freedesktop.DBus.GLib.Async",
319 (gchar *) "",
320 NULL
321 };
322
323 static const GDBusAnnotationInfo * const _up_exported_device_method_get_statistics_annotation_info_pointers[] =
324 {
325 &_up_exported_device_method_get_statistics_annotation_info_0,
326 NULL
327 };
328
329 static const _ExtendedGDBusMethodInfo _up_exported_device_method_info_get_statistics =
330 {
331 {
332 -1,
333 (gchar *) "GetStatistics",
334 (GDBusArgInfo **) &_up_exported_device_method_info_get_statistics_IN_ARG_pointers,
335 (GDBusArgInfo **) &_up_exported_device_method_info_get_statistics_OUT_ARG_pointers,
336 (GDBusAnnotationInfo **) &_up_exported_device_method_get_statistics_annotation_info_pointers
337 },
338 "handle-get-statistics",
339 FALSE
340 };
341
342 static const GDBusMethodInfo * const _up_exported_device_method_info_pointers[] =
343 {
344 &_up_exported_device_method_info_refresh.parent_struct,
345 &_up_exported_device_method_info_get_history.parent_struct,
346 &_up_exported_device_method_info_get_statistics.parent_struct,
347 NULL
348 };
349
350 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_native_path =
351 {
352 {
353 -1,
354 (gchar *) "NativePath",
355 (gchar *) "s",
356 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
357 NULL
358 },
359 "native-path",
360 FALSE,
361 TRUE
362 };
363
364 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_vendor =
365 {
366 {
367 -1,
368 (gchar *) "Vendor",
369 (gchar *) "s",
370 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
371 NULL
372 },
373 "vendor",
374 FALSE,
375 TRUE
376 };
377
378 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_model =
379 {
380 {
381 -1,
382 (gchar *) "Model",
383 (gchar *) "s",
384 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
385 NULL
386 },
387 "model",
388 FALSE,
389 TRUE
390 };
391
392 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_serial =
393 {
394 {
395 -1,
396 (gchar *) "Serial",
397 (gchar *) "s",
398 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
399 NULL
400 },
401 "serial",
402 FALSE,
403 TRUE
404 };
405
406 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_update_time =
407 {
408 {
409 -1,
410 (gchar *) "UpdateTime",
411 (gchar *) "t",
412 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
413 NULL
414 },
415 "update-time",
416 FALSE,
417 TRUE
418 };
419
420 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_type_ =
421 {
422 {
423 -1,
424 (gchar *) "Type",
425 (gchar *) "u",
426 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
427 NULL
428 },
429 "type",
430 FALSE,
431 TRUE
432 };
433
434 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_power_supply =
435 {
436 {
437 -1,
438 (gchar *) "PowerSupply",
439 (gchar *) "b",
440 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
441 NULL
442 },
443 "power-supply",
444 FALSE,
445 TRUE
446 };
447
448 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_has_history =
449 {
450 {
451 -1,
452 (gchar *) "HasHistory",
453 (gchar *) "b",
454 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
455 NULL
456 },
457 "has-history",
458 FALSE,
459 TRUE
460 };
461
462 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_has_statistics =
463 {
464 {
465 -1,
466 (gchar *) "HasStatistics",
467 (gchar *) "b",
468 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
469 NULL
470 },
471 "has-statistics",
472 FALSE,
473 TRUE
474 };
475
476 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_online =
477 {
478 {
479 -1,
480 (gchar *) "Online",
481 (gchar *) "b",
482 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
483 NULL
484 },
485 "online",
486 FALSE,
487 TRUE
488 };
489
490 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_energy =
491 {
492 {
493 -1,
494 (gchar *) "Energy",
495 (gchar *) "d",
496 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
497 NULL
498 },
499 "energy",
500 FALSE,
501 TRUE
502 };
503
504 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_energy_empty =
505 {
506 {
507 -1,
508 (gchar *) "EnergyEmpty",
509 (gchar *) "d",
510 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
511 NULL
512 },
513 "energy-empty",
514 FALSE,
515 TRUE
516 };
517
518 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_energy_full =
519 {
520 {
521 -1,
522 (gchar *) "EnergyFull",
523 (gchar *) "d",
524 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
525 NULL
526 },
527 "energy-full",
528 FALSE,
529 TRUE
530 };
531
532 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_energy_full_design =
533 {
534 {
535 -1,
536 (gchar *) "EnergyFullDesign",
537 (gchar *) "d",
538 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
539 NULL
540 },
541 "energy-full-design",
542 FALSE,
543 TRUE
544 };
545
546 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_energy_rate =
547 {
548 {
549 -1,
550 (gchar *) "EnergyRate",
551 (gchar *) "d",
552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
553 NULL
554 },
555 "energy-rate",
556 FALSE,
557 TRUE
558 };
559
560 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_voltage =
561 {
562 {
563 -1,
564 (gchar *) "Voltage",
565 (gchar *) "d",
566 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
567 NULL
568 },
569 "voltage",
570 FALSE,
571 TRUE
572 };
573
574 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_luminosity =
575 {
576 {
577 -1,
578 (gchar *) "Luminosity",
579 (gchar *) "d",
580 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
581 NULL
582 },
583 "luminosity",
584 FALSE,
585 TRUE
586 };
587
588 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_time_to_empty =
589 {
590 {
591 -1,
592 (gchar *) "TimeToEmpty",
593 (gchar *) "x",
594 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
595 NULL
596 },
597 "time-to-empty",
598 FALSE,
599 TRUE
600 };
601
602 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_time_to_full =
603 {
604 {
605 -1,
606 (gchar *) "TimeToFull",
607 (gchar *) "x",
608 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
609 NULL
610 },
611 "time-to-full",
612 FALSE,
613 TRUE
614 };
615
616 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_percentage =
617 {
618 {
619 -1,
620 (gchar *) "Percentage",
621 (gchar *) "d",
622 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
623 NULL
624 },
625 "percentage",
626 FALSE,
627 TRUE
628 };
629
630 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_temperature =
631 {
632 {
633 -1,
634 (gchar *) "Temperature",
635 (gchar *) "d",
636 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
637 NULL
638 },
639 "temperature",
640 FALSE,
641 TRUE
642 };
643
644 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_is_present =
645 {
646 {
647 -1,
648 (gchar *) "IsPresent",
649 (gchar *) "b",
650 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
651 NULL
652 },
653 "is-present",
654 FALSE,
655 TRUE
656 };
657
658 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_state =
659 {
660 {
661 -1,
662 (gchar *) "State",
663 (gchar *) "u",
664 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
665 NULL
666 },
667 "state",
668 FALSE,
669 TRUE
670 };
671
672 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_is_rechargeable =
673 {
674 {
675 -1,
676 (gchar *) "IsRechargeable",
677 (gchar *) "b",
678 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
679 NULL
680 },
681 "is-rechargeable",
682 FALSE,
683 TRUE
684 };
685
686 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_capacity =
687 {
688 {
689 -1,
690 (gchar *) "Capacity",
691 (gchar *) "d",
692 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
693 NULL
694 },
695 "capacity",
696 FALSE,
697 TRUE
698 };
699
700 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_technology =
701 {
702 {
703 -1,
704 (gchar *) "Technology",
705 (gchar *) "u",
706 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
707 NULL
708 },
709 "technology",
710 FALSE,
711 TRUE
712 };
713
714 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_warning_level =
715 {
716 {
717 -1,
718 (gchar *) "WarningLevel",
719 (gchar *) "u",
720 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
721 NULL
722 },
723 "warning-level",
724 FALSE,
725 TRUE
726 };
727
728 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_battery_level =
729 {
730 {
731 -1,
732 (gchar *) "BatteryLevel",
733 (gchar *) "u",
734 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
735 NULL
736 },
737 "battery-level",
738 FALSE,
739 TRUE
740 };
741
742 static const _ExtendedGDBusPropertyInfo _up_exported_device_property_info_icon_name =
743 {
744 {
745 -1,
746 (gchar *) "IconName",
747 (gchar *) "s",
748 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
749 NULL
750 },
751 "icon-name",
752 FALSE,
753 TRUE
754 };
755
756 static const GDBusPropertyInfo * const _up_exported_device_property_info_pointers[] =
757 {
758 &_up_exported_device_property_info_native_path.parent_struct,
759 &_up_exported_device_property_info_vendor.parent_struct,
760 &_up_exported_device_property_info_model.parent_struct,
761 &_up_exported_device_property_info_serial.parent_struct,
762 &_up_exported_device_property_info_update_time.parent_struct,
763 &_up_exported_device_property_info_type_.parent_struct,
764 &_up_exported_device_property_info_power_supply.parent_struct,
765 &_up_exported_device_property_info_has_history.parent_struct,
766 &_up_exported_device_property_info_has_statistics.parent_struct,
767 &_up_exported_device_property_info_online.parent_struct,
768 &_up_exported_device_property_info_energy.parent_struct,
769 &_up_exported_device_property_info_energy_empty.parent_struct,
770 &_up_exported_device_property_info_energy_full.parent_struct,
771 &_up_exported_device_property_info_energy_full_design.parent_struct,
772 &_up_exported_device_property_info_energy_rate.parent_struct,
773 &_up_exported_device_property_info_voltage.parent_struct,
774 &_up_exported_device_property_info_luminosity.parent_struct,
775 &_up_exported_device_property_info_time_to_empty.parent_struct,
776 &_up_exported_device_property_info_time_to_full.parent_struct,
777 &_up_exported_device_property_info_percentage.parent_struct,
778 &_up_exported_device_property_info_temperature.parent_struct,
779 &_up_exported_device_property_info_is_present.parent_struct,
780 &_up_exported_device_property_info_state.parent_struct,
781 &_up_exported_device_property_info_is_rechargeable.parent_struct,
782 &_up_exported_device_property_info_capacity.parent_struct,
783 &_up_exported_device_property_info_technology.parent_struct,
784 &_up_exported_device_property_info_warning_level.parent_struct,
785 &_up_exported_device_property_info_battery_level.parent_struct,
786 &_up_exported_device_property_info_icon_name.parent_struct,
787 NULL
788 };
789
790 static const _ExtendedGDBusInterfaceInfo _up_exported_device_interface_info =
791 {
792 {
793 -1,
794 (gchar *) "org.freedesktop.UPower.Device",
795 (GDBusMethodInfo **) &_up_exported_device_method_info_pointers,
796 NULL,
797 (GDBusPropertyInfo **) &_up_exported_device_property_info_pointers,
798 NULL
799 },
800 "exported-device",
801 };
802
803
804 /**
805 * up_exported_device_interface_info:
806 *
807 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link> D-Bus interface.
808 *
809 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
810 */
811 GDBusInterfaceInfo *
up_exported_device_interface_info(void)812 up_exported_device_interface_info (void)
813 {
814 return (GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct;
815 }
816
817 /**
818 * up_exported_device_override_properties:
819 * @klass: The class structure for a #GObject derived class.
820 * @property_id_begin: The property id to assign to the first overridden property.
821 *
822 * Overrides all #GObject properties in the #UpExportedDevice interface for a concrete class.
823 * The properties are overridden in the order they are defined.
824 *
825 * Returns: The last property id.
826 */
827 guint
up_exported_device_override_properties(GObjectClass * klass,guint property_id_begin)828 up_exported_device_override_properties (GObjectClass *klass, guint property_id_begin)
829 {
830 g_object_class_override_property (klass, property_id_begin++, "native-path");
831 g_object_class_override_property (klass, property_id_begin++, "vendor");
832 g_object_class_override_property (klass, property_id_begin++, "model");
833 g_object_class_override_property (klass, property_id_begin++, "serial");
834 g_object_class_override_property (klass, property_id_begin++, "update-time");
835 g_object_class_override_property (klass, property_id_begin++, "type");
836 g_object_class_override_property (klass, property_id_begin++, "power-supply");
837 g_object_class_override_property (klass, property_id_begin++, "has-history");
838 g_object_class_override_property (klass, property_id_begin++, "has-statistics");
839 g_object_class_override_property (klass, property_id_begin++, "online");
840 g_object_class_override_property (klass, property_id_begin++, "energy");
841 g_object_class_override_property (klass, property_id_begin++, "energy-empty");
842 g_object_class_override_property (klass, property_id_begin++, "energy-full");
843 g_object_class_override_property (klass, property_id_begin++, "energy-full-design");
844 g_object_class_override_property (klass, property_id_begin++, "energy-rate");
845 g_object_class_override_property (klass, property_id_begin++, "voltage");
846 g_object_class_override_property (klass, property_id_begin++, "luminosity");
847 g_object_class_override_property (klass, property_id_begin++, "time-to-empty");
848 g_object_class_override_property (klass, property_id_begin++, "time-to-full");
849 g_object_class_override_property (klass, property_id_begin++, "percentage");
850 g_object_class_override_property (klass, property_id_begin++, "temperature");
851 g_object_class_override_property (klass, property_id_begin++, "is-present");
852 g_object_class_override_property (klass, property_id_begin++, "state");
853 g_object_class_override_property (klass, property_id_begin++, "is-rechargeable");
854 g_object_class_override_property (klass, property_id_begin++, "capacity");
855 g_object_class_override_property (klass, property_id_begin++, "technology");
856 g_object_class_override_property (klass, property_id_begin++, "warning-level");
857 g_object_class_override_property (klass, property_id_begin++, "battery-level");
858 g_object_class_override_property (klass, property_id_begin++, "icon-name");
859 return property_id_begin - 1;
860 }
861
862
863
864 /**
865 * UpExportedDevice:
866 *
867 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link>.
868 */
869
870 /**
871 * UpExportedDeviceIface:
872 * @parent_iface: The parent interface.
873 * @handle_get_history: Handler for the #UpExportedDevice::handle-get-history signal.
874 * @handle_get_statistics: Handler for the #UpExportedDevice::handle-get-statistics signal.
875 * @handle_refresh: Handler for the #UpExportedDevice::handle-refresh signal.
876 * @get_battery_level: Getter for the #UpExportedDevice:battery-level property.
877 * @get_capacity: Getter for the #UpExportedDevice:capacity property.
878 * @get_energy: Getter for the #UpExportedDevice:energy property.
879 * @get_energy_empty: Getter for the #UpExportedDevice:energy-empty property.
880 * @get_energy_full: Getter for the #UpExportedDevice:energy-full property.
881 * @get_energy_full_design: Getter for the #UpExportedDevice:energy-full-design property.
882 * @get_energy_rate: Getter for the #UpExportedDevice:energy-rate property.
883 * @get_has_history: Getter for the #UpExportedDevice:has-history property.
884 * @get_has_statistics: Getter for the #UpExportedDevice:has-statistics property.
885 * @get_icon_name: Getter for the #UpExportedDevice:icon-name property.
886 * @get_is_present: Getter for the #UpExportedDevice:is-present property.
887 * @get_is_rechargeable: Getter for the #UpExportedDevice:is-rechargeable property.
888 * @get_luminosity: Getter for the #UpExportedDevice:luminosity property.
889 * @get_model: Getter for the #UpExportedDevice:model property.
890 * @get_native_path: Getter for the #UpExportedDevice:native-path property.
891 * @get_online: Getter for the #UpExportedDevice:online property.
892 * @get_percentage: Getter for the #UpExportedDevice:percentage property.
893 * @get_power_supply: Getter for the #UpExportedDevice:power-supply property.
894 * @get_serial: Getter for the #UpExportedDevice:serial property.
895 * @get_state: Getter for the #UpExportedDevice:state property.
896 * @get_technology: Getter for the #UpExportedDevice:technology property.
897 * @get_temperature: Getter for the #UpExportedDevice:temperature property.
898 * @get_time_to_empty: Getter for the #UpExportedDevice:time-to-empty property.
899 * @get_time_to_full: Getter for the #UpExportedDevice:time-to-full property.
900 * @get_type_: Getter for the #UpExportedDevice:type property.
901 * @get_update_time: Getter for the #UpExportedDevice:update-time property.
902 * @get_vendor: Getter for the #UpExportedDevice:vendor property.
903 * @get_voltage: Getter for the #UpExportedDevice:voltage property.
904 * @get_warning_level: Getter for the #UpExportedDevice:warning-level property.
905 *
906 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link>.
907 */
908
909 typedef UpExportedDeviceIface UpExportedDeviceInterface;
G_DEFINE_INTERFACE(UpExportedDevice,up_exported_device,G_TYPE_OBJECT)910 G_DEFINE_INTERFACE (UpExportedDevice, up_exported_device, G_TYPE_OBJECT)
911
912 static void
913 up_exported_device_default_init (UpExportedDeviceIface *iface)
914 {
915 /* GObject signals for incoming D-Bus method calls: */
916 /**
917 * UpExportedDevice::handle-refresh:
918 * @object: A #UpExportedDevice.
919 * @invocation: A #GDBusMethodInvocation.
920 *
921 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower-Device.Refresh">Refresh()</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 up_exported_device_complete_refresh() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
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 g_signal_new ("handle-refresh",
928 G_TYPE_FROM_INTERFACE (iface),
929 G_SIGNAL_RUN_LAST,
930 G_STRUCT_OFFSET (UpExportedDeviceIface, handle_refresh),
931 g_signal_accumulator_true_handled,
932 NULL,
933 g_cclosure_marshal_generic,
934 G_TYPE_BOOLEAN,
935 1,
936 G_TYPE_DBUS_METHOD_INVOCATION);
937
938 /**
939 * UpExportedDevice::handle-get-history:
940 * @object: A #UpExportedDevice.
941 * @invocation: A #GDBusMethodInvocation.
942 * @arg_type: Argument passed by remote caller.
943 * @arg_timespan: Argument passed by remote caller.
944 * @arg_resolution: Argument passed by remote caller.
945 *
946 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetHistory">GetHistory()</link> D-Bus method.
947 *
948 * 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 up_exported_device_complete_get_history() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
949 *
950 * 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.
951 */
952 g_signal_new ("handle-get-history",
953 G_TYPE_FROM_INTERFACE (iface),
954 G_SIGNAL_RUN_LAST,
955 G_STRUCT_OFFSET (UpExportedDeviceIface, handle_get_history),
956 g_signal_accumulator_true_handled,
957 NULL,
958 g_cclosure_marshal_generic,
959 G_TYPE_BOOLEAN,
960 4,
961 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT);
962
963 /**
964 * UpExportedDevice::handle-get-statistics:
965 * @object: A #UpExportedDevice.
966 * @invocation: A #GDBusMethodInvocation.
967 * @arg_type: Argument passed by remote caller.
968 *
969 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetStatistics">GetStatistics()</link> D-Bus method.
970 *
971 * 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 up_exported_device_complete_get_statistics() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
972 *
973 * 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.
974 */
975 g_signal_new ("handle-get-statistics",
976 G_TYPE_FROM_INTERFACE (iface),
977 G_SIGNAL_RUN_LAST,
978 G_STRUCT_OFFSET (UpExportedDeviceIface, handle_get_statistics),
979 g_signal_accumulator_true_handled,
980 NULL,
981 g_cclosure_marshal_generic,
982 G_TYPE_BOOLEAN,
983 2,
984 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
985
986 /* GObject properties for D-Bus properties: */
987 /**
988 * UpExportedDevice:native-path:
989 *
990 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.NativePath">"NativePath"</link>.
991 *
992 * 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.
993 */
994 g_object_interface_install_property (iface,
995 g_param_spec_string ("native-path", "NativePath", "NativePath", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
996 /**
997 * UpExportedDevice:vendor:
998 *
999 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Vendor">"Vendor"</link>.
1000 *
1001 * 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.
1002 */
1003 g_object_interface_install_property (iface,
1004 g_param_spec_string ("vendor", "Vendor", "Vendor", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1005 /**
1006 * UpExportedDevice:model:
1007 *
1008 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Model">"Model"</link>.
1009 *
1010 * 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.
1011 */
1012 g_object_interface_install_property (iface,
1013 g_param_spec_string ("model", "Model", "Model", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1014 /**
1015 * UpExportedDevice:serial:
1016 *
1017 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Serial">"Serial"</link>.
1018 *
1019 * 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.
1020 */
1021 g_object_interface_install_property (iface,
1022 g_param_spec_string ("serial", "Serial", "Serial", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1023 /**
1024 * UpExportedDevice:update-time:
1025 *
1026 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.UpdateTime">"UpdateTime"</link>.
1027 *
1028 * 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.
1029 */
1030 g_object_interface_install_property (iface,
1031 g_param_spec_uint64 ("update-time", "UpdateTime", "UpdateTime", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1032 /**
1033 * UpExportedDevice:type:
1034 *
1035 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Type">"Type"</link>.
1036 *
1037 * 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.
1038 */
1039 g_object_interface_install_property (iface,
1040 g_param_spec_uint ("type", "Type", "Type", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1041 /**
1042 * UpExportedDevice:power-supply:
1043 *
1044 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.PowerSupply">"PowerSupply"</link>.
1045 *
1046 * 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.
1047 */
1048 g_object_interface_install_property (iface,
1049 g_param_spec_boolean ("power-supply", "PowerSupply", "PowerSupply", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1050 /**
1051 * UpExportedDevice:has-history:
1052 *
1053 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasHistory">"HasHistory"</link>.
1054 *
1055 * 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.
1056 */
1057 g_object_interface_install_property (iface,
1058 g_param_spec_boolean ("has-history", "HasHistory", "HasHistory", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1059 /**
1060 * UpExportedDevice:has-statistics:
1061 *
1062 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasStatistics">"HasStatistics"</link>.
1063 *
1064 * 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.
1065 */
1066 g_object_interface_install_property (iface,
1067 g_param_spec_boolean ("has-statistics", "HasStatistics", "HasStatistics", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1068 /**
1069 * UpExportedDevice:online:
1070 *
1071 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Online">"Online"</link>.
1072 *
1073 * 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.
1074 */
1075 g_object_interface_install_property (iface,
1076 g_param_spec_boolean ("online", "Online", "Online", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1077 /**
1078 * UpExportedDevice:energy:
1079 *
1080 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Energy">"Energy"</link>.
1081 *
1082 * 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.
1083 */
1084 g_object_interface_install_property (iface,
1085 g_param_spec_double ("energy", "Energy", "Energy", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1086 /**
1087 * UpExportedDevice:energy-empty:
1088 *
1089 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyEmpty">"EnergyEmpty"</link>.
1090 *
1091 * 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.
1092 */
1093 g_object_interface_install_property (iface,
1094 g_param_spec_double ("energy-empty", "EnergyEmpty", "EnergyEmpty", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1095 /**
1096 * UpExportedDevice:energy-full:
1097 *
1098 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFull">"EnergyFull"</link>.
1099 *
1100 * 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.
1101 */
1102 g_object_interface_install_property (iface,
1103 g_param_spec_double ("energy-full", "EnergyFull", "EnergyFull", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1104 /**
1105 * UpExportedDevice:energy-full-design:
1106 *
1107 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFullDesign">"EnergyFullDesign"</link>.
1108 *
1109 * 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.
1110 */
1111 g_object_interface_install_property (iface,
1112 g_param_spec_double ("energy-full-design", "EnergyFullDesign", "EnergyFullDesign", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1113 /**
1114 * UpExportedDevice:energy-rate:
1115 *
1116 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyRate">"EnergyRate"</link>.
1117 *
1118 * 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.
1119 */
1120 g_object_interface_install_property (iface,
1121 g_param_spec_double ("energy-rate", "EnergyRate", "EnergyRate", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1122 /**
1123 * UpExportedDevice:voltage:
1124 *
1125 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Voltage">"Voltage"</link>.
1126 *
1127 * 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.
1128 */
1129 g_object_interface_install_property (iface,
1130 g_param_spec_double ("voltage", "Voltage", "Voltage", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1131 /**
1132 * UpExportedDevice:luminosity:
1133 *
1134 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Luminosity">"Luminosity"</link>.
1135 *
1136 * 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.
1137 */
1138 g_object_interface_install_property (iface,
1139 g_param_spec_double ("luminosity", "Luminosity", "Luminosity", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1140 /**
1141 * UpExportedDevice:time-to-empty:
1142 *
1143 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToEmpty">"TimeToEmpty"</link>.
1144 *
1145 * 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.
1146 */
1147 g_object_interface_install_property (iface,
1148 g_param_spec_int64 ("time-to-empty", "TimeToEmpty", "TimeToEmpty", G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1149 /**
1150 * UpExportedDevice:time-to-full:
1151 *
1152 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToFull">"TimeToFull"</link>.
1153 *
1154 * 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.
1155 */
1156 g_object_interface_install_property (iface,
1157 g_param_spec_int64 ("time-to-full", "TimeToFull", "TimeToFull", G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1158 /**
1159 * UpExportedDevice:percentage:
1160 *
1161 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Percentage">"Percentage"</link>.
1162 *
1163 * 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.
1164 */
1165 g_object_interface_install_property (iface,
1166 g_param_spec_double ("percentage", "Percentage", "Percentage", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1167 /**
1168 * UpExportedDevice:temperature:
1169 *
1170 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Temperature">"Temperature"</link>.
1171 *
1172 * 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.
1173 */
1174 g_object_interface_install_property (iface,
1175 g_param_spec_double ("temperature", "Temperature", "Temperature", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1176 /**
1177 * UpExportedDevice:is-present:
1178 *
1179 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsPresent">"IsPresent"</link>.
1180 *
1181 * 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.
1182 */
1183 g_object_interface_install_property (iface,
1184 g_param_spec_boolean ("is-present", "IsPresent", "IsPresent", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1185 /**
1186 * UpExportedDevice:state:
1187 *
1188 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.State">"State"</link>.
1189 *
1190 * 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.
1191 */
1192 g_object_interface_install_property (iface,
1193 g_param_spec_uint ("state", "State", "State", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1194 /**
1195 * UpExportedDevice:is-rechargeable:
1196 *
1197 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsRechargeable">"IsRechargeable"</link>.
1198 *
1199 * 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.
1200 */
1201 g_object_interface_install_property (iface,
1202 g_param_spec_boolean ("is-rechargeable", "IsRechargeable", "IsRechargeable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1203 /**
1204 * UpExportedDevice:capacity:
1205 *
1206 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Capacity">"Capacity"</link>.
1207 *
1208 * 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.
1209 */
1210 g_object_interface_install_property (iface,
1211 g_param_spec_double ("capacity", "Capacity", "Capacity", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1212 /**
1213 * UpExportedDevice:technology:
1214 *
1215 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.Technology">"Technology"</link>.
1216 *
1217 * 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.
1218 */
1219 g_object_interface_install_property (iface,
1220 g_param_spec_uint ("technology", "Technology", "Technology", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1221 /**
1222 * UpExportedDevice:warning-level:
1223 *
1224 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.WarningLevel">"WarningLevel"</link>.
1225 *
1226 * 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.
1227 */
1228 g_object_interface_install_property (iface,
1229 g_param_spec_uint ("warning-level", "WarningLevel", "WarningLevel", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1230 /**
1231 * UpExportedDevice:battery-level:
1232 *
1233 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.BatteryLevel">"BatteryLevel"</link>.
1234 *
1235 * 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.
1236 */
1237 g_object_interface_install_property (iface,
1238 g_param_spec_uint ("battery-level", "BatteryLevel", "BatteryLevel", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1239 /**
1240 * UpExportedDevice:icon-name:
1241 *
1242 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower-Device.IconName">"IconName"</link>.
1243 *
1244 * 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.
1245 */
1246 g_object_interface_install_property (iface,
1247 g_param_spec_string ("icon-name", "IconName", "IconName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1248 }
1249
1250 /**
1251 * up_exported_device_get_native_path: (skip)
1252 * @object: A #UpExportedDevice.
1253 *
1254 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.NativePath">"NativePath"</link> D-Bus property.
1255 *
1256 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1257 *
1258 * 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 up_exported_device_dup_native_path() if on another thread.
1259 *
1260 * 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.
1261 */
1262 const gchar *
up_exported_device_get_native_path(UpExportedDevice * object)1263 up_exported_device_get_native_path (UpExportedDevice *object)
1264 {
1265 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_native_path (object);
1266 }
1267
1268 /**
1269 * up_exported_device_dup_native_path: (skip)
1270 * @object: A #UpExportedDevice.
1271 *
1272 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.NativePath">"NativePath"</link> D-Bus property.
1273 *
1274 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1275 *
1276 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1277 */
1278 gchar *
up_exported_device_dup_native_path(UpExportedDevice * object)1279 up_exported_device_dup_native_path (UpExportedDevice *object)
1280 {
1281 gchar *value;
1282 g_object_get (G_OBJECT (object), "native-path", &value, NULL);
1283 return value;
1284 }
1285
1286 /**
1287 * up_exported_device_set_native_path: (skip)
1288 * @object: A #UpExportedDevice.
1289 * @value: The value to set.
1290 *
1291 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.NativePath">"NativePath"</link> D-Bus property to @value.
1292 *
1293 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1294 */
1295 void
up_exported_device_set_native_path(UpExportedDevice * object,const gchar * value)1296 up_exported_device_set_native_path (UpExportedDevice *object, const gchar *value)
1297 {
1298 g_object_set (G_OBJECT (object), "native-path", value, NULL);
1299 }
1300
1301 /**
1302 * up_exported_device_get_vendor: (skip)
1303 * @object: A #UpExportedDevice.
1304 *
1305 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Vendor">"Vendor"</link> D-Bus property.
1306 *
1307 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1308 *
1309 * 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 up_exported_device_dup_vendor() if on another thread.
1310 *
1311 * 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.
1312 */
1313 const gchar *
up_exported_device_get_vendor(UpExportedDevice * object)1314 up_exported_device_get_vendor (UpExportedDevice *object)
1315 {
1316 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_vendor (object);
1317 }
1318
1319 /**
1320 * up_exported_device_dup_vendor: (skip)
1321 * @object: A #UpExportedDevice.
1322 *
1323 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Vendor">"Vendor"</link> D-Bus property.
1324 *
1325 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1326 *
1327 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1328 */
1329 gchar *
up_exported_device_dup_vendor(UpExportedDevice * object)1330 up_exported_device_dup_vendor (UpExportedDevice *object)
1331 {
1332 gchar *value;
1333 g_object_get (G_OBJECT (object), "vendor", &value, NULL);
1334 return value;
1335 }
1336
1337 /**
1338 * up_exported_device_set_vendor: (skip)
1339 * @object: A #UpExportedDevice.
1340 * @value: The value to set.
1341 *
1342 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Vendor">"Vendor"</link> D-Bus property to @value.
1343 *
1344 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1345 */
1346 void
up_exported_device_set_vendor(UpExportedDevice * object,const gchar * value)1347 up_exported_device_set_vendor (UpExportedDevice *object, const gchar *value)
1348 {
1349 g_object_set (G_OBJECT (object), "vendor", value, NULL);
1350 }
1351
1352 /**
1353 * up_exported_device_get_model: (skip)
1354 * @object: A #UpExportedDevice.
1355 *
1356 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Model">"Model"</link> D-Bus property.
1357 *
1358 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1359 *
1360 * 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 up_exported_device_dup_model() if on another thread.
1361 *
1362 * 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.
1363 */
1364 const gchar *
up_exported_device_get_model(UpExportedDevice * object)1365 up_exported_device_get_model (UpExportedDevice *object)
1366 {
1367 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_model (object);
1368 }
1369
1370 /**
1371 * up_exported_device_dup_model: (skip)
1372 * @object: A #UpExportedDevice.
1373 *
1374 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Model">"Model"</link> D-Bus property.
1375 *
1376 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1377 *
1378 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1379 */
1380 gchar *
up_exported_device_dup_model(UpExportedDevice * object)1381 up_exported_device_dup_model (UpExportedDevice *object)
1382 {
1383 gchar *value;
1384 g_object_get (G_OBJECT (object), "model", &value, NULL);
1385 return value;
1386 }
1387
1388 /**
1389 * up_exported_device_set_model: (skip)
1390 * @object: A #UpExportedDevice.
1391 * @value: The value to set.
1392 *
1393 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Model">"Model"</link> D-Bus property to @value.
1394 *
1395 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1396 */
1397 void
up_exported_device_set_model(UpExportedDevice * object,const gchar * value)1398 up_exported_device_set_model (UpExportedDevice *object, const gchar *value)
1399 {
1400 g_object_set (G_OBJECT (object), "model", value, NULL);
1401 }
1402
1403 /**
1404 * up_exported_device_get_serial: (skip)
1405 * @object: A #UpExportedDevice.
1406 *
1407 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Serial">"Serial"</link> D-Bus property.
1408 *
1409 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1410 *
1411 * 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 up_exported_device_dup_serial() if on another thread.
1412 *
1413 * 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.
1414 */
1415 const gchar *
up_exported_device_get_serial(UpExportedDevice * object)1416 up_exported_device_get_serial (UpExportedDevice *object)
1417 {
1418 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_serial (object);
1419 }
1420
1421 /**
1422 * up_exported_device_dup_serial: (skip)
1423 * @object: A #UpExportedDevice.
1424 *
1425 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Serial">"Serial"</link> D-Bus property.
1426 *
1427 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1428 *
1429 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1430 */
1431 gchar *
up_exported_device_dup_serial(UpExportedDevice * object)1432 up_exported_device_dup_serial (UpExportedDevice *object)
1433 {
1434 gchar *value;
1435 g_object_get (G_OBJECT (object), "serial", &value, NULL);
1436 return value;
1437 }
1438
1439 /**
1440 * up_exported_device_set_serial: (skip)
1441 * @object: A #UpExportedDevice.
1442 * @value: The value to set.
1443 *
1444 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Serial">"Serial"</link> D-Bus property to @value.
1445 *
1446 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1447 */
1448 void
up_exported_device_set_serial(UpExportedDevice * object,const gchar * value)1449 up_exported_device_set_serial (UpExportedDevice *object, const gchar *value)
1450 {
1451 g_object_set (G_OBJECT (object), "serial", value, NULL);
1452 }
1453
1454 /**
1455 * up_exported_device_get_update_time: (skip)
1456 * @object: A #UpExportedDevice.
1457 *
1458 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.UpdateTime">"UpdateTime"</link> D-Bus property.
1459 *
1460 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1461 *
1462 * Returns: The property value.
1463 */
1464 guint64
up_exported_device_get_update_time(UpExportedDevice * object)1465 up_exported_device_get_update_time (UpExportedDevice *object)
1466 {
1467 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_update_time (object);
1468 }
1469
1470 /**
1471 * up_exported_device_set_update_time: (skip)
1472 * @object: A #UpExportedDevice.
1473 * @value: The value to set.
1474 *
1475 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.UpdateTime">"UpdateTime"</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
up_exported_device_set_update_time(UpExportedDevice * object,guint64 value)1480 up_exported_device_set_update_time (UpExportedDevice *object, guint64 value)
1481 {
1482 g_object_set (G_OBJECT (object), "update-time", value, NULL);
1483 }
1484
1485 /**
1486 * up_exported_device_get_type_: (skip)
1487 * @object: A #UpExportedDevice.
1488 *
1489 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Type">"Type"</link> D-Bus property.
1490 *
1491 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1492 *
1493 * Returns: The property value.
1494 */
1495 guint
up_exported_device_get_type_(UpExportedDevice * object)1496 up_exported_device_get_type_ (UpExportedDevice *object)
1497 {
1498 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_type_ (object);
1499 }
1500
1501 /**
1502 * up_exported_device_set_type_: (skip)
1503 * @object: A #UpExportedDevice.
1504 * @value: The value to set.
1505 *
1506 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Type">"Type"</link> D-Bus property to @value.
1507 *
1508 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1509 */
1510 void
up_exported_device_set_type_(UpExportedDevice * object,guint value)1511 up_exported_device_set_type_ (UpExportedDevice *object, guint value)
1512 {
1513 g_object_set (G_OBJECT (object), "type", value, NULL);
1514 }
1515
1516 /**
1517 * up_exported_device_get_power_supply: (skip)
1518 * @object: A #UpExportedDevice.
1519 *
1520 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.PowerSupply">"PowerSupply"</link> D-Bus property.
1521 *
1522 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1523 *
1524 * Returns: The property value.
1525 */
1526 gboolean
up_exported_device_get_power_supply(UpExportedDevice * object)1527 up_exported_device_get_power_supply (UpExportedDevice *object)
1528 {
1529 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_power_supply (object);
1530 }
1531
1532 /**
1533 * up_exported_device_set_power_supply: (skip)
1534 * @object: A #UpExportedDevice.
1535 * @value: The value to set.
1536 *
1537 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.PowerSupply">"PowerSupply"</link> D-Bus property to @value.
1538 *
1539 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1540 */
1541 void
up_exported_device_set_power_supply(UpExportedDevice * object,gboolean value)1542 up_exported_device_set_power_supply (UpExportedDevice *object, gboolean value)
1543 {
1544 g_object_set (G_OBJECT (object), "power-supply", value, NULL);
1545 }
1546
1547 /**
1548 * up_exported_device_get_has_history: (skip)
1549 * @object: A #UpExportedDevice.
1550 *
1551 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasHistory">"HasHistory"</link> D-Bus property.
1552 *
1553 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1554 *
1555 * Returns: The property value.
1556 */
1557 gboolean
up_exported_device_get_has_history(UpExportedDevice * object)1558 up_exported_device_get_has_history (UpExportedDevice *object)
1559 {
1560 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_has_history (object);
1561 }
1562
1563 /**
1564 * up_exported_device_set_has_history: (skip)
1565 * @object: A #UpExportedDevice.
1566 * @value: The value to set.
1567 *
1568 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasHistory">"HasHistory"</link> D-Bus property to @value.
1569 *
1570 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1571 */
1572 void
up_exported_device_set_has_history(UpExportedDevice * object,gboolean value)1573 up_exported_device_set_has_history (UpExportedDevice *object, gboolean value)
1574 {
1575 g_object_set (G_OBJECT (object), "has-history", value, NULL);
1576 }
1577
1578 /**
1579 * up_exported_device_get_has_statistics: (skip)
1580 * @object: A #UpExportedDevice.
1581 *
1582 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasStatistics">"HasStatistics"</link> D-Bus property.
1583 *
1584 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1585 *
1586 * Returns: The property value.
1587 */
1588 gboolean
up_exported_device_get_has_statistics(UpExportedDevice * object)1589 up_exported_device_get_has_statistics (UpExportedDevice *object)
1590 {
1591 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_has_statistics (object);
1592 }
1593
1594 /**
1595 * up_exported_device_set_has_statistics: (skip)
1596 * @object: A #UpExportedDevice.
1597 * @value: The value to set.
1598 *
1599 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.HasStatistics">"HasStatistics"</link> D-Bus property to @value.
1600 *
1601 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1602 */
1603 void
up_exported_device_set_has_statistics(UpExportedDevice * object,gboolean value)1604 up_exported_device_set_has_statistics (UpExportedDevice *object, gboolean value)
1605 {
1606 g_object_set (G_OBJECT (object), "has-statistics", value, NULL);
1607 }
1608
1609 /**
1610 * up_exported_device_get_online: (skip)
1611 * @object: A #UpExportedDevice.
1612 *
1613 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Online">"Online"</link> D-Bus property.
1614 *
1615 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1616 *
1617 * Returns: The property value.
1618 */
1619 gboolean
up_exported_device_get_online(UpExportedDevice * object)1620 up_exported_device_get_online (UpExportedDevice *object)
1621 {
1622 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_online (object);
1623 }
1624
1625 /**
1626 * up_exported_device_set_online: (skip)
1627 * @object: A #UpExportedDevice.
1628 * @value: The value to set.
1629 *
1630 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Online">"Online"</link> D-Bus property to @value.
1631 *
1632 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1633 */
1634 void
up_exported_device_set_online(UpExportedDevice * object,gboolean value)1635 up_exported_device_set_online (UpExportedDevice *object, gboolean value)
1636 {
1637 g_object_set (G_OBJECT (object), "online", value, NULL);
1638 }
1639
1640 /**
1641 * up_exported_device_get_energy: (skip)
1642 * @object: A #UpExportedDevice.
1643 *
1644 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Energy">"Energy"</link> D-Bus property.
1645 *
1646 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1647 *
1648 * Returns: The property value.
1649 */
1650 gdouble
up_exported_device_get_energy(UpExportedDevice * object)1651 up_exported_device_get_energy (UpExportedDevice *object)
1652 {
1653 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_energy (object);
1654 }
1655
1656 /**
1657 * up_exported_device_set_energy: (skip)
1658 * @object: A #UpExportedDevice.
1659 * @value: The value to set.
1660 *
1661 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Energy">"Energy"</link> D-Bus property to @value.
1662 *
1663 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1664 */
1665 void
up_exported_device_set_energy(UpExportedDevice * object,gdouble value)1666 up_exported_device_set_energy (UpExportedDevice *object, gdouble value)
1667 {
1668 g_object_set (G_OBJECT (object), "energy", value, NULL);
1669 }
1670
1671 /**
1672 * up_exported_device_get_energy_empty: (skip)
1673 * @object: A #UpExportedDevice.
1674 *
1675 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyEmpty">"EnergyEmpty"</link> D-Bus property.
1676 *
1677 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1678 *
1679 * Returns: The property value.
1680 */
1681 gdouble
up_exported_device_get_energy_empty(UpExportedDevice * object)1682 up_exported_device_get_energy_empty (UpExportedDevice *object)
1683 {
1684 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_energy_empty (object);
1685 }
1686
1687 /**
1688 * up_exported_device_set_energy_empty: (skip)
1689 * @object: A #UpExportedDevice.
1690 * @value: The value to set.
1691 *
1692 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyEmpty">"EnergyEmpty"</link> D-Bus property to @value.
1693 *
1694 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1695 */
1696 void
up_exported_device_set_energy_empty(UpExportedDevice * object,gdouble value)1697 up_exported_device_set_energy_empty (UpExportedDevice *object, gdouble value)
1698 {
1699 g_object_set (G_OBJECT (object), "energy-empty", value, NULL);
1700 }
1701
1702 /**
1703 * up_exported_device_get_energy_full: (skip)
1704 * @object: A #UpExportedDevice.
1705 *
1706 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFull">"EnergyFull"</link> D-Bus property.
1707 *
1708 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1709 *
1710 * Returns: The property value.
1711 */
1712 gdouble
up_exported_device_get_energy_full(UpExportedDevice * object)1713 up_exported_device_get_energy_full (UpExportedDevice *object)
1714 {
1715 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_energy_full (object);
1716 }
1717
1718 /**
1719 * up_exported_device_set_energy_full: (skip)
1720 * @object: A #UpExportedDevice.
1721 * @value: The value to set.
1722 *
1723 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFull">"EnergyFull"</link> D-Bus property to @value.
1724 *
1725 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1726 */
1727 void
up_exported_device_set_energy_full(UpExportedDevice * object,gdouble value)1728 up_exported_device_set_energy_full (UpExportedDevice *object, gdouble value)
1729 {
1730 g_object_set (G_OBJECT (object), "energy-full", value, NULL);
1731 }
1732
1733 /**
1734 * up_exported_device_get_energy_full_design: (skip)
1735 * @object: A #UpExportedDevice.
1736 *
1737 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFullDesign">"EnergyFullDesign"</link> D-Bus property.
1738 *
1739 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1740 *
1741 * Returns: The property value.
1742 */
1743 gdouble
up_exported_device_get_energy_full_design(UpExportedDevice * object)1744 up_exported_device_get_energy_full_design (UpExportedDevice *object)
1745 {
1746 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_energy_full_design (object);
1747 }
1748
1749 /**
1750 * up_exported_device_set_energy_full_design: (skip)
1751 * @object: A #UpExportedDevice.
1752 * @value: The value to set.
1753 *
1754 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyFullDesign">"EnergyFullDesign"</link> D-Bus property to @value.
1755 *
1756 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1757 */
1758 void
up_exported_device_set_energy_full_design(UpExportedDevice * object,gdouble value)1759 up_exported_device_set_energy_full_design (UpExportedDevice *object, gdouble value)
1760 {
1761 g_object_set (G_OBJECT (object), "energy-full-design", value, NULL);
1762 }
1763
1764 /**
1765 * up_exported_device_get_energy_rate: (skip)
1766 * @object: A #UpExportedDevice.
1767 *
1768 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyRate">"EnergyRate"</link> D-Bus property.
1769 *
1770 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1771 *
1772 * Returns: The property value.
1773 */
1774 gdouble
up_exported_device_get_energy_rate(UpExportedDevice * object)1775 up_exported_device_get_energy_rate (UpExportedDevice *object)
1776 {
1777 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_energy_rate (object);
1778 }
1779
1780 /**
1781 * up_exported_device_set_energy_rate: (skip)
1782 * @object: A #UpExportedDevice.
1783 * @value: The value to set.
1784 *
1785 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.EnergyRate">"EnergyRate"</link> D-Bus property to @value.
1786 *
1787 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1788 */
1789 void
up_exported_device_set_energy_rate(UpExportedDevice * object,gdouble value)1790 up_exported_device_set_energy_rate (UpExportedDevice *object, gdouble value)
1791 {
1792 g_object_set (G_OBJECT (object), "energy-rate", value, NULL);
1793 }
1794
1795 /**
1796 * up_exported_device_get_voltage: (skip)
1797 * @object: A #UpExportedDevice.
1798 *
1799 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Voltage">"Voltage"</link> D-Bus property.
1800 *
1801 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1802 *
1803 * Returns: The property value.
1804 */
1805 gdouble
up_exported_device_get_voltage(UpExportedDevice * object)1806 up_exported_device_get_voltage (UpExportedDevice *object)
1807 {
1808 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_voltage (object);
1809 }
1810
1811 /**
1812 * up_exported_device_set_voltage: (skip)
1813 * @object: A #UpExportedDevice.
1814 * @value: The value to set.
1815 *
1816 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Voltage">"Voltage"</link> D-Bus property to @value.
1817 *
1818 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1819 */
1820 void
up_exported_device_set_voltage(UpExportedDevice * object,gdouble value)1821 up_exported_device_set_voltage (UpExportedDevice *object, gdouble value)
1822 {
1823 g_object_set (G_OBJECT (object), "voltage", value, NULL);
1824 }
1825
1826 /**
1827 * up_exported_device_get_luminosity: (skip)
1828 * @object: A #UpExportedDevice.
1829 *
1830 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Luminosity">"Luminosity"</link> D-Bus property.
1831 *
1832 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1833 *
1834 * Returns: The property value.
1835 */
1836 gdouble
up_exported_device_get_luminosity(UpExportedDevice * object)1837 up_exported_device_get_luminosity (UpExportedDevice *object)
1838 {
1839 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_luminosity (object);
1840 }
1841
1842 /**
1843 * up_exported_device_set_luminosity: (skip)
1844 * @object: A #UpExportedDevice.
1845 * @value: The value to set.
1846 *
1847 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Luminosity">"Luminosity"</link> D-Bus property to @value.
1848 *
1849 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1850 */
1851 void
up_exported_device_set_luminosity(UpExportedDevice * object,gdouble value)1852 up_exported_device_set_luminosity (UpExportedDevice *object, gdouble value)
1853 {
1854 g_object_set (G_OBJECT (object), "luminosity", value, NULL);
1855 }
1856
1857 /**
1858 * up_exported_device_get_time_to_empty: (skip)
1859 * @object: A #UpExportedDevice.
1860 *
1861 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToEmpty">"TimeToEmpty"</link> D-Bus property.
1862 *
1863 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1864 *
1865 * Returns: The property value.
1866 */
1867 gint64
up_exported_device_get_time_to_empty(UpExportedDevice * object)1868 up_exported_device_get_time_to_empty (UpExportedDevice *object)
1869 {
1870 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_time_to_empty (object);
1871 }
1872
1873 /**
1874 * up_exported_device_set_time_to_empty: (skip)
1875 * @object: A #UpExportedDevice.
1876 * @value: The value to set.
1877 *
1878 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToEmpty">"TimeToEmpty"</link> D-Bus property to @value.
1879 *
1880 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1881 */
1882 void
up_exported_device_set_time_to_empty(UpExportedDevice * object,gint64 value)1883 up_exported_device_set_time_to_empty (UpExportedDevice *object, gint64 value)
1884 {
1885 g_object_set (G_OBJECT (object), "time-to-empty", value, NULL);
1886 }
1887
1888 /**
1889 * up_exported_device_get_time_to_full: (skip)
1890 * @object: A #UpExportedDevice.
1891 *
1892 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToFull">"TimeToFull"</link> D-Bus property.
1893 *
1894 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1895 *
1896 * Returns: The property value.
1897 */
1898 gint64
up_exported_device_get_time_to_full(UpExportedDevice * object)1899 up_exported_device_get_time_to_full (UpExportedDevice *object)
1900 {
1901 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_time_to_full (object);
1902 }
1903
1904 /**
1905 * up_exported_device_set_time_to_full: (skip)
1906 * @object: A #UpExportedDevice.
1907 * @value: The value to set.
1908 *
1909 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.TimeToFull">"TimeToFull"</link> D-Bus property to @value.
1910 *
1911 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1912 */
1913 void
up_exported_device_set_time_to_full(UpExportedDevice * object,gint64 value)1914 up_exported_device_set_time_to_full (UpExportedDevice *object, gint64 value)
1915 {
1916 g_object_set (G_OBJECT (object), "time-to-full", value, NULL);
1917 }
1918
1919 /**
1920 * up_exported_device_get_percentage: (skip)
1921 * @object: A #UpExportedDevice.
1922 *
1923 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Percentage">"Percentage"</link> D-Bus property.
1924 *
1925 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1926 *
1927 * Returns: The property value.
1928 */
1929 gdouble
up_exported_device_get_percentage(UpExportedDevice * object)1930 up_exported_device_get_percentage (UpExportedDevice *object)
1931 {
1932 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_percentage (object);
1933 }
1934
1935 /**
1936 * up_exported_device_set_percentage: (skip)
1937 * @object: A #UpExportedDevice.
1938 * @value: The value to set.
1939 *
1940 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Percentage">"Percentage"</link> D-Bus property to @value.
1941 *
1942 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1943 */
1944 void
up_exported_device_set_percentage(UpExportedDevice * object,gdouble value)1945 up_exported_device_set_percentage (UpExportedDevice *object, gdouble value)
1946 {
1947 g_object_set (G_OBJECT (object), "percentage", value, NULL);
1948 }
1949
1950 /**
1951 * up_exported_device_get_temperature: (skip)
1952 * @object: A #UpExportedDevice.
1953 *
1954 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Temperature">"Temperature"</link> D-Bus property.
1955 *
1956 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1957 *
1958 * Returns: The property value.
1959 */
1960 gdouble
up_exported_device_get_temperature(UpExportedDevice * object)1961 up_exported_device_get_temperature (UpExportedDevice *object)
1962 {
1963 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_temperature (object);
1964 }
1965
1966 /**
1967 * up_exported_device_set_temperature: (skip)
1968 * @object: A #UpExportedDevice.
1969 * @value: The value to set.
1970 *
1971 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Temperature">"Temperature"</link> D-Bus property to @value.
1972 *
1973 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1974 */
1975 void
up_exported_device_set_temperature(UpExportedDevice * object,gdouble value)1976 up_exported_device_set_temperature (UpExportedDevice *object, gdouble value)
1977 {
1978 g_object_set (G_OBJECT (object), "temperature", value, NULL);
1979 }
1980
1981 /**
1982 * up_exported_device_get_is_present: (skip)
1983 * @object: A #UpExportedDevice.
1984 *
1985 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsPresent">"IsPresent"</link> D-Bus property.
1986 *
1987 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1988 *
1989 * Returns: The property value.
1990 */
1991 gboolean
up_exported_device_get_is_present(UpExportedDevice * object)1992 up_exported_device_get_is_present (UpExportedDevice *object)
1993 {
1994 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_is_present (object);
1995 }
1996
1997 /**
1998 * up_exported_device_set_is_present: (skip)
1999 * @object: A #UpExportedDevice.
2000 * @value: The value to set.
2001 *
2002 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsPresent">"IsPresent"</link> D-Bus property to @value.
2003 *
2004 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2005 */
2006 void
up_exported_device_set_is_present(UpExportedDevice * object,gboolean value)2007 up_exported_device_set_is_present (UpExportedDevice *object, gboolean value)
2008 {
2009 g_object_set (G_OBJECT (object), "is-present", value, NULL);
2010 }
2011
2012 /**
2013 * up_exported_device_get_state: (skip)
2014 * @object: A #UpExportedDevice.
2015 *
2016 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.State">"State"</link> D-Bus property.
2017 *
2018 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2019 *
2020 * Returns: The property value.
2021 */
2022 guint
up_exported_device_get_state(UpExportedDevice * object)2023 up_exported_device_get_state (UpExportedDevice *object)
2024 {
2025 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_state (object);
2026 }
2027
2028 /**
2029 * up_exported_device_set_state: (skip)
2030 * @object: A #UpExportedDevice.
2031 * @value: The value to set.
2032 *
2033 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.State">"State"</link> D-Bus property to @value.
2034 *
2035 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2036 */
2037 void
up_exported_device_set_state(UpExportedDevice * object,guint value)2038 up_exported_device_set_state (UpExportedDevice *object, guint value)
2039 {
2040 g_object_set (G_OBJECT (object), "state", value, NULL);
2041 }
2042
2043 /**
2044 * up_exported_device_get_is_rechargeable: (skip)
2045 * @object: A #UpExportedDevice.
2046 *
2047 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsRechargeable">"IsRechargeable"</link> D-Bus property.
2048 *
2049 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2050 *
2051 * Returns: The property value.
2052 */
2053 gboolean
up_exported_device_get_is_rechargeable(UpExportedDevice * object)2054 up_exported_device_get_is_rechargeable (UpExportedDevice *object)
2055 {
2056 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_is_rechargeable (object);
2057 }
2058
2059 /**
2060 * up_exported_device_set_is_rechargeable: (skip)
2061 * @object: A #UpExportedDevice.
2062 * @value: The value to set.
2063 *
2064 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IsRechargeable">"IsRechargeable"</link> D-Bus property to @value.
2065 *
2066 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2067 */
2068 void
up_exported_device_set_is_rechargeable(UpExportedDevice * object,gboolean value)2069 up_exported_device_set_is_rechargeable (UpExportedDevice *object, gboolean value)
2070 {
2071 g_object_set (G_OBJECT (object), "is-rechargeable", value, NULL);
2072 }
2073
2074 /**
2075 * up_exported_device_get_capacity: (skip)
2076 * @object: A #UpExportedDevice.
2077 *
2078 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Capacity">"Capacity"</link> D-Bus property.
2079 *
2080 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2081 *
2082 * Returns: The property value.
2083 */
2084 gdouble
up_exported_device_get_capacity(UpExportedDevice * object)2085 up_exported_device_get_capacity (UpExportedDevice *object)
2086 {
2087 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_capacity (object);
2088 }
2089
2090 /**
2091 * up_exported_device_set_capacity: (skip)
2092 * @object: A #UpExportedDevice.
2093 * @value: The value to set.
2094 *
2095 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Capacity">"Capacity"</link> D-Bus property to @value.
2096 *
2097 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2098 */
2099 void
up_exported_device_set_capacity(UpExportedDevice * object,gdouble value)2100 up_exported_device_set_capacity (UpExportedDevice *object, gdouble value)
2101 {
2102 g_object_set (G_OBJECT (object), "capacity", value, NULL);
2103 }
2104
2105 /**
2106 * up_exported_device_get_technology: (skip)
2107 * @object: A #UpExportedDevice.
2108 *
2109 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Technology">"Technology"</link> D-Bus property.
2110 *
2111 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2112 *
2113 * Returns: The property value.
2114 */
2115 guint
up_exported_device_get_technology(UpExportedDevice * object)2116 up_exported_device_get_technology (UpExportedDevice *object)
2117 {
2118 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_technology (object);
2119 }
2120
2121 /**
2122 * up_exported_device_set_technology: (skip)
2123 * @object: A #UpExportedDevice.
2124 * @value: The value to set.
2125 *
2126 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.Technology">"Technology"</link> D-Bus property to @value.
2127 *
2128 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2129 */
2130 void
up_exported_device_set_technology(UpExportedDevice * object,guint value)2131 up_exported_device_set_technology (UpExportedDevice *object, guint value)
2132 {
2133 g_object_set (G_OBJECT (object), "technology", value, NULL);
2134 }
2135
2136 /**
2137 * up_exported_device_get_warning_level: (skip)
2138 * @object: A #UpExportedDevice.
2139 *
2140 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.WarningLevel">"WarningLevel"</link> D-Bus property.
2141 *
2142 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2143 *
2144 * Returns: The property value.
2145 */
2146 guint
up_exported_device_get_warning_level(UpExportedDevice * object)2147 up_exported_device_get_warning_level (UpExportedDevice *object)
2148 {
2149 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_warning_level (object);
2150 }
2151
2152 /**
2153 * up_exported_device_set_warning_level: (skip)
2154 * @object: A #UpExportedDevice.
2155 * @value: The value to set.
2156 *
2157 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.WarningLevel">"WarningLevel"</link> D-Bus property to @value.
2158 *
2159 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2160 */
2161 void
up_exported_device_set_warning_level(UpExportedDevice * object,guint value)2162 up_exported_device_set_warning_level (UpExportedDevice *object, guint value)
2163 {
2164 g_object_set (G_OBJECT (object), "warning-level", value, NULL);
2165 }
2166
2167 /**
2168 * up_exported_device_get_battery_level: (skip)
2169 * @object: A #UpExportedDevice.
2170 *
2171 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.BatteryLevel">"BatteryLevel"</link> D-Bus property.
2172 *
2173 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2174 *
2175 * Returns: The property value.
2176 */
2177 guint
up_exported_device_get_battery_level(UpExportedDevice * object)2178 up_exported_device_get_battery_level (UpExportedDevice *object)
2179 {
2180 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_battery_level (object);
2181 }
2182
2183 /**
2184 * up_exported_device_set_battery_level: (skip)
2185 * @object: A #UpExportedDevice.
2186 * @value: The value to set.
2187 *
2188 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.BatteryLevel">"BatteryLevel"</link> D-Bus property to @value.
2189 *
2190 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2191 */
2192 void
up_exported_device_set_battery_level(UpExportedDevice * object,guint value)2193 up_exported_device_set_battery_level (UpExportedDevice *object, guint value)
2194 {
2195 g_object_set (G_OBJECT (object), "battery-level", value, NULL);
2196 }
2197
2198 /**
2199 * up_exported_device_get_icon_name: (skip)
2200 * @object: A #UpExportedDevice.
2201 *
2202 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IconName">"IconName"</link> D-Bus property.
2203 *
2204 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2205 *
2206 * 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 up_exported_device_dup_icon_name() if on another thread.
2207 *
2208 * 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.
2209 */
2210 const gchar *
up_exported_device_get_icon_name(UpExportedDevice * object)2211 up_exported_device_get_icon_name (UpExportedDevice *object)
2212 {
2213 return UP_EXPORTED_DEVICE_GET_IFACE (object)->get_icon_name (object);
2214 }
2215
2216 /**
2217 * up_exported_device_dup_icon_name: (skip)
2218 * @object: A #UpExportedDevice.
2219 *
2220 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IconName">"IconName"</link> D-Bus property.
2221 *
2222 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2223 *
2224 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
2225 */
2226 gchar *
up_exported_device_dup_icon_name(UpExportedDevice * object)2227 up_exported_device_dup_icon_name (UpExportedDevice *object)
2228 {
2229 gchar *value;
2230 g_object_get (G_OBJECT (object), "icon-name", &value, NULL);
2231 return value;
2232 }
2233
2234 /**
2235 * up_exported_device_set_icon_name: (skip)
2236 * @object: A #UpExportedDevice.
2237 * @value: The value to set.
2238 *
2239 * Sets the <link linkend="gdbus-property-org-freedesktop-UPower-Device.IconName">"IconName"</link> D-Bus property to @value.
2240 *
2241 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2242 */
2243 void
up_exported_device_set_icon_name(UpExportedDevice * object,const gchar * value)2244 up_exported_device_set_icon_name (UpExportedDevice *object, const gchar *value)
2245 {
2246 g_object_set (G_OBJECT (object), "icon-name", value, NULL);
2247 }
2248
2249 /**
2250 * up_exported_device_call_refresh:
2251 * @proxy: A #UpExportedDeviceProxy.
2252 * @cancellable: (nullable): A #GCancellable or %NULL.
2253 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2254 * @user_data: User data to pass to @callback.
2255 *
2256 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.Refresh">Refresh()</link> D-Bus method on @proxy.
2257 * 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()).
2258 * You can then call up_exported_device_call_refresh_finish() to get the result of the operation.
2259 *
2260 * See up_exported_device_call_refresh_sync() for the synchronous, blocking version of this method.
2261 */
2262 void
up_exported_device_call_refresh(UpExportedDevice * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2263 up_exported_device_call_refresh (
2264 UpExportedDevice *proxy,
2265 GCancellable *cancellable,
2266 GAsyncReadyCallback callback,
2267 gpointer user_data)
2268 {
2269 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2270 "Refresh",
2271 g_variant_new ("()"),
2272 G_DBUS_CALL_FLAGS_NONE,
2273 -1,
2274 cancellable,
2275 callback,
2276 user_data);
2277 }
2278
2279 /**
2280 * up_exported_device_call_refresh_finish:
2281 * @proxy: A #UpExportedDeviceProxy.
2282 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to up_exported_device_call_refresh().
2283 * @error: Return location for error or %NULL.
2284 *
2285 * Finishes an operation started with up_exported_device_call_refresh().
2286 *
2287 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2288 */
2289 gboolean
up_exported_device_call_refresh_finish(UpExportedDevice * proxy,GAsyncResult * res,GError ** error)2290 up_exported_device_call_refresh_finish (
2291 UpExportedDevice *proxy,
2292 GAsyncResult *res,
2293 GError **error)
2294 {
2295 GVariant *_ret;
2296 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2297 if (_ret == NULL)
2298 goto _out;
2299 g_variant_get (_ret,
2300 "()");
2301 g_variant_unref (_ret);
2302 _out:
2303 return _ret != NULL;
2304 }
2305
2306 /**
2307 * up_exported_device_call_refresh_sync:
2308 * @proxy: A #UpExportedDeviceProxy.
2309 * @cancellable: (nullable): A #GCancellable or %NULL.
2310 * @error: Return location for error or %NULL.
2311 *
2312 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.Refresh">Refresh()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2313 *
2314 * See up_exported_device_call_refresh() for the asynchronous version of this method.
2315 *
2316 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2317 */
2318 gboolean
up_exported_device_call_refresh_sync(UpExportedDevice * proxy,GCancellable * cancellable,GError ** error)2319 up_exported_device_call_refresh_sync (
2320 UpExportedDevice *proxy,
2321 GCancellable *cancellable,
2322 GError **error)
2323 {
2324 GVariant *_ret;
2325 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2326 "Refresh",
2327 g_variant_new ("()"),
2328 G_DBUS_CALL_FLAGS_NONE,
2329 -1,
2330 cancellable,
2331 error);
2332 if (_ret == NULL)
2333 goto _out;
2334 g_variant_get (_ret,
2335 "()");
2336 g_variant_unref (_ret);
2337 _out:
2338 return _ret != NULL;
2339 }
2340
2341 /**
2342 * up_exported_device_call_get_history:
2343 * @proxy: A #UpExportedDeviceProxy.
2344 * @arg_type: Argument to pass with the method invocation.
2345 * @arg_timespan: Argument to pass with the method invocation.
2346 * @arg_resolution: Argument to pass with the method invocation.
2347 * @cancellable: (nullable): A #GCancellable or %NULL.
2348 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2349 * @user_data: User data to pass to @callback.
2350 *
2351 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetHistory">GetHistory()</link> D-Bus method on @proxy.
2352 * 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()).
2353 * You can then call up_exported_device_call_get_history_finish() to get the result of the operation.
2354 *
2355 * See up_exported_device_call_get_history_sync() for the synchronous, blocking version of this method.
2356 */
2357 void
up_exported_device_call_get_history(UpExportedDevice * proxy,const gchar * arg_type,guint arg_timespan,guint arg_resolution,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2358 up_exported_device_call_get_history (
2359 UpExportedDevice *proxy,
2360 const gchar *arg_type,
2361 guint arg_timespan,
2362 guint arg_resolution,
2363 GCancellable *cancellable,
2364 GAsyncReadyCallback callback,
2365 gpointer user_data)
2366 {
2367 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2368 "GetHistory",
2369 g_variant_new ("(suu)",
2370 arg_type,
2371 arg_timespan,
2372 arg_resolution),
2373 G_DBUS_CALL_FLAGS_NONE,
2374 -1,
2375 cancellable,
2376 callback,
2377 user_data);
2378 }
2379
2380 /**
2381 * up_exported_device_call_get_history_finish:
2382 * @proxy: A #UpExportedDeviceProxy.
2383 * @out_data: (out) (optional): Return location for return parameter or %NULL to ignore.
2384 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to up_exported_device_call_get_history().
2385 * @error: Return location for error or %NULL.
2386 *
2387 * Finishes an operation started with up_exported_device_call_get_history().
2388 *
2389 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2390 */
2391 gboolean
up_exported_device_call_get_history_finish(UpExportedDevice * proxy,GVariant ** out_data,GAsyncResult * res,GError ** error)2392 up_exported_device_call_get_history_finish (
2393 UpExportedDevice *proxy,
2394 GVariant **out_data,
2395 GAsyncResult *res,
2396 GError **error)
2397 {
2398 GVariant *_ret;
2399 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2400 if (_ret == NULL)
2401 goto _out;
2402 g_variant_get (_ret,
2403 "(@a(udu))",
2404 out_data);
2405 g_variant_unref (_ret);
2406 _out:
2407 return _ret != NULL;
2408 }
2409
2410 /**
2411 * up_exported_device_call_get_history_sync:
2412 * @proxy: A #UpExportedDeviceProxy.
2413 * @arg_type: Argument to pass with the method invocation.
2414 * @arg_timespan: Argument to pass with the method invocation.
2415 * @arg_resolution: Argument to pass with the method invocation.
2416 * @out_data: (out) (optional): Return location for return parameter or %NULL to ignore.
2417 * @cancellable: (nullable): A #GCancellable or %NULL.
2418 * @error: Return location for error or %NULL.
2419 *
2420 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetHistory">GetHistory()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2421 *
2422 * See up_exported_device_call_get_history() for the asynchronous version of this method.
2423 *
2424 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2425 */
2426 gboolean
up_exported_device_call_get_history_sync(UpExportedDevice * proxy,const gchar * arg_type,guint arg_timespan,guint arg_resolution,GVariant ** out_data,GCancellable * cancellable,GError ** error)2427 up_exported_device_call_get_history_sync (
2428 UpExportedDevice *proxy,
2429 const gchar *arg_type,
2430 guint arg_timespan,
2431 guint arg_resolution,
2432 GVariant **out_data,
2433 GCancellable *cancellable,
2434 GError **error)
2435 {
2436 GVariant *_ret;
2437 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2438 "GetHistory",
2439 g_variant_new ("(suu)",
2440 arg_type,
2441 arg_timespan,
2442 arg_resolution),
2443 G_DBUS_CALL_FLAGS_NONE,
2444 -1,
2445 cancellable,
2446 error);
2447 if (_ret == NULL)
2448 goto _out;
2449 g_variant_get (_ret,
2450 "(@a(udu))",
2451 out_data);
2452 g_variant_unref (_ret);
2453 _out:
2454 return _ret != NULL;
2455 }
2456
2457 /**
2458 * up_exported_device_call_get_statistics:
2459 * @proxy: A #UpExportedDeviceProxy.
2460 * @arg_type: Argument to pass with the method invocation.
2461 * @cancellable: (nullable): A #GCancellable or %NULL.
2462 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2463 * @user_data: User data to pass to @callback.
2464 *
2465 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetStatistics">GetStatistics()</link> D-Bus method on @proxy.
2466 * 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()).
2467 * You can then call up_exported_device_call_get_statistics_finish() to get the result of the operation.
2468 *
2469 * See up_exported_device_call_get_statistics_sync() for the synchronous, blocking version of this method.
2470 */
2471 void
up_exported_device_call_get_statistics(UpExportedDevice * proxy,const gchar * arg_type,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2472 up_exported_device_call_get_statistics (
2473 UpExportedDevice *proxy,
2474 const gchar *arg_type,
2475 GCancellable *cancellable,
2476 GAsyncReadyCallback callback,
2477 gpointer user_data)
2478 {
2479 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2480 "GetStatistics",
2481 g_variant_new ("(s)",
2482 arg_type),
2483 G_DBUS_CALL_FLAGS_NONE,
2484 -1,
2485 cancellable,
2486 callback,
2487 user_data);
2488 }
2489
2490 /**
2491 * up_exported_device_call_get_statistics_finish:
2492 * @proxy: A #UpExportedDeviceProxy.
2493 * @out_data: (out) (optional): Return location for return parameter or %NULL to ignore.
2494 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to up_exported_device_call_get_statistics().
2495 * @error: Return location for error or %NULL.
2496 *
2497 * Finishes an operation started with up_exported_device_call_get_statistics().
2498 *
2499 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2500 */
2501 gboolean
up_exported_device_call_get_statistics_finish(UpExportedDevice * proxy,GVariant ** out_data,GAsyncResult * res,GError ** error)2502 up_exported_device_call_get_statistics_finish (
2503 UpExportedDevice *proxy,
2504 GVariant **out_data,
2505 GAsyncResult *res,
2506 GError **error)
2507 {
2508 GVariant *_ret;
2509 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2510 if (_ret == NULL)
2511 goto _out;
2512 g_variant_get (_ret,
2513 "(@a(dd))",
2514 out_data);
2515 g_variant_unref (_ret);
2516 _out:
2517 return _ret != NULL;
2518 }
2519
2520 /**
2521 * up_exported_device_call_get_statistics_sync:
2522 * @proxy: A #UpExportedDeviceProxy.
2523 * @arg_type: Argument to pass with the method invocation.
2524 * @out_data: (out) (optional): Return location for return parameter or %NULL to ignore.
2525 * @cancellable: (nullable): A #GCancellable or %NULL.
2526 * @error: Return location for error or %NULL.
2527 *
2528 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetStatistics">GetStatistics()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2529 *
2530 * See up_exported_device_call_get_statistics() for the asynchronous version of this method.
2531 *
2532 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2533 */
2534 gboolean
up_exported_device_call_get_statistics_sync(UpExportedDevice * proxy,const gchar * arg_type,GVariant ** out_data,GCancellable * cancellable,GError ** error)2535 up_exported_device_call_get_statistics_sync (
2536 UpExportedDevice *proxy,
2537 const gchar *arg_type,
2538 GVariant **out_data,
2539 GCancellable *cancellable,
2540 GError **error)
2541 {
2542 GVariant *_ret;
2543 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2544 "GetStatistics",
2545 g_variant_new ("(s)",
2546 arg_type),
2547 G_DBUS_CALL_FLAGS_NONE,
2548 -1,
2549 cancellable,
2550 error);
2551 if (_ret == NULL)
2552 goto _out;
2553 g_variant_get (_ret,
2554 "(@a(dd))",
2555 out_data);
2556 g_variant_unref (_ret);
2557 _out:
2558 return _ret != NULL;
2559 }
2560
2561 /**
2562 * up_exported_device_complete_refresh:
2563 * @object: A #UpExportedDevice.
2564 * @invocation: (transfer full): A #GDBusMethodInvocation.
2565 *
2566 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower-Device.Refresh">Refresh()</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.
2567 *
2568 * This method will free @invocation, you cannot use it afterwards.
2569 */
2570 void
up_exported_device_complete_refresh(UpExportedDevice * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2571 up_exported_device_complete_refresh (
2572 UpExportedDevice *object G_GNUC_UNUSED,
2573 GDBusMethodInvocation *invocation)
2574 {
2575 g_dbus_method_invocation_return_value (invocation,
2576 g_variant_new ("()"));
2577 }
2578
2579 /**
2580 * up_exported_device_complete_get_history:
2581 * @object: A #UpExportedDevice.
2582 * @invocation: (transfer full): A #GDBusMethodInvocation.
2583 * @data: Parameter to return.
2584 *
2585 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetHistory">GetHistory()</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.
2586 *
2587 * This method will free @invocation, you cannot use it afterwards.
2588 */
2589 void
up_exported_device_complete_get_history(UpExportedDevice * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * data)2590 up_exported_device_complete_get_history (
2591 UpExportedDevice *object G_GNUC_UNUSED,
2592 GDBusMethodInvocation *invocation,
2593 GVariant *data)
2594 {
2595 g_dbus_method_invocation_return_value (invocation,
2596 g_variant_new ("(@a(udu))",
2597 data));
2598 }
2599
2600 /**
2601 * up_exported_device_complete_get_statistics:
2602 * @object: A #UpExportedDevice.
2603 * @invocation: (transfer full): A #GDBusMethodInvocation.
2604 * @data: Parameter to return.
2605 *
2606 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower-Device.GetStatistics">GetStatistics()</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.
2607 *
2608 * This method will free @invocation, you cannot use it afterwards.
2609 */
2610 void
up_exported_device_complete_get_statistics(UpExportedDevice * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * data)2611 up_exported_device_complete_get_statistics (
2612 UpExportedDevice *object G_GNUC_UNUSED,
2613 GDBusMethodInvocation *invocation,
2614 GVariant *data)
2615 {
2616 g_dbus_method_invocation_return_value (invocation,
2617 g_variant_new ("(@a(dd))",
2618 data));
2619 }
2620
2621 /* ------------------------------------------------------------------------ */
2622
2623 /**
2624 * UpExportedDeviceProxy:
2625 *
2626 * The #UpExportedDeviceProxy structure contains only private data and should only be accessed using the provided API.
2627 */
2628
2629 /**
2630 * UpExportedDeviceProxyClass:
2631 * @parent_class: The parent class.
2632 *
2633 * Class structure for #UpExportedDeviceProxy.
2634 */
2635
2636 struct _UpExportedDeviceProxyPrivate
2637 {
2638 GData *qdata;
2639 };
2640
2641 static void up_exported_device_proxy_iface_init (UpExportedDeviceIface *iface);
2642
2643 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(UpExportedDeviceProxy,up_exported_device_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (UpExportedDeviceProxy)G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE,up_exported_device_proxy_iface_init))2644 G_DEFINE_TYPE_WITH_CODE (UpExportedDeviceProxy, up_exported_device_proxy, G_TYPE_DBUS_PROXY,
2645 G_ADD_PRIVATE (UpExportedDeviceProxy)
2646 G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE, up_exported_device_proxy_iface_init))
2647
2648 #else
2649 G_DEFINE_TYPE_WITH_CODE (UpExportedDeviceProxy, up_exported_device_proxy, G_TYPE_DBUS_PROXY,
2650 G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE, up_exported_device_proxy_iface_init))
2651
2652 #endif
2653 static void
2654 up_exported_device_proxy_finalize (GObject *object)
2655 {
2656 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2657 g_datalist_clear (&proxy->priv->qdata);
2658 G_OBJECT_CLASS (up_exported_device_proxy_parent_class)->finalize (object);
2659 }
2660
2661 static void
up_exported_device_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2662 up_exported_device_proxy_get_property (GObject *object,
2663 guint prop_id,
2664 GValue *value,
2665 GParamSpec *pspec G_GNUC_UNUSED)
2666 {
2667 const _ExtendedGDBusPropertyInfo *info;
2668 GVariant *variant;
2669 g_assert (prop_id != 0 && prop_id - 1 < 29);
2670 info = (const _ExtendedGDBusPropertyInfo *) _up_exported_device_property_info_pointers[prop_id - 1];
2671 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2672 if (info->use_gvariant)
2673 {
2674 g_value_set_variant (value, variant);
2675 }
2676 else
2677 {
2678 if (variant != NULL)
2679 g_dbus_gvariant_to_gvalue (variant, value);
2680 }
2681 if (variant != NULL)
2682 g_variant_unref (variant);
2683 }
2684
2685 static void
up_exported_device_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)2686 up_exported_device_proxy_set_property_cb (GDBusProxy *proxy,
2687 GAsyncResult *res,
2688 gpointer user_data)
2689 {
2690 const _ExtendedGDBusPropertyInfo *info = user_data;
2691 GError *error;
2692 GVariant *_ret;
2693 error = NULL;
2694 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2695 if (!_ret)
2696 {
2697 g_warning ("Error setting property '%s' on interface org.freedesktop.UPower.Device: %s (%s, %d)",
2698 info->parent_struct.name,
2699 error->message, g_quark_to_string (error->domain), error->code);
2700 g_error_free (error);
2701 }
2702 else
2703 {
2704 g_variant_unref (_ret);
2705 }
2706 }
2707
2708 static void
up_exported_device_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2709 up_exported_device_proxy_set_property (GObject *object,
2710 guint prop_id,
2711 const GValue *value,
2712 GParamSpec *pspec G_GNUC_UNUSED)
2713 {
2714 const _ExtendedGDBusPropertyInfo *info;
2715 GVariant *variant;
2716 g_assert (prop_id != 0 && prop_id - 1 < 29);
2717 info = (const _ExtendedGDBusPropertyInfo *) _up_exported_device_property_info_pointers[prop_id - 1];
2718 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2719 g_dbus_proxy_call (G_DBUS_PROXY (object),
2720 "org.freedesktop.DBus.Properties.Set",
2721 g_variant_new ("(ssv)", "org.freedesktop.UPower.Device", info->parent_struct.name, variant),
2722 G_DBUS_CALL_FLAGS_NONE,
2723 -1,
2724 NULL, (GAsyncReadyCallback) up_exported_device_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2725 g_variant_unref (variant);
2726 }
2727
2728 static void
up_exported_device_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)2729 up_exported_device_proxy_g_signal (GDBusProxy *proxy,
2730 const gchar *sender_name G_GNUC_UNUSED,
2731 const gchar *signal_name,
2732 GVariant *parameters)
2733 {
2734 _ExtendedGDBusSignalInfo *info;
2735 GVariantIter iter;
2736 GVariant *child;
2737 GValue *paramv;
2738 gsize num_params;
2739 gsize n;
2740 guint signal_id;
2741 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct, signal_name);
2742 if (info == NULL)
2743 return;
2744 num_params = g_variant_n_children (parameters);
2745 paramv = g_new0 (GValue, num_params + 1);
2746 g_value_init (¶mv[0], UP_TYPE_EXPORTED_DEVICE);
2747 g_value_set_object (¶mv[0], proxy);
2748 g_variant_iter_init (&iter, parameters);
2749 n = 1;
2750 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2751 {
2752 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2753 if (arg_info->use_gvariant)
2754 {
2755 g_value_init (¶mv[n], G_TYPE_VARIANT);
2756 g_value_set_variant (¶mv[n], child);
2757 n++;
2758 }
2759 else
2760 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
2761 g_variant_unref (child);
2762 }
2763 signal_id = g_signal_lookup (info->signal_name, UP_TYPE_EXPORTED_DEVICE);
2764 g_signal_emitv (paramv, signal_id, 0, NULL);
2765 for (n = 0; n < num_params + 1; n++)
2766 g_value_unset (¶mv[n]);
2767 g_free (paramv);
2768 }
2769
2770 static void
up_exported_device_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)2771 up_exported_device_proxy_g_properties_changed (GDBusProxy *_proxy,
2772 GVariant *changed_properties,
2773 const gchar *const *invalidated_properties)
2774 {
2775 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (_proxy);
2776 guint n;
2777 const gchar *key;
2778 GVariantIter *iter;
2779 _ExtendedGDBusPropertyInfo *info;
2780 g_variant_get (changed_properties, "a{sv}", &iter);
2781 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2782 {
2783 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct, key);
2784 g_datalist_remove_data (&proxy->priv->qdata, key);
2785 if (info != NULL)
2786 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2787 }
2788 g_variant_iter_free (iter);
2789 for (n = 0; invalidated_properties[n] != NULL; n++)
2790 {
2791 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct, invalidated_properties[n]);
2792 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2793 if (info != NULL)
2794 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2795 }
2796 }
2797
2798 static const gchar *
up_exported_device_proxy_get_native_path(UpExportedDevice * object)2799 up_exported_device_proxy_get_native_path (UpExportedDevice *object)
2800 {
2801 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2802 GVariant *variant;
2803 const gchar *value = NULL;
2804 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "NativePath");
2805 if (variant != NULL)
2806 {
2807 value = g_variant_get_string (variant, NULL);
2808 g_variant_unref (variant);
2809 }
2810 return value;
2811 }
2812
2813 static const gchar *
up_exported_device_proxy_get_vendor(UpExportedDevice * object)2814 up_exported_device_proxy_get_vendor (UpExportedDevice *object)
2815 {
2816 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2817 GVariant *variant;
2818 const gchar *value = NULL;
2819 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Vendor");
2820 if (variant != NULL)
2821 {
2822 value = g_variant_get_string (variant, NULL);
2823 g_variant_unref (variant);
2824 }
2825 return value;
2826 }
2827
2828 static const gchar *
up_exported_device_proxy_get_model(UpExportedDevice * object)2829 up_exported_device_proxy_get_model (UpExportedDevice *object)
2830 {
2831 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2832 GVariant *variant;
2833 const gchar *value = NULL;
2834 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Model");
2835 if (variant != NULL)
2836 {
2837 value = g_variant_get_string (variant, NULL);
2838 g_variant_unref (variant);
2839 }
2840 return value;
2841 }
2842
2843 static const gchar *
up_exported_device_proxy_get_serial(UpExportedDevice * object)2844 up_exported_device_proxy_get_serial (UpExportedDevice *object)
2845 {
2846 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2847 GVariant *variant;
2848 const gchar *value = NULL;
2849 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Serial");
2850 if (variant != NULL)
2851 {
2852 value = g_variant_get_string (variant, NULL);
2853 g_variant_unref (variant);
2854 }
2855 return value;
2856 }
2857
2858 static guint64
up_exported_device_proxy_get_update_time(UpExportedDevice * object)2859 up_exported_device_proxy_get_update_time (UpExportedDevice *object)
2860 {
2861 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2862 GVariant *variant;
2863 guint64 value = 0;
2864 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UpdateTime");
2865 if (variant != NULL)
2866 {
2867 value = g_variant_get_uint64 (variant);
2868 g_variant_unref (variant);
2869 }
2870 return value;
2871 }
2872
2873 static guint
up_exported_device_proxy_get_type_(UpExportedDevice * object)2874 up_exported_device_proxy_get_type_ (UpExportedDevice *object)
2875 {
2876 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2877 GVariant *variant;
2878 guint value = 0;
2879 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Type");
2880 if (variant != NULL)
2881 {
2882 value = g_variant_get_uint32 (variant);
2883 g_variant_unref (variant);
2884 }
2885 return value;
2886 }
2887
2888 static gboolean
up_exported_device_proxy_get_power_supply(UpExportedDevice * object)2889 up_exported_device_proxy_get_power_supply (UpExportedDevice *object)
2890 {
2891 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2892 GVariant *variant;
2893 gboolean value = 0;
2894 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PowerSupply");
2895 if (variant != NULL)
2896 {
2897 value = g_variant_get_boolean (variant);
2898 g_variant_unref (variant);
2899 }
2900 return value;
2901 }
2902
2903 static gboolean
up_exported_device_proxy_get_has_history(UpExportedDevice * object)2904 up_exported_device_proxy_get_has_history (UpExportedDevice *object)
2905 {
2906 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2907 GVariant *variant;
2908 gboolean value = 0;
2909 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "HasHistory");
2910 if (variant != NULL)
2911 {
2912 value = g_variant_get_boolean (variant);
2913 g_variant_unref (variant);
2914 }
2915 return value;
2916 }
2917
2918 static gboolean
up_exported_device_proxy_get_has_statistics(UpExportedDevice * object)2919 up_exported_device_proxy_get_has_statistics (UpExportedDevice *object)
2920 {
2921 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2922 GVariant *variant;
2923 gboolean value = 0;
2924 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "HasStatistics");
2925 if (variant != NULL)
2926 {
2927 value = g_variant_get_boolean (variant);
2928 g_variant_unref (variant);
2929 }
2930 return value;
2931 }
2932
2933 static gboolean
up_exported_device_proxy_get_online(UpExportedDevice * object)2934 up_exported_device_proxy_get_online (UpExportedDevice *object)
2935 {
2936 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2937 GVariant *variant;
2938 gboolean value = 0;
2939 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Online");
2940 if (variant != NULL)
2941 {
2942 value = g_variant_get_boolean (variant);
2943 g_variant_unref (variant);
2944 }
2945 return value;
2946 }
2947
2948 static gdouble
up_exported_device_proxy_get_energy(UpExportedDevice * object)2949 up_exported_device_proxy_get_energy (UpExportedDevice *object)
2950 {
2951 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2952 GVariant *variant;
2953 gdouble value = 0;
2954 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Energy");
2955 if (variant != NULL)
2956 {
2957 value = g_variant_get_double (variant);
2958 g_variant_unref (variant);
2959 }
2960 return value;
2961 }
2962
2963 static gdouble
up_exported_device_proxy_get_energy_empty(UpExportedDevice * object)2964 up_exported_device_proxy_get_energy_empty (UpExportedDevice *object)
2965 {
2966 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2967 GVariant *variant;
2968 gdouble value = 0;
2969 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EnergyEmpty");
2970 if (variant != NULL)
2971 {
2972 value = g_variant_get_double (variant);
2973 g_variant_unref (variant);
2974 }
2975 return value;
2976 }
2977
2978 static gdouble
up_exported_device_proxy_get_energy_full(UpExportedDevice * object)2979 up_exported_device_proxy_get_energy_full (UpExportedDevice *object)
2980 {
2981 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2982 GVariant *variant;
2983 gdouble value = 0;
2984 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EnergyFull");
2985 if (variant != NULL)
2986 {
2987 value = g_variant_get_double (variant);
2988 g_variant_unref (variant);
2989 }
2990 return value;
2991 }
2992
2993 static gdouble
up_exported_device_proxy_get_energy_full_design(UpExportedDevice * object)2994 up_exported_device_proxy_get_energy_full_design (UpExportedDevice *object)
2995 {
2996 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
2997 GVariant *variant;
2998 gdouble value = 0;
2999 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EnergyFullDesign");
3000 if (variant != NULL)
3001 {
3002 value = g_variant_get_double (variant);
3003 g_variant_unref (variant);
3004 }
3005 return value;
3006 }
3007
3008 static gdouble
up_exported_device_proxy_get_energy_rate(UpExportedDevice * object)3009 up_exported_device_proxy_get_energy_rate (UpExportedDevice *object)
3010 {
3011 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3012 GVariant *variant;
3013 gdouble value = 0;
3014 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EnergyRate");
3015 if (variant != NULL)
3016 {
3017 value = g_variant_get_double (variant);
3018 g_variant_unref (variant);
3019 }
3020 return value;
3021 }
3022
3023 static gdouble
up_exported_device_proxy_get_voltage(UpExportedDevice * object)3024 up_exported_device_proxy_get_voltage (UpExportedDevice *object)
3025 {
3026 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3027 GVariant *variant;
3028 gdouble value = 0;
3029 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Voltage");
3030 if (variant != NULL)
3031 {
3032 value = g_variant_get_double (variant);
3033 g_variant_unref (variant);
3034 }
3035 return value;
3036 }
3037
3038 static gdouble
up_exported_device_proxy_get_luminosity(UpExportedDevice * object)3039 up_exported_device_proxy_get_luminosity (UpExportedDevice *object)
3040 {
3041 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3042 GVariant *variant;
3043 gdouble value = 0;
3044 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Luminosity");
3045 if (variant != NULL)
3046 {
3047 value = g_variant_get_double (variant);
3048 g_variant_unref (variant);
3049 }
3050 return value;
3051 }
3052
3053 static gint64
up_exported_device_proxy_get_time_to_empty(UpExportedDevice * object)3054 up_exported_device_proxy_get_time_to_empty (UpExportedDevice *object)
3055 {
3056 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3057 GVariant *variant;
3058 gint64 value = 0;
3059 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "TimeToEmpty");
3060 if (variant != NULL)
3061 {
3062 value = g_variant_get_int64 (variant);
3063 g_variant_unref (variant);
3064 }
3065 return value;
3066 }
3067
3068 static gint64
up_exported_device_proxy_get_time_to_full(UpExportedDevice * object)3069 up_exported_device_proxy_get_time_to_full (UpExportedDevice *object)
3070 {
3071 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3072 GVariant *variant;
3073 gint64 value = 0;
3074 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "TimeToFull");
3075 if (variant != NULL)
3076 {
3077 value = g_variant_get_int64 (variant);
3078 g_variant_unref (variant);
3079 }
3080 return value;
3081 }
3082
3083 static gdouble
up_exported_device_proxy_get_percentage(UpExportedDevice * object)3084 up_exported_device_proxy_get_percentage (UpExportedDevice *object)
3085 {
3086 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3087 GVariant *variant;
3088 gdouble value = 0;
3089 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Percentage");
3090 if (variant != NULL)
3091 {
3092 value = g_variant_get_double (variant);
3093 g_variant_unref (variant);
3094 }
3095 return value;
3096 }
3097
3098 static gdouble
up_exported_device_proxy_get_temperature(UpExportedDevice * object)3099 up_exported_device_proxy_get_temperature (UpExportedDevice *object)
3100 {
3101 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3102 GVariant *variant;
3103 gdouble value = 0;
3104 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Temperature");
3105 if (variant != NULL)
3106 {
3107 value = g_variant_get_double (variant);
3108 g_variant_unref (variant);
3109 }
3110 return value;
3111 }
3112
3113 static gboolean
up_exported_device_proxy_get_is_present(UpExportedDevice * object)3114 up_exported_device_proxy_get_is_present (UpExportedDevice *object)
3115 {
3116 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3117 GVariant *variant;
3118 gboolean value = 0;
3119 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IsPresent");
3120 if (variant != NULL)
3121 {
3122 value = g_variant_get_boolean (variant);
3123 g_variant_unref (variant);
3124 }
3125 return value;
3126 }
3127
3128 static guint
up_exported_device_proxy_get_state(UpExportedDevice * object)3129 up_exported_device_proxy_get_state (UpExportedDevice *object)
3130 {
3131 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3132 GVariant *variant;
3133 guint value = 0;
3134 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "State");
3135 if (variant != NULL)
3136 {
3137 value = g_variant_get_uint32 (variant);
3138 g_variant_unref (variant);
3139 }
3140 return value;
3141 }
3142
3143 static gboolean
up_exported_device_proxy_get_is_rechargeable(UpExportedDevice * object)3144 up_exported_device_proxy_get_is_rechargeable (UpExportedDevice *object)
3145 {
3146 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3147 GVariant *variant;
3148 gboolean value = 0;
3149 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IsRechargeable");
3150 if (variant != NULL)
3151 {
3152 value = g_variant_get_boolean (variant);
3153 g_variant_unref (variant);
3154 }
3155 return value;
3156 }
3157
3158 static gdouble
up_exported_device_proxy_get_capacity(UpExportedDevice * object)3159 up_exported_device_proxy_get_capacity (UpExportedDevice *object)
3160 {
3161 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3162 GVariant *variant;
3163 gdouble value = 0;
3164 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Capacity");
3165 if (variant != NULL)
3166 {
3167 value = g_variant_get_double (variant);
3168 g_variant_unref (variant);
3169 }
3170 return value;
3171 }
3172
3173 static guint
up_exported_device_proxy_get_technology(UpExportedDevice * object)3174 up_exported_device_proxy_get_technology (UpExportedDevice *object)
3175 {
3176 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3177 GVariant *variant;
3178 guint value = 0;
3179 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Technology");
3180 if (variant != NULL)
3181 {
3182 value = g_variant_get_uint32 (variant);
3183 g_variant_unref (variant);
3184 }
3185 return value;
3186 }
3187
3188 static guint
up_exported_device_proxy_get_warning_level(UpExportedDevice * object)3189 up_exported_device_proxy_get_warning_level (UpExportedDevice *object)
3190 {
3191 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3192 GVariant *variant;
3193 guint value = 0;
3194 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "WarningLevel");
3195 if (variant != NULL)
3196 {
3197 value = g_variant_get_uint32 (variant);
3198 g_variant_unref (variant);
3199 }
3200 return value;
3201 }
3202
3203 static guint
up_exported_device_proxy_get_battery_level(UpExportedDevice * object)3204 up_exported_device_proxy_get_battery_level (UpExportedDevice *object)
3205 {
3206 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3207 GVariant *variant;
3208 guint value = 0;
3209 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "BatteryLevel");
3210 if (variant != NULL)
3211 {
3212 value = g_variant_get_uint32 (variant);
3213 g_variant_unref (variant);
3214 }
3215 return value;
3216 }
3217
3218 static const gchar *
up_exported_device_proxy_get_icon_name(UpExportedDevice * object)3219 up_exported_device_proxy_get_icon_name (UpExportedDevice *object)
3220 {
3221 UpExportedDeviceProxy *proxy = UP_EXPORTED_DEVICE_PROXY (object);
3222 GVariant *variant;
3223 const gchar *value = NULL;
3224 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IconName");
3225 if (variant != NULL)
3226 {
3227 value = g_variant_get_string (variant, NULL);
3228 g_variant_unref (variant);
3229 }
3230 return value;
3231 }
3232
3233 static void
up_exported_device_proxy_init(UpExportedDeviceProxy * proxy)3234 up_exported_device_proxy_init (UpExportedDeviceProxy *proxy)
3235 {
3236 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3237 proxy->priv = up_exported_device_proxy_get_instance_private (proxy);
3238 #else
3239 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, UP_TYPE_EXPORTED_DEVICE_PROXY, UpExportedDeviceProxyPrivate);
3240 #endif
3241
3242 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), up_exported_device_interface_info ());
3243 }
3244
3245 static void
up_exported_device_proxy_class_init(UpExportedDeviceProxyClass * klass)3246 up_exported_device_proxy_class_init (UpExportedDeviceProxyClass *klass)
3247 {
3248 GObjectClass *gobject_class;
3249 GDBusProxyClass *proxy_class;
3250
3251 gobject_class = G_OBJECT_CLASS (klass);
3252 gobject_class->finalize = up_exported_device_proxy_finalize;
3253 gobject_class->get_property = up_exported_device_proxy_get_property;
3254 gobject_class->set_property = up_exported_device_proxy_set_property;
3255
3256 proxy_class = G_DBUS_PROXY_CLASS (klass);
3257 proxy_class->g_signal = up_exported_device_proxy_g_signal;
3258 proxy_class->g_properties_changed = up_exported_device_proxy_g_properties_changed;
3259
3260 up_exported_device_override_properties (gobject_class, 1);
3261
3262 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3263 g_type_class_add_private (klass, sizeof (UpExportedDeviceProxyPrivate));
3264 #endif
3265 }
3266
3267 static void
up_exported_device_proxy_iface_init(UpExportedDeviceIface * iface)3268 up_exported_device_proxy_iface_init (UpExportedDeviceIface *iface)
3269 {
3270 iface->get_native_path = up_exported_device_proxy_get_native_path;
3271 iface->get_vendor = up_exported_device_proxy_get_vendor;
3272 iface->get_model = up_exported_device_proxy_get_model;
3273 iface->get_serial = up_exported_device_proxy_get_serial;
3274 iface->get_update_time = up_exported_device_proxy_get_update_time;
3275 iface->get_type_ = up_exported_device_proxy_get_type_;
3276 iface->get_power_supply = up_exported_device_proxy_get_power_supply;
3277 iface->get_has_history = up_exported_device_proxy_get_has_history;
3278 iface->get_has_statistics = up_exported_device_proxy_get_has_statistics;
3279 iface->get_online = up_exported_device_proxy_get_online;
3280 iface->get_energy = up_exported_device_proxy_get_energy;
3281 iface->get_energy_empty = up_exported_device_proxy_get_energy_empty;
3282 iface->get_energy_full = up_exported_device_proxy_get_energy_full;
3283 iface->get_energy_full_design = up_exported_device_proxy_get_energy_full_design;
3284 iface->get_energy_rate = up_exported_device_proxy_get_energy_rate;
3285 iface->get_voltage = up_exported_device_proxy_get_voltage;
3286 iface->get_luminosity = up_exported_device_proxy_get_luminosity;
3287 iface->get_time_to_empty = up_exported_device_proxy_get_time_to_empty;
3288 iface->get_time_to_full = up_exported_device_proxy_get_time_to_full;
3289 iface->get_percentage = up_exported_device_proxy_get_percentage;
3290 iface->get_temperature = up_exported_device_proxy_get_temperature;
3291 iface->get_is_present = up_exported_device_proxy_get_is_present;
3292 iface->get_state = up_exported_device_proxy_get_state;
3293 iface->get_is_rechargeable = up_exported_device_proxy_get_is_rechargeable;
3294 iface->get_capacity = up_exported_device_proxy_get_capacity;
3295 iface->get_technology = up_exported_device_proxy_get_technology;
3296 iface->get_warning_level = up_exported_device_proxy_get_warning_level;
3297 iface->get_battery_level = up_exported_device_proxy_get_battery_level;
3298 iface->get_icon_name = up_exported_device_proxy_get_icon_name;
3299 }
3300
3301 /**
3302 * up_exported_device_proxy_new:
3303 * @connection: A #GDBusConnection.
3304 * @flags: Flags from the #GDBusProxyFlags enumeration.
3305 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3306 * @object_path: An object path.
3307 * @cancellable: (nullable): A #GCancellable or %NULL.
3308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3309 * @user_data: User data to pass to @callback.
3310 *
3311 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link>. See g_dbus_proxy_new() for more details.
3312 *
3313 * 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()).
3314 * You can then call up_exported_device_proxy_new_finish() to get the result of the operation.
3315 *
3316 * See up_exported_device_proxy_new_sync() for the synchronous, blocking version of this constructor.
3317 */
3318 void
up_exported_device_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3319 up_exported_device_proxy_new (
3320 GDBusConnection *connection,
3321 GDBusProxyFlags flags,
3322 const gchar *name,
3323 const gchar *object_path,
3324 GCancellable *cancellable,
3325 GAsyncReadyCallback callback,
3326 gpointer user_data)
3327 {
3328 g_async_initable_new_async (UP_TYPE_EXPORTED_DEVICE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower.Device", NULL);
3329 }
3330
3331 /**
3332 * up_exported_device_proxy_new_finish:
3333 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to up_exported_device_proxy_new().
3334 * @error: Return location for error or %NULL
3335 *
3336 * Finishes an operation started with up_exported_device_proxy_new().
3337 *
3338 * Returns: (transfer full) (type UpExportedDeviceProxy): The constructed proxy object or %NULL if @error is set.
3339 */
3340 UpExportedDevice *
up_exported_device_proxy_new_finish(GAsyncResult * res,GError ** error)3341 up_exported_device_proxy_new_finish (
3342 GAsyncResult *res,
3343 GError **error)
3344 {
3345 GObject *ret;
3346 GObject *source_object;
3347 source_object = g_async_result_get_source_object (res);
3348 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3349 g_object_unref (source_object);
3350 if (ret != NULL)
3351 return UP_EXPORTED_DEVICE (ret);
3352 else
3353 return NULL;
3354 }
3355
3356 /**
3357 * up_exported_device_proxy_new_sync:
3358 * @connection: A #GDBusConnection.
3359 * @flags: Flags from the #GDBusProxyFlags enumeration.
3360 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3361 * @object_path: An object path.
3362 * @cancellable: (nullable): A #GCancellable or %NULL.
3363 * @error: Return location for error or %NULL
3364 *
3365 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link>. See g_dbus_proxy_new_sync() for more details.
3366 *
3367 * The calling thread is blocked until a reply is received.
3368 *
3369 * See up_exported_device_proxy_new() for the asynchronous version of this constructor.
3370 *
3371 * Returns: (transfer full) (type UpExportedDeviceProxy): The constructed proxy object or %NULL if @error is set.
3372 */
3373 UpExportedDevice *
up_exported_device_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3374 up_exported_device_proxy_new_sync (
3375 GDBusConnection *connection,
3376 GDBusProxyFlags flags,
3377 const gchar *name,
3378 const gchar *object_path,
3379 GCancellable *cancellable,
3380 GError **error)
3381 {
3382 GInitable *ret;
3383 ret = g_initable_new (UP_TYPE_EXPORTED_DEVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower.Device", NULL);
3384 if (ret != NULL)
3385 return UP_EXPORTED_DEVICE (ret);
3386 else
3387 return NULL;
3388 }
3389
3390
3391 /**
3392 * up_exported_device_proxy_new_for_bus:
3393 * @bus_type: A #GBusType.
3394 * @flags: Flags from the #GDBusProxyFlags enumeration.
3395 * @name: A bus name (well-known or unique).
3396 * @object_path: An object path.
3397 * @cancellable: (nullable): A #GCancellable or %NULL.
3398 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3399 * @user_data: User data to pass to @callback.
3400 *
3401 * Like up_exported_device_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3402 *
3403 * 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()).
3404 * You can then call up_exported_device_proxy_new_for_bus_finish() to get the result of the operation.
3405 *
3406 * See up_exported_device_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3407 */
3408 void
up_exported_device_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3409 up_exported_device_proxy_new_for_bus (
3410 GBusType bus_type,
3411 GDBusProxyFlags flags,
3412 const gchar *name,
3413 const gchar *object_path,
3414 GCancellable *cancellable,
3415 GAsyncReadyCallback callback,
3416 gpointer user_data)
3417 {
3418 g_async_initable_new_async (UP_TYPE_EXPORTED_DEVICE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower.Device", NULL);
3419 }
3420
3421 /**
3422 * up_exported_device_proxy_new_for_bus_finish:
3423 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to up_exported_device_proxy_new_for_bus().
3424 * @error: Return location for error or %NULL
3425 *
3426 * Finishes an operation started with up_exported_device_proxy_new_for_bus().
3427 *
3428 * Returns: (transfer full) (type UpExportedDeviceProxy): The constructed proxy object or %NULL if @error is set.
3429 */
3430 UpExportedDevice *
up_exported_device_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)3431 up_exported_device_proxy_new_for_bus_finish (
3432 GAsyncResult *res,
3433 GError **error)
3434 {
3435 GObject *ret;
3436 GObject *source_object;
3437 source_object = g_async_result_get_source_object (res);
3438 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3439 g_object_unref (source_object);
3440 if (ret != NULL)
3441 return UP_EXPORTED_DEVICE (ret);
3442 else
3443 return NULL;
3444 }
3445
3446 /**
3447 * up_exported_device_proxy_new_for_bus_sync:
3448 * @bus_type: A #GBusType.
3449 * @flags: Flags from the #GDBusProxyFlags enumeration.
3450 * @name: A bus name (well-known or unique).
3451 * @object_path: An object path.
3452 * @cancellable: (nullable): A #GCancellable or %NULL.
3453 * @error: Return location for error or %NULL
3454 *
3455 * Like up_exported_device_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3456 *
3457 * The calling thread is blocked until a reply is received.
3458 *
3459 * See up_exported_device_proxy_new_for_bus() for the asynchronous version of this constructor.
3460 *
3461 * Returns: (transfer full) (type UpExportedDeviceProxy): The constructed proxy object or %NULL if @error is set.
3462 */
3463 UpExportedDevice *
up_exported_device_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3464 up_exported_device_proxy_new_for_bus_sync (
3465 GBusType bus_type,
3466 GDBusProxyFlags flags,
3467 const gchar *name,
3468 const gchar *object_path,
3469 GCancellable *cancellable,
3470 GError **error)
3471 {
3472 GInitable *ret;
3473 ret = g_initable_new (UP_TYPE_EXPORTED_DEVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower.Device", NULL);
3474 if (ret != NULL)
3475 return UP_EXPORTED_DEVICE (ret);
3476 else
3477 return NULL;
3478 }
3479
3480
3481 /* ------------------------------------------------------------------------ */
3482
3483 /**
3484 * UpExportedDeviceSkeleton:
3485 *
3486 * The #UpExportedDeviceSkeleton structure contains only private data and should only be accessed using the provided API.
3487 */
3488
3489 /**
3490 * UpExportedDeviceSkeletonClass:
3491 * @parent_class: The parent class.
3492 *
3493 * Class structure for #UpExportedDeviceSkeleton.
3494 */
3495
3496 struct _UpExportedDeviceSkeletonPrivate
3497 {
3498 GValue *properties;
3499 GList *changed_properties;
3500 GSource *changed_properties_idle_source;
3501 GMainContext *context;
3502 GMutex lock;
3503 };
3504
3505 static void
_up_exported_device_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)3506 _up_exported_device_skeleton_handle_method_call (
3507 GDBusConnection *connection G_GNUC_UNUSED,
3508 const gchar *sender G_GNUC_UNUSED,
3509 const gchar *object_path G_GNUC_UNUSED,
3510 const gchar *interface_name,
3511 const gchar *method_name,
3512 GVariant *parameters,
3513 GDBusMethodInvocation *invocation,
3514 gpointer user_data)
3515 {
3516 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (user_data);
3517 _ExtendedGDBusMethodInfo *info;
3518 GVariantIter iter;
3519 GVariant *child;
3520 GValue *paramv;
3521 gsize num_params;
3522 guint num_extra;
3523 gsize n;
3524 guint signal_id;
3525 GValue return_value = G_VALUE_INIT;
3526 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3527 g_assert (info != NULL);
3528 num_params = g_variant_n_children (parameters);
3529 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3530 n = 0;
3531 g_value_init (¶mv[n], UP_TYPE_EXPORTED_DEVICE);
3532 g_value_set_object (¶mv[n++], skeleton);
3533 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3534 g_value_set_object (¶mv[n++], invocation);
3535 if (info->pass_fdlist)
3536 {
3537 #ifdef G_OS_UNIX
3538 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
3539 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3540 #else
3541 g_assert_not_reached ();
3542 #endif
3543 }
3544 g_variant_iter_init (&iter, parameters);
3545 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3546 {
3547 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3548 if (arg_info->use_gvariant)
3549 {
3550 g_value_init (¶mv[n], G_TYPE_VARIANT);
3551 g_value_set_variant (¶mv[n], child);
3552 n++;
3553 }
3554 else
3555 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
3556 g_variant_unref (child);
3557 }
3558 signal_id = g_signal_lookup (info->signal_name, UP_TYPE_EXPORTED_DEVICE);
3559 g_value_init (&return_value, G_TYPE_BOOLEAN);
3560 g_signal_emitv (paramv, signal_id, 0, &return_value);
3561 if (!g_value_get_boolean (&return_value))
3562 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);
3563 g_value_unset (&return_value);
3564 for (n = 0; n < num_params + num_extra; n++)
3565 g_value_unset (¶mv[n]);
3566 g_free (paramv);
3567 }
3568
3569 static GVariant *
_up_exported_device_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)3570 _up_exported_device_skeleton_handle_get_property (
3571 GDBusConnection *connection G_GNUC_UNUSED,
3572 const gchar *sender G_GNUC_UNUSED,
3573 const gchar *object_path G_GNUC_UNUSED,
3574 const gchar *interface_name G_GNUC_UNUSED,
3575 const gchar *property_name,
3576 GError **error,
3577 gpointer user_data)
3578 {
3579 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (user_data);
3580 GValue value = G_VALUE_INIT;
3581 GParamSpec *pspec;
3582 _ExtendedGDBusPropertyInfo *info;
3583 GVariant *ret;
3584 ret = NULL;
3585 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct, property_name);
3586 g_assert (info != NULL);
3587 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3588 if (pspec == NULL)
3589 {
3590 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3591 }
3592 else
3593 {
3594 g_value_init (&value, pspec->value_type);
3595 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3596 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3597 g_value_unset (&value);
3598 }
3599 return ret;
3600 }
3601
3602 static gboolean
_up_exported_device_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)3603 _up_exported_device_skeleton_handle_set_property (
3604 GDBusConnection *connection G_GNUC_UNUSED,
3605 const gchar *sender G_GNUC_UNUSED,
3606 const gchar *object_path G_GNUC_UNUSED,
3607 const gchar *interface_name G_GNUC_UNUSED,
3608 const gchar *property_name,
3609 GVariant *variant,
3610 GError **error,
3611 gpointer user_data)
3612 {
3613 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (user_data);
3614 GValue value = G_VALUE_INIT;
3615 GParamSpec *pspec;
3616 _ExtendedGDBusPropertyInfo *info;
3617 gboolean ret;
3618 ret = FALSE;
3619 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_up_exported_device_interface_info.parent_struct, property_name);
3620 g_assert (info != NULL);
3621 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3622 if (pspec == NULL)
3623 {
3624 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3625 }
3626 else
3627 {
3628 if (info->use_gvariant)
3629 g_value_set_variant (&value, variant);
3630 else
3631 g_dbus_gvariant_to_gvalue (variant, &value);
3632 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3633 g_value_unset (&value);
3634 ret = TRUE;
3635 }
3636 return ret;
3637 }
3638
3639 static const GDBusInterfaceVTable _up_exported_device_skeleton_vtable =
3640 {
3641 _up_exported_device_skeleton_handle_method_call,
3642 _up_exported_device_skeleton_handle_get_property,
3643 _up_exported_device_skeleton_handle_set_property,
3644 {NULL}
3645 };
3646
3647 static GDBusInterfaceInfo *
up_exported_device_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3648 up_exported_device_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3649 {
3650 return up_exported_device_interface_info ();
3651 }
3652
3653 static GDBusInterfaceVTable *
up_exported_device_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3654 up_exported_device_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3655 {
3656 return (GDBusInterfaceVTable *) &_up_exported_device_skeleton_vtable;
3657 }
3658
3659 static GVariant *
up_exported_device_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)3660 up_exported_device_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3661 {
3662 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (_skeleton);
3663
3664 GVariantBuilder builder;
3665 guint n;
3666 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3667 if (_up_exported_device_interface_info.parent_struct.properties == NULL)
3668 goto out;
3669 for (n = 0; _up_exported_device_interface_info.parent_struct.properties[n] != NULL; n++)
3670 {
3671 GDBusPropertyInfo *info = _up_exported_device_interface_info.parent_struct.properties[n];
3672 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3673 {
3674 GVariant *value;
3675 value = _up_exported_device_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower.Device", info->name, NULL, skeleton);
3676 if (value != NULL)
3677 {
3678 g_variant_take_ref (value);
3679 g_variant_builder_add (&builder, "{sv}", info->name, value);
3680 g_variant_unref (value);
3681 }
3682 }
3683 }
3684 out:
3685 return g_variant_builder_end (&builder);
3686 }
3687
3688 static gboolean _up_exported_device_emit_changed (gpointer user_data);
3689
3690 static void
up_exported_device_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)3691 up_exported_device_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3692 {
3693 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (_skeleton);
3694 gboolean emit_changed = FALSE;
3695
3696 g_mutex_lock (&skeleton->priv->lock);
3697 if (skeleton->priv->changed_properties_idle_source != NULL)
3698 {
3699 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3700 skeleton->priv->changed_properties_idle_source = NULL;
3701 emit_changed = TRUE;
3702 }
3703 g_mutex_unlock (&skeleton->priv->lock);
3704
3705 if (emit_changed)
3706 _up_exported_device_emit_changed (skeleton);
3707 }
3708
3709 static void up_exported_device_skeleton_iface_init (UpExportedDeviceIface *iface);
3710 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(UpExportedDeviceSkeleton,up_exported_device_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (UpExportedDeviceSkeleton)G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE,up_exported_device_skeleton_iface_init))3711 G_DEFINE_TYPE_WITH_CODE (UpExportedDeviceSkeleton, up_exported_device_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3712 G_ADD_PRIVATE (UpExportedDeviceSkeleton)
3713 G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE, up_exported_device_skeleton_iface_init))
3714
3715 #else
3716 G_DEFINE_TYPE_WITH_CODE (UpExportedDeviceSkeleton, up_exported_device_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3717 G_IMPLEMENT_INTERFACE (UP_TYPE_EXPORTED_DEVICE, up_exported_device_skeleton_iface_init))
3718
3719 #endif
3720 static void
3721 up_exported_device_skeleton_finalize (GObject *object)
3722 {
3723 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3724 guint n;
3725 for (n = 0; n < 29; n++)
3726 g_value_unset (&skeleton->priv->properties[n]);
3727 g_free (skeleton->priv->properties);
3728 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3729 if (skeleton->priv->changed_properties_idle_source != NULL)
3730 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3731 g_main_context_unref (skeleton->priv->context);
3732 g_mutex_clear (&skeleton->priv->lock);
3733 G_OBJECT_CLASS (up_exported_device_skeleton_parent_class)->finalize (object);
3734 }
3735
3736 static void
up_exported_device_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)3737 up_exported_device_skeleton_get_property (GObject *object,
3738 guint prop_id,
3739 GValue *value,
3740 GParamSpec *pspec G_GNUC_UNUSED)
3741 {
3742 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3743 g_assert (prop_id != 0 && prop_id - 1 < 29);
3744 g_mutex_lock (&skeleton->priv->lock);
3745 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3746 g_mutex_unlock (&skeleton->priv->lock);
3747 }
3748
3749 static gboolean
_up_exported_device_emit_changed(gpointer user_data)3750 _up_exported_device_emit_changed (gpointer user_data)
3751 {
3752 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (user_data);
3753 GList *l;
3754 GVariantBuilder builder;
3755 GVariantBuilder invalidated_builder;
3756 guint num_changes;
3757
3758 g_mutex_lock (&skeleton->priv->lock);
3759 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3760 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3761 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3762 {
3763 ChangedProperty *cp = l->data;
3764 GVariant *variant;
3765 const GValue *cur_value;
3766
3767 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3768 if (!_g_value_equal (cur_value, &cp->orig_value))
3769 {
3770 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3771 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3772 g_variant_unref (variant);
3773 num_changes++;
3774 }
3775 }
3776 if (num_changes > 0)
3777 {
3778 GList *connections, *ll;
3779 GVariant *signal_variant;
3780 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.UPower.Device",
3781 &builder, &invalidated_builder));
3782 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3783 for (ll = connections; ll != NULL; ll = ll->next)
3784 {
3785 GDBusConnection *connection = ll->data;
3786
3787 g_dbus_connection_emit_signal (connection,
3788 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3789 "org.freedesktop.DBus.Properties",
3790 "PropertiesChanged",
3791 signal_variant,
3792 NULL);
3793 }
3794 g_variant_unref (signal_variant);
3795 g_list_free_full (connections, g_object_unref);
3796 }
3797 else
3798 {
3799 g_variant_builder_clear (&builder);
3800 g_variant_builder_clear (&invalidated_builder);
3801 }
3802 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3803 skeleton->priv->changed_properties = NULL;
3804 skeleton->priv->changed_properties_idle_source = NULL;
3805 g_mutex_unlock (&skeleton->priv->lock);
3806 return FALSE;
3807 }
3808
3809 static void
_up_exported_device_schedule_emit_changed(UpExportedDeviceSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)3810 _up_exported_device_schedule_emit_changed (UpExportedDeviceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3811 {
3812 ChangedProperty *cp;
3813 GList *l;
3814 cp = NULL;
3815 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3816 {
3817 ChangedProperty *i_cp = l->data;
3818 if (i_cp->info == info)
3819 {
3820 cp = i_cp;
3821 break;
3822 }
3823 }
3824 if (cp == NULL)
3825 {
3826 cp = g_new0 (ChangedProperty, 1);
3827 cp->prop_id = prop_id;
3828 cp->info = info;
3829 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3830 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3831 g_value_copy (orig_value, &cp->orig_value);
3832 }
3833 }
3834
3835 static void
up_exported_device_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)3836 up_exported_device_skeleton_notify (GObject *object,
3837 GParamSpec *pspec G_GNUC_UNUSED)
3838 {
3839 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3840 g_mutex_lock (&skeleton->priv->lock);
3841 if (skeleton->priv->changed_properties != NULL &&
3842 skeleton->priv->changed_properties_idle_source == NULL)
3843 {
3844 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3845 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3846 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _up_exported_device_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3847 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _up_exported_device_emit_changed");
3848 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3849 g_source_unref (skeleton->priv->changed_properties_idle_source);
3850 }
3851 g_mutex_unlock (&skeleton->priv->lock);
3852 }
3853
3854 static void
up_exported_device_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)3855 up_exported_device_skeleton_set_property (GObject *object,
3856 guint prop_id,
3857 const GValue *value,
3858 GParamSpec *pspec)
3859 {
3860 const _ExtendedGDBusPropertyInfo *info;
3861 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3862 g_assert (prop_id != 0 && prop_id - 1 < 29);
3863 info = (const _ExtendedGDBusPropertyInfo *) _up_exported_device_property_info_pointers[prop_id - 1];
3864 g_mutex_lock (&skeleton->priv->lock);
3865 g_object_freeze_notify (object);
3866 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3867 {
3868 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
3869 info->emits_changed_signal)
3870 _up_exported_device_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
3871 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3872 g_object_notify_by_pspec (object, pspec);
3873 }
3874 g_mutex_unlock (&skeleton->priv->lock);
3875 g_object_thaw_notify (object);
3876 }
3877
3878 static void
up_exported_device_skeleton_init(UpExportedDeviceSkeleton * skeleton)3879 up_exported_device_skeleton_init (UpExportedDeviceSkeleton *skeleton)
3880 {
3881 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3882 skeleton->priv = up_exported_device_skeleton_get_instance_private (skeleton);
3883 #else
3884 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, UP_TYPE_EXPORTED_DEVICE_SKELETON, UpExportedDeviceSkeletonPrivate);
3885 #endif
3886
3887 g_mutex_init (&skeleton->priv->lock);
3888 skeleton->priv->context = g_main_context_ref_thread_default ();
3889 skeleton->priv->properties = g_new0 (GValue, 29);
3890 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
3891 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
3892 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
3893 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
3894 g_value_init (&skeleton->priv->properties[4], G_TYPE_UINT64);
3895 g_value_init (&skeleton->priv->properties[5], G_TYPE_UINT);
3896 g_value_init (&skeleton->priv->properties[6], G_TYPE_BOOLEAN);
3897 g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN);
3898 g_value_init (&skeleton->priv->properties[8], G_TYPE_BOOLEAN);
3899 g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN);
3900 g_value_init (&skeleton->priv->properties[10], G_TYPE_DOUBLE);
3901 g_value_init (&skeleton->priv->properties[11], G_TYPE_DOUBLE);
3902 g_value_init (&skeleton->priv->properties[12], G_TYPE_DOUBLE);
3903 g_value_init (&skeleton->priv->properties[13], G_TYPE_DOUBLE);
3904 g_value_init (&skeleton->priv->properties[14], G_TYPE_DOUBLE);
3905 g_value_init (&skeleton->priv->properties[15], G_TYPE_DOUBLE);
3906 g_value_init (&skeleton->priv->properties[16], G_TYPE_DOUBLE);
3907 g_value_init (&skeleton->priv->properties[17], G_TYPE_INT64);
3908 g_value_init (&skeleton->priv->properties[18], G_TYPE_INT64);
3909 g_value_init (&skeleton->priv->properties[19], G_TYPE_DOUBLE);
3910 g_value_init (&skeleton->priv->properties[20], G_TYPE_DOUBLE);
3911 g_value_init (&skeleton->priv->properties[21], G_TYPE_BOOLEAN);
3912 g_value_init (&skeleton->priv->properties[22], G_TYPE_UINT);
3913 g_value_init (&skeleton->priv->properties[23], G_TYPE_BOOLEAN);
3914 g_value_init (&skeleton->priv->properties[24], G_TYPE_DOUBLE);
3915 g_value_init (&skeleton->priv->properties[25], G_TYPE_UINT);
3916 g_value_init (&skeleton->priv->properties[26], G_TYPE_UINT);
3917 g_value_init (&skeleton->priv->properties[27], G_TYPE_UINT);
3918 g_value_init (&skeleton->priv->properties[28], G_TYPE_STRING);
3919 }
3920
3921 static const gchar *
up_exported_device_skeleton_get_native_path(UpExportedDevice * object)3922 up_exported_device_skeleton_get_native_path (UpExportedDevice *object)
3923 {
3924 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3925 const gchar *value;
3926 g_mutex_lock (&skeleton->priv->lock);
3927 value = g_value_get_string (&(skeleton->priv->properties[0]));
3928 g_mutex_unlock (&skeleton->priv->lock);
3929 return value;
3930 }
3931
3932 static const gchar *
up_exported_device_skeleton_get_vendor(UpExportedDevice * object)3933 up_exported_device_skeleton_get_vendor (UpExportedDevice *object)
3934 {
3935 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3936 const gchar *value;
3937 g_mutex_lock (&skeleton->priv->lock);
3938 value = g_value_get_string (&(skeleton->priv->properties[1]));
3939 g_mutex_unlock (&skeleton->priv->lock);
3940 return value;
3941 }
3942
3943 static const gchar *
up_exported_device_skeleton_get_model(UpExportedDevice * object)3944 up_exported_device_skeleton_get_model (UpExportedDevice *object)
3945 {
3946 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3947 const gchar *value;
3948 g_mutex_lock (&skeleton->priv->lock);
3949 value = g_value_get_string (&(skeleton->priv->properties[2]));
3950 g_mutex_unlock (&skeleton->priv->lock);
3951 return value;
3952 }
3953
3954 static const gchar *
up_exported_device_skeleton_get_serial(UpExportedDevice * object)3955 up_exported_device_skeleton_get_serial (UpExportedDevice *object)
3956 {
3957 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3958 const gchar *value;
3959 g_mutex_lock (&skeleton->priv->lock);
3960 value = g_value_get_string (&(skeleton->priv->properties[3]));
3961 g_mutex_unlock (&skeleton->priv->lock);
3962 return value;
3963 }
3964
3965 static guint64
up_exported_device_skeleton_get_update_time(UpExportedDevice * object)3966 up_exported_device_skeleton_get_update_time (UpExportedDevice *object)
3967 {
3968 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3969 guint64 value;
3970 g_mutex_lock (&skeleton->priv->lock);
3971 value = g_value_get_uint64 (&(skeleton->priv->properties[4]));
3972 g_mutex_unlock (&skeleton->priv->lock);
3973 return value;
3974 }
3975
3976 static guint
up_exported_device_skeleton_get_type_(UpExportedDevice * object)3977 up_exported_device_skeleton_get_type_ (UpExportedDevice *object)
3978 {
3979 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3980 guint value;
3981 g_mutex_lock (&skeleton->priv->lock);
3982 value = g_value_get_uint (&(skeleton->priv->properties[5]));
3983 g_mutex_unlock (&skeleton->priv->lock);
3984 return value;
3985 }
3986
3987 static gboolean
up_exported_device_skeleton_get_power_supply(UpExportedDevice * object)3988 up_exported_device_skeleton_get_power_supply (UpExportedDevice *object)
3989 {
3990 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
3991 gboolean value;
3992 g_mutex_lock (&skeleton->priv->lock);
3993 value = g_value_get_boolean (&(skeleton->priv->properties[6]));
3994 g_mutex_unlock (&skeleton->priv->lock);
3995 return value;
3996 }
3997
3998 static gboolean
up_exported_device_skeleton_get_has_history(UpExportedDevice * object)3999 up_exported_device_skeleton_get_has_history (UpExportedDevice *object)
4000 {
4001 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4002 gboolean value;
4003 g_mutex_lock (&skeleton->priv->lock);
4004 value = g_value_get_boolean (&(skeleton->priv->properties[7]));
4005 g_mutex_unlock (&skeleton->priv->lock);
4006 return value;
4007 }
4008
4009 static gboolean
up_exported_device_skeleton_get_has_statistics(UpExportedDevice * object)4010 up_exported_device_skeleton_get_has_statistics (UpExportedDevice *object)
4011 {
4012 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4013 gboolean value;
4014 g_mutex_lock (&skeleton->priv->lock);
4015 value = g_value_get_boolean (&(skeleton->priv->properties[8]));
4016 g_mutex_unlock (&skeleton->priv->lock);
4017 return value;
4018 }
4019
4020 static gboolean
up_exported_device_skeleton_get_online(UpExportedDevice * object)4021 up_exported_device_skeleton_get_online (UpExportedDevice *object)
4022 {
4023 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4024 gboolean value;
4025 g_mutex_lock (&skeleton->priv->lock);
4026 value = g_value_get_boolean (&(skeleton->priv->properties[9]));
4027 g_mutex_unlock (&skeleton->priv->lock);
4028 return value;
4029 }
4030
4031 static gdouble
up_exported_device_skeleton_get_energy(UpExportedDevice * object)4032 up_exported_device_skeleton_get_energy (UpExportedDevice *object)
4033 {
4034 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4035 gdouble value;
4036 g_mutex_lock (&skeleton->priv->lock);
4037 value = g_value_get_double (&(skeleton->priv->properties[10]));
4038 g_mutex_unlock (&skeleton->priv->lock);
4039 return value;
4040 }
4041
4042 static gdouble
up_exported_device_skeleton_get_energy_empty(UpExportedDevice * object)4043 up_exported_device_skeleton_get_energy_empty (UpExportedDevice *object)
4044 {
4045 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4046 gdouble value;
4047 g_mutex_lock (&skeleton->priv->lock);
4048 value = g_value_get_double (&(skeleton->priv->properties[11]));
4049 g_mutex_unlock (&skeleton->priv->lock);
4050 return value;
4051 }
4052
4053 static gdouble
up_exported_device_skeleton_get_energy_full(UpExportedDevice * object)4054 up_exported_device_skeleton_get_energy_full (UpExportedDevice *object)
4055 {
4056 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4057 gdouble value;
4058 g_mutex_lock (&skeleton->priv->lock);
4059 value = g_value_get_double (&(skeleton->priv->properties[12]));
4060 g_mutex_unlock (&skeleton->priv->lock);
4061 return value;
4062 }
4063
4064 static gdouble
up_exported_device_skeleton_get_energy_full_design(UpExportedDevice * object)4065 up_exported_device_skeleton_get_energy_full_design (UpExportedDevice *object)
4066 {
4067 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4068 gdouble value;
4069 g_mutex_lock (&skeleton->priv->lock);
4070 value = g_value_get_double (&(skeleton->priv->properties[13]));
4071 g_mutex_unlock (&skeleton->priv->lock);
4072 return value;
4073 }
4074
4075 static gdouble
up_exported_device_skeleton_get_energy_rate(UpExportedDevice * object)4076 up_exported_device_skeleton_get_energy_rate (UpExportedDevice *object)
4077 {
4078 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4079 gdouble value;
4080 g_mutex_lock (&skeleton->priv->lock);
4081 value = g_value_get_double (&(skeleton->priv->properties[14]));
4082 g_mutex_unlock (&skeleton->priv->lock);
4083 return value;
4084 }
4085
4086 static gdouble
up_exported_device_skeleton_get_voltage(UpExportedDevice * object)4087 up_exported_device_skeleton_get_voltage (UpExportedDevice *object)
4088 {
4089 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4090 gdouble value;
4091 g_mutex_lock (&skeleton->priv->lock);
4092 value = g_value_get_double (&(skeleton->priv->properties[15]));
4093 g_mutex_unlock (&skeleton->priv->lock);
4094 return value;
4095 }
4096
4097 static gdouble
up_exported_device_skeleton_get_luminosity(UpExportedDevice * object)4098 up_exported_device_skeleton_get_luminosity (UpExportedDevice *object)
4099 {
4100 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4101 gdouble value;
4102 g_mutex_lock (&skeleton->priv->lock);
4103 value = g_value_get_double (&(skeleton->priv->properties[16]));
4104 g_mutex_unlock (&skeleton->priv->lock);
4105 return value;
4106 }
4107
4108 static gint64
up_exported_device_skeleton_get_time_to_empty(UpExportedDevice * object)4109 up_exported_device_skeleton_get_time_to_empty (UpExportedDevice *object)
4110 {
4111 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4112 gint64 value;
4113 g_mutex_lock (&skeleton->priv->lock);
4114 value = g_value_get_int64 (&(skeleton->priv->properties[17]));
4115 g_mutex_unlock (&skeleton->priv->lock);
4116 return value;
4117 }
4118
4119 static gint64
up_exported_device_skeleton_get_time_to_full(UpExportedDevice * object)4120 up_exported_device_skeleton_get_time_to_full (UpExportedDevice *object)
4121 {
4122 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4123 gint64 value;
4124 g_mutex_lock (&skeleton->priv->lock);
4125 value = g_value_get_int64 (&(skeleton->priv->properties[18]));
4126 g_mutex_unlock (&skeleton->priv->lock);
4127 return value;
4128 }
4129
4130 static gdouble
up_exported_device_skeleton_get_percentage(UpExportedDevice * object)4131 up_exported_device_skeleton_get_percentage (UpExportedDevice *object)
4132 {
4133 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4134 gdouble value;
4135 g_mutex_lock (&skeleton->priv->lock);
4136 value = g_value_get_double (&(skeleton->priv->properties[19]));
4137 g_mutex_unlock (&skeleton->priv->lock);
4138 return value;
4139 }
4140
4141 static gdouble
up_exported_device_skeleton_get_temperature(UpExportedDevice * object)4142 up_exported_device_skeleton_get_temperature (UpExportedDevice *object)
4143 {
4144 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4145 gdouble value;
4146 g_mutex_lock (&skeleton->priv->lock);
4147 value = g_value_get_double (&(skeleton->priv->properties[20]));
4148 g_mutex_unlock (&skeleton->priv->lock);
4149 return value;
4150 }
4151
4152 static gboolean
up_exported_device_skeleton_get_is_present(UpExportedDevice * object)4153 up_exported_device_skeleton_get_is_present (UpExportedDevice *object)
4154 {
4155 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4156 gboolean value;
4157 g_mutex_lock (&skeleton->priv->lock);
4158 value = g_value_get_boolean (&(skeleton->priv->properties[21]));
4159 g_mutex_unlock (&skeleton->priv->lock);
4160 return value;
4161 }
4162
4163 static guint
up_exported_device_skeleton_get_state(UpExportedDevice * object)4164 up_exported_device_skeleton_get_state (UpExportedDevice *object)
4165 {
4166 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4167 guint value;
4168 g_mutex_lock (&skeleton->priv->lock);
4169 value = g_value_get_uint (&(skeleton->priv->properties[22]));
4170 g_mutex_unlock (&skeleton->priv->lock);
4171 return value;
4172 }
4173
4174 static gboolean
up_exported_device_skeleton_get_is_rechargeable(UpExportedDevice * object)4175 up_exported_device_skeleton_get_is_rechargeable (UpExportedDevice *object)
4176 {
4177 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4178 gboolean value;
4179 g_mutex_lock (&skeleton->priv->lock);
4180 value = g_value_get_boolean (&(skeleton->priv->properties[23]));
4181 g_mutex_unlock (&skeleton->priv->lock);
4182 return value;
4183 }
4184
4185 static gdouble
up_exported_device_skeleton_get_capacity(UpExportedDevice * object)4186 up_exported_device_skeleton_get_capacity (UpExportedDevice *object)
4187 {
4188 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4189 gdouble value;
4190 g_mutex_lock (&skeleton->priv->lock);
4191 value = g_value_get_double (&(skeleton->priv->properties[24]));
4192 g_mutex_unlock (&skeleton->priv->lock);
4193 return value;
4194 }
4195
4196 static guint
up_exported_device_skeleton_get_technology(UpExportedDevice * object)4197 up_exported_device_skeleton_get_technology (UpExportedDevice *object)
4198 {
4199 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4200 guint value;
4201 g_mutex_lock (&skeleton->priv->lock);
4202 value = g_value_get_uint (&(skeleton->priv->properties[25]));
4203 g_mutex_unlock (&skeleton->priv->lock);
4204 return value;
4205 }
4206
4207 static guint
up_exported_device_skeleton_get_warning_level(UpExportedDevice * object)4208 up_exported_device_skeleton_get_warning_level (UpExportedDevice *object)
4209 {
4210 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4211 guint value;
4212 g_mutex_lock (&skeleton->priv->lock);
4213 value = g_value_get_uint (&(skeleton->priv->properties[26]));
4214 g_mutex_unlock (&skeleton->priv->lock);
4215 return value;
4216 }
4217
4218 static guint
up_exported_device_skeleton_get_battery_level(UpExportedDevice * object)4219 up_exported_device_skeleton_get_battery_level (UpExportedDevice *object)
4220 {
4221 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4222 guint value;
4223 g_mutex_lock (&skeleton->priv->lock);
4224 value = g_value_get_uint (&(skeleton->priv->properties[27]));
4225 g_mutex_unlock (&skeleton->priv->lock);
4226 return value;
4227 }
4228
4229 static const gchar *
up_exported_device_skeleton_get_icon_name(UpExportedDevice * object)4230 up_exported_device_skeleton_get_icon_name (UpExportedDevice *object)
4231 {
4232 UpExportedDeviceSkeleton *skeleton = UP_EXPORTED_DEVICE_SKELETON (object);
4233 const gchar *value;
4234 g_mutex_lock (&skeleton->priv->lock);
4235 value = g_value_get_string (&(skeleton->priv->properties[28]));
4236 g_mutex_unlock (&skeleton->priv->lock);
4237 return value;
4238 }
4239
4240 static void
up_exported_device_skeleton_class_init(UpExportedDeviceSkeletonClass * klass)4241 up_exported_device_skeleton_class_init (UpExportedDeviceSkeletonClass *klass)
4242 {
4243 GObjectClass *gobject_class;
4244 GDBusInterfaceSkeletonClass *skeleton_class;
4245
4246 gobject_class = G_OBJECT_CLASS (klass);
4247 gobject_class->finalize = up_exported_device_skeleton_finalize;
4248 gobject_class->get_property = up_exported_device_skeleton_get_property;
4249 gobject_class->set_property = up_exported_device_skeleton_set_property;
4250 gobject_class->notify = up_exported_device_skeleton_notify;
4251
4252
4253 up_exported_device_override_properties (gobject_class, 1);
4254
4255 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4256 skeleton_class->get_info = up_exported_device_skeleton_dbus_interface_get_info;
4257 skeleton_class->get_properties = up_exported_device_skeleton_dbus_interface_get_properties;
4258 skeleton_class->flush = up_exported_device_skeleton_dbus_interface_flush;
4259 skeleton_class->get_vtable = up_exported_device_skeleton_dbus_interface_get_vtable;
4260
4261 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4262 g_type_class_add_private (klass, sizeof (UpExportedDeviceSkeletonPrivate));
4263 #endif
4264 }
4265
4266 static void
up_exported_device_skeleton_iface_init(UpExportedDeviceIface * iface)4267 up_exported_device_skeleton_iface_init (UpExportedDeviceIface *iface)
4268 {
4269 iface->get_native_path = up_exported_device_skeleton_get_native_path;
4270 iface->get_vendor = up_exported_device_skeleton_get_vendor;
4271 iface->get_model = up_exported_device_skeleton_get_model;
4272 iface->get_serial = up_exported_device_skeleton_get_serial;
4273 iface->get_update_time = up_exported_device_skeleton_get_update_time;
4274 iface->get_type_ = up_exported_device_skeleton_get_type_;
4275 iface->get_power_supply = up_exported_device_skeleton_get_power_supply;
4276 iface->get_has_history = up_exported_device_skeleton_get_has_history;
4277 iface->get_has_statistics = up_exported_device_skeleton_get_has_statistics;
4278 iface->get_online = up_exported_device_skeleton_get_online;
4279 iface->get_energy = up_exported_device_skeleton_get_energy;
4280 iface->get_energy_empty = up_exported_device_skeleton_get_energy_empty;
4281 iface->get_energy_full = up_exported_device_skeleton_get_energy_full;
4282 iface->get_energy_full_design = up_exported_device_skeleton_get_energy_full_design;
4283 iface->get_energy_rate = up_exported_device_skeleton_get_energy_rate;
4284 iface->get_voltage = up_exported_device_skeleton_get_voltage;
4285 iface->get_luminosity = up_exported_device_skeleton_get_luminosity;
4286 iface->get_time_to_empty = up_exported_device_skeleton_get_time_to_empty;
4287 iface->get_time_to_full = up_exported_device_skeleton_get_time_to_full;
4288 iface->get_percentage = up_exported_device_skeleton_get_percentage;
4289 iface->get_temperature = up_exported_device_skeleton_get_temperature;
4290 iface->get_is_present = up_exported_device_skeleton_get_is_present;
4291 iface->get_state = up_exported_device_skeleton_get_state;
4292 iface->get_is_rechargeable = up_exported_device_skeleton_get_is_rechargeable;
4293 iface->get_capacity = up_exported_device_skeleton_get_capacity;
4294 iface->get_technology = up_exported_device_skeleton_get_technology;
4295 iface->get_warning_level = up_exported_device_skeleton_get_warning_level;
4296 iface->get_battery_level = up_exported_device_skeleton_get_battery_level;
4297 iface->get_icon_name = up_exported_device_skeleton_get_icon_name;
4298 }
4299
4300 /**
4301 * up_exported_device_skeleton_new:
4302 *
4303 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower-Device.top_of_page">org.freedesktop.UPower.Device</link>.
4304 *
4305 * Returns: (transfer full) (type UpExportedDeviceSkeleton): The skeleton object.
4306 */
4307 UpExportedDevice *
up_exported_device_skeleton_new(void)4308 up_exported_device_skeleton_new (void)
4309 {
4310 return UP_EXPORTED_DEVICE (g_object_new (UP_TYPE_EXPORTED_DEVICE_SKELETON, NULL));
4311 }
4312
4313