2 * Generated by gdbus-codegen 2.32.1. DO NOT EDIT.
4 * The license of this code is the same as for the source it was derived from.
11 #include "bluetoothserialproxy.h"
14 # include <gio/gunixfdlist.h>
19 GDBusArgInfo parent_struct;
20 gboolean use_gvariant;
21 } _ExtendedGDBusArgInfo;
25 GDBusMethodInfo parent_struct;
26 const gchar *signal_name;
28 } _ExtendedGDBusMethodInfo;
32 GDBusSignalInfo parent_struct;
33 const gchar *signal_name;
34 } _ExtendedGDBusSignalInfo;
38 GDBusPropertyInfo parent_struct;
39 const gchar *hyphen_name;
40 gboolean use_gvariant;
41 } _ExtendedGDBusPropertyInfo;
45 GDBusInterfaceInfo parent_struct;
46 const gchar *hyphen_name;
47 } _ExtendedGDBusInterfaceInfo;
51 const _ExtendedGDBusPropertyInfo *info;
53 GValue orig_value; /* the value before the change */
57 _changed_property_free (ChangedProperty *data)
59 g_value_unset (&data->orig_value);
64 _g_strv_equal0 (gchar **a, gchar **b)
68 if (a == NULL && b == NULL)
73 if (a == NULL || b == NULL)
75 if (g_strv_length (a) != g_strv_length (b))
77 for (n = 0; a[n] != NULL; n++)
78 if (g_strcmp0 (a[n], b[n]) != 0)
86 _g_variant_equal0 (GVariant *a, GVariant *b)
89 if (a == NULL && b == NULL)
94 if (a == NULL || b == NULL)
96 ret = g_variant_equal (a, b);
101 G_GNUC_UNUSED static gboolean
102 _g_value_equal (const GValue *a, const GValue *b)
104 gboolean ret = FALSE;
105 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
106 switch (G_VALUE_TYPE (a))
109 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
112 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
115 ret = (g_value_get_int (a) == g_value_get_int (b));
118 ret = (g_value_get_uint (a) == g_value_get_uint (b));
121 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
124 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
127 ret = (g_value_get_double (a) == g_value_get_double (b));
130 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
133 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
136 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
137 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
139 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
145 /* ------------------------------------------------------------------------
146 * Code for interface org.bluez.Serial
147 * ------------------------------------------------------------------------
151 * SECTION:OrgBluezSerial
152 * @title: OrgBluezSerial
153 * @short_description: Generated C code for the org.bluez.Serial D-Bus interface
155 * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link> D-Bus interface in C.
158 /* ---- Introspection data for org.bluez.Serial ---- */
160 static const _ExtendedGDBusArgInfo _org_bluez_serial_method_info_connect_IN_ARG_unnamed_arg0 =
171 static const _ExtendedGDBusArgInfo * const _org_bluez_serial_method_info_connect_IN_ARG_pointers[] =
173 &_org_bluez_serial_method_info_connect_IN_ARG_unnamed_arg0,
177 static const _ExtendedGDBusArgInfo _org_bluez_serial_method_info_connect_OUT_ARG_unnamed_arg1 =
188 static const _ExtendedGDBusArgInfo * const _org_bluez_serial_method_info_connect_OUT_ARG_pointers[] =
190 &_org_bluez_serial_method_info_connect_OUT_ARG_unnamed_arg1,
194 static const _ExtendedGDBusMethodInfo _org_bluez_serial_method_info_connect =
199 (GDBusArgInfo **) &_org_bluez_serial_method_info_connect_IN_ARG_pointers,
200 (GDBusArgInfo **) &_org_bluez_serial_method_info_connect_OUT_ARG_pointers,
207 static const _ExtendedGDBusArgInfo _org_bluez_serial_method_info_connect_fd_IN_ARG_unnamed_arg0 =
218 static const _ExtendedGDBusArgInfo * const _org_bluez_serial_method_info_connect_fd_IN_ARG_pointers[] =
220 &_org_bluez_serial_method_info_connect_fd_IN_ARG_unnamed_arg0,
224 static const _ExtendedGDBusArgInfo _org_bluez_serial_method_info_connect_fd_OUT_ARG_unnamed_arg1 =
235 static const _ExtendedGDBusArgInfo * const _org_bluez_serial_method_info_connect_fd_OUT_ARG_pointers[] =
237 &_org_bluez_serial_method_info_connect_fd_OUT_ARG_unnamed_arg1,
241 static const _ExtendedGDBusMethodInfo _org_bluez_serial_method_info_connect_fd =
246 (GDBusArgInfo **) &_org_bluez_serial_method_info_connect_fd_IN_ARG_pointers,
247 (GDBusArgInfo **) &_org_bluez_serial_method_info_connect_fd_OUT_ARG_pointers,
254 static const _ExtendedGDBusArgInfo _org_bluez_serial_method_info_disconnect_IN_ARG_unnamed_arg0 =
265 static const _ExtendedGDBusArgInfo * const _org_bluez_serial_method_info_disconnect_IN_ARG_pointers[] =
267 &_org_bluez_serial_method_info_disconnect_IN_ARG_unnamed_arg0,
271 static const _ExtendedGDBusMethodInfo _org_bluez_serial_method_info_disconnect =
276 (GDBusArgInfo **) &_org_bluez_serial_method_info_disconnect_IN_ARG_pointers,
284 static const _ExtendedGDBusMethodInfo * const _org_bluez_serial_method_info_pointers[] =
286 &_org_bluez_serial_method_info_connect,
287 &_org_bluez_serial_method_info_connect_fd,
288 &_org_bluez_serial_method_info_disconnect,
292 static const _ExtendedGDBusInterfaceInfo _org_bluez_serial_interface_info =
297 (GDBusMethodInfo **) &_org_bluez_serial_method_info_pointers,
307 * org_bluez_serial_interface_info:
309 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link> D-Bus interface.
311 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
314 org_bluez_serial_interface_info (void)
316 return (GDBusInterfaceInfo *) &_org_bluez_serial_interface_info;
320 * org_bluez_serial_override_properties:
321 * @klass: The class structure for a #GObject<!-- -->-derived class.
322 * @property_id_begin: The property id to assign to the first overridden property.
324 * Overrides all #GObject properties in the #OrgBluezSerial interface for a concrete class.
325 * The properties are overridden in the order they are defined.
327 * Returns: The last property id.
330 org_bluez_serial_override_properties (GObjectClass *klass, guint property_id_begin)
332 return property_id_begin - 1;
340 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link>.
344 * OrgBluezSerialIface:
345 * @parent_iface: The parent interface.
346 * @handle_connect: Handler for the #OrgBluezSerial::handle-connect signal.
347 * @handle_connect_fd: Handler for the #OrgBluezSerial::handle-connect-fd signal.
348 * @handle_disconnect: Handler for the #OrgBluezSerial::handle-disconnect signal.
350 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link>.
354 org_bluez_serial_default_init (OrgBluezSerialIface *iface)
356 /* GObject signals for incoming D-Bus method calls: */
358 * OrgBluezSerial::handle-connect:
359 * @object: A #OrgBluezSerial.
360 * @invocation: A #GDBusMethodInvocation.
361 * @arg_unnamed_arg0: Argument passed by remote caller.
363 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Serial.Connect">Connect()</link> D-Bus method.
365 * 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 org_bluez_serial_complete_connect() 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.
367 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
369 g_signal_new ("handle-connect",
370 G_TYPE_FROM_INTERFACE (iface),
372 G_STRUCT_OFFSET (OrgBluezSerialIface, handle_connect),
373 g_signal_accumulator_true_handled,
375 g_cclosure_marshal_generic,
378 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
381 * OrgBluezSerial::handle-connect-fd:
382 * @object: A #OrgBluezSerial.
383 * @invocation: A #GDBusMethodInvocation.
384 * @arg_unnamed_arg0: Argument passed by remote caller.
386 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Serial.ConnectFD">ConnectFD()</link> D-Bus method.
388 * 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 org_bluez_serial_complete_connect_fd() 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.
390 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
392 g_signal_new ("handle-connect-fd",
393 G_TYPE_FROM_INTERFACE (iface),
395 G_STRUCT_OFFSET (OrgBluezSerialIface, handle_connect_fd),
396 g_signal_accumulator_true_handled,
398 g_cclosure_marshal_generic,
401 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
404 * OrgBluezSerial::handle-disconnect:
405 * @object: A #OrgBluezSerial.
406 * @invocation: A #GDBusMethodInvocation.
407 * @arg_unnamed_arg0: Argument passed by remote caller.
409 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Serial.Disconnect">Disconnect()</link> D-Bus method.
411 * 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 org_bluez_serial_complete_disconnect() 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.
413 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
415 g_signal_new ("handle-disconnect",
416 G_TYPE_FROM_INTERFACE (iface),
418 G_STRUCT_OFFSET (OrgBluezSerialIface, handle_disconnect),
419 g_signal_accumulator_true_handled,
421 g_cclosure_marshal_generic,
424 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
428 typedef OrgBluezSerialIface OrgBluezSerialInterface;
429 G_DEFINE_INTERFACE (OrgBluezSerial, org_bluez_serial, G_TYPE_OBJECT);
432 * org_bluez_serial_call_connect:
433 * @proxy: A #OrgBluezSerialProxy.
434 * @arg_unnamed_arg0: Argument to pass with the method invocation.
435 * @cancellable: (allow-none): A #GCancellable or %NULL.
436 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
437 * @user_data: User data to pass to @callback.
439 * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.Connect">Connect()</link> D-Bus method on @proxy.
440 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
441 * You can then call org_bluez_serial_call_connect_finish() to get the result of the operation.
443 * See org_bluez_serial_call_connect_sync() for the synchronous, blocking version of this method.
446 org_bluez_serial_call_connect (
447 OrgBluezSerial *proxy,
448 const gchar *arg_unnamed_arg0,
449 GCancellable *cancellable,
450 GAsyncReadyCallback callback,
453 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
455 g_variant_new ("(s)",
457 G_DBUS_CALL_FLAGS_NONE,
465 * org_bluez_serial_call_connect_finish:
466 * @proxy: A #OrgBluezSerialProxy.
467 * @out_unnamed_arg1: (out): Return location for return parameter or %NULL to ignore.
468 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_bluez_serial_call_connect().
469 * @error: Return location for error or %NULL.
471 * Finishes an operation started with org_bluez_serial_call_connect().
473 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
476 org_bluez_serial_call_connect_finish (
477 OrgBluezSerial *proxy,
478 gchar **out_unnamed_arg1,
483 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
489 g_variant_unref (_ret);
495 * org_bluez_serial_call_connect_sync:
496 * @proxy: A #OrgBluezSerialProxy.
497 * @arg_unnamed_arg0: Argument to pass with the method invocation.
498 * @out_unnamed_arg1: (out): Return location for return parameter or %NULL to ignore.
499 * @cancellable: (allow-none): A #GCancellable or %NULL.
500 * @error: Return location for error or %NULL.
502 * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.Connect">Connect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
504 * See org_bluez_serial_call_connect() for the asynchronous version of this method.
506 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
509 org_bluez_serial_call_connect_sync (
510 OrgBluezSerial *proxy,
511 const gchar *arg_unnamed_arg0,
512 gchar **out_unnamed_arg1,
513 GCancellable *cancellable,
517 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
519 g_variant_new ("(s)",
521 G_DBUS_CALL_FLAGS_NONE,
530 g_variant_unref (_ret);
536 * org_bluez_serial_call_connect_fd:
537 * @proxy: A #OrgBluezSerialProxy.
538 * @arg_unnamed_arg0: Argument to pass with the method invocation.
539 * @cancellable: (allow-none): A #GCancellable or %NULL.
540 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
541 * @user_data: User data to pass to @callback.
543 * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.ConnectFD">ConnectFD()</link> D-Bus method on @proxy.
544 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
545 * You can then call org_bluez_serial_call_connect_fd_finish() to get the result of the operation.
547 * See org_bluez_serial_call_connect_fd_sync() for the synchronous, blocking version of this method.
550 org_bluez_serial_call_connect_fd (
551 OrgBluezSerial *proxy,
552 const gchar *arg_unnamed_arg0,
553 GCancellable *cancellable,
554 GAsyncReadyCallback callback,
557 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
559 g_variant_new ("(s)",
561 G_DBUS_CALL_FLAGS_NONE,
569 * org_bluez_serial_call_connect_fd_finish:
570 * @proxy: A #OrgBluezSerialProxy.
571 * @out_unnamed_arg1: (out): Return location for return parameter or %NULL to ignore.
572 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_bluez_serial_call_connect_fd().
573 * @error: Return location for error or %NULL.
575 * Finishes an operation started with org_bluez_serial_call_connect_fd().
577 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
580 org_bluez_serial_call_connect_fd_finish (
581 OrgBluezSerial *proxy,
582 GVariant **out_unnamed_arg1,
587 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
593 g_variant_unref (_ret);
599 * org_bluez_serial_call_connect_fd_sync:
600 * @proxy: A #OrgBluezSerialProxy.
601 * @arg_unnamed_arg0: Argument to pass with the method invocation.
602 * @out_unnamed_arg1: (out): Return location for return parameter or %NULL to ignore.
603 * @cancellable: (allow-none): A #GCancellable or %NULL.
604 * @error: Return location for error or %NULL.
606 * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.ConnectFD">ConnectFD()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
608 * See org_bluez_serial_call_connect_fd() for the asynchronous version of this method.
610 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
613 org_bluez_serial_call_connect_fd_sync (
614 OrgBluezSerial *proxy,
615 const gchar *arg_unnamed_arg0,
616 GVariant **out_unnamed_arg1,
617 GCancellable *cancellable,
621 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
623 g_variant_new ("(s)",
625 G_DBUS_CALL_FLAGS_NONE,
634 g_variant_unref (_ret);
640 * org_bluez_serial_call_disconnect:
641 * @proxy: A #OrgBluezSerialProxy.
642 * @arg_unnamed_arg0: Argument to pass with the method invocation.
643 * @cancellable: (allow-none): A #GCancellable or %NULL.
644 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
645 * @user_data: User data to pass to @callback.
647 * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.Disconnect">Disconnect()</link> D-Bus method on @proxy.
648 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
649 * You can then call org_bluez_serial_call_disconnect_finish() to get the result of the operation.
651 * See org_bluez_serial_call_disconnect_sync() for the synchronous, blocking version of this method.
654 org_bluez_serial_call_disconnect (
655 OrgBluezSerial *proxy,
656 const gchar *arg_unnamed_arg0,
657 GCancellable *cancellable,
658 GAsyncReadyCallback callback,
661 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
663 g_variant_new ("(s)",
665 G_DBUS_CALL_FLAGS_NONE,
673 * org_bluez_serial_call_disconnect_finish:
674 * @proxy: A #OrgBluezSerialProxy.
675 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_bluez_serial_call_disconnect().
676 * @error: Return location for error or %NULL.
678 * Finishes an operation started with org_bluez_serial_call_disconnect().
680 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
683 org_bluez_serial_call_disconnect_finish (
684 OrgBluezSerial *proxy,
689 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
694 g_variant_unref (_ret);
700 * org_bluez_serial_call_disconnect_sync:
701 * @proxy: A #OrgBluezSerialProxy.
702 * @arg_unnamed_arg0: Argument to pass with the method invocation.
703 * @cancellable: (allow-none): A #GCancellable or %NULL.
704 * @error: Return location for error or %NULL.
706 * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Serial.Disconnect">Disconnect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
708 * See org_bluez_serial_call_disconnect() for the asynchronous version of this method.
710 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
713 org_bluez_serial_call_disconnect_sync (
714 OrgBluezSerial *proxy,
715 const gchar *arg_unnamed_arg0,
716 GCancellable *cancellable,
720 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
722 g_variant_new ("(s)",
724 G_DBUS_CALL_FLAGS_NONE,
732 g_variant_unref (_ret);
738 * org_bluez_serial_complete_connect:
739 * @object: A #OrgBluezSerial.
740 * @invocation: (transfer full): A #GDBusMethodInvocation.
741 * @unnamed_arg1: Parameter to return.
743 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Serial.Connect">Connect()</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.
745 * This method will free @invocation, you cannot use it afterwards.
748 org_bluez_serial_complete_connect (
749 OrgBluezSerial *object,
750 GDBusMethodInvocation *invocation,
751 const gchar *unnamed_arg1)
753 g_dbus_method_invocation_return_value (invocation,
754 g_variant_new ("(s)",
759 * org_bluez_serial_complete_connect_fd:
760 * @object: A #OrgBluezSerial.
761 * @invocation: (transfer full): A #GDBusMethodInvocation.
762 * @unnamed_arg1: Parameter to return.
764 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Serial.ConnectFD">ConnectFD()</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.
766 * This method will free @invocation, you cannot use it afterwards.
769 org_bluez_serial_complete_connect_fd (
770 OrgBluezSerial *object,
771 GDBusMethodInvocation *invocation,
772 GVariant *unnamed_arg1)
774 g_dbus_method_invocation_return_value (invocation,
775 g_variant_new ("(@h)",
780 * org_bluez_serial_complete_disconnect:
781 * @object: A #OrgBluezSerial.
782 * @invocation: (transfer full): A #GDBusMethodInvocation.
784 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Serial.Disconnect">Disconnect()</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.
786 * This method will free @invocation, you cannot use it afterwards.
789 org_bluez_serial_complete_disconnect (
790 OrgBluezSerial *object,
791 GDBusMethodInvocation *invocation)
793 g_dbus_method_invocation_return_value (invocation,
794 g_variant_new ("()"));
797 /* ------------------------------------------------------------------------ */
800 * OrgBluezSerialProxy:
802 * The #OrgBluezSerialProxy structure contains only private data and should only be accessed using the provided API.
806 * OrgBluezSerialProxyClass:
807 * @parent_class: The parent class.
809 * Class structure for #OrgBluezSerialProxy.
812 struct _OrgBluezSerialProxyPrivate
817 static void org_bluez_serial_proxy_iface_init (OrgBluezSerialIface *iface);
819 G_DEFINE_TYPE_WITH_CODE (OrgBluezSerialProxy, org_bluez_serial_proxy, G_TYPE_DBUS_PROXY,
820 G_IMPLEMENT_INTERFACE (TYPE_ORG_BLUEZ_SERIAL, org_bluez_serial_proxy_iface_init));
823 org_bluez_serial_proxy_finalize (GObject *object)
825 OrgBluezSerialProxy *proxy = ORG_BLUEZ_SERIAL_PROXY (object);
826 g_datalist_clear (&proxy->priv->qdata);
827 G_OBJECT_CLASS (org_bluez_serial_proxy_parent_class)->finalize (object);
831 org_bluez_serial_proxy_get_property (GObject *object,
839 org_bluez_serial_proxy_set_property (GObject *object,
847 org_bluez_serial_proxy_g_signal (GDBusProxy *proxy,
848 const gchar *sender_name,
849 const gchar *signal_name,
850 GVariant *parameters)
852 _ExtendedGDBusSignalInfo *info;
859 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_org_bluez_serial_interface_info, signal_name);
862 num_params = g_variant_n_children (parameters);
863 paramv = g_new0 (GValue, num_params + 1);
864 g_value_init (¶mv[0], TYPE_ORG_BLUEZ_SERIAL);
865 g_value_set_object (¶mv[0], proxy);
866 g_variant_iter_init (&iter, parameters);
868 while ((child = g_variant_iter_next_value (&iter)) != NULL)
870 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
871 if (arg_info->use_gvariant)
873 g_value_init (¶mv[n], G_TYPE_VARIANT);
874 g_value_set_variant (¶mv[n], child);
878 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
879 g_variant_unref (child);
881 signal_id = g_signal_lookup (info->signal_name, TYPE_ORG_BLUEZ_SERIAL);
882 g_signal_emitv (paramv, signal_id, 0, NULL);
883 for (n = 0; n < num_params + 1; n++)
884 g_value_unset (¶mv[n]);
889 org_bluez_serial_proxy_g_properties_changed (GDBusProxy *_proxy,
890 GVariant *changed_properties,
891 const gchar *const *invalidated_properties)
893 OrgBluezSerialProxy *proxy = ORG_BLUEZ_SERIAL_PROXY (_proxy);
897 _ExtendedGDBusPropertyInfo *info;
898 g_variant_get (changed_properties, "a{sv}", &iter);
899 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
901 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_bluez_serial_interface_info, key);
902 g_datalist_remove_data (&proxy->priv->qdata, key);
904 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
906 g_variant_iter_free (iter);
907 for (n = 0; invalidated_properties[n] != NULL; n++)
909 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_bluez_serial_interface_info, invalidated_properties[n]);
910 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
912 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
917 org_bluez_serial_proxy_init (OrgBluezSerialProxy *proxy)
919 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ORG_BLUEZ_SERIAL_PROXY, OrgBluezSerialProxyPrivate);
920 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), org_bluez_serial_interface_info ());
924 org_bluez_serial_proxy_class_init (OrgBluezSerialProxyClass *klass)
926 GObjectClass *gobject_class;
927 GDBusProxyClass *proxy_class;
929 g_type_class_add_private (klass, sizeof (OrgBluezSerialProxyPrivate));
931 gobject_class = G_OBJECT_CLASS (klass);
932 gobject_class->finalize = org_bluez_serial_proxy_finalize;
933 gobject_class->get_property = org_bluez_serial_proxy_get_property;
934 gobject_class->set_property = org_bluez_serial_proxy_set_property;
936 proxy_class = G_DBUS_PROXY_CLASS (klass);
937 proxy_class->g_signal = org_bluez_serial_proxy_g_signal;
938 proxy_class->g_properties_changed = org_bluez_serial_proxy_g_properties_changed;
943 org_bluez_serial_proxy_iface_init (OrgBluezSerialIface *iface)
948 * org_bluez_serial_proxy_new:
949 * @connection: A #GDBusConnection.
950 * @flags: Flags from the #GDBusProxyFlags enumeration.
951 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
952 * @object_path: An object path.
953 * @cancellable: (allow-none): A #GCancellable or %NULL.
954 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
955 * @user_data: User data to pass to @callback.
957 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link>. See g_dbus_proxy_new() for more details.
959 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
960 * You can then call org_bluez_serial_proxy_new_finish() to get the result of the operation.
962 * See org_bluez_serial_proxy_new_sync() for the synchronous, blocking version of this constructor.
965 org_bluez_serial_proxy_new (
966 GDBusConnection *connection,
967 GDBusProxyFlags flags,
969 const gchar *object_path,
970 GCancellable *cancellable,
971 GAsyncReadyCallback callback,
974 g_async_initable_new_async (TYPE_ORG_BLUEZ_SERIAL_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.bluez.Serial", NULL);
978 * org_bluez_serial_proxy_new_finish:
979 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_bluez_serial_proxy_new().
980 * @error: Return location for error or %NULL
982 * Finishes an operation started with org_bluez_serial_proxy_new().
984 * Returns: (transfer full) (type OrgBluezSerialProxy): The constructed proxy object or %NULL if @error is set.
987 org_bluez_serial_proxy_new_finish (
992 GObject *source_object;
993 source_object = g_async_result_get_source_object (res);
994 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
995 g_object_unref (source_object);
997 return ORG_BLUEZ_SERIAL (ret);
1003 * org_bluez_serial_proxy_new_sync:
1004 * @connection: A #GDBusConnection.
1005 * @flags: Flags from the #GDBusProxyFlags enumeration.
1006 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1007 * @object_path: An object path.
1008 * @cancellable: (allow-none): A #GCancellable or %NULL.
1009 * @error: Return location for error or %NULL
1011 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link>. See g_dbus_proxy_new_sync() for more details.
1013 * The calling thread is blocked until a reply is received.
1015 * See org_bluez_serial_proxy_new() for the asynchronous version of this constructor.
1017 * Returns: (transfer full) (type OrgBluezSerialProxy): The constructed proxy object or %NULL if @error is set.
1020 org_bluez_serial_proxy_new_sync (
1021 GDBusConnection *connection,
1022 GDBusProxyFlags flags,
1024 const gchar *object_path,
1025 GCancellable *cancellable,
1029 ret = g_initable_new (TYPE_ORG_BLUEZ_SERIAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Serial", NULL);
1031 return ORG_BLUEZ_SERIAL (ret);
1038 * org_bluez_serial_proxy_new_for_bus:
1039 * @bus_type: A #GBusType.
1040 * @flags: Flags from the #GDBusProxyFlags enumeration.
1041 * @name: A bus name (well-known or unique).
1042 * @object_path: An object path.
1043 * @cancellable: (allow-none): A #GCancellable or %NULL.
1044 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1045 * @user_data: User data to pass to @callback.
1047 * Like org_bluez_serial_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1049 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1050 * You can then call org_bluez_serial_proxy_new_for_bus_finish() to get the result of the operation.
1052 * See org_bluez_serial_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1055 org_bluez_serial_proxy_new_for_bus (
1057 GDBusProxyFlags flags,
1059 const gchar *object_path,
1060 GCancellable *cancellable,
1061 GAsyncReadyCallback callback,
1064 g_async_initable_new_async (TYPE_ORG_BLUEZ_SERIAL_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.bluez.Serial", NULL);
1068 * org_bluez_serial_proxy_new_for_bus_finish:
1069 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_bluez_serial_proxy_new_for_bus().
1070 * @error: Return location for error or %NULL
1072 * Finishes an operation started with org_bluez_serial_proxy_new_for_bus().
1074 * Returns: (transfer full) (type OrgBluezSerialProxy): The constructed proxy object or %NULL if @error is set.
1077 org_bluez_serial_proxy_new_for_bus_finish (
1082 GObject *source_object;
1083 source_object = g_async_result_get_source_object (res);
1084 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1085 g_object_unref (source_object);
1087 return ORG_BLUEZ_SERIAL (ret);
1093 * org_bluez_serial_proxy_new_for_bus_sync:
1094 * @bus_type: A #GBusType.
1095 * @flags: Flags from the #GDBusProxyFlags enumeration.
1096 * @name: A bus name (well-known or unique).
1097 * @object_path: An object path.
1098 * @cancellable: (allow-none): A #GCancellable or %NULL.
1099 * @error: Return location for error or %NULL
1101 * Like org_bluez_serial_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1103 * The calling thread is blocked until a reply is received.
1105 * See org_bluez_serial_proxy_new_for_bus() for the asynchronous version of this constructor.
1107 * Returns: (transfer full) (type OrgBluezSerialProxy): The constructed proxy object or %NULL if @error is set.
1110 org_bluez_serial_proxy_new_for_bus_sync (
1112 GDBusProxyFlags flags,
1114 const gchar *object_path,
1115 GCancellable *cancellable,
1119 ret = g_initable_new (TYPE_ORG_BLUEZ_SERIAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Serial", NULL);
1121 return ORG_BLUEZ_SERIAL (ret);
1127 /* ------------------------------------------------------------------------ */
1130 * OrgBluezSerialSkeleton:
1132 * The #OrgBluezSerialSkeleton structure contains only private data and should only be accessed using the provided API.
1136 * OrgBluezSerialSkeletonClass:
1137 * @parent_class: The parent class.
1139 * Class structure for #OrgBluezSerialSkeleton.
1142 struct _OrgBluezSerialSkeletonPrivate
1145 GList *changed_properties;
1146 GSource *changed_properties_idle_source;
1147 GMainContext *context;
1152 _org_bluez_serial_skeleton_handle_method_call (
1153 GDBusConnection *connection,
1154 const gchar *sender,
1155 const gchar *object_path,
1156 const gchar *interface_name,
1157 const gchar *method_name,
1158 GVariant *parameters,
1159 GDBusMethodInvocation *invocation,
1162 OrgBluezSerialSkeleton *skeleton = ORG_BLUEZ_SERIAL_SKELETON (user_data);
1163 _ExtendedGDBusMethodInfo *info;
1171 GValue return_value = G_VALUE_INIT;
1172 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1173 g_assert (info != NULL);
1174 num_params = g_variant_n_children (parameters);
1175 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1177 g_value_init (¶mv[n], TYPE_ORG_BLUEZ_SERIAL);
1178 g_value_set_object (¶mv[n++], skeleton);
1179 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1180 g_value_set_object (¶mv[n++], invocation);
1181 if (info->pass_fdlist)
1184 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1185 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1187 g_assert_not_reached ();
1190 g_variant_iter_init (&iter, parameters);
1191 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1193 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1194 if (arg_info->use_gvariant)
1196 g_value_init (¶mv[n], G_TYPE_VARIANT);
1197 g_value_set_variant (¶mv[n], child);
1201 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1202 g_variant_unref (child);
1204 signal_id = g_signal_lookup (info->signal_name, TYPE_ORG_BLUEZ_SERIAL);
1205 g_value_init (&return_value, G_TYPE_BOOLEAN);
1206 g_signal_emitv (paramv, signal_id, 0, &return_value);
1207 if (!g_value_get_boolean (&return_value))
1208 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);
1209 g_value_unset (&return_value);
1210 for (n = 0; n < num_params + num_extra; n++)
1211 g_value_unset (¶mv[n]);
1216 _org_bluez_serial_skeleton_handle_get_property (
1217 GDBusConnection *connection,
1218 const gchar *sender,
1219 const gchar *object_path,
1220 const gchar *interface_name,
1221 const gchar *property_name,
1225 OrgBluezSerialSkeleton *skeleton = ORG_BLUEZ_SERIAL_SKELETON (user_data);
1226 GValue value = G_VALUE_INIT;
1228 _ExtendedGDBusPropertyInfo *info;
1231 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_bluez_serial_interface_info, property_name);
1232 g_assert (info != NULL);
1233 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1236 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1240 g_value_init (&value, pspec->value_type);
1241 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1242 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1243 g_value_unset (&value);
1249 _org_bluez_serial_skeleton_handle_set_property (
1250 GDBusConnection *connection,
1251 const gchar *sender,
1252 const gchar *object_path,
1253 const gchar *interface_name,
1254 const gchar *property_name,
1259 OrgBluezSerialSkeleton *skeleton = ORG_BLUEZ_SERIAL_SKELETON (user_data);
1260 GValue value = G_VALUE_INIT;
1262 _ExtendedGDBusPropertyInfo *info;
1265 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_bluez_serial_interface_info, property_name);
1266 g_assert (info != NULL);
1267 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1270 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1274 if (info->use_gvariant)
1275 g_value_set_variant (&value, variant);
1277 g_dbus_gvariant_to_gvalue (variant, &value);
1278 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1279 g_value_unset (&value);
1285 static const GDBusInterfaceVTable _org_bluez_serial_skeleton_vtable =
1287 _org_bluez_serial_skeleton_handle_method_call,
1288 _org_bluez_serial_skeleton_handle_get_property,
1289 _org_bluez_serial_skeleton_handle_set_property
1292 static GDBusInterfaceInfo *
1293 org_bluez_serial_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)
1295 return org_bluez_serial_interface_info ();
1298 static GDBusInterfaceVTable *
1299 org_bluez_serial_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)
1301 return (GDBusInterfaceVTable *) &_org_bluez_serial_skeleton_vtable;
1305 org_bluez_serial_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1307 OrgBluezSerialSkeleton *skeleton = ORG_BLUEZ_SERIAL_SKELETON (_skeleton);
1309 GVariantBuilder builder;
1311 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1312 if (_org_bluez_serial_interface_info.parent_struct.properties == NULL)
1314 for (n = 0; _org_bluez_serial_interface_info.parent_struct.properties[n] != NULL; n++)
1316 GDBusPropertyInfo *info = _org_bluez_serial_interface_info.parent_struct.properties[n];
1317 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1320 value = _org_bluez_serial_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.bluez.Serial", info->name, NULL, skeleton);
1323 g_variant_take_ref (value);
1324 g_variant_builder_add (&builder, "{sv}", info->name, value);
1325 g_variant_unref (value);
1330 return g_variant_builder_end (&builder);
1334 org_bluez_serial_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1338 static void org_bluez_serial_skeleton_iface_init (OrgBluezSerialIface *iface);
1339 G_DEFINE_TYPE_WITH_CODE (OrgBluezSerialSkeleton, org_bluez_serial_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1340 G_IMPLEMENT_INTERFACE (TYPE_ORG_BLUEZ_SERIAL, org_bluez_serial_skeleton_iface_init));
1343 org_bluez_serial_skeleton_finalize (GObject *object)
1345 OrgBluezSerialSkeleton *skeleton = ORG_BLUEZ_SERIAL_SKELETON (object);
1346 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1347 if (skeleton->priv->changed_properties_idle_source != NULL)
1348 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1349 g_main_context_unref (skeleton->priv->context);
1350 g_mutex_clear (&skeleton->priv->lock);
1351 G_OBJECT_CLASS (org_bluez_serial_skeleton_parent_class)->finalize (object);
1355 org_bluez_serial_skeleton_init (OrgBluezSerialSkeleton *skeleton)
1357 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ORG_BLUEZ_SERIAL_SKELETON, OrgBluezSerialSkeletonPrivate);
1358 g_mutex_init (&skeleton->priv->lock);
1359 skeleton->priv->context = g_main_context_ref_thread_default ();
1363 org_bluez_serial_skeleton_class_init (OrgBluezSerialSkeletonClass *klass)
1365 GObjectClass *gobject_class;
1366 GDBusInterfaceSkeletonClass *skeleton_class;
1368 g_type_class_add_private (klass, sizeof (OrgBluezSerialSkeletonPrivate));
1370 gobject_class = G_OBJECT_CLASS (klass);
1371 gobject_class->finalize = org_bluez_serial_skeleton_finalize;
1373 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1374 skeleton_class->get_info = org_bluez_serial_skeleton_dbus_interface_get_info;
1375 skeleton_class->get_properties = org_bluez_serial_skeleton_dbus_interface_get_properties;
1376 skeleton_class->flush = org_bluez_serial_skeleton_dbus_interface_flush;
1377 skeleton_class->get_vtable = org_bluez_serial_skeleton_dbus_interface_get_vtable;
1381 org_bluez_serial_skeleton_iface_init (OrgBluezSerialIface *iface)
1386 * org_bluez_serial_skeleton_new:
1388 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Serial.top_of_page">org.bluez.Serial</link>.
1390 * Returns: (transfer full) (type OrgBluezSerialSkeleton): The skeleton object.
1393 org_bluez_serial_skeleton_new (void)
1395 return ORG_BLUEZ_SERIAL (g_object_new (TYPE_ORG_BLUEZ_SERIAL_SKELETON, NULL));